From: Wouter Wijngaards Date: Mon, 5 Feb 2007 13:47:26 +0000 (+0000) Subject: Improved checking for compiler flags. X-Git-Tag: release-0.0~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ca689882dd1847180c6065704414b8f752a9ee0;p=thirdparty%2Funbound.git Improved checking for compiler flags. git-svn-id: file:///svn/unbound/trunk@63 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/Makefile.in b/Makefile.in index aec72eaf5..365ac55a8 100644 --- a/Makefile.in +++ b/Makefile.in @@ -115,7 +115,7 @@ endif $(BUILD)%.d: $(srcdir)/%.c $(INFO) Depend $< @if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi - $Q$(SHELL) -ec '$(CC) -MM $(CPPFLAGS) $< \ + $Q$(SHELL) -ec '$(CC) -MM $(CPPFLAGS) $(CFLAGS) $< \ | sed '\''s!\(.*\)\.o[ :]*!$(dir $@)\1.o $@ : !g'\'' > $@; \ [ -s $@ ] || rm -f $@' diff --git a/configure.ac b/configure.ac index 932797d14..c3fb0167f 100644 --- a/configure.ac +++ b/configure.ac @@ -37,7 +37,7 @@ fi dnl routine to help check for needed compiler flags. # if the given code compiles without the flag, execute argument 4 # if the given code only compiles with the flag, execute argument 3 -# otherwise fail +# otherwise fail, execute argument 5. AC_DEFUN([CHECK_COMPILER_FLAG_NEEDED], [ AC_REQUIRE([AC_PROG_CC]) @@ -54,11 +54,12 @@ else if test -z "`$CC $CFLAGS $1 -Werror -Wall -c conftest.c 2>&1`"; then eval "cv_prog_cc_flag_needed_$cache=yes" else -echo 'Test with flag fails too!' -cat conftest.c -echo "$CC $CFLAGS $1 -Werror -Wall -c conftest.c 2>&1" -echo `$CC $CFLAGS $1 -Werror -Wall -c conftest.c` -exit 1 +eval "cv_prog_cc_flag_needed_$cache=fail" +#echo 'Test with flag fails too!' +#cat conftest.c +#echo "$CC $CFLAGS $1 -Werror -Wall -c conftest.c 2>&1" +#echo `$CC $CFLAGS $1 -Werror -Wall -c conftest.c` +#exit 1 fi ] fi @@ -69,9 +70,15 @@ AC_MSG_RESULT(yes) : $3 else +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then AC_MSG_RESULT(no) : $4 +else +AC_MSG_RESULT(failed) +: +$5 +fi fi ]) @@ -139,6 +146,17 @@ int test() { return a; } ], [CFLAGS="$CFLAGS -D__EXTENSIONS__"]) +# check that functions are defined +AC_CHECK_DECLS([isascii, getopt, srandom, ctime_r, isblank, gai_strerror],, [echo "Cannot set compile environment; pass defines in CFLAGS=-D... ./configure"; exit 1], [ +#include +#include +#include +#include +#include +#include +#include +#include +]) # for Sun studio 11. CHECK_COMPILER_FLAG(xO4, [CFLAGS="$CFLAGS -xO4"])