This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, v3] Potential solution to librt issue.
- From: Paolo Bonzini <bonzini at gnu dot org>
- To: Chris Fairles <chris dot fairles at gmail dot com>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>, gcc-patches at gcc dot gnu dot org, Paolo Carlini <PAOLO dot CARLINI at oracle dot com>
- Date: Wed, 23 Jul 2008 08:22:39 +0200
- Subject: Re: [PATCH, v3] Potential solution to librt issue.
- References: <fac6bb500807222135s2f4b9163n678ba36c17b89219@mail.gmail.com>
Chris Fairles wrote:
Uses AC_SEARCH_LIB to check if clock_gettime is in -lrt or -lposix4
(the latter for some Solaris archs). If its available, "-lrt" is
assigned to GLIBCXX_LIBS which is AC_SUBST'd so its available in
Makefile.am's as $(GLIBCXX_LIBS). I've just tacked it onto the LDFLAGS
for libstdc++.so/a. There might be a more appropriate var to tack it
onto (ldadd??).
Yes, something like
libstdc___la_LIBADD = $(GLIBCXX_LIBS)
$(top_builddir)/libmath/libmath.la \
$(top_builddir)/libsupc++/libsupc++convenience.la \
libstdc___la_DEPENDENCIES = ${version_dep} \
$(top_builddir)/libmath/libmath.la \
$(top_builddir)/libsupc++/libsupc++convenience.la
There's at least one issue: if clock_gettime is a builtin (i.e.
doesn't require an external lib) then GLIBCXX_LIBS will hold the
string "none required" which will obviously cause failures during
linking.
Better to do
AC_SEARCH_LIBS(clock_gettime, [rt posix4])
case "$ac_cv_search_clock_gettime" in
-l*) GLIBCXX_LIBS=$ac_cv_search_clock_gettime ;;
esac
Ok with those changes.
Paolo