From: Mika Lindqvist Date: Mon, 11 May 2015 18:43:16 +0000 (+0300) Subject: Add test for reallocf. X-Git-Tag: 1.9.9-b1~843 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F24%2Fhead;p=thirdparty%2Fzlib-ng.git Add test for reallocf. --- diff --git a/Makefile.in b/Makefile.in index 9948dcd2..75e65c31 100644 --- a/Makefile.in +++ b/Makefile.in @@ -48,6 +48,7 @@ SHELL=/bin/sh EXE= SRCDIR=. +BSDLIBS= ARCHDIR=arch/generic ARCH_STATIC_OBJS= @@ -134,7 +135,7 @@ infcover.o: $(SRCDIR)/test/infcover.c $(SRCDIR)/zlib.h zconf.h $(CC) $(CFLAGS) -I. -I$(SRCDIR) -c -o $@ $(SRCDIR)/test/infcover.c infcover: infcover.o libz.a - $(CC) $(CFLAGS) -o $@ infcover.o libz.a + $(CC) $(CFLAGS) -o $@ infcover.o libz.a $(BSDLIBS) cover: infcover rm -f *.gcda diff --git a/configure b/configure index ff8ec842..d9e515bd 100755 --- a/configure +++ b/configure @@ -533,12 +533,55 @@ EOF if tryboth $CC -c $CFLAGS $test.c; then CFLAGS="$CFLAGS -DHAVE_HIDDEN" SFLAGS="$SFLAGS -DHAVE_HIDDEN" + echo >> configure.log echo "Checking for attribute(visibility) support... Yes." | tee -a configure.log else + echo >> configure.log echo "Checking for attribute(visibility) support... No." | tee -a configure.log fi fi +# check where reallocf is defined +cat > $test.c << EOF +#include + +int main() +{ + void *p = reallocf(NULL, 255); + return p != NULL; +} +EOF +if try $CC -c $CFLAGS -Werror $test.c; then + echo "Checking where reallocf is defined... stdlib.h" | tee -a configure.log +else +cat > $test.c << EOF +#include + +int main() +{ + void *p = reallocf(NULL, 255); + return p != NULL; +} +EOF +if try $CC -c $CFLAGS -Werror $test.c; then + echo "Checking where reallocf is defined... bsd/stdlib.h" | tee -a configure.log + CFLAGS="$CFLAGS -DHAVE_BSD_STDLIB" +else + echo "Checking where reallocf is defined... Not found!" | tee -a configure.log +fi; +fi; + +# check if we need -lbsd for reallocf +BSDLIBS= +if ($CC $CFLAGS -o $test $test.c) 2>> configure.log ; then + echo "Checking for reallocf... Yes." | tee -a configure.log +elif ($CC $CFLAGS -o $test $test.c -lbsd) 2>> configure.log ; then + BSDLIBS=-lbsd + echo "Checking for reallocf... -lbsd" | tee -a configure.log +else + echo "Checking for reallocf... No." | tee -a configure.log +fi; + # Check for __builtin_ctzl() support in compiler cat > $test.c << EOF int main(void) @@ -692,6 +735,7 @@ echo LDCONFIG = $LDCONFIG >> configure.log echo LDFLAGS = $LDFLAGS >> configure.log echo LDSHARED = $LDSHARED >> configure.log echo LDSHAREDLIBC = $LDSHAREDLIBC >> configure.log +echo BSDLIBS = $BSDLIBS >> configure.log echo OBJC = $OBJC >> configure.log echo PIC_OBJC = $PIC_OBJC >> configure.log echo RANLIB = $RANLIB >> configure.log @@ -743,6 +787,7 @@ sed < $SRCDIR/Makefile.in " /^includedir *=/s#=.*#=$includedir# /^mandir *=/s#=.*#=$mandir# /^SRCDIR *=/s#=.*#=$SRCDIR# +/^BSDLIBS *=/s#=.*#=$BSDLIBS# /^OBJC *=/s#=.*#= $OBJC# /^PIC_OBJC *=/s#=.*#= $PIC_OBJC# /^all: */s#:.*#: $ALL#