This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: libstdc++ libtool lossage
On Feb 21, 2002, Richard Henderson <rth@redhat.com> wrote:
> On Thu, Feb 21, 2002 at 07:51:32PM -0300, Alexandre Oliva wrote:
>> But then, perhaps -shared-libgcc is a do-nothing if no shared libgcc
>> is built already?
> It is.
Ok, so here's the patch I've come up with that addresses the problem
of libstdc++-v3 and libjava not being linked with the shared version
of libgcc. It has the unfortunate (?) side effect that the two
programs linked in libjava, rmic and rmiregistry, are now explicitly
linked with the shared libgcc, instead of only inheriting that from
libgcj, but that's probably tolerable to avoid the major complications
I'd run into while trying to figure out how to avoid it. I'm checking
this in. Tested on athlon-pc-linux-gnu.
Index: ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* configure.in (CXX_FOR_TARGET): Add -shared-libgcc for
libstdc++-v3 and libjava.
Index: libjava/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* acinclude.m4 (LIB_AC_PROG_CXX): Copied from libstdc++-v3.
Use it.
* Makefile.am (LIBLINK): Use CXX (and its tag) for linking.
* configure, Makefile.in: Rebuilt.
Index: configure.in
===================================================================
RCS file: /cvs/gcc/egcs/configure.in,v
retrieving revision 1.118
diff -u -p -r1.118 configure.in
--- configure.in 2002/02/09 03:00:13 1.118
+++ configure.in 2002/02/22 01:55:18
@@ -1548,7 +1548,7 @@ fi
if test "x${CXX_FOR_TARGET+set}" = xset; then
:
elif test -d ${topsrcdir}/gcc; then
- CXX_FOR_TARGET='$$r/gcc/`case $$dir in libstdc++-v3) echo xgcc ;; *) echo g++ ;; esac` -B$$r/gcc/ -nostdinc++ '$libstdcxx_flags
+ CXX_FOR_TARGET='$$r/gcc/`case $$dir in libstdc++-v3 | libjava) echo xgcc -shared-libgcc ;; *) echo g++ ;; esac` -B$$r/gcc/ -nostdinc++ '$libstdcxx_flags
elif test "$host" = "$target"; then
CXX_FOR_TARGET='$(CXX)'
else
Index: libjava/Makefile.am
===================================================================
RCS file: /cvs/gcc/egcs/libjava/Makefile.am,v
retrieving revision 1.200
diff -u -p -r1.200 Makefile.am
--- libjava/Makefile.am 2002/02/21 10:58:12 1.200
+++ libjava/Makefile.am 2002/02/22 01:55:23
@@ -71,7 +71,7 @@ GCJ_WITH_FLAGS = $(GCJ) --encoding=UTF-8
GCJCOMPILE = $(LIBTOOL) --tag=GCJ --mode=compile $(GCJ_WITH_FLAGS) -fassume-compiled -fclasspath=$(here) -L$(here) $(JC1FLAGS) -MD -MT $@ -MF $(@:.lo=.d) -c
GCJLINK = $(LIBTOOL) --tag=GCJ --mode=link $(GCJ) -L$(here) $(JC1FLAGS) $(LDFLAGS) -o $@
-LIBLINK = $(LIBTOOL) --tag=CC --mode=link $(CC) -L$(here) $(JC1FLAGS) $(LDFLAGS) -o $@
+LIBLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXX) -L$(here) $(JC1FLAGS) $(LDFLAGS) -o $@
## We define this because otherwise libtool can be run with different
## values of `CXX' and will then get confused and fail to work. So,
Index: libjava/acinclude.m4
===================================================================
RCS file: /cvs/gcc/egcs/libjava/acinclude.m4,v
retrieving revision 1.16
diff -u -p -r1.16 acinclude.m4
--- libjava/acinclude.m4 2002/02/07 03:24:10 1.16
+++ libjava/acinclude.m4 2002/02/22 01:55:23
@@ -80,7 +80,50 @@ define([AC_PROG_CC_WORKS],[])
define([AC_PROG_CXX_WORKS],[])
AC_PROG_CC
-AC_PROG_CXX
+
+# We use the libstdc++-v3 version of LIB_AC_PROG_CXX, that gets
+# glibcpp_CXX cached instead of CXX. That's because we're passed a
+# different definition of CXX than other directories, since we don't
+# depend on libstdc++-v3 having already been built.
+AC_DEFUN(LIB_AC_PROG_CXX,
+[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
+dnl Fool anybody using AC_PROG_CXX.
+AC_PROVIDE([AC_PROG_CXX])
+# Use glibcpp_CXX so that we do not cause CXX to be cached with the
+# flags that come in CXX while configuring libstdc++. They're different
+# from those used for all other target libraries. If CXX is set in
+# the environment, respect that here.
+glibcpp_CXX=$CXX
+AC_CHECK_PROGS(glibcpp_CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
+AC_SUBST(glibcpp_CXX)
+CXX=$glibcpp_CXX
+test -z "$glibcpp_CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
+
+AC_PROG_CXX_GNU
+
+if test $ac_cv_prog_gxx = yes; then
+ GXX=yes
+dnl Check whether -g works, even if CXXFLAGS is set, in case the package
+dnl plays around with CXXFLAGS (such as to build both debugging and
+dnl normal versions of a library), tasteless as that idea is.
+ ac_test_CXXFLAGS="${CXXFLAGS+set}"
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS=
+ AC_PROG_CXX_G
+ if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ elif test $ac_cv_prog_cxx_g = yes; then
+ CXXFLAGS="-g -O2"
+ else
+ CXXFLAGS="-O2"
+ fi
+else
+ GXX=
+ test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
+fi
+])
+
+LIB_AC_PROG_CXX
dnl version is pulled out to make it a bit easier to change using sed.
version=0.0.7
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer