3 # Extended Template Library Bootstrap Script
4 # $Id: bootstrap,v 1.2 2005/01/04 01:54:14 darco Exp $
6 # This script creates the configure script and Makefile.in files,
7 # and also fixes a few things in both to ensure a smooth build
8 # on all compilers and platforms.
11 # Grab the current directory and move to our own
15 # Environment Variables
16 BOOTSTRAP_NAME="$(basename $0)"
18 CONFIG_DIR="$(pwd)/config"
20 [ -x /bin/cygpath ] && CONFIG_DIR="`cygpath -m -s "$CONFIG_DIR"`"
21 [ -x /bin/cygpath ] && CONFIG_DIR="`cygpath -u "$CONFIG_DIR"`"
22 [ -x /bin/cygpath ] && CURR_DIR="`cygpath -m -s "$CURR_DIR"`"
23 [ -x /bin/cygpath ] && CURR_DIR="`cygpath -u "$CURR_DIR"`"
25 . "$CONFIG_DIR/build.cfg"
28 s/@PACKAGE@/$PACKAGE/g;
29 s/@PACKAGE_NAME@/$PACKAGE_NAME/g;
30 s/@PACKAGE_BUGREPORT@/$PACKAGE_BUGREPORT/g;
31 s/@PACKAGE_TARNAME@/$PACKAGE_TARNAME/g;
32 s/@PACKAGE_VERSION@/$PACKAGE_VERSION/g;
33 s/@VERSION@/$VERSION/g;
34 s/@VERSION_MAJ@/$VERSION_MAJ/g;
35 s/@VERSION_MIN@/$VERSION_MIN/g;
36 s/@VERSION_REV@/$VERSION_REV/g;
37 s/@VERSION_REL@/$VERSION_REL/g;
41 # Required automake and autoconf versions
45 export WANT_AUTOMAKE=1.6;
46 export WANT_AUTOCONF_2_5=1;
48 # Define the output function
50 echo $BOOTSTRAP_NAME: $*
53 # Define the cleanup function
56 rm -fr config.cache autom4te.cache configure.in $TEMPFILE
59 output Prepairing build environment for $PACKAGE-$VERSION...
61 # Look for the CVS directory. If we don't find it, we need to
62 # ask the user if they know what they are doing.
63 ( test -d CVS || test -d .svn ) ||
66 $BOOTSTRAP_NAME: warning: This shell script is intended for those
67 $BOOTSTRAP_NAME: warning: who either know what they are doing or
68 $BOOTSTRAP_NAME: warning: or downloaded this program from the CVS
69 $BOOTSTRAP_NAME: warning: repository. See README for more details.
70 $BOOTSTRAP_NAME: warning: To avoid seeing this message in the future,
71 $BOOTSTRAP_NAME: warning: create an empty directory called 'CVS'."
72 echo Waiting for 15 seconds...
76 # Create the temporary file
77 output Creating temporary file...
78 TEMPFILE=`mktemp /tmp/$BOOTSTRAP_NAME.XXXXXX` ||
80 output ERROR: Unable to create temporary file!
85 (which autoconf > /dev/null 2>&1 ) ||
87 output error: 'Could not find GNU autoconf!'
88 output You need to download and install GNU autoconf v2.52 or higher.
89 output '<ftp://ftp.gnu.org/gnu/autoconf>'
94 # Check autoconf version
95 output Using $(autoconf --version | grep utoconf)
96 autoconf --version | grep -q "$AUTOCONF_VERSION" || echo \
97 "$BOOTSTRAP_NAME: warning: Unexpected version of GNU Autoconf (expected $AUTOCONF_VERSION)
98 $BOOTSTRAP_NAME: warning: *** Bootstrap process may fail!"
101 (which automake > /dev/null 2>&1 ) ||
103 output error: 'Could not find GNU automake!'
104 output You need to download and install GNU automake v1.5 or higher.
105 output '<ftp://ftp.gnu.org/gnu/automake>'
110 # Check automake version
111 output Using $(automake --version | grep utomake)
112 automake --version | grep -q "$AUTOMAKE_VERSION" || echo \
113 "$BOOTSTRAP_NAME: warning: Unexpected version of GNU Automake (expected $AUTOMAKE_VERSION)
114 $BOOTSTRAP_NAME: warning: *** Bootstrap process may fail!"
116 for FILENAME in doxygen.cfg pkgconfig.pc project.spec ; do {
117 output Creating $FILENAME...
118 sed "$SED_SCRIPT" < "$CONFIG_DIR/$FILENAME.in" > $FILENAME;
121 output Renaming pkgconfig.pc to $PACKAGE_TARNAME.pc.in...
122 mv pkgconfig.pc "$PACKAGE_TARNAME.pc.in"
124 output Renaming project.spec to $PACKAGE-$VERSION.spec...
125 mv project.spec "$PACKAGE-$VERSION.spec"
127 output Finishing up $PACKAGE-$VERSION.spec...
128 echo %changelog >> "$PACKAGE-$VERSION.spec"
129 cat ChangeLog >> "$PACKAGE-$VERSION.spec"
131 output Creating configure.in from configure.ac...
132 sed "$SED_SCRIPT" < "$CONFIG_DIR/configure.ac" > configure.in;
134 output Setting up build environment...
136 # Set the shell to output what we are doing
139 # Create all of the build environment files
141 aclocal -I "$CONFIG_DIR" $ACLOCAL_FLAGS &&
143 autoconf -o configure &&
144 automake --foreign --add-missing --copy --include-deps
147 # Something went wrong...
149 echo $BOOTSTRAP_NAME: Failure.
154 # Turn off echoing of commands
157 #output Patching configure script to look for gcc3...
159 #s/g++ c++/g++3 g++ c++/;
160 #s/gcc cc/gcc3 gcc cc/;
161 #s:PREFIX/include:PREFIX/include/ETL:;
162 #" < configure > $TEMPFILE
163 #cp $TEMPFILE configure
165 # Patch the Makefile.am files
166 for filename in $(find Makefile.in ETL test -name Makefile.in) ; do {
167 echo $BOOTSTRAP_NAME: Patching $filename
169 cp $filename $TEMPFILE &&
172 s;-I"'$(srcdir)'" ;-I"'$(top_srcdir)'" ;
173 s;configure.in;config/configure.ac;
174 " < $TEMPFILE > $filename
178 echo $BOOTSTRAP_NAME: Failure. Unable to patch $filename.
184 echo $BOOTSTRAP_NAME: Creating Makefile...
187 ./configure --enable-maintainer-mode
191 ./configure --enable-maintainer-mode
195 ./configure --enable-maintainer-mode
199 ./configure --enable-maintainer-mode
203 ./configure --enable-maintainer-mode
210 echo $BOOTSTRAP_NAME: Complete.
214 # Move back to the current directory