Debian Codegraph @

scripts/autogen.sh

raw symbols SCIP
1 #!/bin/sh
2 # Run this to generate all the initial makefiles, etc.
3 # Shamelessly copied from Glade
4
5 DIE=0
6
7 if test -d m4local ; then
8 :
9 else
10 echo "Directory \`m4local' does not exist. Creating it."
11 if test -e m4local ; then
12 echo "**Error**: A file \`m4local' exists and is not a directory."
13 echo "Please remove it."
14 DIE=1
15 fi
16 mkdir m4local
17 fi
18
19 if test -d m4 ; then
20 rm -rf m4
21 elif test -e m4 ; then
22 echo "**Error**: A file \`m4local' exists and is not a directory."
23 echo "Please remove it."
24 exit 1
25 fi
26
27 mkdir m4
28
29 # shellcheck disable=SC2006,SC2154
30 test -f "$srcdir/configure.ac" && sed "s/XXXRELEASE_DATE=XXX/RELEASE_DATE=\"`date '+%d %b %Y'`\"/" "$srcdir/m4extra/stp_release.m4.in" > "$srcdir/m4/stp_release.m4"
31
32 # Make sure all of our auto* bits are up to date.
33 autoreconf -ivf
34
35 # shellcheck disable=SC2006
36 libtoolv=`libtool --version | head -1 | sed 's,.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\(\.[0-9][0-9]*\)\?\).*[a-z]*\([ ]?.*\|\)$,\1,'`
37 if [ -n "$libtoolv" ] ; then
38 # shellcheck disable=SC2006
39 libtool_major=`echo "$libtoolv" | awk -F. '{print $1}'`
40 # shellcheck disable=SC2006
41 libtool_minor=`echo "$libtoolv" | awk -F. '{print $2}'`
42 # shellcheck disable=SC2006,SC2034
43 libtool_point=`echo "$libtoolv" | awk -F. '{print $3}'`
44 if [ "$libtool_major" -le 1 ] && [ "$libtool_minor" -lt 5 ] ; then
45 libtool_err=1
46 fi
47 else
48 libtool_err=1
49 fi
50
51 if [ -z "`type -p glib-mkenums`" ] ; then
52 echo
53 echo "**Error**: You must have \`glib2-mkenums' installed to create a"
54 echo "Gutenprint distribution. This is usually distributed in the"
55 echo "glib2-devel, glib2-dev, or similar package."
56 DIE=1
57 fi
58
59 if [ -n "$libtool_err" ] ; then
60 echo
61 echo "**Warning**: You should have \`libtool' 1.5 or newer installed to"
62 echo "create a Gutenprint distribution. Earlier versions of libtool do"
63 echo "not generate correct code for all platforms."
64 echo "Get ftp://ftp.gnu.org/pub/gnu/libtool/libtool-1.5.tar.gz"
65 echo "(or a newer version if it is available)"
66 DIE=1
67 fi
68
69 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
70 echo
71 echo "**Error**: You must have \`autoconf' installed to"
72 echo "create a Gutenprint distribution."
73 echo "Download the appropriate package for your distribution,"
74 echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
75 DIE=1
76 }
77
78 test -f "$srcdir/ChangeLog" || echo > "$srcdir/ChangeLog"
79
80 (grep "^AM_PROG_LIBTOOL" "$srcdir/configure.ac" >/dev/null) && {
81 (libtool --version) < /dev/null > /dev/null 2>&1 || {
82 echo
83 echo "**Error**: You must have \`libtool' installed to"
84 echo "create a Gutenprint distribution."
85 echo "Get ftp://ftp.gnu.org/pub/gnu/libtool/libtool-1.5.tar.gz"
86 echo "(or a newer version if it is available)"
87 DIE=1
88 }
89 }
90
91 grep "^AM_GNU_GETTEXT" "$srcdir/configure.ac" >/dev/null && {
92 grep "sed.*POTFILES" "$srcdir/configure.ac" >/dev/null || \
93 (gettext --version) < /dev/null > /dev/null 2>&1 || {
94 echo
95 echo "**Error**: You must have \`gettext' installed to"
96 echo "create a Gutenprint distribution."
97 echo "Get ftp://ftp.gnu.org/pub/gnu/gettext/gettext-0.16.tar.gz"
98 echo "(or a newer version if it is available)"
99 DIE=1
100 }
101 }
102
103 (pkg-config --version) < /dev/null > /dev/null 2>&1 || {
104 echo
105 echo "**Error**: You must have \`pkg-config' installed to"
106 echo "create a Gutenprint distribution."
107 echo "Download the appropriate package for your distribution,"
108 echo "or get the source tarball at http://www.freedesktop.org/"
109 DIE=1
110 }
111
112
113 #### MRS: The following now only generates a warning, since earlier
114 #### versions of gettext *do* work, they just don't create the
115 #### right uninstall code.
116
117 # shellcheck disable=SC2006
118 gettextv=`gettext --version | head -1 | awk '{print $NF}'`
119 gettext_err=1
120 if [ -n "$gettextv" ] ; then
121 # shellcheck disable=SC2006
122 gettext_major=`echo "$gettextv" | awk -F. '{print $1}'`
123 # shellcheck disable=SC2006
124 gettext_minor=`echo "$gettextv" | awk -F. '{print $2}'`
125 # shellcheck disable=SC2006,SC2034
126 gettext_point=`echo "$gettextv" | awk -F. '{print $3}'`
127 if [ "$gettext_major" -gt 0 ] || [ "$gettext_minor" -ge 16 ] ; then
128 gettext_err=
129 fi
130 fi
131 if [ -n "$gettext_err" ] ; then
132 echo
133 echo "**Warning**: You must have \`gettext' 0.16 or newer installed to"
134 echo "create a Gutenprint distribution. Earlier versions of gettext do"
135 echo "not generate the correct 'make uninstall' code."
136 echo "Get ftp://ftp.gnu.org/gnu/gettext/gettext-0.16.tar.gz"
137 echo "(or a newer version if it is available)"
138 fi
139
140 (autopoint --version) < /dev/null > /dev/null 2>&1 || {
141 echo
142 echo "**Error**: You must have \`autopoint' installed to"
143 echo "create a Gutenprint distribution."
144 echo "Get ftp://ftp.gnu.org/pub/gnu/gettext/gettext-0.16.tar.gz"
145 echo "(or a newer version if it is available)"
146 DIE=1
147 NO_AUTOMAKE=yes
148 }
149
150 (automake --version) < /dev/null > /dev/null 2>&1 || {
151 echo
152 echo "**Error**: You must have \`automake' installed to"
153 echo "create a Gutenprint distribution."
154 echo "Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.7.tar.gz"
155 echo "(or a newer version if it is available)"
156 DIE=1
157 NO_AUTOMAKE=yes
158 }
159
160
161 # if no automake, don't bother testing for aclocal
162 test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
163 echo
164 echo "**Error**: Missing \`aclocal'. The version of \`automake'"
165 echo "installed doesn't appear recent enough."
166 echo "Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.7.tar.gz"
167 echo "(or a newer version if it is available)"
168 DIE=1
169 }
170
171
172 # Check for existence of dvips
173
174 command -V dvips >/dev/null 2>&1 || {
175 echo
176 echo "***Warning***: You must have \"dvips\" installed to"
177 echo "build the Gutenprint user's guide."
178 echo
179 }
180
181
182 command -V db2html >/dev/null 2>&1 || {
183 echo " "
184 echo "***Warning***: You must have \"db2html\" installed to"
185 echo "build the Gutenprint user's guide."
186 echo "This usually comes from packages named docbook-utils or docbook-toys."
187 echo " "
188 }
189
190 command -V db2pdf >/dev/null 2>&1 || {
191 echo " "
192 echo "***Warning***: You must have \"db2pdf\" installed to"
193 echo "build the Gutenprint developers's guide."
194 echo "This usually comes from packages named docbook-utils-pdf"
195 echo "or docbook-toys."
196 echo " "
197 }
198
199 # Check for convert
200
201 command -V convert >/dev/null 2>&1
202 test $? -ne 0 && {
203 echo " "
204 echo "***Warning***: You must have \"convert\" installed to"
205 echo "build the Gutenprint user's guide."
206 echo "\"convert\" comes from the ImageMagick software package."
207 echo "Go to http://imagemagick.sourceforge.net/http and get"
208 echo "the file ImageMagick-5.3.1.tar.gz"
209 echo "(or a newer version if available)"
210 echo " "
211 }
212
213 # Check for docbook version 4
214 # Note workaround for Fedora installation
215 # Include path for Fedora Docbook. A bit circuitous, but Fedora appends
216 # a bunch of extra stuff to the name of the directory-- including the
217 # version of Fedora (eg -fc9). We don't want to test for every version
218 # of Fedora and modern bourne shells won't expand the glob (*);
219 # therefore, we do a `find` first and then test to see if there are any
220 # results.
221
222 if test -d /usr/share/sgml/docbook ; then
223 # shellcheck disable=SC2006
224 fedora_docbook=`find /usr/share/sgml/docbook -type d -name 'sgml-dtd-4.*' -print`
225 fi
226
227 {
228 test -d "/usr/share/sgml/docbook_4" || test -d "/usr/share/sgml/docbook/dtd/4.0" || test -d "/usr/share/sgml/docbook/dtd/4.1" || test -d "/usr/share/sgml/docbook_4.1" || test -n "$fedora_docbook"
229 } || {
230 echo " "
231 echo "***Warning***: You must have Docbook v4 installed to"
232 echo "build the Gutenprint user's guide."
233 echo " "
234 }
235
236 if test "$DIE" -eq 1; then
237 exit 1
238 fi
239
240 if test -z "$*"; then
241 echo "**Warning**: I am going to run \`configure' with no arguments."
242 echo "If you wish to pass any to it, please specify them on the"
243 # shellcheck disable=SC1117
244 echo "\`$0\' command line."
245 echo
246 fi
247
248 case $CC in
249 xlc )
250 am_opt=--include-deps;;
251 esac
252
253 # We don't have subdirectories. We don't want any untarred directories that
254 # contain configure.ac files to mess things up for us.
255 coin="$srcdir/configure.ac"
256 # shellcheck disable=SC2006
257 dr=`dirname "$coin"`
258 if test -f "$dr/NO-AUTO-GEN"; then
259 echo skipping "$dr" -- flagged as no auto-gen
260 else
261 echo processing "$dr"
262 # shellcheck disable=SC2006
263 macrodirs=`sed -n -e 's,^dnl AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < "$coin"`
264 ( cd "$dr"
265 aclocalinclude="$ACLOCAL_FLAGS"
266 for k in $macrodirs; do
267 if test -d "$k"; then
268 aclocalinclude="$aclocalinclude -I $k"
269 ##else
270 ## echo "**Warning**: No such directory \`$k'. Ignored."
271 fi
272 done
273 if grep "^AM_GNU_GETTEXT" configure.ac >/dev/null; then
274 if grep "sed.*POTFILES" configure.ac >/dev/null; then
275 : #do nothing -- we still have an old unmodified configure.ac
276 else
277 echo "Creating $dr/aclocal.m4 ..."
278 rm -f aclocal.m4
279 test -r aclocal.m4 || touch aclocal.m4
280 # We've removed po/ChangeLog from the repository. Version
281 # 0.10.40 of gettext appends an entry to the ChangeLog every time
282 # anyone runs autogen.sh. Since developers do that a lot, and
283 # then proceed to commit their entire sandbox, we wind up with
284 # an ever-growing po/ChangeLog that generates conflicts on
285 # a routine basis. There's no good reason for this.
286 echo 'This ChangeLog is redundant. Please see the main ChangeLog for i18n changes.' > po/ChangeLog
287 echo >> po/ChangeLog
288 echo 'This file is present only to keep po/Makefile.in.in happy.' >> po/ChangeLog
289 echo "Running autopoint... Ignore non-fatal messages."
290 autopoint --force
291 # shellcheck disable=SC2181
292 if [ $? -ne 0 ] ; then
293 echo 'Autopoint failed!'
294 exit 1
295 fi
296 echo "Making $dr/aclocal.m4 writable ..."
297 test -r "$dr/aclocal.m4" && chmod u+w "$dr/aclocal.m4"
298 fi
299 fi
300 if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
301 echo "Running libtoolize..."
302 libtoolize --force --copy
303 # shellcheck disable=SC2181
304 if [ $? -ne 0 ] ; then
305 echo 'Libtoolize failed!'
306 exit 1
307 fi
308 fi
309 echo "Running aclocal $aclocalinclude ..."
310 # shellcheck disable=SC2086
311 aclocal $aclocalinclude
312 # shellcheck disable=SC2181
313 if [ $? -ne 0 ] ; then
314 echo 'aclocal failed!'
315 exit 1
316 fi
317 if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then
318 echo "Running autoheader..."
319 autoheader
320 # shellcheck disable=SC2181
321 if [ $? -ne 0 ] ; then
322 echo 'autoheader failed!'
323 exit 1
324 fi
325 fi
326 echo "Running automake --gnu $am_opt ..."
327 automake --add-missing --force-missing --copy --gnu $am_opt
328 # shellcheck disable=SC2181
329 if [ $? -ne 0 ] ; then
330 echo 'automake failed!'
331 exit 1
332 fi
333 echo "Running autoconf ..."
334 autoconf
335 # shellcheck disable=SC2181
336 if [ $? -ne 0 ] ; then
337 echo 'autoconf failed!'
338 exit 1
339 fi
340 ) || exit 1
341 fi
342
343 conf_flags="--enable-maintainer-mode" #--enable-iso-c
344
345 if test -z "$NOCONFIGURE"; then
346 echo Running "$srcdir/configure" $conf_flags "$@" ...
347 "$srcdir/configure" $conf_flags "$@" \
348 && echo Now type \`make\' to compile "$PKG_NAME" || exit 1
349 else
350 echo Skipping configure process.
351 fi