2070
by keescook
Need to use bash, Ubuntu's /bin/sh is dash, which is unsafe for some of the bashisms in this script now. |
1 |
#!/bin/bash
|
1
by mental
moving trunk for module inkscape |
2 |
|
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.
|
|
11 |
||
12 |
||
13 |
PROJECT="Inkscape" |
|
14 |
TEST_TYPE=-f |
|
15 |
FILE=inkscape.spec.in |
|
16 |
||
17 |
AUTOCONF_REQUIRED_VERSION=2.52 |
|
4654
by gouldtj
r17853@shi: ted | 2008-02-04 09:54:45 -0800 |
18 |
AUTOMAKE_REQUIRED_VERSION=1.10 |
1
by mental
moving trunk for module inkscape |
19 |
GLIB_REQUIRED_VERSION=2.0.0 |
20 |
INTLTOOL_REQUIRED_VERSION=0.17 |
|
21 |
||
212
by pjrm
Extra quoting in various places. |
22 |
srcdir=`dirname "$0"` |
1
by mental
moving trunk for module inkscape |
23 |
test -z "$srcdir" && srcdir=. |
24 |
ORIGDIR=`pwd` |
|
212
by pjrm
Extra quoting in various places. |
25 |
cd "$srcdir" |
1
by mental
moving trunk for module inkscape |
26 |
|
212
by pjrm
Extra quoting in various places. |
27 |
./tools-version.sh |
1
by mental
moving trunk for module inkscape |
28 |
|
29 |
check_version ()
|
|
30 |
{
|
|
2069
by keescook
Protect arguments with quotes |
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;` |
|
2063
by luca_bruno
better version comparison |
35 |
test -z "$MINOR1" && MINOR1="0"; |
36 |
||
2307
by mjwybrow
* autogen.sh: Improve the versionCheck test to be more portable. |
37 |
if [ "$MAJOR1" -gt "$MAJOR2" ] || [ "$MAJOR1" -eq "$MAJOR2" -a "$MINOR1" -ge "$MINOR2" ]; then |
1
by mental
moving trunk for module inkscape |
38 |
echo "yes (version $1)" |
39 |
else
|
|
40 |
echo "Too old (found version $1)!" |
|
41 |
DIE=1 |
|
42 |
fi
|
|
43 |
}
|
|
44 |
||
45 |
attempt_command () { |
|
46 |
IGNORE=$1 |
|
47 |
shift
|
|
48 |
||
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 |
}
|
|
65 |
||
66 |
echo
|
|
4481
by bryce
w.s. |
67 |
echo "I am testing that you have the required versions of autoconf," |
1
by mental
moving trunk for module inkscape |
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
|
|
71 |
||
72 |
DIE=0 |
|
73 |
||
74 |
echo -n "checking for autoconf >= $AUTOCONF_REQUIRED_VERSION ... " |
|
75 |
if (autoconf --version) < /dev/null > /dev/null 2>&1; then |
|
76 |
VER=`autoconf --version \ |
|
212
by pjrm
Extra quoting in various places. |
77 |
| grep -iw autoconf | sed -n 's/.* \([0-9.]*\)[-a-z0-9]*$/\1/p'` |
78 |
check_version "$VER" "$AUTOCONF_REQUIRED_VERSION" |
|
1
by mental
moving trunk for module inkscape |
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
|
|
86 |
||
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.
|
|
9109
by Jon A. Cruz
Fixing autogen for OS X. |
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 |
|
4507
by gouldtj
r17647@shi: ted | 2008-01-14 23:30:32 -0800 |
93 |
AUTOMAKE=automake-1.10 |
94 |
ACLOCAL=aclocal-1.10 |
|
1
by mental
moving trunk for module inkscape |
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
|
|
4507
by gouldtj
r17647@shi: ted | 2008-01-14 23:30:32 -0800 |
104 |
echo " You must have automake 1.10 or newer installed to compile $PROJECT." |
1
by mental
moving trunk for module inkscape |
105 |
DIE=1 |
106 |
fi
|
|
107 |
if test x$AUTOMAKE != x; then |
|
108 |
VER=`$AUTOMAKE --version \ |
|
212
by pjrm
Extra quoting in various places. |
109 |
| grep automake | sed -n 's/.* \([0-9.]*\)[-a-z0-9]*$/\1/p'` |
110 |
check_version "$VER" "$AUTOMAKE_REQUIRED_VERSION" |
|
1
by mental
moving trunk for module inkscape |
111 |
fi
|
112 |
||
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 \ |
|
212
by pjrm
Extra quoting in various places. |
116 |
| grep glib-gettextize | sed -n 's/.* \([0-9.]*\)/\1/p'` |
117 |
check_version "$VER" "$GLIB_REQUIRED_VERSION" |
|
1
by mental
moving trunk for module inkscape |
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
|
|
125 |
||
126 |
echo -n "checking for intltool >= $INTLTOOL_REQUIRED_VERSION ... " |
|
127 |
if (intltoolize --version) < /dev/null > /dev/null 2>&1; then |
|
128 |
VER=`intltoolize --version \ |
|
212
by pjrm
Extra quoting in various places. |
129 |
| grep intltoolize | sed -n 's/.* \([0-9.]*\)/\1/p'` |
130 |
check_version "$VER" "$INTLTOOL_REQUIRED_VERSION" |
|
1
by mental
moving trunk for module inkscape |
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
|
|
138 |
||
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
|
|
145 |
||
146 |
||
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 |
}
|
|
153 |
||
154 |
||
155 |
if test -z "$ACLOCAL_FLAGS"; then |
|
156 |
||
157 |
acdir=`$ACLOCAL --print-ac-dir` |
|
8254.1.46
by Ted Gould
Adding all of the library stuff in. Including libtool in configure and libtoolize in autogen.sh |
158 |
m4list="glib-2.0.m4 glib-gettext.m4 gtk-2.0.m4 intltool.m4 pkg.m4 libtool.m4" |
1
by mental
moving trunk for module inkscape |
159 |
|
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
|
|
174 |
||
175 |
echo "" |
|
176 |
||
177 |
attempt_command 'underquoted definition of|[\)\#]Extending' \ |
|
178 |
$ACLOCAL $ACLOCAL_FLAGS |
|
179 |
||
180 |
# optionally feature autoheader
|
|
181 |
(autoheader --version) < /dev/null > /dev/null 2>&1 && { |
|
182 |
attempt_command '' autoheader
|
|
183 |
}
|
|
184 |
||
9797
by Jon A. Cruz
Fix libtoolize hardcoding for OS X. |
185 |
# use glibtoolize if it is available (darwin)
|
186 |
(glibtoolize --version) < /dev/null > /dev/null 2>&1 && LIBTOOLIZE=glibtoolize || LIBTOOLIZE=libtoolize |
|
187 |
||
188 |
attempt_command '' $LIBTOOLIZE |
|
2740
by keescook
more missing files, updated autogen to not use symlinks |
189 |
attempt_command '' $AUTOMAKE --copy --force --add-missing |
1
by mental
moving trunk for module inkscape |
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
|
|
194 |
||
195 |
echo "" |
|
196 |
echo "Done! Please run './configure' now." |