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.10 --version) < /dev/null > /dev/null 2>&1; then
90 AUTOMAKE=automake-1.10
91 ACLOCAL=aclocal-1.10
92 elif (automake --version) < /dev/null > /dev/null 2>&1; then
93 # Leave unversioned automake for a last resort: it may be a version earlier
94 # than what we require.
95 # (In particular, it might mean automake 1.4: that version didn't default to
96 # installing a versioned name.)
97 AUTOMAKE=automake
98 ACLOCAL=aclocal
99 else
100 echo
101 echo " You must have automake 1.10 or newer installed to compile $PROJECT."
102 echo " Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.8.5.tar.gz"
103 echo " (or a newer version of 1.8 if it is available; note that 1.9 is buggy)"
104 DIE=1
105 fi
106 if test x$AUTOMAKE != x; then
107 VER=`$AUTOMAKE --version \
108 | grep automake | sed -n 's/.* \([0-9.]*\)[-a-z0-9]*$/\1/p'`
109 check_version "$VER" "$AUTOMAKE_REQUIRED_VERSION"
111 # Exclude automake 1.9.[0-6]
112 if expr $VER \>= 1.9.0 >/dev/null && expr $VER \<= 1.9.6 >/dev/null ; then
113 echo
114 echo " You must have automake less than 1.9.0 or newer than 1.9.6"
115 echo " Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.8.5.tar.gz"
116 echo " (or a newer version of 1.8 if it is available)"
117 DIE=1
118 fi
119 fi
121 echo -n "checking for glib-gettextize >= $GLIB_REQUIRED_VERSION ... "
122 if (glib-gettextize --version) < /dev/null > /dev/null 2>&1; then
123 VER=`glib-gettextize --version \
124 | grep glib-gettextize | sed -n 's/.* \([0-9.]*\)/\1/p'`
125 check_version "$VER" "$GLIB_REQUIRED_VERSION"
126 else
127 echo
128 echo " You must have glib-gettextize installed to compile $PROJECT."
129 echo " glib-gettextize is part of glib-2.0, so you should already"
130 echo " have it. Make sure it is in your PATH."
131 DIE=1
132 fi
134 echo -n "checking for intltool >= $INTLTOOL_REQUIRED_VERSION ... "
135 if (intltoolize --version) < /dev/null > /dev/null 2>&1; then
136 VER=`intltoolize --version \
137 | grep intltoolize | sed -n 's/.* \([0-9.]*\)/\1/p'`
138 check_version "$VER" "$INTLTOOL_REQUIRED_VERSION"
139 else
140 echo
141 echo " You must have intltool installed to compile $PROJECT."
142 echo " Get the latest version from"
143 echo " ftp://ftp.gnome.org/pub/GNOME/sources/intltool/"
144 DIE=1
145 fi
147 if test "$DIE" -eq 1; then
148 echo
149 echo "Please install/upgrade the missing tools and call me again."
150 echo
151 exit 1
152 fi
155 test $TEST_TYPE $FILE || {
156 echo
157 echo "You must run this script in the top-level $PROJECT directory."
158 echo
159 exit 1
160 }
163 if test -z "$ACLOCAL_FLAGS"; then
165 acdir=`$ACLOCAL --print-ac-dir`
166 m4list="glib-2.0.m4 glib-gettext.m4 gtk-2.0.m4 intltool.m4 pkg.m4"
168 for file in $m4list
169 do
170 if [ ! -f "$acdir/$file" ]; then
171 echo
172 echo "WARNING: aclocal's directory is $acdir, but..."
173 echo " no file $acdir/$file"
174 echo " You may see fatal macro warnings below."
175 echo " If these files are installed in /some/dir, set the ACLOCAL_FLAGS "
176 echo " environment variable to \"-I /some/dir\", or install"
177 echo " $acdir/$file."
178 echo
179 fi
180 done
181 fi
183 echo ""
185 attempt_command 'underquoted definition of|[\)\#]Extending' \
186 $ACLOCAL $ACLOCAL_FLAGS
188 # optionally feature autoheader
189 (autoheader --version) < /dev/null > /dev/null 2>&1 && {
190 attempt_command '' autoheader
191 }
193 attempt_command '' $AUTOMAKE --copy --force --add-missing
194 attempt_command '' autoconf
195 attempt_command '^(Please add the files| codeset| progtest|from the|or directly|You will also|ftp://ftp.gnu.org|$)' \
196 glib-gettextize --copy --force
197 attempt_command '' intltoolize --copy --force --automake
199 echo ""
200 echo "Done! Please run './configure' now."