Fix rebuilding rules of ltmain
OK to apply? With this, if only `ChangeLog' (and `configure.ac' for ltversion.in) are newer than the respective target, we avoid updating. This fixes the bug where touch $srcdir/libltdl/config/ltmain.m4sh # or edit otherwise would fail to update ltmain.sh and thus libtool. This seems to more or less work with the make implementations of Solaris 10, AIX 4.3.3, FreeBSD 6, and of course GNU. More or less meaning: the proprietary make implementations will keep rerunning autotools and config.status for a while, but eventually they will settle on something. Cheers, Ralf 2007-04-27 Ralf Wildenhues <[EMAIL PROTECTED]> * Makefile.am (clean-ltmain-sh): Removed. (libtool, $(srcdir)/$(m4dir)/ltversion.m4) ($(srcdir)/$(auxdir)/ltmain.sh): Updated to not depend on any phony rules. Test `$?' for prerequisites that should always cause us to update the target. Fixes rebuilding rules, at the cost of sometimes updating too much with non-GNU make. Index: Makefile.am === RCS file: /cvsroot/libtool/libtool/Makefile.am,v retrieving revision 1.218 diff -u -r1.218 Makefile.am --- Makefile.am 26 Apr 2007 22:34:05 - 1.218 +++ Makefile.am 26 Apr 2007 23:01:31 - @@ -89,12 +89,15 @@ # We used to do this with a 'stamp-vcl' file, but non-gmake builds # would rerun configure on every invocation, so now we manually # check the version numbers from the build rule when necessary. -libtool: clean-ltmain-sh $(top_builddir)/config.status $(srcdir)/$(auxdir)/ltmain.sh ChangeLog +libtool: $(top_builddir)/config.status $(srcdir)/$(auxdir)/ltmain.sh ChangeLog @target=libtool; $(rebuild); \ if test -f "$$target"; then \ set dummy `./$$target --version | sed 1q`; actualver="$$5"; \ test "$$actualver" = "$$correctver" && rebuild=false; \ fi; \ + for prereq in $?; do \ + case $$prereq in *ChangeLog);; *) rebuild=:;; esac; \ + done; \ if $$rebuild; then \ echo $(SHELL) ./config.status $$target; \ cd $(top_builddir) && $(SHELL) ./config.status $$target; \ @@ -144,15 +147,6 @@ CLEANFILES += libtool libtoolize libtoolize.tmp \ $(auxdir)/ltmain.tmp $(m4dir)/ltversion.tmp - -## We used to build ltmain.sh in the build tree, but now it is created -## in the source tree by bootstrap. This rule removes stale copies from -## previous builds left behind in the build tree, that would override the -## source tree version in current builds. -clean-ltmain-sh: - @-test "$(srcdir)" = "$(top_builddir)" || \ - rm -f "$(top_builddir)/$(auxdir)/ltmain.sh" stamp-vcl - ## We build ltversion.m4 here, instead of from config.status, ## because config.status is rerun each time one of configure's ## dependencies change and ltversion.m4 happens to be a configure @@ -164,13 +158,16 @@ ## Use `$(srcdir)/m4' for the benefit of non-GNU makes: this is ## how ltversion.m4 appears in our dependencies. EXTRA_DIST += $(m4dir)/ltversion.in $(srcdir)/$(m4dir)/ltversion.m4 -$(srcdir)/$(m4dir)/ltversion.m4: clean-ltmain-sh $(m4dir)/ltversion.in configure.ac ChangeLog +$(srcdir)/$(m4dir)/ltversion.m4: $(m4dir)/ltversion.in configure.ac ChangeLog @target='$(srcdir)/$(m4dir)/ltversion.m4'; $(rebuild); \ if test -f "$$target"; then \ set dummy `sed -n '/^# serial /p' "$$target"`; shift; \ actualver=1.$$3; \ test "$$actualver" = "$$correctver" && rebuild=false; \ fi; \ + for prereq in $?; do \ + case $$prereq in *ChangeLog | *configure.ac);; *) rebuild=:;; esac; \ + done; \ if $$rebuild; then \ cd $(srcdir); \ rm -f $(m4dir)/ltversion.tmp; \ @@ -197,17 +194,22 @@ ## distcheck (at least) by rebuilding ltmain.sh in the source ## tree whenever config.status regenerates the Makefile. EXTRA_DIST += $(srcdir)/$(auxdir)/ltmain.sh -$(srcdir)/$(auxdir)/ltmain.sh: clean-ltmain-sh $(sh_files) $(auxdir)/ltmain.m4sh configure.ac ChangeLog +$(srcdir)/$(auxdir)/ltmain.sh: $(sh_files) $(auxdir)/ltmain.m4sh configure.ac ChangeLog @target='$(srcdir)/$(auxdir)/ltmain.sh'; $(rebuild); \ if test -f "$$target"; then \ eval `sed -n '/^package_revision=/p' "$$target"`; \ actualver=$$package_revision; \ test "$$actualver" = "$$correctver" && rebuild=false; \ fi; \ + for prereq in $?; do \ + case $$prereq in *ChangeLog);; *) rebuild=:;; esac; \ + done; \ if $$rebuild; then \ cd $(srcdir); \ rm -f $(auxdir)/ltmain.in $(auxdir)/ltmain.tmp \ $(auxdir)/ltmain.sh; \ + echo $(M4SH) -B $(auxdir) $(auxdir)/ltmain.m4sh \ + \> $(auxdir)/ltmain.in; \ $(M4SH) -B $(auxdir) $(auxdir)/ltmain.m4sh \ > $(auxdir)/ltmain.in; \ input="ltmain.m4sh"; \
Re: libtool/ltmain linking wrong (/usr/lib) libstdc++
[ let's continue this discussion on libtool-patches, please ] Hello Liviu, Vishal, Could you please try this patch (written for both CVS HEAD and branch-1-5), and post the --debug link output with the changed libtool script? Thank you. The patch is certainly not ready for prime time yet, as it will need lots of testing, and quite likely several more iterations. I have no idea how to write a good automatic testcase. Also I have no idea yet when to apply it if so, or whether also to 1.5. Cheers, Ralf HEAD: 2007-04-27 Ralf Wildenhues <[EMAIL PROTECTED]> * libltdl/config/ltmain.m4sh (func_mode_link): Do not treat `-l' in "conv" pass already, just like we skip over `-L' then. Fixes linking against installed /usr/lib/libstdc++.la when -lstdc++ happens to be in $postdeps. * NEWS: Update. Reports by Liviu Nicoara <[EMAIL PROTECTED]> and Vishal Soni-G20083 <[EMAIL PROTECTED]> and others. Index: NEWS === RCS file: /cvsroot/libtool/libtool/NEWS,v retrieving revision 1.203 diff -u -r1.203 NEWS --- NEWS23 Apr 2007 17:10:16 - 1.203 +++ NEWS26 Apr 2007 22:42:27 - @@ -85,6 +85,10 @@ - Use of C++ templates together with shared libraries has been improved on some systems and with some compilers, but is still ongoing work. Feedback is desirable here. + - Linking of libstdc++ (and other GCC compiler-provided libraries) +has been fixed in the case when a compiler from a nonstandard location +was used, but there was also an installation in a location the runtime +linker would search by default. * Bug fixes: Index: libltdl/config/ltmain.m4sh === RCS file: /cvsroot/libtool/libtool/libltdl/config/ltmain.m4sh,v retrieving revision 1.74 diff -u -r1.74 ltmain.m4sh --- libltdl/config/ltmain.m4sh 23 Apr 2007 17:10:17 - 1.74 +++ libltdl/config/ltmain.m4sh 26 Apr 2007 22:42:30 - @@ -3797,6 +3797,10 @@ continue ;; -l*) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue branch-1-5: Index: ltmain.in === RCS file: /cvsroot/libtool/libtool/Attic/ltmain.in,v retrieving revision 1.334.2.140 diff -u -r1.334.2.140 ltmain.in --- ltmain.in 10 Apr 2007 19:10:04 - 1.334.2.140 +++ ltmain.in 26 Apr 2007 22:43:39 - @@ -2144,6 +2144,10 @@ continue ;; -l*) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi if test "$linkmode" != lib && test "$linkmode" != prog; then $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue
Re: .ctor section of shared libraries with PathScale compiler
Thanks Noah. I installed that, but changed the constant to be a #define in the header file. To ease Jeff's concerns about -shared: if libtool supports shared libraries for the system/compiler in question, then they will be preferred over static libs. So -shared is not needed in order for the test to be effective. And we don't want it to fail in the static-only case. Cheers, Ralf 2007-04-27 Noah Misch <[EMAIL PROTECTED]> * tests/ctor.at: New file. * Makefile.am (TESTSUITE_AT): Add tests/ctor.at. Index: Makefile.am === RCS file: /cvsroot/libtool/libtool/Makefile.am,v retrieving revision 1.217 diff -u -r1.217 Makefile.am --- Makefile.am 24 Apr 2007 20:46:17 - 1.217 +++ Makefile.am 26 Apr 2007 22:32:48 - @@ -448,6 +448,7 @@ tests/nonrecursive.at \ tests/recursive.at \ tests/template.at \ + tests/ctor.at \ tests/early-libtool.at \ tests/deplibs-ident.at \ tests/stresstest.at \ --- /dev/null 2007-04-15 17:46:43.220064750 +0200 +++ tests/ctor.at 2007-04-27 00:31:36.0 +0200 @@ -0,0 +1,67 @@ +# ctor.at -- Test constructors via C++-*- Autotest -*- +# +# Copyright (C) 2007 Free Software Foundation, Inc. +# Written by Noah Misch, 2007 +# +# This file is part of GNU Libtool. +# +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, +# or obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +AT_BANNER([Constructors.]) + +AT_SETUP([C++ static constructors]) +LT_AT_TAG([CXX]) +AT_KEYWORDS([libtool]) + +AT_DATA(class.h, +[[#define magic 0xaabbccdd +class Foo { +public: + Foo() { bar = magic; } + unsigned bar; +}; + +extern Foo instance; +]]) + +AT_DATA(libctor.cpp, +[[#include "class.h" +Foo instance; +]]) + +AT_DATA(main.cpp, +[[#include "class.h" + +int main(int argc, char **argv) +{ + return instance.bar != magic; +} +]]) + +AT_CHECK([$LIBTOOL --tag=CXX --mode=compile $CXX $CPPFLAGS $CXXFLAGS \ + -c libctor.cpp -o libctor.lo], [0], [ignore], [ignore]) +AT_CHECK([$LIBTOOL --tag=CXX --mode=compile $CXX $CPPFLAGS $CXXFLAGS \ + -c main.cpp -o main.lo], [0], [ignore], [ignore]) +AT_CHECK([$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS \ + libctor.lo -o libctor.la -rpath /none], [0], [ignore], [ignore]) +AT_CHECK([$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS \ + main.lo libctor.la -o main], [0], [ignore], [ignore]) + +LT_AT_EXEC_CHECK([./main], [0]) + +AT_CLEANUP
Re: mdemo ltdl failure
Hi Charles, Bruno, * Charles Wilson wrote on Thu, Apr 26, 2007 at 07:34:56AM CEST: > > Attached. Re-ran *all* of the tests described here: > http://lists.gnu.org/archive/html/libtool-patches/2007-04/msg00073.html > with identical results. Thank you for patching and testing, and thanks to Bruno for the fine review. > I did not bump the argz.m4 serial again (I'm not sure what the rules are: > bump on EVERY change, or only on "big" changes?). So, Ralf, please do that > manually if it is necessary. It can't hurt, so I did that, and applied (libtool and gnulib). > + if test "$lt_os_major" -gt 1 \ > + || { test "$lt_os_major" -eq 1 \ > + && { test "$lt_os_minor" -gt 5 \ > + || { test "$lt_os_minor" -eq 5 \ > + && test "$lt_os_micro" -gt 24; }; }; }; then Bruno asked for this GCS compliant formatting. I have some (very minor) issue with it: it looks uglier in shell, due to the necessary backslashes. Also, the GCS specify this for C code only, to be strict. But I'm not all that strong about it, so I left it in your patch. Cheers, Ralf