From 58a5a820546cb18bd19e947f960487fab738d7f8 Mon Sep 17 00:00:00 2001
From: "Gary V. Vaughan" <gary@gnu.org>
Date: Fri, 8 Sep 2000 17:04:24 +0000
Subject: [PATCH] libtool.m4 (_LT_AC_LTCONFIG_HACK): The ltconfig.in code I
 ported from ltconfig.in was incomplete -- this is a backport of the missing
 code taken from the multi-language branch.

---
 ChangeLog  |  6 ++++++
 libtool.m4 | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index fce799e4..29b7766d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2000-09-08  Gary V. Vaughan  <gcc@techie.com>
+
+	libtool.m4 (_LT_AC_LTCONFIG_HACK): The ltconfig.in code I
+	ported from ltconfig.in was incomplete -- this is a backport
+	of the missing code taken from the multi-language branch.
+	
 2000-09-07  Pavel Roskin  <proskin@gnu.org>
 
 	* libtool.m4 (_LT_AC_LTCONFIG_HACK):  Fixed incorrect use of
diff --git a/libtool.m4 b/libtool.m4
index ff1c992c..ea44c8c4 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -2019,6 +2019,52 @@ fi
 ##
 ## END FIXME
 
+## FIXME: this should be a separate macro
+##
+if test "$enable_shared" = yes && test "$ac_cv_prog_gcc" = yes; then
+  case "$archive_cmds" in
+  *'~'*)
+    # FIXME: we may have to deal with multi-command sequences.
+    ;;
+  '$CC '*)
+    # Test whether the compiler implicitly links with -lc since on some
+    # systems, -lgcc has to come before -lc. If gcc already passes -lc
+    # to ld, don't add -lc before -lgcc.
+    AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+    AC_CACHE_VAL([ac_cv_archive_cmds_need_lc],
+    [$rm conftest*
+    echo 'static int dummy;' > conftest.c
+
+    if AC_TRY_EVAL(ac_compile); then
+      soname=conftest
+      lib=conftest
+      libobjs=conftest.$ac_objext
+      deplibs=
+      wl=$ac_cv_prog_cc_wl
+      compiler_flags=-v
+      linker_flags=-v
+      verstring=
+      output_objdir=.
+      libname=conftest
+      save_allow_undefined_flag=$allow_undefined_flag
+      allow_undefined_flag=
+      if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \"); then
+	ac_cv_archive_cmds_need_lc=no
+      else
+	ac_cv_archive_cmds_need_lc=yes
+      fi
+      allow_undefined_flag=$save_allow_undefined_flag
+    else
+      cat conftest.err 1>&5
+    fi])
+    AC_MSG_RESULT([$ac_cv_archive_cmds_need_lc])
+    ;;
+  esac
+fi
+need_lc=${ac_cv_archive_cmds_need_lc-yes}
+##
+## END FIXME
+
 ## FIXME: this should be a separate macro
 ##
 # Now quote all the things that may contain metacharacters while being