Submitted By: Joe Ciccone <jciccone@linuxfromscratch.org>
Date: 2006-11-09
Initial Package Version: 2.5
Origin: Joe Ciccone
Upstream Status: Unknown
Description: Checks to see if libgcc_eh has been provided by gcc. If it has
             the glibc will attempt to link to it.

	     Rediffed for 2.7 by Jim Gifford

diff -Naur glibc-2.7.orig/Makeconfig glibc-2.7/Makeconfig
--- glibc-2.7.orig/Makeconfig	2007-07-05 15:03:47.000000000 -0700
+++ glibc-2.7/Makeconfig	2007-10-20 15:23:21.000000000 -0700
@@ -524,12 +524,20 @@
   libunwind = -lunwind
 endif
 ifneq ($(have-as-needed),yes)
+ifneq ($(have-cc-with-libgcc_eh),yes)
+ libgcc_eh := $(libunwind)
+else
  libgcc_eh := -lgcc_eh $(libunwind)
+endif
 else
  libgcc_eh := -Wl,--as-needed -lgcc_s$(libgcc_s_suffix) $(libunwind) -Wl,--no-as-needed
 endif
 gnulib := -lgcc $(libgcc_eh)
-static-gnulib := -lgcc -lgcc_eh $(libunwind)
+ifneq ($(have-cc-with-libgcc_eh),yes)
+ static-gnulib := -lgcc $(libunwind)
+else
+ static-gnulib := -lgcc -lgcc_eh $(libunwind)
+endif
 libc.so-gnulib := -lgcc
 endif
 ifeq ($(elf),yes)
diff -Naur glibc-2.7.orig/config.make.in glibc-2.7/config.make.in
--- glibc-2.7.orig/config.make.in	2007-08-25 15:25:24.000000000 -0700
+++ glibc-2.7/config.make.in	2007-10-20 15:23:21.000000000 -0700
@@ -60,6 +60,7 @@
 have-libaudit = @have_libaudit@
 have-libcap = @have_libcap@
 have-cc-with-libunwind = @libc_cv_cc_with_libunwind@
+have-cc-with-libgcc_eh = @libc_cv_cc_with_libgcc_eh@
 fno-unit-at-a-time = @fno_unit_at_a_time@
 bind-now = @bindnow@
 have-hash-style = @libc_cv_hashstyle@
diff -Naur glibc-2.7.orig/configure glibc-2.7/configure
--- glibc-2.7.orig/configure	2007-10-18 04:22:23.000000000 -0700
+++ glibc-2.7/configure	2007-10-20 21:26:18.000000000 -0700
@@ -716,6 +716,7 @@
 BISON
 VERSIONING
 libc_cv_cc_with_libunwind
+libc_cv_cc_with_libgcc_eh
 libc_cv_Bgroup
 libc_cv_libgcc_s_suffix
 libc_cv_as_needed
@@ -6045,6 +6046,33 @@
 
   fi
 
+  { echo "$as_me:$LINENO: checking whether to link against libgcc_eh" >&5
+echo $ECHO_N "checking whether to link against libgcc_eh... $ECHO_C" >&6; }
+if test "${libc_cv_cc_with_libgcc_eh+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+    cat > conftest.c <<EOF
+int main (void) { return 0; }
+EOF
+    if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
+       conftest.c -v 2>&1 >/dev/null | grep -q " -lgcc_eh "; then
+      libc_cv_cc_with_libgcc_eh=yes
+    else
+      libc_cv_cc_with_libgcc_eh=no
+    fi
+    rm -f conftest*
+fi
+{ echo "$as_me:$LINENO: result: $libc_cv_cc_with_libgcc_eh" >&5
+echo "${ECHO_T}$libc_cv_cc_with_libgcc_eh" >&6; }
+
+  if test $libc_cv_cc_with_libgcc_eh = yes; then
+    cat >>confdefs.h <<\_ACEOF
+#define HAVE_CC_WITH_LIBGCC_EH 1
+_ACEOF
+
+  fi
+
   { echo "$as_me:$LINENO: checking for -z nodelete option" >&5
 echo $ECHO_N "checking for -z nodelete option... $ECHO_C" >&6; }
 if test "${libc_cv_z_nodelete+set}" = set; then
@@ -9243,6 +9271,7 @@
 BISON!$BISON$ac_delim
 VERSIONING!$VERSIONING$ac_delim
 libc_cv_cc_with_libunwind!$libc_cv_cc_with_libunwind$ac_delim
+libc_cv_cc_with_libgcc_eh!$libc_cv_cc_with_libgcc_eh$ac_delim
 libc_cv_Bgroup!$libc_cv_Bgroup$ac_delim
 libc_cv_libgcc_s_suffix!$libc_cv_libgcc_s_suffix$ac_delim
 libc_cv_as_needed!$libc_cv_as_needed$ac_delim
@@ -9294,7 +9323,7 @@
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 52; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 53; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
diff -Naur glibc-2.7.orig/configure.in glibc-2.7/configure.in
--- glibc-2.7.orig/configure.in	2007-06-07 20:16:36.000000000 -0700
+++ glibc-2.7/configure.in	2007-10-20 15:23:21.000000000 -0700
@@ -1388,6 +1388,23 @@
     AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
   fi
 
+  AC_CACHE_CHECK(whether to link against libgcc_eh,
+                 libc_cv_cc_with_libgcc_eh, [
+    cat > conftest.c <<EOF
+int main (void) { return 0; }
+EOF
+    if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
+       conftest.c -v 2>&1 >/dev/null | grep -q " -lgcc_eh "; then
+      libc_cv_cc_with_libgcc_eh=yes
+    else
+      libc_cv_cc_with_libgcc_eh=no
+    fi
+    rm -f conftest*])
+  AC_SUBST(libc_cv_cc_with_libgcc_eh)
+  if test $libc_cv_cc_with_libgcc_eh = yes; then
+    AC_DEFINE(HAVE_CC_WITH_LIBGCC_EH)
+  fi
+
   AC_CACHE_CHECK(for -z nodelete option,
 		 libc_cv_z_nodelete, [dnl
   cat > conftest.c <<EOF

