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 [ -x /bin/cygpath ] && CONFIG_DIR="`cygpath -m -s "$CONFIG_DIR"`"
20 [ -x /bin/cygpath ] && CONFIG_DIR="`cygpath -u "$CONFIG_DIR"`"
21 [ -x /bin/cygpath ] && CURR_DIR="`cygpath -m -s "$CURR_DIR"`"
22 [ -x /bin/cygpath ] && CURR_DIR="`cygpath -u "$CURR_DIR"`"
23 # Automake,Autoconf, and Libtool versions that we require
27 export WANT_AUTOMAKE=1.8
28 #export WANT_LIBTOOL_VER=1.5
29 export WANT_AUTOCONF_2_5=1
30 export WANT_AUTOCONF=2.5
32 . $CONFIG_DIR/build.cfg
35 s/@PACKAGE@/$PACKAGE/g;
36 s/@PACKAGE_NAME@/$PACKAGE_NAME/g;
37 s/@PACKAGE_BUGREPORT@/$PACKAGE_BUGREPORT/g;
38 s/@PACKAGE_TARNAME@/$PACKAGE_TARNAME/g;
39 s/@PACKAGE_VERSION@/$PACKAGE_VERSION/g;
40 s/@VERSION@/$VERSION/g;
41 s/@API_VERSION@/$API_VERSION/g;
42 s/@VERSION_MAJ@/$VERSION_MAJ/g;
43 s/@VERSION_MIN@/$VERSION_MIN/g;
44 s/@VERSION_REV@/$VERSION_REV/g;
45 s/@VERSION_REL@/$VERSION_REL/g;
49 # Define the output function
51 echo $BOOTSTRAP_NAME: $*
54 # Define the cleanup function
57 rm -fr config.cache autom4te*.cache configure.in $TEMPFILE
60 output Prepairing build environment for $PACKAGE-$VERSION...
62 # Look for the CVS directory. If we don't find it, we need to
63 # ask the user if they know what they are doing.
64 ( test -d CVS || test -d .svn ) ||
66 output warning: This shell script is intended for those
67 output warning: who either know what they are doing or
68 output warning: or downloaded this program from the CVS
69 output warning: repository. See README for more details.
70 output warning: To avoid seeing this message in the future,
71 output warning: create an empty directory called 'CVS'.
72 output 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" ||
98 output warning: Unexpected version of GNU Autoconf "(expected $AUTOCONF_VERSION)"
99 output warning: *** Bootstrap process may fail!
103 (which automake > /dev/null 2>&1 ) ||
105 output error: 'Could not find GNU automake!'
106 output You need to download and install GNU automake v1.5 or higher.
107 output '<ftp://ftp.gnu.org/gnu/automake/>'
112 # Check automake version
113 output Using $(automake --version | grep utomake)
114 automake --version | grep -q "$AUTOMAKE_VERSION" ||
116 output warning: Unexpected version of GNU Automake "(expected $AUTOMAKE_VERSION)"
117 output warning: *** Bootstrap process may fail!
121 (which libtool > /dev/null 2>&1 ) ||
123 output error: 'Could not find GNU libtool!'
124 output You need to download and install GNU libtool v1.4 or higher.
125 output '<ftp://ftp.gnu.org/gnu/libtool/>'
129 # Check libtool version
130 echo $BOOTSTRAP_NAME: Using $(libtoolize --version | grep ibtool)
131 libtoolize --version | grep -q "$LIBTOOL_VERSION" ||
133 output warning: Unexpected version of GNU Libtool "(expected $LIBTOOL_VERSION)"
134 output warning: *** Bootstrap process may fail!
137 # Versions of libtool prior to 1.4.2 have a seriously broken libltdl.
138 # If we are using this broken version, we need to patch it.
139 libtoolize --version | grep -q -e "1.4.2" -e "1.4.1" -e "1.4 " && PATCH_LTDL=1
143 for FILENAME in doxygen.cfg pkgconfig.pc project.spec ; do {
144 output Creating $FILENAME...
145 sed "$SED_SCRIPT" < $CONFIG_DIR/$FILENAME.in > $FILENAME;
148 output Renaming pkgconfig.pc to $PACKAGE_TARNAME.pc.in...
149 mv pkgconfig.pc "$PACKAGE_TARNAME.pc.in"
151 output Renaming project.spec to $PACKAGE-$VERSION.spec...
152 mv project.spec "$PACKAGE-$VERSION.spec"
154 output Finishing up $PACKAGE-$VERSION.spec...
155 echo %changelog >> "$PACKAGE-$VERSION.spec"
156 cat NEWS >> "$PACKAGE-$VERSION.spec"
158 output Creating configure.in from configure.ac...
159 sed "$SED_SCRIPT" < $CONFIG_DIR/configure.ac > configure.in;
161 output Setting up build environment...
163 # Set the shell to output what we are doing
166 # Create all of the build environment files
168 libtoolize -c -f --ltdl &&
169 aclocal -I $CONFIG_DIR $ACLOCAL_FLAGS &&
171 autoconf -o configure &&
172 automake --foreign --add-missing --copy --include-deps &&
176 # Something went wrong...
183 # Turn off echoing of commands
186 # Reconfigure the LTDL, if necessary
187 [ $RECONFIG_LTDL"x" != "x" ] && (
188 output Reconfiguring LTDL...
192 ( echo "AC_CONFIG_AUX_DIR(../config)" >> configure.[ai][cn] ) &&
193 aclocal -I $CONFIG_DIR &&
196 automake --foreign --add-missing --copy
199 # Something went wrong...
208 # If this is the broken version of LTDL, then patch it
209 [ $PATCH_LTDL"x" != "x" ] && (
210 output Patching LTDL...
212 s/handle || /(handle \&\& handle->loader) || /;
213 s/errors > 0) \&\& file_not_found ())/errors > 0) \&\& !file_not_found ())/;
214 s/(!handle)/(!handle || !handle->loader)/;
215 s/ access (filename, R_OK)/ !access (filename, R_OK)/;
216 " < libltdl/ltdl.c > $TEMPFILE && cp $TEMPFILE libltdl/ltdl.c
218 s/DLL_EXPORT/LTDL_DLL_EXPORT/;
219 " < libltdl/ltdl.h > $TEMPFILE && cp $TEMPFILE libltdl/ltdl.h
223 output Patching libtool...
224 patch config/ltmain.sh config/ltmain.patch
227 # Something went wrong...
234 #echo '#define LTDL_SHLIB_EXT ".so"' >> libltdl/config-h.in
237 #define LTDL_SHLIB_EXT ".dll"
240 #define LTDL_SHLIB_EXT ".so"
242 #define LTDL_SHLIB_EXT ".la"
244 #endif ' >> libltdl/config-h.in
246 # output Patching configure script to look for gcc3...
248 # s/g++ c++/g++3 g++ c++/;
249 # s/gcc cc/gcc3 gcc cc/;
250 # s:"'${prefix}/include'":"'${prefix}/include/sinfg'":;
251 # s:PREFIX/include:PREFIX/include/ETL:;
252 # " < configure > $TEMPFILE
253 # cp $TEMPFILE configure
255 # Patch the Makefile.in files
256 for filename in $(find Makefile.in src -name Makefile.in) ; do {
257 echo $BOOTSTRAP_NAME: Patching $filename
259 cp $filename $TEMPFILE &&
261 # Remove brain-dead include path
264 # Gosh... I can't remember why I did this one...
265 # Everything seems to work, so I'll leave it in.
266 s;-I"'$(srcdir)'" ;-I"'$(top_srcdir)'" ;
268 # Tell the configure script where it's origin realy is
269 s;configure.in;config/configure.ac;
270 " < $TEMPFILE > $filename
274 output Failure. Unable to patch $filename.
280 output Creating Makefile...
283 ./configure --enable-maintainer-mode
287 ./configure --enable-maintainer-mode
291 ./configure --enable-maintainer-mode
295 ./configure --enable-maintainer-mode
299 ./configure --enable-maintainer-mode
311 # Move back to the current directory
314 make -C src/synfig/proto