1#!/bin/sh
2
3# This script does all the magic calls to automake/autoconf and
4# friends that are needed to configure a cvs checkout.  You need a
5# couple of extra tools to run this script successfully.
6#
7# If you are compiling from a released tarball you don't need these
8# tools and you shouldn't use this script.  Just call ./configure
9# directly.
10
11PROJECT="gimp-help-2"
12TEST_TYPE=-f
13FILE=src/gimp.xml
14
15srcdir=`dirname $0`
16test -z "$srcdir" && srcdir=.
17ORIGDIR=`pwd`
18cd $srcdir
19
20DIE=0
21
22echo -n "Looking for latest automake version ... "
23required_automake_minor=10
24minor=16
25while [ $minor -ge $required_automake_minor ]; do
26    ver=1.$minor
27    if (automake-$ver --version) < /dev/null > /dev/null 2>&1; then
28        AUTOMAKE=automake-$ver
29        ACLOCAL=aclocal-$ver
30	echo $ver
31        break
32    fi
33    minor=`expr $minor - 1`
34done
35
36if [ -z "$AUTOMAKE" ]; then
37    echo
38    echo "  You must have automake 1.$required_automake_minor or newer" \
39            "installed to compile $PROJECT."
40    echo "  Download the appropriate package for your distribution,"
41    echo "  or get the source tarball at ftp://ftp.gnu.org/pub/gnu/automake/"
42    DIE=1
43fi
44
45if test "$DIE" -eq 1; then
46    echo
47    echo "Please install/upgrade the missing tools and call me again."
48    echo
49    exit 1
50fi
51
52
53test $TEST_TYPE $FILE || {
54    echo
55    echo "You must run this script in the top-level $PROJECT directory."
56    echo
57    exit 1
58}
59
60
61if test -z "$NOCONFIGURE"; then
62  echo
63  echo "I am going to run ./configure with the following arguments:"
64  echo
65  echo "  --enable-maintainer-mode --enable-build $AUTOGEN_CONFIGURE_ARGS $@"
66  echo
67
68  if test -z "$*"; then
69      echo "If you wish to pass additional arguments, please specify them "
70      echo "on the $0 command line or set the AUTOGEN_CONFIGURE_ARGS "
71      echo "environment variable."
72      echo
73  fi
74fi
75
76if test -z "$ACLOCAL_FLAGS"; then
77    acdir=`$ACLOCAL --print-ac-dir`
78    m4list="pkg.m4"
79
80    for file in $m4list
81    do
82        if [ ! -f "$acdir/$file" ]; then
83            echo
84            echo "WARNING: aclocal's directory is $acdir, but..."
85            echo "         no file $acdir/$file"
86            echo "         You may see fatal macro warnings below."
87            echo "         If these files are installed in /some/dir, set the ACLOCAL_FLAGS "
88            echo "         environment variable to \"-I /some/dir\", or install"            echo "         $acdir/$file."
89            echo
90        fi
91    done
92fi
93
94$ACLOCAL $ACLOCAL_FLAGS
95RC=$?
96if test $RC -ne 0; then
97   echo "$ACLOCAL gave errors. Please fix the error conditions and try again."
98   exit 1
99fi
100
101$AUTOMAKE --add-missing || exit 1
102if [ -e Makefile.in ]; then
103    sed -e 's/^# HIDE FROM AUTOMAKE #//' \
104        -e '/^all\(-local\)\?:/i\
105\
106\
107'       Makefile.in > Makefile.in.tmp &&
108    mv Makefile.in.tmp Makefile.in
109else
110    echo >&2 "Error: cannot find Makefile.in"
111    exit 1
112fi
113autoconf || exit 1
114
115rm -rf autom4te.cache
116
117cd $ORIGDIR
118
119if test -z "$NOCONFIGURE"; then
120  if $srcdir/configure --enable-maintainer-mode "$@"; then
121    echo
122    echo "Now type 'make' to compile $PROJECT."
123  else
124    echo
125    echo "Configure failed or did not finish!"
126    exit 1
127  fi
128fi
129