]>
Commit | Line | Data |
---|---|---|
01c56de4 | 1 | #! /bin/sh |
86996fca | 2 | # Print a version string. |
179b2419 | 3 | scriptversion=2014-12-08.12; # UTC |
01c56de4 | 4 | |
bbb44d83 | 5 | # Bootstrap this package from checked-out sources. |
01c56de4 | 6 | |
179b2419 | 7 | # Copyright (C) 2003-2014 Free Software Foundation, Inc. |
1f65350a | 8 | |
f16b0819 | 9 | # This program is free software: you can redistribute it and/or modify |
1f65350a | 10 | # it under the terms of the GNU General Public License as published by |
f16b0819 PE |
11 | # the Free Software Foundation, either version 3 of the License, or |
12 | # (at your option) any later version. | |
6d8e724d | 13 | |
1f65350a PE |
14 | # This program is distributed in the hope that it will be useful, |
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | # GNU General Public License for more details. | |
6d8e724d | 18 | |
1f65350a | 19 | # You should have received a copy of the GNU General Public License |
f16b0819 | 20 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1f65350a | 21 | |
86996fca PE |
22 | # Originally written by Paul Eggert. The canonical version of this |
23 | # script is maintained as build-aux/bootstrap in gnulib, however, to | |
24 | # be useful to your project, you should place a copy of it under | |
25 | # version control in the top-level directory of your project. The | |
26 | # intent is that all customization can be done with a bootstrap.conf | |
27 | # file also maintained in your version control; gnulib comes with a | |
28 | # template build-aux/bootstrap.conf to get you started. | |
29 | ||
30 | # Please report bugs or propose patches to bug-gnulib@gnu.org. | |
1f65350a | 31 | |
3b2942e6 PE |
32 | nl=' |
33 | ' | |
5a2baae7 | 34 | |
62a9592d | 35 | # Ensure file names are sorted consistently across platforms. |
a9f027b9 PE |
36 | LC_ALL=C |
37 | export LC_ALL | |
38 | ||
b2c4c25d AD |
39 | # Ensure that CDPATH is not set. Otherwise, the output from cd |
40 | # would cause trouble in at least one use below. | |
41 | (unset CDPATH) >/dev/null 2>&1 && unset CDPATH | |
42 | ||
6d8e724d PE |
43 | local_gl_dir=gl |
44 | ||
179b2419 AD |
45 | # Honour $PERL, but work even if there is none |
46 | PERL="${PERL-perl}" | |
47 | ||
a898435b | 48 | me=$0 |
bbb44d83 | 49 | |
e3ddc1e3 | 50 | usage() { |
c1455bab | 51 | cat <<EOF |
a898435b | 52 | Usage: $me [OPTION]... |
10f429ef | 53 | Bootstrap this package from the checked-out sources. |
e3ddc1e3 PE |
54 | |
55 | Options: | |
a898435b | 56 | --gnulib-srcdir=DIRNAME specify the local directory where gnulib |
f0a43dd1 JD |
57 | sources reside. Use this if you already |
58 | have gnulib sources on your machine, and | |
59 | do not want to waste your bandwidth downloading | |
a898435b JD |
60 | them again. Defaults to \$GNULIB_SRCDIR |
61 | --bootstrap-sync if this bootstrap script is not identical to | |
dcd39f1d JD |
62 | the version in the local gnulib sources, |
63 | update this script, and then restart it with | |
a898435b JD |
64 | /bin/sh or the shell \$CONFIG_SHELL |
65 | --no-bootstrap-sync do not check whether bootstrap is out of sync | |
66 | --copy copy files instead of creating symbolic links | |
67 | --force attempt to bootstrap even if the sources seem | |
68 | not to have been checked out | |
69 | --no-git do not use git to update gnulib. Requires that | |
70 | --gnulib-srcdir point to a correct gnulib snapshot | |
71 | --skip-po do not download po files | |
72 | ||
73 | If the file $me.conf exists in the same directory as this script, its | |
e3ddc1e3 PE |
74 | contents are read as shell variables to configure the bootstrap. |
75 | ||
f0a43dd1 JD |
76 | For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR |
77 | are honored. | |
78 | ||
e3ddc1e3 | 79 | Running without arguments will suffice in most cases. |
c1455bab | 80 | EOF |
e3ddc1e3 | 81 | } |
3b2942e6 | 82 | |
41c11ce4 AD |
83 | # warnf_ FORMAT-STRING ARG1... |
84 | warnf_ () | |
85 | { | |
86 | warnf_format_=$1 | |
87 | shift | |
88 | nl=' | |
89 | ' | |
90 | case $* in | |
91 | *$nl*) me_=$(printf "$me"|tr "$nl|" '??') | |
92 | printf "$warnf_format_" "$@" | sed "s|^|$me_: |" ;; | |
93 | *) printf "$me: $warnf_format_" "$@" ;; | |
94 | esac >&2 | |
95 | } | |
96 | ||
97 | # warn_ WORD1... | |
98 | warn_ () | |
99 | { | |
100 | # If IFS does not start with ' ', set it and emit the warning in a subshell. | |
101 | case $IFS in | |
102 | ' '*) warnf_ '%s\n' "$*";; | |
103 | *) (IFS=' '; warn_ "$@");; | |
104 | esac | |
105 | } | |
106 | ||
107 | # die WORD1... | |
108 | die() { warn_ "$@"; exit 1; } | |
109 | ||
3b2942e6 PE |
110 | # Configuration. |
111 | ||
6d8e724d PE |
112 | # Name of the Makefile.am |
113 | gnulib_mk=gnulib.mk | |
114 | ||
3b2942e6 PE |
115 | # List of gnulib modules needed. |
116 | gnulib_modules= | |
117 | ||
118 | # Any gnulib files needed that are not in modules. | |
119 | gnulib_files= | |
120 | ||
ee7e9e3b JM |
121 | : ${AUTOPOINT=autopoint} |
122 | : ${AUTORECONF=autoreconf} | |
123 | ||
124 | # A function to be called right after gnulib-tool is run. | |
86996fca | 125 | # Override it via your own definition in bootstrap.conf. |
ee7e9e3b | 126 | bootstrap_post_import_hook() { :; } |
86996fca | 127 | |
f0a43dd1 JD |
128 | # A function to be called after everything else in this script. |
129 | # Override it via your own definition in bootstrap.conf. | |
130 | bootstrap_epilogue() { :; } | |
131 | ||
6d8e724d PE |
132 | # The command to download all .po files for a specified domain into |
133 | # a specified directory. Fill in the first %s is the domain name, and | |
134 | # the second with the destination directory. Use rsync's -L and -r | |
135 | # options because the latest/%s directory and the .po files within are | |
136 | # all symlinks. | |
137 | po_download_command_format=\ | |
86996fca PE |
138 | "rsync --delete --exclude '*.s1' -Lrtvz \ |
139 | 'translationproject.org::tp/latest/%s/' '%s'" | |
3b2942e6 | 140 | |
ee7e9e3b JM |
141 | # Fallback for downloading .po files (if rsync fails). |
142 | po_download_command_format2=\ | |
143 | "wget --mirror -nd -q -np -A.po -P '%s' \ | |
144 | http://translationproject.org/latest/%s/" | |
145 | ||
f9340b27 AD |
146 | # Prefer a non-empty tarname (4th argument of AC_INIT if given), else |
147 | # fall back to the package name (1st argument with munging) | |
3b2942e6 | 148 | extract_package_name=' |
f9340b27 AD |
149 | /^AC_INIT(\[*/{ |
150 | s/// | |
151 | /^[^,]*,[^,]*,[^,]*,[ []*\([^][ ,)]\)/{ | |
152 | s//\1/ | |
153 | s/[],)].*// | |
3b2942e6 PE |
154 | p |
155 | q | |
156 | } | |
f9340b27 | 157 | s/[],)].*// |
3b2942e6 PE |
158 | s/^GNU // |
159 | y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ | |
f9340b27 | 160 | s/[^abcdefghijklmnopqrstuvwxyz0123456789_]/-/g |
3b2942e6 PE |
161 | p |
162 | } | |
163 | ' | |
41c11ce4 AD |
164 | package=$(sed -n "$extract_package_name" configure.ac) \ |
165 | || die 'cannot find package name in configure.ac' | |
bbb44d83 | 166 | gnulib_name=lib$package |
3b2942e6 | 167 | |
bbb44d83 | 168 | build_aux=build-aux |
f0a43dd1 JD |
169 | source_base=lib |
170 | m4_base=m4 | |
171 | doc_base=doc | |
172 | tests_base=tests | |
a898435b | 173 | gnulib_extra_files='' |
3b2942e6 | 174 | |
6d8e724d | 175 | # Additional gnulib-tool options to use. Use "\newline" to break lines. |
163bb369 | 176 | gnulib_tool_option_extras= |
6d8e724d | 177 | |
3b2942e6 PE |
178 | # Other locale categories that need message catalogs. |
179 | EXTRA_LOCALE_CATEGORIES= | |
180 | ||
181 | # Additional xgettext options to use. Use "\\\newline" to break lines. | |
182 | XGETTEXT_OPTIONS='\\\ | |
183 | --flag=_:1:pass-c-format\\\ | |
184 | --flag=N_:1:pass-c-format\\\ | |
185 | --flag=error:3:c-format --flag=error_at_line:5:c-format\\\ | |
186 | ' | |
187 | ||
86996fca PE |
188 | # Package bug report address and copyright holder for gettext files |
189 | COPYRIGHT_HOLDER='Free Software Foundation, Inc.' | |
f0a43dd1 JD |
190 | MSGID_BUGS_ADDRESS=bug-$package@gnu.org |
191 | ||
3b2942e6 PE |
192 | # Files we don't want to import. |
193 | excluded_files= | |
194 | ||
10f429ef PE |
195 | # File that should exist in the top directory of a checked out hierarchy, |
196 | # but not in a distribution tarball. | |
86996fca | 197 | checkout_only_file=README-hacking |
e3ddc1e3 | 198 | |
46356ea4 PE |
199 | # Whether to use copies instead of symlinks. |
200 | copy=false | |
201 | ||
6d8e724d PE |
202 | # Set this to '.cvsignore .gitignore' in bootstrap.conf if you want |
203 | # those files to be generated in directories like lib/, m4/, and po/. | |
204 | # Or set it to 'auto' to make this script select which to use based | |
205 | # on which version control system (if any) is used in the source directory. | |
206 | vc_ignore=auto | |
207 | ||
dcd39f1d JD |
208 | # Set this to true in bootstrap.conf to enable --bootstrap-sync by |
209 | # default. | |
210 | bootstrap_sync=false | |
211 | ||
a898435b JD |
212 | # Use git to update gnulib sources |
213 | use_git=true | |
214 | ||
5407fc7d | 215 | check_exists() { |
179b2419 AD |
216 | if test "$1" = "--verbose"; then |
217 | ($2 --version </dev/null) >/dev/null 2>&1 | |
218 | if test $? -ge 126; then | |
219 | # If not found, run with diagnostics as one may be | |
220 | # presented with env variables to set to find the right version | |
221 | ($2 --version </dev/null) | |
222 | fi | |
223 | else | |
224 | ($1 --version </dev/null) >/dev/null 2>&1 | |
225 | fi | |
226 | ||
5407fc7d AD |
227 | test $? -lt 126 |
228 | } | |
229 | ||
d7be4085 AD |
230 | # find_tool ENVVAR NAMES... |
231 | # ------------------------- | |
f0a43dd1 | 232 | # Search for a required program. Use the value of ENVVAR, if set, |
5407fc7d AD |
233 | # otherwise find the first of the NAMES that can be run. |
234 | # If found, set ENVVAR to the program name, die otherwise. | |
d511fbd5 AD |
235 | # |
236 | # FIXME: code duplication, see also gnu-web-doc-update. | |
d7be4085 AD |
237 | find_tool () |
238 | { | |
d7be4085 AD |
239 | find_tool_envvar=$1 |
240 | shift | |
3710dd02 AD |
241 | find_tool_names=$@ |
242 | eval "find_tool_res=\$$find_tool_envvar" | |
243 | if test x"$find_tool_res" = x; then | |
5407fc7d AD |
244 | for i; do |
245 | if check_exists $i; then | |
246 | find_tool_res=$i | |
247 | break | |
d7be4085 AD |
248 | fi |
249 | done | |
250 | fi | |
5407fc7d AD |
251 | if test x"$find_tool_res" = x; then |
252 | warn_ "one of these is required: $find_tool_names;" | |
253 | die "alternatively set $find_tool_envvar to a compatible tool" | |
254 | fi | |
3710dd02 | 255 | eval "$find_tool_envvar=\$find_tool_res" |
d7be4085 AD |
256 | eval "export $find_tool_envvar" |
257 | } | |
258 | ||
3b2942e6 | 259 | # Override the default configuration, if necessary. |
f0a43dd1 JD |
260 | # Make sure that bootstrap.conf is sourced from the current directory |
261 | # if we were invoked as "sh bootstrap". | |
262 | case "$0" in | |
263 | */*) test -r "$0.conf" && . "$0.conf" ;; | |
264 | *) test -r "$0.conf" && . ./"$0.conf" ;; | |
265 | esac | |
266 | ||
a898435b JD |
267 | # Extra files from gnulib, which override files from other sources. |
268 | test -z "${gnulib_extra_files}" && \ | |
269 | gnulib_extra_files=" | |
41dfa1cb AD |
270 | build-aux/install-sh |
271 | build-aux/mdate-sh | |
272 | build-aux/texinfo.tex | |
273 | build-aux/depcomp | |
274 | build-aux/config.guess | |
275 | build-aux/config.sub | |
a898435b JD |
276 | doc/INSTALL |
277 | " | |
3b2942e6 | 278 | |
6d8e724d PE |
279 | if test "$vc_ignore" = auto; then |
280 | vc_ignore= | |
281 | test -d .git && vc_ignore=.gitignore | |
282 | test -d CVS && vc_ignore="$vc_ignore .cvsignore" | |
283 | fi | |
284 | ||
3b2942e6 PE |
285 | # Translate configuration into internal form. |
286 | ||
1f65350a PE |
287 | # Parse options. |
288 | ||
289 | for option | |
290 | do | |
291 | case $option in | |
292 | --help) | |
e3ddc1e3 | 293 | usage |
1f65350a PE |
294 | exit;; |
295 | --gnulib-srcdir=*) | |
3f32a0d2 | 296 | GNULIB_SRCDIR=${option#--gnulib-srcdir=};; |
1f65350a PE |
297 | --skip-po) |
298 | SKIP_PO=t;; | |
e3ddc1e3 | 299 | --force) |
bbb44d83 | 300 | checkout_only_file=;; |
46356ea4 PE |
301 | --copy) |
302 | copy=true;; | |
dcd39f1d JD |
303 | --bootstrap-sync) |
304 | bootstrap_sync=true;; | |
305 | --no-bootstrap-sync) | |
306 | bootstrap_sync=false;; | |
a898435b JD |
307 | --no-git) |
308 | use_git=false;; | |
1f65350a | 309 | *) |
41c11ce4 | 310 | die "$option: unknown option";; |
1f65350a PE |
311 | esac |
312 | done | |
313 | ||
41c11ce4 AD |
314 | $use_git || test -d "$GNULIB_SRCDIR" \ |
315 | || die "Error: --no-git requires --gnulib-srcdir" | |
a898435b | 316 | |
bbb44d83 | 317 | if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then |
41c11ce4 | 318 | die "Bootstrapping from a non-checked-out distribution is risky." |
e3ddc1e3 PE |
319 | fi |
320 | ||
a565f732 AD |
321 | # Strip blank and comment lines to leave significant entries. |
322 | gitignore_entries() { | |
323 | sed '/^#/d; /^$/d' "$@" | |
a898435b JD |
324 | } |
325 | ||
a565f732 AD |
326 | # If $STR is not already on a line by itself in $FILE, insert it at the start. |
327 | # Entries are inserted at the start of the ignore list to ensure existing | |
328 | # entries starting with ! are not overridden. Such entries support | |
329 | # whitelisting exceptions after a more generic blacklist pattern. | |
330 | insert_if_absent() { | |
bbb44d83 PE |
331 | file=$1 |
332 | str=$2 | |
6d8e724d | 333 | test -f $file || touch $file |
a565f732 AD |
334 | test -r $file || die "Error: failed to read ignore file: $file" |
335 | duplicate_entries=$(gitignore_entries $file | sort | uniq -d) | |
336 | if [ "$duplicate_entries" ] ; then | |
337 | die "Error: Duplicate entries in $file: " $duplicate_entries | |
338 | fi | |
339 | linesold=$(gitignore_entries $file | wc -l) | |
5407fc7d | 340 | linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l) |
a565f732 AD |
341 | if [ $linesold != $linesnew ] ; then |
342 | { echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \ | |
343 | || die "insert_if_absent $file $str: failed" | |
344 | fi | |
bbb44d83 PE |
345 | } |
346 | ||
2f3fd8f9 | 347 | # Adjust $PATTERN for $VC_IGNORE_FILE and insert it with |
a565f732 | 348 | # insert_if_absent. |
2f3fd8f9 JD |
349 | insert_vc_ignore() { |
350 | vc_ignore_file="$1" | |
351 | pattern="$2" | |
352 | case $vc_ignore_file in | |
353 | *.gitignore) | |
ee7e9e3b JM |
354 | # A .gitignore entry that does not start with '/' applies |
355 | # recursively to subdirectories, so prepend '/' to every | |
2f3fd8f9 | 356 | # .gitignore entry. |
3f32a0d2 | 357 | pattern=$(echo "$pattern" | sed s,^,/,);; |
2f3fd8f9 | 358 | esac |
a565f732 | 359 | insert_if_absent "$vc_ignore_file" "$pattern" |
2f3fd8f9 JD |
360 | } |
361 | ||
bbb44d83 PE |
362 | # Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac. |
363 | found_aux_dir=no | |
364 | grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \ | |
365 | >/dev/null && found_aux_dir=yes | |
366 | grep '^[ ]*AC_CONFIG_AUX_DIR('"$build_aux"')' configure.ac \ | |
367 | >/dev/null && found_aux_dir=yes | |
41c11ce4 AD |
368 | test $found_aux_dir = yes \ |
369 | || die "configure.ac lacks 'AC_CONFIG_AUX_DIR([$build_aux])'; add it" | |
bbb44d83 PE |
370 | |
371 | # If $build_aux doesn't exist, create it now, otherwise some bits | |
372 | # below will malfunction. If creating it, also mark it as ignored. | |
373 | if test ! -d $build_aux; then | |
374 | mkdir $build_aux | |
6d8e724d PE |
375 | for dot_ig in x $vc_ignore; do |
376 | test $dot_ig = x && continue | |
2f3fd8f9 | 377 | insert_vc_ignore $dot_ig $build_aux |
bbb44d83 PE |
378 | done |
379 | fi | |
380 | ||
f0a43dd1 JD |
381 | # Note this deviates from the version comparison in automake |
382 | # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a | |
383 | # but this should suffice as we won't be specifying old | |
384 | # version formats or redundant trailing .0 in bootstrap.conf. | |
385 | # If we did want full compatibility then we should probably | |
386 | # use m4_version_compare from autoconf. | |
387 | sort_ver() { # sort -V is not generally available | |
388 | ver1="$1" | |
389 | ver2="$2" | |
390 | ||
391 | # split on '.' and compare each component | |
392 | i=1 | |
393 | while : ; do | |
394 | p1=$(echo "$ver1" | cut -d. -f$i) | |
395 | p2=$(echo "$ver2" | cut -d. -f$i) | |
396 | if [ ! "$p1" ]; then | |
397 | echo "$1 $2" | |
398 | break | |
399 | elif [ ! "$p2" ]; then | |
400 | echo "$2 $1" | |
401 | break | |
402 | elif [ ! "$p1" = "$p2" ]; then | |
403 | if [ "$p1" -gt "$p2" ] 2>/dev/null; then # numeric comparison | |
404 | echo "$2 $1" | |
405 | elif [ "$p2" -gt "$p1" ] 2>/dev/null; then # numeric comparison | |
406 | echo "$1 $2" | |
407 | else # numeric, then lexicographic comparison | |
408 | lp=$(printf "$p1\n$p2\n" | LANG=C sort -n | tail -n1) | |
409 | if [ "$lp" = "$p2" ]; then | |
410 | echo "$1 $2" | |
411 | else | |
412 | echo "$2 $1" | |
413 | fi | |
414 | fi | |
415 | break | |
416 | fi | |
417 | i=$(($i+1)) | |
418 | done | |
419 | } | |
1f65350a | 420 | |
f0a43dd1 JD |
421 | get_version() { |
422 | app=$1 | |
423 | ||
179b2419 | 424 | $app --version >/dev/null 2>&1 || { $app --version; return 1; } |
f0a43dd1 JD |
425 | |
426 | $app --version 2>&1 | | |
dcd39f1d JD |
427 | sed -n '# Move version to start of line. |
428 | s/.*[v ]\([0-9]\)/\1/ | |
429 | ||
430 | # Skip lines that do not start with version. | |
431 | /^[0-9]/!d | |
f0a43dd1 | 432 | |
dcd39f1d JD |
433 | # Remove characters after the version. |
434 | s/[^.a-z0-9-].*// | |
f0a43dd1 | 435 | |
dcd39f1d JD |
436 | # The first component must be digits only. |
437 | s/^\([0-9]*\)[a-z-].*/\1/ | |
f0a43dd1 | 438 | |
f0a43dd1 JD |
439 | #the following essentially does s/5.005/5.5/ |
440 | s/\.0*\([1-9]\)/.\1/g | |
441 | p | |
442 | q' | |
e10a80ee PE |
443 | } |
444 | ||
f0a43dd1 JD |
445 | check_versions() { |
446 | ret=0 | |
447 | ||
448 | while read app req_ver; do | |
86996fca PE |
449 | # We only need libtoolize from the libtool package. |
450 | if test "$app" = libtool; then | |
451 | app=libtoolize | |
452 | fi | |
a898435b JD |
453 | # Exempt git if --no-git is in effect. |
454 | if test "$app" = git; then | |
455 | $use_git || continue | |
456 | fi | |
f0a43dd1 | 457 | # Honor $APP variables ($TAR, $AUTOCONF, etc.) |
3f32a0d2 | 458 | appvar=$(echo $app | LC_ALL=C tr '[a-z]-' '[A-Z]_') |
f0a43dd1 | 459 | test "$appvar" = TAR && appvar=AMTAR |
ee7e9e3b JM |
460 | case $appvar in |
461 | GZIP) ;; # Do not use $GZIP: it contains gzip options. | |
179b2419 | 462 | PERL::*) ;; # Keep perl modules as-is |
ee7e9e3b JM |
463 | *) eval "app=\${$appvar-$app}" ;; |
464 | esac | |
b2c4c25d AD |
465 | |
466 | # Handle the still-experimental Automake-NG programs specially. | |
467 | # They remain named as the mainstream Automake programs ("automake", | |
468 | # and "aclocal") to avoid gratuitous incompatibilities with | |
469 | # pre-existing usages (by, say, autoreconf, or custom autogen.sh | |
470 | # scripts), but correctly identify themselves (as being part of | |
471 | # "GNU automake-ng") when asked their version. | |
472 | case $app in | |
473 | automake-ng|aclocal-ng) | |
3f32a0d2 | 474 | app=${app%-ng} |
b2c4c25d | 475 | ($app --version | grep '(GNU automake-ng)') >/dev/null 2>&1 || { |
41c11ce4 | 476 | warn_ "Error: '$app' not found or not from Automake-NG" |
b2c4c25d AD |
477 | ret=1 |
478 | continue | |
479 | } ;; | |
179b2419 AD |
480 | # Another check is for perl modules. These can be written as |
481 | # e.g. perl::XML::XPath in case of XML::XPath module, etc. | |
482 | perl::*) | |
483 | # Extract module name | |
484 | app="${app#perl::}" | |
485 | if ! $PERL -m"$app" -e 'exit 0' >/dev/null 2>&1; then | |
486 | warn_ "Error: perl module '$app' not found" | |
487 | ret=1 | |
488 | fi | |
489 | continue | |
490 | ;; | |
b2c4c25d | 491 | esac |
ee7e9e3b JM |
492 | if [ "$req_ver" = "-" ]; then |
493 | # Merely require app to exist; not all prereq apps are well-behaved | |
494 | # so we have to rely on $? rather than get_version. | |
179b2419 | 495 | if ! check_exists --verbose $app; then |
41c11ce4 | 496 | warn_ "Error: '$app' not found" |
f0a43dd1 JD |
497 | ret=1 |
498 | fi | |
ee7e9e3b JM |
499 | else |
500 | # Require app to produce a new enough version string. | |
501 | inst_ver=$(get_version $app) | |
502 | if [ ! "$inst_ver" ]; then | |
41c11ce4 | 503 | warn_ "Error: '$app' not found" |
ee7e9e3b JM |
504 | ret=1 |
505 | else | |
506 | latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2) | |
507 | if [ ! "$latest_ver" = "$inst_ver" ]; then | |
41c11ce4 AD |
508 | warnf_ '%s\n' \ |
509 | "Error: '$app' version == $inst_ver is too old" \ | |
510 | " '$app' version >= $req_ver is required" | |
ee7e9e3b JM |
511 | ret=1 |
512 | fi | |
513 | fi | |
f0a43dd1 JD |
514 | fi |
515 | done | |
516 | ||
517 | return $ret | |
518 | } | |
fee2ed87 | 519 | |
f0a43dd1 JD |
520 | print_versions() { |
521 | echo "Program Min_version" | |
522 | echo "----------------------" | |
86996fca | 523 | printf %s "$buildreq" |
f0a43dd1 JD |
524 | echo "----------------------" |
525 | # can't depend on column -t | |
526 | } | |
527 | ||
5407fc7d AD |
528 | # Find sha1sum, named gsha1sum on MacPorts, shasum on Mac OS X 10.6. |
529 | # Also find the compatible sha1 utility on the BSDs | |
530 | if test x"$SKIP_PO" = x; then | |
531 | find_tool SHA1SUM sha1sum gsha1sum shasum sha1 | |
532 | fi | |
533 | ||
86996fca PE |
534 | use_libtool=0 |
535 | # We'd like to use grep -E, to see if any of LT_INIT, | |
536 | # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac, | |
537 | # but that's not portable enough (e.g., for Solaris). | |
538 | grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \ | |
539 | && use_libtool=1 | |
540 | grep '^[ ]*LT_INIT' configure.ac >/dev/null \ | |
541 | && use_libtool=1 | |
542 | if test $use_libtool = 1; then | |
543 | find_tool LIBTOOLIZE glibtoolize libtoolize | |
544 | fi | |
545 | ||
ee7e9e3b JM |
546 | # gnulib-tool requires at least automake and autoconf. |
547 | # If either is not listed, add it (with minimum version) as a prerequisite. | |
548 | case $buildreq in | |
549 | *automake*) ;; | |
550 | *) buildreq="automake 1.9 | |
551 | $buildreq" ;; | |
552 | esac | |
553 | case $buildreq in | |
554 | *autoconf*) ;; | |
555 | *) buildreq="autoconf 2.59 | |
556 | $buildreq" ;; | |
557 | esac | |
558 | ||
559 | # When we can deduce that gnulib-tool will require patch, | |
560 | # and when patch is not already listed as a prerequisite, add it, too. | |
3f32a0d2 AD |
561 | if test -d "$local_gl_dir" \ |
562 | && ! find "$local_gl_dir" -name '*.diff' -exec false {} +; then | |
ee7e9e3b JM |
563 | case $buildreq in |
564 | *patch*) ;; | |
565 | *) buildreq="patch - | |
566 | $buildreq" ;; | |
567 | esac | |
568 | fi | |
569 | ||
f0a43dd1 | 570 | if ! printf "$buildreq" | check_versions; then |
86996fca PE |
571 | echo >&2 |
572 | if test -f README-prereq; then | |
41c11ce4 | 573 | die "See README-prereq for how to get the prerequisite programs" |
86996fca | 574 | else |
41c11ce4 | 575 | die "Please install the prerequisite programs" |
86996fca | 576 | fi |
f0a43dd1 JD |
577 | fi |
578 | ||
179b2419 AD |
579 | # Warn the user if autom4te appears to be broken; this causes known |
580 | # issues with at least gettext 0.18.3. | |
581 | probe=$(echo 'm4_quote([hi])' | autom4te -l M4sugar -t 'm4_quote:$%' -) | |
582 | if test "x$probe" != xhi; then | |
583 | warn_ "WARNING: your autom4te wrapper eats stdin;" | |
584 | warn_ "if bootstrap fails, consider upgrading your autotools" | |
585 | fi | |
586 | ||
f0a43dd1 JD |
587 | echo "$0: Bootstrapping from checked-out $package sources..." |
588 | ||
589 | # See if we can use gnulib's git-merge-changelog merge driver. | |
5407fc7d | 590 | if $use_git && test -d .git && check_exists git; then |
fee2ed87 PB |
591 | if git config merge.merge-changelog.driver >/dev/null ; then |
592 | : | |
5407fc7d | 593 | elif check_exists git-merge-changelog; then |
a898435b | 594 | echo "$0: initializing git-merge-changelog driver" |
fee2ed87 PB |
595 | git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver' |
596 | git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B' | |
597 | else | |
a898435b | 598 | echo "$0: consider installing git-merge-changelog from gnulib" |
fee2ed87 PB |
599 | fi |
600 | fi | |
601 | ||
f0a43dd1 JD |
602 | |
603 | cleanup_gnulib() { | |
604 | status=$? | |
86996fca | 605 | rm -fr "$gnulib_path" |
f0a43dd1 JD |
606 | exit $status |
607 | } | |
608 | ||
609 | git_modules_config () { | |
610 | test -f .gitmodules && git config --file .gitmodules "$@" | |
611 | } | |
612 | ||
41dfa1cb AD |
613 | if $use_git; then |
614 | gnulib_path=$(git_modules_config submodule.gnulib.path) | |
615 | test -z "$gnulib_path" && gnulib_path=gnulib | |
616 | fi | |
86996fca | 617 | |
41dfa1cb AD |
618 | # Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a |
619 | # submodule, for use in the rest of the script. | |
1f65350a PE |
620 | |
621 | case ${GNULIB_SRCDIR--} in | |
622 | -) | |
41dfa1cb | 623 | # Note that $use_git is necessarily true in this case. |
f0a43dd1 | 624 | if git_modules_config submodule.gnulib.url >/dev/null; then |
1f65350a | 625 | echo "$0: getting gnulib files..." |
179b2419 AD |
626 | git submodule init -- "$gnulib_path" || exit $? |
627 | git submodule update -- "$gnulib_path" || exit $? | |
1f65350a | 628 | |
86996fca | 629 | elif [ ! -d "$gnulib_path" ]; then |
f0a43dd1 | 630 | echo "$0: getting gnulib files..." |
1f65350a | 631 | |
e10a80ee PE |
632 | trap cleanup_gnulib 1 2 13 15 |
633 | ||
86996fca PE |
634 | shallow= |
635 | git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2' | |
636 | git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" || | |
e10a80ee | 637 | cleanup_gnulib |
1f65350a | 638 | |
e10a80ee | 639 | trap - 1 2 13 15 |
1f65350a | 640 | fi |
86996fca | 641 | GNULIB_SRCDIR=$gnulib_path |
f0a43dd1 JD |
642 | ;; |
643 | *) | |
41dfa1cb AD |
644 | # Use GNULIB_SRCDIR directly or as a reference. |
645 | if $use_git && test -d "$GNULIB_SRCDIR"/.git && \ | |
f0a43dd1 | 646 | git_modules_config submodule.gnulib.url >/dev/null; then |
f0a43dd1 | 647 | echo "$0: getting gnulib files..." |
86996fca PE |
648 | if git submodule -h|grep -- --reference > /dev/null; then |
649 | # Prefer the one-liner available in git 1.6.4 or newer. | |
650 | git submodule update --init --reference "$GNULIB_SRCDIR" \ | |
651 | "$gnulib_path" || exit $? | |
652 | else | |
653 | # This fallback allows at least git 1.5.5. | |
654 | if test -f "$gnulib_path"/gnulib-tool; then | |
655 | # Since file already exists, assume submodule init already complete. | |
179b2419 | 656 | git submodule update -- "$gnulib_path" || exit $? |
86996fca PE |
657 | else |
658 | # Older git can't clone into an empty directory. | |
659 | rmdir "$gnulib_path" 2>/dev/null | |
660 | git clone --reference "$GNULIB_SRCDIR" \ | |
661 | "$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \ | |
179b2419 AD |
662 | && git submodule init -- "$gnulib_path" \ |
663 | && git submodule update -- "$gnulib_path" \ | |
86996fca PE |
664 | || exit $? |
665 | fi | |
666 | fi | |
667 | GNULIB_SRCDIR=$gnulib_path | |
f0a43dd1 JD |
668 | fi |
669 | ;; | |
1f65350a PE |
670 | esac |
671 | ||
41dfa1cb AD |
672 | # $GNULIB_SRCDIR now points to the version of gnulib to use, and |
673 | # we no longer need to use git or $gnulib_path below here. | |
674 | ||
dcd39f1d JD |
675 | if $bootstrap_sync; then |
676 | cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || { | |
677 | echo "$0: updating bootstrap and restarting..." | |
a565f732 AD |
678 | case $(sh -c 'echo "$1"' -- a) in |
679 | a) ignored=--;; | |
680 | *) ignored=ignored;; | |
681 | esac | |
dcd39f1d JD |
682 | exec sh -c \ |
683 | 'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \ | |
a565f732 | 684 | $ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \ |
dcd39f1d JD |
685 | "$0" "$@" --no-bootstrap-sync |
686 | } | |
687 | fi | |
688 | ||
284d8a13 | 689 | gnulib_tool=$GNULIB_SRCDIR/gnulib-tool |
163bb369 | 690 | <$gnulib_tool || exit $? |
1f65350a | 691 | |
1f65350a PE |
692 | # Get translations. |
693 | ||
6d8e724d | 694 | download_po_files() { |
5a2baae7 PE |
695 | subdir=$1 |
696 | domain=$2 | |
a898435b | 697 | echo "$me: getting translations into $subdir for $domain..." |
3f32a0d2 | 698 | cmd=$(printf "$po_download_command_format" "$domain" "$subdir") |
ee7e9e3b JM |
699 | eval "$cmd" && return |
700 | # Fallback to HTTP. | |
3f32a0d2 | 701 | cmd=$(printf "$po_download_command_format2" "$subdir" "$domain") |
6d8e724d PE |
702 | eval "$cmd" |
703 | } | |
5a2baae7 | 704 | |
86996fca | 705 | # Mirror .po files to $po_dir/.reference and copy only the new |
6d8e724d | 706 | # or modified ones into $po_dir. Also update $po_dir/LINGUAS. |
86996fca PE |
707 | # Note po files that exist locally only are left in $po_dir but will |
708 | # not be included in LINGUAS and hence will not be distributed. | |
6d8e724d PE |
709 | update_po_files() { |
710 | # Directory containing primary .po files. | |
711 | # Overwrite them only when we're sure a .po file is new. | |
712 | po_dir=$1 | |
713 | domain=$2 | |
714 | ||
86996fca | 715 | # Mirror *.po files into this dir. |
6d8e724d PE |
716 | # Usually contains *.s1 checksum files. |
717 | ref_po_dir="$po_dir/.reference" | |
718 | ||
719 | test -d $ref_po_dir || mkdir $ref_po_dir || return | |
720 | download_po_files $ref_po_dir $domain \ | |
721 | && ls "$ref_po_dir"/*.po 2>/dev/null | | |
86996fca | 722 | sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return |
6d8e724d | 723 | |
3f32a0d2 | 724 | langs=$(cd $ref_po_dir && echo *.po | sed 's/\.po//g') |
f0a43dd1 JD |
725 | test "$langs" = '*' && langs=x |
726 | for po in $langs; do | |
727 | case $po in x) continue;; esac | |
728 | new_po="$ref_po_dir/$po.po" | |
729 | cksum_file="$ref_po_dir/$po.s1" | |
730 | if ! test -f "$cksum_file" || | |
731 | ! test -f "$po_dir/$po.po" || | |
5407fc7d | 732 | ! $SHA1SUM -c "$cksum_file" < "$new_po" > /dev/null 2>&1; then |
a898435b | 733 | echo "$me: updated $po_dir/$po.po..." |
f0a43dd1 | 734 | cp "$new_po" "$po_dir/$po.po" \ |
5407fc7d | 735 | && $SHA1SUM < "$new_po" > "$cksum_file" || return |
f0a43dd1 | 736 | fi |
6d8e724d | 737 | done |
5a2baae7 PE |
738 | } |
739 | ||
1f65350a PE |
740 | case $SKIP_PO in |
741 | '') | |
bbb44d83 | 742 | if test -d po; then |
6d8e724d | 743 | update_po_files po $package || exit |
bbb44d83 | 744 | fi |
f7ab6a50 | 745 | |
3b2942e6 | 746 | if test -d runtime-po; then |
6d8e724d | 747 | update_po_files runtime-po $package-runtime || exit |
3b2942e6 | 748 | fi;; |
1f65350a PE |
749 | esac |
750 | ||
6d8e724d | 751 | symlink_to_dir() |
e70f46d1 | 752 | { |
6d8e724d PE |
753 | src=$1/$2 |
754 | dst=${3-$2} | |
e70f46d1 PE |
755 | |
756 | test -f "$src" && { | |
6d8e724d | 757 | |
86996fca PE |
758 | # If the destination directory doesn't exist, create it. |
759 | # This is required at least for "lib/uniwidth/cjk.h". | |
3f32a0d2 | 760 | dst_dir=$(dirname "$dst") |
86996fca PE |
761 | if ! test -d "$dst_dir"; then |
762 | mkdir -p "$dst_dir" | |
763 | ||
764 | # If we've just created a directory like lib/uniwidth, | |
765 | # tell version control system(s) it's ignorable. | |
766 | # FIXME: for now, this does only one level | |
3f32a0d2 | 767 | parent=$(dirname "$dst_dir") |
86996fca PE |
768 | for dot_ig in x $vc_ignore; do |
769 | test $dot_ig = x && continue | |
770 | ig=$parent/$dot_ig | |
3f32a0d2 | 771 | insert_vc_ignore $ig "${dst_dir##*/}" |
86996fca PE |
772 | done |
773 | fi | |
6d8e724d | 774 | |
46356ea4 PE |
775 | if $copy; then |
776 | { | |
f0a43dd1 | 777 | test ! -h "$dst" || { |
a898435b | 778 | echo "$me: rm -f $dst" && |
f0a43dd1 JD |
779 | rm -f "$dst" |
780 | } | |
46356ea4 PE |
781 | } && |
782 | test -f "$dst" && | |
783 | cmp -s "$src" "$dst" || { | |
a898435b | 784 | echo "$me: cp -fp $src $dst" && |
f0a43dd1 | 785 | cp -fp "$src" "$dst" |
46356ea4 PE |
786 | } |
787 | else | |
ee7e9e3b JM |
788 | # Leave any existing symlink alone, if it already points to the source, |
789 | # so that broken build tools that care about symlink times | |
790 | # aren't confused into doing unnecessary builds. Conversely, if the | |
791 | # existing symlink's time stamp is older than the source, make it afresh, | |
792 | # so that broken tools aren't confused into skipping needed builds. See | |
793 | # <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00326.html>. | |
46356ea4 | 794 | test -h "$dst" && |
3f32a0d2 AD |
795 | src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 && |
796 | dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 && | |
ee7e9e3b | 797 | test "$src_i" = "$dst_i" && |
3f32a0d2 | 798 | both_ls=$(ls -dt "$src" "$dst") && |
ee7e9e3b | 799 | test "X$both_ls" = "X$dst$nl$src" || { |
f0a43dd1 JD |
800 | dot_dots= |
801 | case $src in | |
802 | /*) ;; | |
803 | *) | |
804 | case /$dst/ in | |
805 | *//* | */../* | */./* | /*/*/*/*/*/) | |
41c11ce4 AD |
806 | die "invalid symlink calculation: $src -> $dst";; |
807 | /*/*/*/*/) dot_dots=../../../;; | |
808 | /*/*/*/) dot_dots=../../;; | |
809 | /*/*/) dot_dots=../;; | |
f0a43dd1 JD |
810 | esac;; |
811 | esac | |
812 | ||
a898435b | 813 | echo "$me: ln -fs $dot_dots$src $dst" && |
f0a43dd1 | 814 | ln -fs "$dot_dots$src" "$dst" |
46356ea4 PE |
815 | } |
816 | fi | |
e70f46d1 PE |
817 | } |
818 | } | |
819 | ||
3f32a0d2 AD |
820 | version_controlled_file() { |
821 | parent=$1 | |
822 | file=$2 | |
823 | if test -d .git; then | |
824 | git rm -n "$file" > /dev/null 2>&1 | |
825 | elif test -d .svn; then | |
826 | svn log -r HEAD "$file" > /dev/null 2>&1 | |
827 | elif test -d CVS; then | |
828 | grep -F "/${file##*/}/" "$parent/CVS/Entries" 2>/dev/null | | |
829 | grep '^/[^/]*/[0-9]' > /dev/null | |
830 | else | |
41c11ce4 | 831 | warn_ "no version control for $file?" |
3f32a0d2 AD |
832 | false |
833 | fi | |
834 | } | |
835 | ||
ee7e9e3b JM |
836 | # NOTE: we have to be careful to run both autopoint and libtoolize |
837 | # before gnulib-tool, since gnulib-tool is likely to provide newer | |
838 | # versions of files "installed" by these two programs. | |
839 | # Then, *after* gnulib-tool (see below), we have to be careful to | |
840 | # run autoreconf in such a way that it does not run either of these | |
841 | # two just-pre-run programs. | |
1f65350a | 842 | |
ee7e9e3b JM |
843 | # Import from gettext. |
844 | with_gettext=yes | |
845 | grep '^[ ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \ | |
846 | with_gettext=no | |
1f65350a | 847 | |
3f32a0d2 | 848 | if test $with_gettext = yes || test $use_libtool = 1; then |
ee7e9e3b | 849 | |
3f32a0d2 AD |
850 | tempbase=.bootstrap$$ |
851 | trap "rm -f $tempbase.0 $tempbase.1" 1 2 13 15 | |
1f65350a | 852 | |
3f32a0d2 AD |
853 | > $tempbase.0 > $tempbase.1 && |
854 | find . ! -type d -print | sort > $tempbase.0 || exit | |
855 | ||
856 | if test $with_gettext = yes; then | |
857 | # Released autopoint has the tendency to install macros that have been | |
858 | # obsoleted in current gnulib, so run this before gnulib-tool. | |
859 | echo "$0: $AUTOPOINT --force" | |
860 | $AUTOPOINT --force || exit | |
10f429ef | 861 | fi |
3f32a0d2 AD |
862 | |
863 | # Autoreconf runs aclocal before libtoolize, which causes spurious | |
864 | # warnings if the initial aclocal is confused by the libtoolized | |
865 | # (or worse out-of-date) macro directory. | |
866 | # libtoolize 1.9b added the --install option; but we support back | |
867 | # to libtoolize 1.5.22, where the install action was default. | |
868 | if test $use_libtool = 1; then | |
869 | install= | |
870 | case $($LIBTOOLIZE --help) in | |
871 | *--install*) install=--install ;; | |
872 | esac | |
873 | echo "running: $LIBTOOLIZE $install --copy" | |
874 | $LIBTOOLIZE $install --copy | |
875 | fi | |
876 | ||
877 | find . ! -type d -print | sort >$tempbase.1 | |
878 | old_IFS=$IFS | |
879 | IFS=$nl | |
880 | for file in $(comm -13 $tempbase.0 $tempbase.1); do | |
881 | IFS=$old_IFS | |
882 | parent=${file%/*} | |
883 | version_controlled_file "$parent" "$file" || { | |
884 | for dot_ig in x $vc_ignore; do | |
885 | test $dot_ig = x && continue | |
886 | ig=$parent/$dot_ig | |
887 | insert_vc_ignore "$ig" "${file##*/}" | |
888 | done | |
889 | } | |
890 | done | |
891 | IFS=$old_IFS | |
892 | ||
893 | rm -f $tempbase.0 $tempbase.1 | |
894 | trap - 1 2 13 15 | |
895 | fi | |
10f429ef | 896 | |
3b2942e6 PE |
897 | # Import from gnulib. |
898 | ||
899 | gnulib_tool_options="\ | |
900 | --import\ | |
901 | --no-changelog\ | |
ee7e9e3b JM |
902 | --aux-dir $build_aux\ |
903 | --doc-base $doc_base\ | |
bbb44d83 | 904 | --lib $gnulib_name\ |
ee7e9e3b JM |
905 | --m4-base $m4_base/\ |
906 | --source-base $source_base/\ | |
907 | --tests-base $tests_base\ | |
6d8e724d | 908 | --local-dir $local_gl_dir\ |
f0a43dd1 | 909 | $gnulib_tool_option_extras\ |
3b2942e6 | 910 | " |
86996fca PE |
911 | if test $use_libtool = 1; then |
912 | case "$gnulib_tool_options " in | |
913 | *' --libtool '*) ;; | |
914 | *) gnulib_tool_options="$gnulib_tool_options --libtool" ;; | |
915 | esac | |
916 | fi | |
3b2942e6 PE |
917 | echo "$0: $gnulib_tool $gnulib_tool_options --import ..." |
918 | $gnulib_tool $gnulib_tool_options --import $gnulib_modules && | |
3b2942e6 PE |
919 | |
920 | for file in $gnulib_files; do | |
9dcb193a | 921 | symlink_to_dir "$GNULIB_SRCDIR" $file \ |
41c11ce4 | 922 | || die "failed to symlink $file" |
3b2942e6 | 923 | done |
1f65350a | 924 | |
163bb369 | 925 | bootstrap_post_import_hook \ |
41c11ce4 | 926 | || die "bootstrap_post_import_hook failed" |
f0a43dd1 JD |
927 | |
928 | # Remove any dangling symlink matching "*.m4" or "*.[ch]" in some | |
929 | # gnulib-populated directories. Such .m4 files would cause aclocal to fail. | |
930 | # The following requires GNU find 4.2.3 or newer. Considering the usual | |
931 | # portability constraints of this script, that may seem a very demanding | |
932 | # requirement, but it should be ok. Ignore any failure, which is fine, | |
933 | # since this is only a convenience to help developers avoid the relatively | |
934 | # unusual case in which a symlinked-to .m4 file is git-removed from gnulib | |
935 | # between successive runs of this script. | |
936 | find "$m4_base" "$source_base" \ | |
937 | -depth \( -name '*.m4' -o -name '*.[ch]' \) \ | |
938 | -type l -xtype l -delete > /dev/null 2>&1 | |
3b2942e6 | 939 | |
a565f732 AD |
940 | # Invoke autoreconf with --force --install to ensure upgrades of tools |
941 | # such as ylwrap. | |
942 | AUTORECONFFLAGS="--verbose --install --force -I $m4_base $ACLOCAL_FLAGS" | |
943 | ||
ee7e9e3b JM |
944 | # Some systems (RHEL 5) are using ancient autotools, for which the |
945 | # --no-recursive option had not been invented. Detect that lack and | |
946 | # omit the option when it's not supported. FIXME in 2017: remove this | |
947 | # hack when RHEL 5 autotools are updated, or when they become irrelevant. | |
ee7e9e3b | 948 | case $($AUTORECONF --help) in |
a565f732 | 949 | *--no-recursive*) AUTORECONFFLAGS="$AUTORECONFFLAGS --no-recursive";; |
ee7e9e3b | 950 | esac |
62a9592d | 951 | |
ee7e9e3b | 952 | # Tell autoreconf not to invoke autopoint or libtoolize; they were run above. |
a565f732 AD |
953 | echo "running: AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS" |
954 | AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS \ | |
41c11ce4 | 955 | || die "autoreconf failed" |
62a9592d | 956 | |
3b2942e6 | 957 | # Get some extra files from gnulib, overriding existing files. |
3b2942e6 | 958 | for file in $gnulib_extra_files; do |
3b2942e6 | 959 | case $file in |
e70f46d1 | 960 | */INSTALL) dst=INSTALL;; |
3f32a0d2 | 961 | build-aux/*) dst=$build_aux/${file#build-aux/};; |
e70f46d1 | 962 | *) dst=$file;; |
3b2942e6 | 963 | esac |
9dcb193a | 964 | symlink_to_dir "$GNULIB_SRCDIR" $file $dst \ |
41c11ce4 | 965 | || die "failed to symlink $file" |
3b2942e6 | 966 | done |
fbca8023 | 967 | |
bbb44d83 PE |
968 | if test $with_gettext = yes; then |
969 | # Create gettext configuration. | |
970 | echo "$0: Creating po/Makevars from po/Makevars.template ..." | |
971 | rm -f po/Makevars | |
3b2942e6 | 972 | sed ' |
bbb44d83 | 973 | /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/ |
86996fca PE |
974 | /^COPYRIGHT_HOLDER *=/s/=.*/= '"$COPYRIGHT_HOLDER"'/ |
975 | /^MSGID_BUGS_ADDRESS *=/s|=.*|= '"$MSGID_BUGS_ADDRESS"'| | |
bbb44d83 PE |
976 | /^XGETTEXT_OPTIONS *=/{ |
977 | s/$/ \\/ | |
978 | a\ | |
f0a43dd1 | 979 | '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+} |
bbb44d83 | 980 | } |
41c11ce4 AD |
981 | ' po/Makevars.template >po/Makevars \ |
982 | || die 'cannot generate po/Makevars' | |
3b2942e6 | 983 | |
b2c4c25d AD |
984 | # If the 'gettext' module is in use, grab the latest Makefile.in.in. |
985 | # If only the 'gettext-h' module is in use, assume autopoint already | |
986 | # put the correct version of this file into place. | |
987 | case $gnulib_modules in | |
988 | *gettext-h*) ;; | |
989 | *gettext*) | |
41c11ce4 AD |
990 | cp $GNULIB_SRCDIR/build-aux/po/Makefile.in.in po/Makefile.in.in \ |
991 | || die "cannot create po/Makefile.in.in" | |
b2c4c25d AD |
992 | ;; |
993 | esac | |
8ef26c2a | 994 | |
bbb44d83 PE |
995 | if test -d runtime-po; then |
996 | # Similarly for runtime-po/Makevars, but not quite the same. | |
997 | rm -f runtime-po/Makevars | |
998 | sed ' | |
999 | /^DOMAIN *=.*/s/=.*/= '"$package"'-runtime/ | |
1000 | /^subdir *=.*/s/=.*/= runtime-po/ | |
1001 | /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/ | |
1002 | /^XGETTEXT_OPTIONS *=/{ | |
f0a43dd1 JD |
1003 | s/$/ \\/ |
1004 | a\ | |
1005 | '"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+} | |
bbb44d83 | 1006 | } |
41c11ce4 AD |
1007 | ' po/Makevars.template >runtime-po/Makevars \ |
1008 | || die 'cannot generate runtime-po/Makevars' | |
bbb44d83 PE |
1009 | |
1010 | # Copy identical files from po to runtime-po. | |
1011 | (cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po) | |
1012 | fi | |
3b2942e6 | 1013 | fi |
1f65350a | 1014 | |
f0a43dd1 JD |
1015 | bootstrap_epilogue |
1016 | ||
1f65350a | 1017 | echo "$0: done. Now you can run './configure'." |
f0a43dd1 | 1018 | |
86996fca PE |
1019 | # Local variables: |
1020 | # eval: (add-hook 'write-file-hooks 'time-stamp) | |
1021 | # time-stamp-start: "scriptversion=" | |
1022 | # time-stamp-format: "%:y-%02m-%02d.%02H" | |
1023 | # time-stamp-time-zone: "UTC" | |
1024 | # time-stamp-end: "; # UTC" | |
f0a43dd1 | 1025 | # End: |