From aec80873100b4cb0fc7abc9585822b7041fcd1f1 Mon Sep 17 00:00:00 2001 From: "Gary V. Vaughan" Date: Wed, 19 Nov 2014 13:42:27 +0000 Subject: bootstrap: sync with upstream. * build-aux/gl/build-aux/bootstrap.in, build-aux/gl/build-aux/extract-trace, build-aux/gl/build-aux/funclib.sh, build-aux/gl/build-aux/inline-source, build-aux/gl/build-aux/options-parser: Sync with upstream. * bootstrap: Regenerate. Signed-off-by: Gary V. Vaughan --- bootstrap | 1122 +++++++++++++++++++-------------- build-aux/gl/build-aux/bootstrap.in | 253 ++++---- build-aux/gl/build-aux/extract-trace | 24 +- build-aux/gl/build-aux/funclib.sh | 247 ++++++-- build-aux/gl/build-aux/inline-source | 22 +- build-aux/gl/build-aux/options-parser | 26 +- 6 files changed, 1031 insertions(+), 663 deletions(-) diff --git a/bootstrap b/bootstrap index 3188a877..f81f3ff1 100755 --- a/bootstrap +++ b/bootstrap @@ -1,20 +1,241 @@ #! /bin/sh +## DO NOT EDIT - This file generated from build-aux/bootstrap.in +## by inline-source v2014-01-03.01 # Bootstrap an Autotooled package from checked-out sources. # Written by Gary V. Vaughan, 2010 -# Copyright (C) 2010-2013 Free Software Foundation, Inc. +# Copyright (C) 2010-2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Originally written by Paul Eggert. The canonical version of this +# script is maintained as build-aux/bootstrap in gnulib, however, to +# be useful to your project, you should place a copy of it under +# version control in the top-level directory of your project. The +# intent is that all customization can be done with a bootstrap.conf +# file also maintained in your version control; gnulib comes with a +# template build-aux/bootstrap.conf to get you started. + +# Please report bugs or propose patches to bug-gnulib@gnu.org. + + +## ------ ## +## Usage. ## +## ------ ## + +# Most GNUish projects do not keep all of the generated Autotool +# files under version control, but running all of the right tools +# with the right arguments, in the correct order to regenerate +# all of those files in readiness for configuration and building +# can be surprisingly involved! Many projects have a 'bootstrap' +# script under version control to invoke Autotools and perform +# other assorted book-keeping with version numbers and the like. +# +# This bootstrap script aims to probe the configure.ac and top +# Makefile.am of your project to automatically determine what +# the correct ordering and arguments are and then run the tools for +# you. In order to use it, you can generate an initial standalone +# script with: +# +# gl/build-aux/inline-source gl/build-aux/bootstrap.in > bootstrap +# +# You should then store than script in version control for other +# developers in you project. It will give you instructions about +# how to keep it up to date if the sources change. +# +# See gl/doc/bootstrap.texi for documentation on how to write +# a bootstrap.conf to customize it for your project's +# idiosyncracies. + + +## ================================================================== ## +## ## +## DO NOT EDIT THIS FILE, CUSTOMIZE IT USING A BOOTSTRAP.CONF ## +## ## +## ================================================================== ## + +## ------------------------------- ## +## User overridable command paths. ## +## ------------------------------- ## + +# All uppercase denotes values stored in the environment. These +# variables should generally be overridden by the user - however, we do +# set them to 'true' in some parts of this script to prevent them being +# called at the wrong time by other tools that we call ('autoreconf', +# for example). +# +# We also allow 'LIBTOOLIZE', 'M4', 'SHA1SUM' and some others to be +# overridden, and export the result for child processes, but they are +# handled by the function 'func_find_tool' and not defaulted in this +# section. + +: ${ACLOCAL="aclocal"} +: ${AUTOCONF="autoconf"} +: ${AUTOHEADER="autoheader"} +: ${AUTOM4TE="autom4te"} +: ${AUTOHEADER="autoheader"} +: ${AUTOMAKE="automake"} +: ${AUTOPOINT="autopoint"} +: ${AUTORECONF="autoreconf"} +: ${CMP="cmp"} +: ${CONFIG_SHELL="/bin/sh"} +: ${DIFF="diff"} +: ${GIT="git"} +: ${LN_S="ln -s"} +: ${RM="rm"} + +export ACLOCAL +export AUTOCONF +export AUTOHEADER +export AUTOM4TE +export AUTOHEADER +export AUTOMAKE +export AUTOPOINT +export AUTORECONF +export CONFIG_SHELL + + +## -------------- ## +## Configuration. ## +## -------------- ## + +# A newline delimited list of triples of programs (that respond to +# --version), the minimum version numbers required (or just '-' in the +# version field if any version will be sufficient) and homepage URLs +# to help locate missing packages. +buildreq= + +# Name of a file containing instructions on installing missing packages +# required in 'buildreq'. +buildreq_readme=README-hacking + +# These are extracted from AC_INIT in configure.ac, though you can +# override those values in 'bootstrap.conf' if you prefer. +build_aux= +macro_dir= +package= +package_name= +package_version= +package_bugreport= + +# These are extracted from 'gnulib-cache.m4', or else fall-back +# automatically on the gnulib defaults; unless you set the values +# manually in 'bootstrap.conf'. +doc_base= +gnulib_mk= +gnulib_name= +local_gl_dir= +source_base= +tests_base= + +# The list of gnulib modules required at 'gnulib-tool' time. If you +# check 'gnulib-cache.m4' into your repository, then this list will be +# extracted automatically. +gnulib_modules= + +# Extra gnulib files that are not in modules, which override files of +# the same name installed by other bootstrap tools. +gnulib_non_module_files=" + build-aux/compile + build-aux/install-sh + build-aux/mdate-sh + build-aux/texinfo.tex + build-aux/depcomp + build-aux/config.guess + build-aux/config.sub + doc/INSTALL +" + +# Relative path to the local gnulib submodule, and url to the upstream +# git repository. If you have a gnulib entry in your .gitmodules file, +# these values are ignored. +gnulib_path= +gnulib_url= + +# Additional gnulib-tool options to use. +gnulib_tool_options=" + --no-changelog +" + +# bootstrap removes any macro-files that are not included by aclocal.m4, +# except for files listed in this variable that are always kept. +gnulib_precious=" + gnulib-tool.m4 +" + +# When truncating long commands for display, always allow at least this +# many characters before truncating. +min_cmd_len=160 + +# The command to download all .po files for a specified domain into +# a specified directory. Fill in the first %s is the domain name, and +# the second with the destination directory. Use rsync's -L and -r +# options because the latest/%s directory and the .po files within are +# all symlinks. +po_download_command_format=\ +"rsync --delete --exclude '*.s1' -Lrtvz \ +'translationproject.org::tp/latest/%s/' '%s'" + +# Other locale categories that need message catalogs. +extra_locale_categories= + +# Additional xgettext options to use. Gnulib might provide you with an +# extensive list of additional options to append to this, but gettext +# 0.16.1 and newer appends them automaticaly, so you can safely ignore +# the complaints from 'gnulib-tool' if your $configure_ac states: +# +# AM_GNU_GETTEXT_VERSION([0.16.1]) +xgettext_options=" + --flag=_:1:pass-c-format + --flag=N_:1:pass-c-format +" + +# Package copyright holder for gettext files. Defaults to FSF if unset. +copyright_holder= + +# File that should exist in the top directory of a checked out hierarchy, +# but not in a distribution tarball. +checkout_only_file= + +# Whether to use copies instead of symlinks by default (if set to true, +# the --copy option has no effect). +copy=false + +# Set this to ".cvsignore .gitignore" in 'bootstrap.conf' if you want +# those files to be generated in directories like 'lib/', 'm4/', and 'po/', +# or set it to "auto" to make this script select what to use based +# on what version control system (if any) is used in the source directory. +# Or set it to "none" to ignore VCS ignore files entirely. Default is +# "auto". +vc_ignore= + + +## ------------------- ## +## External Libraries. ## +## ------------------- ## + # Source required external libraries: # Set a version string for this script. -scriptversion=2013-08-23.20; # UTC +scriptversion=2014-01-03.01; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 -# Copyright (C) 2004-2013 Free Software Foundation, Inc. +# Copyright (C) 2004-2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -94,47 +315,157 @@ nl=' ' IFS="$sp $nl" -# There are still modern systems that have problems with 'echo' mis- -# handling backslashes, among others, so make sure $bs_echo is set to a -# command that correctly interprets backslashes. -# (this code from Autoconf 2.68) - -# Printing a long string crashes Solaris 7 /usr/bin/printf. -bs_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -bs_echo=$bs_echo$bs_echo$bs_echo$bs_echo$bs_echo -bs_echo=$bs_echo$bs_echo$bs_echo$bs_echo$bs_echo$bs_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $bs_echo`" = "X$bs_echo") 2>/dev/null; then - bs_echo='print -r --' - bs_echo_n='print -rn --' -elif (test "X`printf %s $bs_echo`" = "X$bs_echo") 2>/dev/null; then - bs_echo='printf %s\n' - bs_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $bs_echo) 2>/dev/null`" = "X-n $bs_echo"; then - bs_echo_body='eval /usr/ucb/echo -n "$1$nl"' - bs_echo_n='/usr/ucb/echo -n' - else - bs_echo_body='eval expr "X$1" : "X\\(.*\\)"' - bs_echo_n_body='eval - arg=$1; - case $arg in #( - *"$nl"*) - expr "X$arg" : "X\\(.*\\)$nl"; - arg=`expr "X$arg" : ".*$nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$nl" - ' - export bs_echo_n_body - bs_echo_n='sh -c $bs_echo_n_body bs_echo' - fi - export bs_echo_body - bs_echo='sh -c $bs_echo_body bs_echo' +# There are apparently some retarded systems that use ';' as a PATH separator! +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } fi + +## ------------------------- ## +## Locate command utilities. ## +## ------------------------- ## + + +# func_executable_p FILE +# ---------------------- +# Check that FILE is an executable regular file. +func_executable_p () +{ + test -f "$1" && test -x "$1" +} + + +# func_path_progs PROGS_LIST CHECK_FUNC [PATH] +# -------------------------------------------- +# Search for either a program that responds to --version with output +# containing "GNU", or else returned by CHECK_FUNC otherwise, by +# trying all the directories in PATH with each of the elements of +# PROGS_LIST. +# +# CHECK_FUNC should accept the path to a candidate program, and +# set $func_check_prog_result if it truncates its output less than +# $_G_path_prog_max characters. +func_path_progs () +{ + _G_progs_list=$1 + _G_check_func=$2 + _G_PATH=${3-"$PATH"} + + _G_path_prog_max=0 + _G_path_prog_found=false + _G_save_IFS=$IFS; IFS=$PATH_SEPARATOR + for _G_dir in $_G_PATH; do + IFS=$_G_save_IFS + test -z "$_G_dir" && _G_dir=. + for _G_prog_name in $_G_progs_list; do + for _exeext in '' .EXE; do + _G_path_prog=$_G_dir/$_G_prog_name$_exeext + func_executable_p "$_G_path_prog" || continue + case `"$_G_path_prog" --version 2>&1` in + *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; + *) $_G_check_func $_G_path_prog + func_path_progs_result=$func_check_prog_result + ;; + esac + $_G_path_prog_found && break 3 + done + done + done + IFS=$_G_save_IFS + test -z "$func_path_progs_result" && { + echo "no acceptable sed could be found in \$PATH" >&2 + exit 1 + } +} + + +# We want to be able to use the functions in this file before configure +# has figured out where the best binaries are kept, which means we have +# to search for them ourselves - except when the results are already set +# where we skip the searches. + +# Unless the user overrides by setting SED, search the path for either GNU +# sed, or the sed that truncates its output the least. +test -z "$SED" && { + _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for _G_i in 1 2 3 4 5 6 7; do + _G_sed_script=$_G_sed_script$nl$_G_sed_script + done + echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed + _G_sed_script= + + func_check_prog_sed () + { + _G_path_prog=$1 + + _G_count=0 + printf 0123456789 >conftest.in + while : + do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo '' >> conftest.nl + "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test "$_G_count" -gt "$_G_path_prog_max"; then + # Best one so far, save it but keep looking for a better one + func_check_prog_result=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test 10 -lt "$_G_count" && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + } + + func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin + rm -f conftest.sed + SED=$func_path_progs_result +} + + +# Unless the user overrides by setting GREP, search the path for either GNU +# grep, or the grep that truncates its output the least. +test -z "$GREP" && { + func_check_prog_grep () + { + _G_path_prog=$1 + + _G_count=0 + _G_path_prog_max=0 + printf 0123456789 >conftest.in + while : + do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo 'GREP' >> conftest.nl + "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test "$_G_count" -gt "$_G_path_prog_max"; then + # Best one so far, save it but keep looking for a better one + func_check_prog_result=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test 10 -lt "$_G_count" && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + } + + func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin + GREP=$func_path_progs_result +} + + ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## @@ -145,16 +476,14 @@ fi # in the command search PATH. : ${CP="cp -f"} -: ${ECHO="$bs_echo"} -: ${EGREP="grep -E"} -: ${FGREP="grep -F"} -: ${GREP="grep"} +: ${ECHO="printf %s\n"} +: ${EGREP="$GREP -E"} +: ${FGREP="$GREP -F"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} -: ${SED="sed"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} @@ -245,13 +574,13 @@ exit_status=$EXIT_SUCCESS progpath=$0 # The name of this program. -progname=`$bs_echo "$progpath" |$SED "$sed_basename"` +progname=`$ECHO "$progpath" |$SED "$sed_basename"` # Make sure we have an absolute progpath for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) - progdir=`$bs_echo "$progpath" |$SED "$sed_dirname"` + progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` progdir=`cd "$progdir" && pwd` progpath=$progdir/$progname ;; @@ -445,7 +774,7 @@ func_append_uniq () { $debug_cmd - eval _G_current_value='`$bs_echo $'$1'`' + eval _G_current_value='`$ECHO $'$1'`' _G_delim=`expr "$2" : '\(.\)'` case $_G_delim$_G_current_value$_G_delim in @@ -558,7 +887,7 @@ func_echo () IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS - $bs_echo "$progname: $_G_line" + $ECHO "$progname: $_G_line" done IFS=$func_echo_IFS } @@ -592,17 +921,17 @@ func_echo_infix_1 () for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" do test -n "$_G_tc" && { - _G_esc_tc=`$bs_echo "$_G_tc" | sed "$sed_make_literal_regex"` - _G_indent=`$bs_echo "$_G_indent" | sed "s|$_G_esc_tc||g"` + _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` + _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` } done - _G_indent="$progname: "`echo "$_G_indent" | sed 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes + _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes func_echo_infix_1_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_infix_1_IFS - $bs_echo "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 + $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 _G_prefix=$_G_indent done IFS=$func_echo_infix_1_IFS @@ -1166,22 +1495,53 @@ func_warning () } +# func_sort_ver VER1 VER2 +# ----------------------- +# 'sort -V' is not generally available. +# Note this deviates from the version comparison in automake +# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a +# but this should suffice as we won't be specifying old +# version formats or redundant trailing .0 in bootstrap.conf. +# If we did want full compatibility then we should probably +# use m4_version_compare from autoconf. +func_sort_ver () +{ + $debug_cmd + + printf '%s\n%s\n' "$1" "$2" \ + | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n +} + +# func_lt_ver PREV CURR +# --------------------- +# Return true if PREV and CURR are in the correct order according to +# func_sort_ver, otherwise false. Use it like this: +# +# func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." +func_lt_ver () +{ + $debug_cmd + + test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` +} + + # Local variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: #! /bin/sh # Set a version string for this script. -scriptversion=2012-10-21.11; # UTC +scriptversion=2014-01-07.03; # UTC # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 -# Copyright (C) 2010-2013 Free Software Foundation, Inc. +# Copyright (C) 2010-2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -1321,7 +1681,7 @@ func_remove_hook () { $debug_cmd - eval ${1}_hooks='`$bs_echo "\$'$1'_hooks" |$SED "s| '$2'||"`' + eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' } @@ -1598,9 +1958,9 @@ func_validate_options () -## ------------------## +## ----------------- ## ## Helper functions. ## -## ------------------## +## ----------------- ## # This section contains the helper functions used by the rest of the # hookable option parser framework in ascii-betical order. @@ -1614,8 +1974,8 @@ func_fatal_help () { $debug_cmd - eval \$bs_echo \""Usage: $usage"\" - eval \$bs_echo \""$fatal_help"\" + eval \$ECHO \""Usage: $usage"\" + eval \$ECHO \""$fatal_help"\" func_error ${1+"$@"} exit $EXIT_FAILURE } @@ -1629,7 +1989,7 @@ func_help () $debug_cmd func_usage_message - $bs_echo "$long_help_message" + $ECHO "$long_help_message" exit 0 } @@ -1716,7 +2076,7 @@ func_usage () $debug_cmd func_usage_message - $bs_echo "Run '$progname --help |${PAGER-more}' for full usage" + $ECHO "Run '$progname --help |${PAGER-more}' for full usage" exit 0 } @@ -1728,7 +2088,7 @@ func_usage_message () { $debug_cmd - eval \$bs_echo \""Usage: $usage"\" + eval \$ECHO \""Usage: $usage"\" echo $SED -n 's|^# || /^Written by/{ @@ -1737,7 +2097,7 @@ func_usage_message () h /^Written by/q' < "$progpath" echo - eval \$bs_echo \""$usage_message"\" + eval \$ECHO \""$usage_message"\" } @@ -1749,7 +2109,7 @@ func_version () $debug_cmd printf '%s\n' "$progname $scriptversion" - $SED -n '/^##/q + $SED -n ' /(C)/!b go :more /\./!{ @@ -1777,7 +2137,7 @@ func_version () # Local variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: @@ -1786,7 +2146,7 @@ func_version () # Extract macro arguments from autotools input with GNU M4. # Written by Gary V. Vaughan, 2010 # -# Copyright (C) 2010-2013 Free Software Foundation, Inc. +# Copyright (C) 2010-2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -1795,7 +2155,7 @@ test -z "$progpath" && . `echo "$0" |${SED-sed} 's|[^/]*$||'`/funclib.sh test extract-trace = "$progname" && . `echo "$0" |${SED-sed} 's|[^/]*$||'`/options-parser # Set a version string. -scriptversion=2013-08-22.10; # UTC +scriptversion=2014-01-04.01; # UTC # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -1827,9 +2187,9 @@ scriptversion=2013-08-22.10; # UTC -## ------------------## +## ----------------- ## ## Helper functions. ## -## ------------------## +## ----------------- ## # This section contains the helper functions used by the rest of # 'extract-trace'. @@ -1851,7 +2211,7 @@ func_autoconf_configure () # If we were passed a genuine file, make sure it calls AC_INIT. test -f "$1" \ - && _G_ac_init=`$SED "$_G_sed_no_comment" "$1" |grep AC_INIT` + && _G_ac_init=`$SED "$_G_sed_no_comment" "$1" |$GREP AC_INIT` # Otherwise it is not a genuine Autoconf input file. test -n "$_G_ac_init" @@ -2025,8 +2385,8 @@ func_extract_trace () $require_configure_ac $require_gnu_m4 - _G_m4_traces=`$bs_echo "--trace=$1" |$SED 's%,% --trace=%g'` - _G_re_macros=`$bs_echo "($1)" |$SED 's%,%|%g'` + _G_m4_traces=`$ECHO "--trace=$1" |$SED 's%,% --trace=%g'` + _G_re_macros=`$ECHO "($1)" |$SED 's%,%|%g'` _G_macros="$1"; shift test $# -gt 0 || { set dummy $configure_ac @@ -2100,328 +2460,110 @@ func_extract_trace () IFS=$_G_save func_append _G_mini "AC_DEFUN([$_G_macro])$nl" done - IFS=$_G_save - - # We discard M4's stdout, but the M4 trace output from reading our - # "autoconf.mini" followed by any other files passed to this - # function is then scanned by sed to transform it into a colon - # delimited argument list assigned to a shell variable. - _G_transform='s|#.*$||; s|^dnl .*$||; s| dnl .*$||;' - - # Unfortunately, alternation in regexp addresses doesn't work in at - # least BSD (and hence Mac OS X) sed, so we have to append a capture - # and print block for each traced macro to the sed transform script. - _G_save=$IFS - IFS=, - for _G_macro in $_G_macros; do - IFS=$_G_save - func_append _G_transform ' - /^m4trace: -1- '"$_G_macro"'/ { - s|^m4trace: -1- '"$_G_macro"'[([]*|| - s|], [[]|:|g - s|[])]*$|:| - s|\(.\):$|\1| - p - }' - done - IFS=$_G_save - - # Save the command pipeline results for further use by callers of - # this function. - func_extract_trace_result=`$bs_echo "$_G_mini" \ - |$M4 -daq --prefix $_G_m4_traces - "$@" 2>&1 1>/dev/null \ - |$SED -n -e "$_G_transform"` -} - - -# func_extract_trace_first MACRO_NAMES [FILENAME]... -# -------------------------------------------------- -# Exactly like func_extract_trace, except that only the first argument -# to the first invocation of one of the comma separated MACRO_NAMES is -# returned in '$func_extract_trace_first_result'. -func_extract_trace_first () -{ - $debug_cmd - - func_extract_trace ${1+"$@"} - func_extract_trace_first_result=`$bs_echo "$func_extract_trace_result" \ - |$SED -e 's|:.*$||g' -e 1q` -} - - -# func_main [ARG]... -# ------------------ -func_main () -{ - $debug_cmd - - # Configuration. - usage='$progname MACRO_NAME FILE [...]' - - long_help_message=' -The first argument to this program is the name of an autotools macro -whose arguments you want to extract by examining the files listed in the -remaining arguments using the same tool that Autoconf and Automake use, -GNU M4. - -The arguments are returned separated by colons, with each traced call -on a separate line.' - - # Option processing. - func_options "$@" - eval set dummy "$func_options_result"; shift - - # Validate remaining non-option arguments. - test $# -gt 1 \ - || func_fatal_help "not enough arguments" - - # Pass non-option arguments to extraction function. - func_extract_trace "$@" - - # Display results. - test -n "$func_extract_trace_result" \ - && $bs_echo "$func_extract_trace_result" - - # The End. - exit $EXIT_SUCCESS -} - - -## --------------------------- ## -## Actually perform the trace. ## -## --------------------------- ## - -# Only call 'func_main' if this script was called directly. -test extract-trace = "$progname" && func_main "$@" - -# Local variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" -# time-stamp-time-zone: "UTC" -# End: - -# Set a version string for *this* script. -scriptversion=2013-09-15.06; # UTC - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# Originally written by Paul Eggert. The canonical version of this -# script is maintained as build-aux/bootstrap in gnulib, however, to -# be useful to your project, you should place a copy of it under -# version control in the top-level directory of your project. The -# intent is that all customization can be done with a bootstrap.conf -# file also maintained in your version control; gnulib comes with a -# template build-aux/bootstrap.conf to get you started. - -# Please report bugs or propose patches to bug-gnulib@gnu.org. - - -## ------ ## -## Usage. ## -## ------ ## - -# Most GNUish projects do not keep all of the generated Autotool -# files under version control, but running all of the right tools -# with the right arguments, in the correct order to regenerate -# all of those files in readiness for configuration and building -# can be surprisingly involved! Many projects have a 'bootstrap' -# script under version control to invoke Autotools and perform -# other assorted book-keeping with version numbers and the like. -# -# This bootstrap script aims to probe the configure.ac and top -# Makefile.am of your project to automatically determine what -# the correct ordering and arguments are and then run the tools for -# you. In order to use it, you can generate an initial standalone -# script with: -# -# gl/build-aux/inline-source gl/build-aux/bootstrap.in > bootstrap -# -# You should then store than script in version control for other -# developers in you project. It will give you instructions about -# how to keep it up to date if the sources change. -# -# See gl/doc/bootstrap.texi for documentation on how to write -# a bootstrap.conf to customize it for your project's -# idiosyncracies. - - -## ================================================================== ## -## ## -## DO NOT EDIT THIS FILE, CUSTOMIZE IT USING A BOOTSTRAP.CONF ## -## ## -## ================================================================== ## - -## ------------------------------- ## -## User overridable command paths. ## -## ------------------------------- ## - -# All uppercase denotes values stored in the environment. These -# variables should generally be overridden by the user - however, we do -# set them to 'true' in some parts of this script to prevent them being -# called at the wrong time by other tools that we call ('autoreconf', -# for example). -# -# We also allow 'LIBTOOLIZE', 'M4', 'SHA1SUM' and some others to be -# overridden, and export the result for child processes, but they are -# handled by the function 'func_find_tool' and not defaulted in this -# section. - -: ${ACLOCAL="aclocal"} -: ${AUTOCONF="autoconf"} -: ${AUTOHEADER="autoheader"} -: ${AUTOM4TE="autom4te"} -: ${AUTOHEADER="autoheader"} -: ${AUTOMAKE="automake"} -: ${AUTOPOINT="autopoint"} -: ${AUTORECONF="autoreconf"} -: ${CMP="cmp"} -: ${CONFIG_SHELL="/bin/sh"} -: ${DIFF="diff"} -: ${EGREP="grep -E"} -: ${FGREP="grep -F"} -: ${GIT="git"} -: ${GREP="grep"} -: ${LN_S="ln -s"} -: ${RM="rm"} -: ${SED="sed"} + IFS=$_G_save -export ACLOCAL -export AUTOCONF -export AUTOHEADER -export AUTOM4TE -export AUTOHEADER -export AUTOMAKE -export AUTOPOINT -export AUTORECONF -export CONFIG_SHELL + # We discard M4's stdout, but the M4 trace output from reading our + # "autoconf.mini" followed by any other files passed to this + # function is then scanned by sed to transform it into a colon + # delimited argument list assigned to a shell variable. + _G_transform='s|#.*$||; s|^dnl .*$||; s| dnl .*$||;' + # Unfortunately, alternation in regexp addresses doesn't work in at + # least BSD (and hence Mac OS X) sed, so we have to append a capture + # and print block for each traced macro to the sed transform script. + _G_save=$IFS + IFS=, + for _G_macro in $_G_macros; do + IFS=$_G_save + func_append _G_transform ' + /^m4trace: -1- '"$_G_macro"'/ { + s|^m4trace: -1- '"$_G_macro"'[([]*|| + s|], [[]|:|g + s|[])]*$|:| + s|\(.\):$|\1| + p + }' + done + IFS=$_G_save -## -------------- ## -## Configuration. ## -## -------------- ## + # Save the command pipeline results for further use by callers of + # this function. + func_extract_trace_result=`$ECHO "$_G_mini" \ + |$M4 -daq --prefix $_G_m4_traces - "$@" 2>&1 1>/dev/null \ + |$SED -n -e "$_G_transform"` +} -# A newline delimited list of triples of programs (that respond to -# --version), the minimum version numbers required (or just '-' in the -# version field if any version will be sufficient) and homepage URLs -# to help locate missing packages. -buildreq= -# Name of a file containing instructions on installing missing packages -# required in 'buildreq'. -buildreq_readme=README-hacking +# func_extract_trace_first MACRO_NAMES [FILENAME]... +# -------------------------------------------------- +# Exactly like func_extract_trace, except that only the first argument +# to the first invocation of one of the comma separated MACRO_NAMES is +# returned in '$func_extract_trace_first_result'. +func_extract_trace_first () +{ + $debug_cmd -# These are extracted from AC_INIT in configure.ac, though you can -# override those values in 'bootstrap.conf' if you prefer. -build_aux= -macro_dir= -package= -package_name= -package_version= -package_bugreport= + func_extract_trace ${1+"$@"} + func_extract_trace_first_result=`$ECHO "$func_extract_trace_result" \ + |$SED -e 's|:.*$||g' -e 1q` +} -# These are extracted from 'gnulib-cache.m4', or else fall-back -# automatically on the gnulib defaults; unless you set the values -# manually in 'bootstrap.conf'. -doc_base= -gnulib_mk= -gnulib_name= -local_gl_dir= -source_base= -tests_base= -# The list of gnulib modules required at 'gnulib-tool' time. If you -# check 'gnulib-cache.m4' into your repository, then this list will be -# extracted automatically. -gnulib_modules= +# func_main [ARG]... +# ------------------ +func_main () +{ + $debug_cmd -# Extra gnulib files that are not in modules, which override files of -# the same name installed by other bootstrap tools. -gnulib_non_module_files=" - build-aux/compile - build-aux/install-sh - build-aux/mdate-sh - build-aux/texinfo.tex - build-aux/depcomp - build-aux/config.guess - build-aux/config.sub - doc/INSTALL -" + # Configuration. + usage='$progname MACRO_NAME FILE [...]' -# Relative path to the local gnulib submodule, and url to the upstream -# git repository. If you have a gnulib entry in your .gitmodules file, -# these values are ignored. -gnulib_path= -gnulib_url= + long_help_message=' +The first argument to this program is the name of an autotools macro +whose arguments you want to extract by examining the files listed in the +remaining arguments using the same tool that Autoconf and Automake use, +GNU M4. -# Additional gnulib-tool options to use. -gnulib_tool_options=" - --no-changelog -" +The arguments are returned separated by colons, with each traced call +on a separate line.' -# bootstrap removes any macro-files that are not included by aclocal.m4, -# except for files listed in this variable that are always kept. -gnulib_precious=" - gnulib-tool.m4 -" + # Option processing. + func_options "$@" + eval set dummy "$func_options_result"; shift -# When truncating long commands for display, always allow at least this -# many characters before truncating. -min_cmd_len=160 + # Validate remaining non-option arguments. + test $# -gt 1 \ + || func_fatal_help "not enough arguments" -# The command to download all .po files for a specified domain into -# a specified directory. Fill in the first %s is the domain name, and -# the second with the destination directory. Use rsync's -L and -r -# options because the latest/%s directory and the .po files within are -# all symlinks. -po_download_command_format=\ -"rsync --delete --exclude '*.s1' -Lrtvz \ -'translationproject.org::tp/latest/%s/' '%s'" + # Pass non-option arguments to extraction function. + func_extract_trace "$@" -# Other locale categories that need message catalogs. -extra_locale_categories= + # Display results. + test -n "$func_extract_trace_result" \ + && $ECHO "$func_extract_trace_result" -# Additional xgettext options to use. Gnulib might provide you with an -# extensive list of additional options to append to this, but gettext -# 0.16.1 and newer appends them automaticaly, so you can safely ignore -# the complaints from 'gnulib-tool' if your $configure_ac states: -# -# AM_GNU_GETTEXT_VERSION([0.16.1]) -xgettext_options=" - --flag=_:1:pass-c-format - --flag=N_:1:pass-c-format -" + # The End. + exit $EXIT_SUCCESS +} -# Package copyright holder for gettext files. Defaults to FSF if unset. -copyright_holder= -# File that should exist in the top directory of a checked out hierarchy, -# but not in a distribution tarball. -checkout_only_file= +## --------------------------- ## +## Actually perform the trace. ## +## --------------------------- ## -# Whether to use copies instead of symlinks by default (if set to true, -# the --copy option has no effect). -copy=false +# Only call 'func_main' if this script was called directly. +test extract-trace = "$progname" && func_main "$@" -# Set this to ".cvsignore .gitignore" in 'bootstrap.conf' if you want -# those files to be generated in directories like 'lib/', 'm4/', and 'po/', -# or set it to "auto" to make this script select what to use based -# on what version control system (if any) is used in the source directory. -# Or set it to "none" to ignore VCS ignore files entirely. Default is -# "auto". -vc_ignore= +# Local variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-pattern: "20/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-time-zone: "UTC" +# End: + +# Set a version string for *this* script. +scriptversion=2014-11-04.13; # UTC ## ------------------- ## @@ -2505,6 +2647,10 @@ func_prep () $require_gnulib_merge_changelog + # Report the results of SED and GREP searches from funclib.sh. + func_verbose "GREP='$GREP'" + func_verbose "SED='$SED'" + # fetch update files from the translation project func_update_translations @@ -2541,13 +2687,21 @@ func_reconfigure () { $debug_cmd + $require_automake_options + + # Automake (without 'foreign' option) requires that README exists. + case " $automake_options " in + " foreign ") ;; + *) func_ensure_README ;; + esac + # Ensure ChangeLog presence. if test -n "$gnulib_modules"; then func_ifcontains "$gnulib_modules" gitlog-to-changelog \ func_ensure_changelog else $require_gnulib_cache - if sed -n '/^gl_MODULES(\[/,/^])$/p' $gnulib_cache 2>/dev/null | + if $SED -n '/^gl_MODULES(\[/,/^])$/p' $gnulib_cache 2>/dev/null | func_grep_q gitlog-to-changelog then func_ensure_changelog @@ -2555,7 +2709,7 @@ func_reconfigure () fi # Released 'autopoint' has the tendency to install macros that have - # been obsoleted in current 'gnulib., so run this before 'gnulib-tool'. + # been obsoleted in current 'gnulib', so run this before 'gnulib-tool'. func_autopoint # Autoreconf runs 'aclocal' before 'libtoolize', which causes spurious @@ -2867,12 +3021,44 @@ EOT } -# func_autoreconf -# --------------- +# func_ensure_README +# ------------------ +# Without AM_INIT_AUTOMAKE([foreign]), automake will not run to +# completion with no README file, even though README.md or README.txt +# is often preferable. +func_ensure_README () +{ + $debug_cmd + + test -f README || { + _G_README= + for _G_readme in README.txt README.md README.rst; do + test -f "$_G_readme" && break + done + + test -f "$_G_readme" && $LN_S $_G_readme README + func_verbose "$LN_S $_G_readme README" + } + + return 0 +} + + +# func_autoreconf [SUBDIR] +# ------------------------ # Being careful not to re-run 'autopoint' or 'libtoolize', and not to # try to run 'autopoint', 'libtoolize' or 'autoheader' on packages that # don't use them, defer to 'autoreconf' for execution of the remaining # autotools to bootstrap this package. +# +# Projects with multiple trees to reconfigure can hook another call to +# this function onto func_reconfigure: +# +# my_autoreconf_foo () +# { +# func_autoreconf foo +# } +# func_add_hook func_reconfigure my_autoreconf_foo func_autoreconf () { $debug_cmd @@ -2889,7 +3075,7 @@ func_autoreconf () $opt_copy || func_append _G_autoreconf_options " --symlink" $opt_force && func_append _G_autoreconf_options " --force" $opt_verbose && func_append _G_autoreconf_options " --verbose" - func_show_eval "$AUTORECONF$_G_autoreconf_options --install" 'exit $?' + func_show_eval "$AUTORECONF$_G_autoreconf_options --install${1+ $1}" 'exit $?' AUTOPOINT=$save_AUTOPOINT LIBTOOLIZE=$save_LIBTOOLIZE @@ -2964,7 +3150,7 @@ func_clean_unused_macros () # We use 'ls|grep' instead of 'ls *.m4' to avoid exceeding # command line length limits in some shells. - for file in `cd "$macro_dir" && ls -1 |grep '\.m4$'`; do + for file in `cd "$macro_dir" && ls -1 |$GREP '\.m4$'`; do # Remove a macro file when aclocal.m4 does not m4_include it... func_grep_q 'm4_include([[]'$macro_dir/$file'])' $aclocal_m4s \ @@ -3114,6 +3300,21 @@ func_require_autoheader () } +# require_automake_options +# ------------------------ +# Extract options from AM_AUTOMAKE_INIT. +require_automake_options=func_require_automake_options +func_require_automake_options () +{ + $debug_cmd + + func_extract_trace AM_INIT_AUTOMAKE + automake_options=$func_extract_trace_result + + require_automake_options=: +} + + # require_autopoint # ----------------- # Skip autopoint if it's not needed. @@ -3168,17 +3369,19 @@ Please add bootstrap to your gnulib_modules list in 'bootstrap.conf', so that I can tell you when there are updates available." else + rm -f bootstrap.new $build_aux/inline-source $build_aux/bootstrap.in > bootstrap.new if func_cmp_s "$progpath" bootstrap.new; then rm -f bootstrap.new func_verbose "bootstrap script up to date" else + chmod 555 bootstrap.new func_warning upgrade "\ An updated bootstrap script has been generated for you in 'bootstrap.new'. After you've verified that you want the changes, you can update with: - cat bootstrap.new > $progname + mv -f bootstrap.new $progname ./$progname Or you can disable this check permanently by adding the @@ -3282,7 +3485,7 @@ for tool in autoconf libtoolize autopoint; do '$tool' $_G_version http://www.gnu.org/s/'$b' " func_verbose \ - "auto-adding '\'$tool'-'$_G_version\'' to build requirements" + "auto-adding '\'$tool'-$_G_version'\'' to build requirements" } } @@ -3307,7 +3510,7 @@ func_require_buildreq_automake () # ...and AM_INIT_AUTOMAKE is declared... test -n "$func_extract_trace_result" && { - automake_version=`$bs_echo "$func_extract_trace_result" \ + automake_version=`$ECHO "$func_extract_trace_result" \ |$SED -e 's|[^0-9]*||' -e 's| .*$||'` test -n "$automake_version" || automake_version=- @@ -3343,7 +3546,7 @@ func_require_buildreq_patch () # The ugly find invocation is necessary to exit with non-zero # status for old find binaries that don't support -exec fully. if test ! -d "$local_gl_dir" \ - || find "$local_gl_dir" -name *.diff -exec false {} \; ; then : + || find "$local_gl_dir" -name "*.diff" -exec false {} \; ; then : else func_append buildreq 'patch - http://www.gnu.org/s/patch ' @@ -3495,8 +3698,8 @@ func_require_git () $opt_skip_git && GIT=true test true = "$GIT" || { - if test -f .gitignore && ($GIT --version) >/dev/null 2>&1; then :; else - GIT=true + if test -d .git/.; then + ($GIT --version) >/dev/null 2>&1 || GIT=true fi } @@ -3713,8 +3916,8 @@ func_require_gnulib_submodule () fi # Make sure we've checked out the correct revision of gnulib. - func_show_eval "$GIT submodule init" \ - && func_show_eval "$GIT submodule update" \ + func_show_eval "$GIT submodule init -- $gnulib_path" \ + && func_show_eval "$GIT submodule update -- $gnulib_path" \ || func_fatal_error "Unable to update gnulib submodule." fi @@ -3818,6 +4021,9 @@ func_require_libtoolize () func_find_tool LIBTOOLIZE libtoolize glibtoolize } + test -n "$LIBTOOLIZE" || func_fatal_error "\ +Please install GNU Libtool, or 'export LIBTOOLIZE=/path/to/libtoolize'." + func_verbose "export LIBTOOLIZE='$LIBTOOLIZE'" # Make sure the search result is visible to subshells @@ -3908,7 +4114,6 @@ func_require_macro_dir () # require_makefile_am # ------------------- # Ensure there is a 'Makefile.am' in the current directory. -# names an existing file. require_makefile_am=func_require_makefile_am func_require_makefile_am () { @@ -4056,6 +4261,9 @@ func_require_patch () func_find_tool PATCH gpatch patch } + test -n "$PATCH" || func_fatal_error "\ +Please install GNU Patch, or 'export PATCH=/path/to/gnu/patch'." + func_verbose "export PATCH='$PATCH'" # Make sure the search result is visible to subshells @@ -4113,9 +4321,9 @@ func_require_vc_ignore_files () } -## ------------------## +## ----------------- ## ## Helper functions. ## -## ------------------## +## ----------------- ## # This section contains the helper functions used by the rest of 'bootstrap'. @@ -4188,27 +4396,30 @@ func_grep_q () # func_ifcontains LIST MEMBER YES-CMD [NO-CMD] # -------------------------------------------- # If whitespace-separated LIST contains MEMBER then execute YES-CMD, -# otherwise if NO-CMD was give, execute that. +# otherwise if NO-CMD was given, execute that. func_ifcontains () { $debug_cmd - # The embedded echo is to squash whitespace before globbing. - _G_wslist=`$bs_echo " "$1" "` + _G_wslist=$1 _G_member=$2 _G_yes_cmd=$3 _G_no_cmd=${4-":"} - case $_G_wslist in - *" $_G_member "*) - eval "$_G_yes_cmd" - _G_status=$? - ;; - *) - eval "$_G_no_cmd" - _G_status=$? - ;; - esac + _G_found=false + for _G_item in $_G_wslist; do + test "x$_G_item" = "x$_G_member" && { + _G_found=: + break + } + done + if $_G_found; then + eval "$_G_yes_cmd" + _G_status=$? + else + eval "$_G_no_cmd" + _G_status=$? + fi test 0 -eq "$_G_status" || exit $_G_status } @@ -4222,7 +4433,7 @@ func_strpad () $debug_cmd _G_width=`expr "$2" - 1` - func_strpad_result=`$bs_echo "$1" |$SED ' + func_strpad_result=`$ECHO "$1" |$SED ' :a s|^.\{0,'"$_G_width"'\}$|&'"$3"'| ta @@ -4239,7 +4450,7 @@ func_strrpad () $debug_cmd _G_width=`expr "$2" - 1` - func_strrpad_result=`$bs_echo "$1" |$SED ' + func_strrpad_result=`$ECHO "$1" |$SED ' :a s|^.\{0,'"$_G_width"'\}$|'"$3"'&| ta @@ -4324,7 +4535,7 @@ func_strtable () # Strip off the indent, and make a divider with '-' chars, then # reindent. - _G_divider=`$bs_echo "$func_strrow_result" \ + _G_divider=`$ECHO "$func_strrow_result" \ |$SED 's|[^ ]|-|g :a s|- |--|g @@ -4451,7 +4662,7 @@ func_gitignore_entries () { $debug_cmd - sed -e '/^#/d' -e '/^$/d' "$@" + $SED -e '/^#/d' -e '/^$/d' "$@" } @@ -4481,62 +4692,15 @@ func_insert_if_absent () || func_verbose "inserting '$str' into '$file'" linesold=`func_gitignore_entries "$file" |wc -l` - linesnew=`{ $bs_echo "$str"; cat "$file"; } \ + linesnew=`{ $ECHO "$str"; cat "$file"; } \ |func_gitignore_entries |sort -u |wc -l` test "$linesold" -eq "$linesnew" \ - || { sed "1i\\$nl$str$nl" "$file" >"$file"T && mv "$file"T "$file"; } \ + || { $SED "1i\\$nl$str$nl" "$file" >"$file"T && mv "$file"T "$file"; } \ || func_permissions_error "$file" done } -# func_sort_ver VER1 VER2 -# ----------------------- -# 'sort -V' is not generally available. -# Note this deviates from the version comparison in automake -# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a -# but this should suffice as we won't be specifying old -# version formats or redundant trailing .0 in bootstrap.conf. -# If we did want full compatibility then we should probably -# use m4_version_compare from autoconf. -func_sort_ver () -{ - $debug_cmd - - ver1=$1 - ver2=$2 - - # Split on '.' and compare each component. - i=1 - while :; do - p1=`echo "$ver1" |cut -d. -f$i` - p2=`echo "$ver2" |cut -d. -f$i` - if test ! "$p1"; then - echo "$1 $2" - break - elif test ! "$p2"; then - echo "$2 $1" - break - elif test ! "$p1" = "$p2"; then - if test "$p1" -gt "$p2" 2>/dev/null; then # numeric comparison - echo "$2 $1" - elif test "$p2" -gt "$p1" 2>/dev/null; then # numeric comparison - echo "$1 $2" - else # numeric, then lexicographic comparison - lp=`printf "$p1\n$p2\n" |sort -n |tail -n1` - if test "$lp" = "$p2"; then - echo "$1 $2" - else - echo "$2 $1" - fi - fi - break - fi - i=`expr $i + 1` - done -} - - # func_get_version APP # -------------------- # echo the version number (if any) of APP, which is looked up along your @@ -4549,7 +4713,7 @@ func_get_version () # Rather than uncomment the sed script in-situ, strip the comments # programatically before passing the result to $SED for evaluation. - sed_get_version=`$bs_echo '# extract version within line + sed_get_version=`$ECHO '# extract version within line s|.*[v ]\{1,\}\([0-9]\{1,\}\.[.a-z0-9-]*\).*|\1| t done @@ -4591,7 +4755,7 @@ func_check_tool () ;; *) save_IFS=$IFS - IFS=: + IFS=${PATH_SEPARATOR-:} for _G_check_tool_path in $PATH; do IFS=$save_IFS if test -x "$_G_check_tool_path/$1"; then @@ -4647,9 +4811,6 @@ delimited list of triples; 'program min-version url'." else _G_instver=`func_get_version $_G_app` - test -z "$_G_instver" \ - || func_verbose "found '$_G_app' version $_G_instver." - # Fail if --version didn't work. if test -z "$_G_instver"; then func_error "Prerequisite '$_G_app' not found. Please install it, or @@ -4658,13 +4819,29 @@ delimited list of triples; 'program min-version url'." # Fail if a newer version than what we have is required. else - _G_newer=`func_sort_ver $_G_reqver $_G_instver |cut -d' ' -f2` - test "$_G_newer" != "$_G_instver" && { - func_error "\ + func_verbose "found '$_G_app' version $_G_instver." + + case $_G_reqver in + =*) + # If $buildreq version starts with '=', version must + # match the installed program exactly. + test "x$_G_reqver" = "x=$_G_instver" || { + func_error "\ + '$_G_app' version == $_G_instver is too old + 'exactly $_G_app-$_G_reqver is required" + func_check_versions_result=false + } + ;; + *) + # Otherwise, anything that is not older is a match. + func_lt_ver "$_G_reqver" "$_G_instver" || { + func_error "\ '$_G_app' version == $_G_instver is too old '$_G_app' version >= $_G_reqver is required" func_check_versions_result=false - } + } + ;; + esac fi fi done @@ -4724,6 +4901,9 @@ func_update_po_files () # Find sha1sum, named gsha1sum on MacPorts, and shasum on MacOS 10.6+. func_find_tool SHA1SUM sha1sum gsha1sum shasum sha1 + test -n "$SHA1SUM" || func_fatal_error "\ +Please install GNU Coreutils, or 'export SHA1SUM=/path/to/sha1sum'." + _G_langs=`cd $_G_ref_po_dir && echo *.po|$SED 's|\.po||g'` test '*' = "$_G_langs" && _G_langs=x for _G_po in $_G_langs; do @@ -4914,7 +5094,7 @@ exit ${exit_status-$EXIT_SUCCESS} # Local variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-pattern: "20/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-pattern: "500/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: diff --git a/build-aux/gl/build-aux/bootstrap.in b/build-aux/gl/build-aux/bootstrap.in index df3b6dbe..05025ffe 100755 --- a/build-aux/gl/build-aux/bootstrap.in +++ b/build-aux/gl/build-aux/bootstrap.in @@ -3,18 +3,10 @@ # Bootstrap an Autotooled package from checked-out sources. # Written by Gary V. Vaughan, 2010 -# Copyright (C) 2010-2013 Free Software Foundation, Inc. +# Copyright (C) 2010-2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# Source required external libraries: -. `echo "$0" |${SED-sed} 's|[^/]*$||'`"funclib.sh" -. `echo "$0" |${SED-sed} 's|[^/]*$||'`"options-parser" -. `echo "$0" |${SED-sed} 's|[^/]*$||'`"extract-trace" - -# Set a version string for *this* script. -scriptversion=2013-09-15.06; # UTC - # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -100,13 +92,9 @@ scriptversion=2013-09-15.06; # UTC : ${CMP="cmp"} : ${CONFIG_SHELL="/bin/sh"} : ${DIFF="diff"} -: ${EGREP="grep -E"} -: ${FGREP="grep -F"} : ${GIT="git"} -: ${GREP="grep"} : ${LN_S="ln -s"} : ${RM="rm"} -: ${SED="sed"} export ACLOCAL export AUTOCONF @@ -234,6 +222,19 @@ copy=false vc_ignore= +## ------------------- ## +## External Libraries. ## +## ------------------- ## + +# Source required external libraries: +. `echo "$0" |${SED-sed} 's|[^/]*$||'`"funclib.sh" +. `echo "$0" |${SED-sed} 's|[^/]*$||'`"options-parser" +. `echo "$0" |${SED-sed} 's|[^/]*$||'`"extract-trace" + +# Set a version string for *this* script. +scriptversion=2014-11-04.13; # UTC + + ## ------------------- ## ## Hookable functions. ## ## ------------------- ## @@ -315,6 +316,10 @@ func_prep () $require_gnulib_merge_changelog + # Report the results of SED and GREP searches from funclib.sh. + func_verbose "GREP='$GREP'" + func_verbose "SED='$SED'" + # fetch update files from the translation project func_update_translations @@ -351,13 +356,21 @@ func_reconfigure () { $debug_cmd + $require_automake_options + + # Automake (without 'foreign' option) requires that README exists. + case " $automake_options " in + " foreign ") ;; + *) func_ensure_README ;; + esac + # Ensure ChangeLog presence. if test -n "$gnulib_modules"; then func_ifcontains "$gnulib_modules" gitlog-to-changelog \ func_ensure_changelog else $require_gnulib_cache - if sed -n '/^gl_MODULES(\[/,/^])$/p' $gnulib_cache 2>/dev/null | + if $SED -n '/^gl_MODULES(\[/,/^])$/p' $gnulib_cache 2>/dev/null | func_grep_q gitlog-to-changelog then func_ensure_changelog @@ -365,7 +378,7 @@ func_reconfigure () fi # Released 'autopoint' has the tendency to install macros that have - # been obsoleted in current 'gnulib., so run this before 'gnulib-tool'. + # been obsoleted in current 'gnulib', so run this before 'gnulib-tool'. func_autopoint # Autoreconf runs 'aclocal' before 'libtoolize', which causes spurious @@ -677,12 +690,44 @@ EOT } -# func_autoreconf -# --------------- +# func_ensure_README +# ------------------ +# Without AM_INIT_AUTOMAKE([foreign]), automake will not run to +# completion with no README file, even though README.md or README.txt +# is often preferable. +func_ensure_README () +{ + $debug_cmd + + test -f README || { + _G_README= + for _G_readme in README.txt README.md README.rst; do + test -f "$_G_readme" && break + done + + test -f "$_G_readme" && $LN_S $_G_readme README + func_verbose "$LN_S $_G_readme README" + } + + return 0 +} + + +# func_autoreconf [SUBDIR] +# ------------------------ # Being careful not to re-run 'autopoint' or 'libtoolize', and not to # try to run 'autopoint', 'libtoolize' or 'autoheader' on packages that # don't use them, defer to 'autoreconf' for execution of the remaining # autotools to bootstrap this package. +# +# Projects with multiple trees to reconfigure can hook another call to +# this function onto func_reconfigure: +# +# my_autoreconf_foo () +# { +# func_autoreconf foo +# } +# func_add_hook func_reconfigure my_autoreconf_foo func_autoreconf () { $debug_cmd @@ -699,7 +744,7 @@ func_autoreconf () $opt_copy || func_append _G_autoreconf_options " --symlink" $opt_force && func_append _G_autoreconf_options " --force" $opt_verbose && func_append _G_autoreconf_options " --verbose" - func_show_eval "$AUTORECONF$_G_autoreconf_options --install" 'exit $?' + func_show_eval "$AUTORECONF$_G_autoreconf_options --install${1+ $1}" 'exit $?' AUTOPOINT=$save_AUTOPOINT LIBTOOLIZE=$save_LIBTOOLIZE @@ -774,7 +819,7 @@ func_clean_unused_macros () # We use 'ls|grep' instead of 'ls *.m4' to avoid exceeding # command line length limits in some shells. - for file in `cd "$macro_dir" && ls -1 |grep '\.m4$'`; do + for file in `cd "$macro_dir" && ls -1 |$GREP '\.m4$'`; do # Remove a macro file when aclocal.m4 does not m4_include it... func_grep_q 'm4_include([[]'$macro_dir/$file'])' $aclocal_m4s \ @@ -924,6 +969,21 @@ func_require_autoheader () } +# require_automake_options +# ------------------------ +# Extract options from AM_AUTOMAKE_INIT. +require_automake_options=func_require_automake_options +func_require_automake_options () +{ + $debug_cmd + + func_extract_trace AM_INIT_AUTOMAKE + automake_options=$func_extract_trace_result + + require_automake_options=: +} + + # require_autopoint # ----------------- # Skip autopoint if it's not needed. @@ -978,17 +1038,19 @@ Please add bootstrap to your gnulib_modules list in 'bootstrap.conf', so that I can tell you when there are updates available." else + rm -f bootstrap.new $build_aux/inline-source $build_aux/bootstrap.in > bootstrap.new if func_cmp_s "$progpath" bootstrap.new; then rm -f bootstrap.new func_verbose "bootstrap script up to date" else + chmod 555 bootstrap.new func_warning upgrade "\ An updated bootstrap script has been generated for you in 'bootstrap.new'. After you've verified that you want the changes, you can update with: - cat bootstrap.new > $progname + mv -f bootstrap.new $progname ./$progname Or you can disable this check permanently by adding the @@ -1092,7 +1154,7 @@ for tool in autoconf libtoolize autopoint; do '$tool' $_G_version http://www.gnu.org/s/'$b' " func_verbose \ - "auto-adding '\'$tool'-'$_G_version\'' to build requirements" + "auto-adding '\'$tool'-$_G_version'\'' to build requirements" } } @@ -1117,7 +1179,7 @@ func_require_buildreq_automake () # ...and AM_INIT_AUTOMAKE is declared... test -n "$func_extract_trace_result" && { - automake_version=`$bs_echo "$func_extract_trace_result" \ + automake_version=`$ECHO "$func_extract_trace_result" \ |$SED -e 's|[^0-9]*||' -e 's| .*$||'` test -n "$automake_version" || automake_version=- @@ -1153,7 +1215,7 @@ func_require_buildreq_patch () # The ugly find invocation is necessary to exit with non-zero # status for old find binaries that don't support -exec fully. if test ! -d "$local_gl_dir" \ - || find "$local_gl_dir" -name *.diff -exec false {} \; ; then : + || find "$local_gl_dir" -name "*.diff" -exec false {} \; ; then : else func_append buildreq 'patch - http://www.gnu.org/s/patch ' @@ -1305,8 +1367,8 @@ func_require_git () $opt_skip_git && GIT=true test true = "$GIT" || { - if test -f .gitignore && ($GIT --version) >/dev/null 2>&1; then :; else - GIT=true + if test -d .git/.; then + ($GIT --version) >/dev/null 2>&1 || GIT=true fi } @@ -1523,8 +1585,8 @@ func_require_gnulib_submodule () fi # Make sure we've checked out the correct revision of gnulib. - func_show_eval "$GIT submodule init" \ - && func_show_eval "$GIT submodule update" \ + func_show_eval "$GIT submodule init -- $gnulib_path" \ + && func_show_eval "$GIT submodule update -- $gnulib_path" \ || func_fatal_error "Unable to update gnulib submodule." fi @@ -1628,6 +1690,9 @@ func_require_libtoolize () func_find_tool LIBTOOLIZE libtoolize glibtoolize } + test -n "$LIBTOOLIZE" || func_fatal_error "\ +Please install GNU Libtool, or 'export LIBTOOLIZE=/path/to/libtoolize'." + func_verbose "export LIBTOOLIZE='$LIBTOOLIZE'" # Make sure the search result is visible to subshells @@ -1718,7 +1783,6 @@ func_require_macro_dir () # require_makefile_am # ------------------- # Ensure there is a 'Makefile.am' in the current directory. -# names an existing file. require_makefile_am=func_require_makefile_am func_require_makefile_am () { @@ -1866,6 +1930,9 @@ func_require_patch () func_find_tool PATCH gpatch patch } + test -n "$PATCH" || func_fatal_error "\ +Please install GNU Patch, or 'export PATCH=/path/to/gnu/patch'." + func_verbose "export PATCH='$PATCH'" # Make sure the search result is visible to subshells @@ -1923,9 +1990,9 @@ func_require_vc_ignore_files () } -## ------------------## +## ----------------- ## ## Helper functions. ## -## ------------------## +## ----------------- ## # This section contains the helper functions used by the rest of 'bootstrap'. @@ -1998,27 +2065,30 @@ func_grep_q () # func_ifcontains LIST MEMBER YES-CMD [NO-CMD] # -------------------------------------------- # If whitespace-separated LIST contains MEMBER then execute YES-CMD, -# otherwise if NO-CMD was give, execute that. +# otherwise if NO-CMD was given, execute that. func_ifcontains () { $debug_cmd - # The embedded echo is to squash whitespace before globbing. - _G_wslist=`$bs_echo " "$1" "` + _G_wslist=$1 _G_member=$2 _G_yes_cmd=$3 _G_no_cmd=${4-":"} - case $_G_wslist in - *" $_G_member "*) - eval "$_G_yes_cmd" - _G_status=$? - ;; - *) - eval "$_G_no_cmd" - _G_status=$? - ;; - esac + _G_found=false + for _G_item in $_G_wslist; do + test "x$_G_item" = "x$_G_member" && { + _G_found=: + break + } + done + if $_G_found; then + eval "$_G_yes_cmd" + _G_status=$? + else + eval "$_G_no_cmd" + _G_status=$? + fi test 0 -eq "$_G_status" || exit $_G_status } @@ -2032,7 +2102,7 @@ func_strpad () $debug_cmd _G_width=`expr "$2" - 1` - func_strpad_result=`$bs_echo "$1" |$SED ' + func_strpad_result=`$ECHO "$1" |$SED ' :a s|^.\{0,'"$_G_width"'\}$|&'"$3"'| ta @@ -2049,7 +2119,7 @@ func_strrpad () $debug_cmd _G_width=`expr "$2" - 1` - func_strrpad_result=`$bs_echo "$1" |$SED ' + func_strrpad_result=`$ECHO "$1" |$SED ' :a s|^.\{0,'"$_G_width"'\}$|'"$3"'&| ta @@ -2134,7 +2204,7 @@ func_strtable () # Strip off the indent, and make a divider with '-' chars, then # reindent. - _G_divider=`$bs_echo "$func_strrow_result" \ + _G_divider=`$ECHO "$func_strrow_result" \ |$SED 's|[^ ]|-|g :a s|- |--|g @@ -2261,7 +2331,7 @@ func_gitignore_entries () { $debug_cmd - sed -e '/^#/d' -e '/^$/d' "$@" + $SED -e '/^#/d' -e '/^$/d' "$@" } @@ -2291,62 +2361,15 @@ func_insert_if_absent () || func_verbose "inserting '$str' into '$file'" linesold=`func_gitignore_entries "$file" |wc -l` - linesnew=`{ $bs_echo "$str"; cat "$file"; } \ + linesnew=`{ $ECHO "$str"; cat "$file"; } \ |func_gitignore_entries |sort -u |wc -l` test "$linesold" -eq "$linesnew" \ - || { sed "1i\\$nl$str$nl" "$file" >"$file"T && mv "$file"T "$file"; } \ + || { $SED "1i\\$nl$str$nl" "$file" >"$file"T && mv "$file"T "$file"; } \ || func_permissions_error "$file" done } -# func_sort_ver VER1 VER2 -# ----------------------- -# 'sort -V' is not generally available. -# Note this deviates from the version comparison in automake -# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a -# but this should suffice as we won't be specifying old -# version formats or redundant trailing .0 in bootstrap.conf. -# If we did want full compatibility then we should probably -# use m4_version_compare from autoconf. -func_sort_ver () -{ - $debug_cmd - - ver1=$1 - ver2=$2 - - # Split on '.' and compare each component. - i=1 - while :; do - p1=`echo "$ver1" |cut -d. -f$i` - p2=`echo "$ver2" |cut -d. -f$i` - if test ! "$p1"; then - echo "$1 $2" - break - elif test ! "$p2"; then - echo "$2 $1" - break - elif test ! "$p1" = "$p2"; then - if test "$p1" -gt "$p2" 2>/dev/null; then # numeric comparison - echo "$2 $1" - elif test "$p2" -gt "$p1" 2>/dev/null; then # numeric comparison - echo "$1 $2" - else # numeric, then lexicographic comparison - lp=`printf "$p1\n$p2\n" |sort -n |tail -n1` - if test "$lp" = "$p2"; then - echo "$1 $2" - else - echo "$2 $1" - fi - fi - break - fi - i=`expr $i + 1` - done -} - - # func_get_version APP # -------------------- # echo the version number (if any) of APP, which is looked up along your @@ -2359,7 +2382,7 @@ func_get_version () # Rather than uncomment the sed script in-situ, strip the comments # programatically before passing the result to $SED for evaluation. - sed_get_version=`$bs_echo '# extract version within line + sed_get_version=`$ECHO '# extract version within line s|.*[v ]\{1,\}\([0-9]\{1,\}\.[.a-z0-9-]*\).*|\1| t done @@ -2401,7 +2424,7 @@ func_check_tool () ;; *) save_IFS=$IFS - IFS=: + IFS=${PATH_SEPARATOR-:} for _G_check_tool_path in $PATH; do IFS=$save_IFS if test -x "$_G_check_tool_path/$1"; then @@ -2457,9 +2480,6 @@ delimited list of triples; 'program min-version url'." else _G_instver=`func_get_version $_G_app` - test -z "$_G_instver" \ - || func_verbose "found '$_G_app' version $_G_instver." - # Fail if --version didn't work. if test -z "$_G_instver"; then func_error "Prerequisite '$_G_app' not found. Please install it, or @@ -2468,13 +2488,29 @@ delimited list of triples; 'program min-version url'." # Fail if a newer version than what we have is required. else - _G_newer=`func_sort_ver $_G_reqver $_G_instver |cut -d' ' -f2` - test "$_G_newer" != "$_G_instver" && { - func_error "\ + func_verbose "found '$_G_app' version $_G_instver." + + case $_G_reqver in + =*) + # If $buildreq version starts with '=', version must + # match the installed program exactly. + test "x$_G_reqver" = "x=$_G_instver" || { + func_error "\ + '$_G_app' version == $_G_instver is too old + 'exactly $_G_app-$_G_reqver is required" + func_check_versions_result=false + } + ;; + *) + # Otherwise, anything that is not older is a match. + func_lt_ver "$_G_reqver" "$_G_instver" || { + func_error "\ '$_G_app' version == $_G_instver is too old '$_G_app' version >= $_G_reqver is required" func_check_versions_result=false - } + } + ;; + esac fi fi done @@ -2534,6 +2570,9 @@ func_update_po_files () # Find sha1sum, named gsha1sum on MacPorts, and shasum on MacOS 10.6+. func_find_tool SHA1SUM sha1sum gsha1sum shasum sha1 + test -n "$SHA1SUM" || func_fatal_error "\ +Please install GNU Coreutils, or 'export SHA1SUM=/path/to/sha1sum'." + _G_langs=`cd $_G_ref_po_dir && echo *.po|$SED 's|\.po||g'` test '*' = "$_G_langs" && _G_langs=x for _G_po in $_G_langs; do @@ -2724,7 +2763,7 @@ exit ${exit_status-$EXIT_SUCCESS} # Local variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-pattern: "20/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-pattern: "500/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: diff --git a/build-aux/gl/build-aux/extract-trace b/build-aux/gl/build-aux/extract-trace index 5e42ea78..41a7b8b0 100755 --- a/build-aux/gl/build-aux/extract-trace +++ b/build-aux/gl/build-aux/extract-trace @@ -3,7 +3,7 @@ # Extract macro arguments from autotools input with GNU M4. # Written by Gary V. Vaughan, 2010 # -# Copyright (C) 2010-2013 Free Software Foundation, Inc. +# Copyright (C) 2010-2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -12,7 +12,7 @@ test -z "$progpath" && . `echo "$0" |${SED-sed} 's|[^/]*$||'`/funclib.sh test extract-trace = "$progname" && . `echo "$0" |${SED-sed} 's|[^/]*$||'`/options-parser # Set a version string. -scriptversion=2013-08-22.10; # UTC +scriptversion=2014-01-04.01; # UTC # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -44,9 +44,9 @@ scriptversion=2013-08-22.10; # UTC -## ------------------## +## ----------------- ## ## Helper functions. ## -## ------------------## +## ----------------- ## # This section contains the helper functions used by the rest of # 'extract-trace'. @@ -68,7 +68,7 @@ func_autoconf_configure () # If we were passed a genuine file, make sure it calls AC_INIT. test -f "$1" \ - && _G_ac_init=`$SED "$_G_sed_no_comment" "$1" |grep AC_INIT` + && _G_ac_init=`$SED "$_G_sed_no_comment" "$1" |$GREP AC_INIT` # Otherwise it is not a genuine Autoconf input file. test -n "$_G_ac_init" @@ -242,8 +242,8 @@ func_extract_trace () $require_configure_ac $require_gnu_m4 - _G_m4_traces=`$bs_echo "--trace=$1" |$SED 's%,% --trace=%g'` - _G_re_macros=`$bs_echo "($1)" |$SED 's%,%|%g'` + _G_m4_traces=`$ECHO "--trace=$1" |$SED 's%,% --trace=%g'` + _G_re_macros=`$ECHO "($1)" |$SED 's%,%|%g'` _G_macros="$1"; shift test $# -gt 0 || { set dummy $configure_ac @@ -345,7 +345,7 @@ func_extract_trace () # Save the command pipeline results for further use by callers of # this function. - func_extract_trace_result=`$bs_echo "$_G_mini" \ + func_extract_trace_result=`$ECHO "$_G_mini" \ |$M4 -daq --prefix $_G_m4_traces - "$@" 2>&1 1>/dev/null \ |$SED -n -e "$_G_transform"` } @@ -361,7 +361,7 @@ func_extract_trace_first () $debug_cmd func_extract_trace ${1+"$@"} - func_extract_trace_first_result=`$bs_echo "$func_extract_trace_result" \ + func_extract_trace_first_result=`$ECHO "$func_extract_trace_result" \ |$SED -e 's|:.*$||g' -e 1q` } @@ -397,7 +397,7 @@ on a separate line.' # Display results. test -n "$func_extract_trace_result" \ - && $bs_echo "$func_extract_trace_result" + && $ECHO "$func_extract_trace_result" # The End. exit $EXIT_SUCCESS @@ -414,7 +414,7 @@ test extract-trace = "$progname" && func_main "$@" # Local variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-pattern: "20/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: diff --git a/build-aux/gl/build-aux/funclib.sh b/build-aux/gl/build-aux/funclib.sh index fbaa8d0f..9cb02ff6 100644 --- a/build-aux/gl/build-aux/funclib.sh +++ b/build-aux/gl/build-aux/funclib.sh @@ -1,10 +1,10 @@ # Set a version string for this script. -scriptversion=2013-08-23.20; # UTC +scriptversion=2014-01-03.01; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 -# Copyright (C) 2004-2013 Free Software Foundation, Inc. +# Copyright (C) 2004-2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -84,47 +84,157 @@ nl=' ' IFS="$sp $nl" -# There are still modern systems that have problems with 'echo' mis- -# handling backslashes, among others, so make sure $bs_echo is set to a -# command that correctly interprets backslashes. -# (this code from Autoconf 2.68) - -# Printing a long string crashes Solaris 7 /usr/bin/printf. -bs_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -bs_echo=$bs_echo$bs_echo$bs_echo$bs_echo$bs_echo -bs_echo=$bs_echo$bs_echo$bs_echo$bs_echo$bs_echo$bs_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $bs_echo`" = "X$bs_echo") 2>/dev/null; then - bs_echo='print -r --' - bs_echo_n='print -rn --' -elif (test "X`printf %s $bs_echo`" = "X$bs_echo") 2>/dev/null; then - bs_echo='printf %s\n' - bs_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $bs_echo) 2>/dev/null`" = "X-n $bs_echo"; then - bs_echo_body='eval /usr/ucb/echo -n "$1$nl"' - bs_echo_n='/usr/ucb/echo -n' - else - bs_echo_body='eval expr "X$1" : "X\\(.*\\)"' - bs_echo_n_body='eval - arg=$1; - case $arg in #( - *"$nl"*) - expr "X$arg" : "X\\(.*\\)$nl"; - arg=`expr "X$arg" : ".*$nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$nl" - ' - export bs_echo_n_body - bs_echo_n='sh -c $bs_echo_n_body bs_echo' - fi - export bs_echo_body - bs_echo='sh -c $bs_echo_body bs_echo' +# There are apparently some retarded systems that use ';' as a PATH separator! +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } fi + +## ------------------------- ## +## Locate command utilities. ## +## ------------------------- ## + + +# func_executable_p FILE +# ---------------------- +# Check that FILE is an executable regular file. +func_executable_p () +{ + test -f "$1" && test -x "$1" +} + + +# func_path_progs PROGS_LIST CHECK_FUNC [PATH] +# -------------------------------------------- +# Search for either a program that responds to --version with output +# containing "GNU", or else returned by CHECK_FUNC otherwise, by +# trying all the directories in PATH with each of the elements of +# PROGS_LIST. +# +# CHECK_FUNC should accept the path to a candidate program, and +# set $func_check_prog_result if it truncates its output less than +# $_G_path_prog_max characters. +func_path_progs () +{ + _G_progs_list=$1 + _G_check_func=$2 + _G_PATH=${3-"$PATH"} + + _G_path_prog_max=0 + _G_path_prog_found=false + _G_save_IFS=$IFS; IFS=$PATH_SEPARATOR + for _G_dir in $_G_PATH; do + IFS=$_G_save_IFS + test -z "$_G_dir" && _G_dir=. + for _G_prog_name in $_G_progs_list; do + for _exeext in '' .EXE; do + _G_path_prog=$_G_dir/$_G_prog_name$_exeext + func_executable_p "$_G_path_prog" || continue + case `"$_G_path_prog" --version 2>&1` in + *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; + *) $_G_check_func $_G_path_prog + func_path_progs_result=$func_check_prog_result + ;; + esac + $_G_path_prog_found && break 3 + done + done + done + IFS=$_G_save_IFS + test -z "$func_path_progs_result" && { + echo "no acceptable sed could be found in \$PATH" >&2 + exit 1 + } +} + + +# We want to be able to use the functions in this file before configure +# has figured out where the best binaries are kept, which means we have +# to search for them ourselves - except when the results are already set +# where we skip the searches. + +# Unless the user overrides by setting SED, search the path for either GNU +# sed, or the sed that truncates its output the least. +test -z "$SED" && { + _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for _G_i in 1 2 3 4 5 6 7; do + _G_sed_script=$_G_sed_script$nl$_G_sed_script + done + echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed + _G_sed_script= + + func_check_prog_sed () + { + _G_path_prog=$1 + + _G_count=0 + printf 0123456789 >conftest.in + while : + do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo '' >> conftest.nl + "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test "$_G_count" -gt "$_G_path_prog_max"; then + # Best one so far, save it but keep looking for a better one + func_check_prog_result=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test 10 -lt "$_G_count" && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + } + + func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin + rm -f conftest.sed + SED=$func_path_progs_result +} + + +# Unless the user overrides by setting GREP, search the path for either GNU +# grep, or the grep that truncates its output the least. +test -z "$GREP" && { + func_check_prog_grep () + { + _G_path_prog=$1 + + _G_count=0 + _G_path_prog_max=0 + printf 0123456789 >conftest.in + while : + do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo 'GREP' >> conftest.nl + "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test "$_G_count" -gt "$_G_path_prog_max"; then + # Best one so far, save it but keep looking for a better one + func_check_prog_result=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test 10 -lt "$_G_count" && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + } + + func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin + GREP=$func_path_progs_result +} + + ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## @@ -135,16 +245,14 @@ fi # in the command search PATH. : ${CP="cp -f"} -: ${ECHO="$bs_echo"} -: ${EGREP="grep -E"} -: ${FGREP="grep -F"} -: ${GREP="grep"} +: ${ECHO="printf %s\n"} +: ${EGREP="$GREP -E"} +: ${FGREP="$GREP -F"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} -: ${SED="sed"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} @@ -235,13 +343,13 @@ exit_status=$EXIT_SUCCESS progpath=$0 # The name of this program. -progname=`$bs_echo "$progpath" |$SED "$sed_basename"` +progname=`$ECHO "$progpath" |$SED "$sed_basename"` # Make sure we have an absolute progpath for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) - progdir=`$bs_echo "$progpath" |$SED "$sed_dirname"` + progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` progdir=`cd "$progdir" && pwd` progpath=$progdir/$progname ;; @@ -435,7 +543,7 @@ func_append_uniq () { $debug_cmd - eval _G_current_value='`$bs_echo $'$1'`' + eval _G_current_value='`$ECHO $'$1'`' _G_delim=`expr "$2" : '\(.\)'` case $_G_delim$_G_current_value$_G_delim in @@ -548,7 +656,7 @@ func_echo () IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS - $bs_echo "$progname: $_G_line" + $ECHO "$progname: $_G_line" done IFS=$func_echo_IFS } @@ -582,17 +690,17 @@ func_echo_infix_1 () for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" do test -n "$_G_tc" && { - _G_esc_tc=`$bs_echo "$_G_tc" | sed "$sed_make_literal_regex"` - _G_indent=`$bs_echo "$_G_indent" | sed "s|$_G_esc_tc||g"` + _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` + _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` } done - _G_indent="$progname: "`echo "$_G_indent" | sed 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes + _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes func_echo_infix_1_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_infix_1_IFS - $bs_echo "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 + $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 _G_prefix=$_G_indent done IFS=$func_echo_infix_1_IFS @@ -1156,10 +1264,41 @@ func_warning () } +# func_sort_ver VER1 VER2 +# ----------------------- +# 'sort -V' is not generally available. +# Note this deviates from the version comparison in automake +# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a +# but this should suffice as we won't be specifying old +# version formats or redundant trailing .0 in bootstrap.conf. +# If we did want full compatibility then we should probably +# use m4_version_compare from autoconf. +func_sort_ver () +{ + $debug_cmd + + printf '%s\n%s\n' "$1" "$2" \ + | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n +} + +# func_lt_ver PREV CURR +# --------------------- +# Return true if PREV and CURR are in the correct order according to +# func_sort_ver, otherwise false. Use it like this: +# +# func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." +func_lt_ver () +{ + $debug_cmd + + test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` +} + + # Local variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: diff --git a/build-aux/gl/build-aux/inline-source b/build-aux/gl/build-aux/inline-source index 4bd26b10..fede037c 100755 --- a/build-aux/gl/build-aux/inline-source +++ b/build-aux/gl/build-aux/inline-source @@ -3,7 +3,7 @@ # Output the contents of a shell script with sourced files inlined. # Written by Gary V. Vaughan, 2012 -# Copyright (C) 2012-2013 Free Software Foundation, Inc. +# Copyright (C) 2012-2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -12,7 +12,7 @@ . `echo "$0" |${SED-sed} 's|[^/]*$||'`"options-parser" # Set a version string for *this* script. -scriptversion=2012-10-11.10; # UTC +scriptversion=2014-01-03.01; # UTC # This program is free software: you can redistribute it and/or modify @@ -124,16 +124,26 @@ func_include () test -n "$_G_scriptdir" || _G_scriptdir="./" $AWK ' + BEGIN { magic = '${_RECURSE_MAGIC-0}'; } + + /^#!/ && magic == 0 { + print $0; + print "## DO NOT EDIT - This file generated from '$1'"; + print "## by '$progname' v'$scriptversion'"; + magic++; + next; + } + /^\. ['\''"].*['\''"]$/ { file = substr ($2, 2, length ($2) -2); - system (sprintf ("'$progpath' %s", file)); + system (sprintf ("env _RECURSE_MAGIC=%d '$progpath' %s", magic, file)); next; } /^\. `echo [^`]*`['\''"][^'\''"]*['\''"]$/ { tail = substr ($0, match ($0, /`['\''"]/)); file = substr (tail, 3, length (tail) -3); - system (sprintf ("'$progpath' '"$_G_scriptdir"'%s", file)); + system (sprintf ("env _RECURSE_MAGIC=%d '$progpath' '"$_G_scriptdir"'%s", magic, file)); next; } @@ -148,7 +158,7 @@ exit 0 # Local variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-pattern: "20/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: diff --git a/build-aux/gl/build-aux/options-parser b/build-aux/gl/build-aux/options-parser index 13cd39b0..41302a8a 100644 --- a/build-aux/gl/build-aux/options-parser +++ b/build-aux/gl/build-aux/options-parser @@ -1,12 +1,12 @@ #! /bin/sh # Set a version string for this script. -scriptversion=2012-10-21.11; # UTC +scriptversion=2014-01-07.03; # UTC # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 -# Copyright (C) 2010-2013 Free Software Foundation, Inc. +# Copyright (C) 2010-2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -146,7 +146,7 @@ func_remove_hook () { $debug_cmd - eval ${1}_hooks='`$bs_echo "\$'$1'_hooks" |$SED "s| '$2'||"`' + eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' } @@ -423,9 +423,9 @@ func_validate_options () -## ------------------## +## ----------------- ## ## Helper functions. ## -## ------------------## +## ----------------- ## # This section contains the helper functions used by the rest of the # hookable option parser framework in ascii-betical order. @@ -439,8 +439,8 @@ func_fatal_help () { $debug_cmd - eval \$bs_echo \""Usage: $usage"\" - eval \$bs_echo \""$fatal_help"\" + eval \$ECHO \""Usage: $usage"\" + eval \$ECHO \""$fatal_help"\" func_error ${1+"$@"} exit $EXIT_FAILURE } @@ -454,7 +454,7 @@ func_help () $debug_cmd func_usage_message - $bs_echo "$long_help_message" + $ECHO "$long_help_message" exit 0 } @@ -541,7 +541,7 @@ func_usage () $debug_cmd func_usage_message - $bs_echo "Run '$progname --help |${PAGER-more}' for full usage" + $ECHO "Run '$progname --help |${PAGER-more}' for full usage" exit 0 } @@ -553,7 +553,7 @@ func_usage_message () { $debug_cmd - eval \$bs_echo \""Usage: $usage"\" + eval \$ECHO \""Usage: $usage"\" echo $SED -n 's|^# || /^Written by/{ @@ -562,7 +562,7 @@ func_usage_message () h /^Written by/q' < "$progpath" echo - eval \$bs_echo \""$usage_message"\" + eval \$ECHO \""$usage_message"\" } @@ -574,7 +574,7 @@ func_version () $debug_cmd printf '%s\n' "$progname $scriptversion" - $SED -n '/^##/q + $SED -n ' /(C)/!b go :more /\./!{ @@ -602,7 +602,7 @@ func_version () # Local variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: -- cgit v1.2.1