8e15ce
#! /bin/sh
8e15ce
# Print a version string.
8e15ce
scriptversion=2019-01-04.17; # UTC
8e15ce
8e15ce
# Bootstrap this package from checked-out sources.
8e15ce
8e15ce
# Copyright (C) 2003-2019 Free Software Foundation, Inc.
8e15ce
8e15ce
# This program is free software: you can redistribute it and/or modify
8e15ce
# it under the terms of the GNU General Public License as published by
8e15ce
# the Free Software Foundation, either version 3 of the License, or
8e15ce
# (at your option) any later version.
8e15ce
8e15ce
# This program is distributed in the hope that it will be useful,
8e15ce
# but WITHOUT ANY WARRANTY; without even the implied warranty of
8e15ce
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
8e15ce
# GNU General Public License for more details.
8e15ce
8e15ce
# You should have received a copy of the GNU General Public License
8e15ce
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
8e15ce
8e15ce
# Originally written by Paul Eggert.  The canonical version of this
8e15ce
# script is maintained as build-aux/bootstrap in gnulib, however, to
8e15ce
# be useful to your project, you should place a copy of it under
8e15ce
# version control in the top-level directory of your project.  The
8e15ce
# intent is that all customization can be done with a bootstrap.conf
8e15ce
# file also maintained in your version control; gnulib comes with a
8e15ce
# template build-aux/bootstrap.conf to get you started.
8e15ce
8e15ce
# Please report bugs or propose patches to bug-gnulib@gnu.org.
8e15ce
8e15ce
nl='
8e15ce
'
8e15ce
8e15ce
# Ensure file names are sorted consistently across platforms.
8e15ce
LC_ALL=C
8e15ce
export LC_ALL
8e15ce
8e15ce
# Ensure that CDPATH is not set.  Otherwise, the output from cd
8e15ce
# would cause trouble in at least one use below.
8e15ce
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
8e15ce
8e15ce
local_gl_dir=gl
8e15ce
8e15ce
# Honor $PERL, but work even if there is none.
8e15ce
PERL="${PERL-perl}"
8e15ce
8e15ce
me=$0
8e15ce
8e15ce
default_gnulib_url=git://git.sv.gnu.org/gnulib
8e15ce
8e15ce
usage() {
8e15ce
  cat <
8e15ce
Usage: $me [OPTION]...
8e15ce
Bootstrap this package from the checked-out sources.
8e15ce
8e15ce
Options:
8e15ce
 --gnulib-srcdir=DIRNAME  specify the local directory where gnulib
8e15ce
                          sources reside.  Use this if you already
8e15ce
                          have gnulib sources on your machine, and
8e15ce
                          do not want to waste your bandwidth downloading
8e15ce
                          them again.  Defaults to \$GNULIB_SRCDIR
8e15ce
 --bootstrap-sync         if this bootstrap script is not identical to
8e15ce
                          the version in the local gnulib sources,
8e15ce
                          update this script, and then restart it with
8e15ce
                          /bin/sh or the shell \$CONFIG_SHELL
8e15ce
 --no-bootstrap-sync      do not check whether bootstrap is out of sync
8e15ce
 --copy                   copy files instead of creating symbolic links
8e15ce
 --force                  attempt to bootstrap even if the sources seem
8e15ce
                          not to have been checked out
8e15ce
 --no-git                 do not use git to update gnulib.  Requires that
8e15ce
                          --gnulib-srcdir point to a correct gnulib snapshot
8e15ce
 --skip-po                do not download po files
8e15ce
8e15ce
If the file $me.conf exists in the same directory as this script, its
8e15ce
contents are read as shell variables to configure the bootstrap.
8e15ce
8e15ce
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
8e15ce
are honored.
8e15ce
8e15ce
Gnulib sources can be fetched in various ways:
8e15ce
8e15ce
 * If this package is in a git repository with a 'gnulib' submodule
8e15ce
   configured, then that submodule is initialized and updated and sources
8e15ce
   are fetched from there.  If \$GNULIB_SRCDIR is set (directly or via
8e15ce
   --gnulib-srcdir) and is a git repository, then it is used as a reference.
8e15ce
8e15ce
 * Otherwise, if \$GNULIB_SRCDIR is set (directly or via --gnulib-srcdir),
8e15ce
   then sources are fetched from that local directory.  If it is a git
8e15ce
   repository and \$GNULIB_REVISION is set, then that revision is checked
8e15ce
   out.
8e15ce
8e15ce
 * Otherwise, if this package is in a git repository with a 'gnulib'
8e15ce
   submodule configured, then that submodule is initialized and updated and
8e15ce
   sources are fetched from there.
8e15ce
8e15ce
 * Otherwise, if the 'gnulib' directory does not exist, Gnulib sources are
8e15ce
   cloned into that directory using git from \$GNULIB_URL, defaulting to
8e15ce
   $default_gnulib_url.
8e15ce
   If \$GNULIB_REVISION is set, then that revision is checked out.
8e15ce
8e15ce
 * Otherwise, the existing Gnulib sources in the 'gnulib' directory are
8e15ce
   used.  If it is a git repository and \$GNULIB_REVISION is set, then that
8e15ce
   revision is checked out.
8e15ce
8e15ce
If you maintain a package and want to pin a particular revision of the
8e15ce
Gnulib sources that has been tested with your package, then there are two
8e15ce
possible approaches: either configure a 'gnulib' submodule with the
8e15ce
appropriate revision, or set \$GNULIB_REVISION (and if necessary
8e15ce
\$GNULIB_URL) in $me.conf.
8e15ce
8e15ce
Running without arguments will suffice in most cases.
8e15ce
EOF
8e15ce
}
8e15ce
8e15ce
# warnf_ FORMAT-STRING ARG1...
8e15ce
warnf_ ()
8e15ce
{
8e15ce
  warnf_format_=$1
8e15ce
  shift
8e15ce
  nl='
8e15ce
'
8e15ce
  case $* in
8e15ce
    *$nl*) me_=$(printf "$me"|tr "$nl|" '??')
8e15ce
       printf "$warnf_format_" "$@" | sed "s|^|$me_: |" ;;
8e15ce
    *) printf "$me: $warnf_format_" "$@" ;;
8e15ce
  esac >&2
