#! /bin/sh
#
-# Copyright (C) 2002-2009 Free Software Foundation, Inc.
+# Copyright (C) 2002-2010 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
gnulib-tool --extract-description module
gnulib-tool --extract-status module
gnulib-tool --extract-notice module
+ gnulib-tool --extract-applicability module
gnulib-tool --extract-filelist module
gnulib-tool --extract-dependencies module
gnulib-tool --extract-autoconf-snippet module
fi
version=
fi
- year=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed 's,^.* ,,'`
+ year=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed -e 's,^.* ,,'`
echo "\
gnulib-tool (GNU $package $date)$version
Copyright (C) $year Free Software Foundation, Inc.
# outputs to stdout a header for a generated file.
func_emit_copyright_notice ()
{
- sed -n '/Copyright/ {
- p
- q
- }' < "$self_abspathname"
+ sed -n -e '/Copyright/ {
+ p
+ q
+ }' < "$self_abspathname"
echo "#"
echo "# This file is free software, distributed under the terms of the GNU"
echo "# General Public License. As a special exception to the GNU General"
&& test "X$1" != "X--no-reexec" \
&& test -n "$CONFIG_SHELL" \
&& test -f "$CONFIG_SHELL" \
- && $CONFIG_SHELL -c 'echo '\t' | grep t > /dev/null'; then
+ && $CONFIG_SHELL -c "echo '\\t' | grep t > /dev/null"; then
exec $CONFIG_SHELL "$0" --no-reexec "$@"
exit 127
fi
if test -n "$prereqs"; then
autoconf_minversion=`
for version in $prereqs; do echo $version; done |
- LC_ALL=C sort -nru | sed 1q
+ LC_ALL=C sort -nru | sed -e 1q
`
fi
fi
s/^Description:[ ]*$//
s/^Status:[ ]*$//
s/^Notice:[ ]*$//
+ s/^Applicability:[ ]*$//
s/^Files:[ ]*$//
s/^Depends-on:[ ]*$//
s/^configure\.ac-early:[ ]*$//
sed -n -e "/^Notice$sed_extract_prog" < "$lookedup_file"
}
+# func_get_applicability module
+# Input:
+# - local_gnulib_dir from --local-dir
+# The expected result (on stdout) is either 'main', or 'tests', or 'all'.
+func_get_applicability ()
+{
+ func_lookup_file "modules/$1"
+ { sed -n -e "/^Applicability$sed_extract_prog" < "$lookedup_file"
+ # The default is 'main' or 'tests', depending on the module's name.
+ case "$1" in
+ *-tests) echo "tests";;
+ *) echo "main";;
+ esac
+ } | sed -e 's,^ *$,,' | sed -e 1q
+}
+
# func_get_filelist module
# Input:
# - local_gnulib_dir from --local-dir
func_emit_copyright_notice
echo
uses_subdirs=
- (
+ {
for module in $modules; do
if $for_test; then
func_verify_tests_module
done
fi
done
- ) > allsnippets.tmp
+ } > allsnippets.tmp
# Generate dependencies here, since it eases the debugging of test failures.
# If there are source files in subdirectories, prevent collision of the
# object files (example: hash.c and libxml/hash.c).
# "AM_GNU_GETTEXT used but SUBDIRS not defined"
echo "SUBDIRS ="
echo "TESTS ="
+ echo "XFAIL_TESTS ="
echo "TESTS_ENVIRONMENT ="
echo "noinst_PROGRAMS ="
if ! $for_test; then
echo " if test -n \"\$${macro_prefix_arg}_LIBOBJS\"; then"
echo " # Remove the extension."
echo " sed_drop_objext='s/\\.o\$//;s/\\.obj\$//'"
- echo " for i in \`for i in \$${macro_prefix_arg}_LIBOBJS; do echo \"\$i\"; done | sed \"\$sed_drop_objext\" | sort | uniq\`; do"
+ echo " for i in \`for i in \$${macro_prefix_arg}_LIBOBJS; do echo \"\$i\"; done | sed -e \"\$sed_drop_objext\" | sort | uniq\`; do"
echo " ${macro_prefix_arg}_libobjs=\"\$${macro_prefix_arg}_libobjs \$i.\$ac_objext\""
echo " ${macro_prefix_arg}_ltlibobjs=\"\$${macro_prefix_arg}_ltlibobjs \$i.lo\""
echo " done"
# ignoring tests modules. Its lib/* sources go into $sourcebase/. If --lgpl
# is specified, it will consist only of LGPLed source.
# The tests-related module list is the transitive closure of the specified
- # modules, including tests modules, minus the main module list. Its lib/*
- # sources (brought in through dependencies of *-tests modules) go into
- # $testsbase/. It may contain GPLed source, even if --lgpl is specified.
+ # modules, including tests modules, minus the main module list excluding
+ # modules of applicability 'all'. Its lib/* sources (brought in through
+ # dependencies of *-tests modules) go into $testsbase/. It may contain GPLed
+ # source, even if --lgpl is specified.
# Determine main module list.
saved_inctests="$inctests"
inctests=""
fi
# Determine tests-related module list.
echo "$final_modules" | LC_ALL=C sort -u > "$tmp"/final-modules
- testsrelated_modules=`func_reset_sigpipe; echo "$main_modules" | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/final-modules`
+ testsrelated_modules=`func_reset_sigpipe
+ for module in $main_modules; do
+ if test \`func_get_applicability $module\` = main; then
+ echo $module
+ fi
+ done \
+ | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/final-modules`
if test $verbose -ge 1; then
echo "Tests-related module list:"
echo "$testsrelated_modules" | sed -e 's/^/ /'
case "$lgpl" in
yes | 3)
case $license in
- LGPL | LGPLv2+) ;;
+ LGPL | LGPLv2+ | LGPLv3+) ;;
*) func_append license_incompatibilities "$module $license$nl" ;;
esac
;;
esac
echo "gl_LOCAL_DIR([$relative_local_gnulib_dir])"
echo "gl_MODULES(["
- echo "$specified_modules" | sed 's/^/ /g'
+ echo "$specified_modules" | sed -e 's/^/ /g'
echo "])"
test -z "$incobsolete" || echo "gl_WITH_OBSOLETE"
echo "gl_AVOID([$avoidlist])"
-e "$sed_replace_build_aux"
if test "$module" = 'alloca' && test "$libtool" = true; then
echo 'changequote(,)dnl'
- echo 'LTALLOCA=`echo "$ALLOCA" | sed '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
+ echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
echo 'changequote([, ])dnl'
echo 'AC_SUBST([LTALLOCA])'
fi
if test -z "$modules"; then
# All modules together.
# Except config-h, which breaks all modules which use HAVE_CONFIG_H.
- # Except maintainer-makefile, which requires a cfg.mk file.
# Except ftruncate, mountlist, which abort the configuration on mingw. FIXME.
modules=`func_all_modules`
- modules=`for m in $modules; do case $m in config-h | maintainer-makefile | ftruncate | mountlist) ;; *) echo $m;; esac; done`
+ modules=`for m in $modules; do case $m in config-h | ftruncate | mountlist) ;; *) echo $m;; esac; done`
fi
modules=`for m in $modules; do echo $m; done | LC_ALL=C sort -u`
test -d "$testdir/$testsbase" || mkdir "$testdir/$testsbase"
# Viewed from the $testsbase subdirectory, $auxdir is different.
saved_auxdir="$auxdir"
- auxdir=`echo "$testsbase/"|sed 's%[^/][^/]*//*%../%g'`"$auxdir"
+ auxdir=`echo "$testsbase/" | sed -e 's%[^/][^/]*//*%../%g'`"$auxdir"
# Create $testsbase/Makefile.am.
use_libtests=false
destfile="$testsbase/Makefile.am"
echo "AC_CONFIG_AUX_DIR([$auxdir])"
echo "AM_INIT_AUTOMAKE"
echo
- echo "AM_CONFIG_HEADER([config.h])"
+ echo "AC_CONFIG_HEADERS([config.h])"
echo
echo "AC_PROG_CC"
echo "AC_PROG_INSTALL"
echo "AC_PROG_MAKE_SET"
echo "AC_PROG_RANLIB"
echo
+ if test -n "$uses_subdirs"; then
+ echo "AM_PROG_CC_C_O"
+ echo
+ fi
for module in $modules; do
func_verify_module
if test -n "$module"; then
# by "merging" config.h into $testsbase/config.h; look out for gcc warnings.
echo "AH_TOP([#include \"../config.h\"])"
echo
- echo "AC_OUTPUT([Makefile])"
+ echo "AC_CONFIG_FILES([Makefile])"
+ echo "AC_OUTPUT"
) > "$testdir/$testsbase/configure.ac"
auxdir="$saved_auxdir"
func_append subdirs " $testsbase"
fi
echo "AM_INIT_AUTOMAKE"
echo
- echo "AM_CONFIG_HEADER([config.h])"
+ echo "AC_CONFIG_HEADERS([config.h])"
echo
echo "AC_PROG_CC"
echo "AC_PROG_INSTALL"
*) func_append makefiles " $d/Makefile" ;;
esac
done
- echo "AC_OUTPUT([$makefiles])"
+ echo "AC_CONFIG_FILES([$makefiles])"
+ echo "AC_OUTPUT"
) > "$testdir/configure.ac"
# Create autogenerated files.
done
# Then, all modules all together.
# Except config-h, which breaks all modules which use HAVE_CONFIG_H.
- # Except maintainer-makefile, which requires a cfg.mk file.
- allmodules=`for m in $allmodules; do if test $m != config-h && test $m != maintainer-makefile; then echo $m; fi; done`
+ allmodules=`for m in $allmodules; do if test $m != config-h; then echo $m; fi; done`
func_create_testdir "$megatestdir/ALL" "$allmodules"
func_append megasubdirs "ALL"
echo "AC_PROG_MAKE_SET"
echo
echo "AC_CONFIG_SUBDIRS([$megasubdirs])"
- echo "AC_OUTPUT([Makefile])"
+ echo "AC_CONFIG_FILES([Makefile])"
+ echo "AC_OUTPUT"
) > "$megatestdir/configure.ac"
# Create autogenerated files.
if test -f "$destdir"/configure.in; then
configure_ac="$destdir/configure.in"
else
- func_fatal_error "cannot find $destdir/configure.ac"
+ func_fatal_error "cannot find $destdir/configure.ac - make sure you run gnulib-tool from within your package's directory"
fi
fi
m4dirs=
m4dirs_count=0
if test -f "$destdir"/Makefile.am; then
- aclocal_amflags=`sed -n 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/p' "$destdir"/Makefile.am`
+ aclocal_amflags=`sed -n -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/p' "$destdir"/Makefile.am`
m4dir_is_next=
for arg in $aclocal_amflags; do
if test -n "$m4dir_is_next"; then
sedexpr2='s,^[^/]*$,.,'
sedexpr3='s,/[^/]*$,,'
m4dirs=`sed -n -e "$sedexpr1" aclocal.m4 | sed -e "$sedexpr2" -e "$sedexpr3" | LC_ALL=C sort -u`
- m4dirs_count=`echo "$m4dirs" | wc -l`
+ m4dirs_count=`printf %s "$m4dirs" | wc -l`
fi
fi
if test $m4dirs_count = 0; then
done
;;
+ extract-applicability )
+ for module
+ do
+ func_verify_module
+ if test -n "$module"; then
+ func_get_applicability "$module"
+ fi
+ done
+ ;;
+
extract-filelist )
for module
do