1 #!/bin/bash
3 # This script does all the magic calls to automake/autoconf and
4 # friends that are needed to configure a cvs checkout. As described in
5 # the file HACKING you need a couple of extra tools to run this script
6 # successfully.
7 #
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.
13 PROJECT="Inkscape"
14 TEST_TYPE=-f
15 FILE=inkscape.spec.in
17 AUTOCONF_REQUIRED_VERSION=2.52
18 AUTOMAKE_REQUIRED_VERSION=1.7
19 GLIB_REQUIRED_VERSION=2.0.0
20 INTLTOOL_REQUIRED_VERSION=0.17
22 srcdir=`dirname "$0"`
23 test -z "$srcdir" && srcdir=.
24 ORIGDIR=`pwd`
25 cd "$srcdir"
27 ./tools-version.sh
29 check_version ()
30 {
31 MAJOR1=`echo "$1" | cut -d"." -f1`;
32 MINOR1=`echo "$1" | cut -s -d"." -f2`;
33 MAJOR2=`echo "$2" | cut -d"." -f1`;
34 MINOR2=`echo "$2" | cut -d"." -f2;`
35 test -z "$MINOR1" && MINOR1="0";
37 if [ "$MAJOR1" -gt "$MAJOR2" ] || [ "$MAJOR1" -eq "$MAJOR2" -a "$MINOR1" -ge "$MINOR2" ]; then
38 echo "yes (version $1)"
39 else
40 echo "Too old (found version $1)!"
41 DIE=1
42 fi
43 }
45 attempt_command () {
46 IGNORE=$1
47 shift
49 echo "Running $@ ..."
50 ERR="`$@ 2>&1`"
51 errcode=$?
52 if [ "x$IGNORE" = "x" ]; then
53 ERR=`echo "$ERR"`
54 else
55 ERR=`echo "$ERR" | egrep -v "$IGNORE"`
56 fi
57 if [ "x$ERR" != "x" ]; then
58 echo "$ERR" | awk '{print " " $0}'
59 fi
60 if [ $errcode -gt 0 ]; then
61 echo "Please fix the error conditions and try again."
62 exit 1
63 fi
64 }
66 echo
67 echo "I am testing that you have the required versions of autoconf,"
68 echo "automake, glib-gettextize and intltoolize. This test is not foolproof and"
69 echo "if anything goes wrong, there may be guidance in the file HACKING.txt"
70 echo
72 DIE=0
74 echo -n "checking for autoconf >= $AUTOCONF_REQUIRED_VERSION ... "
75 if (autoconf --version) < /dev/null > /dev/null 2>&1; then
76 VER=`autoconf --version \
77 | grep -iw autoconf | sed -n 's/.* \([0-9.]*\)[-a-z0-9]*$/\1/p'`
78 check_version "$VER" "$AUTOCONF_REQUIRED_VERSION"
79 else
80 echo
81 echo " You must have autoconf installed to compile $PROJECT."
82 echo " Download the appropriate package for your distribution,"
83 echo " or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
84 DIE=1;
85 fi
87 echo -n "checking for automake >= $AUTOMAKE_REQUIRED_VERSION ... "
88 # Prefer earlier versions just so that the earliest supported version gets test coverage by developers.
89 if (automake-1.7 --version) < /dev/null > /dev/null 2>&1; then
90 AUTOMAKE=automake-1.7
91 ACLOCAL=aclocal-1.7
92 elif (automake-1.8 --version) < /dev/null > /dev/null 2>&1; then
93 AUTOMAKE=automake-1.8
94 ACLOCAL=aclocal-1.8
95 elif (automake --version) < /dev/null > /dev/null 2>&1; then
96 # Leave unversioned automake for a last resort: it may be a version earlier
97 # than what we require.
98 # (In particular, it might mean automake 1.4: that version didn't default to
99 # installing a versioned name.)
100 AUTOMAKE=automake
101 ACLOCAL=aclocal
102 else
103 echo
104 echo " You must have automake 1.7 or newer installed to compile $PROJECT."
105 echo " Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.8.5.tar.gz"
106 echo " (or a newer version of 1.8 if it is available; note that 1.9 is buggy)"
107 DIE=1
108 fi
109 if test x$AUTOMAKE != x; then
110 VER=`$AUTOMAKE --version \
111 | grep automake | sed -n 's/.* \([0-9.]*\)[-a-z0-9]*$/\1/p'`
112 check_version "$VER" "$AUTOMAKE_REQUIRED_VERSION"
114 # Exclude automake 1.9.[0-6]
115 if expr $VER \>= 1.9.0 >/dev/null && expr $VER \<= 1.9.6 >/dev/null ; then
116 echo
117 echo " You must have automake less than 1.9.0 or newer than 1.9.6"
118 echo " Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.8.5.tar.gz"
119 echo " (or a newer version of 1.8 if it is available)"
120 DIE=1
121 fi
122 fi
124 echo -n "checking for glib-gettextize >= $GLIB_REQUIRED_VERSION ... "
125 if (glib-gettextize --version) < /dev/null > /dev/null 2>&1; then
126 VER=`glib-gettextize --version \
127 | grep glib-gettextize | sed -n 's/.* \([0-9.]*\)/\1/p'`
128 check_version "$VER" "$GLIB_REQUIRED_VERSION"
129 else
130 echo
131 echo " You must have glib-gettextize installed to compile $PROJECT."
132 echo " glib-gettextize is part of glib-2.0, so you should already"
133 echo " have it. Make sure it is in your PATH."
134 DIE=1
135 fi
137 echo -n "checking for intltool >= $INTLTOOL_REQUIRED_VERSION ... "
138 if (intltoolize --version) < /dev/null > /dev/null 2>&1; then
139 VER=`intltoolize --version \
140 | grep intltoolize | sed -n 's/.* \([0-9.]*\)/\1/p'`
141 check_version "$VER" "$INTLTOOL_REQUIRED_VERSION"
142 else
143 echo
144 echo " You must have intltool installed to compile $PROJECT."
145 echo " Get the latest version from"
146 echo " ftp://ftp.gnome.org/pub/GNOME/sources/intltool/"
147 DIE=1
148 fi
150 if test "$DIE" -eq 1; then
151 echo
152 echo "Please install/upgrade the missing tools and call me again."
153 echo
154 exit 1
155 fi
158 test $TEST_TYPE $FILE || {
159 echo
160 echo "You must run this script in the top-level $PROJECT directory."
161 echo
162 exit 1
163 }
166 if test -z "$ACLOCAL_FLAGS"; then
168 acdir=`$ACLOCAL --print-ac-dir`
169 m4list="glib-2.0.m4 glib-gettext.m4 gtk-2.0.m4 intltool.m4 pkg.m4"
171 for file in $m4list
172 do
173 if [ ! -f "$acdir/$file" ]; then
174 echo
175 echo "WARNING: aclocal's directory is $acdir, but..."
176 echo " no file $acdir/$file"
177 echo " You may see fatal macro warnings below."
178 echo " If these files are installed in /some/dir, set the ACLOCAL_FLAGS "
179 echo " environment variable to \"-I /some/dir\", or install"
180 echo " $acdir/$file."
181 echo
182 fi
183 done
184 fi
186 echo ""
188 attempt_command 'underquoted definition of|[\)\#]Extending' \
189 $ACLOCAL $ACLOCAL_FLAGS
191 # optionally feature autoheader
192 (autoheader --version) < /dev/null > /dev/null 2>&1 && {
193 attempt_command '' autoheader
194 }
196 attempt_command '' $AUTOMAKE --copy --force --add-missing
197 attempt_command '' autoconf
198 attempt_command '^(Please add the files| codeset| progtest|from the|or directly|You will also|ftp://ftp.gnu.org|$)' \
199 glib-gettextize --copy --force
200 attempt_command '' intltoolize --copy --force --automake
202 echo ""
203 echo "Done! Please run './configure' now."