X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=gnulib-tool;h=e3e928d06bcc738abaf9c9644f91fee5e6248927;hb=46f74723b3fd5b41bebc0fd9c10b642726a0d47e;hp=68fa095ec1dbae8e1245ab66f489bf1b7ef65256;hpb=52892b2c0be375d6799bb38232ee7b687d084524;p=gnulib.git diff --git a/gnulib-tool b/gnulib-tool index 68fa095ec..e3e928d06 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -1,6 +1,6 @@ #! /bin/sh # -# Copyright (C) 2002-2006 Free Software Foundation, Inc. +# Copyright (C) 2002-2007 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 @@ -22,7 +22,7 @@ progname=$0 package=gnulib -cvsdatestamp='$Date: 2006-11-13 19:07:29 $' +cvsdatestamp='$Date: 2007-01-09 13:44:33 $' last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'` version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'` nl=' @@ -66,10 +66,13 @@ if test -z "${AUTOPOINT}" || test -n "${GETTEXTPATH}"; then AUTOPOINT="${GETTEXTPATH}autopoint" fi -# GNU sort is needed. Set SORT to its location (not needed if it's called -# 'sort' and already in the PATH). -if test -z "$SORT"; then - SORT=sort +# When using GNU sed, turn off as many GNU extensions as possible, +# to minimize the risk of accidentally using non-portable features. +# However, do this only for gnulib-tool itself, not for the code that +# gnulib-tool generates, since we don't want "sed --posix" to leak +# into makefiles. +if (alias) > /dev/null 2>&1 && echo | sed --posix d >/dev/null 2>&1; then + alias sed='sed --posix' fi # func_usage @@ -182,7 +185,7 @@ Written by" "Bruno Haible" "and" "Simon Josefsson" # outputs to stdout a header for a generated file. func_emit_copyright_notice () { - echo "# Copyright (C) 2004-2006 Free Software Foundation, Inc." + echo "# Copyright (C) 2004-2007 Free Software Foundation, Inc." 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" @@ -690,11 +693,14 @@ func_ln_if_changed () s,^dnl .*$,, s, dnl .*$,, /AC_PREREQ/ { - s,^.*AC_PREREQ([[ ]*\([^])]*\).*$,prereqs="$prereqs \1",p + s,^.*AC_PREREQ([[ ]*\([^])]*\).*$,\1,p }' - eval `sed -n -e "$my_sed_traces" < "$configure_ac"` + prereqs=`sed -n -e "$my_sed_traces" < "$configure_ac"` if test -n "$prereqs"; then - autoconf_minversion=`for version in $prereqs; do echo $version; done | $SORT -g -u | tail -1` + autoconf_minversion=` + for version in $prereqs; do echo $version; done | + LC_ALL=C sort -nru | sed 1q + ` fi fi if test -z "$autoconf_minversion"; then @@ -808,12 +814,18 @@ func_all_modules () # Filter out unit test modules; they can be retrieved through # --extract-tests-module if desired. { - (cd "$gnulib_dir/modules" && ls -1) + (cd "$gnulib_dir" && find modules -type f -print | sed -e 's,^modules/,,') if test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules"; then - (cd "$local_gnulib_dir/modules" && ls -1 | sed -e 's,\.diff$,,') + (cd "$local_gnulib_dir" && find modules -type f -print | sed -e 's,^modules/,,' -e 's,\.diff$,,') fi } \ - | sed -e '/^CVS$/d' -e '/^ChangeLog$/d' -e '/^COPYING$/d' -e '/^README$/d' -e '/^TEMPLATE$/d' -e '/^TEMPLATE-TESTS$/d' -e '/~$/d' \ + | sed -e '/^CVS$/d' -e '/[/]CVS$/d' \ + -e '/^ChangeLog$/d' -e '/[/]ChangeLog$/d' \ + -e '/^COPYING$/d' -e '/[/]COPYING$/d' \ + -e '/^README$/d' -e '/[/]README$/d' \ + -e '/^TEMPLATE$/d' \ + -e '/^TEMPLATE-TESTS$/d' \ + -e '/~$/d' \ | sed -e '/-tests$/d' \ | LC_ALL=C sort -u } @@ -902,6 +914,7 @@ func_get_filelist () { func_lookup_file "modules/$1" sed -n -e "/^Files$sed_extract_prog" < "$lookedup_file" + echo m4/gnulib-common.m4 case "$autoconf_minversion" in 2.59) #echo m4/onceonly.m4 @@ -951,7 +964,7 @@ func_get_automake_snippet () s/\\$/\\/ ta }' - sed_extract_mentioned_files='s/^lib_SOURCES[ ]*+=[ ]*//p' + sed_extract_mentioned_files='s/^lib_SOURCES[ ]*+=[ ]*//p' already_mentioned_files=` \ sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file" \ | sed -e "$sed_combine_lines" \ @@ -1236,26 +1249,10 @@ func_emit_lib_Makefile_am () echo "AUTOMAKE_OPTIONS = 1.5 gnits${subdir_options}" fi echo - if grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *= *$libname\\.$libext\$" allsnippets.tmp > /dev/null; then - # One of the snippets already specifies an installation location for the - # library. Don't confuse automake by saying it should not be installed. - : - else - # By default, the generated library should not be installed. - echo "noinst_${perhapsLT}LIBRARIES $assign $libname.$libext" - fi - echo - echo "${libname}_${libext}_SOURCES =" - # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However, - # automake during its analyses looks for $(LIBOBJS), not for @LIBOBJS@. - echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${perhapsLT}LIBOBJS)" - echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${perhapsLT}LIBOBJS)" - echo "EXTRA_${libname}_${libext}_SOURCES =" - if test "$libtool" = true; then - echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)" - fi if test -z "$makefile_name"; then 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. if grep '^pkgdata_DATA *+=' allsnippets.tmp > /dev/null; then @@ -1275,6 +1272,25 @@ func_emit_lib_Makefile_am () echo "AM_CPPFLAGS =" fi echo + if grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *= *$libname\\.$libext\$" allsnippets.tmp > /dev/null; then + # One of the snippets already specifies an installation location for the + # library. Don't confuse automake by saying it should not be installed. + : + else + # By default, the generated library should not be installed. + echo "noinst_${perhapsLT}LIBRARIES += $libname.$libext" + fi + echo + echo "${libname}_${libext}_SOURCES =" + # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However, + # automake during its analyses looks for $(LIBOBJS), not for @LIBOBJS@. + echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${perhapsLT}LIBOBJS)" + echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${perhapsLT}LIBOBJS)" + echo "EXTRA_${libname}_${libext}_SOURCES =" + if test "$libtool" = true; then + echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)" + fi + echo cat allsnippets.tmp \ | sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g' echo @@ -2176,10 +2192,17 @@ func_import () echo "Finished." echo echo "You may need to add #include directives for the following .h files." + # Intersect $specified_modules and $modules + # (since $specified_modules is not necessarily of subset of $modules - some + # may have been skipped through --avoid, and since the elements of $modules + # but not in $specified_modules can go away without explicit notice - through + # changes in the module dependencies). + echo "$specified_modules" > "$tmp"/modules1 # a sorted list, one module per line + echo "$modules" > "$tmp"/modules2 # also a sorted list, one module per line # First the #include <...> directives without #ifs, sorted for convenience, # then the #include "..." directives without #ifs, sorted for convenience, # then the #include directives that are surrounded by #ifs. Not sorted. - for module in $modules; do + for module in `LC_ALL=C join "$tmp"/modules1 "$tmp"/modules2`; do include_directive=`func_get_include_directive "$module"` case "$nl$include_directive" in *"$nl#if"*) @@ -2247,6 +2270,30 @@ func_create_testdir () fi modules=`for m in $modules; do echo $m; done | LC_ALL=C sort -u` + # Check that the license of every module is consistent with the license of + # its dependencies. + saved_modules="$modules" + for requested_module in $saved_modules; do + requested_license=`func_get_license "$requested_module"` + if test "$requested_license" != GPL; then + # Here we use func_modules_transitive_closure, not just + # func_get_dependencies, so that we also detect weird situations like + # an LGPL module which depends on a GPLed build tool module which depends + # on a GPL module. + modules="$requested_module" + func_modules_transitive_closure + for module in $modules; do + license=`func_get_license "$module"` + case $license in + LGPL | 'GPLed build tool') ;; + 'public domain' | 'unlimited' | 'unmodifiable license text') ;; + *) echo "warning: module $requested_module depends on a module with an incompatible license: $module" 1>&2 ;; + esac + done + fi + done + modules="$saved_modules" + # Subdirectory names. sourcebase=gllib m4base=glm4 @@ -2383,7 +2430,6 @@ func_create_testdir () echo "gl_libdeps=" echo "gl_ltlibdeps=" fi - echo "gl_source_base='$testsbase'" # Wrap the set of autoconf snippets into an autoconf macro that is then # invoked. This is needed because autoconf does not support AC_REQUIRE # at the top level: @@ -2403,6 +2449,7 @@ func_create_testdir () # We don't have explicit ordering constraints between the various # autoconf snippets. It's cleanest to put those of the library before # those of the tests. + echo "gl_source_base='../$sourcebase'" for module in $modules; do func_verify_nontests_module if test -n "$module"; then @@ -2410,6 +2457,7 @@ func_create_testdir () | sed -e "$sed_replace_build_aux" fi done + echo "gl_source_base='.'" for module in $modules; do func_verify_tests_module if test -n "$module"; then @@ -2466,6 +2514,10 @@ func_create_testdir () echo "AC_PROG_INSTALL" echo "AC_PROG_MAKE_SET" echo + echo "# For autobuild." + echo "AC_CANONICAL_BUILD" + echo "AC_CANONICAL_HOST" + echo echo "m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace" echo "m4_pattern_allow([^gl_ES\$])dnl a valid locale name" echo "m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"