Debian Codegraph @

bootstrap

raw ◀ ▶
1 Debian patch touch this file
1 #!/bin/sh
2 #
3 # License: GNU General Public License (GPL)
4 # Copyright 2001 horms <[email protected]>
5 # (heavily mangled by alanr)
6 #
7 # bootstrap: set up the project and get it ready to make
8 #
9 # Basically, we run autoconf, automake and libtool in the
10 # right way to get things set up for this environment.
11 #
12 # We also look and see if those tools are installed, and
13 # tell you where to get them if they're not.
14 #
15 # Our goal is to not require dragging along anything
16 # more than we need. If this doesn't work on your system,
17 # (i.e., your /bin/sh is broken) send us a patch.
18 #
19 # This code loosely based on the corresponding named script in
20 # enlightenment, and also on the sort-of-standard autoconf
21 # bootstrap script.
22
23 # Run this to generate all the initial makefiles, etc.
24
25 testProgram()
26 {
27 cmd=$1
28
29 if [ -z "$cmd" ]; then
30 return 1;
31 fi
32
33 arch=`uname -s`
34
35 # Make sure the which is in an if-block... on some platforms it throws exceptions
36 #
37 # The ERR trap is not executed if the failed command is part
38 # of an until or while loop, part of an if statement, part of a &&
39 # or || list.
40 if
41 which $cmd </dev/null >/dev/null 2>&1
42 then
43 :
44 else
45 return 1
46 fi
47
48 # The GNU standard is --version
49 if
50 $cmd --version </dev/null >/dev/null 2>&1
51 then
52 return 0
53 fi
54
55 # Maybe it suppports -V instead
56 if
57 $cmd -V </dev/null >/dev/null 2>&1
58 then
59 return 0
60 fi
61
62 # Nope, the program seems broken
63 return 1
64 }
65
66 srcdir=`dirname $0`
67 CONFIG=$srcdir/configure
68 if
69 [ X$srcdir = "X" ]
70 then
71 srcdir=.
72 fi
73
74 case "$*" in
75 --help) IsHelp=yes;;
76 -?) IsHelp=yes; set -- --help;;
77 *) IsHelp=no;;
78 esac
79
80 arch=`uname -s`
81 # Disable the errors on FreeBSD until a fix can be found.
82 if [ ! "$arch" = "FreeBSD" ]; then
83 set -e
84 #
85 # All errors are fatal from here on out...
86 # The shell will complain and exit on any "uncaught" error code.
87 #
88 #
89 # And the trap will ensure sure some kind of error message comes out.
90 #
91 trap 'echo ""; echo "$0 exiting due to error (sorry!)." >&2' 0
92 fi
93
94 HERE=`pwd`
95 cd $srcdir
96
97 RC=0
98
99 gnu="ftp://ftp.gnu.org/pub/gnu"
100
101 # Check for Autoconf
102 pkg="autoconf"
103 URL=$gnu/$pkg/
104 for command in autoconf autoconf213 autoconf253 autoconf259
105 do
106 if
107 testProgram $command == 1
108 then
109 : OK $pkg is installed
110 autoconf=$command
111 autoheader=`echo "$autoconf" | sed -e 's/autoconf/autoheader/'`
112 autom4te=`echo "$autoconf" | sed -e 's/autoconf/autmo4te/'`
113 autoreconf=`echo "$autoconf" | sed -e 's/autoconf/autoreconf/'`
114 autoscan=`echo "$autoconf" | sed -e 's/autoconf/autoscan/'`
115 autoupdate=`echo "$autoconf" | sed -e 's/autoconf/autoupdate/'`
116 ifnames=`echo "$autoconf" | sed -e 's/autoconf/ifnames/'`
117 fi
118 done
119
120
121 # Check to see if we got a valid command.
122 if
123 $autoconf --version </dev/null >/dev/null 2>&1
124 then
125 echo "Autoconf package $autoconf found."
126 else
127 RC=$?
128 cat <<-EOF >&2
129
130 You must have $pkg installed to compile the linux-ha package.
131 Download the appropriate package for your system,
132 or get the source tarball at: $URL
133 EOF
134 fi
135
136 # Create local copy so that the incremental updates will work.
137 rm -f ./autoconf
138 ln -s `which $autoconf` ./autoconf
139
140 # Check for automake
141 pkg="automake"
142 URL=$gnu/$pkg/
143 for command in automake automake14 automake-1.4 automake15 automake-1.5 automake17 automake-1.7 automake19 automake-1.9
144 do
145 if
146 testProgram $command
147 then
148 : OK $pkg is installed
149 automake=$command
150 aclocal=`echo "$automake" | sed -e 's/automake/aclocal/'`
151
152 fi
153 done
154
155 # Check to see if we got a valid command.
156 if
157 $automake --version </dev/null >/dev/null 2>&1
158 then
159 echo "Automake package $automake found."
160 else
161 RC=$?
162 cat <<-EOF >&2
163
164 You must have $pkg installed to compile the linux-ha package.
165 Download the appropriate package for your system,
166 or get the source tarball at: $URL
167 EOF
168 fi
169
170 # Create local copy so that the incremental updates will work.
171 rm -f ./automake
172 ln -s `which $automake` ./automake
173
174 # Check for Libtool
175 pkg="libtool"
•176 URL=$gnu/$pkg/
177 if
178 testProgram libtoolize
179 then
180 : OK $pkg is installed
181 libtoolize=libtoolize
182 fi
183
184 # Check to see if we got a valid command.
185 if
•186 $libtoolize --version </dev/null >/dev/null 2>&1
187 then
•188 echo "Libtool package $libtoolize found."
189 else
190 RC=$?
191 cat <<-EOF >&2
192
193 You must have $pkg installed to compile the linux-ha package.
194 Download the appropriate package for your system,
195 or get the source tarball at: $URL
196 EOF
197 fi
198
199 case $RC in
200 0) ;;
201 *) exit $RC;;
202 esac
203
204 case $IsHelp in
205 yes) $CONFIG "$@"; trap '' 0; exit 0;;
206 esac
207
208 oneline() {
209 read x; echo "$x"
210 }
211
•212 LT_version=`$libtoolize --version | oneline | sed -e 's%^[^0-9]*%%' -e s'% .*%%'`
213 LT_majvers=`echo "$LT_version" | sed -e 's%\..*%%'`
214 LT_minvers=`echo "$LT_version" | sed -e 's%^[^.]*\.%%' `
215 LT_minnum=`echo "$LT_minvers" | sed -e 's%[^0-9].*%%'`
216
217 if
218 [ $LT_majvers -lt 1 ] || [ $LT_majvers = 1 -a $LT_minnum -lt 4 ]
219 then
220 echo "Minimum version of libtool is 1.4. You have $LT_version installed."
221 exit 1
222 fi
223
224 echo $aclocal $ACLOCAL_FLAGS
225 $aclocal $ACLOCAL_FLAGS
226
227 # Create local copy so that the incremental updates will work.
228 rm -f ./autoheader
229 ln -s `which $autoheader` ./autoheader
230
231 if
232 echo $autoheader --version < /dev/null > /dev/null 2>&1
233 $autoheader --version < /dev/null > /dev/null 2>&1
234 then
235 echo $autoheader
236 $autoheader
237 fi
238
239 rm -rf libltdl libltdl.tar
240 echo $libtoolize --ltdl --force --copy
241 GREP_OPTIONS= $libtoolize --ltdl --force --copy || {
242 if test -f /etc/debian_version; then
243 echo ""
244 echo "Running Debian? You probably need to install libltdl3-dev."
245 fi
246 exit 1
247 }
248
249
250 echo $aclocal $ACLOCAL_FLAGS
251 $aclocal $ACLOCAL_FLAGS
252
253 # Emulate the old --ltdl-tar option...
254 # If the libltdl directory is required we will unpack it later
255 tar -cf libltdl.tar libltdl
256 rm -rf libltdl
257
258 echo $automake --add-missing --include-deps --copy
259 $automake --add-missing --include-deps --copy
260
261 echo $autoconf
262 $autoconf
263
264 test -f libtool.m4 || touch libtool.m4
265 test -f ltdl.m4 || touch ltdl.m4
266
267 cd $HERE
268
269 if
270 [ $# -lt 1 ]
271 then
272 echo Now run $CONFIG.
273 else
274 echo $CONFIG "$@"
275 $CONFIG "$@"
276
277 echo "Now type 'gmake' to compile the system, noting that"
278 echo "'gmake' is often available as 'make'."
279 echo
280 fi
281 trap '' 0