This is the mail archive of the
libstdc++@sources.redhat.com
mailing list for the libstdc++ project.
Supporting --enable-version-specific-runtime-libs
- To: libstdc++ at sources dot redhat dot com
- Subject: Supporting --enable-version-specific-runtime-libs
- From: markh at landmark dot com
- Date: Fri, 6 Oct 2000 18:55:48 -0400 (EDT)
- cc: mharig at landmark dot com
Libstdc++ Maintainers,
Here are patches for changing libstdc++-2.90.8 so that when gcc-2.95.2
is built with this library, the library and header files can be
installed in a version-specific directory tree. Please read the notes
included. They are interspersed between the patch files.
In producing these changes I used the following GNU tools:
autoconf, version 2.13
automake, version 1.4
bash, version 2.04
fileutils, version 4.0
gcc, version 2.95.2
libtool, version 1.3.5
patch, version 2.5.4
1. Patch libstdc++-2.90.8/configure.in:
a. This patch adds support for --with-gxx-include-dir=<include-files dir>
It was tested using:
i) missing value: --with-gxx-include-dir
ii) null value: --with-gxx-include-dir=
iii) invalid value: --with-gxx-include-dir=foo, where 'foo'
does not exist
iv) valid value: --with-gxx-include-dir=foo, where 'foo' does exist
v) opposite: --without-gxx-include-dir
b. if --with-gxx-include-dir is provided, it overrides the location
used with --enable-version-specific-runtime-libs
c. Adds support for --enable-version-specific-runtime-libs.
i) It was also tested for --disable-version-specific-runtime-libs.
ii) Assumes that the compiler provides the file "gcc/version.c"
to determine the compiler version.
d. Changes the automake user variable 'USE_LIBDIR', which tested for
the absence of the --with-cross-host option, to the variable
'USING_CROSS_COMPILER', which tests for the presence of that same
option.
*** configure.in Fri Mar 24 16:18:56 2000
- --- configure.in.new Fri Sep 1 20:02:12 2000
***************
*** 15,20 ****
- --- 15,61 ----
AC_ARG_WITH(cross-host,
[ --with-cross-host=HOST configuring with a cross compiler])
+
+ # Check for the interface version number for specifying where header
+ # files are installed, if a version number is provided.
+ libstdcxx_interface=
+ if test -f ${srcdir}/Makefile.am; then
+ libstdcxx_interface=`grep "^INTERFACE" ${srcdir}/Makefile.in | sed 's/INTERFACE[ ]*=[ ]*\(.*\)/\1/'`
+ fi
+ AC_SUBST(libstdcxx_interface)
+ AM_CONDITIONAL(LIBSTDCXX_INTERFACE, test x${libstdcxx_interface} != x)
+
+
+ # Process the option "--with-gxx-include-dir=<include-files directory>"
+ AC_ARG_WITH(gxx-include-dir,
+ [ --with-gxx-include-dir Specify the installation directory for g++ header files ],
+ [case "${withval}" in
+ yes) AC_MSG_ERROR(Missing directory for --with-gxx-include-dir);;
+ no) gxx_include_dir=;;
+ *) if test -d "${withval}"; then gxx_include_dir=${withval}; \
+ else AC_MSG_ERROR(invalid directory \"${withval}\" for --with-gxx-include-dir); fi;;
+ esac],
+ gxx_include_dir=)
+ AC_SUBST(gxx_include_dir)
+ AM_CONDITIONAL(GXX_INCLUDE_DIR, test x${gxx_include_dir} != x)
+
+
+ # Process the option "--enable-version-specific-runtime-libs"
+ AC_ARG_ENABLE(version-specific-runtime-libs,
+ [ --enable-version-specific-runtime-libs Specify that run-time libraries should be installed in the compiler-specific directory ],
+ [ version_specific_libs=true
+ # Need the gcc compiler version to know where to install libraries
+ # and header files if --enable-version-specific-runtime-libs option
+ # is selected.
+ changequote(,)dnl
+ gcc_version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $srcdir/../gcc/version.c`
+ changequote([,])dnl
+ AC_SUBST(gcc_version)
+ ],
+ version_specific_libs=false )
+ AM_CONDITIONAL(VERSION_SPECIFIC_LIBS, test x${version_specific_libs} = xtrue)
+
+
GLIBCPP_CONFIGURE(.)
AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
***************
*** 118,124 ****
AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
AM_CONDITIONAL(NULL_TARGET, test "$NULL_TARGET" = yes)
AM_CONDITIONAL(NATIVE, test "$NATIVE" = yes || test "$NULL_TARGET" = yes)
! AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
AC_LC_MESSAGES
- --- 159,165 ----
AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
AM_CONDITIONAL(NULL_TARGET, test "$NULL_TARGET" = yes)
AM_CONDITIONAL(NATIVE, test "$NATIVE" = yes || test "$NULL_TARGET" = yes)
! AM_CONDITIONAL(USING_CROSS_COMPILER, test -n "$with_cross_host")
AC_LC_MESSAGES
======== End of patch for libstdc++-2.90.8/configure.in ================
2. Patch libstdc++-2.90.8/Makefile.am. This patch simply removes the
unused variable 'gxx_include_dir' from the file.
*** Makefile.am Fri Mar 24 16:18:56 2000
- --- Makefile.am.new Fri Sep 1 20:01:59 2000
***************
*** 27,33 ****
# This helps subvert libstdcxx_interface, as calculated by devo/config.if
# Needed so that g++ can find the correct include subdir automatically.
INTERFACE = v3
- - gxx_include_dir=$(includedir)/g++
SUBDIRS = math libio src
- --- 27,32 ----
========= End of patch for libstdc++-2.90.8/Makefile.am ================
3. Patch libstdc++-2.90.8/src/Makefile.am.
This patch uses the changes that were made in
libstdc++-2.90.8/configure.in.
a. Although 'automake' allows nested conditionals, none of the
conditional 'if', 'else', 'endif' statements should be indented,
or else automake gets confused -- something which is not
documented in the automake info file.
b. automake also got confused when I indented the macros related to
libtool support, but only for the libtool definitions.
Elsewhere, the macro definitions were indented for readability
without any problems for automake. Strange.
*** Makefile.am Wed Oct 4 18:09:11 2000
- --- Makefile.am.new Wed Oct 4 18:08:59 2000
***************
*** 26,41 ****
# Cross compiler and multilib support.
# Install a library built with a cross compiler in tooldir, not libdir.
! if USE_LIBDIR
! toolexeclibdir = $(libdir)$(MULTISUBDIR)
! else
toolexecdir = $(exec_prefix)/$(target_alias)
! toolexeclibdir = $(toolexecdir)/lib$(MULTISUBDIR)
endif
toolexeclib_LTLIBRARIES = libstdc++.la
- -
# We have a problem when building the shared libstdc++ object if the
# rules automake generates would be used. We cannot allow CXX to be used
# in libtool since this would add -lstdc++ to the link line which of
- --- 26,46 ----
# Cross compiler and multilib support.
# Install a library built with a cross compiler in tooldir, not libdir.
! if USING_CROSS_COMPILER
toolexecdir = $(exec_prefix)/$(target_alias)
! toolexeclibdir = $(exec_prefix)/$(target_alias)/lib$(MULTISUBDIR)
! else
! if VERSION_SPECIFIC_LIBS
! gcc_version = @gcc_version@
! toolexecdir = $(libdir)/gcc-lib/$(target_alias)
! toolexeclibdir = $(toolexecdir)/$(gcc_version)
! else
! toolexeclibdir = $(libdir)$(MULTISUBDIR)
! endif
endif
toolexeclib_LTLIBRARIES = libstdc++.la
# We have a problem when building the shared libstdc++ object if the
# rules automake generates would be used. We cannot allow CXX to be used
# in libtool since this would add -lstdc++ to the link line which of
***************
*** 197,218 ****
# We cannot use the default rules to install headers since we cannot
# statically decide which headers to install. So we have our own special
# installation routine here.
! myincludep = $(DESTDIR)$(includedir)/g++-v3/
install: myinstallheaders
# NB: As libio_headers may be empty, need this to make sure bash doesn't
# choke on an empty for... loop by using libio_headers_install
! myinstallheaders: $(headers:%=$(myincludep)%)
if test -z "$(MULTISUBDIR)"; then \
for i in $(std_headers); do \
echo "$(INSTALL_DATA) $(top_srcdir)/std/$$i $(myincludep)"; \
$(INSTALL_DATA) $(top_srcdir)/std/$$i $(myincludep); \
done; \
for i in $(generated_headers); do \
! echo "$(INSTALL_DATA) $(top_builddir)/$$i $(myincludep)bits/"; \
! $(INSTALL_DATA) $(top_builddir)/$$i $(myincludep)bits/; \
done; \
libio_headers_install='$(libio_headers)'; \
for i in $$libio_headers_install; do \
- --- 202,235 ----
# We cannot use the default rules to install headers since we cannot
# statically decide which headers to install. So we have our own special
# installation routine here.
! if GXX_INCLUDE_DIR
! myincludep = @gxx_include_dir@
! else
! if VERSION_SPECIFIC_LIBS
! myincludep = $(libdir)/gcc-lib/$(target_alias)/$(gcc_version)/include/g++/
! else
! if LIBSTDCXX_INTERFACE
! myincludep = $(prefix)/include/g++-@libstdcxx_interface@/
! else
! myincludep = $(prefix)/include/g++/
! endif
! endif
! endif
install: myinstallheaders
# NB: As libio_headers may be empty, need this to make sure bash doesn't
# choke on an empty for... loop by using libio_headers_install
! myinstallheaders: $(headers:%=$(myincludep)/%)
if test -z "$(MULTISUBDIR)"; then \
for i in $(std_headers); do \
echo "$(INSTALL_DATA) $(top_srcdir)/std/$$i $(myincludep)"; \
$(INSTALL_DATA) $(top_srcdir)/std/$$i $(myincludep); \
done; \
for i in $(generated_headers); do \
! echo "$(INSTALL_DATA) $(top_builddir)/$$i $(myincludep)/bits/"; \
! $(INSTALL_DATA) $(top_builddir)/$$i $(myincludep)/bits/; \
done; \
libio_headers_install='$(libio_headers)'; \
for i in $$libio_headers_install; do \
***************
*** 223,229 ****
$(INSTALL_DATA) $(cpu_headers) $(myincludep); \
fi;
! $(headers:%=$(myincludep)%): $(myincludep)%: %
if test -z "$(MULTISUBDIR)"; then \
$(mkinstalldirs) $(@D); \
echo " $(INSTALL_DATA) $^ $@"; \
- --- 240,246 ----
$(INSTALL_DATA) $(cpu_headers) $(myincludep); \
fi;
! $(headers:%=$(myincludep)/%): $(myincludep)/%: %
if test -z "$(MULTISUBDIR)"; then \
$(mkinstalldirs) $(@D); \
echo " $(INSTALL_DATA) $^ $@"; \
========= End of patch for libstdc++-2.90.8/src/Makefile.am ===========
5. Other steps I had to take to get the version-specific libraries to
install OK:
a. If I ran 'aclocal' in the 'libstdc++-2.90.8' directory, then the
aclocal.m4 file that was produced was missing some definitions.
So, instead of running 'aclocal', I used the aclocal.m4 file that
was provided with the distribution to get around this problem.
Has the aclocal.m4 in the distribution been edited by hand? Here
are the error messages that autoconf produced after I ran aclocal
(after applying the above patches, of course):
autoconf: Undefined macros:
***BUG in Autoconf--please report*** AC_REPLACE_MATHFUNCS
***BUG in Autoconf--please report*** AC_REPLACE_MATHFUNCS
***BUG in Autoconf--please report*** AC_REPLACE_STRINGFUNCS
configure.in:164:AC_LC_MESSAGES
Here is a difference listing of the code that is provided in the
distribution version of aclocal.m4 that is not generated by
aclocal (autoconf, version 2.13):
997,1028d996
< # Check for functions in math library.
< # Ulrich Drepper <drepper@cygnus.com>, 1998.
< #
< # This file can be copied and used freely without restrictions. It can
< # be used in projects which are not available under the GNU Public License
< # but which still want to provide support for the GNU gettext functionality.
< # Please note that the actual code is *not* freely available.
<
< # serial 1
<
< dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
< AC_DEFUN(AC_REPLACE_MATHFUNCS,
< [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
< AC_SUBST(LIBMATHOBJS)dnl
< ])
<
< # Check for string functions.
< # Ulrich Drepper <drepper@cygnus.com>, 1998.
< #
< # This file can be copied and used freely without restrictions. It can
< # be used in projects which are not available under the GNU Public License
< # but which still want to provide support for the GNU gettext functionality.
< # Please note that the actual code is *not* freely available.
<
< # serial 1
<
< dnl AC_REPLACE_STRINGFUNCS(FUNCTION...)
< AC_DEFUN(AC_REPLACE_STRINGFUNCS,
< [AC_CHECK_FUNCS([$1], , [LIBSTRINGOBJS="$LIBSTRINGOBJS ${ac_func}.lo"])
< AC_SUBST(LIBSTRINGOBJS)dnl
< ])
<
1380,1386c1348,1356
< # the libltdl convenience library, adds --enable-ltdl-convenience to
< # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
< # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
< # to be `${top_builddir}/libltdl'. Make sure you start DIR with
< # '${top_builddir}/' (note the single quotes!) if your package is not
< # flat, and, if you're not using automake, define top_builddir as
< # appropriate in the Makefiles.
- ---
> # the libltdl convenience library and INCLTDL to the include flags for
> # the libltdl header and adds --enable-ltdl-convenience to the
> # configure arguments. Note that LIBLTDL and INCLTDL are not
> # AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not
> # provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed
> # with '${top_builddir}/' and INCLTDL will be prefixed with
> # '${top_srcdir}/' (note the single quotes!). If your package is not
> # flat and you're not using automake, define top_builddir and
> # top_srcdir appropriately in the Makefiles.
1393,1394c1363,1364
< LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
< INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
- ---
> LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
> INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
1398,1404c1368,1376
< # the libltdl installable library, and adds --enable-ltdl-install to
< # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
< # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
< # to be `${top_builddir}/libltdl'. Make sure you start DIR with
< # '${top_builddir}/' (note the single quotes!) if your package is not
< # flat, and, if you're not using automake, define top_builddir as
< # appropriate in the Makefiles.
- ---
> # the libltdl installable library and INCLTDL to the include flags for
> # the libltdl header and adds --enable-ltdl-install to the configure
> # arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
> # AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed
> # libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will
> # be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
> # with '${top_srcdir}/' (note the single quotes!). If your package is
> # not flat and you're not using automake, define top_builddir and
> # top_srcdir appropriately in the Makefiles.
1417,1418c1389,1390
< LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
< INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
- ---
> LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
> INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
1460,1479d1431
<
< # Check whether LC_MESSAGES is available in <locale.h>.
< # Ulrich Drepper <drepper@cygnus.com>, 1995.
< #
< # This file file be copied and used freely without restrictions. It can
< # be used in projects which are not available under the GNU Public License
< # but which still want to provide support for the GNU gettext functionality.
< # Please note that the actual code is *not* freely available.
<
< # serial 1
<
< AC_DEFUN(AC_LC_MESSAGES,
< [if test $ac_cv_header_locale_h = yes; then
< AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
< [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
< ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
< if test $ac_cv_val_LC_MESSAGES = yes; then
< AC_DEFINE(HAVE_LC_MESSAGES)
< fi
< fi])
b. I edited the generated file libstdc++-2.90.8/src/Makefile.in to
change the line "WERROR = -Werror" to read "WERROR =", as
documented in the installation instructions.
c. Line 324 of the generated file libstdc++-2.90.8/src/Makefile.in
had the following erroneous code:
cp -pr $$/$$file $(distdir)/$$file; \
I changed it to read:
cp -pr $$d/$$file $(distdir)/$$file; \
This line is in the rule for the target 'distdir'. Here is the
entire rule with the changed line in context:
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
if test -f $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
Is this an error in libtool's or automake's macros? That line
is correct in the Makefile.in in the libstdc++-2.90.8
distribution.
e. I checked the gcc 2.95.2 built with these changes by compiling
two small programs:
foo.cc:
int main()
{
return 0;
}
and hello.cc:
#include <iostream>
int main()
{
using namespace std;
cout << "Hello, world!\n";
return 0;
}
I compiled these programs with the commands:
g++ -static -fhonor-std foo.cc
g++ -static -fhonor-std hello.cc
If I omit the '-static' option (i.e., using the shared library),
then the following errors are generated:
/opt/gnu/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/libstdc++.so: undefined reference to `std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_M_destroy(std::allocator<wchar_t> const &)'
/opt/gnu/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/libstdc++.so: undefined reference to `std::basic_ostream<wchar_t, std::char_traits<wchar_t> >::operator<<(long double)'
/opt/gnu/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/libstdc++.so: undefined reference to `std::basic_ostream<wchar_t, std::char_traits<wchar_t> > & std::operator<<<wchar_t, std::char_traits<wchar_t> >(std::basic_ostream<wchar_t, std::char_traits<wchar_t> > &, char)'
/opt/gnu/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/libstdc++.so: undefined reference to `std::ctype<wchar_t> const & std::use_facet<std::ctype<wchar_t> >(std::locale const &)'
/opt/gnu/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/libstdc++.so: undefined reference to `std::basic_streambuf<wchar_t, std::char_traits<wchar_t> > virtual table'
/opt/gnu/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/libstdc++.so: undefined reference to `std::basic_ostringstream<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::std::basic_ios<wchar_t, std::char_traits<wchar_t> > virtual table'
/opt/gnu/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/libstdc++.so: undefined reference to `std::basic_ostream<wchar_t, std::char_traits<wchar_t> >::std::basic_ios<wchar_t, std::char_traits<wchar_t> > virtual table'
/opt/gnu/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/libstdc++.so: undefined reference to `std::basic_ostream<wchar_t, std::char_traits<wchar_t> > & std::operator<<<wchar_t, std::char_traits<wchar_t> >(std::basic_ostream<wchar_t, std::char_traits<wchar_t> > &, char const *)'
/opt/gnu/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/libstdc++.so: undefined reference to `std::basic_ios<wchar_t, std::char_traits<wchar_t> >::init(std::basic_streambuf<wchar_t, std::char_traits<wchar_t> > *)'
/opt/gnu/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/libstdc++.so: undefined reference to `std::basic_ostream<wchar_t, std::char_traits<wchar_t> >::operator<<(double)'
/opt/gnu/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/libstdc++.so: undefined reference to `std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_S_empty_rep_storage'
/opt/gnu/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/libstdc++.so: undefined reference to `std::basic_ostream<wchar_t, std::char_traits<wchar_t> > & std::operator<<<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >(std::basic_ostream<wchar_t, std::char_traits<wchar_t> > &, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const &)'
/opt/gnu/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/libstdc++.so: undefined reference to `std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::basic_string::<wchar_t *>(wchar_t *, wchar_t *, std::allocator<wchar_t> const &)'
/opt/gnu/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/libstdc++.so: undefined reference to `std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::basic_string(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const &)'
/opt/gnu/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/libstdc++.so: undefined reference to `std::basic_ios<wchar_t, std::char_traits<wchar_t> > virtual table'
/opt/gnu/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/libstdc++.so: undefined reference to `std::basic_ostream<wchar_t, std::char_traits<wchar_t> >::operator<<(std::basic_ostream<wchar_t, std::char_traits<wchar_t> > &(*)(std::basic_ostream<wchar_t, std::char_traits<wchar_t> > &))'
/opt/gnu/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/libstdc++.so: undefined reference to `std::basic_ostream<wchar_t, std::char_traits<wchar_t> > & std::ends<wchar_t, std::char_traits<wchar_t> >(std::basic_ostream<wchar_t, std::char_traits<wchar_t> > &)'
/opt/gnu/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/libstdc++.so: undefined reference to `std::basic_stringbuf<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > virtual table'
- --
## Mark Harig
## Landmark Systems, Reston, Virginia, USA
## Email: mharig@landmark.com