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