Add brackets around control flow constructs to make more readable
[gnash.git] / autogen.sh
blob25990abb60d1a9d730f49a9ef50ab54dde70cdf5
1 #!/bin/sh
3 #
4 # Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
5 #
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 3 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.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 # Run this to generate all the initial makefiles, etc.
21 srcdir=`dirname $0`
22 test -z "$srcdir" && srcdir=.
24 DIE=0
26 #Always use our macros
27 #ACLOCAL_FLAGS="-I macros $ACLOCAL_FLAGS"
29 if test "`uname`" = "Darwin"; then
30 LIBTOOLIZE=glibtoolize
33 (test -f $srcdir/configure.ac) || {
34 echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
35 echo " top-level package directory"
36 exit 1
39 (${AUTOCONF:-autoconf} --version) < /dev/null > /dev/null 2>&1 || {
40 echo
41 echo "**Error**: You must have \`autoconf' installed."
42 echo "Download the appropriate package for your distribution,"
43 echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
44 DIE=1
47 (grep "^AC_PROG_INTLTOOL" $srcdir/configure.ac >/dev/null) && {
48 (${INTLTOOLIZE:-intltoolize} --version) < /dev/null > /dev/null 2>&1 || {
49 echo
50 echo "**Error**: You must have \`intltool' installed."
51 echo "You can get it from:"
52 echo " ftp://ftp.gnome.org/pub/GNOME/"
53 DIE=1
57 (grep "^AM_PROG_XML_I18N_TOOLS" $srcdir/configure.ac >/dev/null) && {
58 (xml-i18n-toolize --version) < /dev/null > /dev/null 2>&1 || {
59 echo
60 echo "**Error**: You must have \`xml-i18n-toolize' installed."
61 echo "You can get it from:"
62 echo " ftp://ftp.gnome.org/pub/GNOME/"
63 DIE=1
67 (grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
68 (${LIBTOOL:-libtool} --version) < /dev/null > /dev/null 2>&1 || {
69 echo
70 echo "**Error**: You must have \`libtool' installed."
71 echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
72 DIE=1
76 (grep "^AM_GLIB_GNU_GETTEXT" $srcdir/configure.ac >/dev/null) && {
77 (grep "sed.*POTFILES" $srcdir/configure.ac) > /dev/null || \
78 (glib-gettextize --version) < /dev/null > /dev/null 2>&1 || {
79 echo
80 echo "**Error**: You must have \`glib' installed."
81 echo "You can get it from: ftp://ftp.gtk.org/pub/gtk"
82 DIE=1
86 (${AUTOMAKE:-automake} --version) < /dev/null > /dev/null 2>&1 || {
87 echo
88 echo "**Error**: You must have \`automake' installed."
89 echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
90 DIE=1
91 NO_AUTOMAKE=yes
95 # if no automake, don't bother testing for aclocal
96 test -n "$NO_AUTOMAKE" || (${ACLOCAL:-aclocal} --version) < /dev/null > /dev/null 2>&1 || {
97 echo
98 echo "**Error**: Missing \`aclocal'. The version of \`automake'"
99 echo "installed doesn't appear recent enough."
100 echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/"
101 DIE=1
104 if test "$DIE" -eq 1; then
105 exit 1
108 case $CC in
109 xlc )
110 am_opt=--include-deps;;
111 esac
113 # Rather than have libltdl run it's own configure, the few tests
114 # libltdl needed were added to the main configure.ac. As we need to
115 # look at config.h in header files, which may conflict with other
116 # versions of config.h, this has been renamed to gnashconfig,h to be
117 # unique. As the files libtoolize copies insist on using config.h, we
118 # just edit the name, rather than adding a fixed copy to Gnash.
120 # This gets more interesting with libtool 2.x, which heavily changed
121 # how everything worked. Where libtool 1.5 installed only a header and
122 # had a single source file, libtool 2.x has an entire sub directory
123 # tree of headers and source files. So for libtool 1.5.x, we do
124 # everything the way this has always worked for Gnash. For libtool
125 # 2.x, we install in a subdirectory of libbase, because we have to
126 # hack the build directory, and everything configures tottally
127 # differernt than 1.5.x used to. For more fun, libtoolize has
128 # different command line arguments, but one thing that got fixed is
129 # for libtool 2.x there is an #define for the config file name, but
130 # for libtool 1.5 it expects config.h always, so we change this to
131 # gnashconfig.h.
132 ltdlver=`${LIBTOOLIZE:-libtoolize} --version | head -1 | sed -e 's/(.*) //' | cut -d ' ' -f 2`
133 ltdlmajor=`echo $ltdlver | cut -d '.' -f 1`
134 if test -z "$NO_LIBTOOLIZE" ; then
135 ltbasedir="libltdl"
136 libtoolflags="--force --copy --ltdl"
137 if test $ltdlmajor -eq 2; then
138 libtoolflags="${libtoolflags} ${ltbasedir} --quiet --recursive"
140 echo "Running libtoolize $ltdlver ${libtoolflags} ..."
141 # We have to remove the old libltdl sources, as it's entirely
142 # possible these files are being regenerated on a machine with a
143 # different version of libtoolize.
144 rm -fr libltdl
145 # delete the old libtool config macros too, or things break when downgrading
146 # to libtool 1.x.
147 rm -fr macros/libtool.m4 macros/ltdl.m4 macros/ltoptions.m4
148 rm -fr macros/ltsugar.m4 macros/ltversion.m4 macros/lt~obsolete.m4
149 if ${LIBTOOLIZE:-libtoolize} ${libtoolflags}; then
150 # libtool insists on including config.h, but we use gnashconfig.h
151 # to avoid any problems, so we have to change this include
152 # so they all reference the right config header file.
153 if test -d libltdl; then
154 for i in libltdl/*.c; do
155 # echo "Fixing $i..."
156 mv $i $i.orig
157 sed -e 's/include <config.h>/include <gnashconfig.h>/' $i.orig > $i
158 done
160 # mv libltdl/ltdl.c libltdl/ltdl.c.orig
161 # sed -e 's/include <config.h>/include <gnashconfig.h>/' libltdl/ltdl.c.orig > libltdl/ltdl.c
162 # for libtool 1.x, we don't build in libltdl, it's built in libbase instead. autoconf doesn't like
163 # conditional output files, so we nuke the original libltdl/Makefile.am and replace it with a zero
164 # sized one to keep autoconf happy.
165 if test $ltdlmajor -eq 1; then
166 mv libltdl/Makefile.am Makefile.am.orig
167 touch libltdl/Makefile.am
169 if test -f ${ltbasedir}/config-h.in; then
170 chmod a+w ${ltbasedir}/config-h.in # Darwin needs this
172 else
173 echo
174 echo "**Error**: libtoolize failed, do you have libtool and libltdl3-dev packages installed?"
175 exit 1
179 #for coin in `find $srcdir -name CVS -prune -o -name configure.ac -print`
180 for coin in configure.ac
182 dr=`dirname $coin`
183 if test -f $dr/NO-AUTO-GEN; then
184 echo skipping $dr -- flagged as no auto-gen
185 else
186 echo processing $dr
187 ( cd $dr
189 if test -d macros; then
190 aclocalinclude="-I macros $ACLOCAL_FLAGS"
191 else
192 aclocalinclude="$ACLOCAL_FLAGS"
195 if test -d cygnal; then
196 aclocalinclude="-I cygnal ${aclocalinclude}"
199 # libtoolize 1.x puts the additional config files in the top level libltdl
200 # libtoolize puits them in ourt own macros subdirectory.
201 if test -f libltdl/acinclude.m4; then
202 aclocalinclude="-I libltdl ${aclocalinclude}"
205 if grep "^AM_GLIB_GNU_GETTEXT" configure.ac >/dev/null; then
206 echo "Creating $dr/aclocal.m4 ..."
207 test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
208 echo "Making $dr/aclocal.m4 writable ..."
209 test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
211 if grep "^AC_PROG_INTLTOOL" configure.ac >/dev/null; then
212 echo "Running intltoolize --copy --force --automake ..."
213 ${INTLTOOLIZE:-intltoolize} --copy --force --automake
215 if grep "^AM_PROG_XML_I18N_TOOLS" configure.ac >/dev/null; then
216 echo "Running xml-i18n-toolize --copy --force --automake..."
217 xml-i18n-toolize --copy --force --automake
219 # if grep "^AC_PROG_LIBTOOL" configure.ac >/dev/null; then
220 # if test -z "$NO_LIBTOOLIZE" ; then
221 # echo "Running libtoolize --force --copy ..."
222 # ${LIBTOOLIZE:-libtoolize} --force --copy
223 # fi
224 # fi
225 echo "Running aclocal $aclocalinclude ..."
226 ${ACLOCAL:-aclocal} ${aclocalinclude}
227 if grep "^A[CM]_CONFIG_HEADER" configure.ac >/dev/null; then
228 echo "Running autoheader..."
229 ${AUTOHEADER:-autoheader}
231 # This is a hack. Any command line arguments maens don't run Automake.
232 # This is to prevent regenerating and checking in a pile of Makefiles
233 # that haven't really changed. They clutter up the checkin messages.
234 if test x"$1" = x ; then
235 echo "Running automake --add-missing --copy $am_opt ..."
236 ${AUTOMAKE:-automake} --add-missing --copy $am_opt
238 echo "Running autoconf ..."
239 ${AUTOCONF:-autoconf}
242 done
244 conf_flags="--enable-maintainer-mode"