From 00b846cd1f5a0054a1ce7ebcd1d7908887dc5a23 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 2 Aug 2011 16:13:18 -0400 Subject: [PATCH] Make sure compiler supports static-libgcc before using it. --- configure.in | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index e2b460070..503a8c5b9 100644 --- a/configure.in +++ b/configure.in @@ -1920,7 +1920,21 @@ AC_PROG_GCC_TRADITIONAL AC_C_CONST AC_C_VOLATILE if test X"$with_gnu_ld" != "yes" -a -n "$GCC"; then - LTLDFLAGS="$LTLDFLAGS -Wc,-static-libgcc" + _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 + LTLDFLAGS="$LTLDFLAGS -Wc,-static-libgcc" + fi fi dnl dnl Program checks