8e15ce
}
8e15ce
8e15ce
# warn_ WORD1...
8e15ce
warn_ ()
8e15ce
{
8e15ce
  # If IFS does not start with ' ', set it and emit the warning in a subshell.
8e15ce
  case $IFS in
8e15ce
    ' '*) warnf_ '%s\n' "$*";;
8e15ce
    *)    (IFS=' '; warn_ "$@");;
8e15ce
  esac
8e15ce
}
8e15ce
8e15ce
# die WORD1...
8e15ce
die() { warn_ "$@"; exit 1; }
8e15ce
8e15ce
# Configuration.
8e15ce
8e15ce
# Name of the Makefile.am
8e15ce
gnulib_mk=gnulib.mk
8e15ce
8e15ce
# List of gnulib modules needed.
8e15ce
gnulib_modules=
8e15ce
8e15ce
# Any gnulib files needed that are not in modules.
8e15ce
gnulib_files=
8e15ce
8e15ce
: ${AUTOPOINT=autopoint}
8e15ce
: ${AUTORECONF=autoreconf}
8e15ce
8e15ce
# A function to be called right after gnulib-tool is run.
8e15ce
# Override it via your own definition in bootstrap.conf.
8e15ce
bootstrap_post_import_hook() { :; }
8e15ce
8e15ce
# A function to be called after everything else in this script.
8e15ce
# Override it via your own definition in bootstrap.conf.
8e15ce
bootstrap_epilogue() { :; }
8e15ce
8e15ce
# The command to download all .po files for a specified domain into a
8e15ce
# specified directory.  Fill in the first %s with the destination
8e15ce
# directory and the second with the domain name.
8e15ce
po_download_command_format=\
8e15ce
"wget --mirror --level=1 -nd -q -A.po -P '%s' \
8e15ce
 https://translationproject.org/latest/%s/"
8e15ce
8e15ce
# Prefer a non-empty tarname (4th argument of AC_INIT if given), else
8e15ce
# fall back to the package name (1st argument with munging)
8e15ce
extract_package_name='
8e15ce
  /^AC_INIT(\[*/{
8e15ce
     s///
8e15ce
     /^[^,]*,[^,]*,[^,]*,[ []*\([^][ ,)]\)/{
8e15ce
       s//\1/
8e15ce
       s/[],)].*//
8e15ce
       p
8e15ce
       q
8e15ce
     }
8e15ce
     s/[],)].*//
8e15ce
     s/^GNU //
8e15ce
     y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
8e15ce
     s/[^abcdefghijklmnopqrstuvwxyz0123456789_]/-/g
8e15ce
     p
8e15ce
  }
8e15ce
'
8e15ce
package=$(sed -n "$extract_package_name" configure.ac) \
8e15ce
  || die 'cannot find package name in configure.ac'
8e15ce
gnulib_name=lib$package
8e15ce
8e15ce
build_aux=build-aux
8e15ce
source_base=lib
8e15ce
m4_base=m4
8e15ce
doc_base=doc
8e15ce
tests_base=tests
8e15ce
gnulib_extra_files="
8e15ce
        build-aux/install-sh
8e15ce
        build-aux/mdate-sh
8e15ce
        build-aux/texinfo.tex
8e15ce
        build-aux/depcomp
8e15ce
        build-aux/config.guess
8e15ce
        build-aux/config.sub
8e15ce
        doc/INSTALL
8e15ce
"
8e15ce
8e15ce
# Additional gnulib-tool options to use.  Use "\newline" to break lines.
8e15ce
gnulib_tool_option_extras=
8e15ce
8e15ce
# Other locale categories that need message catalogs.
8e15ce
EXTRA_LOCALE_CATEGORIES=
8e15ce
8e15ce
# Additional xgettext options to use.  Use "\\\newline" to break lines.
8e15ce
XGETTEXT_OPTIONS='\\\
8e15ce
 --flag=_:1:pass-c-format\\\
8e15ce
 --flag=N_:1:pass-c-format\\\
8e15ce
 --flag=error:3:c-format --flag=error_at_line:5:c-format\\\
