#! /bin/sh
#
-# Copyright (C) 1995-1998, 2000-2013 Free Software Foundation, Inc.
+# Copyright (C) 1995-1998, 2000-2015 Free Software Foundation, Inc.
#
# 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
progname=$0
package=@PACKAGE@
version=@VERSION@
+archive_version=@ARCHIVE_VERSION@
# Set variables
-# - gettext_dir directory where the sources are stored.
+# - gettext_datadir directory where the data files are stored.
prefix="@prefix@"
datarootdir="@datarootdir@"
-gettext_dir="@datadir@/gettext"
+: ${gettext_datadir="@datadir@/gettext"}
+: ${AUTOM4TE=autom4te}
# func_tmpdir
# creates a temporary directory.
func_find_curr_installdir # determine curr_installdir
func_find_prefixes
# Relocate the directory variables that we use.
- gettext_dir=`echo "$gettext_dir/" | sed -e "s%^${orig_installprefix}/%${curr_installprefix}/%" | sed -e 's,/$,,'`
+ gettext_datadir=`echo "$gettext_datadir/" | sed -e "s%^${orig_installprefix}/%${curr_installprefix}/%" | sed -e 's,/$,,'`
fi
-# func_trace macro
-# traces an Autoconf macro call and outputs the arguments to stdout.
-func_trace ()
+# func_trace_autoconf macro configure.ac
+# traces an Autoconf macro call and outputs the arguments to stdout,
+# using autom4te.
+func_trace_autoconf ()
{
echo '\
-dnl disable macros which may abort autom4te
-m4_undefine([m4_assert])
-m4_undefine([m4_fatal])
-m4_undefine([m4_warn])
-m4_undefine([m4_errprintn])
-m4_undefine([m4_exit])
-m4_undefine([m4_include])
-m4_undefine([m4_esyscmd])
-dnl macros which needs to be traced without aclocal.m4
-m4_define([AM_GNU_GETTEXT], [])
-m4_define([AM_GNU_GETTEXT_VERSION], [])
+dnl replace macros which may abort autom4te with a no-op variant
+m4_pushdef([m4_assert])
+m4_pushdef([m4_fatal])
+m4_pushdef([m4_warn])
+m4_pushdef([m4_errprintn])
+m4_pushdef([m4_exit])
+m4_pushdef([m4_include])
+m4_pushdef([m4_esyscmd])
' \
- | ${AUTOM4TE:-autom4te} --no-cache --language=Autoconf-without-aclocal-m4 \
+ | "$AUTOM4TE" --no-cache --language=Autoconf-without-aclocal-m4 \
--trace="$1":\$% - "$2" 2>/dev/null
}
+# func_trace_sed macro configure.ac
+# traces an Autoconf macro call and outputs the arguments to stdout,
+# using sed.
+func_trace_sed ()
+{
+ sed_extract_arguments='
+s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,;
+/'"$1"'(/ {
+ ta
+ :a
+ s/)/)/
+ tb
+ s/\\$//
+ N
+ ba
+ :b
+ s,^.*'"$1"'([[ ]*\([^]"$`\\)]*\).*$,\1,p
+}
+d'
+ sed -e "$sed_extract_arguments" "$2"
+}
+
# func_usage
# outputs to stdout the --help usage message.
func_usage ()
# Nuisances.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
# Command-line option processing.
# Removes the OPTIONS from the arguments. Sets the variables:
# - force 1 if --force was given, 0 otherwise
fi
fi
+# Select the method for Autoconf macro tracing. func_trace_autoconf
+# is more accurate than func_trace_sed, but it only works with
+# autoconf >= 2.69.
+if echo "AC_PREREQ([2.69])" \
+ | "$AUTOM4TE" --no-cache --language=Autoconf-without-aclocal-m4 - 2>&1; then
+ func_trace=func_trace_autoconf
+else
+ func_trace=func_trace_sed
+fi
+
# Check in which directory config.rpath etc. belong.
-auxdir=`func_trace AC_CONFIG_AUX_DIR "$configure_in"`
+auxdir=`"$func_trace" AC_CONFIG_AUX_DIR "$configure_in"`
if test -n "$auxdir"; then
auxdir="$auxdir/"
fi
# Check in which directory gettext.m4 etc. belong.
-macrodirs=`func_trace AC_CONFIG_MACRO_DIR_TRACE "$configure_in"`
+macrodirs=`"$func_trace" AC_CONFIG_MACRO_DIR_TRACE "$configure_in"`
if test -z "$macrodirs"; then
- macrodirs=`func_trace AC_CONFIG_MACRO_DIR "$configure_in"`
+ macrodirs=`"$func_trace" AC_CONFIG_MACRO_DIR "$configure_in"`
fi
for arg in $macrodirs; do
m4dir="$arg"
done
# For simplicity we change to the gettext source directory.
-cd "$gettext_dir" ||
- func_fatal_error "gettext source directory '${gettext_dir}' doesn't exist"
+cd "$gettext_datadir" ||
+ func_fatal_error "gettext source directory '${gettext_datadir}' doesn't exist"
# Variables which keep track what has been modified.
added_directories=
for file in *; do
case $file in
ABOUT-NLS)
- func_linkorcopy $file "$gettext_dir/$file" $file
+ func_linkorcopy $file "$gettext_datadir/$file" $file
;;
config.rpath)
if test -f "$srcdir/$auxdir$file"; then
else
added_extradist="$added_extradist $auxdir$file"
fi
- func_linkorcopy $file "$gettext_dir/$file" "$auxdir$file"
+ func_linkorcopy $file "$gettext_datadir/$file" "$auxdir$file"
;;
esac
done
for file in *; do
if test $file != COPYING.LIB-2.0 && test $file != COPYING.LIB-2.1; then
if test $file != plural.c; then
- func_linkorcopy $file "$gettext_dir/intl/$file" intl/$file
+ func_linkorcopy $file "$gettext_datadir/intl/$file" intl/$file
else
# plural.c is a generated file; it must be copied and touched.
func_copy $file intl/$file
echo "Not copying intl/ directory."
# Tell the user what to put into configure.ac, if it is not already there.
external=
- xargs=`func_trace AM_GNU_GETTEXT "$srcdir/$configure_in"`
+ # Need to use func_trace_sed instead of $func_trace, since
+ # AM_GNU_GETTEXT is not a standard Autoconf trace.
+ xargs=`func_trace_sed AM_GNU_GETTEXT "$srcdir/$configure_in"`
save_IFS="$IFS"; IFS=:
for arg in $xargs; do
if test 'external' = "$arg"; then
fi
fi
func_backup "$podir/$file"
- func_linkorcopy $file "$gettext_dir/po/$file" "$podir/$file"
+ func_linkorcopy $file "$gettext_datadir/po/$file" "$podir/$file"
done
for file in *; do
case $file in
# Already handled above.
;;
Makevars.template)
- func_linkorcopy Makevars.template "$gettext_dir/po/Makevars.template" "$podir/Makevars.template"
+ func_linkorcopy Makevars.template "$gettext_datadir/po/Makevars.template" "$podir/Makevars.template"
if test -f "$srcdir/po/Makevars"; then
LC_ALL=C sed -n -e 's/[ ]*\([A-Za-z0-9_]*\)[ ]*=.*/\1/p' < "$srcdir/$podir/Makevars" | LC_ALL=C sort > "$srcdir/$podir/Makevars.tmp1"
LC_ALL=C sed -n -e 's/[ ]*\([A-Za-z0-9_]*\)[ ]*=.*/\1/p' < "$srcdir/$podir/Makevars.template" | LC_ALL=C sort > "$srcdir/$podir/Makevars.tmp2"
fi
fi
func_backup "$podir/$file"
- func_linkorcopy $file "$gettext_dir/po/$file" "$podir/$file"
+ func_linkorcopy $file "$gettext_datadir/po/$file" "$podir/$file"
;;
esac
done
func_modify_configure_in "(AC_OUTPUT): Remove command that created po/Makefile."
sed -e '/^\(dnl \|\)AC_LINK_FILES(\$nls_cv_header_libgt, \$nls_cv_header_intl)$/d' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
func_modify_configure_in "(AC_LINK_FILES): Remove invocation."
-sed -e 's/^AM_GNU_GETTEXT_VERSION([^()]*)/AM_GNU_GETTEXT_VERSION(['"$version"'])/' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
-func_modify_configure_in "(AM_GNU_GETTEXT_VERSION): Bump to $version."
+# AM_GNU_GETTEXT_VERSION may not be present, when AM_GNU_GETTEXT_REQUIRE_VERSION is used.
+if grep '^AM_GNU_GETTEXT_VERSION(' "$srcdir/$configure_in" 2>&1 >/dev/null; then
+ sed -e 's/^AM_GNU_GETTEXT_VERSION([^()]*)/AM_GNU_GETTEXT_VERSION(['"$archive_version"'])/' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
+ func_modify_configure_in "(AM_GNU_GETTEXT_VERSION): Bump to $archive_version."
+fi
$do_changelog && func_ChangeLog_finish
# Recommend replacement for deprecated Makefile variables.
if $doit; then
echo "$please"
echo "You might also want to copy the convenience header file gettext.h"
- echo "from the $gettext_dir directory into your package."
+ echo "from the $gettext_datadir directory into your package."
echo "It is a wrapper around <libintl.h> that implements the configure --disable-nls"
echo "option."
echo