X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=gnulib-tool;h=67986a272ba292c538d9329952a03ed2807aa4a5;hb=2d44e171101261b1bd3c29e46a0a7a03b919286e;hp=397f442b35298b02fe5e87e9cb0c97e728584620;hpb=2046ebdc38bd1e6f4b69b901a46839bf1e82ab75;p=gnulib.git diff --git a/gnulib-tool b/gnulib-tool index 397f442b3..67986a272 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -1,6 +1,6 @@ #! /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 @@ -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" @@ -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 @@ -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" @@ -2744,9 +2763,9 @@ func_import () # 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 excluding - # 'link-warning'. Its lib/* sources (brought in through dependencies of - # *-tests modules) go into $testsbase/. It may contain GPLed source, even if - # --lgpl is specified. + # 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="" @@ -2760,8 +2779,13 @@ func_import () fi # Determine tests-related module list. echo "$final_modules" | LC_ALL=C sort -u > "$tmp"/final-modules - sed_remove_link_warning='/^link-warning$/d' - testsrelated_modules=`func_reset_sigpipe; echo "$main_modules" | LC_ALL=C sort -u | sed -e "$sed_remove_link_warning" | 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/^/ /' @@ -2809,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 ;; @@ -3398,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])" @@ -3523,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 @@ -4000,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" @@ -4470,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 @@ -4500,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 @@ -4638,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