8e15ce
'
8e15ce
8e15ce
# Package bug report address and copyright holder for gettext files
8e15ce
COPYRIGHT_HOLDER='Free Software Foundation, Inc.'
8e15ce
MSGID_BUGS_ADDRESS=bug-$package@gnu.org
8e15ce
8e15ce
# Files we don't want to import.
8e15ce
excluded_files=
8e15ce
8e15ce
# File that should exist in the top directory of a checked out hierarchy,
8e15ce
# but not in a distribution tarball.
8e15ce
checkout_only_file=README-hacking
8e15ce
8e15ce
# Whether to use copies instead of symlinks.
8e15ce
copy=false
8e15ce
8e15ce
# Set this to '.cvsignore .gitignore' in bootstrap.conf if you want
8e15ce
# those files to be generated in directories like lib/, m4/, and po/.
8e15ce
# Or set it to 'auto' to make this script select which to use based
8e15ce
# on which version control system (if any) is used in the source directory.
8e15ce
vc_ignore=auto
8e15ce
8e15ce
# Set this to true in bootstrap.conf to enable --bootstrap-sync by
8e15ce
# default.
8e15ce
bootstrap_sync=false
8e15ce
8e15ce
# Use git to update gnulib sources
8e15ce
use_git=true
8e15ce
8e15ce
check_exists() {
8e15ce
  if test "$1" = "--verbose"; then
8e15ce
    ($2 --version </dev/null) >/dev/null 2>&1
8e15ce
    if test $? -ge 126; then
8e15ce
      # If not found, run with diagnostics as one may be
8e15ce
      # presented with env variables to set to find the right version
8e15ce
      ($2 --version 
8e15ce
    fi
8e15ce
  else
8e15ce
    ($1 --version </dev/null) >/dev/null 2>&1
8e15ce
  fi
8e15ce
8e15ce
  test $? -lt 126
8e15ce
}
8e15ce
8e15ce
# find_tool ENVVAR NAMES...
8e15ce
# -------------------------
8e15ce
# Search for a required program.  Use the value of ENVVAR, if set,
8e15ce
# otherwise find the first of the NAMES that can be run.
8e15ce
# If found, set ENVVAR to the program name, die otherwise.
8e15ce
#
8e15ce
# FIXME: code duplication, see also gnu-web-doc-update.
8e15ce
find_tool ()
8e15ce
{
8e15ce
  find_tool_envvar=$1
8e15ce
  shift
8e15ce
  find_tool_names=$@
8e15ce
  eval "find_tool_res=\$$find_tool_envvar"
8e15ce
  if test x"$find_tool_res" = x; then
8e15ce
    for i; do
8e15ce
      if check_exists $i; then
8e15ce
        find_tool_res=$i
8e15ce
        break
8e15ce
      fi
8e15ce
    done
8e15ce
  fi
8e15ce
  if test x"$find_tool_res" = x; then
8e15ce
    warn_ "one of these is required: $find_tool_names;"
8e15ce
    die   "alternatively set $find_tool_envvar to a compatible tool"
8e15ce
  fi
8e15ce
  eval "$find_tool_envvar=\$find_tool_res"
8e15ce
  eval "export $find_tool_envvar"
8e15ce
}
8e15ce
8e15ce
# Override the default configuration, if necessary.
8e15ce
# Make sure that bootstrap.conf is sourced from the current directory
8e15ce
# if we were invoked as "sh bootstrap".
8e15ce
case "$0" in
8e15ce
  */*) test -r "$0.conf" && . "$0.conf" ;;
8e15ce
  *) test -r "$0.conf" && . ./"$0.conf" ;;
8e15ce
esac
8e15ce
8e15ce
if test "$vc_ignore" = auto; then
8e15ce
  vc_ignore=
8e15ce
  test -d .git && vc_ignore=.gitignore
8e15ce
  test -d CVS && vc_ignore="$vc_ignore .cvsignore"
8e15ce
fi
8e15ce
8e15ce
if test x"$gnulib_modules$gnulib_files$gnulib_extra_files" = x; then
8e15ce
  use_gnulib=false
8e15ce
else
8e15ce
  use_gnulib=true
8e15ce
fi
8e15ce
8e15ce
# Translate configuration into internal form.
8e15ce
8e15ce
# Parse options.
8e15ce
8e15ce
for option
8e15ce
do
8e15ce
  case $option in
8e15ce
  --help)
8e15ce
    usage
8e15ce
    exit;;
8e15ce
  --gnulib-srcdir=*)
8e15ce
    GNULIB_SRCDIR=${option#--gnulib-srcdir=};;
8e15ce
  --skip-po)
8e15ce
    SKIP_PO=t;;
8e15ce
  --force)
8e15ce
    checkout_only_file=;;
8e15ce
  --copy)
8e15ce
    copy=true;;
8e15ce
  --bootstrap-sync)
8e15ce
    bootstrap_sync=true;;
8e15ce
  --no-bootstrap-sync)
8e15ce
    bootstrap_sync=false;;
8e15ce
  --no-git)
8e15ce
    use_git=false;;
8e15ce
  *)
8e15ce
    die "$option: unknown option";;
8e15ce
  esac
8e15ce
done
8e15ce
8e15ce
$use_git || test -d "$GNULIB_SRCDIR" \
8e15ce
  || die "Error: --no-git requires --gnulib-srcdir"
8e15ce
8e15ce
if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
8e15ce
  die "Bootstrapping from a non-checked-out distribution is risky."
8e15ce
fi
8e15ce
8e15ce
# Strip blank and comment lines to leave significant entries.
8e15ce
gitignore_entries() {
8e15ce
  sed '/^#/d; /^$/d' "$@"
8e15ce
}
8e15ce
8e15ce
# If $STR is not already on a line by itself in $FILE, insert it at the start.
8e15ce
# Entries are inserted at the start of the ignore list to ensure existing
8e15ce
# entries starting with ! are not overridden.  Such entries support
8e15ce
# whitelisting exceptions after a more generic blacklist pattern.
8e15ce
insert_if_absent() {
8e15ce
  file=$1
8e15ce
  str=$2
8e15ce
  test -f $file || touch $file
8e15ce
  test -r $file || die "Error: failed to read ignore file: $file"
8e15ce
  duplicate_entries=$(gitignore_entries $file | sort | uniq -d)
8e15ce
  if [ "$duplicate_entries" ] ; then
8e15ce
    die "Error: Duplicate entries in $file: " $duplicate_entries
8e15ce
  fi
8e15ce
  linesold=$(gitignore_entries $file | wc -l)
8e15ce
  linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l)
8e15ce
  if [ $linesold != $linesnew ] ; then
8e15ce
    { echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \
8e15ce
      || die "insert_if_absent $file $str: failed"
8e15ce
  fi
8e15ce
}
8e15ce
8e15ce
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
8e15ce
# insert_if_absent.
8e15ce
insert_vc_ignore() {
8e15ce
  vc_ignore_file="$1"
8e15ce
  pattern="$2"
8e15ce
  case $vc_ignore_file in
8e15ce
  *.gitignore)
8e15ce
    # A .gitignore entry that does not start with '/' applies
8e15ce
    # recursively to subdirectories, so prepend '/' to every
8e15ce
    # .gitignore entry.
8e15ce
    pattern=$(echo "$pattern" | sed s,^,/,);;
8e15ce
  esac
8e15ce
  insert_if_absent "$vc_ignore_file" "$pattern"
8e15ce
}
8e15ce
8e15ce
# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
8e15ce
found_aux_dir=no
8e15ce
grep '^[	 ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \
8e15ce
    >/dev/null && found_aux_dir=yes
8e15ce
grep '^[	 ]*AC_CONFIG_AUX_DIR('"$build_aux"')' configure.ac \
8e15ce
    >/dev/null && found_aux_dir=yes
8e15ce
test $found_aux_dir = yes \
8e15ce
  || die "configure.ac lacks 'AC_CONFIG_AUX_DIR([$build_aux])'; add it"
8e15ce
8e15ce
# If $build_aux doesn't exist, create it now, otherwise some bits
8e15ce
# below will malfunction.  If creating it, also mark it as ignored.
8e15ce
if test ! -d $build_aux; then
8e15ce
  mkdir $build_aux
8e15ce
  for dot_ig in x $vc_ignore; do
8e15ce
    test $dot_ig = x && continue
8e15ce
    insert_vc_ignore $dot_ig $build_aux
8e15ce
  done
8e15ce
fi
8e15ce
8e15ce
# Note this deviates from the version comparison in automake
8e15ce
# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
8e15ce
# but this should suffice as we won't be specifying old
8e15ce
# version formats or redundant trailing .0 in bootstrap.conf.
8e15ce
# If we did want full compatibility then we should probably
8e15ce
# use m4_version_compare from autoconf.
8e15ce
sort_ver() { # sort -V is not generally available
8e15ce
  ver1="$1"
8e15ce
  ver2="$2"
8e15ce
8e15ce
  # split on '.' and compare each component
8e15ce
  i=1
8e15ce
  while : ; do
8e15ce
    p1=$(echo "$ver1" | cut -d. -f$i)
8e15ce
    p2=$(echo "$ver2" | cut -d. -f$i)
8e15ce
    if [ ! "$p1" ]; then
8e15ce
      echo "$1 $2"
8e15ce
      break
8e15ce
    elif [ ! "$p2" ]; then
8e15ce
      echo "$2 $1"
8e15ce
      break
8e15ce
    elif [ ! "$p1" = "$p2" ]; then
8e15ce
      if [ "$p1" -gt "$p2" ] 2>/dev/null; then # numeric comparison
8e15ce
        echo "$2 $1"
8e15ce
      elif [ "$p2" -gt "$p1" ] 2>/dev/null; then # numeric comparison
8e15ce
        echo "$1 $2"
8e15ce
      else # numeric, then lexicographic comparison
8e15ce
        lp=$(printf "$p1\n$p2\n" | LANG=C sort -n | tail -n1)
8e15ce
        if [ "$lp" = "$p2" ]; then
8e15ce
          echo "$1 $2"
8e15ce
        else
8e15ce
          echo "$2 $1"
8e15ce
        fi
8e15ce
      fi
8e15ce
      break
8e15ce
    fi
8e15ce
    i=$(($i+1))
8e15ce
  done
8e15ce
}
8e15ce
8e15ce
get_version_sed='
8e15ce
# Move version to start of line.
8e15ce
s/.*[v ]\([0-9]\)/\1/
8e15ce
8e15ce
# Skip lines that do not start with version.
8e15ce
/^[0-9]/!d
8e15ce
8e15ce
# Remove characters after the version.
8e15ce
s/[^.a-z0-9-].*//
8e15ce
8e15ce
# The first component must be digits only.
8e15ce
s/^\([0-9]*\)[a-z-].*/\1/
8e15ce
8e15ce
#the following essentially does s/5.005/5.5/
8e15ce
s/\.0*\([1-9]\)/.\1/g
8e15ce
p
8e15ce
q'
8e15ce
8e15ce
get_version() {
8e15ce
  app=$1
8e15ce
8e15ce
  $app --version >/dev/null 2>&1 || { $app --version; return 1; }
8e15ce
8e15ce
  $app --version 2>&1 | sed -n "$get_version_sed"
8e15ce
}
8e15ce
8e15ce
check_versions() {
8e15ce
  ret=0
8e15ce
8e15ce
  while read app req_ver; do
8e15ce
    # We only need libtoolize from the libtool package.
8e15ce
    if test "$app" = libtool; then
8e15ce
      app=libtoolize
8e15ce
    fi
8e15ce
    # Exempt git if --no-git is in effect.
8e15ce
    if test "$app" = git; then
8e15ce
      $use_git || continue
8e15ce
    fi
8e15ce
    # Honor $APP variables ($TAR, $AUTOCONF, etc.)
8e15ce
    appvar=$(echo $app | LC_ALL=C tr '[a-z]-' '[A-Z]_')
8e15ce
    test "$appvar" = TAR && appvar=AMTAR
8e15ce
    case $appvar in
8e15ce
        GZIP) ;; # Do not use $GZIP:  it contains gzip options.
8e15ce
        PERL::*) ;; # Keep perl modules as-is
