]> diplodocus.org Git - nmh/commitdiff
The linker on FreeBSD 10 doesn't like -ansi. So added a
authorDavid Levine <levinedl@acm.org>
Fri, 6 Dec 2013 00:10:01 +0000 (18:10 -0600)
committerDavid Levine <levinedl@acm.org>
Fri, 6 Dec 2013 00:10:01 +0000 (18:10 -0600)
configure check to not put -ansi in CFLAGS if the linker
doesn't like it.  Though may need to add -pedantic-errors.
There doesn't seem to be an easy way to get automake to
not put CFLAGS in the link command.

configure.ac

index 38e2a58bf5fd16498cba625ef805e4bfe1e72e22..0788b9f14e833d0b672b62b3c427e26291d31146 100644 (file)
@@ -111,16 +111,31 @@ dnl setup version 2.763, because it disables some features in the
 dnl system system header files and warns about them with -Wall.  Try
 dnl to test for that generally, though still with gcc.
 if test "$GCC" = yes; then
-  AC_CACHE_CHECK([whether we can use -ansi with gcc], [nmh_cv_has_dash_ansi],
-    [nmh_saved_cppflags="$CPPFLAGS"
-     nmh_saved_cflags="$CFLAGS"
-     CPPFLAGS="-D_GNU_SOURCE"
-     CFLAGS="-ansi -Wall -Werror"
+  AC_CACHE_CHECK([whether we can use -ansi with linker],
+                 [nmh_cv_has_dash_ansi_with_linker],
+    [nmh_saved_ldflags="$LDFLAGS"
+     LDFLAGS="-ansi"
      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <time.h>],[tzset();])],
-       [nmh_cv_has_dash_ansi=yes],
-       [nmh_cv_has_dash_ansi=no])
-     CPPFLAGS="$nmh_saved_cppflags"
-     CFLAGS="$nmh_saved_cflags"])
+       [nmh_cv_has_dash_ansi_with_linker=yes],
+       [nmh_cv_has_dash_ansi_with_linker=no])
+     LDFLAGS="$nmh_saved_ldflags"])
+
+  dnl Can't use -ansi with the linker on FreeBSD 10.  If -ansi can't
+  dnl be used with the linker, don't try to put it in CFLAGS.
+  if test "$nmh_cv_has_dash_ansi_with_linker" = yes; then
+    AC_CACHE_CHECK([whether we can use -ansi with gcc], [nmh_cv_has_dash_ansi],
+      [nmh_saved_cppflags="$CPPFLAGS"
+       nmh_saved_cflags="$CFLAGS"
+       CPPFLAGS="-D_GNU_SOURCE"
+       CFLAGS="-ansi -Wall -Werror"
+       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <time.h>],[tzset();])],
+         [nmh_cv_has_dash_ansi=yes],
+         [nmh_cv_has_dash_ansi=no])
+       CPPFLAGS="$nmh_saved_cppflags"
+       CFLAGS="$nmh_saved_cflags"])
+  else
+    nmh_cv_has_dash_ansi=no
+  fi
 else
   nmh_cv_has_dash_ansi=no
 fi