+2004-07-30 Gary V. Vaughan <gary@gnu.org>
+
+ My thanks to Alexandre Duret-Lutz <adl@gnu.org> for the insight
+ required to write this changeset -- especially that ltmain.sh is
+ the same on any machine for a given release, which I hadn't
+ noticed for some bizarre reason: It turns out that generating
+ distributed files from configure causes no end of hassle, as
+ evidenced by the many patches I've generated over the last few
+ days to try and get the dist and distcheck make rules to work.
+ Instead of all that hair, we now simply generate our distributed
+ files (now including ltmain.sh) with make rules -- and since
+ automake creates make variables for all AC_SUBSTs, that is really
+ easy. The code looks a lot more like automake and autoconf
+ Makefile.ams now, and doesn't have all the rough edges the earlier
+ hacky solution suffered from. We still generate libtool from
+ config.status, but that is not a distributed file, and doesn't
+ break the golden rule. Besides, there is way more going on there
+ than a bunch of substitutions:
+
+ * Makefile.am (edit): New common sed substitutions for files now
+ generated by make instead of config.status.
+ (CLEANFILES): Clean new tmp files.
+ (EXTRA_DIST): Add ltmain.sh.
+ (vcl-tmp): Reinstated.
+ (m4/ltversion.m4, config/ltmain.sh): New rules. Generate from
+ here instead of config.status.
+ (libtoolize): Ditto.
+ (libtool): Call config.status to regenerate if necessary.
+ (dist-hook): Removed.
+ * config/ltmain.in: Moved here from top_srcdir.
+ * README-alpha: Update instructions to check AS_SHELL_SANITIZE is
+ up to date.
+ * bootstrap: Rewritten. Generate m4/ltversion.m4 and
+ config/ltmain.sh because configure depends on them.
+ * configure.ac (AC_CONFIG_SRCDIR): Use libtoolize.in now that
+ ltmain.in has moved.
+ (AC_CONFIG_FILES): Don't generate distributed files,
+ config/ltmain.sh and libtoolize from config.status. We have make
+ rules to do that now.
+
2004-07-30 Peter O'Gorman <peter@pogma.com>
* m4/libtool.m4, ltmain.in: readd the comments that I erased.
ACLOCAL_AMFLAGS = -I m4
+edit = sed \
+ -e 's,@PACKAGE\@,$(PACKAGE),g' \
+ -e 's,@VERSION\@,$(VERSION),g' \
+ -e 's,@MACRO_VERSION\@,$(VERSION),g' \
+ -e 's,@LN_S\@,$(LN_S),g' \
+ -e 's,@SED\@,$(SED),g' \
+ -e 's,@prefix\@,$(prefix),g' \
+ -e 's,@datadir\@,$(datadir),g' \
+ -e 's,@pkgdatadir\@,$(pkgdatadir),g' \
+ -e 's,@aclocaldir\@,$(aclocaldir),g' \
+ -e "s,@configure_input\@,Generated from $$input; do not edit by hand,g"
+
BUILD_SUBDIRS = . libltdl doc tests
SUBDIRS = $(BUILD_SUBDIRS)
DIST_SUBDIRS = $(BUILD_SUBDIRS)
-EXTRA_DIST = bootstrap libtoolize.in ltmain.in config/mkstamp stamp-vcl \
- ChangeLog.1996 ChangeLog.1997 ChangeLog.1998 ChangeLog.1999 \
+EXTRA_DIST = bootstrap libtoolize.in config/ltmain.in config/mkstamp \
+ stamp-vcl ChangeLog.1996 ChangeLog.1997 ChangeLog.1998 ChangeLog.1999 \
ChangeLog.2000 ChangeLog.2001 ChangeLog.2002 ChangeLog.2003
-CLEANFILES = libtool libtoolize ltmain.shT
+CLEANFILES = libtool libtoolize \
+ libtoolize.tmp config/ltmain.tmp m4/ltversion.tmp
# These are required by libtoolize and must be executable when installed.
# Since _SCRIPTS gets the program transform applied we make them
aclocal_DATA = m4/argz.m4 m4/libtool.m4 m4/ltdl.m4 \
m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4
+## If mkstamp does not match $(srcdir)/stamp-vcl, we still put the new one
+## in the current dir, incase $(srcdir) is not writable. The dir selection
+## at the top of this rule takes care of prefering the right one on
+## subsequent runs.
+MKSTAMP = $(SHELL) $(top_srcdir)/config/mkstamp
+stamp-vcl: vcl-tmp ChangeLog
+vcl-tmp:
+ @dir=.; test -f $$dir/stamp-vcl || dir=$(srcdir); \
+ set -- `$(MKSTAMP) < $(top_srcdir)/ChangeLog`; \
+ echo "$$1" > vcl.tmp; \
+ cmp -s vcl.tmp $$dir/stamp-vcl \
+ || (echo "Updating stamp-vcl"; cp vcl.tmp ./stamp-vcl)
+ -@rm -f vcl.tmp
+
# 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
# Use `$(top_srcdir)/m4' for the benefit of non-GNU makes: this is
# how ltversion.m4 appears in our dependencies.
EXTRA_DIST += m4/ltversion.in
-$(top_srcdir)/m4/ltversion.m4: $(top_srcdir)/m4/ltversion.in stamp-vcl
- set `$(MKSTAMP) < $(top_srcdir)/ChangeLog`; \
+$(top_srcdir)/m4/ltversion.m4: m4/ltversion.in configure.ac stamp-vcl
+ cd $(top_srcdir); \
+ rm -f m4/ltversion.tmp; \
+ set -- `$(MKSTAMP) < ChangeLog`; \
serial=`echo $$1 | sed 's,^1[.],,g'`; \
- sed -e "s,[@]MACRO_VERSION[@],$(VERSION),g" \
- -e "s,[@]MACRO_REVISION[@],$$1,g" \
- -e "s,[@]MACRO_SERIAL[@],$$serial,g" \
- -e "s,[@]configure_input[@],Generated from ltversion.in; do not edit by hand.,g" \
- $(top_srcdir)/m4/ltversion.in > $@t
- chmod a-w $@t
- mv -f $@t $@
+ input="ltversion.in"; \
+ $(edit) -e "s,@MACRO_REVISION\@,$$1,g" \
+ -e "s,@MACRO_SERIAL\@,$$serial,g" \
+ m4/ltversion.in > m4/ltversion.tmp; \
+ chmod a-w m4/ltversion.tmp; \
+ mv -f m4/ltversion.tmp $(top_srcdir)/m4/ltversion.m4
-# The standalone libtool script, and the libtool distributor.
-bin_SCRIPTS = libtool libtoolize
+## And for similar reasons, ltmain.sh can't be built from config.status.
+EXTRA_DIST += config/ltmain.sh
+$(top_srcdir)/config/ltmain.sh: config/ltmain.in configure.ac stamp-vcl
+ cd $(top_srcdir); \
+ rm -f config/ltmain.tmp; \
+ set -- `$(MKSTAMP) < $(top_srcdir)/ChangeLog`; \
+ input="ltmain.in"; \
+ $(edit) -e "s,@TIMESTAMP\@,$$1 $$2 $$3,g" \
+ -e "s,@package_revision\@,$$1,g" \
+ config/ltmain.in > config/ltmain.tmp; \
+ chmod a-w config/ltmain.tmp; \
+ mv -f config/ltmain.tmp $(top_srcdir)/config/ltmain.sh
-## If mkstamp does not match $(srcdir)/stamp-vcl, we still put the new one
-## in the current dir, incase $(srcdir) is not writable. The dir selection
-## at the top of this rule takes care of prefering the right one on
-## subsequent runs.
-MKSTAMP = $(SHELL) $(top_srcdir)/config/mkstamp
-stamp-vcl: $(top_srcdir)/ChangeLog
- @dir=.; test -f $$dir/stamp-vcl || dir=$(srcdir); \
- set `$(MKSTAMP) < $(top_srcdir)/ChangeLog`; \
- echo "$$1" > vcl.tmp; \
- cmp -s vcl.tmp $$dir/stamp-vcl \
- || (echo "Updating stamp-vcl"; cp vcl.tmp ./stamp-vcl)
- -@rm -f vcl.tmp
+# The libtool distributor and the standalone libtool script.
+bin_SCRIPTS = libtoolize libtool
+
+libtoolize: libtoolize.in Makefile
+ rm -f libtoolize.tmp libtoolize
+ input="libtoolize.in"; \
+ $(edit) $(srcdir)/libtoolize.in > libtoolize.tmp
+ chmod a+x libtoolize.tmp
+ chmod a-w libtoolize.tmp
+ mv -f libtoolize.tmp libtoolize
+
+# Automake doesn't want us to generate distributed files from config.status,
+# but the alternative (see libtool-1.4.3) was even uglier!
+libtool: $(top_builddir)/config.status
+ cd $(top_builddir) && $(SHELL) ./config.status $@
.PHONY: configure-subdirs
configure-subdirs distdir: $(DIST_MAKEFILE_LIST)
install-data-hook:
chmod +x $(DESTDIR)$(pkgdatadir)/config.guess
chmod +x $(DESTDIR)$(pkgdatadir)/config.sub
-
-## Unlike any other project, libtool builds its own ltmain.sh, so
-## some of the rules generated by automake need to be frobbed in
-## VPATH builds because ltmain.sh ends up in the build tree rather
-## than the source tree:
-$(top_srcdir)/config/ltmain.sh: config/ltmain.sh
- -dir=$(top_srcdir)/config; \
- touch $$dir/fnord$$$$ 2>/dev/null || chmod a+w $$dir; \
- rm -f $$dir/ltmain.sh; \
- cp config/ltmain.sh $$dir/ltmain.sh; \
- test -f $$dir/fnord$$$$ && \
- { rm -f $$dir/fnord$$$$; chmod a-w $$dir $$dir/ltmain.sh; }
-
-## Put it in so that automake doesn't choke on reconf. We don't
-## really want to distribute this file, but putting it here gives
-## the automake dist rules something to see during `make distcheck':
-EXTRA_DIST += $(top_srcdir)/config/ltmain.sh
-
-## Take it away again so that we don't distribute it by mistake
-## (it is supposed to be generated on the installers machine).
-dist-hook: $(top_srcdir)/config/ltmain.sh
- -rm -f $(top_distdir)/config/ltmain.sh
# better features, and configure.ac documents oldest version of each
# required for bootstrap (AC_PREREQ, and AM_INIT_AUTOMAKE).
+test -f ./configure.ac || {
+ echo "bootstrap: can't find ./configure.ac, please rerun from top_srcdir"
+ exit 1
+}
+
# Upgrade caveat:
cat <<'EOF'
WARNING: If bootstrapping with this script fails, it may be due to an
# Delete stale acinclude.m4 from previous libtool versions.
rm -f acinclude.m4
-fakes="config/ltmain.sh config/libtoolize"
if test -z "$reconfdirs"; then
reconfdirs=". `ls -1d tests/*demo tests/*demo[0-9]`"
fi
-# Extract the version number from the configure.ac file, and make
-# sure that ltversion.m4 is up to date (preserving the timestamp
-# if possible).
-mv ./m4/ltversion.m4 .ltversion.m4T
-set -- `sed '/AC_INIT/{s/[][,]//g; p;};d' configure.ac`
-make top_srcdir=. VERSION="$2" -f Makefile.am ./m4/ltversion.m4
-if cmp -s ./m4/ltversion.m4 .ltversion.m4T; then
- rm -f ./m4/ltversion.m4
- mv .ltversion.m4T ./m4/ltversion.m4
-else
- rm -f .ltversion.m4T
-fi
+# Extract the package name and version number from configure.ac:
+set -- `sed '/AC_INIT/{s/[][,()]/ /g; p;};d' configure.ac`
+
+# Building distributed files from configure is bad for automake, so we
+# generate them here, and have Makefile rules to keep them up to date:
+rm -f ./config/ltmain.sh ./m4/ltversion.m4
+make -f Makefile.am ./config/ltmain.sh ./m4/ltversion.m4 \
+ top_srcdir=. PACKAGE="$2" VERSION="$3"
-for file in $fakes; do
- cat > $file <<'EOF'
+# Make a dummy libtoolize script for autoreconf:
+cat > ./config/libtoolize <<'EOF'
#! /bin/sh
# This is a dummy file for bootstrapping CVS libtool.
echo "$0: Bootstrap detected, no files installed." | sed 's,^.*/,,g'
exit 0
EOF
- chmod 755 $file
-done
+chmod 755 ./config/libtoolize
# Running the installed `libtoolize' will trash the local (newer) libtool.m4
# among others. Call the dummy script we made earlier.
autoreconf --force --verbose --install $sub
done
-for file in $fakes; do
- rm -f $file
-done
+# Remove our dummy libtoolize
+rm -f ./config/libtoolize
-# These files con cause an infinite configure loop if left behind.
+# These files can cause an infinite configure loop if left behind.
rm -f Makefile libltdl/Makefile libtool vcl.tmp
exit 0