3 # Synfig 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)"
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|@SVN_REPOSITORY@|$SVN_REPOSITORY|g;
41 s/@VERSION@/$VERSION/g;
42 s/@API_VERSION@/$API_VERSION/g;
43 s/@VERSION_MAJ@/$VERSION_MAJ/g;
44 s/@VERSION_MIN@/$VERSION_MIN/g;
45 s/@VERSION_REV@/$VERSION_REV/g;
46 s/@VERSION_REL@/$VERSION_REL/g;
50 # Define the output function
52 echo $BOOTSTRAP_NAME: $*
55 # Define the cleanup function
58 rm -fr config.cache autom4te*.cache configure.in $TEMPFILE
61 output Prepairing build environment for $PACKAGE-$VERSION...
63 # Look for the CVS directory. If we don't find it, we need to
64 # ask the user if they know what they are doing.
65 ( test -d CVS || test -d .svn ) ||
67 output warning: This shell script is intended for those
68 output warning: who either know what they are doing or
69 output warning: or downloaded this program from the CVS
70 output warning: repository. See README for more details.
71 output warning: To avoid seeing this message in the future,
72 output warning: create an empty directory called 'CVS'.
73 output Waiting for 15 seconds...
77 # Create the temporary file
78 output Creating temporary file...
79 TEMPFILE=`mktemp /tmp/$BOOTSTRAP_NAME.XXXXXX` ||
81 output ERROR: Unable to create temporary file!
86 (which autoconf > /dev/null 2>&1 ) ||
88 output error: 'Could not find GNU autoconf!'
89 output You need to download and install GNU autoconf v2.52 or higher.
90 output '<ftp://ftp.gnu.org/gnu/autoconf/>'
95 # Check autoconf version
96 output Using $(autoconf --version | grep utoconf)
97 autoconf --version | grep -q "$AUTOCONF_VERSION" ||
99 output warning: Unexpected version of GNU Autoconf "(expected $AUTOCONF_VERSION)"
100 output warning: *** Bootstrap process may fail!
104 (which automake > /dev/null 2>&1 ) ||
106 output error: 'Could not find GNU automake!'
107 output You need to download and install GNU automake v1.5 or higher.
108 output '<ftp://ftp.gnu.org/gnu/automake/>'
113 # Check automake version
114 output Using $(automake --version | grep utomake)
115 automake --version | grep -q "$AUTOMAKE_VERSION" ||
117 output warning: Unexpected version of GNU Automake "(expected $AUTOMAKE_VERSION)"
118 output warning: *** Bootstrap process may fail!
122 (which libtool > /dev/null 2>&1 ) ||
124 output error: 'Could not find GNU libtool!'
125 output You need to download and install GNU libtool v1.4 or higher.
126 output '<ftp://ftp.gnu.org/gnu/libtool/>'
130 # Check libtool version
131 echo $BOOTSTRAP_NAME: Using $(libtoolize --version | grep ibtool)
132 libtoolize --version | grep -q "$LIBTOOL_VERSION" ||
134 output warning: Unexpected version of GNU Libtool "(expected $LIBTOOL_VERSION)"
135 output warning: *** Bootstrap process may fail!
138 # Versions of libtool prior to 1.4.2 have a seriously broken libltdl.
139 # If we are using this broken version, we need to patch it.
140 libtoolize --version | grep -q -e "1.4.2" -e "1.4.1" -e "1.4 " && PATCH_LTDL=1
144 for FILENAME in doxygen.cfg pkgconfig.pc project.spec ; do {
145 output Creating $FILENAME...
146 sed "$SED_SCRIPT" < "$CONFIG_DIR/$FILENAME.in" > $FILENAME;
149 output Renaming pkgconfig.pc to $PACKAGE_TARNAME.pc.in...
150 mv pkgconfig.pc "$PACKAGE_TARNAME.pc.in"
152 output Renaming project.spec to $PACKAGE.spec...
153 mv project.spec "$PACKAGE.spec"
155 output Finishing up $PACKAGE.spec...
156 echo %changelog >> "$PACKAGE.spec"
157 cat NEWS >> "$PACKAGE.spec"
159 output Creating configure.in from configure.ac...
160 sed "$SED_SCRIPT" < "$CONFIG_DIR/configure.ac" > configure.in;
162 output Setting up build environment...
164 # Set the shell to output what we are doing
167 # Create all of the build environment files
169 libtoolize -c -f --ltdl &&
170 aclocal -I "$CONFIG_DIR" $ACLOCAL_FLAGS &&
172 autoconf -o configure &&
173 automake --foreign --add-missing --copy --include-deps &&
177 # Something went wrong...
184 # Turn off echoing of commands
187 # Reconfigure the LTDL, if necessary
188 [ $RECONFIG_LTDL"x" != "x" ] && (
189 output Reconfiguring LTDL...
193 ( echo "AC_CONFIG_AUX_DIR(../config)" >> configure.[ai][cn] ) &&
194 aclocal -I "../$CONFIG_DIR" &&
197 automake --foreign --add-missing --copy
200 # Something went wrong...
209 # If this is the broken version of LTDL, then patch it
210 [ $PATCH_LTDL"x" != "x" ] && (
211 output Patching LTDL...
213 s/handle || /(handle \&\& handle->loader) || /;
214 s/errors > 0) \&\& file_not_found ())/errors > 0) \&\& !file_not_found ())/;
215 s/(!handle)/(!handle || !handle->loader)/;
216 s/ access (filename, R_OK)/ !access (filename, R_OK)/;
217 " < libltdl/ltdl.c > $TEMPFILE && cp $TEMPFILE libltdl/ltdl.c
219 s/DLL_EXPORT/LTDL_DLL_EXPORT/;
220 " < libltdl/ltdl.h > $TEMPFILE && cp $TEMPFILE libltdl/ltdl.h
224 output Patching libtool...
225 patch config/ltmain.sh config/ltmain.patch
228 # Something went wrong...
235 #echo '#define LTDL_SHLIB_EXT ".so"' >> libltdl/config-h.in
238 #define LTDL_SHLIB_EXT ".dll"
241 #define LTDL_SHLIB_EXT ".so"
243 #define LTDL_SHLIB_EXT ".la"
245 #endif ' >> libltdl/config-h.in
247 # output Patching configure script to look for gcc3...
249 # s/g++ c++/g++3 g++ c++/;
250 # s/gcc cc/gcc3 gcc cc/;
251 # s:"'${prefix}/include'":"'${prefix}/include/synfig'":;
252 # s:PREFIX/include:PREFIX/include/ETL:;
253 # " < configure > $TEMPFILE
254 # cp $TEMPFILE configure
256 # Patch the Makefile.in files
257 for filename in $(find Makefile.in src -name Makefile.in) ; do {
258 echo $BOOTSTRAP_NAME: Patching $filename
260 cp $filename $TEMPFILE &&
262 # Remove brain-dead include path
265 # Gosh... I can't remember why I did this one...
266 # Everything seems to work, so I'll leave it in.
267 s;-I"'$(srcdir)'" ;-I"'$(top_srcdir)'" ;
269 # Tell the configure script where it's origin realy is
270 s;configure.in;config/configure.ac;
271 " < $TEMPFILE > $filename
275 output Failure. Unable to patch $filename.
281 output Creating Makefile...
284 ./configure --enable-maintainer-mode
288 ./configure --enable-maintainer-mode
292 ./configure --enable-maintainer-mode
296 ./configure --enable-maintainer-mode
300 ./configure --enable-maintainer-mode
312 # Move back to the current directory
315 make -C src/synfig/proto