]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Improved checking for compiler flags.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 5 Feb 2007 13:47:26 +0000 (13:47 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 5 Feb 2007 13:47:26 +0000 (13:47 +0000)
git-svn-id: file:///svn/unbound/trunk@63 be551aaa-1e26-0410-a405-d3ace91eadb9

Makefile.in
configure.ac

index aec72eaf5013306bf0b1870ea84c515f016342e8..365ac55a8a46117fd7d761934bcd62efdc7e9853 100644 (file)
@@ -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 $@'
 
index 932797d1474c25d31ecd12f24b8a359a0d93a3fc..c3fb0167f5ee31158f6c7e3d0c8d9002286b27c9 100644 (file)
@@ -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 <stdlib.h>
+#include <sys/time.h>
+#include <time.h>
+#include <netdb.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <stdbool.h>
+#include <ctype.h>
+])
 
 # for Sun studio 11.
 CHECK_COMPILER_FLAG(xO4, [CFLAGS="$CFLAGS -xO4"])