as_fn_error $? "Your C compiler doesn't support variadic macros, try building with gcc instead" "$LINENO" 5
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-if test X"$with_gnu_ld" != "yes" -a -n "$GCC"; then
- _CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -static-libgcc"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -static-libgcc" >&5
-$as_echo_n "checking whether $CC understands -static-libgcc... " >&6; }
-if ${sudo_cv_var_gcc_static_libgcc+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- sudo_cv_var_gcc_static_libgcc=yes
-else
- sudo_cv_var_gcc_static_libgcc=no
-
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_var_gcc_static_libgcc" >&5
-$as_echo "$sudo_cv_var_gcc_static_libgcc" >&6; }
- CFLAGS="$_CFLAGS"
- if test "$sudo_cv_var_gcc_static_libgcc" = "yes"; then
- LT_LDFLAGS="$LT_LDFLAGS -Wc,-static-libgcc"
- fi
-fi
for ac_prog in 'bison -y' byacc
do
ac_c_werror_flag=yes
+
+if test -n "$GCC" -a "$lt_cv_prog_gnu_ld" != "yes" -a -n "$GCC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -static-libgcc" >&5
+$as_echo_n "checking whether C compiler accepts -static-libgcc... " >&6; }
+if ${ax_cv_check_cflags___static_libgcc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ ax_check_save_flags=$CFLAGS
+ CFLAGS="$CFLAGS -static-libgcc"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ax_cv_check_cflags___static_libgcc=yes
+else
+ ax_cv_check_cflags___static_libgcc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS=$ax_check_save_flags
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___static_libgcc" >&5
+$as_echo "$ax_cv_check_cflags___static_libgcc" >&6; }
+if test x"$ax_cv_check_cflags___static_libgcc" = xyes; then :
+ LT_LDFLAGS="$LT_LDFLAGS -Wc,-static-libgcc"
+else
+ :
+fi
+
+fi
+
as_CACHEVAR=`$as_echo "ax_cv_check_cflags__-fvisibility=hidden" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fvisibility=hidden" >&5
$as_echo_n "checking whether C compiler accepts -fvisibility=hidden... " >&6; }
# define sudo_fprintf(fp, ...) fprintf((fp), __VA_ARGS__)
#endif
], [sudo_fprintf(stderr, "a %s", "test");])], [], [AC_MSG_ERROR([Your C compiler doesn't support variadic macros, try building with gcc instead])])
-if test X"$with_gnu_ld" != "yes" -a -n "$GCC"; then
- _CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -static-libgcc"
- AC_CACHE_CHECK([whether $CC understands -static-libgcc],
- [sudo_cv_var_gcc_static_libgcc],
- [AC_LINK_IFELSE(
- [AC_LANG_PROGRAM([[]], [[]])],
- [sudo_cv_var_gcc_static_libgcc=yes],
- [sudo_cv_var_gcc_static_libgcc=no]
- )
- ]
- )
- CFLAGS="$_CFLAGS"
- if test "$sudo_cv_var_gcc_static_libgcc" = "yes"; then
- LT_LDFLAGS="$LT_LDFLAGS -Wc,-static-libgcc"
- fi
-fi
dnl
dnl Program checks
SUDO_IO_LOGDIR
dnl
-dnl Check for gcc 4.0-style symbol visibility support.
-dnl This must be towards the end as it turns warnings
-dnl into fatal errors (and there is no way to undo that)
+dnl Turn warnings into errors.
+dnl All compiler/loader tests after this point will fail if
+dnl a warning is displayed (nornally, warnings are not fata).
dnl
AC_LANG_WERROR
+
+dnl
+dnl If compiler supports the -static-libgcc flag use it unless we have
+dnl GNU ld (which can avoid linking in libgcc when it is not needed).
+dnl This test relies on AC_LANG_WERROR
+dnl
+if test -n "$GCC" -a "$lt_cv_prog_gnu_ld" != "yes" -a -n "$GCC"; then
+ AX_CHECK_COMPILE_FLAG([-static-libgcc], [LT_LDFLAGS="$LT_LDFLAGS -Wc,-static-libgcc"])
+fi
+
+dnl
+dnl Check for symbol visibility support.
+dnl This test relies on AC_LANG_WERROR
+dnl
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [
AC_DEFINE(HAVE_DSO_VISIBILITY)
CFLAGS="${CFLAGS} -fvisibility=hidden"
dnl
dnl If the compiler doesn't have symbol visibility support, it may
dnl support version scripts (only GNU and Solaris ld).
+dnl This test relies on AC_LANG_WERROR
dnl
if test -n "$LT_LDEXPORTS"; then
if test "$lt_cv_prog_gnu_ld" = "yes"; then
dnl
dnl Check for -fstack-protector and -z relro support
-dnl This after the call to AC_LANG_WERROR so that warnings
-dnl are treated as fatal errors.
+dnl This test relies on AC_LANG_WERROR
dnl
if test "$enable_hardening" != "no"; then
AX_CHECK_COMPILE_FLAG([-fstack-protector], [