8e15ce
        *) eval "app=\${$appvar-$app}" ;;
8e15ce
    esac
8e15ce
8e15ce
    # Handle the still-experimental Automake-NG programs specially.
8e15ce
    # They remain named as the mainstream Automake programs ("automake",
8e15ce
    # and "aclocal") to avoid gratuitous incompatibilities with
8e15ce
    # pre-existing usages (by, say, autoreconf, or custom autogen.sh
8e15ce
    # scripts), but correctly identify themselves (as being part of
8e15ce
    # "GNU automake-ng") when asked their version.
8e15ce
    case $app in
8e15ce
      automake-ng|aclocal-ng)
8e15ce
        app=${app%-ng}
8e15ce
        ($app --version | grep '(GNU automake-ng)') >/dev/null 2>&1 || {
8e15ce
          warn_ "Error: '$app' not found or not from Automake-NG"
8e15ce
          ret=1
8e15ce
          continue
8e15ce
        } ;;
8e15ce
      # Another check is for perl modules.  These can be written as
8e15ce
      # e.g. perl::XML::XPath in case of XML::XPath module, etc.
8e15ce
      perl::*)
8e15ce
        # Extract module name
8e15ce
        app="${app#perl::}"
8e15ce
        if ! $PERL -m"$app" -e 'exit 0' >/dev/null 2>&1; then
8e15ce
          warn_ "Error: perl module '$app' not found"
8e15ce
          ret=1
8e15ce
        fi
8e15ce
        continue
8e15ce
        ;;
8e15ce
    esac
8e15ce
    if [ "$req_ver" = "-" ]; then
8e15ce
      # Merely require app to exist; not all prereq apps are well-behaved
8e15ce
      # so we have to rely on $? rather than get_version.
8e15ce
      if ! check_exists --verbose $app; then
8e15ce
        warn_ "Error: '$app' not found"
8e15ce
        ret=1
8e15ce
      fi
8e15ce
    else
8e15ce
      # Require app to produce a new enough version string.
8e15ce
      inst_ver=$(get_version $app)
8e15ce
      if [ ! "$inst_ver" ]; then
8e15ce
        warn_ "Error: '$app' not found"
8e15ce
        ret=1
8e15ce
      else
8e15ce
        latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2)
8e15ce
        if [ ! "$latest_ver" = "$inst_ver" ]; then
8e15ce
          warnf_ '%s\n'                                        \
8e15ce
              "Error: '$app' version == $inst_ver is too old"  \
8e15ce
              "       '$app' version >= $req_ver is required"
8e15ce
          ret=1
8e15ce
        fi
8e15ce
      fi
8e15ce
    fi
8e15ce
  done
8e15ce
8e15ce
  return $ret
