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