Debian Codegraph @

bootstrap

raw
1 #! /bin/sh
2
3 # bootstrap — generic bootstrap/autogen.sh script for autotools projects
4 #
5 # Copyright © 2002—2015 Sam Hocevar <[email protected]>
6 #
7 # This program is free software. It comes without any warranty, to
8 # the extent permitted by applicable law. You can redistribute it
9 # and/or modify it under the terms of the Do What the Fuck You Want
10 # to Public License, Version 2, as published by the WTFPL Task Force.
11 # See http://www.wtfpl.net/ for more details.
12 #
13 # The latest version of this script can be found at the following place:
14 # http://caca.zoy.org/wiki/build
15
16 # Die if an error occurs
17 set -e
18
19 # Guess whether we are using configure.ac or configure.in
20 if test -f configure.ac; then
21 conffile="configure.ac"
22 elif test -f configure.in; then
23 conffile="configure.in"
24 else
25 echo "$0: could not find configure.ac or configure.in"
26 exit 1
27 fi
28
29 # Check for needed features
30 auxdir="`sed -ne 's/^[ \t]*A._CONFIG_AUX_DIR *([[ ]*\([^] )]*\).*/\1/p' $conffile`"
31 pkgconfig="`grep '^[ \t]*PKG_PROG_PKG_CONFIG' $conffile >/dev/null 2>&1 && echo yes || echo no`"
32 libtool="`grep '^[ \t]*LT_INIT' $conffile >/dev/null 2>&1 && echo yes || echo no`"
33 header="`grep '^[ \t]*A._CONFIG_HEADERS' $conffile >/dev/null 2>&1 && echo yes || echo no`"
34 makefile="`[ -f Makefile.am ] && echo yes || echo no`"
35 aclocalflags="`sed -ne 's/^[ \t]*ACLOCAL_AMFLAGS[ \t]*=//p' Makefile.am 2>/dev/null || :`"
36
37 # Check for automake
38 amvers="no"
39 for v in "" "-1.15" "-1.14" "-1.13" "-1.12" "-1.11"; do
40 if automake${v} --version > /dev/null 2>&1; then
41 amvers=${v}
42 break
43 fi
44 done
45
46 if test "$amvers" = "no"; then
47 echo "$0: automake not found"
48 exit 1
49 fi
50
51 # Check for autoconf
52 acvers="no"
53 for v in "" "259" "253"; do
54 if autoconf${v} --version >/dev/null 2>&1; then
55 acvers="${v}"
56 break
57 fi
58 done
59
60 if test "$acvers" = "no"; then
61 echo "$0: autoconf not found"
62 exit 1
63 fi
64
65 # Check for libtool
66 if test "$libtool" = "yes"; then
67 libtoolize="no"
68 if glibtoolize --version >/dev/null 2>&1; then
69 libtoolize="glibtoolize"
70 else
71 for v in "16" "15" "" "14"; do
72 if libtoolize${v} --version >/dev/null 2>&1; then
73 libtoolize="libtoolize${v}"
74 break
75 fi
76 done
77 fi
78
79 if test "$libtoolize" = "no"; then
80 echo "$0: libtool not found"
81 exit 1
82 fi
83 fi
84
85 # Check for pkg-config
86 if test "$pkgconfig" = "yes"; then
87 if ! pkg-config --version >/dev/null 2>&1; then
88 echo "$0: pkg-config not found"
89 exit 1
90 fi
91 fi
92
93 # Remove old cruft
94 for x in aclocal.m4 configure config.guess config.log config.sub config.cache config.h.in config.h compile libtool.m4 ltoptions.m4 ltsugar.m4 ltversion.m4 ltmain.sh libtool ltconfig missing mkinstalldirs depcomp install-sh; do rm -f $x autotools/$x; if test -n "$auxdir"; then rm -f "$auxdir/$x"; fi; done
95 rm -Rf autom4te.cache
96 if test -n "$auxdir"; then
97 if test ! -d "$auxdir"; then
98 mkdir "$auxdir"
99 fi
100 aclocalflags="-I $auxdir -I . ${aclocalflags}"
101 fi
102
103 # Honour M4PATH because sometimes M4 doesn't
104 save_IFS=$IFS
105 IFS=:
106 tmp="$M4PATH"
107 for x in $tmp; do
108 if test -n "$x"; then
109 aclocalflags="-I $x ${aclocalflags}"
110 fi
111 done
112 IFS=$save_IFS
113
114 # Explain what we are doing from now
115 set -x
116
117 # Bootstrap package
118 if test "$libtool" = "yes"; then
119 ${libtoolize} --copy --force
120 if test -n "$auxdir" -a ! "$auxdir" = "." -a -f "ltmain.sh"; then
121 echo "$0: working around a minor libtool issue"
122 mv ltmain.sh "$auxdir/"
123 fi
124 fi
125
126 aclocal${amvers} ${aclocalflags}
127 autoconf${acvers}
128 if test "$header" = "yes"; then
129 autoheader${acvers}
130 fi
131 if test "$makefile" = "yes"; then
132 #add --include-deps if you want to bootstrap with any other compiler than gcc
133 #automake${amvers} --add-missing --copy --include-deps
134 automake${amvers} --foreign --add-missing --copy
135 fi
136
137 # Remove cruft that we no longer want
138 rm -Rf autom4te.cache
139