]>
Commit | Line | Data |
---|---|---|
5c4f8cad PE |
1 | # A library of shell functions for autopull.sh, autogen.sh, and bootstrap. |
2 | ||
3 | # Copyright (C) 2003-2022 Free Software Foundation, Inc. | |
4 | # | |
5 | # This program is free software: you can redistribute it and/or modify | |
6 | # it under the terms of the GNU General Public License as published by | |
7 | # the Free Software Foundation, either version 3 of the License, or | |
8 | # (at your option) any later version. | |
9 | # | |
10 | # This program is distributed in the hope that it will be useful, | |
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | # GNU General Public License for more details. | |
14 | # | |
15 | # You should have received a copy of the GNU General Public License | |
16 | # along with this program. If not, see <https://www.gnu.org/licenses/>. | |
17 | ||
18 | # Originally written by Paul Eggert. The canonical version of this | |
19 | # script is maintained as build-aux/bootstrap-funclib.sh in gnulib. | |
20 | # However, to be useful to your package, you should place a copy of it | |
21 | # under version control in the top-level directory of your package. The | |
22 | # intent is that all customization can be done with a bootstrap.conf | |
23 | # file also maintained in your version control; gnulib comes with a | |
24 | # template build-aux/bootstrap.conf to get you started. | |
25 | ||
26 | scriptversion=2022-07-24.15; # UTC | |
27 | ||
28 | nl=' | |
29 | ' | |
30 | ||
31 | # Ensure file names are sorted consistently across platforms. | |
32 | LC_ALL=C | |
33 | export LC_ALL | |
34 | ||
35 | # Honor $PERL, but work even if there is none. | |
36 | PERL="${PERL-perl}" | |
37 | ||
38 | default_gnulib_url=https://git.savannah.gnu.org/git/gnulib.git | |
39 | ||
40 | # Copyright year, for the --version output. | |
41 | copyright_year=`echo "$scriptversion" | sed -e 's/[^0-9].*//'` | |
42 | copyright="Copyright (C) ${copyright_year} Free Software Foundation, Inc. | |
43 | License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. | |
44 | This is free software: you are free to change and redistribute it. | |
45 | There is NO WARRANTY, to the extent permitted by law." | |
46 | ||
47 | # warnf_ FORMAT-STRING ARG1... | |
48 | warnf_ () | |
49 | { | |
50 | warnf_format_=$1 | |
51 | shift | |
52 | nl=' | |
53 | ' | |
54 | case $* in | |
55 | *$nl*) me_=$(printf "$me"|tr "$nl|" '??') | |
56 | printf "$warnf_format_" "$@" | sed "s|^|$me_: |" ;; | |
57 | *) printf "$me: $warnf_format_" "$@" ;; | |
58 | esac >&2 | |
59 | } | |
60 | ||
61 | # warn_ WORD1... | |
62 | warn_ () | |
63 | { | |
64 | # If IFS does not start with ' ', set it and emit the warning in a subshell. | |
65 | case $IFS in | |
66 | ' '*) warnf_ '%s\n' "$*";; | |
67 | *) (IFS=' '; warn_ "$@");; | |
68 | esac | |
69 | } | |
70 | ||
71 | # die WORD1... | |
72 | die() { warn_ "$@"; exit 1; } | |
73 | ||
74 | # ------------------------------ Configuration. ------------------------------ | |
75 | ||
76 | # Directory that contains package-specific gnulib modules and/or overrides. | |
77 | local_gl_dir=gl | |
78 | ||
79 | # Name of the Makefile.am | |
80 | # XXX Not used. | |
81 | gnulib_mk=gnulib.mk | |
82 | ||
83 | # List of gnulib modules needed. | |
84 | gnulib_modules= | |
85 | ||
86 | # Any gnulib files needed that are not in modules. | |
87 | gnulib_files= | |
88 | ||
89 | # A function to be called for each unrecognized option. Returns 0 if | |
90 | # the option in $1 has been processed by the function. Returns 1 if | |
91 | # the option has not been processed by the function. Override it via | |
92 | # your own definition in bootstrap.conf | |
93 | bootstrap_option_hook() { return 1; } | |
94 | ||
95 | # A function to be called in order to print the --help information | |
96 | # corresponding to user-defined command-line options. | |
97 | bootstrap_print_option_usage_hook() { :; } | |
98 | ||
99 | # A function to be called at the end of autopull.sh. | |
100 | # Override it via your own definition in bootstrap.conf. | |
101 | bootstrap_post_pull_hook() { :; } | |
102 | ||
103 | # A function to be called right after gnulib-tool is run. | |
104 | # Override it via your own definition in bootstrap.conf. | |
105 | bootstrap_post_import_hook() { :; } | |
106 | ||
107 | # A function to be called after everything else in this script. | |
108 | # Override it via your own definition in bootstrap.conf. | |
109 | bootstrap_epilogue() { :; } | |
110 | ||
111 | # The command to download all .po files for a specified domain into a | |
112 | # specified directory. Fill in the first %s with the destination | |
113 | # directory and the second with the domain name. | |
114 | po_download_command_format=\ | |
115 | "wget --mirror --level=1 -nd -nv -A.po -P '%s' \ | |
116 | https://translationproject.org/latest/%s/" | |
117 | ||
118 | # Prefer a non-empty tarname (4th argument of AC_INIT if given), else | |
119 | # fall back to the package name (1st argument with munging). | |
120 | extract_package_name=' | |
121 | /^AC_INIT(\[*/{ | |
122 | s/// | |
123 | /^[^,]*,[^,]*,[^,]*,[ []*\([^][ ,)]\)/{ | |
124 | s//\1/ | |
125 | s/[],)].*// | |
126 | p | |
127 | q | |
128 | } | |
129 | s/[],)].*// | |
130 | s/^GNU // | |
131 | y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ | |
132 | s/[^abcdefghijklmnopqrstuvwxyz0123456789_]/-/g | |
133 | p | |
134 | } | |
135 | ' | |
136 | package=$(${AUTOCONF:-autoconf} --trace AC_INIT:\$4 configure.ac 2>/dev/null) | |
137 | if test -z "$package"; then | |
138 | package=$(sed -n "$extract_package_name" configure.ac) \ | |
139 | || die 'cannot find package name in configure.ac' | |
140 | fi | |
141 | gnulib_name=lib$package | |
142 | ||
143 | build_aux=build-aux | |
144 | source_base=lib | |
145 | m4_base=m4 | |
146 | doc_base=doc | |
147 | tests_base=tests | |
148 | gnulib_extra_files=" | |
149 | build-aux/install-sh | |
150 | build-aux/mdate-sh | |
151 | build-aux/texinfo.tex | |
152 | build-aux/depcomp | |
153 | build-aux/config.guess | |
154 | build-aux/config.sub | |
155 | doc/INSTALL | |
156 | " | |
157 | ||
158 | # Additional gnulib-tool options to use. Use "\newline" to break lines. | |
159 | gnulib_tool_option_extras= | |
160 | ||
161 | # Other locale categories that need message catalogs. | |
162 | EXTRA_LOCALE_CATEGORIES= | |
163 | ||
164 | # Additional xgettext options to use. Use "\\\newline" to break lines. | |
165 | XGETTEXT_OPTIONS='\\\ | |
166 | --flag=_:1:pass-c-format\\\ | |
167 | --flag=N_:1:pass-c-format\\\ | |
168 | --flag=error:3:c-format --flag=error_at_line:5:c-format\\\ | |
169 | ' | |
170 | ||
171 | # Package bug report address and copyright holder for gettext files | |
172 | COPYRIGHT_HOLDER='Free Software Foundation, Inc.' | |
173 | MSGID_BUGS_ADDRESS=bug-$package@gnu.org | |
174 | ||
175 | # Files we don't want to import. | |
176 | # XXX Not used. | |
177 | excluded_files= | |
178 | ||
179 | # File that should exist in the top directory of a checked out hierarchy, | |
180 | # but not in a distribution tarball. | |
181 | checkout_only_file=README-hacking | |
182 | ||
183 | # Set this to '.cvsignore .gitignore' in bootstrap.conf if you want | |
184 | # those files to be generated in directories like lib/, m4/, and po/. | |
185 | # Or set it to 'auto' to make this script select which to use based | |
186 | # on which version control system (if any) is used in the source directory. | |
187 | vc_ignore=auto | |
188 | ||
189 | # Set this to true in bootstrap.conf to enable --bootstrap-sync by | |
190 | # default. | |
191 | bootstrap_sync=false | |
192 | ||
193 | # Override the default configuration, if necessary. | |
194 | # Make sure that bootstrap.conf is sourced from the current directory | |
195 | # if we were invoked as "sh bootstrap". | |
196 | conffile=`dirname "$me"`/bootstrap.conf | |
197 | test -r "$conffile" && . "$conffile" | |
198 | ||
199 | # ------------------------- Build-time prerequisites ------------------------- | |
200 | ||
201 | check_exists() { | |
202 | if test "$1" = "--verbose"; then | |
203 | ($2 --version </dev/null) >/dev/null 2>&1 | |
204 | if test $? -ge 126; then | |
205 | # If not found, run with diagnostics as one may be | |
206 | # presented with env variables to set to find the right version | |
207 | ($2 --version </dev/null) | |
208 | fi | |
209 | else | |
210 | ($1 --version </dev/null) >/dev/null 2>&1 | |
211 | fi | |
212 | ||
213 | test $? -lt 126 | |
214 | } | |
215 | ||
216 | # Note this deviates from the version comparison in automake | |
217 | # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a | |
218 | # but this should suffice as we won't be specifying old | |
219 | # version formats or redundant trailing .0 in bootstrap.conf. | |
220 | # If we did want full compatibility then we should probably | |
221 | # use m4_version_compare from autoconf. | |
222 | sort_ver() { # sort -V is not generally available | |
223 | ver1="$1" | |
224 | ver2="$2" | |
225 | ||
226 | # split on '.' and compare each component | |
227 | i=1 | |
228 | while : ; do | |
229 | p1=$(echo "$ver1" | cut -d. -f$i) | |
230 | p2=$(echo "$ver2" | cut -d. -f$i) | |
231 | if [ ! "$p1" ]; then | |
232 | echo "$1 $2" | |
233 | break | |
234 | elif [ ! "$p2" ]; then | |
235 | echo "$2 $1" | |
236 | break | |
237 | elif [ ! "$p1" = "$p2" ]; then | |
238 | if [ "$p1" -gt "$p2" ] 2>/dev/null; then # numeric comparison | |
239 | echo "$2 $1" | |
240 | elif [ "$p2" -gt "$p1" ] 2>/dev/null; then # numeric comparison | |
241 | echo "$1 $2" | |
242 | else # numeric, then lexicographic comparison | |
243 | lp=$(printf "%s\n%s\n" "$p1" "$p2" | LANG=C sort -n | tail -n1) | |
244 | if [ "$lp" = "$p2" ]; then | |
245 | echo "$1 $2" | |
246 | else | |
247 | echo "$2 $1" | |
248 | fi | |
249 | fi | |
250 | break | |
251 | fi | |
252 | i=$(($i+1)) | |
253 | done | |
254 | } | |
255 | ||
256 | get_version_sed=' | |
257 | # Move version to start of line. | |
258 | s/.*[v ]\([0-9]\)/\1/ | |
259 | ||
260 | # Skip lines that do not start with version. | |
261 | /^[0-9]/!d | |
262 | ||
263 | # Remove characters after the version. | |
264 | s/[^.a-z0-9-].*// | |
265 | ||
266 | # The first component must be digits only. | |
267 | s/^\([0-9]*\)[a-z-].*/\1/ | |
268 | ||
269 | #the following essentially does s/5.005/5.5/ | |
270 | s/\.0*\([1-9]\)/.\1/g | |
271 | p | |
272 | q' | |
273 | ||
274 | get_version() { | |
275 | app=$1 | |
276 | ||
277 | $app --version >/dev/null 2>&1 || { $app --version; return 1; } | |
278 | ||
279 | $app --version 2>&1 | sed -n "$get_version_sed" | |
280 | } | |
281 | ||
282 | check_versions() { | |
283 | ret=0 | |
284 | ||
285 | while read app req_ver; do | |
286 | # We only need libtoolize from the libtool package. | |
287 | if test "$app" = libtool; then | |
288 | app=libtoolize | |
289 | fi | |
290 | # Exempt git if git is not needed. | |
291 | if test "$app" = git; then | |
292 | $check_git || continue | |
293 | fi | |
294 | # Honor $APP variables ($TAR, $AUTOCONF, etc.) | |
295 | appvar=$(echo $app | LC_ALL=C tr '[a-z]-' '[A-Z]_') | |
296 | test "$appvar" = TAR && appvar=AMTAR | |
297 | case $appvar in | |
298 | GZIP) ;; # Do not use $GZIP: it contains gzip options. | |
299 | PERL::*) ;; # Keep perl modules as-is | |
300 | *) eval "app=\${$appvar-$app}" ;; | |
301 | esac | |
302 | ||
303 | # Handle the still-experimental Automake-NG programs specially. | |
304 | # They remain named as the mainstream Automake programs ("automake", | |
305 | # and "aclocal") to avoid gratuitous incompatibilities with | |
306 | # pre-existing usages (by, say, autoreconf, or custom autogen.sh | |
307 | # scripts), but correctly identify themselves (as being part of | |
308 | # "GNU automake-ng") when asked their version. | |
309 | case $app in | |
310 | automake-ng|aclocal-ng) | |
311 | app=${app%-ng} | |
312 | ($app --version | grep '(GNU automake-ng)') >/dev/null 2>&1 || { | |
313 | warn_ "Error: '$app' not found or not from Automake-NG" | |
314 | ret=1 | |
315 | continue | |
316 | } ;; | |
317 | # Another check is for perl modules. These can be written as | |
318 | # e.g. perl::XML::XPath in case of XML::XPath module, etc. | |
319 | perl::*) | |
320 | # Extract module name | |
321 | app="${app#perl::}" | |
322 | if ! $PERL -m"$app" -e 'exit 0' >/dev/null 2>&1; then | |
323 | warn_ "Error: perl module '$app' not found" | |
324 | ret=1 | |
325 | fi | |
326 | continue | |
327 | ;; | |
328 | esac | |
329 | if [ "$req_ver" = "-" ]; then | |
330 | # Merely require app to exist; not all prereq apps are well-behaved | |
331 | # so we have to rely on $? rather than get_version. | |
332 | if ! check_exists --verbose $app; then | |
333 | warn_ "Error: '$app' not found" | |
334 | ret=1 | |
335 | fi | |
336 | else | |
337 | # Require app to produce a new enough version string. | |
338 | inst_ver=$(get_version $app) | |
339 | if [ ! "$inst_ver" ]; then | |
340 | warn_ "Error: '$app' not found" | |
341 | ret=1 | |
342 | else | |
343 | latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2) | |
344 | if [ ! "$latest_ver" = "$inst_ver" ]; then | |
345 | warnf_ '%s\n' \ | |
346 | "Error: '$app' version == $inst_ver is too old" \ | |
347 | " '$app' version >= $req_ver is required" | |
348 | ret=1 | |
349 | fi | |
350 | fi | |
351 | fi | |
352 | done | |
353 | ||
354 | return $ret | |
355 | } | |
356 | ||
357 | print_versions() { | |
358 | echo "Program Min_version" | |
359 | echo "----------------------" | |
360 | printf %s "$buildreq" | |
361 | echo "----------------------" | |
362 | # can't depend on column -t | |
363 | } | |
364 | ||
365 | # check_build_prerequisites check_git | |
366 | check_build_prerequisites() | |
367 | { | |
368 | check_git="$1" | |
369 | ||
370 | # gnulib-tool requires at least automake and autoconf. | |
371 | # If either is not listed, add it (with minimum version) as a prerequisite. | |
372 | case $buildreq in | |
373 | *automake*) ;; | |
374 | *) buildreq="automake 1.9 | |
375 | $buildreq" ;; | |
376 | esac | |
377 | case $buildreq in | |
378 | *autoconf*) ;; | |
379 | *) buildreq="autoconf 2.59 | |
380 | $buildreq" ;; | |
381 | esac | |
382 | ||
383 | # When we can deduce that gnulib-tool will require patch, | |
384 | # and when patch is not already listed as a prerequisite, add it, too. | |
385 | if test -d "$local_gl_dir" \ | |
386 | && ! find "$local_gl_dir" -name '*.diff' -exec false {} +; then | |
387 | case $buildreq in | |
388 | *patch*) ;; | |
389 | *) buildreq="patch - | |
390 | $buildreq" ;; | |
391 | esac | |
392 | fi | |
393 | ||
394 | if ! printf '%s' "$buildreq" | check_versions; then | |
395 | echo >&2 | |
396 | if test -f README-prereq; then | |
397 | die "See README-prereq for how to get the prerequisite programs" | |
398 | else | |
399 | die "Please install the prerequisite programs" | |
400 | fi | |
401 | fi | |
402 | ||
403 | # Warn the user if autom4te appears to be broken; this causes known | |
404 | # issues with at least gettext 0.18.3. | |
405 | probe=$(echo 'm4_quote([hi])' | autom4te -l M4sugar -t 'm4_quote:$%' -) | |
406 | if test "x$probe" != xhi; then | |
407 | warn_ "WARNING: your autom4te wrapper eats stdin;" | |
408 | warn_ "if bootstrap fails, consider upgrading your autotools" | |
409 | fi | |
410 | } | |
411 | ||
412 | # find_tool ENVVAR NAMES... | |
413 | # ------------------------- | |
414 | # Search for a required program. Use the value of ENVVAR, if set, | |
415 | # otherwise find the first of the NAMES that can be run. | |
416 | # If found, set ENVVAR to the program name, die otherwise. | |
417 | # | |
418 | # FIXME: code duplication, see also gnu-web-doc-update. | |
419 | find_tool () | |
420 | { | |
421 | find_tool_envvar=$1 | |
422 | shift | |
423 | find_tool_names=$@ | |
424 | eval "find_tool_res=\$$find_tool_envvar" | |
425 | if test x"$find_tool_res" = x; then | |
426 | for i; do | |
427 | if check_exists $i; then | |
428 | find_tool_res=$i | |
429 | break | |
430 | fi | |
431 | done | |
432 | fi | |
433 | if test x"$find_tool_res" = x; then | |
434 | warn_ "one of these is required: $find_tool_names;" | |
435 | die "alternatively set $find_tool_envvar to a compatible tool" | |
436 | fi | |
437 | eval "$find_tool_envvar=\$find_tool_res" | |
438 | eval "export $find_tool_envvar" | |
439 | } | |
440 | ||
441 | # --------------------- Preparing GNULIB_SRCDIR for use. --------------------- | |
442 | # This is part of autopull.sh, but bootstrap needs it too, for self-upgrading. | |
443 | ||
444 | cleanup_gnulib() { | |
445 | status=$? | |
446 | # XXX It's a bad idea to erase the submodule directory if it contains local | |
447 | # modifications. | |
448 | rm -fr "$gnulib_path" | |
449 | exit $status | |
450 | } | |
451 | ||
452 | git_modules_config () { | |
453 | test -f .gitmodules && git config --file .gitmodules "$@" | |
454 | } | |
455 | ||
456 | prepare_GNULIB_SRCDIR () | |
457 | { | |
458 | if test -n "$GNULIB_SRCDIR"; then | |
459 | # Use GNULIB_SRCDIR directly. | |
460 | # We already checked that $GNULIB_SRCDIR references a directory. | |
461 | # Verify that it contains a gnulib checkout. | |
462 | test -f "$GNULIB_SRCDIR/gnulib-tool" \ | |
463 | || die "Error: --gnulib-srcdir or \$GNULIB_SRCDIR is specified, but does not contain gnulib-tool" | |
464 | elif $use_git; then | |
465 | gnulib_path=$(git_modules_config submodule.gnulib.path) | |
466 | test -z "$gnulib_path" && gnulib_path=gnulib | |
467 | ||
468 | # Get gnulib files. Populate $gnulib_path, possibly updating a | |
469 | # submodule, for use in the rest of the script. | |
470 | ||
471 | if test -n "$GNULIB_REFDIR" && test -d "$GNULIB_REFDIR"/.git \ | |
472 | && git_modules_config submodule.gnulib.url >/dev/null; then | |
473 | # Use GNULIB_REFDIR as a reference. | |
474 | echo "$0: getting gnulib files..." | |
475 | if git submodule -h|grep -- --reference > /dev/null; then | |
476 | # Prefer the one-liner available in git 1.6.4 or newer. | |
477 | git submodule update --init --reference "$GNULIB_REFDIR" \ | |
478 | "$gnulib_path" || exit $? | |
479 | else | |
480 | # This fallback allows at least git 1.5.5. | |
481 | if test -f "$gnulib_path"/gnulib-tool; then | |
482 | # Since file already exists, assume submodule init already complete. | |
483 | git submodule update -- "$gnulib_path" || exit $? | |
484 | else | |
485 | # Older git can't clone into an empty directory. | |
486 | rmdir "$gnulib_path" 2>/dev/null | |
487 | git clone --reference "$GNULIB_REFDIR" \ | |
488 | "$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \ | |
489 | && git submodule init -- "$gnulib_path" \ | |
490 | && git submodule update -- "$gnulib_path" \ | |
491 | || exit $? | |
492 | fi | |
493 | fi | |
494 | else | |
495 | # GNULIB_REFDIR is not set or not usable. Ignore it. | |
496 | if git_modules_config submodule.gnulib.url >/dev/null; then | |
497 | echo "$0: getting gnulib files..." | |
498 | git submodule init -- "$gnulib_path" || exit $? | |
499 | git submodule update -- "$gnulib_path" || exit $? | |
500 | ||
501 | elif [ ! -d "$gnulib_path" ]; then | |
502 | echo "$0: getting gnulib files..." | |
503 | ||
504 | trap cleanup_gnulib 1 2 13 15 | |
505 | ||
506 | shallow= | |
507 | if test -z "$GNULIB_REVISION"; then | |
508 | if git clone -h 2>&1 | grep -- --depth > /dev/null; then | |
509 | shallow='--depth 2' | |
510 | fi | |
511 | git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \ | |
512 | || cleanup_gnulib | |
513 | else | |
514 | if git fetch -h 2>&1 | grep -- --depth > /dev/null; then | |
515 | shallow='--depth 2' | |
516 | fi | |
517 | mkdir -p "$gnulib_path" | |
518 | # Only want a shallow checkout of $GNULIB_REVISION, but git does not | |
519 | # support cloning by commit hash. So attempt a shallow fetch by commit | |
520 | # hash to minimize the amount of data downloaded and changes needed to | |
521 | # be processed, which can drastically reduce download and processing | |
522 | # time for checkout. If the fetch by commit fails, a shallow fetch can | |
523 | # not be performed because we do not know what the depth of the commit | |
524 | # is without fetching all commits. So fallback to fetching all commits. | |
525 | git -C "$gnulib_path" init | |
526 | git -C "$gnulib_path" remote add origin \ | |
527 | ${GNULIB_URL:-$default_gnulib_url} | |
528 | git -C "$gnulib_path" fetch $shallow origin "$GNULIB_REVISION" \ | |
529 | || git -C "$gnulib_path" fetch origin \ | |
530 | || cleanup_gnulib | |
531 | git -C "$gnulib_path" reset --hard FETCH_HEAD | |
532 | fi | |
533 | ||
534 | trap - 1 2 13 15 | |
535 | fi | |
536 | fi | |
537 | GNULIB_SRCDIR=$gnulib_path | |
538 | # Verify that the submodule contains a gnulib checkout. | |
539 | test -f "$gnulib_path/gnulib-tool" \ | |
540 | || die "Error: $gnulib_path is supposed to contain a gnulib checkout, but does not contain gnulib-tool" | |
541 | fi | |
542 | ||
543 | # XXX Should this be done if $use_git is false? | |
544 | if test -d "$GNULIB_SRCDIR"/.git && test -n "$GNULIB_REVISION" \ | |
545 | && ! git_modules_config submodule.gnulib.url >/dev/null; then | |
546 | (cd "$GNULIB_SRCDIR" && git checkout "$GNULIB_REVISION") || cleanup_gnulib | |
547 | fi | |
548 | ||
549 | # $GNULIB_SRCDIR now points to the version of gnulib to use, and | |
550 | # we no longer need to use git or $gnulib_path below here. | |
551 | } | |
552 | ||
553 | # -------- Upgrading bootstrap to the version found in GNULIB_SRCDIR. -------- | |
554 | ||
555 | upgrade_bootstrap () | |
556 | { | |
557 | { cmp -s "$medir"/bootstrap "$GNULIB_SRCDIR/top/bootstrap" \ | |
558 | && cmp -s "$medir"/bootstrap-funclib.sh "$GNULIB_SRCDIR/top/bootstrap-funclib.sh" \ | |
559 | && cmp -s "$medir"/autopull.sh "$GNULIB_SRCDIR/top/autopull.sh" \ | |
560 | && cmp -s "$medir"/autogen.sh "$GNULIB_SRCDIR/top/autogen.sh"; \ | |
561 | } || { | |
562 | echo "$0: updating bootstrap & companions and restarting..." | |
563 | case $(sh -c 'echo "$1"' -- a) in | |
564 | a) ignored=--;; | |
565 | *) ignored=ignored;; | |
566 | esac | |
567 | exec sh -c \ | |
568 | '{ if test -f "$1"; then cp "$1" "$3"; else cp "$2" "$3"; fi; } && { if test -f "$4"; then cp "$4" "$5"; else rm -f "$5"; fi; } && { if test -f "$6"; then cp "$6" "$7"; else rm -f "$7"; fi; } && { if test -f "$8"; then cp "$8" "$9"; else rm -f "$9"; fi; } && shift && shift && shift && shift && shift && shift && shift && shift && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \ | |
569 | $ignored \ | |
570 | "$GNULIB_SRCDIR/top/bootstrap" "$GNULIB_SRCDIR/build-aux/bootstrap" "$medir/bootstrap" \ | |
571 | "$GNULIB_SRCDIR/top/bootstrap-funclib.sh" "$medir/bootstrap-funclib.sh" \ | |
572 | "$GNULIB_SRCDIR/top/autopull.sh" "$medir/autopull.sh" \ | |
573 | "$GNULIB_SRCDIR/top/autogen.sh" "$medir/autogen.sh" \ | |
574 | "$0" "$@" --no-bootstrap-sync | |
575 | } | |
576 | } | |
577 | ||
578 | # ---------------------------------------------------------------------------- | |
579 | ||
580 | if test x"$gnulib_modules$gnulib_files$gnulib_extra_files" = x; then | |
581 | use_gnulib=false | |
582 | else | |
583 | use_gnulib=true | |
584 | fi | |
585 | ||
586 | # ---------------------------------------------------------------------------- | |
587 | ||
588 | # Local Variables: | |
589 | # eval: (add-hook 'before-save-hook 'time-stamp) | |
590 | # time-stamp-start: "scriptversion=" | |
591 | # time-stamp-format: "%:y-%02m-%02d.%02H" | |
592 | # time-stamp-time-zone: "UTC0" | |
593 | # time-stamp-end: "; # UTC" | |
594 | # End: |