X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=gnulib-tool;h=d8734167abacb1b6843eddd16f63ae1049cd22e4;hb=3030c5b5e0a5199e16b05927da72c43c42f211c3;hp=2c00b1fbe21b7822f05fe7d5175e2806e3a0b8c6;hpb=52ba377209500b66aaeb6142b3cd979a406a0d88;p=gnulib.git diff --git a/gnulib-tool b/gnulib-tool index 2c00b1fbe..d8734167a 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -115,6 +115,7 @@ Usage: gnulib-tool --list 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 @@ -252,7 +253,7 @@ q 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. @@ -267,10 +268,10 @@ Written by" "Bruno Haible" "and" "Simon Josefsson" # 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" @@ -703,7 +704,7 @@ if test -z "$have_echo" \ && 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 @@ -1177,7 +1178,7 @@ 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 @@ -1347,6 +1348,7 @@ sed_extract_prog=':[ ]*$/ { s/^Description:[ ]*$// s/^Status:[ ]*$// s/^Notice:[ ]*$// + s/^Applicability:[ ]*$// s/^Files:[ ]*$// s/^Depends-on:[ ]*$// s/^configure\.ac-early:[ ]*$// @@ -1389,6 +1391,22 @@ func_get_notice () 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 @@ -2216,7 +2234,7 @@ func_emit_tests_Makefile_am () func_emit_copyright_notice echo uses_subdirs= - ( + { for module in $modules; do if $for_test; then func_verify_tests_module @@ -2258,7 +2276,7 @@ func_emit_tests_Makefile_am () 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). @@ -2277,6 +2295,7 @@ func_emit_tests_Makefile_am () # "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 @@ -2432,7 +2451,7 @@ func_emit_initmacro_end () 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" @@ -2743,9 +2762,10 @@ func_import () # 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="" @@ -2759,7 +2779,13 @@ func_import () 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/^/ /' @@ -2807,7 +2833,7 @@ func_import () case "$lgpl" in yes | 3) case $license in - LGPL | LGPLv2+) ;; + LGPL | LGPLv2+ | LGPLv3+) ;; *) func_append license_incompatibilities "$module $license$nl" ;; esac ;; @@ -2869,11 +2895,22 @@ s,^\(.................................................[^ ]*\) *, sed_transform_main_lib_file=$sed_transform_main_lib_file' s/GNU Lesser General/GNU General/g s/GNU Library General/GNU General/g - s/version \(2\|2\.1\)\([ ,]\)/version 3\2/g + s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g ' fi fi + # Determine script to apply to auxiliary files that go into $auxdir/. + sed_transform_build_aux_file= + if test -n "$do_copyrights"; then + # Update license. + sed_transform_build_aux_file=$sed_transform_build_aux_file' + s/GNU Lesser General/GNU General/g + s/GNU Library General/GNU General/g + s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g + ' + fi + # Determine script to apply to library files that go into $testsbase/. sed_transform_testsrelated_lib_file="$sed_transform_lib_file" if test -n "$do_copyrights"; then @@ -2881,7 +2918,7 @@ s,^\(.................................................[^ ]*\) *, sed_transform_testsrelated_lib_file=$sed_transform_testsrelated_lib_file' s/GNU Lesser General/GNU General/g s/GNU Library General/GNU General/g - s/version \(2\|2\.1\)\([ ,]\)/version 3\2/g + s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g ' fi @@ -2917,22 +2954,25 @@ s,^\(.................................................[^ ]*\) *, func_append old_files " m4/gnulib-tool.m4" fi + rewritten='%REWRITTEN%' sed_rewrite_old_files="\ - s,^build-aux/,$auxdir/, - s,^doc/,$cached_docbase/, - s,^lib/,$cached_sourcebase/, - s,^m4/,$cached_m4base/, - s,^tests/,$cached_testsbase/, - s,^tests=lib/,$cached_testsbase/, - s,^top/,," + s,^build-aux/,$rewritten$auxdir/, + s,^doc/,$rewritten$cached_docbase/, + s,^lib/,$rewritten$cached_sourcebase/, + s,^m4/,$rewritten$cached_m4base/, + s,^tests/,$rewritten$cached_testsbase/, + s,^tests=lib/,$rewritten$cached_testsbase/, + s,^top/,$rewritten, + s,^$rewritten,," sed_rewrite_new_files="\ - s,^build-aux/,$auxdir/, - s,^doc/,$docbase/, - s,^lib/,$sourcebase/, - s,^m4/,$m4base/, - s,^tests/,$testsbase/, - s,^tests=lib/,$testsbase/, - s,^top/,," + s,^build-aux/,$rewritten$auxdir/, + s,^doc/,$rewritten$docbase/, + s,^lib/,$rewritten$sourcebase/, + s,^m4/,$rewritten$m4base/, + s,^tests/,$rewritten$testsbase/, + s,^tests=lib/,$rewritten$testsbase/, + s,^top/,$rewritten, + s,^$rewritten,," # Create directories. { echo "$sourcebase" @@ -3022,6 +3062,14 @@ s,^\(.................................................[^ ]*\) *, ;; esac fi + if test -n "$sed_transform_build_aux_file"; then + case "$of" in + build-aux/*) + sed -e "$sed_transform_build_aux_file" \ + < "$lookedup_file" > "$tmpfile" || func_fatal_error "failed" + ;; + esac + fi if test -n "$sed_transform_testsrelated_lib_file"; then case "$of" in tests=lib/*) @@ -3374,7 +3422,7 @@ s,//*$,/,' 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])" @@ -3499,7 +3547,7 @@ s,//*$,/,' -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 @@ -3883,13 +3931,15 @@ func_create_testdir () echo "$files" | sed -e 's/^/ /' fi + rewritten='%REWRITTEN%' sed_rewrite_files="\ - s,^build-aux/,$auxdir/, - s,^doc/,$docbase/, - s,^lib/,$sourcebase/, - s,^m4/,$m4base/, - s,^tests/,$testsbase/, - s,^top/,," + s,^build-aux/,$rewritten$auxdir/, + s,^doc/,$rewritten$docbase/, + s,^lib/,$rewritten$sourcebase/, + s,^m4/,$rewritten$m4base/, + s,^tests/,$rewritten$testsbase/, + s,^top/,$rewritten, + s,^$rewritten,," # Create directories. for f in $files; do echo $f; done \ @@ -3974,7 +4024,7 @@ func_create_testdir () 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" @@ -3986,13 +4036,17 @@ func_create_testdir () 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 @@ -4076,7 +4130,8 @@ func_create_testdir () # 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" @@ -4101,7 +4156,7 @@ func_create_testdir () 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" @@ -4192,7 +4247,8 @@ func_create_testdir () *) 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. @@ -4354,7 +4410,8 @@ func_create_megatestdir () 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. @@ -4393,7 +4450,7 @@ case $mode in 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 @@ -4437,7 +4494,7 @@ case $mode in 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 @@ -4467,7 +4524,7 @@ case $mode in 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 @@ -4605,6 +4662,16 @@ case $mode in 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 @@ -4715,13 +4782,15 @@ case $mode in test -n "$docbase" || docbase="doc" test -n "$testsbase" || testsbase="tests" test -n "$auxdir" || auxdir="build-aux" + rewritten='%REWRITTEN%' sed_rewrite_files="\ - s,^build-aux/,$auxdir/, - s,^doc/,$docbase/, - s,^lib/,$sourcebase/, - s,^m4/,$m4base/, - s,^tests/,$testsbase/, - s,^top/,," + s,^build-aux/,$rewritten$auxdir/, + s,^doc/,$rewritten$docbase/, + s,^lib/,$rewritten$sourcebase/, + s,^m4/,$rewritten$m4base/, + s,^tests/,$rewritten$testsbase/, + s,^top/,$rewritten, + s,^$rewritten,," if test -d "$dest"; then destdir="$dest" g=`echo "$f" | sed -e "$sed_rewrite_files"`