Move the check for -static-libgcc until after AC_LANG_WERROR

has been called and use AX_CHECK_COMPILE_FLAG().
This commit is contained in:
Todd C. Miller
2012-06-18 14:10:50 -04:00
parent 2ef0cc73fc
commit af8a211e4b
2 changed files with 58 additions and 59 deletions

76
configure vendored
View File

@@ -14628,43 +14628,6 @@ else
as_fn_error $? "Your C compiler doesn't support variadic macros, try building with gcc instead" "$LINENO" 5 as_fn_error $? "Your C compiler doesn't support variadic macros, try building with gcc instead" "$LINENO" 5
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 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 for ac_prog in 'bison -y' byacc
do do
@@ -20080,6 +20043,45 @@ $as_echo "$iolog_dir" >&6; }
ac_c_werror_flag=yes 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_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 "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fvisibility=hidden" >&5
$as_echo_n "checking whether C compiler accepts -fvisibility=hidden... " >&6; } $as_echo_n "checking whether C compiler accepts -fvisibility=hidden... " >&6; }

View File

@@ -1975,23 +1975,6 @@ AC_INCLUDES_DEFAULT
# define sudo_fprintf(fp, ...) fprintf((fp), __VA_ARGS__) # define sudo_fprintf(fp, ...) fprintf((fp), __VA_ARGS__)
#endif #endif
], [sudo_fprintf(stderr, "a %s", "test");])], [], [AC_MSG_ERROR([Your C compiler doesn't support variadic macros, try building with gcc instead])]) ], [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
dnl Program checks dnl Program checks
@@ -3169,11 +3152,25 @@ SUDO_TIMEDIR
SUDO_IO_LOGDIR SUDO_IO_LOGDIR
dnl dnl
dnl Check for gcc 4.0-style symbol visibility support. dnl Turn warnings into errors.
dnl This must be towards the end as it turns warnings dnl All compiler/loader tests after this point will fail if
dnl into fatal errors (and there is no way to undo that) dnl a warning is displayed (nornally, warnings are not fata).
dnl dnl
AC_LANG_WERROR 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], [ AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [
AC_DEFINE(HAVE_DSO_VISIBILITY) AC_DEFINE(HAVE_DSO_VISIBILITY)
CFLAGS="${CFLAGS} -fvisibility=hidden" CFLAGS="${CFLAGS} -fvisibility=hidden"
@@ -3202,6 +3199,7 @@ AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [
dnl dnl
dnl If the compiler doesn't have symbol visibility support, it may dnl If the compiler doesn't have symbol visibility support, it may
dnl support version scripts (only GNU and Solaris ld). dnl support version scripts (only GNU and Solaris ld).
dnl This test relies on AC_LANG_WERROR
dnl dnl
if test -n "$LT_LDEXPORTS"; then if test -n "$LT_LDEXPORTS"; then
if test "$lt_cv_prog_gnu_ld" = "yes"; then if test "$lt_cv_prog_gnu_ld" = "yes"; then
@@ -3241,8 +3239,7 @@ fi
dnl dnl
dnl Check for -fstack-protector and -z relro support dnl Check for -fstack-protector and -z relro support
dnl This after the call to AC_LANG_WERROR so that warnings dnl This test relies on AC_LANG_WERROR
dnl are treated as fatal errors.
dnl dnl
if test "$enable_hardening" != "no"; then if test "$enable_hardening" != "no"; then
AX_CHECK_COMPILE_FLAG([-fstack-protector], [ AX_CHECK_COMPILE_FLAG([-fstack-protector], [