#! /bin/sh
#
-# Copyright (C) 2002-2011 Free Software Foundation, Inc.
+# Copyright (C) 2002-2012 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
--update update the current package, restore files omitted
from version control
--create-testdir create a scratch package with the given modules
+ (pass --with-tests to include the unit tests)
--create-megatestdir create a mega scratch package with the given modules
one by one and all together
+ (pass --with-tests to include the unit tests)
--test test the combination of the given modules
+ (pass --with-tests to include the unit tests)
(recommended to use CC=\"gcc -Wall\" here)
--megatest test the given modules one by one and all together
+ (pass --with-tests to include the unit tests)
(recommended to use CC=\"gcc -Wall\" here)
--extract-description extract the description
--extract-comment extract the comment
--extract-maintainer report the maintainer(s) inside gnulib
--extract-tests-module report the unit test module, if it exists
--copy-file copy a file that is not part of any module
+ --help Show this help text.
+ --version Show version and authorship information.
General options:
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
-
-Written by" "Bruno Haible" "and" "Simon Josefsson"
+"
+ printf "Written by %s, %s, and %s.\n" "Bruno Haible" "Paul Eggert" "Simon Josefsson"
}
# func_emit_copyright_notice
func_exit 1
fi
fi
- # This code helps migrating from --import to --add-import or --update. It can
- # be removed on 2012-01-01.
- if test "$mode" = import && test $# = 0; then
- echo "gnulib-tool: cowardly refusing to erase the module list." 1>&2
- echo "The meaning of the option '--import' has changed." 1>&2
- echo "See the documentation at" 1>&2
- echo "<http://www.gnu.org/software/gnulib/manual/html_node/Modified-imports.html>." 1>&2
- echo "For updating to a newer version of gnulib, use" 1>&2
- echo " gnulib-tool --add-import" 1>&2
- echo "For restoring files that were omitted from version control, use" 1>&2
- echo " gnulib-tool --update" 1>&2
- func_exit 1
- fi
if test "$mode" = update; then
if test $# != 0; then
echo "gnulib-tool: too many arguments in 'update' mode" 1>&2
fi
}
-# func_get_license module
+# func_get_license_raw module
# Input:
# - local_gnulib_dir from --local-dir
# - modcache true or false, from --cache-modules/--no-cache-modules
-func_get_license ()
+func_get_license_raw ()
{
- {
- if ! $modcache; then
- func_lookup_file "modules/$1"
- sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
+ if ! $modcache; then
+ func_lookup_file "modules/$1"
+ sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
+ else
+ func_cache_lookup_module "$1"
+ # Output the field's value, including the final newline (if any).
+ if $have_associative; then
+ if eval 'test -n "${modcache_license[$1]+set}"'; then
+ eval 'echo "${modcache_license[$1]}"'
+ fi
else
- func_cache_lookup_module "$1"
- # Output the field's value, including the final newline (if any).
- if $have_associative; then
- if eval 'test -n "${modcache_license[$1]+set}"'; then
- eval 'echo "${modcache_license[$1]}"'
- fi
- else
- eval "field_set=\"\$${cachevar}_license_set\""
- if test -n "$field_set"; then
- eval "field_value=\"\$${cachevar}_license\""
- echo "${field_value}"
- fi
+ eval "field_set=\"\$${cachevar}_license_set\""
+ if test -n "$field_set"; then
+ eval "field_value=\"\$${cachevar}_license\""
+ echo "${field_value}"
fi
fi
+ fi
+}
+
+# func_get_license module
+# Input:
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+func_get_license ()
+{
+ # Warn if the License field is missing.
+ case "$1" in
+ *-tests ) ;;
+ * )
+ license=`func_get_license_raw "$1"`
+ if test -z "$license"; then
+ func_warning "module $1 lacks a License"
+ fi
+ ;;
+ esac
+ {
+ func_get_license_raw "$1"
# The default is GPL.
echo "GPL"
} | sed -e 's,^ *$,,' | sed -e 1q
;;
esac
done
- if $inc; then
+ if $inc && func_acceptable "$dep"; then
func_append inmodules " $dep"
if test "$cond_dependencies" = true; then
escaped_dep=`echo "$dep" | sed -e "$sed_escape_dependency"`
|| { test -n "$lsymbolic" \
&& test "$lookedup_file" = "$local_gnulib_dir/$f"; }; } \
&& test -z "$lookedup_tmp" \
- && cmp "$lookedup_file" "$tmpfile" > /dev/null; then
+ && cmp -s "$lookedup_file" "$tmpfile"; then
func_ln_if_changed "$lookedup_file" "$destdir/$g"
else
mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error "failed"
# - already_present nonempty if the file should already exist, empty otherwise
func_update_file ()
{
- if cmp "$destdir/$g" "$tmpfile" > /dev/null; then
+ if cmp -s "$destdir/$g" "$tmpfile"; then
: # The file has not changed.
else
# Replace the file.
|| { test -n "$lsymbolic" \
&& test "$lookedup_file" = "$local_gnulib_dir/$f"; }; } \
&& test -z "$lookedup_tmp" \
- && cmp "$lookedup_file" "$tmpfile" > /dev/null; then
+ && cmp -s "$lookedup_file" "$tmpfile"; then
func_ln_if_changed "$lookedup_file" "$destdir/$g"
else
mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error "failed"
echo "noinst_HEADERS ="
echo "noinst_LIBRARIES ="
echo "noinst_LTLIBRARIES ="
- # Automake versions < 1.9b create an empty pkgdatadir at installation time
- # if you specify pkgdata_DATA to empty. This is a workaround.
+ # Automake versions < 1.11.4 create an empty pkgdatadir at
+ # installation time if you specify pkgdata_DATA to empty.
+ # See automake bugs #10997 and #11030:
+ # * http://debbugs.gnu.org/10997
+ # * http://debbugs.gnu.org/11030
+ # So we need this workaround.
if grep '^pkgdata_DATA *+=' "$tmp"/allsnippets > /dev/null; then
echo "pkgdata_DATA ="
fi
echo "check_LIBRARIES = libtests.a"
fi
fi
- # Automake versions < 1.9b create an empty pkgdatadir at installation time
- # if you specify pkgdata_DATA to empty. This is a workaround.
+ # Automake versions < 1.11.4 create an empty pkgdatadir at
+ # installation time if you specify pkgdata_DATA to empty.
+ # See automake bugs #10997 and #11030:
+ # * http://debbugs.gnu.org/10997
+ # * http://debbugs.gnu.org/11030
+ # So we need this workaround.
if grep '^pkgdata_DATA *+=' "$tmp"/main_snippets "$tmp"/longrunning_snippets > /dev/null; then
echo "pkgdata_DATA ="
fi
# - local_gnulib_dir from --local-dir
# - modcache true or false, from --cache-modules/--no-cache-modules
# - sed_replace_build_aux sed expression that replaces reference to build-aux
+# - sed_replace_include_guard_prefix
+# sed expression for resolving ${gl_include_guard_prefix}
# - module the module name
# - toplevel true or false. 'false' means a subordinate use of
# gnulib-tool.
func_get_autoconf_snippet "$module" \
| sed -e '/^$/d;' -e "s/^/$indentation/" \
-e "$sed_replace_build_aux" \
+ -e "$sed_replace_include_guard_prefix" \
| { if $disable_libtool; then
sed -e 's/\$gl_cond_libtool/false/g' \
-e 's/gl_libdeps/gltests_libdeps/g' \
# - local_gnulib_dir from --local-dir
# - modcache true or false, from --cache-modules/--no-cache-modules
# - sed_replace_build_aux sed expression that replaces reference to build-aux
+# - sed_replace_include_guard_prefix
+# sed expression for resolving ${gl_include_guard_prefix}
# - modules the list of modules.
# - verifier one of func_verify_module, func_verify_nontests_module,
# func_verify_tests_module. It selects the subset of
disable_libtool="$4"
disable_gettext="$5"
if test "$cond_dependencies" = true; then
+ for m in $modules; do echo $m; done | LC_ALL=C sort -u > "$tmp"/modules
# Emit the autoconf code for the unconditional modules.
for module in $1; do
eval $verifier
func_emit_autoconf_snippet " "
echo " $shellvar=true"
deps=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
+ # Intersect $deps with the modules list $1.
+ deps=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
for dep in $deps; do
if func_cond_module_p "$dep"; then
func_module_shellfunc_name "$dep"
func_cond_module_condition "$module" "$dep"
if test "$condition" != true; then
- echo ' if $condition; then'
+ echo " if $condition; then"
echo " $shellfunc"
echo ' fi'
else
:
else
deps=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
+ # Intersect $deps with the modules list $1.
+ deps=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
for dep in $deps; do
if func_cond_module_p "$dep"; then
func_module_shellfunc_name "$dep"
modules="$main_modules"
func_emit_lib_Makefile_am > "$tmpfile"
if test -f "$destdir"/$sourcebase/$makefile_am; then
- if cmp "$destdir"/$sourcebase/$makefile_am "$tmpfile" > /dev/null; then
+ if cmp -s "$destdir"/$sourcebase/$makefile_am "$tmpfile"; then
rm -f "$tmpfile"
else
if $doit; then
func_lookup_file build-aux/po/$file
cat "$lookedup_file" > "$tmpfile"
if test -f "$destdir"/$pobase/$file; then
- if cmp "$destdir"/$pobase/$file "$tmpfile" > /dev/null; then
+ if cmp -s "$destdir"/$pobase/$file "$tmpfile"; then
rm -f "$tmpfile"
else
if $doit; then
func_dest_tmpfilename $pobase/Makevars
func_emit_po_Makevars > "$tmpfile"
if test -f "$destdir"/$pobase/Makevars; then
- if cmp "$destdir"/$pobase/Makevars "$tmpfile" > /dev/null; then
+ if cmp -s "$destdir"/$pobase/Makevars "$tmpfile"; then
rm -f "$tmpfile"
else
if $doit; then
func_dest_tmpfilename $pobase/POTFILES.in
func_emit_po_POTFILES_in > "$tmpfile"
if test -f "$destdir"/$pobase/POTFILES.in; then
- if cmp "$destdir"/$pobase/POTFILES.in "$tmpfile" > /dev/null; then
+ if cmp -s "$destdir"/$pobase/POTFILES.in "$tmpfile"; then
rm -f "$tmpfile"
else
if $doit; then
}
) > "$tmpfile"
if test -f "$destdir"/$pobase/LINGUAS; then
- if cmp "$destdir"/$pobase/LINGUAS "$tmpfile" > /dev/null; then
+ if cmp -s "$destdir"/$pobase/LINGUAS "$tmpfile"; then
rm -f "$tmpfile"
else
echo "Updating $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
fi
) > "$tmpfile"
if test -f "$destdir"/$m4base/gnulib-cache.m4; then
- if cmp "$destdir"/$m4base/gnulib-cache.m4 "$tmpfile" > /dev/null; then
+ if cmp -s "$destdir"/$m4base/gnulib-cache.m4 "$tmpfile"; then
rm -f "$tmpfile"
else
if $doit; then
echo "])"
) > "$tmpfile"
if test -f "$destdir"/$m4base/gnulib-comp.m4; then
- if cmp "$destdir"/$m4base/gnulib-comp.m4 "$tmpfile" > /dev/null; then
+ if cmp -s "$destdir"/$m4base/gnulib-comp.m4 "$tmpfile"; then
rm -f "$tmpfile"
else
if $doit; then
modules="$testsrelated_modules"
func_emit_tests_Makefile_am "${macro_prefix}tests_WITNESS" > "$tmpfile"
if test -f "$destdir"/$testsbase/$makefile_am; then
- if cmp "$destdir"/$testsbase/$makefile_am "$tmpfile" > /dev/null; then
+ if cmp -s "$destdir"/$testsbase/$makefile_am "$tmpfile"; then
rm -f "$tmpfile"
else
if $doit; then
echo " - mention \"${val}\" in ${var} in ${dir}Makefile.am,"
fi
done
- echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after AC_PROG_CC,"
+ if grep '^ *AC_PROG_CC_STDC' "$configure_ac" > /dev/null; then
+ position_early_after=AC_PROG_CC_STDC
+ else
+ if grep '^ *AC_PROG_CC_C99' "$configure_ac" > /dev/null; then
+ position_early_after=AC_PROG_CC_C99
+ else
+ position_early_after=AC_PROG_CC
+ fi
+ fi
+ echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after $position_early_after,"
echo " - invoke ${macro_prefix}_INIT in $configure_ac."
}
# its dependencies.
saved_inctests="$inctests"
# When computing transitive closures, don't consider $module to depend on
- # $module-tests. Need this becauses tests are implicitly GPL and may depend
+ # $module-tests. Need this because tests are implicitly GPL and may depend
# on GPL modules - therefore we don't want a warning in this case.
inctests=""
for requested_module in $specified_modules; do
;;
extract-dependencies )
+ if test -n "$avoidlist"; then
+ func_fatal_error "cannot combine --avoid and --extract-dependencies"
+ fi
for module
do
func_verify_module