Prepare for 2.2.6b release.
[libtool.git] / bootstrap
blob8ce6ac7dc54e10caaf5414333823b6dcabb7b5cb
1 #! /bin/sh
2 # bootstrap -- Helps bootstrapping libtool, when checked out from CVS.
4 # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc,
5 # Mritten by Gary V. Vaughan, 2003
7 # This file is part of GNU Libtool.
9 # GNU Libtool is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation; either version 2 of
12 # the License, or (at your option) any later version.
14 # GNU Libtool is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with GNU Libtool; see the file COPYING. If not, a copy
21 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
22 # or obtained by writing to the Free Software Foundation, Inc.,
23 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 ####
26 # It is okay for the bootstrap process to require unreleased autoconf
27 # or automake, as long as any released libtool will work with at least
28 # the newest stable versions of each. Generally, newer versions offer
29 # better features, and configure.ac documents oldest version of each
30 # required for bootstrap (AC_PREREQ, and AM_INIT_AUTOMAKE).
32 SHELL=${CONFIG_SHELL-/bin/sh}
33 export SHELL
34 : ${AUTORECONF=autoreconf}
35 : ${AUTOCONF=autoconf}
36 : ${AUTOMAKE=automake}
37 : ${AUTOM4TE=autom4te}
38 : ${MAKE=make}
39 : ${GREP=grep}
40 : ${EGREP=egrep}
41 : ${FGREP=fgrep}
42 : ${SED=sed}
43 : ${LN_S='ln -s'}
44 : ${MAKEINFO=makeinfo}
45 : ${WORKING_LIBOBJ_SUPPORT=false}
47 case $1 in
48 --help|-h*)
49 cat <<EOF
50 `echo $0 | sed 's,^.*/,,g'`: This script is designed to bootstrap a fresh CVS checkout
51 of Libtool. Useful environment variable settings:
52 reconfdirs='. libltdl' Do not bootstrap the old test suite.
53 WORKING_LIBOBJ_SUPPORT=: Declare that you have fixed LIBOBJDIR support
54 in autoconf (> 2.59) and automake (> 1.9.6).
55 EOF
56 exit
58 esac
60 test -f ./configure.ac || {
61 echo "bootstrap: can't find ./configure.ac, please rerun from top_srcdir"
62 exit 1
66 # Extract auxdir and m4dir from configure.ac:
67 lt_tab=' '
68 my_sed_traces='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,;
69 /AC_CONFIG_AUX_DIR[^_]/ {
70 s,^.*AC_CONFIG_AUX_DIR([[ '"$lt_tab"']*\([^])]*\).*$,auxdir=\1,; p;
72 /AC_CONFIG_MACRO_DIR/ {
73 s,^.*AC_CONFIG_MACRO_DIR([[ '"$lt_tab"']*\([^])]*\).*$,m4dir=\1,; p;
75 d;'
76 eval `cat configure.ac 2>/dev/null | $SED "$my_sed_traces"`
79 # Upgrade caveat:
80 cat <<'EOF'
81 WARNING: If bootstrapping with this script fails, it may be due to an
82 WARNING: incompatible installed `libtool.m4' being pulled in to
83 WARNING: `aclocal.m4'. The best way to work around such a problem is to
84 WARNING: uninstall your system libtool files, or failing that, overwrite
85 WARNING: them with all m4 file as shipped with this distribution (except
86 WARNING: `lt~obsolete.m4'). After that, retry this bootstrap.
87 EOF
89 find . -depth \( -name autom4te.cache -o -name libtool \) -print \
90 | grep -v '{arch}' \
91 | xargs rm -rf
93 # Delete stale files from previous libtool versions.
94 rm -f acinclude.m4 libltdl/config.h
96 # Workaround for missing LIBOBJDIR support in Autoconf 2.59, Automake 1.9.6:
97 # Have symlinks of the libobj files in top source dir.
98 # Set WORKING_LIBOBJ_SUPPORT=: when calling bootstrap if you have fixed tools.
99 case `($AUTOCONF --version) 2>/dev/null` in
100 *\ 2.59[c-z]* | *\ 2.[6-9][0-9]* | *\ [3-9].[0-9]*)
101 case `($AUTOMAKE --version) 2>/dev/null` in
102 *\ 1.9[a-z]* | *\ 1.1[0-9]* | *\ 1.[2-9][0-9]* | *\ [2-9].[0-9]*)
103 WORKING_LIBOBJ_SUPPORT=: ;;
104 esac ;;
105 esac
106 for file in argz.c lt__dirent.c lt__strl.c; do
107 rm -f $file
108 $WORKING_LIBOBJ_SUPPORT || $LN_S libltdl/$file $file
109 done
111 if test -z "$reconfdirs"; then
112 reconfdirs=". libltdl `ls -1d tests/*demo tests/*demo[0-9]`"
115 # Extract the package name and version number from configure.ac:
116 set dummy `$SED -n '
117 /AC_INIT/{
118 s/[][,()]/ /g
120 }' configure.ac`
121 shift
123 # Whip up a dirty Makefile:
124 makes='Makefile.am libltdl/Makefile.inc'
125 rm -f Makefile
126 $SED '/^if /,/^endif$/d;/^else$/,/^endif$/d;/^include /d' $makes > Makefile
128 # Building distributed files from configure is bad for automake, so we
129 # generate them here, and have Makefile rules to keep them up to date.
130 # We don't have all the substitution values to build ltmain.sh from this
131 # script yet, but we need config/ltmain.sh for the libtool commands in
132 # configure, and ltversion.m4 to generate configure in the first place:
133 rm -f $auxdir/ltmain.sh $m4dir/ltversion.m4
135 $MAKE ./$auxdir/ltmain.sh ./$m4dir/ltversion.m4 ./doc/notes.txt \
136 ./libtoolize.in ./tests/defs.in ./tests/package.m4 \
137 ./tests/testsuite ./libltdl/Makefile.am \
138 srcdir=. top_srcdir=. PACKAGE="$2" VERSION="$3" \
139 PACKAGE_BUGREPORT="bug-$2@gnu.org" M4SH="$AUTOM4TE --language=m4sh" \
140 AUTOTEST="$AUTOM4TE --language=autotest" SED="$SED" MAKEINFO="$MAKEINFO" \
141 GREP="$GREP" FGREP="$FGREP" EGREP="$EGREP" LN_S="$LN_S"
143 test -f clcommit.m4sh && $MAKE -f Makefile.maint ./commit \
144 srcdir=. top_srcdir=. PACKAGE="$2" VERSION="$3" M4SH="$AUTOM4TE -l m4sh" \
145 SED="$SED" GREP="$GREP" FGREP="$FGREP" EGREP="$EGREP" LN_S="$LN_S"
147 rm -f Makefile
149 # Make a dummy libtoolize script for autoreconf:
150 cat > $auxdir/libtoolize <<'EOF'
151 #! /bin/sh
152 # This is a dummy file for bootstrapping CVS libtool.
153 echo "$0: Bootstrap detected, no files installed." | sed 's,^.*/,,g'
154 exit 0
156 chmod 755 $auxdir/libtoolize
158 # Running the installed `libtoolize' will trash the local (newer) libtool.m4
159 # among others. Call the dummy script we made earlier.
160 LIBTOOLIZE=`pwd`/$auxdir/libtoolize
161 export LIBTOOLIZE
163 for sub in $reconfdirs; do
164 $AUTORECONF --force --verbose --install $sub
165 done
167 # Autoheader valiantly tries to prevent needless reconfigurations by
168 # not changing the timestamp of config-h.in unless the file contents
169 # are updated. Unfortunately config-h.in depends on aclocal.m4 which
170 # *is* updated, so running 'libtoolize --ltdl=. && configure && make'
171 # causes autoheader to be called... undesireable for users that do not
172 # have it! Fudge the timestamp to prevent that:
173 sleep 2 && touch libltdl/config-h.in
175 # Remove our dummy libtoolize
176 rm -f $auxdir/libtoolize
178 # These files can cause an infinite configure loop if left behind.
179 rm -f Makefile libltdl/Makefile libtool vcl.tmp
181 # This file is misgenerated earlier in bootstrap to satisfy automake 1.9.1
182 # and earlier, but has a new enough timestamp to not be updated. Force it
183 # to be regenerated at make-time with proper substitutions in place:
184 touch $auxdir/ltmain.m4sh
186 # Commit script caveat:
187 cat <<EOF
188 WARNING: You might want to regenerate \`commit' and \`$auxdir/mailnotify'
189 WARNING: after you have run \`configure' to discover the real whereabouts
190 WARNING: of \`sed', \`grep' etc. like this:
191 WARNING:
192 WARNING: rm -f commit $auxdir/mailnotify
193 WARNING: make -f Makefile.maint ./commit ./$auxdir/mailnotify
196 exit 0