2 # Print a version string.
3 scriptversion
=2015-08-24.08
; # UTC
5 # Bootstrap this package from checked-out sources.
7 # Copyright (C) 2003-2019 Free Software Foundation, Inc.
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
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.
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
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.
30 # Please report bugs or propose patches to bug-gnulib@gnu.org.
35 # Ensure file names are sorted consistently across platforms.
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
45 # Honour $PERL, but work even if there is none
52 Usage: $me [OPTION]...
53 Bootstrap this package from the checked-out sources.
56 --gnulib-srcdir=DIRNAME specify the local directory where gnulib
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
60 them again. Defaults to \$GNULIB_SRCDIR
61 --bootstrap-sync if this bootstrap script is not identical to
62 the version in the local gnulib sources,
63 update this script, and then restart it with
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
73 If the file $me.conf exists in the same directory as this script, its
74 contents are read as shell variables to configure the bootstrap.
76 For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
79 Running without arguments will suffice in most cases.
83 # warnf_ FORMAT-STRING ARG1...
91 *$nl*) me_
=$
(printf "$me"|
tr "$nl|" '??')
92 printf "$warnf_format_" "$@" |
sed "s|^|$me_: |" ;;
93 *) printf "$me: $warnf_format_" "$@" ;;
100 # If IFS does not start with ' ', set it and emit the warning in a subshell.
102 ' '*) warnf_
'%s\n' "$*";;
103 *) (IFS
=' '; warn_
"$@");;
108 die
() { warn_
"$@"; exit 1; }
112 # Name of the Makefile.am
115 # List of gnulib modules needed.
118 # Any gnulib files needed that are not in modules.
121 : ${AUTOPOINT=autopoint}
122 : ${AUTORECONF=autoreconf}
124 # A function to be called right after gnulib-tool is run.
125 # Override it via your own definition in bootstrap.conf.
126 bootstrap_post_import_hook
() { :; }
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
() { :; }
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
137 po_download_command_format
=\
138 "rsync --delete --exclude '*.s1' -Lrtvz \
139 'translationproject.org::tp/latest/%s/' '%s'"
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/"
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)
148 extract_package_name
='
151 /^[^,]*,[^,]*,[^,]*,[ []*\([^][ ,)]\)/{
159 y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
160 s/[^abcdefghijklmnopqrstuvwxyz0123456789_]/-/g
164 package
=$
(sed -n "$extract_package_name" configure.ac
) \
165 || die
'cannot find package name in configure.ac'
166 gnulib_name
=lib
$package
173 gnulib_extra_files
=''
175 # Additional gnulib-tool options to use. Use "\newline" to break lines.
176 gnulib_tool_option_extras
=
178 # Other locale categories that need message catalogs.
179 EXTRA_LOCALE_CATEGORIES
=
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\\\
188 # Package bug report address and copyright holder for gettext files
189 COPYRIGHT_HOLDER
='Free Software Foundation, Inc.'
190 MSGID_BUGS_ADDRESS
=bug-
$package@gnu.org
192 # Files we don't want to import.
195 # File that should exist in the top directory of a checked out hierarchy,
196 # but not in a distribution tarball.
197 checkout_only_file
=README-hacking
199 # Whether to use copies instead of symlinks.
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.
208 # Set this to true in bootstrap.conf to enable --bootstrap-sync by
212 # Use git to update gnulib sources
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
)
224 ($1 --version </dev
/null
) >/dev
/null
2>&1
230 # find_tool ENVVAR NAMES...
231 # -------------------------
232 # Search for a required program. Use the value of ENVVAR, if set,
233 # otherwise find the first of the NAMES that can be run.
234 # If found, set ENVVAR to the program name, die otherwise.
236 # FIXME: code duplication, see also gnu-web-doc-update.
242 eval "find_tool_res=\$$find_tool_envvar"
243 if test x
"$find_tool_res" = x
; then
245 if check_exists
$i; then
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"
255 eval "$find_tool_envvar=\$find_tool_res"
256 eval "export $find_tool_envvar"
266 # If the destination directory doesn't exist, create it.
267 # This is required at least for "lib/uniwidth/cjk.h".
268 dst_dir
=$
(dirname "$dst")
269 if ! test -d "$dst_dir"; then
272 # If we've just created a directory like lib/uniwidth,
273 # tell version control system(s) it's ignorable.
274 # FIXME: for now, this does only one level
275 parent
=$
(dirname "$dst_dir")
276 for dot_ig
in x
$vc_ignore; do
277 test $dot_ig = x
&& continue
279 insert_vc_ignore
$ig "${dst_dir##*/}"
285 test ! -h "$dst" ||
{
286 echo "$me: rm -f $dst" &&
291 cmp -s "$src" "$dst" ||
{
292 echo "$me: cp -fp $src $dst" &&
296 # Leave any existing symlink alone, if it already points to the source,
297 # so that broken build tools that care about symlink times
298 # aren't confused into doing unnecessary builds. Conversely, if the
299 # existing symlink's time stamp is older than the source, make it afresh,
300 # so that broken tools aren't confused into skipping needed builds. See
301 # <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00326.html>.
303 src_ls
=$
(ls -diL "$src" 2>/dev
/null
) && set $src_ls && src_i
=$1 &&
304 dst_ls
=$
(ls -diL "$dst" 2>/dev
/null
) && set $dst_ls && dst_i
=$1 &&
305 test "$src_i" = "$dst_i" &&
306 both_ls
=$
(ls -dt "$src" "$dst") &&
307 test "X$both_ls" = "X$dst$nl$src" ||
{
313 *//* |
*/..
/* |
*/.
/* |
/*/*/*/*/*/)
314 die
"invalid symlink calculation: $src -> $dst";;
315 /*/*/*/*/) dot_dots
=..
/..
/..
/;;
316 /*/*/*/) dot_dots
=..
/..
/;;
317 /*/*/) dot_dots
=..
/;;
321 echo "$me: ln -fs $dot_dots$src $dst" &&
322 ln -fs "$dot_dots$src" "$dst"
328 # Override the default configuration, if necessary.
329 # Make sure that bootstrap.conf is sourced from the current directory
330 # if we were invoked as "sh bootstrap".
332 */*) test -r "$0.conf" && .
"$0.conf" ;;
333 *) test -r "$0.conf" && . .
/"$0.conf" ;;
336 # Extra files from gnulib, which override files from other sources.
337 test -z "${gnulib_extra_files}" && \
341 build-aux/texinfo.tex
343 build-aux/config.guess
348 if test "$vc_ignore" = auto
; then
350 test -d .git
&& vc_ignore
=.gitignore
351 test -d CVS
&& vc_ignore
="$vc_ignore .cvsignore"
354 # Translate configuration into internal form.
365 GNULIB_SRCDIR
=${option#--gnulib-srcdir=};;
369 checkout_only_file
=;;
373 bootstrap_sync
=true
;;
375 bootstrap_sync
=false
;;
379 die
"$option: unknown option";;
383 $use_git ||
test -d "$GNULIB_SRCDIR" \
384 || die
"Error: --no-git requires --gnulib-srcdir"
386 if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
387 die
"Bootstrapping from a non-checked-out distribution is risky."
390 # Strip blank and comment lines to leave significant entries.
391 gitignore_entries
() {
392 sed '/^#/d; /^$/d' "$@"
395 # If $STR is not already on a line by itself in $FILE, insert it at the start.
396 # Entries are inserted at the start of the ignore list to ensure existing
397 # entries starting with ! are not overridden. Such entries support
398 # whitelisting exceptions after a more generic blacklist pattern.
402 test -f $file ||
touch $file
403 test -r $file || die
"Error: failed to read ignore file: $file"
404 duplicate_entries
=$
(gitignore_entries
$file |
sort |
uniq -d)
405 if [ "$duplicate_entries" ] ; then
406 die
"Error: Duplicate entries in $file: " $duplicate_entries
408 linesold
=$
(gitignore_entries
$file |
wc -l)
409 linesnew
=$
( { echo "$str"; cat $file; } | gitignore_entries |
sort -u |
wc -l)
410 if [ $linesold != $linesnew ] ; then
411 { echo "$str" |
cat - $file > $file.bak
&& mv $file.bak
$file; } \
412 || die
"insert_if_absent $file $str: failed"
416 # Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
421 case $vc_ignore_file in
423 # A .gitignore entry that does not start with '/' applies
424 # recursively to subdirectories, so prepend '/' to every
426 pattern
=$
(echo "$pattern" |
sed s
,^
,/,);;
428 insert_if_absent
"$vc_ignore_file" "$pattern"
431 # Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
433 grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \
434 >/dev
/null
&& found_aux_dir
=yes
435 grep '^[ ]*AC_CONFIG_AUX_DIR('"$build_aux"')' configure.ac \
436 >/dev
/null
&& found_aux_dir
=yes
437 test $found_aux_dir = yes \
438 || die
"configure.ac lacks 'AC_CONFIG_AUX_DIR([$build_aux])'; add it"
440 # If $build_aux doesn't exist, create it now, otherwise some bits
441 # below will malfunction. If creating it, also mark it as ignored.
442 if test ! -d $build_aux; then
444 for dot_ig
in x
$vc_ignore; do
445 test $dot_ig = x
&& continue
446 insert_vc_ignore
$dot_ig $build_aux
450 # Note this deviates from the version comparison in automake
451 # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
452 # but this should suffice as we won't be specifying old
453 # version formats or redundant trailing .0 in bootstrap.conf.
454 # If we did want full compatibility then we should probably
455 # use m4_version_compare from autoconf.
456 sort_ver
() { # sort -V is not generally available
460 # split on '.' and compare each component
463 p1
=$
(echo "$ver1" | cut
-d.
-f$i)
464 p2
=$
(echo "$ver2" | cut
-d.
-f$i)
468 elif [ ! "$p2" ]; then
471 elif [ ! "$p1" = "$p2" ]; then
472 if [ "$p1" -gt "$p2" ] 2>/dev
/null
; then # numeric comparison
474 elif [ "$p2" -gt "$p1" ] 2>/dev
/null
; then # numeric comparison
476 else # numeric, then lexicographic comparison
477 lp=$
(printf "$p1\n$p2\n" | LANG
=C
sort -n |
tail -n1)
478 if [ "$lp" = "$p2" ]; then
493 $app --version >/dev
/null
2>&1 ||
{ $app --version; return 1; }
495 $app --version 2>&1 |
496 sed -n '# Move version to start of line.
497 s/.*[v ]\([0-9]\)/\1/
499 # Skip lines that do not start with version.
502 # Remove characters after the version.
505 # The first component must be digits only.
506 s/^\([0-9]*\)[a-z-].*/\1/
508 #the following essentially does s/5.005/5.5/
509 s/\.0*\([1-9]\)/.\1/g
517 while read app req_ver
; do
518 # We only need libtoolize from the libtool package.
519 if test "$app" = libtool
; then
522 # Exempt git if --no-git is in effect.
523 if test "$app" = git
; then
526 # Honor $APP variables ($TAR, $AUTOCONF, etc.)
527 appvar
=$
(echo $app | LC_ALL
=C
tr '[a-z]-' '[A-Z]_')
528 test "$appvar" = TAR
&& appvar
=AMTAR
530 GZIP
) ;; # Do not use $GZIP: it contains gzip options.
531 PERL
::*) ;; # Keep perl modules as-is
532 *) eval "app=\${$appvar-$app}" ;;
535 # Handle the still-experimental Automake-NG programs specially.
536 # They remain named as the mainstream Automake programs ("automake",
537 # and "aclocal") to avoid gratuitous incompatibilities with
538 # pre-existing usages (by, say, autoreconf, or custom autogen.sh
539 # scripts), but correctly identify themselves (as being part of
540 # "GNU automake-ng") when asked their version.
542 automake-ng|aclocal-ng
)
544 ($app --version |
grep '(GNU automake-ng)') >/dev
/null
2>&1 ||
{
545 warn_
"Error: '$app' not found or not from Automake-NG"
549 # Another check is for perl modules. These can be written as
550 # e.g. perl::XML::XPath in case of XML::XPath module, etc.
552 # Extract module name
554 if ! $PERL -m"$app" -e 'exit 0' >/dev
/null
2>&1; then
555 warn_
"Error: perl module '$app' not found"
561 if [ "$req_ver" = "-" ]; then
562 # Merely require app to exist; not all prereq apps are well-behaved
563 # so we have to rely on $? rather than get_version.
564 if ! check_exists
--verbose $app; then
565 warn_
"Error: '$app' not found"
569 # Require app to produce a new enough version string.
570 inst_ver
=$
(get_version
$app)
571 if [ ! "$inst_ver" ]; then
572 warn_
"Error: '$app' not found"
575 latest_ver
=$
(sort_ver
$req_ver $inst_ver | cut
-d' ' -f2)
576 if [ ! "$latest_ver" = "$inst_ver" ]; then
578 "Error: '$app' version == $inst_ver is too old" \
579 " '$app' version >= $req_ver is required"
590 echo "Program Min_version"
591 echo "----------------------"
592 printf %s
"$buildreq"
593 echo "----------------------"
594 # can't depend on column -t
597 # Find sha1sum, named gsha1sum on MacPorts, shasum on Mac OS X 10.6.
598 # Also find the compatible sha1 utility on the BSDs
599 if test x
"$SKIP_PO" = x
; then
600 find_tool SHA1SUM
sha1sum gsha1sum shasum sha1
604 # We'd like to use grep -E, to see if any of LT_INIT,
605 # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
606 # but that's not portable enough (e.g., for Solaris).
607 grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac
>/dev
/null \
609 grep '^[ ]*LT_INIT' configure.ac
>/dev
/null \
611 if test $use_libtool = 1; then
612 find_tool LIBTOOLIZE glibtoolize libtoolize
615 # gnulib-tool requires at least automake and autoconf.
616 # If either is not listed, add it (with minimum version) as a prerequisite.
619 *) buildreq
="automake 1.9
624 *) buildreq
="autoconf 2.59
628 # When we can deduce that gnulib-tool will require patch,
629 # and when patch is not already listed as a prerequisite, add it, too.
630 if test -d "$local_gl_dir" \
631 && ! find "$local_gl_dir" -name '*.diff' -exec false
{} +; then
639 if ! printf "$buildreq" | check_versions
; then
641 if test -f README-prereq
; then
642 die
"See README-prereq for how to get the prerequisite programs"
644 die
"Please install the prerequisite programs"
648 # Warn the user if autom4te appears to be broken; this causes known
649 # issues with at least gettext 0.18.3.
650 probe
=$
(echo 'm4_quote([hi])' | autom4te
-l M4sugar
-t 'm4_quote:$%' -)
651 if test "x$probe" != xhi
; then
652 warn_
"WARNING: your autom4te wrapper eats stdin;"
653 warn_
"if bootstrap fails, consider upgrading your autotools"
656 echo "$0: Bootstrapping from checked-out $package sources..."
658 # See if we can use gnulib's git-merge-changelog merge driver.
659 if $use_git && test -d .git
&& check_exists git
; then
660 if git config merge.merge-changelog.driver
>/dev
/null
; then
662 elif check_exists git-merge-changelog
; then
663 echo "$0: initializing git-merge-changelog driver"
664 git config merge.merge-changelog.name
'GNU-style ChangeLog merge driver'
665 git config merge.merge-changelog.driver
'git-merge-changelog %O %A %B'
667 echo "$0: consider installing git-merge-changelog from gnulib"
674 rm -fr "$gnulib_path"
678 git_modules_config
() {
679 test -f .gitmodules
&& git config
--file .gitmodules
"$@"
683 gnulib_path
=$
(git_modules_config submodule.gnulib.path
)
684 test -z "$gnulib_path" && gnulib_path
=gnulib
687 # Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a
688 # submodule, for use in the rest of the script.
690 case ${GNULIB_SRCDIR--} in
692 # Note that $use_git is necessarily true in this case.
693 if git_modules_config submodule.gnulib.url
>/dev
/null
; then
694 echo "$0: getting gnulib files..."
695 git submodule init
-- "$gnulib_path" ||
exit $?
696 git submodule update
-- "$gnulib_path" ||
exit $?
698 elif [ ! -d "$gnulib_path" ]; then
699 echo "$0: getting gnulib files..."
701 trap cleanup_gnulib
1 2 13 15
704 git clone
-h 2>&1 |
grep -- --depth > /dev
/null
&& shallow
='--depth 2'
705 git clone
$shallow git
://git.sv.gnu.org
/gnulib
"$gnulib_path" ||
710 GNULIB_SRCDIR
=$gnulib_path
713 # Use GNULIB_SRCDIR directly or as a reference.
714 if $use_git && test -d "$GNULIB_SRCDIR"/.git
&& \
715 git_modules_config submodule.gnulib.url
>/dev
/null
; then
716 echo "$0: getting gnulib files..."
717 if git submodule
-h|
grep -- --reference > /dev
/null
; then
718 # Prefer the one-liner available in git 1.6.4 or newer.
719 git submodule update
--init --reference "$GNULIB_SRCDIR" \
720 "$gnulib_path" ||
exit $?
722 # This fallback allows at least git 1.5.5.
723 if test -f "$gnulib_path"/gnulib-tool
; then
724 # Since file already exists, assume submodule init already complete.
725 git submodule update
-- "$gnulib_path" ||
exit $?
727 # Older git can't clone into an empty directory.
728 rmdir "$gnulib_path" 2>/dev
/null
729 git clone
--reference "$GNULIB_SRCDIR" \
730 "$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
731 && git submodule init
-- "$gnulib_path" \
732 && git submodule update
-- "$gnulib_path" \
736 GNULIB_SRCDIR
=$gnulib_path
741 # $GNULIB_SRCDIR now points to the version of gnulib to use, and
742 # we no longer need to use git or $gnulib_path below here.
744 if $bootstrap_sync; then
745 cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" ||
{
746 echo "$0: updating bootstrap and restarting..."
747 case $
(sh
-c 'echo "$1"' -- a
) in
752 'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
753 $ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \
754 "$0" "$@" --no-bootstrap-sync
758 gnulib_tool
=$GNULIB_SRCDIR/gnulib-tool
759 <$gnulib_tool ||
exit $?
763 download_po_files
() {
766 echo "$me: getting translations into $subdir for $domain..."
767 cmd
=$
(printf "$po_download_command_format" "$domain" "$subdir")
768 eval "$cmd" && return
770 cmd
=$
(printf "$po_download_command_format2" "$subdir" "$domain")
774 # Mirror .po files to $po_dir/.reference and copy only the new
775 # or modified ones into $po_dir. Also update $po_dir/LINGUAS.
776 # Note po files that exist locally only are left in $po_dir but will
777 # not be included in LINGUAS and hence will not be distributed.
779 # Directory containing primary .po files.
780 # Overwrite them only when we're sure a .po file is new.
784 # Mirror *.po files into this dir.
785 # Usually contains *.s1 checksum files.
786 ref_po_dir
="$po_dir/.reference"
788 test -d $ref_po_dir || mkdir
$ref_po_dir ||
return
789 download_po_files
$ref_po_dir $domain \
790 && ls "$ref_po_dir"/*.po
2>/dev
/null |
791 sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" ||
return
793 langs
=$
(cd $ref_po_dir && echo *.po |
sed 's/\.po//g')
794 test "$langs" = '*' && langs
=x
796 case $po in x
) continue;; esac
797 new_po
="$ref_po_dir/$po.po"
798 cksum_file
="$ref_po_dir/$po.s1"
799 if ! test -f "$cksum_file" ||
800 ! test -f "$po_dir/$po.po" ||
801 ! $SHA1SUM -c "$cksum_file" < "$new_po" > /dev
/null
2>&1; then
802 echo "$me: updated $po_dir/$po.po..."
803 cp "$new_po" "$po_dir/$po.po" \
804 && $SHA1SUM < "$new_po" > "$cksum_file" ||
return
812 update_po_files po
$package ||
exit
815 if test -d runtime-po
; then
816 update_po_files runtime-po
$package-runtime ||
exit
820 version_controlled_file
() {
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
831 warn_
"no version control for $file?"
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.
843 # Import from gettext.
845 grep '^[ ]*AM_GNU_GETTEXT_VERSION(' configure.ac
>/dev
/null || \
848 if test $with_gettext = yes ||
test $use_libtool = 1; then
850 tempbase
=.bootstrap$$
851 trap "rm -f $tempbase.0 $tempbase.1" 1 2 13 15
853 > $tempbase.0 > $tempbase.1 &&
854 find .
! -type d
-print |
sort > $tempbase.0 ||
exit
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
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
870 case $
($LIBTOOLIZE --help) in
871 *--install*) install=--install ;;
873 echo "running: $LIBTOOLIZE $install --copy"
874 $LIBTOOLIZE $install --copy
877 find .
! -type d
-print |
sort >$tempbase.1
880 for file in $
(comm -13 $tempbase.0 $tempbase.1); do
883 version_controlled_file
"$parent" "$file" ||
{
884 for dot_ig
in x
$vc_ignore; do
885 test $dot_ig = x
&& continue
887 insert_vc_ignore
"$ig" "${file##*/}"
893 rm -f $tempbase.0 $tempbase.1
897 # Import from gnulib.
899 gnulib_tool_options
="\
902 --aux-dir $build_aux\
903 --doc-base $doc_base\
906 --source-base $source_base/\
907 --tests-base $tests_base\
908 --local-dir $local_gl_dir\
909 $gnulib_tool_option_extras\
911 if test $use_libtool = 1; then
912 case "$gnulib_tool_options " in
914 *) gnulib_tool_options
="$gnulib_tool_options --libtool" ;;
917 echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
918 $gnulib_tool $gnulib_tool_options --import $gnulib_modules \
919 || die
"gnulib-tool failed"
921 for file in $gnulib_files; do
922 symlink_to_dir
"$GNULIB_SRCDIR" $file \
923 || die
"failed to symlink $file"
926 bootstrap_post_import_hook \
927 || die
"bootstrap_post_import_hook failed"
929 # Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
930 # gnulib-populated directories. Such .m4 files would cause aclocal to fail.
931 # The following requires GNU find 4.2.3 or newer. Considering the usual
932 # portability constraints of this script, that may seem a very demanding
933 # requirement, but it should be ok. Ignore any failure, which is fine,
934 # since this is only a convenience to help developers avoid the relatively
935 # unusual case in which a symlinked-to .m4 file is git-removed from gnulib
936 # between successive runs of this script.
937 find "$m4_base" "$source_base" \
938 -depth \
( -name '*.m4' -o -name '*.[ch]' \
) \
939 -type l
-xtype l
-delete > /dev
/null
2>&1
941 # Invoke autoreconf with --force --install to ensure upgrades of tools
943 AUTORECONFFLAGS
="--verbose --install --force -I $m4_base $ACLOCAL_FLAGS"
945 # Some systems (RHEL 5) are using ancient autotools, for which the
946 # --no-recursive option had not been invented. Detect that lack and
947 # omit the option when it's not supported. FIXME in 2017: remove this
948 # hack when RHEL 5 autotools are updated, or when they become irrelevant.
949 case $
($AUTORECONF --help) in
950 *--no-recursive*) AUTORECONFFLAGS
="$AUTORECONFFLAGS --no-recursive";;
953 # Tell autoreconf not to invoke autopoint or libtoolize; they were run above.
954 echo "running: AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS"
955 AUTOPOINT
=true LIBTOOLIZE
=true
$AUTORECONF $AUTORECONFFLAGS \
956 || die
"autoreconf failed"
958 # Get some extra files from gnulib, overriding existing files.
959 for file in $gnulib_extra_files; do
961 */INSTALL
) dst
=INSTALL
;;
962 build-aux
/*) dst
=$build_aux/${file#build-aux/};;
965 symlink_to_dir
"$GNULIB_SRCDIR" $file $dst \
966 || die
"failed to symlink $file"
969 if test $with_gettext = yes; then
970 # Create gettext configuration.
971 echo "$0: Creating po/Makevars from po/Makevars.template ..."
974 /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
975 /^COPYRIGHT_HOLDER *=/s/=.*/= '"$COPYRIGHT_HOLDER"'/
976 /^MSGID_BUGS_ADDRESS *=/s|=.*|= '"$MSGID_BUGS_ADDRESS"'|
977 /^XGETTEXT_OPTIONS *=/{
980 '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
982 ' po
/Makevars.template
>po
/Makevars \
983 || die
'cannot generate po/Makevars'
985 # If the 'gettext' module is in use, grab the latest Makefile.in.in.
986 # If only the 'gettext-h' module is in use, assume autopoint already
987 # put the correct version of this file into place.
988 case $gnulib_modules in
991 cp $GNULIB_SRCDIR/build-aux
/po
/Makefile.
in.
in po
/Makefile.
in.
in \
992 || die
"cannot create po/Makefile.in.in"
996 if test -d runtime-po
; then
997 # Similarly for runtime-po/Makevars, but not quite the same.
998 rm -f runtime-po
/Makevars
1000 /^DOMAIN *=.*/s/=.*/= '"$package"'-runtime/
1001 /^subdir *=.*/s/=.*/= runtime-po/
1002 /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
1003 /^XGETTEXT_OPTIONS *=/{
1006 '"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
1008 ' po
/Makevars.template
>runtime-po
/Makevars \
1009 || die
'cannot generate runtime-po/Makevars'
1011 # Copy identical files from po to runtime-po.
1012 (cd po
&& cp -p Makefile.
in.
in *-quot *.header
*.
sed *.sin ..
/runtime-po
)
1018 echo "$0: done. Now you can run './configure'."
1021 # eval: (add-hook 'write-file-hooks 'time-stamp)
1022 # time-stamp-start: "scriptversion="
1023 # time-stamp-format: "%:y-%02m-%02d.%02H"
1024 # time-stamp-time-zone: "UTC"
1025 # time-stamp-end: "; # UTC"