app: explicitly clear GUI when halting a filter tool
[gimp.git] / autogen.sh
blob445aab039bf4f45ce15cb7d00a43ace904679ea9
1 #!/bin/sh
3 # This script does all the magic calls to automake/autoconf and
4 # friends that are needed to configure a git clone. As described in
5 # the file HACKING you need a couple of extra tools to run this script
6 # successfully.
8 # If you are compiling from a released tarball you don't need these
9 # tools and you shouldn't use this script. Just call ./configure
10 # directly.
12 ACLOCAL=${ACLOCAL-aclocal-1.13}
13 AUTOCONF=${AUTOCONF-autoconf}
14 AUTOHEADER=${AUTOHEADER-autoheader}
15 AUTOMAKE=${AUTOMAKE-automake-1.13}
16 LIBTOOLIZE=${LIBTOOLIZE-libtoolize}
18 AUTOCONF_REQUIRED_VERSION=2.54
19 AUTOMAKE_REQUIRED_VERSION=1.13.0
20 INTLTOOL_REQUIRED_VERSION=0.40.1
21 LIBTOOL_REQUIRED_VERSION=1.5
22 LIBTOOL_WIN32_REQUIRED_VERSION=2.2
25 PROJECT="GNU Image Manipulation Program"
26 TEST_TYPE=-d
27 FILE=plug-ins
30 srcdir=`dirname $0`
31 test -z "$srcdir" && srcdir=.
32 ORIGDIR=`pwd`
33 cd $srcdir
36 check_version ()
38 VERSION_A=$1
39 VERSION_B=$2
41 save_ifs="$IFS"
42 IFS=.
43 set dummy $VERSION_A 0 0 0
44 MAJOR_A=$2
45 MINOR_A=$3
46 MICRO_A=$4
47 set dummy $VERSION_B 0 0 0
48 MAJOR_B=$2
49 MINOR_B=$3
50 MICRO_B=$4
51 IFS="$save_ifs"
53 if expr "$MAJOR_A" = "$MAJOR_B" > /dev/null; then
54 if expr "$MINOR_A" \> "$MINOR_B" > /dev/null; then
55 echo "yes (version $VERSION_A)"
56 elif expr "$MINOR_A" = "$MINOR_B" > /dev/null; then
57 if expr "$MICRO_A" \>= "$MICRO_B" > /dev/null; then
58 echo "yes (version $VERSION_A)"
59 else
60 echo "Too old (version $VERSION_A)"
61 DIE=1
63 else
64 echo "Too old (version $VERSION_A)"
65 DIE=1
67 elif expr "$MAJOR_A" \> "$MAJOR_B" > /dev/null; then
68 echo "Major version might be too new ($VERSION_A)"
69 else
70 echo "Too old (version $VERSION_A)"
71 DIE=1
75 echo
76 echo "I am testing that you have the tools required to build the"
77 echo "$PROJECT from git. This test is not foolproof,"
78 echo "so if anything goes wrong, see the file HACKING for more information..."
79 echo
81 DIE=0
83 OS=`uname -s`
84 case $OS in
85 *YGWIN* | *INGW*)
86 echo "Looks like Win32, you will need libtool $LIBTOOL_WIN32_REQUIRED_VERSION or newer."
87 echo
88 LIBTOOL_REQUIRED_VERSION=$LIBTOOL_WIN32_REQUIRED_VERSION
90 esac
92 printf "checking for libtool >= $LIBTOOL_REQUIRED_VERSION ... "
93 if ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1; then
94 LIBTOOLIZE=$LIBTOOLIZE
95 elif (glibtoolize --version) < /dev/null > /dev/null 2>&1; then
96 LIBTOOLIZE=glibtoolize
97 else
98 echo
99 echo " You must have libtool installed to compile $PROJECT."
100 echo " Install the appropriate package for your distribution,"
101 echo " or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
102 echo
103 DIE=1
106 if test x$LIBTOOLIZE != x; then
107 VER=`$LIBTOOLIZE --version \
108 | grep libtool | sed "s/.* \([0-9.]*\)[-a-z0-9]*$/\1/"`
109 check_version $VER $LIBTOOL_REQUIRED_VERSION
112 # check if gtk-doc is explicitly disabled
113 for ag_option in $AUTOGEN_CONFIGURE_ARGS $@
115 case $ag_option in
116 -disable-gtk-doc | --disable-gtk-doc)
117 enable_gtk_doc=no
119 esac
120 done
122 if test x$enable_gtk_doc = xno; then
123 echo "skipping test for gtkdocize"
124 else
125 printf "checking for gtkdocize ... "
126 if (gtkdocize --version) < /dev/null > /dev/null 2>&1; then
127 echo "yes"
128 else
129 echo
130 echo " You must have gtk-doc installed to compile $PROJECT."
131 echo " Install the appropriate package for your distribution,"
132 echo " or get the source tarball at"
133 echo " https://ftp.gnome.org/pub/GNOME/sources/gtk-doc/"
134 echo " You can also use the option --disable-gtk-doc to skip"
135 echo " this test but then you will not be able to generate a"
136 echo " configure script that can build the API documentation."
137 DIE=1
141 printf "checking for autoconf >= $AUTOCONF_REQUIRED_VERSION ... "
142 if ($AUTOCONF --version) < /dev/null > /dev/null 2>&1; then
143 VER=`$AUTOCONF --version | head -n 1 \
144 | grep -iw autoconf | sed "s/.* \([0-9.]*\)[-a-z0-9]*$/\1/"`
145 check_version $VER $AUTOCONF_REQUIRED_VERSION
146 else
147 echo
148 echo " You must have autoconf installed to compile $PROJECT."
149 echo " Download the appropriate package for your distribution,"
150 echo " or get the source tarball at ftp://ftp.gnu.org/pub/gnu/autoconf/"
151 echo
152 DIE=1;
156 printf "checking for automake >= $AUTOMAKE_REQUIRED_VERSION ... "
157 if ($AUTOMAKE --version) < /dev/null > /dev/null 2>&1; then
158 AUTOMAKE=$AUTOMAKE
159 ACLOCAL=$ACLOCAL
160 elif (automake-1.16 --version) < /dev/null > /dev/null 2>&1; then
161 AUTOMAKE=automake-1.16
162 ACLOCAL=aclocal-1.16
163 elif (automake-1.15 --version) < /dev/null > /dev/null 2>&1; then
164 AUTOMAKE=automake-1.15
165 ACLOCAL=aclocal-1.15
166 elif (automake-1.14 --version) < /dev/null > /dev/null 2>&1; then
167 AUTOMAKE=automake-1.14
168 ACLOCAL=aclocal-1.14
169 elif (automake-1.13 --version) < /dev/null > /dev/null 2>&1; then
170 AUTOMAKE=automake-1.13
171 ACLOCAL=aclocal-1.13
172 elif (automake --version) < /dev/null > /dev/null 2>&1; then
173 AUTOMAKE=automake
174 ACLOCAL=aclocal
175 else
176 echo
177 echo " You must have automake $AUTOMAKE_REQUIRED_VERSION or newer installed to compile $PROJECT."
178 echo " Download the appropriate package for your distribution,"
179 echo " or get the source tarball at ftp://ftp.gnu.org/pub/gnu/automake/"
180 echo
181 DIE=1
184 if test x$AUTOMAKE != x; then
185 VER=`$AUTOMAKE --version \
186 | grep automake | sed "s/.* \([0-9.]*\)[-a-z0-9]*$/\1/"`
187 check_version $VER $AUTOMAKE_REQUIRED_VERSION
191 printf "checking for intltool >= $INTLTOOL_REQUIRED_VERSION ... "
192 if (intltoolize --version) < /dev/null > /dev/null 2>&1; then
193 VER=`intltoolize --version \
194 | grep intltoolize | sed "s/.* \([0-9.]*\)/\1/"`
195 check_version $VER $INTLTOOL_REQUIRED_VERSION
196 else
197 echo
198 echo " You must have intltool installed to compile $PROJECT."
199 echo " Get the latest version from"
200 echo " ftp://ftp.gnome.org/pub/GNOME/sources/intltool/"
201 echo
202 DIE=1
206 printf "checking for xsltproc ... "
207 if (xsltproc --version) < /dev/null > /dev/null 2>&1; then
208 echo "yes"
209 else
210 echo
211 echo " You must have xsltproc installed to compile $PROJECT."
212 echo " Get the latest version from"
213 echo " ftp://ftp.gnome.org/pub/GNOME/sources/libxslt/"
214 echo
215 DIE=1
218 if test "$DIE" -eq 1; then
219 echo
220 echo "Please install/upgrade the missing tools and call me again."
221 echo
222 exit 1
226 test $TEST_TYPE $FILE || {
227 echo
228 echo "You must run this script in the top-level $PROJECT directory."
229 echo
230 exit 1
234 if test -z "$NOCONFIGURE"; then
235 echo
236 echo "I am going to run ./configure with the following arguments:"
237 echo
238 echo " $AUTOGEN_CONFIGURE_ARGS $@"
239 echo
241 if test -z "$*"; then
242 echo "If you wish to pass additional arguments, please specify them "
243 echo "on the $0 command line or set the AUTOGEN_CONFIGURE_ARGS "
244 echo "environment variable."
245 echo
250 if test -z "$ACLOCAL_FLAGS"; then
252 acdir=`$ACLOCAL --print-ac-dir`
253 m4list="glib-2.0.m4 glib-gettext.m4 gtk-2.0.m4 intltool.m4 pkg.m4"
255 for file in $m4list
257 if [ ! -f "$acdir/$file" ]; then
258 echo
259 echo "WARNING: aclocal's directory is $acdir, but..."
260 echo " no file $acdir/$file"
261 echo " You may see fatal macro warnings below."
262 echo " If these files are installed in /some/dir, set the "
263 echo " ACLOCAL_FLAGS environment variable to \"-I /some/dir\""
264 echo " or install $acdir/$file."
265 echo
267 done
270 rm -rf autom4te.cache
272 $ACLOCAL $ACLOCAL_FLAGS
273 RC=$?
274 if test $RC -ne 0; then
275 echo "$ACLOCAL gave errors. Please fix the error conditions and try again."
276 exit $RC
279 $LIBTOOLIZE --force || exit $?
281 if test x$enable_gtk_doc = xno; then
282 if test -f gtk-doc.make; then :; else
283 echo "EXTRA_DIST = missing-gtk-doc" > gtk-doc.make
285 echo "WARNING: You have disabled gtk-doc."
286 echo " As a result, you will not be able to generate the API"
287 echo " documentation and 'make dist' will not work."
288 echo
289 else
290 gtkdocize || exit $?
293 # optionally feature autoheader
294 ($AUTOHEADER --version) < /dev/null > /dev/null 2>&1 && $AUTOHEADER || exit 1
296 $AUTOMAKE --add-missing || exit $?
297 $AUTOCONF || exit $?
299 intltoolize --automake || exit $?
302 cd $ORIGDIR
304 if test -z "$NOCONFIGURE"; then
305 $srcdir/configure $AUTOGEN_CONFIGURE_ARGS "$@"
306 RC=$?
307 if test $RC -ne 0; then
308 echo
309 echo "Configure failed or did not finish!"
310 exit $RC
313 echo
314 echo "Now type 'make' to compile the $PROJECT."