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.10
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 DIE=1
103 fi
104 if test x$AUTOMAKE != x; then
105 VER=`$AUTOMAKE --version \
106 | grep automake | sed -n 's/.* \([0-9.]*\)[-a-z0-9]*$/\1/p'`
107 check_version "$VER" "$AUTOMAKE_REQUIRED_VERSION"
108 fi
110 echo -n "checking for glib-gettextize >= $GLIB_REQUIRED_VERSION ... "
111 if (glib-gettextize --version) < /dev/null > /dev/null 2>&1; then
112 VER=`glib-gettextize --version \
113 | grep glib-gettextize | sed -n 's/.* \([0-9.]*\)/\1/p'`
114 check_version "$VER" "$GLIB_REQUIRED_VERSION"
115 else
116 echo
117 echo " You must have glib-gettextize installed to compile $PROJECT."
118 echo " glib-gettextize is part of glib-2.0, so you should already"
119 echo " have it. Make sure it is in your PATH."
120 DIE=1
121 fi
123 echo -n "checking for intltool >= $INTLTOOL_REQUIRED_VERSION ... "
124 if (intltoolize --version) < /dev/null > /dev/null 2>&1; then
125 VER=`intltoolize --version \
126 | grep intltoolize | sed -n 's/.* \([0-9.]*\)/\1/p'`
127 check_version "$VER" "$INTLTOOL_REQUIRED_VERSION"
128 else
129 echo
130 echo " You must have intltool installed to compile $PROJECT."
131 echo " Get the latest version from"
132 echo " ftp://ftp.gnome.org/pub/GNOME/sources/intltool/"
133 DIE=1
134 fi
136 if test "$DIE" -eq 1; then
137 echo
138 echo "Please install/upgrade the missing tools and call me again."
139 echo
140 exit 1
141 fi
144 test $TEST_TYPE $FILE || {
145 echo
146 echo "You must run this script in the top-level $PROJECT directory."
147 echo
148 exit 1
149 }
152 if test -z "$ACLOCAL_FLAGS"; then
154 acdir=`$ACLOCAL --print-ac-dir`
155 m4list="glib-2.0.m4 glib-gettext.m4 gtk-2.0.m4 intltool.m4 pkg.m4"
157 for file in $m4list
158 do
159 if [ ! -f "$acdir/$file" ]; then
160 echo
161 echo "WARNING: aclocal's directory is $acdir, but..."
162 echo " no file $acdir/$file"
163 echo " You may see fatal macro warnings below."
164 echo " If these files are installed in /some/dir, set the ACLOCAL_FLAGS "
165 echo " environment variable to \"-I /some/dir\", or install"
166 echo " $acdir/$file."
167 echo
168 fi
169 done
170 fi
172 echo ""
174 attempt_command 'underquoted definition of|[\)\#]Extending' \
175 $ACLOCAL $ACLOCAL_FLAGS
177 # optionally feature autoheader
178 (autoheader --version) < /dev/null > /dev/null 2>&1 && {
179 attempt_command '' autoheader
180 }
182 attempt_command '' $AUTOMAKE --copy --force --add-missing
183 attempt_command '' autoconf
184 attempt_command '^(Please add the files| codeset| progtest|from the|or directly|You will also|ftp://ftp.gnu.org|$)' \
185 glib-gettextize --copy --force
186 attempt_command '' intltoolize --copy --force --automake
188 echo ""
189 echo "Done! Please run './configure' now."