8e15ce
}
8e15ce
8e15ce
print_versions() {
8e15ce
  echo "Program    Min_version"
8e15ce
  echo "----------------------"
8e15ce
  printf %s "$buildreq"
8e15ce
  echo "----------------------"
8e15ce
  # can't depend on column -t
8e15ce
}
8e15ce
8e15ce
# Find sha1sum, named gsha1sum on MacPorts, shasum on Mac OS X 10.6.
8e15ce
# Also find the compatible sha1 utility on the BSDs
8e15ce
if test x"$SKIP_PO" = x; then
8e15ce
  find_tool SHA1SUM sha1sum gsha1sum shasum sha1
8e15ce
fi
8e15ce
8e15ce
use_libtool=0
8e15ce
# We'd like to use grep -E, to see if any of LT_INIT,
8e15ce
# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
8e15ce
# but that's not portable enough (e.g., for Solaris).
8e15ce
grep '^[	 ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \
8e15ce
  && use_libtool=1
8e15ce
grep '^[	 ]*LT_INIT' configure.ac >/dev/null \
8e15ce
  && use_libtool=1
8e15ce
if test $use_libtool = 1; then
8e15ce
  find_tool LIBTOOLIZE glibtoolize libtoolize
8e15ce
fi
8e15ce
8e15ce
# gnulib-tool requires at least automake and autoconf.
8e15ce
# If either is not listed, add it (with minimum version) as a prerequisite.
8e15ce
case $buildreq in
8e15ce
  *automake*) ;;
8e15ce
  *) buildreq="automake 1.9
8e15ce
$buildreq" ;;
8e15ce
esac
8e15ce
case $buildreq in
8e15ce
  *autoconf*) ;;
8e15ce
  *) buildreq="autoconf 2.59
8e15ce
$buildreq" ;;
8e15ce
esac
8e15ce
8e15ce
# When we can deduce that gnulib-tool will require patch,
8e15ce
# and when patch is not already listed as a prerequisite, add it, too.
8e15ce
if test -d "$local_gl_dir" \
8e15ce
    && ! find "$local_gl_dir" -name '*.diff' -exec false {} +; then
8e15ce
  case $buildreq in
8e15ce
    *patch*) ;;
8e15ce
    *) buildreq="patch -
8e15ce
$buildreq" ;;
8e15ce
  esac
8e15ce
fi
8e15ce
8e15ce
if ! printf "$buildreq" | check_versions; then
8e15ce
  echo >&2
8e15ce
  if test -f README-prereq; then
8e15ce
    die "See README-prereq for how to get the prerequisite programs"
8e15ce
  else
8e15ce
    die "Please install the prerequisite programs"
8e15ce
  fi
8e15ce
fi
8e15ce
8e15ce
# Warn the user if autom4te appears to be broken; this causes known
8e15ce
# issues with at least gettext 0.18.3.
8e15ce
probe=$(echo 'm4_quote([hi])' | autom4te -l M4sugar -t 'm4_quote:$%' -)
8e15ce
if test "x$probe" != xhi; then
8e15ce
  warn_ "WARNING: your autom4te wrapper eats stdin;"
8e15ce
  warn_ "if bootstrap fails, consider upgrading your autotools"
8e15ce
fi
8e15ce
8e15ce
echo "$0: Bootstrapping from checked-out $package sources..."
8e15ce
8e15ce
# See if we can use gnulib's git-merge-changelog merge driver.
8e15ce
if $use_git && test -d .git && check_exists git; then
8e15ce
  if git config merge.merge-changelog.driver >/dev/null ; then
8e15ce
    :
8e15ce
  elif check_exists git-merge-changelog; then
8e15ce
    echo "$0: initializing git-merge-changelog driver"
8e15ce
    git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
8e15ce
    git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
8e15ce
  else
8e15ce
    echo "$0: consider installing git-merge-changelog from gnulib"
8e15ce
  fi
8e15ce
fi
8e15ce
8e15ce
8e15ce
cleanup_gnulib() {
8e15ce
  status=$?
8e15ce
  rm -fr "$gnulib_path"
8e15ce
  exit $status
8e15ce
}
8e15ce
8e15ce
git_modules_config () {
8e15ce
  test -f .gitmodules && git config --file .gitmodules "$@"
8e15ce
}
8e15ce
8e15ce
if $use_gnulib; then
8e15ce
  if $use_git; then
8e15ce
    gnulib_path=$(git_modules_config submodule.gnulib.path)
8e15ce
    test -z "$gnulib_path" && gnulib_path=gnulib
8e15ce
  fi
8e15ce
8e15ce
  # Get gnulib files.  Populate $GNULIB_SRCDIR, possibly updating a
8e15ce
  # submodule, for use in the rest of the script.
8e15ce
8e15ce
  case ${GNULIB_SRCDIR--} in
8e15ce
  -)
8e15ce
    # Note that $use_git is necessarily true in this case.
8e15ce
    if git_modules_config submodule.gnulib.url >/dev/null; then
8e15ce
      echo "$0: getting gnulib files..."
8e15ce
      git submodule init -- "$gnulib_path" || exit $?
8e15ce
      git submodule update -- "$gnulib_path" || exit $?
8e15ce
8e15ce
    elif [ ! -d "$gnulib_path" ]; then
8e15ce
      echo "$0: getting gnulib files..."
8e15ce
8e15ce
      trap cleanup_gnulib 1 2 13 15
8e15ce
8e15ce
      shallow=
8e15ce
      if test -z "$GNULIB_REVISION"; then
8e15ce
        git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
8e15ce
      fi
8e15ce
      git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \
8e15ce
        || cleanup_gnulib
8e15ce
8e15ce
      trap - 1 2 13 15
8e15ce
    fi
8e15ce
    GNULIB_SRCDIR=$gnulib_path
8e15ce
    ;;
8e15ce
  *)
8e15ce
    # Use GNULIB_SRCDIR directly or as a reference.
8e15ce
    if $use_git && test -d "$GNULIB_SRCDIR"/.git && \
8e15ce
          git_modules_config submodule.gnulib.url >/dev/null; then
8e15ce
      echo "$0: getting gnulib files..."
8e15ce
      if git submodule -h|grep -- --reference > /dev/null; then
8e15ce
        # Prefer the one-liner available in git 1.6.4 or newer.
8e15ce
        git submodule update --init --reference "$GNULIB_SRCDIR" \
8e15ce
          "$gnulib_path" || exit $?
