From: Sven M. Hallberg Date: Tue, 19 Aug 2014 12:50:42 +0000 (+0200) Subject: move the rtnetlink.h/C99 check and always fail configure if it fails X-Git-Url: http://git.meshlink.io/?p=catta;a=commitdiff_plain;h=ea6d8d4a844b67c7abe4ae58a460d872fe299156 move the rtnetlink.h/C99 check and always fail configure if it fails --- diff --git a/configure.ac b/configure.ac index 31bda44..a055f7a 100644 --- a/configure.ac +++ b/configure.ac @@ -143,6 +143,15 @@ AC_DEFINE([HAVE_NETLINK],[],[Support for Linux netlink]) AM_CONDITIONAL(HAVE_NETLINK, [ test x"$HAVE_NETLINK" = xyes ]) +if test "x$HAVE_NETLINK" = "xyes" ; then + # Test whether rtnetlink.h can be included when compiled with -std=c99 + # some distributions (e.g. archlinux) have broken headers that dont + # define __u64 with -std=c99 + AC_MSG_CHECKING([checking whether rtnetlink.h can be included with -std=c99]) + AC_TRY_COMPILE([#include ], [], + [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no])]) +fi + # # Check for net/route.h # @@ -238,28 +247,6 @@ if test "x$GCC" = "xyes" ; then DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -fdiagnostics-show-option -Wno-cast-qual -fno-strict-aliasing" - if test "x$HAVE_NETLINK" = "xyes" ; then - # Test whether rtnetlink.h can be included when compiled with -std=c99 - # some distributions (e.g. archlinux) have broken headers that dont - # define __u64 with -std=c99 - AC_MSG_CHECKING([checking whether rtnetlink.h can be included with -std=c99]) - OLDCFLAGS="$CFLAGS" - CFLAGS="-std=c99" - AC_TRY_COMPILE([#include ], [], - use_stdc99=yes, use_stdc99=no) - - if test x"$use_stdc99" = xyes; then - DESIRED_FLAGS="-std=c99 $DESIRED_FLAGS" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - - CFLAGS="$OLDCFLAGS" - else - DESIRED_FLAGS="-std=c99 $DESIRED_FLAGS" - fi - for flag in $DESIRED_FLAGS ; do AC_MSG_CHECKING([whether $CC accepts $flag]) if test_gcc_flag $flag ; then