summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2010-09-04 18:39:03 +0200
committerBruno Haible <bruno@clisp.org>2010-09-04 18:39:03 +0200
commit9577606baf039e2f0f13b051e38835be03fe0c28 (patch)
tree8f44f747d97c36fd4db395a3eba70cc221ae5a73
parentc45deef3be60127b0e3e99791464d58929a3b23e (diff)
downloadgnulib-9577606baf039e2f0f13b051e38835be03fe0c28.tar.gz
gnulib-tool: Change --import. New options --add/remove-import.
* gnulib-tool: New options --add-import, --remove-import. (func_usage): Document them. (have_associative): Define always. (func_import): In import mode, don't merge the specified settings with the cached settings. Implement remove-import mode. * doc/gnulib-tool.texi (Modified imports): Mention the new options. Explain when to use them versus --import. (Simple update): Use --add-import instead of --import. * NEWS: Mention the change.
-rw-r--r--ChangeLog13
-rw-r--r--NEWS6
-rw-r--r--doc/gnulib-tool.texi57
-rwxr-xr-xgnulib-tool484
4 files changed, 336 insertions, 224 deletions
diff --git a/ChangeLog b/ChangeLog
index 872879205c..11684bc626 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2010-09-04 Bruno Haible <bruno@clisp.org>
+ gnulib-tool: Change --import. New options --add/remove-import.
+ * gnulib-tool: New options --add-import, --remove-import.
+ (func_usage): Document them.
+ (have_associative): Define always.
+ (func_import): In import mode, don't merge the specified settings with
+ the cached settings. Implement remove-import mode.
+ * doc/gnulib-tool.texi (Modified imports): Mention the new options.
+ Explain when to use them versus --import.
+ (Simple update): Use --add-import instead of --import.
+ * NEWS: Mention the change.
+
+2010-09-04 Bruno Haible <bruno@clisp.org>
+
* doc/gnulib-tool.texi (Initial import): Update paragraph about
separate gnulib.mk.
diff --git a/NEWS b/NEWS
index 2015502cf5..e062efa650 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,12 @@
Important notes
---------------
+2010-09-04 gnulib-tool The option '--import' is no longer cumulative; it
+ now expects the complete list of modules and other
+ options on the command line. If you want to
+ augment (not set) the list of modules, use the
+ new option '--add-import' instead of '--import'.
+
User visible incompatible changes
---------------------------------
diff --git a/doc/gnulib-tool.texi b/doc/gnulib-tool.texi
index e9c376e4a2..e4908e8ae8 100644
--- a/doc/gnulib-tool.texi
+++ b/doc/gnulib-tool.texi
@@ -302,30 +302,48 @@ is built from the contents of a different variable, usually
You can at any moment decide to use Gnulib differently than the last time.
-If you only want to use more Gnulib modules, simply invoke
-@command{gnulib-tool --import @var{new-modules}}. @code{gnulib-tool}
-remembers which modules were used last time. The list of modules that
-you pass after @samp{--import} is @emph{added} to the previous list of
-modules.
+There are two ways to change how Gnulib is used. Which one you'll use,
+depends on where you keep track of options and module names that you pass
+to @code{gnulib-tool}.
-For most changes, such as added or removed modules, or even different
-choices of @samp{--lib}, @samp{--source-base} or @samp{--aux-dir}, there
-are two ways to perform the change.
-
-The standard way is to modify manually the file @file{gnulib-cache.m4}
-in the M4 macros directory, then launch @samp{gnulib-tool --import}.
+@itemize @bullet
+@item
+If you store the options and module names in a file under your own
+control, such as @file{autogen.sh}, @file{bootstrap},
+@file{bootstrap.conf}, or similar, simply invoke @command{gnulib-tool}
+again, with modified options and more or fewer module names.
-The other way is to call @command{gnulib-tool} again, with the changed
-command-line options. Note that this doesn't let you remove modules,
-because as you just learned, the list of modules is always cumulated.
-Also this way is often impractical, because you don't remember the way
-you invoked @code{gnulib-tool} last time.
+@item
+@code{gnulib-tool} remembers which modules were used last time. If you
+want to rely on @code{gnulib-tool}'s own memory of the last used
+options and module names, you can use the commands
+@command{gnulib-tool --add-import} and
+@command{gnulib-tool --remove-import}.
+
+So, if you only want to use more Gnulib modules, simply invoke
+@command{gnulib-tool --add-import @var{new-modules}}. The list of
+modules that you pass after @samp{--add-import} is @emph{added} to the
+previous list of modules.
+
+Similarly, if you want to use fewer Gnulib modules, simply invoke
+@command{gnulib-tool --remove-import @var{unneeded-modules}}. The list
+of modules that you pass after @samp{--remove-import} is @emph{removed}
+from the previous list of modules. Note that if a module is then still
+needed as dependency of other modules, it will be used nevertheless.
+If you want to @emph{really} not use a module any more, regardless of
+whether other modules may need it, you need to use the @samp{--avoid}
+option.
+
+For other changes, such as different choices of @samp{--lib},
+@samp{--source-base} or @samp{--aux-dir}, the normal way is to
+modify manually the file @file{gnulib-cache.m4} in the M4 macros
+directory, then launch @samp{gnulib-tool --add-import}.
The only change for which this doesn't work is a change of the
@samp{--m4-base} directory. Because, when you pass a different value of
@samp{--m4-base}, @code{gnulib-tool} will not find the previous
-@file{gnulib-cache.m4} file any more... A possible solution is to manually
-copy the @file{gnulib-cache.m4} into the new M4 macro directory.
+@file{gnulib-cache.m4} file any more... A possible solution is to
+manually copy the @file{gnulib-cache.m4} into the new M4 macro directory.
In the @file{gnulib-cache.m4}, the macros have the following meaning:
@table @code
@@ -372,6 +390,7 @@ The argument is the prefix to use for macros in the @file{gnulib-comp.m4}
file. Corresponds to the @samp{--macro-prefix} command line argument.
@end table
+@end itemize
@node Simple update
@section Simple update
@@ -381,7 +400,7 @@ changing the list of modules or other parameters, a simple call
does it:
@smallexample
-$ gnulib-tool --import
+$ gnulib-tool --add-import
@end smallexample
@noindent
diff --git a/gnulib-tool b/gnulib-tool
index b809dd1bd5..a0a0112cfb 100755
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -127,6 +127,8 @@ func_usage ()
Usage: gnulib-tool --list
gnulib-tool --find filename
gnulib-tool --import [module1 ... moduleN]
+ gnulib-tool --add-import [module1 ... moduleN]
+ gnulib-tool --remove-import [module1 ... moduleN]
gnulib-tool --update
gnulib-tool --create-testdir --dir=directory [module1 ... moduleN]
gnulib-tool --create-megatestdir --dir=directory [module1 ... moduleN]
@@ -151,9 +153,13 @@ Usage: gnulib-tool --list
Operation modes:
--list print the available module names
--find find the modules which contain the specified file
- --import import the given modules into the current package;
+ --import import the given modules into the current package
+ --add-import augment the list of imports from gnulib into the
+ current package, by adding the given modules;
if no modules are specified, update the current
package from the current gnulib
+ --remove-import reduce the list of imports from gnulib into the
+ current package, by removing the given modules
--update update the current package, restore files omitted
from version control
--create-testdir create a scratch package with the given modules
@@ -861,7 +867,8 @@ fi
# Command-line option processing.
# Removes the OPTIONS from the arguments. Sets the variables:
-# - mode list or import or create-testdir or create-megatestdir
+# - mode list or import or add-import or remove-import or update
+# or create-testdir or create-megatestdir
# - destdir from --dir
# - local_gnulib_dir from --local-dir
# - modcache true or false, from --cache-modules/--no-cache-modules
@@ -957,6 +964,12 @@ fi
--import | --impor | --impo | --imp | --im | --i )
mode=import
shift ;;
+ --add-import | --add-impor | --add-impo | --add-imp | --add-im | --add-i | --add- | --add | --ad )
+ mode=add-import
+ shift ;;
+ --remove-import | --remove-impor | --remove-impo | --remove-imp | --remove-im | --remove-i | --remove- | --remove | --remov | --remo | --rem | --re | --r )
+ mode=remove-import
+ shift ;;
--update | --updat | --upda | --upd | --up | --u )
mode=update
shift ;;
@@ -1214,10 +1227,10 @@ fi
esac
done
- if test "$mode" = import; then
+ if case "$mode" in import | add-import | remove-import) true;; *) false;; esac; then
if test -n "$excl_cxx_tests" || test -n "$excl_longrunning_tests" \
|| test -n "$excl_privileged_tests" || test -n "$excl_unportable_tests"; then
- echo "gnulib-tool: invalid options for 'import' mode" 1>&2
+ echo "gnulib-tool: invalid options for '$mode' mode" 1>&2
echo "Try 'gnulib-tool --help' for more information." 1>&2
func_exit 1
fi
@@ -1264,7 +1277,8 @@ fi
DEFAULT_AUTOCONF_MINVERSION="2.59"
autoconf_minversion=
configure_ac=
- if { test "$mode" = import || test "$mode" = update; } && test -n "$destdir"; then
+ if case "$mode" in import | add-import | remove-import | update) true;; *) false;; esac \
+ && test -n "$destdir"; then
if test -f "$destdir"/configure.ac; then
configure_ac="$destdir/configure.ac"
else
@@ -1350,6 +1364,15 @@ for signal in 1 2 3 13 15; do
done
signal=0
+# Note: The 'eval' silences stderr output in dash.
+if (declare -A x && { x[f/2]='foo'; x[f/3]='bar'; eval test '${x[f/2]}' = foo; }) 2>/dev/null; then
+ # Zsh 4 and Bash 4 have associative arrays.
+ have_associative=true
+else
+ # For other shells, use 'eval' with computed shell variable names.
+ have_associative=false
+fi
+
# func_lookup_file file
# looks up a file in $local_gnulib_dir or $gnulib_dir, or combines it through
# 'patch'.
@@ -1533,15 +1556,6 @@ sed_extract_field_header='
if $modcache; then
- # Note: The 'eval' silences stderr output in dash.
- if (declare -A x && { x[f/2]='foo'; x[f/3]='bar'; eval test '${x[f/2]}' = foo; }) 2>/dev/null; then
- # Zsh 4 and Bash 4 have associative arrays.
- have_associative=true
- else
- # For other shells, use 'eval' with computed shell variable names.
- have_associative=false
- fi
-
if $have_associative; then
# Declare the associative arrays.
@@ -3308,6 +3322,7 @@ func_emit_initmacro_done ()
# func_import modules
# Uses also the variables
+# - mode import or add-import or remove-import or update
# - destdir target directory
# - local_gnulib_dir from --local-dir
# - modcache true or false, from --cache-modules/--no-cache-modules
@@ -3351,6 +3366,8 @@ func_emit_initmacro_done ()
func_import ()
{
# Get the cached settings.
+ # In 'import' mode, we read them only for the purpose of knowing the old
+ # installed file list, and don't use them as defaults.
cached_local_gnulib_dir=
cached_specified_modules=
cached_incobsolete=
@@ -3480,130 +3497,174 @@ func_import ()
fi
fi
- # Merge the cached settings with the specified ones.
- # The m4base must be the same as expected from the pathname.
- if test -n "$cached_m4base" && test "$cached_m4base" != "$m4base"; then
- func_fatal_error "$m4base/gnulib-cache.m4 is expected to contain gl_M4_BASE([$m4base])"
- fi
- # The local_gnulib_dir defaults to the cached one. Recall that the cached one
- # is relative to $destdir, whereas the one we use is relative to . or absolute.
- if test -z "$local_gnulib_dir"; then
- if test -n "$cached_local_gnulib_dir"; then
- case "$destdir" in
- /*)
- local_gnulib_dir="$destdir/$cached_local_gnulib_dir" ;;
- *)
- case "$cached_local_gnulib_dir" in
- /*)
- local_gnulib_dir="$destdir/$cached_local_gnulib_dir" ;;
- *)
- func_relconcat "$destdir" "$cached_local_gnulib_dir"
- local_gnulib_dir="$relconcat" ;;
- esac ;;
- esac
+ if test "$mode" = import; then
+ # In 'import' mode, the new set of specified modules overrides the cached
+ # set of modules. Ignore the cached settings.
+ specified_modules="$1"
+ else
+ # Merge the cached settings with the specified ones.
+ # The m4base must be the same as expected from the pathname.
+ if test -n "$cached_m4base" && test "$cached_m4base" != "$m4base"; then
+ func_fatal_error "$m4base/gnulib-cache.m4 is expected to contain gl_M4_BASE([$m4base])"
fi
- fi
- # Append the cached and the specified module names. So that
- # "gnulib-tool --import foo" means to add the module foo.
- specified_modules="$cached_specified_modules $1"
- # Included obsolete modules among the dependencies if specified either way.
- if test -z "$incobsolete"; then
- incobsolete="$cached_incobsolete"
- fi
- # Included special kinds of tests modules among the dependencies if specified
- # either way.
- if test -z "$inc_cxx_tests"; then
- inc_cxx_tests="$cached_inc_cxx_tests"
- fi
- if test -z "$inc_longrunning_tests"; then
- inc_longrunning_tests="$cached_inc_longrunning_tests"
- fi
- if test -z "$inc_privileged_tests"; then
- inc_privileged_tests="$cached_inc_privileged_tests"
- fi
- if test -z "$inc_unportable_tests"; then
- inc_unportable_tests="$cached_inc_unportable_tests"
- fi
- if test -z "$inc_all_tests"; then
- inc_all_tests="$cached_inc_all_tests"
- fi
- # --without-*-tests options are not supported here.
- excl_cxx_tests=
- excl_longrunning_tests=
- excl_privileged_tests=
- excl_unportable_tests=
- # Append the cached and the specified avoidlist. This is probably better
- # than dropping the cached one when --avoid is specified at least once.
- avoidlist=`for m in $cached_avoidlist $avoidlist; do echo $m; done | LC_ALL=C sort -u`
- avoidlist=`echo $avoidlist`
-
- # The sourcebase defaults to the cached one.
- if test -z "$sourcebase"; then
- sourcebase="$cached_sourcebase"
+ # The local_gnulib_dir defaults to the cached one. Recall that the cached one
+ # is relative to $destdir, whereas the one we use is relative to . or absolute.
+ if test -z "$local_gnulib_dir"; then
+ if test -n "$cached_local_gnulib_dir"; then
+ case "$destdir" in
+ /*)
+ local_gnulib_dir="$destdir/$cached_local_gnulib_dir" ;;
+ *)
+ case "$cached_local_gnulib_dir" in
+ /*)
+ local_gnulib_dir="$destdir/$cached_local_gnulib_dir" ;;
+ *)
+ func_relconcat "$destdir" "$cached_local_gnulib_dir"
+ local_gnulib_dir="$relconcat" ;;
+ esac ;;
+ esac
+ fi
+ fi
+ case $mode in
+ add-import)
+ # Append the cached and the specified module names. So that
+ # "gnulib-tool --add-import foo" means to add the module foo.
+ specified_modules="$cached_specified_modules $1"
+ ;;
+ remove-import)
+ # Take the cached module names, minus the specified module names.
+ specified_modules=
+ if $have_associative; then
+ # Use an associative array, for O(N) worst-case run time.
+ declare -A to_remove
+ for m in $1; do
+ to_remove[$m]=yes
+ done
+ for module in $cached_specified_modules; do
+ if test -z "${to_remove[$module]}"; then
+ func_append specified_modules "$module "
+ fi
+ done
+ else
+ # This loop has O(N²) worst-case run time.
+ for module in $cached_specified_modules; do
+ to_remove=
+ for m in $1; do
+ if test "$m" = "$module"; then
+ to_remove=yes
+ break
+ fi
+ done
+ if test -z "$to_remove"; then
+ func_append specified_modules "$module "
+ fi
+ done
+ fi
+ ;;
+ update)
+ # Take the cached module names. There are no specified module names.
+ specified_modules="$cached_specified_modules"
+ ;;
+ esac
+ # Included obsolete modules among the dependencies if specified either way.
+ if test -z "$incobsolete"; then
+ incobsolete="$cached_incobsolete"
+ fi
+ # Included special kinds of tests modules among the dependencies if specified
+ # either way.
+ if test -z "$inc_cxx_tests"; then
+ inc_cxx_tests="$cached_inc_cxx_tests"
+ fi
+ if test -z "$inc_longrunning_tests"; then
+ inc_longrunning_tests="$cached_inc_longrunning_tests"
+ fi
+ if test -z "$inc_privileged_tests"; then
+ inc_privileged_tests="$cached_inc_privileged_tests"
+ fi
+ if test -z "$inc_unportable_tests"; then
+ inc_unportable_tests="$cached_inc_unportable_tests"
+ fi
+ if test -z "$inc_all_tests"; then
+ inc_all_tests="$cached_inc_all_tests"
+ fi
+ # Append the cached and the specified avoidlist. This is probably better
+ # than dropping the cached one when --avoid is specified at least once.
+ avoidlist=`for m in $cached_avoidlist $avoidlist; do echo $m; done | LC_ALL=C sort -u`
+ avoidlist=`echo $avoidlist`
+
+ # The sourcebase defaults to the cached one.
if test -z "$sourcebase"; then
- func_fatal_error "missing --source-base option"
+ sourcebase="$cached_sourcebase"
+ if test -z "$sourcebase"; then
+ func_fatal_error "missing --source-base option"
+ fi
fi
- fi
- # The pobase defaults to the cached one.
- if test -z "$pobase"; then
- pobase="$cached_pobase"
- fi
- # The docbase defaults to the cached one.
- if test -z "$docbase"; then
- docbase="$cached_docbase"
+ # The pobase defaults to the cached one.
+ if test -z "$pobase"; then
+ pobase="$cached_pobase"
+ fi
+ # The docbase defaults to the cached one.
if test -z "$docbase"; then
- func_fatal_error "missing --doc-base option. --doc-base has been introduced on 2006-07-11; if your last invocation of 'gnulib-tool --import' is before that date, you need to run 'gnulib-tool --import' once, with a --doc-base option."
+ docbase="$cached_docbase"
+ if test -z "$docbase"; then
+ func_fatal_error "missing --doc-base option. --doc-base has been introduced on 2006-07-11; if your last invocation of 'gnulib-tool --import' is before that date, you need to run 'gnulib-tool --import' once, with a --doc-base option."
+ fi
fi
- fi
- # The testsbase defaults to the cached one.
- if test -z "$testsbase"; then
- testsbase="$cached_testsbase"
+ # The testsbase defaults to the cached one.
if test -z "$testsbase"; then
- func_fatal_error "missing --tests-base option"
+ testsbase="$cached_testsbase"
+ if test -z "$testsbase"; then
+ func_fatal_error "missing --tests-base option"
+ fi
fi
- fi
- # Require the tests if specified either way.
- if test -z "$inctests"; then
- inctests="$cached_inctests"
- fi
- # The libname defaults to the cached one.
- if test -z "$supplied_libname"; then
- libname="$cached_libname"
- if test -z "$libname"; then
- func_fatal_error "missing --lib option"
+ # Require the tests if specified either way.
+ if test -z "$inctests"; then
+ inctests="$cached_inctests"
fi
- fi
- # Require LGPL if specified either way.
- if test -z "$lgpl"; then
- lgpl="$cached_lgpl"
- fi
- # The makefile_name defaults to the cached one.
- if test -z "$makefile_name"; then
- makefile_name="$cached_makefile_name"
- fi
- # Use libtool if specified either way, or if guessed.
- if test -z "$libtool"; then
- if test -n "$cached_m4base"; then
- libtool="$cached_libtool"
- else
- libtool="$guessed_libtool"
+ # The libname defaults to the cached one.
+ if test -z "$supplied_libname"; then
+ libname="$cached_libname"
+ if test -z "$libname"; then
+ func_fatal_error "missing --lib option"
+ fi
fi
- fi
- # The macro_prefix defaults to the cached one.
- if test -z "$macro_prefix"; then
- macro_prefix="$cached_macro_prefix"
+ # Require LGPL if specified either way.
+ if test -z "$lgpl"; then
+ lgpl="$cached_lgpl"
+ fi
+ # The makefile_name defaults to the cached one.
+ if test -z "$makefile_name"; then
+ makefile_name="$cached_makefile_name"
+ fi
+ # Use libtool if specified either way, or if guessed.
+ if test -z "$libtool"; then
+ if test -n "$cached_m4base"; then
+ libtool="$cached_libtool"
+ else
+ libtool="$guessed_libtool"
+ fi
+ fi
+ # The macro_prefix defaults to the cached one.
if test -z "$macro_prefix"; then
- func_fatal_error "missing --macro-prefix option"
+ macro_prefix="$cached_macro_prefix"
+ if test -z "$macro_prefix"; then
+ func_fatal_error "missing --macro-prefix option"
+ fi
+ fi
+ # The po_domain defaults to the cached one.
+ if test -z "$po_domain"; then
+ po_domain="$cached_po_domain"
+ fi
+ # The vc_files defaults to the cached one.
+ if test -z "$vc_files"; then
+ vc_files="$cached_vc_files"
fi
fi
- # The po_domain defaults to the cached one.
- if test -z "$po_domain"; then
- po_domain="$cached_po_domain"
- fi
- # The vc_files defaults to the cached one.
- if test -z "$vc_files"; then
- vc_files="$cached_vc_files"
- fi
+ # --without-*-tests options are not supported here.
+ excl_cxx_tests=
+ excl_longrunning_tests=
+ excl_privileged_tests=
+ excl_unportable_tests=
# Canonicalize the list of specified modules.
specified_modules=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
@@ -5429,7 +5490,7 @@ s/\([.*$]\)/[\1]/g'
done
;;
- import | update )
+ import | add-import | remove-import | update )
# Where to import.
if test -z "$destdir"; then
@@ -5469,96 +5530,109 @@ s/\([.*$]\)/[\1]/g'
fi
# Determine where to apply func_import.
- if test -n "$m4base"; then
+ if test "$mode" = import; then
# Apply func_import to a particular gnulib directory.
- # Any number of additional modules can be given.
- if test ! -f "$destdir/$m4base"/gnulib-cache.m4; then
- # First use of gnulib in the given m4base.
- test -n "$supplied_libname" || supplied_libname=true
- test -n "$sourcebase" || sourcebase="lib"
- test -n "$docbase" || docbase="doc"
- test -n "$testsbase" || testsbase="tests"
- test -n "$macro_prefix" || macro_prefix="gl"
- fi
+ # The command line contains the complete specification; don't look at
+ # the contents of gnulib-cache.m4.
+ test -n "$supplied_libname" || supplied_libname=true
+ test -n "$sourcebase" || sourcebase="lib"
+ test -n "$m4base" || m4base="m4"
+ test -n "$docbase" || docbase="doc"
+ test -n "$testsbase" || testsbase="tests"
+ test -n "$macro_prefix" || macro_prefix="gl"
func_import "$*"
else
- # Apply func_import to all gnulib directories.
- # To get this list of directories, look at Makefile.am. (Not at
- # configure, because it may be omitted from version control. Also,
- # don't run "find $destdir -name gnulib-cache.m4", as it might be
- # too expensive.)
- m4dirs=
- m4dirs_count=0
- if test -f "$destdir"/Makefile.am; then
- 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
- # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
- case "$arg" in
- /*) ;;
- *)
- if test -f "$destdir/$arg"/gnulib-cache.m4; then
- func_append m4dirs " $arg"
- m4dirs_count=`expr $m4dirs_count + 1`
- fi
- ;;
- esac
- m4dir_is_next=
- else
- if test "X$arg" = "X-I"; then
- m4dir_is_next=yes
- else
+ if test -n "$m4base"; then
+ # Apply func_import to a particular gnulib directory.
+ # Any number of additional modules can be given.
+ if test ! -f "$destdir/$m4base"/gnulib-cache.m4; then
+ # First use of gnulib in the given m4base.
+ test -n "$supplied_libname" || supplied_libname=true
+ test -n "$sourcebase" || sourcebase="lib"
+ test -n "$docbase" || docbase="doc"
+ test -n "$testsbase" || testsbase="tests"
+ test -n "$macro_prefix" || macro_prefix="gl"
+ fi
+ func_import "$*"
+ else
+ # Apply func_import to all gnulib directories.
+ # To get this list of directories, look at Makefile.am. (Not at
+ # configure, because it may be omitted from version control. Also,
+ # don't run "find $destdir -name gnulib-cache.m4", as it might be
+ # too expensive.)
+ m4dirs=
+ m4dirs_count=0
+ if test -f "$destdir"/Makefile.am; then
+ 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
+ # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
+ case "$arg" in
+ /*) ;;
+ *)
+ if test -f "$destdir/$arg"/gnulib-cache.m4; then
+ func_append m4dirs " $arg"
+ m4dirs_count=`expr $m4dirs_count + 1`
+ fi
+ ;;
+ esac
m4dir_is_next=
+ else
+ if test "X$arg" = "X-I"; then
+ m4dir_is_next=yes
+ else
+ m4dir_is_next=
+ fi
fi
+ done
+ else
+ # No Makefile.am! Oh well. Look at the last generated aclocal.m4.
+ if test -f "$destdir"/aclocal.m4; then
+ sedexpr1='s,^m4_include(\[\(.*\)])$,\1,p'
+ sedexpr2='s,^[^/]*$,.,'
+ sedexpr3='s,/[^/]*$,,'
+ m4dirs=`sed -n -e "$sedexpr1" aclocal.m4 | sed -e "$sedexpr2" -e "$sedexpr3" | LC_ALL=C sort -u`
+ m4dirs=`for arg in $m4dirs; do if test -f "$destdir/$arg"/gnulib-cache.m4; then echo $arg; fi; done`
+ m4dirs_count=`for arg in $m4dirs; do echo "$arg"; done | wc -l`
fi
- done
- else
- # No Makefile.am! Oh well. Look at the last generated aclocal.m4.
- if test -f "$destdir"/aclocal.m4; then
- sedexpr1='s,^m4_include(\[\(.*\)])$,\1,p'
- sedexpr2='s,^[^/]*$,.,'
- sedexpr3='s,/[^/]*$,,'
- m4dirs=`sed -n -e "$sedexpr1" aclocal.m4 | sed -e "$sedexpr2" -e "$sedexpr3" | LC_ALL=C sort -u`
- m4dirs=`for arg in $m4dirs; do if test -f "$destdir/$arg"/gnulib-cache.m4; then echo $arg; fi; done`
- m4dirs_count=`for arg in $m4dirs; do echo "$arg"; done | wc -l`
fi
- fi
- if test $m4dirs_count = 0; then
- # First use of gnulib in a package.
- # Any number of additional modules can be given.
- test -n "$supplied_libname" || supplied_libname=true
- test -n "$sourcebase" || sourcebase="lib"
- m4base="m4"
- test -n "$docbase" || docbase="doc"
- test -n "$testsbase" || testsbase="tests"
- test -n "$macro_prefix" || macro_prefix="gl"
- func_import "$*"
- else
- if test $m4dirs_count = 1; then
- # There's only one use of gnulib here. Assume the user means it.
+ if test $m4dirs_count = 0; then
+ # First use of gnulib in a package.
# Any number of additional modules can be given.
- for m4base in $m4dirs; do
- func_import "$*"
- done
+ test -n "$supplied_libname" || supplied_libname=true
+ test -n "$sourcebase" || sourcebase="lib"
+ m4base="m4"
+ test -n "$docbase" || docbase="doc"
+ test -n "$testsbase" || testsbase="tests"
+ test -n "$macro_prefix" || macro_prefix="gl"
+ func_import "$*"
else
- # Ambiguous - guess what the user meant.
- if test $# = 0; then
- # No further arguments. Guess the user wants to update all of them.
+ if test $m4dirs_count = 1; then
+ # There's only one use of gnulib here. Assume the user means it.
+ # Any number of additional modules can be given.
for m4base in $m4dirs; do
- # Perform func_import in a subshell, so that variable values
- # such as
- # local_gnulib_dir, incobsolete, inc_cxx_tests,
- # inc_longrunning_tests, inc_privileged_tests,
- # inc_unportable_tests, inc_all_tests, avoidlist, sourcebase,
- # m4base, pobase, docbase, testsbase, inctests, libname, lgpl,
- # makefile_name, libtool, macro_prefix, po_domain, vc_files
- # don't propagate from one directory to another.
- (func_import) || func_exit 1
+ func_import "$*"
done
else
- # Really ambiguous.
- func_fatal_error "Ambiguity: to which directory should the modules be added? Please specify at least --m4-base=..."
+ # Ambiguous - guess what the user meant.
+ if test $# = 0; then
+ # No further arguments. Guess the user wants to update all of them.
+ for m4base in $m4dirs; do
+ # Perform func_import in a subshell, so that variable values
+ # such as
+ # local_gnulib_dir, incobsolete, inc_cxx_tests,
+ # inc_longrunning_tests, inc_privileged_tests,
+ # inc_unportable_tests, inc_all_tests, avoidlist, sourcebase,
+ # m4base, pobase, docbase, testsbase, inctests, libname, lgpl,
+ # makefile_name, libtool, macro_prefix, po_domain, vc_files
+ # don't propagate from one directory to another.
+ (func_import) || func_exit 1
+ done
+ else
+ # Really ambiguous.
+ func_fatal_error "Ambiguity: to which directory should the modules be added? Please specify at least --m4-base=..."
+ fi
fi
fi
fi