8e15ce
      else
8e15ce
        # This fallback allows at least git 1.5.5.
8e15ce
        if test -f "$gnulib_path"/gnulib-tool; then
8e15ce
          # Since file already exists, assume submodule init already complete.
8e15ce
          git submodule update -- "$gnulib_path" || exit $?
8e15ce
        else
8e15ce
          # Older git can't clone into an empty directory.
8e15ce
          rmdir "$gnulib_path" 2>/dev/null
8e15ce
          git clone --reference "$GNULIB_SRCDIR" \
8e15ce
            "$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
8e15ce
            && git submodule init -- "$gnulib_path" \
8e15ce
            && git submodule update -- "$gnulib_path" \
8e15ce
            || exit $?
8e15ce
        fi
8e15ce
      fi
8e15ce
      GNULIB_SRCDIR=$gnulib_path
8e15ce
    fi
8e15ce
    ;;
8e15ce
  esac
8e15ce
8e15ce
  if test -d "$GNULIB_SRCDIR"/.git && test -n "$GNULIB_REVISION" \
8e15ce
     && ! git_modules_config submodule.gnulib.url >/dev/null; then
8e15ce
    (cd "$GNULIB_SRCDIR" && git checkout "$GNULIB_REVISION") || cleanup_gnulib
8e15ce
  fi
8e15ce
8e15ce
  # $GNULIB_SRCDIR now points to the version of gnulib to use, and
8e15ce
  # we no longer need to use git or $gnulib_path below here.
8e15ce
8e15ce
  if $bootstrap_sync; then
8e15ce
    cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
8e15ce
      echo "$0: updating bootstrap and restarting..."
8e15ce
      case $(sh -c 'echo "$1"' -- a) in
8e15ce
        a) ignored=--;;
8e15ce
        *) ignored=ignored;;
8e15ce
      esac
8e15ce
      exec sh -c \
8e15ce
        'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
8e15ce
        $ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \
8e15ce
        "$0" "$@" --no-bootstrap-sync
8e15ce
    }
8e15ce
  fi
8e15ce
8e15ce
  gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
8e15ce
  <$gnulib_tool || exit $?
8e15ce
fi
8e15ce
8e15ce
# Get translations.
8e15ce
8e15ce
download_po_files() {
8e15ce
  subdir=$1
8e15ce
  domain=$2
8e15ce
  echo "$me: getting translations into $subdir for $domain..."
8e15ce
  cmd=$(printf "$po_download_command_format" "$subdir" "$domain")
8e15ce
  eval "$cmd"
8e15ce
}
8e15ce
8e15ce
# Mirror .po files to $po_dir/.reference and copy only the new
8e15ce
# or modified ones into $po_dir.  Also update $po_dir/LINGUAS.
8e15ce
# Note po files that exist locally only are left in $po_dir but will
8e15ce
# not be included in LINGUAS and hence will not be distributed.
8e15ce
update_po_files() {
8e15ce
  # Directory containing primary .po files.
8e15ce
  # Overwrite them only when we're sure a .po file is new.
8e15ce
  po_dir=$1
8e15ce
  domain=$2
8e15ce
8e15ce
  # Mirror *.po files into this dir.
8e15ce
  # Usually contains *.s1 checksum files.
8e15ce
  ref_po_dir="$po_dir/.reference"
8e15ce
8e15ce
  test -d $ref_po_dir || mkdir $ref_po_dir || return
8e15ce
  download_po_files $ref_po_dir $domain \
8e15ce
    && ls "$ref_po_dir"/*.po 2>/dev/null |
8e15ce
      sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return
8e15ce
8e15ce
  langs=$(cd $ref_po_dir && echo *.po | sed 's/\.po//g')
8e15ce
  test "$langs" = '*' && langs=x
8e15ce
  for po in $langs; do
8e15ce
    case $po in x) continue;; esac
8e15ce
    new_po="$ref_po_dir/$po.po"
8e15ce
    cksum_file="$ref_po_dir/$po.s1"
8e15ce
    if ! test -f "$cksum_file" ||
8e15ce
        ! test -f "$po_dir/$po.po" ||
8e15ce
        ! $SHA1SUM -c "$cksum_file" < "$new_po" > /dev/null 2>&1; then
8e15ce
      echo "$me: updated $po_dir/$po.po..."
8e15ce
      cp "$new_po" "$po_dir/$po.po" \
8e15ce
          && $SHA1SUM < "$new_po" > "$cksum_file" || return
8e15ce
    fi
8e15ce
  done
8e15ce
}
8e15ce
8e15ce
case $SKIP_PO in
8e15ce
'')
8e15ce
  if test -d po; then
8e15ce
    update_po_files po $package || exit
8e15ce
  fi
8e15ce
8e15ce
  if test -d runtime-po; then
8e15ce
    update_po_files runtime-po $package-runtime || exit
8e15ce
  fi;;
8e15ce
esac
8e15ce
8e15ce
symlink_to_dir()
8e15ce
{
8e15ce
  src=$1/$2
8e15ce
  dst=${3-$2}
8e15ce
8e15ce
  test -f "$src" && {
8e15ce
8e15ce
    # If the destination directory doesn't exist, create it.
8e15ce
    # This is required at least for "lib/uniwidth/cjk.h".
8e15ce
    dst_dir=$(dirname "$dst")
8e15ce
    if ! test -d "$dst_dir"; then
8e15ce
      mkdir -p "$dst_dir"
8e15ce
8e15ce
      # If we've just created a directory like lib/uniwidth,
8e15ce
      # tell version control system(s) it's ignorable.
8e15ce
      # FIXME: for now, this does only one level
8e15ce
      parent=$(dirname "$dst_dir")
8e15ce
      for dot_ig in x $vc_ignore; do
8e15ce
        test $dot_ig = x && continue
8e15ce
        ig=$parent/$dot_ig
8e15ce
        insert_vc_ignore $ig "${dst_dir##*/}"
8e15ce
      done
8e15ce
    fi
8e15ce
8e15ce
    if $copy; then
8e15ce
      {
8e15ce
        test ! -h "$dst" || {
8e15ce
          echo "$me: rm -f $dst" &&
8e15ce
          rm -f "$dst"
8e15ce
        }
8e15ce
      } &&
8e15ce
      test -f "$dst" &&
