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