1 | #! /bin/sh |
---|
2 | |
---|
3 | # bootstrap: generic bootstrap/autogen.sh script for autotools projects |
---|
4 | # |
---|
5 | # Copyright (c) 2002-2010 Sam Hocevar <sam@hocevar.net> |
---|
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 Sam Hocevar. See |
---|
11 | # http://sam.zoy.org/wtfpl/COPYING 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 | # LolEngine specific: |
---|
20 | sed -ne '/AC_CONFIG_FILES/,$p' configure.ac \ |
---|
21 | | sed -ne 's/[ \[*]*\([a-z].*\).Makefile.*/\1/p' | while read p; do |
---|
22 | if [ ! -f "$p/Makefile.am" ]; then |
---|
23 | echo "bootstrap: $p/Makefile.am does not exist -- creating stub" |
---|
24 | mkdir -p "$p" |
---|
25 | echo "# Stub created by bootstrap" > "$p/Makefile.am" |
---|
26 | fi |
---|
27 | done |
---|
28 | |
---|
29 | # Guess whether we are using configure.ac or configure.in |
---|
30 | if test -f configure.ac; then |
---|
31 | conffile="configure.ac" |
---|
32 | elif test -f configure.in; then |
---|
33 | conffile="configure.in" |
---|
34 | else |
---|
35 | echo "$0: could not find configure.ac or configure.in" |
---|
36 | exit 1 |
---|
37 | fi |
---|
38 | |
---|
39 | # Check for needed features |
---|
40 | auxdir="`sed -ne 's/^[ \t]*A._CONFIG_AUX_DIR *([[ ]*\([^] )]*\).*/\1/p' $conffile`" |
---|
41 | pkgconfig="`grep '^[ \t]*PKG_PROG_PKG_CONFIG' $conffile >/dev/null 2>&1 && echo yes || echo no`" |
---|
42 | libtool="`grep '^[ \t]*A._PROG_LIBTOOL' $conffile >/dev/null 2>&1 && echo yes || echo no`" |
---|
43 | header="`grep '^[ \t]*A._CONFIG_HEADER' $conffile >/dev/null 2>&1 && echo yes || echo no`" |
---|
44 | makefile="`[ -f Makefile.am ] && echo yes || echo no`" |
---|
45 | aclocalflags="`sed -ne 's/^[ \t]*ACLOCAL_AMFLAGS[ \t]*=//p' Makefile.am 2>/dev/null || :`" |
---|
46 | |
---|
47 | # Check for automake |
---|
48 | amvers="no" |
---|
49 | for v in 12 11 10 9 8 7 6 5; do |
---|
50 | if automake-1.${v} --version >/dev/null 2>&1; then |
---|
51 | amvers="-1.${v}" |
---|
52 | break |
---|
53 | elif automake1.${v} --version >/dev/null 2>&1; then |
---|
54 | amvers="1.${v}" |
---|
55 | break |
---|
56 | fi |
---|
57 | done |
---|
58 | |
---|
59 | if test "${amvers}" = "no" && automake --version > /dev/null 2>&1; then |
---|
60 | amvers="`automake --version | sed -e '1s/[^0-9]*//' -e q`" |
---|
61 | if expr "$amvers" "<" "1.5" > /dev/null 2>&1; then |
---|
62 | amvers="no" |
---|
63 | else |
---|
64 | amvers="" |
---|
65 | fi |
---|
66 | fi |
---|
67 | |
---|
68 | if test "$amvers" = "no"; then |
---|
69 | echo "$0: you need automake version 1.5 or later" |
---|
70 | exit 1 |
---|
71 | fi |
---|
72 | |
---|
73 | # Check for autoconf |
---|
74 | acvers="no" |
---|
75 | for v in "" "259" "253"; do |
---|
76 | if autoconf${v} --version >/dev/null 2>&1; then |
---|
77 | acvers="${v}" |
---|
78 | break |
---|
79 | fi |
---|
80 | done |
---|
81 | |
---|
82 | if test "$acvers" = "no"; then |
---|
83 | echo "$0: you need autoconf" |
---|
84 | exit 1 |
---|
85 | fi |
---|
86 | |
---|
87 | # Check for libtool |
---|
88 | if test "$libtool" = "yes"; then |
---|
89 | libtoolize="no" |
---|
90 | if glibtoolize --version >/dev/null 2>&1; then |
---|
91 | libtoolize="glibtoolize" |
---|
92 | else |
---|
93 | for v in "16" "15" "" "14"; do |
---|
94 | if libtoolize${v} --version >/dev/null 2>&1; then |
---|
95 | libtoolize="libtoolize${v}" |
---|
96 | break |
---|
97 | fi |
---|
98 | done |
---|
99 | fi |
---|
100 | |
---|
101 | if test "$libtoolize" = "no"; then |
---|
102 | echo "$0: you need libtool" |
---|
103 | exit 1 |
---|
104 | fi |
---|
105 | fi |
---|
106 | |
---|
107 | # Check for pkg-config |
---|
108 | if test "$pkgconfig" = "yes"; then |
---|
109 | if ! pkg-config --version >/dev/null 2>&1; then |
---|
110 | echo "$0: you need pkg-config" |
---|
111 | exit 1 |
---|
112 | fi |
---|
113 | fi |
---|
114 | |
---|
115 | # Remove old cruft |
---|
116 | 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 |
---|
117 | rm -Rf autom4te.cache |
---|
118 | if test -n "$auxdir"; then |
---|
119 | if test ! -d "$auxdir"; then |
---|
120 | mkdir "$auxdir" |
---|
121 | fi |
---|
122 | aclocalflags="-I $auxdir -I . ${aclocalflags}" |
---|
123 | fi |
---|
124 | |
---|
125 | # Honour M4PATH because sometimes M4 doesn't |
---|
126 | save_IFS=$IFS |
---|
127 | IFS=: |
---|
128 | tmp="$M4PATH" |
---|
129 | for x in $tmp; do |
---|
130 | if test -n "$x"; then |
---|
131 | aclocalflags="-I $x ${aclocalflags}" |
---|
132 | fi |
---|
133 | done |
---|
134 | IFS=$save_IFS |
---|
135 | |
---|
136 | # Explain what we are doing from now |
---|
137 | set -x |
---|
138 | |
---|
139 | # Bootstrap package |
---|
140 | if test "$libtool" = "yes"; then |
---|
141 | ${libtoolize} --copy --force |
---|
142 | if test -n "$auxdir" -a ! "$auxdir" = "." -a -f "ltmain.sh"; then |
---|
143 | echo "$0: working around a minor libtool issue" |
---|
144 | mv ltmain.sh "$auxdir/" |
---|
145 | fi |
---|
146 | fi |
---|
147 | |
---|
148 | aclocal${amvers} ${aclocalflags} |
---|
149 | autoconf${acvers} |
---|
150 | if test "$header" = "yes"; then |
---|
151 | autoheader${acvers} |
---|
152 | fi |
---|
153 | if test "$makefile" = "yes"; then |
---|
154 | #add --include-deps if you want to bootstrap with any other compiler than gcc |
---|
155 | #automake${amvers} --add-missing --copy --include-deps |
---|
156 | automake${amvers} --foreign --add-missing --copy |
---|
157 | fi |
---|
158 | |
---|
159 | # Remove cruft that we no longer want |
---|
160 | rm -Rf autom4te.cache |
---|
161 | |
---|