8e15ce
      cmp -s "$src" "$dst" || {
8e15ce
        echo "$me: cp -fp $src $dst" &&
8e15ce
        cp -fp "$src" "$dst"
8e15ce
      }
8e15ce
    else
8e15ce
      # Leave any existing symlink alone, if it already points to the source,
8e15ce
      # so that broken build tools that care about symlink times
8e15ce
      # aren't confused into doing unnecessary builds.  Conversely, if the
8e15ce
      # existing symlink's timestamp is older than the source, make it afresh,
8e15ce
      # so that broken tools aren't confused into skipping needed builds.  See
8e15ce
      # <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00326.html>.
8e15ce
      test -h "$dst" &&
8e15ce
      src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
8e15ce
      dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
8e15ce
      test "$src_i" = "$dst_i" &&
8e15ce
      both_ls=$(ls -dt "$src" "$dst") &&
8e15ce
      test "X$both_ls" = "X$dst$nl$src" || {
8e15ce
        dot_dots=
8e15ce
        case $src in
8e15ce
        /*) ;;
8e15ce
        *)
8e15ce
          case /$dst/ in
8e15ce
          *//* | */../* | */./* | /*/*/*/*/*/)
8e15ce
             die "invalid symlink calculation: $src -> $dst";;
8e15ce
          /*/*/*/*/)    dot_dots=../../../;;
8e15ce
          /*/*/*/)      dot_dots=../../;;
8e15ce
          /*/*/)        dot_dots=../;;
8e15ce
          esac;;
8e15ce
        esac
8e15ce
8e15ce
        echo "$me: ln -fs $dot_dots$src $dst" &&
8e15ce
        ln -fs "$dot_dots$src" "$dst"
8e15ce
      }
8e15ce
    fi
8e15ce
  }
8e15ce
}
8e15ce
8e15ce
version_controlled_file() {
8e15ce
  parent=$1
8e15ce
  file=$2
8e15ce
  if test -d .git; then
8e15ce
    git rm -n "$file" > /dev/null 2>&1
8e15ce
  elif test -d .svn; then
8e15ce
    svn log -r HEAD "$file" > /dev/null 2>&1
8e15ce
  elif test -d CVS; then
8e15ce
    grep -F "/${file##*/}/" "$parent/CVS/Entries" 2>/dev/null |
8e15ce
             grep '^/[^/]*/[0-9]' > /dev/null
8e15ce
  else
8e15ce
    warn_ "no version control for $file?"
8e15ce
    false
8e15ce
  fi
8e15ce
}
8e15ce
8e15ce
# NOTE: we have to be careful to run both autopoint and libtoolize
8e15ce
# before gnulib-tool, since gnulib-tool is likely to provide newer
8e15ce
# versions of files "installed" by these two programs.
8e15ce
# Then, *after* gnulib-tool (see below), we have to be careful to
8e15ce
# run autoreconf in such a way that it does not run either of these
8e15ce
# two just-pre-run programs.
8e15ce
8e15ce
# Import from gettext.
8e15ce
with_gettext=yes
8e15ce
grep '^[	 ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \
8e15ce
    with_gettext=no
8e15ce
8e15ce
if test $with_gettext = yes || test $use_libtool = 1; then
8e15ce
8e15ce
  tempbase=.bootstrap$$
8e15ce
  trap "rm -f $tempbase.0 $tempbase.1" 1 2 13 15
8e15ce
8e15ce
  > $tempbase.0 > $tempbase.1 &&
8e15ce
  find . ! -type d -print | sort > $tempbase.0 || exit
8e15ce
8e15ce
  if test $with_gettext = yes; then
8e15ce
    # Released autopoint has the tendency to install macros that have been
8e15ce
    # obsoleted in current gnulib, so run this before gnulib-tool.
8e15ce
    echo "$0: $AUTOPOINT --force"
8e15ce
    $AUTOPOINT --force || exit
8e15ce
  fi
8e15ce
8e15ce
  # Autoreconf runs aclocal before libtoolize, which causes spurious
8e15ce
  # warnings if the initial aclocal is confused by the libtoolized
8e15ce
  # (or worse out-of-date) macro directory.
8e15ce
  # libtoolize 1.9b added the --install option; but we support back
8e15ce
  # to libtoolize 1.5.22, where the install action was default.
8e15ce
  if test $use_libtool = 1; then
8e15ce
    install=
8e15ce
    case $($LIBTOOLIZE --help) in
8e15ce
      *--install*) install=--install ;;
8e15ce
    esac
8e15ce
    echo "running: $LIBTOOLIZE $install --copy"
8e15ce
    $LIBTOOLIZE $install --copy
8e15ce
  fi
8e15ce
8e15ce
  find . ! -type d -print | sort >$tempbase.1
8e15ce
  old_IFS=$IFS
8e15ce
  IFS=$nl
8e15ce
  for file in $(comm -13 $tempbase.0 $tempbase.1); do
8e15ce
    IFS=$old_IFS
8e15ce
    parent=${file%/*}
8e15ce
    version_controlled_file "$parent" "$file" || {
8e15ce
      for dot_ig in x $vc_ignore; do
8e15ce
        test $dot_ig = x && continue
8e15ce
        ig=$parent/$dot_ig
8e15ce
        insert_vc_ignore "$ig" "${file##*/}"
8e15ce
      done
8e15ce
    }
8e15ce
  done
8e15ce
  IFS=$old_IFS
8e15ce
8e15ce
  rm -f $tempbase.0 $tempbase.1
8e15ce
  trap - 1 2 13 15
8e15ce
fi
8e15ce
8e15ce
# Import from gnulib.
8e15ce
8e15ce
if $use_gnulib; then
8e15ce
  gnulib_tool_options="\
8e15ce
   --no-changelog\
8e15ce
   --aux-dir=$build_aux\
8e15ce
   --doc-base=$doc_base\
8e15ce
   --lib=$gnulib_name\
8e15ce
   --m4-base=$m4_base/\
8e15ce
   --source-base=$source_base/\
8e15ce
   --tests-base=$tests_base\
8e15ce
   --local-dir=$local_gl_dir\
8e15ce
   $gnulib_tool_option_extras\
8e15ce
  "
8e15ce
  if test $use_libtool = 1; then
8e15ce
    case "$gnulib_tool_options " in
8e15ce
      *' --libtool '*) ;;
8e15ce
      *) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
8e15ce
    esac
8e15ce
  fi
