More portability tweaks.

Fix compiler warnings.
This commit is contained in:
Moinak Ghosh 2014-05-04 13:32:11 +05:30
parent 4b037f0ed7
commit 4a9cd8c48e
6 changed files with 47 additions and 18 deletions

View file

@ -167,6 +167,7 @@ SHA2ASM_OBJS = $(SHA2ASM_SRCS:.asm=.o)
SHA2_OBJS = $(SHA2_SRCS:.c=.o)
YASM = @YASM@
YASM_GAS = @YASM_GAS@
LIBBSCWRAP = libbsc_compress.c
LIBBSCWRAPOBJ = libbsc_compress.o
LIBBSCDIR = @LIBBSCDIR@
@ -204,7 +205,7 @@ KECCAK_OBJS = $(KECCAK_SRCS:.c=.o)
KECCAK_OBJS_ASM = $(KECCAK_SRCS_ASM:.s=.o)
CRYPTO_ASM_COMPILE1 = $(COMPILE) $(GEN_OPT) $(CRYPTO_CPPFLAGS) $(CPPFLAGS)
CRYPTO_ASM_COMPILE2 = $(YASM)
CRYPTO_ASM_COMPILE2 = $(YASM_GAS)
CRYPTO_ASM_COMPILE = @CRYPTO_ASM_COMPILE@
BAKFILES = *~ lzma/*~ lzfx/*~ lz4/*~ rabin/*~ bsdiff/*~ filters/lzp/*~ utils/*~ crypto/sha2/*~ \
@ -226,9 +227,11 @@ COMMON_CPPFLAGS = $(BASE_CPPFLAGS) -std=gnu99
COMMON_CPPFLAGS_cpp = $(BASE_CPPFLAGS)
COMMON_VEC_FLAGS = -ftree-vectorize
COMMON_LOOP_OPTFLAGS = $(VEC_FLAGS) -floop-interchange -floop-block
LDLIBS = -ldl -L./buildtmp -Wl,-R@LIBBZ2_DIR@ -lbz2 -L./buildtmp -Wl,-R@LIBZ_DIR@ -lz -lm @LIBBSCLFLAGS@ \
-L./buildtmp -Wl,-R@OPENSSL_LIBDIR@ -lcrypto -lrt -Wl,-R@LIBARCHIVE_DIR@ -larchive $(EXTRA_LDFLAGS) \
-Wl,-R/usr/lib,--enable-new-dtags -Wl,-R/usr/lib64,--enable-new-dtags
RPATH=@RPATH@
DTAGS=@DTAGS@
LDLIBS = -ldl -L./buildtmp -Wl,$(RPATH)@LIBBZ2_DIR@ -lbz2 -L./buildtmp -Wl,$(RPATH)@LIBZ_DIR@ -lz -lm @LIBBSCLFLAGS@ \
-L./buildtmp -Wl,$(RPATH)@OPENSSL_LIBDIR@ -lcrypto @LRT@ -Wl,$(RPATH)@LIBARCHIVE_DIR@ -larchive $(EXTRA_LDFLAGS) \
-Wl,$(RPATH)/usr/lib$(DTAGS) -Wl,$(RPATH)/usr/lib64$(DTAGS)
OBJS = $(MAINOBJS) $(LZMAOBJS) $(PPMDOBJS) $(LZFXOBJS) $(LZ4OBJS) $(CRCOBJS) \
$(RABINOBJS) $(BSDIFFOBJS) $(LZPOBJS) $(DELTA2OBJS) @LIBBSCWRAPOBJ@ $(SKEINOBJS) \
$(SKEIN_BLOCK_OBJ) @SHA2ASM_OBJS@ @SHA2_OBJS@ $(KECCAK_OBJS) $(KECCAK_OBJS_ASM) \
@ -266,10 +269,10 @@ CPPFLAGS = @CPPFLAGS@ @NO_SLAB_CPPFLAGS@ @DEBUG_STATS_CPPFLAGS@
GEN_OPT = @GEN_OPT@ @SSE_OPT_FLAGS@
BASE_OPT = @GEN_OPT@
PREFIX=@PREFIX@
AVX_OPT_FLAG = -mavx
SSE4_OPT_FLAG = -msse4.2
SSE3_OPT_FLAG = -mssse3
SSE2_OPT_FLAG = -msse2
AVX_OPT_FLAG = -mavx @USE_CLANG_AS@
SSE4_OPT_FLAG = -msse4.2 @USE_CLANG_AS@
SSE3_OPT_FLAG = -mssse3 @USE_CLANG_AS@
SSE2_OPT_FLAG = -msse2 @USE_CLANG_AS@
SKEIN_FLAGS = $(GEN_OPT) $(VEC_FLAGS) $(CPPFLAGS) @FPTR_FLAG@
SHA2_FLAGS = $(GEN_OPT) $(VEC_FLAGS) $(CPPFLAGS) @FPTR_FLAG@
@ -334,7 +337,7 @@ $(KECCAK_OBJS_OPT64_ASM2): $(KECCAK_SRC_OPT64_ASM2)
$(COMPILE) $(KECCAK_FLAGS) $(@:.o=.s) -o $@
$(KECCAK_OBJS_OPT64_ASM3): $(KECCAK_SRC_OPT64_ASM3)
$(YASM) $(@:.o=.s) -o $@
$(YASM_GAS) $(@:.o=.s) -o $@
$(KECCAK_OBJS_ASM): $(KECCAK_SRCS_ASM) $(KECCAK_HDRS)
@ -380,10 +383,10 @@ $(PROGOBJS): $(PROGSRCS) $(PROGHDRS)
$(COMPILE) $(GEN_OPT) $(LOOP_OPTFLAGS) $(CPPFLAGS) $(@:.o=.c) -o $@
$(LIBBSCLIB):
(cd $(LIBBSCDIR); make)
(cd $(LIBBSCDIR); make CC=$(GCC))
$(LIB): $(OBJS) $(LIBBSCLIB)
$(LINK.LIB) -Wl,-soname,$(LIB).$(LIBVER) -o $(LIB).$(LIBVER) $(OBJS) $(LDLIBS)
$(LINK.LIB) -Wl,-soname$(LIB).$(LIBVER) -o $(LIB).$(LIBVER) $(OBJS) $(LDLIBS)
ln -sf $(LIB).$(LIBVER) $(LIB)
./buildtmp/$(PROG):

View file

@ -54,7 +54,7 @@ struct scratch_buffer {
extern size_t packjpg_filter_process(uchar_t *in_buf, size_t len, uchar_t **out_buf);
int64_t packjpg_filter(struct filter_info *fi, void *filter_private);
ssize_t packjpg_filter(struct filter_info *fi, void *filter_private);
void
add_filters_by_type(struct type_data *typetab, struct filter_flags *ff)

View file

@ -1332,8 +1332,10 @@ extractor_thread_func(void *dat) {
* Read archive entries and extract to disk.
*/
while ((rv = archive_read_next_header(arc, &entry)) != ARCHIVE_EOF) {
#ifndef __APPLE__
const char *xt_name, *xt_value;
size_t xt_size;
#endif
int typ;
if (rv != ARCHIVE_OK)

View file

@ -1,6 +1,5 @@
SHELL = /bin/sh
CC = g++
AR = ar
RANLIB = ranlib

33
config
View file

@ -75,7 +75,9 @@ sha256objs=
keylen=
yasm=yasm
yasm_params_linux="-f x64 -f elf64 -X gnu -g dwarf2 -D LINUX"
yasm_params_osx="-f macho64 -X gnu -p gas"
yasm_params_osx="-f macho64"
yasm_params_gas_osx="-f macho64 -X gnu -p gas"
yasm_params_gas=
keccak_srcs=
keccak_hdrs=
keccak_srcs_asm=
@ -92,6 +94,11 @@ salsa20_stream_asm='\$\(XSALSA20_STREAM_ASM\)'
salsa20_debug=
so_suffix=so
crypto_asm_compile='\$\(CRYPTO_ASM_COMPILE1\)'
use_clang_as=
soname_opt="soname,"
rpath="-R"
dtag_val=',--enable-new-dtags'
lrt="-lrt"
if [ -x /bin/echo ]
then
@ -317,7 +324,7 @@ then
elif [ "$OS" = "Darwin" ]
then
yasm="${yasm} ${yasm_params_osx}"
crypto_asm_compile='\$\(CRYPTO_ASM_COMPILE2\)'
yasm_params_gas="${yasm} ${yasm_params_gas_osx}"
elif [ "$OS" = "SunOS" ]
then
@ -342,6 +349,16 @@ else
keccak_srcs='\$\(KECCAK_SRC_OPT64\)'
fi
if [ "$OS" = "Darwin" ]
then
crypto_asm_compile='\$\(CRYPTO_ASM_COMPILE2\)'
use_clang_as="-Wa,-q"
soname_opt="install_name,@rpath/"
rpath="-rpath,"
dtag_val=""
lrt=""
fi
# Detect OpenSSL library
echo "Checking for OpenSSL ..."
for lib in "${openssl_prefix}/lib64" "${openssl_prefix}/usr/lib64" \
@ -462,7 +479,7 @@ else
fi
rm -rf tst*
openssl_libdir="${openssl_libdir},--enable-new-dtags"
openssl_libdir="${openssl_libdir}${dtag_val}"
# Detect other library packages
for libspec in "libbz2:${bzlib_prefix}" "libz:${zlib_prefix}" "libarchive:${libarchive_prefix}"
@ -491,13 +508,13 @@ do
then
if [ -f "${lib}/${libname}.${so_suffix}" -o -h "${lib}/${libname}.${so_suffix}" ]
then
eval "${libname}_libdir=${lib},--enable-new-dtags"
eval "${libname}_libdir=${lib}${dtag_val}"
(cd ./buildtmp; ln -s ${lib}/${libname}.${so_suffix})
break
else
if [ -f "${lib}/${libname}.a" ]
then
eval "${libname}_libdir=${lib},--enable-new-dtags"
eval "${libname}_libdir=${lib}${dtag_val}"
(cd ./buildtmp; ln -s ${lib}/${libname}.a)
break
fi
@ -664,7 +681,13 @@ cat Makefile.in | sed "
s#@GCC@#${GCC}#g
s#@GPP@#${GPP}#g
s#@CRYPTO_ASM_COMPILE@#${crypto_asm_compile}#g
s#@USE_CLANG_AS@#${use_clang_as}#g
s#@SO_SUFFIX@#${so_suffix}#g
s#@YASM_GAS@#${yasm_params_gas}#g
s#@RPATH@#${rpath}#g
s#@LRT@#${lrt}#g
s#soname#${soname_opt}#g
s#@DTAGS@#${dtag_val}#g
s#@${linkvar}@#\\\$\\(${typ}_${linkvar}\\)#g
s#@${compilevar}@#\\\$\\(${typ}_${compilevar}\\)#g
s#@${compilecppvar}@#\\\$\\(${typ}_${compilecppvar}\\)#g

View file

@ -27,7 +27,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef __APPLE__
#include <malloc.h>
#endif
#include <assert.h>
#include <iostream>