3 # Sinfg Bootstrap Script
4 # $Id: bootstrap,v 1.2 2005/01/10 07:40:26 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)
17 CONFIG_DIR=$(pwd)/config
19 # Automake,Autoconf, and Libtool versions that we require
23 export WANT_AUTOMAKE=1.8
24 #export WANT_LIBTOOL_VER=1.5
25 export WANT_AUTOCONF_2_5=1
26 export WANT_AUTOCONF=2.5
28 . $CONFIG_DIR/build.cfg
31 s/@PACKAGE@/$PACKAGE/g;
32 s/@PACKAGE_NAME@/$PACKAGE_NAME/g;
33 s/@PACKAGE_BUGREPORT@/$PACKAGE_BUGREPORT/g;
34 s/@PACKAGE_TARNAME@/$PACKAGE_TARNAME/g;
35 s/@PACKAGE_VERSION@/$PACKAGE_VERSION/g;
36 s/@VERSION@/$VERSION/g;
37 s/@API_VERSION@/$API_VERSION/g;
38 s/@VERSION_MAJ@/$VERSION_MAJ/g;
39 s/@VERSION_MIN@/$VERSION_MIN/g;
40 s/@VERSION_REV@/$VERSION_REV/g;
41 s/@VERSION_REL@/$VERSION_REL/g;
45 # Define the output function
47 echo $BOOTSTRAP_NAME: $*
50 # Define the cleanup function
53 rm -fr config.cache autom4te*.cache configure.in $TEMPFILE
56 output Prepairing build environment for $PACKAGE-$VERSION...
58 # Look for the CVS directory. If we don't find it, we need to
59 # ask the user if they know what they are doing.
60 ( test -d CVS || test -d .svn ) ||
62 output warning: This shell script is intended for those
63 output warning: who either know what they are doing or
64 output warning: or downloaded this program from the CVS
65 output warning: repository. See README for more details.
66 output warning: To avoid seeing this message in the future,
67 output warning: create an empty directory called 'CVS'.
68 output Waiting for 15 seconds...
72 # Create the temporary file
73 output Creating temporary file...
74 TEMPFILE=`mktemp /tmp/$BOOTSTRAP_NAME.XXXXXX` ||
76 output ERROR: Unable to create temporary file!
81 (which autoconf > /dev/null 2>&1 ) ||
83 output error: 'Could not find GNU autoconf!'
84 output You need to download and install GNU autoconf v2.52 or higher.
85 output '<ftp://ftp.gnu.org/gnu/autoconf/>'
90 # Check autoconf version
91 output Using $(autoconf --version | grep utoconf)
92 autoconf --version | grep -q "$AUTOCONF_VERSION" ||
94 output warning: Unexpected version of GNU Autoconf "(expected $AUTOCONF_VERSION)"
95 output warning: *** Bootstrap process may fail!
99 (which automake > /dev/null 2>&1 ) ||
101 output error: 'Could not find GNU automake!'
102 output You need to download and install GNU automake v1.5 or higher.
103 output '<ftp://ftp.gnu.org/gnu/automake/>'
108 # Check automake version
109 output Using $(automake --version | grep utomake)
110 automake --version | grep -q "$AUTOMAKE_VERSION" ||
112 output warning: Unexpected version of GNU Automake "(expected $AUTOMAKE_VERSION)"
113 output warning: *** Bootstrap process may fail!
117 (which libtool > /dev/null 2>&1 ) ||
119 output error: 'Could not find GNU libtool!'
120 output You need to download and install GNU libtool v1.4 or higher.
121 output '<ftp://ftp.gnu.org/gnu/libtool/>'
125 # Check libtool version
126 echo $BOOTSTRAP_NAME: Using $(libtoolize --version | grep ibtool)
127 libtoolize --version | grep -q "$LIBTOOL_VERSION" ||
129 output warning: Unexpected version of GNU Libtool "(expected $LIBTOOL_VERSION)"
130 output warning: *** Bootstrap process may fail!
133 # Versions of libtool prior to 1.4.2 have a seriously broken libltdl.
134 # If we are using this broken version, we need to patch it.
135 libtoolize --version | grep -q -e "1.4.2" -e "1.4.1" -e "1.4 " && PATCH_LTDL=1
139 for FILENAME in doxygen.cfg pkgconfig.pc project.spec ; do {
140 output Creating $FILENAME...
141 sed "$SED_SCRIPT" < $CONFIG_DIR/$FILENAME.in > $FILENAME;
144 output Renaming pkgconfig.pc to $PACKAGE_TARNAME.pc.in...
145 mv pkgconfig.pc "$PACKAGE_TARNAME.pc.in"
147 output Renaming project.spec to $PACKAGE-$VERSION.spec...
148 mv project.spec "$PACKAGE-$VERSION.spec"
150 output Finishing up $PACKAGE-$VERSION.spec...
151 echo %changelog >> "$PACKAGE-$VERSION.spec"
152 cat NEWS >> "$PACKAGE-$VERSION.spec"
154 output Creating configure.in from configure.ac...
155 sed "$SED_SCRIPT" < $CONFIG_DIR/configure.ac > configure.in;
157 output Setting up build environment...
159 # Set the shell to output what we are doing
162 # Create all of the build environment files
164 libtoolize -c -f --ltdl &&
165 aclocal -I $CONFIG_DIR $ACLOCAL_FLAGS &&
167 autoconf -o configure &&
168 automake --foreign --add-missing --copy --include-deps &&
172 # Something went wrong...
179 # Turn off echoing of commands
182 # Reconfigure the LTDL, if necessary
183 [ $RECONFIG_LTDL"x" != "x" ] && (
184 output Reconfiguring LTDL...
188 ( echo "AC_CONFIG_AUX_DIR(../config)" >> configure.[ai][cn] ) &&
189 aclocal -I $CONFIG_DIR &&
192 automake --foreign --add-missing --copy
195 # Something went wrong...
204 # If this is the broken version of LTDL, then patch it
205 [ $PATCH_LTDL"x" != "x" ] && (
206 output Patching LTDL...
208 s/handle || /(handle \&\& handle->loader) || /;
209 s/errors > 0) \&\& file_not_found ())/errors > 0) \&\& !file_not_found ())/;
210 s/(!handle)/(!handle || !handle->loader)/;
211 s/ access (filename, R_OK)/ !access (filename, R_OK)/;
212 " < libltdl/ltdl.c > $TEMPFILE && cp $TEMPFILE libltdl/ltdl.c
214 s/DLL_EXPORT/LTDL_DLL_EXPORT/;
215 " < libltdl/ltdl.h > $TEMPFILE && cp $TEMPFILE libltdl/ltdl.h
219 output Patching libtool...
220 patch config/ltmain.sh config/ltmain.patch
223 # Something went wrong...
230 #echo '#define LTDL_SHLIB_EXT ".so"' >> libltdl/config-h.in
233 #define LTDL_SHLIB_EXT ".dll"
236 #define LTDL_SHLIB_EXT ".so"
238 #define LTDL_SHLIB_EXT ".la"
240 #endif ' >> libltdl/config-h.in
242 # output Patching configure script to look for gcc3...
244 # s/g++ c++/g++3 g++ c++/;
245 # s/gcc cc/gcc3 gcc cc/;
246 # s:"'${prefix}/include'":"'${prefix}/include/sinfg'":;
247 # s:PREFIX/include:PREFIX/include/ETL:;
248 # " < configure > $TEMPFILE
249 # cp $TEMPFILE configure
251 # Patch the Makefile.in files
252 for filename in $(find Makefile.in src -name Makefile.in) ; do {
253 echo $BOOTSTRAP_NAME: Patching $filename
255 cp $filename $TEMPFILE &&
257 # Remove brain-dead include path
260 # Gosh... I can't remember why I did this one...
261 # Everything seems to work, so I'll leave it in.
262 s;-I"'$(srcdir)'" ;-I"'$(top_srcdir)'" ;
264 # Tell the configure script where it's origin realy is
265 s;configure.in;config/configure.ac;
266 " < $TEMPFILE > $filename
270 output Failure. Unable to patch $filename.
276 output Creating Makefile...
279 ./configure --enable-maintainer-mode
283 ./configure --enable-maintainer-mode
287 ./configure --enable-maintainer-mode
291 ./configure --enable-maintainer-mode
295 ./configure --enable-maintainer-mode
307 # Move back to the current directory