8e15ce
  echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
8e15ce
  $gnulib_tool $gnulib_tool_options --import $gnulib_modules \
8e15ce
    || die "gnulib-tool failed"
8e15ce
8e15ce
  for file in $gnulib_files; do
8e15ce
    symlink_to_dir "$GNULIB_SRCDIR" $file \
8e15ce
      || die "failed to symlink $file"
8e15ce
  done
8e15ce
fi
8e15ce
8e15ce
bootstrap_post_import_hook \
8e15ce
  || die "bootstrap_post_import_hook failed"
8e15ce
8e15ce
# Don't proceed if there are uninitialized submodules.  In particular,
8e15ce
# the next step will remove dangling links, which might be links into
8e15ce
# uninitialized submodules.
8e15ce
#
8e15ce
# Uninitialized submodules are listed with an initial dash.
8e15ce
if $use_git && git submodule | grep '^-' >/dev/null; then
8e15ce
  die "some git submodules are not initialized. "     \
8e15ce
      "Run 'git submodule init' and bootstrap again."
8e15ce
fi
8e15ce
8e15ce
# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
8e15ce
# gnulib-populated directories.  Such .m4 files would cause aclocal to fail.
8e15ce
# The following requires GNU find 4.2.3 or newer.  Considering the usual
8e15ce
# portability constraints of this script, that may seem a very demanding
8e15ce
# requirement, but it should be ok.  Ignore any failure, which is fine,
8e15ce
# since this is only a convenience to help developers avoid the relatively
8e15ce
# unusual case in which a symlinked-to .m4 file is git-removed from gnulib
8e15ce
# between successive runs of this script.
8e15ce
find "$m4_base" "$source_base" \
8e15ce
  -depth \( -name '*.m4' -o -name '*.[ch]' \) \
8e15ce
  -type l -xtype l -delete > /dev/null 2>&1
8e15ce
8e15ce
# Invoke autoreconf with --force --install to ensure upgrades of tools
8e15ce
# such as ylwrap.
8e15ce
AUTORECONFFLAGS="--verbose --install --force -I $m4_base $ACLOCAL_FLAGS"
8e15ce
8e15ce
# Some systems (RHEL 5) are using ancient autotools, for which the
8e15ce
# --no-recursive option had not been invented.  Detect that lack and
8e15ce
# omit the option when it's not supported.  FIXME in 2017: remove this
8e15ce
# hack when RHEL 5 autotools are updated, or when they become irrelevant.
8e15ce
case $($AUTORECONF --help) in
8e15ce
  *--no-recursive*) AUTORECONFFLAGS="$AUTORECONFFLAGS --no-recursive";;
8e15ce
esac
8e15ce
8e15ce
# Tell autoreconf not to invoke autopoint or libtoolize; they were run above.
8e15ce
echo "running: AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS"
8e15ce
AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS \
8e15ce
  || die "autoreconf failed"
8e15ce
8e15ce
# Get some extra files from gnulib, overriding existing files.
8e15ce
for file in $gnulib_extra_files; do
8e15ce
  case $file in
8e15ce
  */INSTALL) dst=INSTALL;;
8e15ce
  build-aux/*) dst=$build_aux/${file#build-aux/};;
8e15ce
  *) dst=$file;;
8e15ce
  esac
8e15ce
  symlink_to_dir "$GNULIB_SRCDIR" $file $dst \
8e15ce
    || die "failed to symlink $file"
8e15ce
done
8e15ce
8e15ce
if test $with_gettext = yes; then
8e15ce
  # Create gettext configuration.
8e15ce
  echo "$0: Creating po/Makevars from po/Makevars.template ..."
8e15ce
  rm -f po/Makevars
8e15ce
  sed '
8e15ce
    /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
8e15ce
    /^COPYRIGHT_HOLDER *=/s/=.*/= '"$COPYRIGHT_HOLDER"'/
8e15ce
    /^MSGID_BUGS_ADDRESS *=/s|=.*|= '"$MSGID_BUGS_ADDRESS"'|
8e15ce
    /^XGETTEXT_OPTIONS *=/{
8e15ce
      s/$/ \\/
8e15ce
      a\
8e15ce
          '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
8e15ce
    }
8e15ce
  ' po/Makevars.template >po/Makevars \
8e15ce
    || die 'cannot generate po/Makevars'
8e15ce
8e15ce
  # If the 'gettext' module is in use, grab the latest Makefile.in.in.
8e15ce
  # If only the 'gettext-h' module is in use, assume autopoint already
8e15ce
  # put the correct version of this file into place.
8e15ce
  case $gnulib_modules in
8e15ce
  *gettext-h*) ;;
8e15ce
  *gettext*)
8e15ce
    cp $GNULIB_SRCDIR/build-aux/po/Makefile.in.in po/Makefile.in.in \
8e15ce
      || die "cannot create po/Makefile.in.in"
8e15ce
    ;;
8e15ce
  esac
8e15ce
8e15ce
  if test -d runtime-po; then
8e15ce
    # Similarly for runtime-po/Makevars, but not quite the same.
8e15ce
    rm -f runtime-po/Makevars
8e15ce
    sed '
8e15ce
      /^DOMAIN *=.*/s/=.*/= '"$package"'-runtime/
8e15ce
      /^subdir *=.*/s/=.*/= runtime-po/
8e15ce
      /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
8e15ce
      /^XGETTEXT_OPTIONS *=/{
8e15ce
        s/$/ \\/
8e15ce
        a\
8e15ce
            '"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
8e15ce
      }
8e15ce
    ' po/Makevars.template >runtime-po/Makevars \
8e15ce
    || die 'cannot generate runtime-po/Makevars'
8e15ce
8e15ce
    # Copy identical files from po to runtime-po.
8e15ce
    (cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
8e15ce
  fi
8e15ce
fi
8e15ce
8e15ce
bootstrap_epilogue
8e15ce
8e15ce
echo "$0: done.  Now you can run './configure'."
8e15ce
8e15ce
# Local variables:
8e15ce
# eval: (add-hook 'before-save-hook 'time-stamp)
8e15ce
# time-stamp-start: "scriptversion="
8e15ce
# time-stamp-format: "%:y-%02m-%02d.%02H"
8e15ce
# time-stamp-time-zone: "UTC0"
8e15ce
# time-stamp-end: "; # UTC"
8e15ce
# End: