3 # Copyright (C) 2002-2008 Free Software Foundation, Inc.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 # This program is meant for authors or maintainers which want to import
20 # modules from gnulib into their packages.
28 # You can set AUTOCONFPATH to empty if autoconf 2.57 is already in your PATH.
32 # AUTOCONFBINDIR=/packages/gnu-inst-autoconf/2.57/bin
33 # AUTOCONFPATH="eval env PATH=${AUTOCONFBINDIR}:\$PATH "
37 # You can set AUTOMAKEPATH to empty if automake 1.9.x is already in your PATH.
40 # You can set GETTEXTPATH to empty if autopoint 0.15 is already in your PATH.
43 # If you didn't set AUTOCONFPATH and AUTOMAKEPATH, you can also set the
44 # variables AUTOCONF, AUTOHEADER, ACLOCAL, AUTOMAKE, AUTORECONF individually.
45 if test -z "${AUTOCONF}" || test -n "${AUTOCONFPATH}"; then
46 AUTOCONF="${AUTOCONFPATH}autoconf"
48 if test -z "${AUTOHEADER}" || test -n "${AUTOCONFPATH}"; then
49 AUTOHEADER="${AUTOCONFPATH}autoheader"
51 if test -z "${ACLOCAL}" || test -n "${AUTOMAKEPATH}"; then
52 ACLOCAL="${AUTOMAKEPATH}aclocal"
54 if test -z "${AUTOMAKE}" || test -n "${AUTOMAKEPATH}"; then
55 AUTOMAKE="${AUTOMAKEPATH}automake"
57 if test -z "${AUTORECONF}" || test -n "${AUTOCONFPATH}"; then
58 AUTORECONF="${AUTOCONFPATH}autoreconf"
61 # If you didn't set GETTEXTPATH, you can also set the variable AUTOPOINT.
62 if test -z "${AUTOPOINT}" || test -n "${GETTEXTPATH}"; then
63 AUTOPOINT="${GETTEXTPATH}autopoint"
66 # When using GNU sed, turn off as many GNU extensions as possible,
67 # to minimize the risk of accidentally using non-portable features.
68 # However, do this only for gnulib-tool itself, not for the code that
69 # gnulib-tool generates, since we don't want "sed --posix" to leak
71 if (alias) > /dev/null 2>&1 && echo | sed --posix -e d >/dev/null 2>&1; then
72 # Define sed as an alias.
73 # It is not always possible to use aliases. Aliases are guaranteed to work
74 # if the executing shell is bash and either it is invoked as /bin/sh or
75 # is a version >= 2.0, supporting shopt. This is the common case.
76 # Two other approaches (use of a variable $sed or of a function func_sed
77 # instead of an alias) require massive, fragile code changes.
78 # An other approach (use of function sed) requires `which sed` - but 'which'
79 # is hard to emulate, due to missing "test -x" on some platforms.
80 if test -n "$BASH_VERSION"; then
81 shopt -s expand_aliases >/dev/null 2>&1
83 alias sed='sed --posix'
87 # outputs to stdout the --help usage message.
91 Usage: gnulib-tool --list
92 gnulib-tool --import [module1 ... moduleN]
94 gnulib-tool --create-testdir --dir=directory [module1 ... moduleN]
95 gnulib-tool --create-megatestdir --dir=directory [module1 ... moduleN]
96 gnulib-tool --test --dir=directory module1 ... moduleN
97 gnulib-tool --megatest --dir=directory [module1 ... moduleN]
98 gnulib-tool --extract-description module
99 gnulib-tool --extract-notice module
100 gnulib-tool --extract-filelist module
101 gnulib-tool --extract-dependencies module
102 gnulib-tool --extract-autoconf-snippet module
103 gnulib-tool --extract-automake-snippet module
104 gnulib-tool --extract-include-directive module
105 gnulib-tool --extract-link-directive module
106 gnulib-tool --extract-license module
107 gnulib-tool --extract-maintainer module
108 gnulib-tool --extract-tests-module module
111 --list print the available module names
112 --import import the given modules into the current package;
113 if no modules are specified, update the current
114 package from the current gnulib
115 --update update the current package, restore files omitted
117 --create-testdir create a scratch package with the given modules
118 --create-megatestdir create a mega scratch package with the given modules
119 one by one and all together
120 --test test the combination of the given modules
121 (recommended to use CC=\"gcc -Wall\" here)
122 --megatest test the given modules one by one and all together
123 (recommended to use CC=\"gcc -Wall\" here)
124 --extract-description extract the description
125 --extract-notice extract the notice or banner
126 --extract-filelist extract the list of files
127 --extract-dependencies extract the dependencies
128 --extract-autoconf-snippet extract the snippet for configure.ac
129 --extract-automake-snippet extract the snippet for library makefile
130 --extract-include-directive extract the #include directive
131 --extract-link-directive extract the linker directive
132 --extract-license report the license terms of the source files
134 --extract-maintainer report the maintainer(s) inside gnulib
135 --extract-tests-module report the unit test module, if it exists
138 --dir=DIRECTORY Specify the target directory.
139 For --import, this specifies where your
140 configure.ac can be found. Defaults to current
142 --local-dir=DIRECTORY Specify a local override directory where to look
143 up files before looking in gnulib's directory.
144 --verbose Increase verbosity. May be repeated.
145 --quiet Decrease verbosity. May be repeated.
147 Options for --import:
148 --lib=LIBRARY Specify the library name. Defaults to 'libgnu'.
149 --source-base=DIRECTORY
150 Directory relative to --dir where source code is
151 placed (default \"lib\").
152 --m4-base=DIRECTORY Directory relative to --dir where *.m4 macros are
153 placed (default \"m4\").
154 --po-base=DIRECTORY Directory relative to --dir where *.po files are
155 placed (default \"po\").
156 --doc-base=DIRECTORY Directory relative to --dir where doc files are
157 placed (default \"doc\").
158 --tests-base=DIRECTORY
159 Directory relative to --dir where unit tests are
160 placed (default \"tests\").
161 --aux-dir=DIRECTORY Directory relative to --dir where auxiliary build
162 tools are placed (default \"build-aux\").
163 --with-tests Include unit tests for the included modules.
164 --avoid=MODULE Avoid including the given MODULE. Useful if you
165 have code that provides equivalent functionality.
166 This option can be repeated.
167 --lgpl[=2|=3] Abort if modules aren't available under the LGPL.
168 Also modify license template from GPL to LGPL.
169 The version number of the LGPL can be specified;
170 the default is currently LGPLv3.
171 --makefile-name=NAME Name of makefile in automake syntax in the
172 source-base and tests-base directories
173 (default \"Makefile.am\").
174 --libtool Use libtool rules.
175 --no-libtool Don't use libtool rules.
176 --macro-prefix=PREFIX Specify the prefix of the macros 'gl_EARLY' and
177 'gl_INIT'. Default is 'gl'.
178 --po-domain=NAME Specify the prefix of the i18n domain. Usually use
179 the package name. A suffix '-gnulib' is appended.
180 --vc-files Update version control related files.
181 --no-vc-files Don't update version control related files
182 (.gitignore and/or .cvsignore).
183 --no-changelog Don't update or create ChangeLog files.
185 Options for --import and --update:
186 --dry-run For --import, only print what would have been done.
187 -s, --symbolic, --symlink Make symbolic links instead of copying files.
188 --local-symlink Make symbolic links instead of copying files, only
189 for files from the local override directory.
190 -S, --more-symlinks Make symbolic links instead of copying files, and
191 don't replace copyright notices.
193 Report bugs to <bug-gnulib@gnu.org>."
197 # outputs to stdout the --version message.
201 if test -d "$gnulib_dir"/.git \
202 && (git --version) >/dev/null 2>/dev/null \
203 && (date --version) >/dev/null 2>/dev/null; then
204 # gnulib checked out from git.
205 sed_extract_first_date='/^Date/{
209 date=`cd "$gnulib_dir" && git log ChangeLog | sed -n -e "$sed_extract_first_date"`
210 # Turn "Fri Mar 21 07:16:51 2008 -0600" into "Mar 21 2008 07:16:51 -0600".
211 sed_year_before_time='s/^[^ ]* \([^ ]*\) \([0-9]*\) \([0-9:]*\) \([0-9]*\) /\1 \2 \4 \3 /'
212 date=`echo "$date" | sed -e "$sed_year_before_time"`
213 # Use GNU date to compute the time in GMT.
214 date=`date -d "$date" -u +"%Y-%m-%d %H:%M:%S"`
215 version=' '`"$gnulib_dir"/build-aux/git-version-gen /dev/null | sed -e 's/-dirty/-modified/'`
217 if test -d "$gnulib_dir"/CVS \
218 && (cvs --version) >/dev/null 2>/dev/null; then
219 # gnulib checked out from CVS.
220 sed_extract_first_date='/^date: /{
221 s/^date: \([0-9][0-9][0-9][0-9]\).\([0-9][0-9]\).\([0-9][0-9]\) \([0-9][0-9]:[0-9][0-9]:[0-9][0-9]\).*/\1-\2-\3 \4/p
224 date=`cd "$gnulib_dir" && cvs log -N ChangeLog 2>/dev/null | sed -n -e "$sed_extract_first_date"`
226 # gnulib copy without versioning information.
227 date=`sed -e 's/ .*//;q' "$gnulib_dir"/ChangeLog`
231 year=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed 's,^.* ,,'`
233 gnulib-tool (GNU $package $date)$version
234 Copyright (C) $year Free Software Foundation, Inc.
235 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
236 This is free software: you are free to change and redistribute it.
237 There is NO WARRANTY, to the extent permitted by law.
239 Written by" "Bruno Haible" "and" "Simon Josefsson"
242 # func_emit_copyright_notice
243 # outputs to stdout a header for a generated file.
244 func_emit_copyright_notice ()
246 sed -n '/Copyright/ {
249 }' < "$self_abspathname"
251 echo "# This file is free software, distributed under the terms of the GNU"
252 echo "# General Public License. As a special exception to the GNU General"
253 echo "# Public License, this file may be distributed as part of a program"
254 echo "# that contains a configuration script generated by Autoconf, under"
255 echo "# the same distribution terms as the rest of that program."
257 echo "# Generated by gnulib-tool."
268 # locates the directory where the gnulib repository lives
270 # - self_abspathname absolute pathname of gnulib-tool
271 # - gnulib_dir absolute pathname of gnulib repository
275 /*) self_abspathname="$0" ;;
276 */*) self_abspathname=`pwd`/"$0" ;;
279 # Iterate through the elements of $PATH.
280 # We use IFS=: instead of
281 # for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'`
282 # because the latter does not work when some PATH element contains spaces.
283 # We use a canonicalized $pathx instead of $PATH, because empty PATH
284 # elements are by definition equivalent to '.', however field splitting
285 # according to IFS=: loses empty fields in many shells:
286 # - /bin/sh on OSF/1 and Solaris loses all empty fields (at the
287 # beginning, at the end, and in the middle),
288 # - /bin/sh on IRIX and /bin/ksh on IRIX and OSF/1 lose empty fields
289 # at the beginning and at the end,
290 # - GNU bash, /bin/sh on AIX and HP-UX, and /bin/ksh on AIX, HP-UX,
291 # Solaris lose empty fields at the end.
292 # The 'case' statement is an optimization, to avoid evaluating the
293 # explicit canonicalization command when $PATH contains no empty fields.
295 if test "${PATH_SEPARATOR+set}" != set; then
297 { echo "#! /bin/sh"; echo "exit 0"; } > "$tmp"/conf.sh
298 chmod +x "$tmp"/conf.sh
299 if (PATH="/nonexistent;$tmp"; conf.sh) >/dev/null 2>&1; then
306 if test "$PATH_SEPARATOR" = ";"; then
307 # On Windows, programs are searched in "." before $PATH.
310 # On Unix, we have to convert empty PATH elements to ".".
314 pathx=`echo ":$PATH:" | sed -e 's/:::*/:.:/g' -e 's/^://' -e 's/:\$//'`
319 IFS="$PATH_SEPARATOR"
323 if test -x "$d/$0" && test ! -d "$d/$0"; then
324 self_abspathname="$d/$0"
329 if test -z "$self_abspathname"; then
330 func_fatal_error "could not locate the gnulib-tool program - how did you invoke it?"
334 while test -h "$self_abspathname"; do
335 # Resolve symbolic link.
336 linkval=`func_readlink "$self_abspathname"`
337 test -n "$linkval" || break
339 /* ) self_abspathname="$linkval" ;;
340 * ) self_abspathname=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;;
343 gnulib_dir=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
347 # creates a temporary directory.
349 # - tmp pathname of freshly created temporary directory
352 # Use the environment variable TMPDIR, falling back to /tmp. This allows
353 # users to specify a different temporary directory, for example, if their
354 # /tmp is filled up or too small.
357 # Use the mktemp program if available. If not available, hide the error
359 tmp=`(umask 077 && mktemp -d "$TMPDIR/glXXXXXX") 2>/dev/null` &&
360 test -n "$tmp" && test -d "$tmp"
363 # Use a simple mkdir command. It is guaranteed to fail if the directory
364 # already exists. $RANDOM is bash specific and expands to empty in shells
365 # other than bash, ksh and zsh. Its use does not increase security;
366 # rather, it minimizes the probability of failure in a very cluttered /tmp
368 tmp=$TMPDIR/gl$$-$RANDOM
369 (umask 077 && mkdir "$tmp")
372 echo "$0: cannot create a temporary directory in $TMPDIR" >&2
377 # func_append var value
378 # appends the given value to the shell variable var.
379 if ( foo=bar; foo+=baz && test "$foo" = barbaz ) >/dev/null 2>&1; then
380 # Use bash's += operator. It reduces complexity of appending repeatedly to
381 # a single variable from O(n^2) to O(n).
389 eval "$1=\"\$$1\$2\""
393 # func_fatal_error message
394 # outputs to stderr a fatal error message, and terminates the program.
397 echo "gnulib-tool: *** $1" 1>&2
398 echo "gnulib-tool: *** Stop." 1>&2
402 # func_readlink SYMLINK
403 # outputs the target of the given symlink.
404 if (type -p readlink) > /dev/null 2>&1; then
407 # Use the readlink program from GNU coreutils.
413 # Use two sed invocations. A single sed -n -e 's,^.* -> \(.*\)$,\1,p'
414 # would do the wrong thing if the link target contains " -> ".
415 LC_ALL=C ls -l "$1" | sed -e 's, -> ,#%%#,' | sed -n -e 's,^.*#%%#\(.*\)$,\1,p'
419 # func_relativize DIR1 DIR2
420 # computes a relative pathname RELDIR such that DIR1/RELDIR = DIR2.
422 # - DIR1 relative pathname, relative to the current directory
423 # - DIR2 relative pathname, relative to the current directory
425 # - reldir relative pathname of DIR2, relative to DIR1
431 sed_first='s,^\([^/]*\)/.*$,\1,'
432 sed_rest='s,^[^/]*/*,,'
433 sed_last='s,^.*/\([^/]*\)$,\1,'
434 sed_butlast='s,/*[^/]*$,,'
435 while test -n "$dir1"; do
436 first=`echo "$dir1" | sed -e "$sed_first"`
437 if test "$first" != "."; then
438 if test "$first" = ".."; then
439 dir2=`echo "$dir0" | sed -e "$sed_last"`/"$dir2"
440 dir0=`echo "$dir0" | sed -e "$sed_butlast"`
442 first2=`echo "$dir2" | sed -e "$sed_first"`
443 if test "$first2" = "$first"; then
444 dir2=`echo "$dir2" | sed -e "$sed_rest"`
448 dir0="$dir0"/"$first"
451 dir1=`echo "$dir1" | sed -e "$sed_rest"`
456 # func_relconcat DIR1 DIR2
457 # computes a relative pathname DIR1/DIR2, with obvious simplifications.
459 # - DIR1 relative pathname, relative to the current directory
460 # - DIR2 relative pathname, relative to DIR1
462 # - relconcat DIR1/DIR2, relative to the current directory
467 sed_first='s,^\([^/]*\)/.*$,\1,'
468 sed_rest='s,^[^/]*/*,,'
469 sed_last='s,^.*/\([^/]*\)$,\1,'
470 sed_butlast='s,/*[^/]*$,,'
472 first=`echo "$dir2" | sed -e "$sed_first"`
473 if test "$first" = "."; then
474 dir2=`echo "$dir2" | sed -e "$sed_rest"`
475 if test -z "$dir2"; then
480 last=`echo "$dir1" | sed -e "$sed_last"`
481 while test "$last" = "."; do
482 dir1=`echo "$dir1" | sed -e "$sed_butlast"`
483 last=`echo "$dir1" | sed -e "$sed_last"`
485 if test -z "$dir1"; then
489 if test "$first" = ".."; then
490 if test "$last" = ".."; then
491 relconcat="$dir1/$dir2"
494 dir1=`echo "$dir1" | sed -e "$sed_butlast"`
495 dir2=`echo "$dir2" | sed -e "$sed_rest"`
496 if test -z "$dir1"; then
500 if test -z "$dir2"; then
505 relconcat="$dir1/$dir2"
513 # Like ln -s, except that SRC is given relative to the current directory (or
514 # absolute), not given relative to the directory of DEST.
520 *) # SRC is relative.
523 ln -s "`pwd`/$1" "$2" ;;
524 *) # DEST is relative too.
525 ln_destdir=`echo "$2" | sed -e 's,[^/]*$,,'`
526 test -n "$ln_destdir" || ln_destdir="."
527 func_relativize "$ln_destdir" "$1"
535 # func_ln_if_changed SRC DEST
536 # Like func_ln, but avoids munging timestamps if the link is correct.
537 func_ln_if_changed ()
539 if test $# -ne 2; then
540 echo "usage: func_ln_if_changed SRC DEST" >&2
542 ln_target=`func_readlink "$2"`
543 if test -h "$2" && test "$1" = "$ln_target"; then
551 # Ensure an 'echo' command that does not interpret backslashes.
553 # echo '\n' | wc -l prints 1 when OK, 2 when KO
554 # echo '\t' | grep t > /dev/null has return code 0 when OK, 1 when KO
555 # This problem is a weird heritage from SVR4. BSD got it right (except that
556 # BSD echo interprets '-n' as an option, which is also not desirable).
557 # Nowadays the problem occurs in 4 situations:
558 # - in bash, when the shell option xpg_echo is set (bash >= 2.04)
559 # or when it was built with --enable-usg-echo-default (bash >= 2.0)
560 # or when it was built with DEFAULT_ECHO_TO_USG (bash < 2.0),
561 # - in zsh, when sh-emulation is not set,
562 # - in ksh (e.g. AIX /bin/sh and Solaris /usr/xpg4/bin/sh are ksh instances,
563 # and HP-UX /bin/sh and IRIX /bin/sh behave similarly),
564 # - in Solaris /bin/sh and OSF/1 /bin/sh.
565 # We try the following workarounds:
566 # - for all: respawn using $CONFIG_SHELL if that is set and works.
567 # - for bash >= 2.04: unset the shell option xpg_echo.
568 # - for bash >= 2.0: define echo to a function that uses the printf built-in.
569 # - for bash < 2.0: define echo to a function that uses cat of a here document.
570 # - for zsh: turn sh-emulation on.
571 # - for ksh: alias echo to 'print -r'.
572 # - for ksh: alias echo to a function that uses cat of a here document.
573 # - for Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh and rely on
574 # the ksh workaround.
575 # - otherwise: respawn using /bin/sh and rely on the workarounds.
576 # When respawning, we pass --no-reexec as first argument, so as to avoid
577 # turning this script into a fork bomb in unlucky situations.
579 if echo '\t' | grep t > /dev/null; then
580 have_echo=yes # Lucky!
582 # Try the workarounds.
583 # Respawn using $CONFIG_SHELL if that is set and works.
584 if test -z "$have_echo" \
585 && test "X$1" != "X--no-reexec" \
586 && test -n "$CONFIG_SHELL" \
587 && test -f "$CONFIG_SHELL" \
588 && $CONFIG_SHELL -c 'echo '\t' | grep t > /dev/null'; then
589 exec $CONFIG_SHELL "$0" --no-reexec "$@"
592 # For bash >= 2.04: unset the shell option xpg_echo.
593 if test -z "$have_echo" \
594 && test -n "$BASH_VERSION" \
595 && (shopt -o xpg_echo; echo '\t' | grep t > /dev/null) 2>/dev/null; then
599 # For bash >= 2.0: define echo to a function that uses the printf built-in.
600 # For bash < 2.0: define echo to a function that uses cat of a here document.
601 # (There is no win in using 'printf' over 'cat' if it is not a shell built-in.)
602 if test -z "$have_echo" \
603 && test -n "$BASH_VERSION"; then \
604 if type printf 2>/dev/null | grep / > /dev/null; then
605 # 'printf' is not a shell built-in.
613 # 'printf' is a shell built-in.
619 if echo '\t' | grep t > /dev/null; then
623 # For zsh: turn sh-emulation on.
624 if test -z "$have_echo" \
625 && test -n "$ZSH_VERSION" \
626 && (emulate sh) >/dev/null 2>&1; then
629 # For ksh: alias echo to 'print -r'.
630 if test -z "$have_echo" \
631 && (type print) >/dev/null 2>&1; then
632 # A 'print' command exists.
633 if type print 2>/dev/null | grep / > /dev/null; then
636 # 'print' is a shell built-in.
637 if (print -r '\told' | grep told > /dev/null) 2>/dev/null; then
638 # 'print' is the ksh shell built-in.
639 alias echo='print -r'
643 if test -z "$have_echo" \
644 && echo '\t' | grep t > /dev/null; then
647 # For ksh: alias echo to a function that uses cat of a here document.
648 # The ksh manual page says:
649 # "Aliasing is performed when scripts are read, not while they are executed.
650 # Therefore, for an alias to take effect, the alias definition command has
651 # to be executed before the command which references the alias is read."
652 # Because of this, we have to play strange tricks with have_echo, to ensure
653 # that the top-level statement containing the test starts after the 'alias'
655 if test -z "$have_echo"; then
662 alias echo=bsd_echo 2>/dev/null
664 if test -z "$have_echo" \
665 && echo '\t' | grep t > /dev/null; then
668 if test -z "$have_echo"; then
669 unalias echo 2>/dev/null
671 # For Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh.
672 if test -z "$have_echo" \
673 && test "X$1" != "X--no-reexec" \
674 && test -f /bin/ksh; then
675 exec /bin/ksh "$0" --no-reexec "$@"
678 # Otherwise: respawn using /bin/sh.
679 if test -z "$have_echo" \
680 && test "X$1" != "X--no-reexec" \
681 && test -f /bin/sh; then
682 exec /bin/sh "$0" --no-reexec "$@"
685 if test -z "$have_echo"; then
686 func_fatal_error "Shell does not support 'echo' correctly. Please install GNU bash and set the environment variable CONFIG_SHELL to point to it."
688 if echo '\t' | grep t > /dev/null; then
691 func_fatal_error "Shell does not support 'echo' correctly. Workaround does not work. Please report this as a bug to bug-gnulib@gnu.org."
693 if test "X$1" = "X--no-reexec"; then
697 # Command-line option processing.
698 # Removes the OPTIONS from the arguments. Sets the variables:
699 # - mode list or import or create-testdir or create-megatestdir
700 # - destdir from --dir
701 # - local_gnulib_dir from --local-dir
702 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
703 # - libname, supplied_libname from --lib
704 # - sourcebase from --source-base
705 # - m4base from --m4-base
706 # - pobase from --po-base
707 # - docbase from --doc-base
708 # - testsbase from --tests-base
709 # - auxdir from --aux-dir
710 # - inctests true if --with-tests was given, blank otherwise
711 # - avoidlist list of modules to avoid, from --avoid
712 # - lgpl yes or a number if --lgpl was given, blank otherwise
713 # - makefile_name from --makefile-name
714 # - libtool true if --libtool was given, false if --no-libtool was
715 # given, blank otherwise
716 # - macro_prefix from --macro-prefix
717 # - po_domain from --po-domain
718 # - vc_files true if --vc-files was given, false if --no-vc-files was
719 # given, blank otherwise
720 # - autoconf_minversion minimum supported autoconf version
721 # - do_changelog false if --no-changelog was given, : otherwise
722 # - doit : if actions shall be executed, false if only to be printed
723 # - symbolic true if --symlink or --more-symlinks was given, blank
725 # - lsymbolic true if --local-symlink was given, blank otherwise
726 # - do_copyrights blank if --more-symlinks was given, true otherwise
756 while test $# -gt 0; do
761 --import | --impor | --impo | --imp | --im | --i )
764 --update | --updat | --upda | --upd | --up | --u )
767 --create-testdir | --create-testdi | --create-testd | --create-test | --create-tes | --create-te | --create-t )
770 --create-megatestdir | --create-megatestdi | --create-megatestd | --create-megatest | --create-megates | --create-megate | --create-megat | --create-mega | --create-meg | --create-me | --create-m )
771 mode=create-megatestdir
773 --test | --tes | --te | --t )
776 --megatest | --megates | --megate | --megat | --mega | --meg | --me | --m )
780 mode=`echo "X$1" | sed -e 's/^X--//'`
785 func_fatal_error "missing argument for --dir"
790 destdir=`echo "X$1" | sed -e 's/^X--dir=//'`
795 func_fatal_error "missing argument for --local-dir"
800 local_gnulib_dir=`echo "X$1" | sed -e 's/^X--local-dir=//'`
802 --verbose | --verbos | --verbo | --verb )
803 verbose=`expr $verbose + 1`
805 --quiet | --quie | --qui | --qu | --q )
806 verbose=`expr $verbose - 1`
811 func_fatal_error "missing argument for --lib"
814 supplied_libname=true
817 libname=`echo "X$1" | sed -e 's/^X--lib=//'`
818 supplied_libname=true
823 func_fatal_error "missing argument for --source-base"
828 sourcebase=`echo "X$1" | sed -e 's/^X--source-base=//'`
833 func_fatal_error "missing argument for --m4-base"
838 m4base=`echo "X$1" | sed -e 's/^X--m4-base=//'`
843 func_fatal_error "missing argument for --po-base"
848 pobase=`echo "X$1" | sed -e 's/^X--po-base=//'`
853 func_fatal_error "missing argument for --doc-base"
858 docbase=`echo "X$1" | sed -e 's/^X--doc-base=//'`
863 func_fatal_error "missing argument for --tests-base"
868 testsbase=`echo "X$1" | sed -e 's/^X--tests-base=//'`
873 func_fatal_error "missing argument for --aux-dir"
878 auxdir=`echo "X$1" | sed -e 's/^X--aux-dir=//'`
886 func_fatal_error "missing argument for --avoid"
888 func_append avoidlist " $1"
891 arg=`echo "X$1" | sed -e 's/^X--avoid=//'`
892 func_append avoidlist " $arg"
898 arg=`echo "X$1" | sed -e 's/^X--lgpl=//'`
901 *) func_fatal_error "invalid LGPL version number for --lgpl" ;;
908 func_fatal_error "missing argument for --makefile-name"
913 makefile_name=`echo "X$1" | sed -e 's/^X--makefile-name=//'`
924 func_fatal_error "missing argument for --macro-prefix"
929 macro_prefix=`echo "X$1" | sed -e 's/^X--macro-prefix=//'`
934 func_fatal_error "missing argument for --po-domain"
939 po_domain=`echo "X$1" | sed -e 's/^X--po-domain=//'`
947 --no-changelog | --no-changelo | --no-changel | --no-change | --no-chang | --no-chan | --no-cha | --no-ch | --no-c )
953 -s | --symbolic | --symboli | --symbol | --symbo | --symb | --symlink | --symlin | --symli | --syml | --sym | --sy )
956 --local-symlink | --local-symlin | --local-symli | --local-syml | --local-sym | --local-sy | --local-s )
959 -S | --more-symlinks | --more-symlink | --more-symlin | --more-symli | --more-syml | --more-sym | --more-sy | --more-s | --more- | --more | --mor | --mo )
963 --help | --hel | --he | --h )
966 --version | --versio | --versi | --vers )
970 # Stop option processing
974 echo "gnulib-tool: unknown option $1" 1>&2
975 echo "Try 'gnulib-tool --help' for more information." 1>&2
982 if test "$mode" = update; then
983 if test $# != 0; then
984 echo "gnulib-tool: too many arguments in 'update' mode" 1>&2
985 echo "Try 'gnulib-tool --help' for more information." 1>&2
986 echo "If you really want to modify the gnulib configuration of your project," 1>&2
987 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
990 if test -n "$local_gnulib_dir" || test -n "$supplied_libname" \
991 || test -n "$sourcebase" || test -n "$m4base" || test -n "$pobase" \
992 || test -n "$docbase" || test -n "$testsbase" || test -n "$auxdir" \
993 || test -n "$inctests" || test -n "$avoidlist" || test -n "$lgpl" \
994 || test -n "$makefile_name" || test -n "$macro_prefix" \
995 || test -n "$po_domain" || test -n "$vc_files"; then
996 echo "gnulib-tool: invalid options for 'update' mode" 1>&2
997 echo "Try 'gnulib-tool --help' for more information." 1>&2
998 echo "If you really want to modify the gnulib configuration of your project," 1>&2
999 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1004 if test -n "$pobase" && test -z "$po_domain"; then
1005 echo "gnulib-tool: together with --po-base, you need to specify --po-domain" 1>&2
1006 echo "Try 'gnulib-tool --help' for more information." 1>&2
1009 if test -z "$pobase" && test -n "$po_domain"; then
1010 echo "gnulib-tool: warning: --po-domain has no effect without a --po-base option" 1>&2
1013 # Determine the minimum supported autoconf version from the project's
1015 DEFAULT_AUTOCONF_MINVERSION="2.59"
1016 autoconf_minversion=
1018 if { test "$mode" = import || test "$mode" = update; } && test -n "$destdir"; then
1019 if test -f "$destdir"/configure.ac; then
1020 configure_ac="$destdir/configure.ac"
1022 if test -f "$destdir"/configure.in; then
1023 configure_ac="$destdir/configure.in"
1027 if test -f configure.ac; then
1028 configure_ac="configure.ac"
1030 if test -f configure.in; then
1031 configure_ac="configure.in"
1035 if test -n "$configure_ac"; then
1036 # Use sed, not autoconf --trace, to look for the AC_PREREQ invocation,
1037 # because when some m4 files are omitted from a CVS repository,
1038 # "autoconf --trace=AC_PREREQ" fails with an error message like this:
1039 # m4: aclocal.m4:851: Cannot open m4/absolute-header.m4: No such file or directory
1040 # autom4te: m4 failed with exit status: 1
1047 s,^.*AC_PREREQ([[ ]*\([^])]*\).*$,\1,p
1049 prereqs=`sed -n -e "$my_sed_traces" < "$configure_ac"`
1050 if test -n "$prereqs"; then
1051 autoconf_minversion=`
1052 for version in $prereqs; do echo $version; done |
1053 LC_ALL=C sort -nru | sed 1q
1057 if test -z "$autoconf_minversion"; then
1058 autoconf_minversion=$DEFAULT_AUTOCONF_MINVERSION
1060 case "$autoconf_minversion" in
1061 1.* | 2.[0-4]* | 2.5[0-8]*)
1062 func_fatal_error "minimum supported autoconf version is 2.59. Try adding AC_PREREQ([$DEFAULT_AUTOCONF_MINVERSION]) to your configure.ac." ;;
1065 # Remove trailing slashes from the directory names. This is necessary for
1066 # m4base (to avoid an error in func_import) and optional for the others.
1067 sed_trimtrailingslashes='s,\([^/]\)//*$,\1,'
1068 case "$local_gnulib_dir" in
1069 */ ) local_gnulib_dir=`echo "$local_gnulib_dir" | sed -e "$sed_trimtrailingslashes"` ;;
1071 case "$sourcebase" in
1072 */ ) sourcebase=`echo "$sourcebase" | sed -e "$sed_trimtrailingslashes"` ;;
1075 */ ) m4base=`echo "$m4base" | sed -e "$sed_trimtrailingslashes"` ;;
1078 */ ) pobase=`echo "$pobase" | sed -e "$sed_trimtrailingslashes"` ;;
1081 */ ) docbase=`echo "$docbase" | sed -e "$sed_trimtrailingslashes"` ;;
1083 case "$testsbase" in
1084 */ ) testsbase=`echo "$testsbase" | sed -e "$sed_trimtrailingslashes"` ;;
1087 */ ) auxdir=`echo "$auxdir" | sed -e "$sed_trimtrailingslashes"` ;;
1093 trap 'exit_status=$?
1094 if test "$signal" != 0; then
1095 echo "caught signal $signal" >&2
1098 exit $exit_status' 0
1099 for signal in 1 2 3 13 15; do
1100 trap '{ signal='$signal'; func_exit 1; }' $signal
1104 # func_lookup_file file
1105 # looks up a file in $local_gnulib_dir or $gnulib_dir, or combines it through
1108 # - local_gnulib_dir from --local-dir
1110 # - lookedup_file name of the merged (combined) file
1111 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
1115 if test -n "$local_gnulib_dir" && test -f "$local_gnulib_dir/$lkfile"; then
1116 lookedup_file="$local_gnulib_dir/$lkfile"
1119 if test -f "$gnulib_dir/$lkfile"; then
1120 if test -n "$local_gnulib_dir" && test -f "$local_gnulib_dir/$lkfile.diff"; then
1121 lkbase=`echo "$lkfile" | sed -e 's,^.*/,,'`
1122 rm -f "$tmp/$lkbase"
1123 cp "$gnulib_dir/$lkfile" "$tmp/$lkbase"
1124 patch -s "$tmp/$lkbase" < "$local_gnulib_dir/$lkfile.diff" \
1125 || func_fatal_error "patch file $local_gnulib_dir/$lkfile.diff didn't apply cleanly"
1126 lookedup_file="$tmp/$lkbase"
1129 lookedup_file="$gnulib_dir/$lkfile"
1133 func_fatal_error "file $gnulib_dir/$lkfile not found"
1140 # - local_gnulib_dir from --local-dir
1143 # Filter out metainformation files like README, which are not modules.
1144 # Filter out unit test modules; they can be retrieved through
1145 # --extract-tests-module if desired.
1147 (cd "$gnulib_dir" && find modules -type f -print | sed -e 's,^modules/,,')
1148 if test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules"; then
1149 (cd "$local_gnulib_dir" && find modules -type f -print | sed -e 's,^modules/,,' -e 's,\.diff$,,')
1152 | sed -e '/^CVS\//d' -e '/\/CVS\//d' \
1153 -e '/^ChangeLog$/d' -e '/\/ChangeLog$/d' \
1154 -e '/^COPYING$/d' -e '/\/COPYING$/d' \
1155 -e '/^README$/d' -e '/\/README$/d' \
1156 -e '/^TEMPLATE$/d' \
1157 -e '/^TEMPLATE-EXTENDED$/d' \
1158 -e '/^TEMPLATE-TESTS$/d' \
1161 | sed -e '/-tests$/d' \
1165 # func_verify_module
1166 # verifies a module name
1168 # - local_gnulib_dir from --local-dir
1169 # - module module name argument
1170 func_verify_module ()
1172 if { test -f "$gnulib_dir/modules/$module" \
1173 || { test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules" \
1174 && test -f "$local_gnulib_dir/modules/$module"; }; } \
1175 && test "CVS" != "$module" \
1176 && test "ChangeLog" != "$module" \
1177 && test "COPYING" != "$module" \
1178 && test "README" != "$module" \
1179 && test "TEMPLATE" != "$module" \
1180 && test "TEMPLATE-EXTENDED" != "$module" \
1181 && test "TEMPLATE-TESTS" != "$module"; then
1182 # OK, $module is a correct module name.
1183 # Verify that building the module description with 'patch' succeeds.
1184 func_lookup_file "modules/$module"
1186 echo "gnulib-tool: module $module doesn't exist" 1>&2
1191 # func_verify_nontests_module
1192 # verifies a module name, excluding tests modules
1194 # - local_gnulib_dir from --local-dir
1195 # - module module name argument
1196 func_verify_nontests_module ()
1199 *-tests ) module= ;;
1200 * ) func_verify_module ;;
1204 # func_verify_tests_module
1205 # verifies a module name, considering only tests modules
1207 # - local_gnulib_dir from --local-dir
1208 # - module module name argument
1209 func_verify_tests_module ()
1212 *-tests ) func_verify_module ;;
1217 sed_extract_prog=':[ ]*$/ {
1220 s/^Description:[ ]*$//
1223 s/^Depends-on:[ ]*$//
1224 s/^configure\.ac-early:[ ]*$//
1225 s/^configure\.ac:[ ]*$//
1226 s/^Makefile\.am:[ ]*$//
1230 s/^Maintainer:[ ]*$//
1237 # func_get_description module
1239 # - local_gnulib_dir from --local-dir
1240 func_get_description ()
1242 func_lookup_file "modules/$1"
1243 sed -n -e "/^Description$sed_extract_prog" < "$lookedup_file"
1246 # func_get_notice module
1248 # - local_gnulib_dir from --local-dir
1251 func_lookup_file "modules/$1"
1252 sed -n -e "/^Notice$sed_extract_prog" < "$lookedup_file"
1255 # func_get_filelist module
1257 # - local_gnulib_dir from --local-dir
1258 func_get_filelist ()
1260 func_lookup_file "modules/$1"
1261 sed -n -e "/^Files$sed_extract_prog" < "$lookedup_file"
1262 echo m4/gnulib-common.m4
1263 case "$autoconf_minversion" in
1270 # func_get_dependencies module
1272 # - local_gnulib_dir from --local-dir
1273 func_get_dependencies ()
1275 # ${module}-tests always implicitly depends on ${module}.
1276 echo "$1" | sed -n -e 's/-tests$//p'
1277 # Then the explicit dependencies listed in the module description.
1278 func_lookup_file "modules/$1"
1279 sed -n -e "/^Depends-on$sed_extract_prog" < "$lookedup_file"
1282 # func_get_autoconf_early_snippet module
1284 # - local_gnulib_dir from --local-dir
1285 func_get_autoconf_early_snippet ()
1287 func_lookup_file "modules/$1"
1288 sed -n -e "/^configure\.ac-early$sed_extract_prog" < "$lookedup_file"
1291 # func_get_autoconf_snippet module
1293 # - local_gnulib_dir from --local-dir
1294 func_get_autoconf_snippet ()
1296 func_lookup_file "modules/$1"
1297 sed -n -e "/^configure\.ac$sed_extract_prog" < "$lookedup_file"
1300 # func_get_automake_snippet module
1302 # - local_gnulib_dir from --local-dir
1303 func_get_automake_snippet ()
1305 func_lookup_file "modules/$1"
1306 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
1309 # *-tests module live in tests/, not lib/.
1310 # Synthesize an EXTRA_DIST augmentation.
1311 all_files=`func_get_filelist $1`
1312 tests_files=`for f in $all_files; do \
1314 tests/*) echo $f ;; \
1316 done | sed -e 's,^tests/,,'`
1317 extra_files="$tests_files"
1318 if test -n "$extra_files"; then
1319 echo "EXTRA_DIST +=" $extra_files
1324 # Synthesize an EXTRA_DIST augmentation.
1325 sed_combine_lines='/\\$/{
1332 sed_extract_mentioned_files='s/^lib_SOURCES[ ]*+=[ ]*//p'
1333 already_mentioned_files=` \
1334 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file" \
1335 | sed -e "$sed_combine_lines" \
1336 | sed -n -e "$sed_extract_mentioned_files" | sed -e 's/#.*//'`
1337 all_files=`func_get_filelist $1`
1338 lib_files=`for f in $all_files; do \
1342 done | sed -e 's,^lib/,,'`
1343 # Remove $already_mentioned_files from $lib_files.
1344 echo "$lib_files" | LC_ALL=C sort -u > "$tmp"/lib-files
1345 extra_files=`for f in $already_mentioned_files; do echo $f; done \
1346 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/lib-files`
1347 if test -n "$extra_files"; then
1348 echo "EXTRA_DIST +=" $extra_files
1351 # Synthesize also an EXTRA_lib_SOURCES augmentation.
1352 # This is necessary so that automake can generate the right list of
1354 # A possible approach would be to use autom4te --trace of the redefined
1355 # AC_LIBOBJ and AC_REPLACE_FUNCS macros when creating the Makefile.am
1356 # (use autom4te --trace, not just grep, so that AC_LIBOBJ invocations
1357 # inside autoconf's built-in macros are not missed).
1358 # But it's simpler and more robust to do it here, based on the file list.
1359 # If some .c file exists and is not used with AC_LIBOBJ - for example,
1360 # a .c file is preprocessed into another .c file for BUILT_SOURCES -,
1361 # automake will generate a useless dependency; this is harmless.
1363 relocatable-prog-wrapper) ;;
1365 sed_extract_c_files='/\.c$/p'
1366 extra_files=`echo "$extra_files" | sed -n -e "$sed_extract_c_files"`
1367 if test -n "$extra_files"; then
1368 echo "EXTRA_lib_SOURCES +=" $extra_files
1373 # Synthesize an EXTRA_DIST augmentation also for the files in build-aux/.
1374 buildaux_files=`for f in $all_files; do \
1376 build-aux/*) echo $f ;; \
1378 done | sed -e 's,^build-aux/,,'`
1379 if test -n "$buildaux_files"; then
1380 sed_prepend_auxdir='s,^,$(top_srcdir)/'"$auxdir"'/,'
1381 echo "EXTRA_DIST += "`echo "$buildaux_files" | sed -e "$sed_prepend_auxdir"`
1384 # Synthesize an EXTRA_DIST augmentation also for the files from top/.
1385 top_files=`for f in $all_files; do \
1389 done | sed -e 's,^top/,,'`
1390 if test -n "$top_files"; then
1391 sed_prepend_topdir='s,^,$(top_srcdir)/,'
1392 echo "EXTRA_DIST += "`echo "$top_files" | sed -e "$sed_prepend_topdir"`
1399 # func_get_include_directive module
1401 # - local_gnulib_dir from --local-dir
1402 func_get_include_directive ()
1404 func_lookup_file "modules/$1"
1405 sed -n -e "/^Include$sed_extract_prog" < "$lookedup_file" | \
1406 sed -e 's/^\(["<]\)/#include \1/'
1409 # func_get_link_directive module
1411 # - local_gnulib_dir from --local-dir
1412 func_get_link_directive ()
1414 func_lookup_file "modules/$1"
1415 sed -n -e "/^Link$sed_extract_prog" < "$lookedup_file"
1418 # func_get_license module
1420 # - local_gnulib_dir from --local-dir
1423 func_lookup_file "modules/$1"
1424 { sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
1425 # The default is GPL.
1427 } | sed -e 's,^ *$,,' | sed -e 1q
1430 # func_get_maintainer module
1432 # - local_gnulib_dir from --local-dir
1433 func_get_maintainer ()
1435 func_lookup_file "modules/$1"
1436 sed -n -e "/^Maintainer$sed_extract_prog" < "$lookedup_file"
1439 # func_get_tests_module module
1441 # - local_gnulib_dir from --local-dir
1442 func_get_tests_module ()
1444 # The naming convention for tests modules is hardwired: ${module}-tests.
1445 if test -f "$gnulib_dir/modules/$1"-tests \
1446 || { test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules" \
1447 && test -f "$local_gnulib_dir/modules/$1"-tests; }; then
1452 # func_acceptable module
1453 # tests whether a module is acceptable.
1455 # - avoidlist list of modules to avoid
1458 for avoid in $avoidlist; do
1459 if test "$avoid" = "$1"; then
1466 # func_modules_transitive_closure
1468 # - local_gnulib_dir from --local-dir
1469 # - modules list of specified modules
1470 # - inctests true if tests should be included, blank otherwise
1471 # - avoidlist list of modules to avoid
1472 # - tmp pathname of a temporary directory
1474 # - modules list of modules, including dependencies
1475 func_modules_transitive_closure ()
1477 # In order to process every module only once (for speed), process an "input
1478 # list" of modules, producing an "output list" of modules. During each round,
1479 # more modules can be queued in the input list. Once a module on the input
1480 # list has been processed, it is added to the "handled list", so we can avoid
1481 # to process it again.
1483 inmodules="$modules"
1485 while test -n "$inmodules"; do
1486 inmodules_this_round="$inmodules"
1487 inmodules= # Accumulator, queue for next round
1488 for module in $inmodules_this_round; do
1490 if test -n "$module"; then
1491 if func_acceptable $module; then
1492 func_append outmodules " $module"
1493 deps=`func_get_dependencies $module`
1494 # Duplicate dependencies are harmless, but Jim wants a warning.
1495 duplicated_deps=`echo "$deps" | LC_ALL=C sort | LC_ALL=C uniq -d`
1496 if test -n "$duplicated_deps"; then
1497 echo "warning: module $module has duplicated dependencies: "`echo $duplicated_deps` 1>&2
1499 func_append inmodules " $deps"
1500 if test -n "$inctests"; then
1501 testsmodule=`func_get_tests_module $module`
1502 if test -n "$testsmodule"; then
1503 func_append inmodules " $testsmodule"
1509 handledmodules=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
1510 # Remove $handledmodules from $inmodules.
1511 for m in $inmodules; do echo $m; done | LC_ALL=C sort -u > "$tmp"/queued-modules
1512 inmodules=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
1514 modules=`for m in $outmodules; do echo $m; done | LC_ALL=C sort -u`
1515 rm -f "$tmp"/queued-modules
1518 # func_modules_add_dummy
1520 # - local_gnulib_dir from --local-dir
1521 # - modules list of modules, including dependencies
1523 # - modules list of modules, including 'dummy' if needed
1524 func_modules_add_dummy ()
1527 sed_remove_backslash_newline=':a
1534 for module in $modules; do
1535 func_verify_nontests_module
1536 if test -n "$module"; then
1537 # Extract the value of "lib_SOURCES += ...".
1538 for file in `func_get_automake_snippet "$module" | sed -e "$sed_remove_backslash_newline" | sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'`; do
1539 # Ignore .h files since they are not compiled.
1542 *) have_lib_SOURCES=yes ;;
1547 # Add the dummy module, to make sure the library will be non-empty.
1548 if test -z "$have_lib_SOURCES"; then
1549 if func_acceptable "dummy"; then
1550 func_append modules " dummy"
1555 # func_modules_notice
1557 # - local_gnulib_dir from --local-dir
1558 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
1559 # - modules list of modules, including dependencies
1560 func_modules_notice ()
1562 if test $verbose -ge -1; then
1563 for module in $modules; do
1565 if test -n "$module"; then
1566 msg=`func_get_notice $module`
1567 if test -n "$msg"; then
1568 echo "Notice from module $module:"
1569 echo "$msg" | sed -e 's/^/ /'
1576 # func_modules_to_filelist
1578 # - local_gnulib_dir from --local-dir
1579 # - modules list of modules, including dependencies
1581 # - files list of files
1582 func_modules_to_filelist ()
1585 for module in $modules; do
1587 if test -n "$module"; then
1588 fs=`func_get_filelist $module`
1589 func_append files " $fs"
1592 files=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
1595 # func_execute_command command [args...]
1596 # Executes a command.
1597 # Uses also the variables
1598 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
1599 func_execute_command ()
1601 if test $verbose -ge 0; then
1605 # Commands like automake produce output to stderr even when the succeed.
1606 # Turn this output off if the command succeeds.
1607 "$@" > "$tmp"/cmdout 2>&1
1609 if test $cmdret = 0; then
1613 cat "$tmp"/cmdout 1>&2
1620 # func_emit_lib_Makefile_am
1621 # emits the contents of library makefile to standard output.
1623 # - local_gnulib_dir from --local-dir
1624 # - modules list of modules, including dependencies
1625 # - libname library name
1626 # - pobase directory relative to destdir where to place *.po files
1627 # - auxdir directory relative to destdir where to place build aux files
1628 # - makefile_name from --makefile-name
1629 # - libtool true if libtool will be used, false or blank otherwise
1630 # - macro_prefix prefix of gl_LIBOBJS macros to use
1631 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
1632 # - actioncmd (optional) command that will reproduce this invocation
1633 # - for_test true if creating a package for testing, false otherwise
1635 # - uses_subdirs nonempty if object files in subdirs exist
1636 func_emit_lib_Makefile_am ()
1638 # When creating an includable Makefile.am snippet, augment variables with
1639 # += instead of assigning them.
1640 if test -n "$makefile_name"; then
1645 if test "$libtool" = true; then
1648 sed_eliminate_LDFLAGS=
1652 sed_eliminate_LDFLAGS='/^lib_LDFLAGS[ ]*+=/d'
1655 # When creating a package for testing: Attempt to provoke failures,
1656 # especially link errors, already during "make" rather than during
1657 # "make check", because "make check" is not possible in a cross-compiling
1658 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
1659 sed_transform_check_PROGRAMS='s,check_PROGRAMS,noinst_PROGRAMS,g'
1661 sed_transform_check_PROGRAMS=
1663 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
1664 echo "## Process this file with automake to produce Makefile.in."
1665 func_emit_copyright_notice
1666 if test -n "$actioncmd"; then
1667 echo "# Reproduce by: $actioncmd"
1672 for module in $modules; do
1673 func_verify_nontests_module
1674 if test -n "$module"; then
1676 func_get_automake_snippet "$module" |
1677 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
1678 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
1679 -e "$sed_eliminate_LDFLAGS" \
1680 -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' \
1681 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
1682 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
1683 -e "$sed_transform_check_PROGRAMS"
1684 if test "$module" = 'alloca'; then
1685 echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
1686 echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@"
1689 # Skip the contents if its entirely empty.
1690 if grep '[^ ]' amsnippet.tmp > /dev/null ; then
1691 echo "## begin gnulib module $module"
1694 echo "## end gnulib module $module"
1698 # Test whether there are some source files in subdirectories.
1699 for f in `func_get_filelist "$module"`; do
1701 lib/*/*.c) uses_subdirs=yes ;;
1707 if test -z "$makefile_name"; then
1708 # If there are source files in subdirectories, prevent collision of the
1709 # object files (example: hash.c and libxml/hash.c).
1711 if test -n "$uses_subdirs"; then
1712 subdir_options=' subdir-objects'
1714 echo "AUTOMAKE_OPTIONS = 1.5 gnits${subdir_options}"
1717 if test -z "$makefile_name"; then
1718 echo "noinst_HEADERS ="
1719 echo "noinst_LIBRARIES ="
1720 echo "noinst_LTLIBRARIES ="
1721 # Automake versions < 1.9b create an empty pkgdatadir at installation time
1722 # if you specify pkgdata_DATA to empty. This is a workaround.
1723 if grep '^pkgdata_DATA *+=' allsnippets.tmp > /dev/null; then
1724 echo "pkgdata_DATA ="
1727 echo "BUILT_SOURCES ="
1730 echo "MOSTLYCLEANFILES $assign core *.stackdump"
1731 if test -z "$makefile_name"; then
1732 echo "MOSTLYCLEANDIRS ="
1734 echo "DISTCLEANFILES ="
1735 echo "MAINTAINERCLEANFILES ="
1737 echo "AM_CPPFLAGS ="
1740 if LC_ALL=C grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *= *$libname\\.$libext\$" allsnippets.tmp > /dev/null; then
1741 # One of the snippets already specifies an installation location for the
1742 # library. Don't confuse automake by saying it should not be installed.
1745 # By default, the generated library should not be installed.
1746 echo "noinst_${perhapsLT}LIBRARIES += $libname.$libext"
1749 echo "${libname}_${libext}_SOURCES ="
1750 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
1751 # automake during its analyses looks for $(LIBOBJS), not for @LIBOBJS@.
1752 echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
1753 echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
1754 echo "EXTRA_${libname}_${libext}_SOURCES ="
1755 if test "$libtool" = true; then
1756 echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)"
1759 if test -n "$pobase"; then
1760 echo "AM_CPPFLAGS += -DDEFAULT_TEXT_DOMAIN=\\\"${po_domain}-gnulib\\\""
1763 cat allsnippets.tmp \
1764 | sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
1766 echo "mostlyclean-local: mostlyclean-generic"
1767 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
1768 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
1769 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
1773 rm -f allsnippets.tmp
1776 # func_emit_po_Makevars
1777 # emits the contents of po/ makefile parametrization to standard output.
1779 # - local_gnulib_dir from --local-dir
1780 # - sourcebase directory relative to destdir where to place source code
1781 # - pobase directory relative to destdir where to place *.po files
1782 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
1783 func_emit_po_Makevars ()
1785 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
1786 func_emit_copyright_notice
1788 echo "# Usually the message domain is the same as the package name."
1789 echo "# But here it has a '-gnulib' suffix."
1790 echo "DOMAIN = ${po_domain}-gnulib"
1792 echo "# These two variables depend on the location of this directory."
1793 echo "subdir = ${pobase}"
1794 echo "top_builddir = "`echo "$pobase" | sed -e 's,//*,/,g' -e 's,[^/][^/]*,..,g'`
1797 # These options get passed to xgettext.
1798 XGETTEXT_OPTIONS = \
1799 --keyword=_ --flag=_:1:pass-c-format \
1800 --keyword=N_ --flag=N_:1:pass-c-format \
1801 --keyword='proper_name:1,"This is a proper name. See the gettext manual, section Names."' \
1802 --keyword='proper_name_utf8:1,"This is a proper name. See the gettext manual, section Names."' \
1803 --flag=error:3:c-format --flag=error_at_line:5:c-format
1805 # This is the copyright holder that gets inserted into the header of the
1806 # $(DOMAIN).pot file. gnulib is copyrighted by the FSF.
1807 COPYRIGHT_HOLDER = Free Software Foundation, Inc.
1809 # This is the email address or URL to which the translators shall report
1810 # bugs in the untranslated strings:
1811 # - Strings which are not entire sentences, see the maintainer guidelines
1812 # in the GNU gettext documentation, section 'Preparing Strings'.
1813 # - Strings which use unclear terms or require additional context to be
1815 # - Strings which make invalid assumptions about notation of date, time or
1817 # - Pluralisation problems.
1818 # - Incorrect English spelling.
1819 # - Incorrect formatting.
1820 # It can be your email address, or a mailing list address where translators
1821 # can write to without being subscribed, or the URL of a web page through
1822 # which the translators can contact you.
1823 MSGID_BUGS_ADDRESS = bug-gnulib@gnu.org
1825 # This is the list of locale categories, beyond LC_MESSAGES, for which the
1826 # message catalogs shall be used. It is usually empty.
1827 EXTRA_LOCALE_CATEGORIES =
1829 # This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
1830 # context. Possible values are "yes" and "no". Set this to yes if the
1831 # package uses functions taking also a message context, like pgettext(), or
1832 # if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
1837 # func_emit_po_POTFILES_in
1838 # emits the file list to be passed to xgettext to standard output.
1840 # - local_gnulib_dir from --local-dir
1841 # - sourcebase directory relative to destdir where to place source code
1842 # - files list of new files
1843 func_emit_po_POTFILES_in ()
1845 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
1846 func_emit_copyright_notice
1848 echo "# List of files which contain translatable strings."
1849 echo "$files" | sed -n -e "s,^lib/,$sourcebase/,p"
1852 # func_emit_tests_Makefile_am
1853 # emits the contents of tests makefile to standard output.
1855 # - local_gnulib_dir from --local-dir
1856 # - modules list of modules, including dependencies
1857 # - libname library name
1858 # - auxdir directory relative to destdir where to place build aux files
1859 # - makefile_name from --makefile-name
1860 # - libtool true if libtool will be used, false or blank otherwise
1861 # - sourcebase relative directory containing lib source code
1862 # - m4base relative directory containing autoconf macros
1863 # - testsbase relative directory containing unit test code
1864 # - macro_prefix prefix of gl_LIBOBJS macros to use
1865 # - for_test true if creating a package for testing, false otherwise
1866 # - use_libtests true if a libtests.a should be built, false otherwise
1868 # - uses_subdirs nonempty if object files in subdirs exist
1869 func_emit_tests_Makefile_am ()
1871 if test "$libtool" = true; then
1873 sed_eliminate_LDFLAGS=
1876 sed_eliminate_LDFLAGS='/^lib_LDFLAGS[ ]*+=/d'
1879 # When creating a package for testing: Attempt to provoke failures,
1880 # especially link errors, already during "make" rather than during
1881 # "make check", because "make check" is not possible in a cross-compiling
1882 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
1883 sed_transform_check_PROGRAMS='s,check_PROGRAMS,noinst_PROGRAMS,g'
1885 sed_transform_check_PROGRAMS=
1887 testsbase_inverse=`echo "$testsbase" | sed -e 's,/$,,' | sed -e 's,[^/][^/]*,..,g'`
1888 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
1889 echo "## Process this file with automake to produce Makefile.in."
1890 func_emit_copyright_notice
1894 for module in $modules; do
1896 func_verify_tests_module
1900 if test -n "$module"; then
1902 func_get_automake_snippet "$module" |
1903 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
1904 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
1905 -e "$sed_eliminate_LDFLAGS" \
1906 -e 's,lib_\([A-Z][A-Z]*\),libtests_a_\1,g' \
1907 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
1908 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
1909 -e "$sed_transform_check_PROGRAMS"
1910 if $use_libtests && test "$module" = 'alloca'; then
1911 echo "libtests_a_LIBADD += @${perhapsLT}ALLOCA@"
1912 echo "libtests_a_DEPENDENCIES += @${perhapsLT}ALLOCA@"
1915 # Skip the contents if its entirely empty.
1916 if grep '[^ ]' amsnippet.tmp > /dev/null ; then
1917 echo "## begin gnulib module $module"
1920 echo "## end gnulib module $module"
1924 # Test whether there are some source files in subdirectories.
1925 for f in `func_get_filelist "$module"`; do
1927 lib/*/*.c | tests/*/*.c) uses_subdirs=yes ;;
1933 # Generate dependencies here, since it eases the debugging of test failures.
1934 # If there are source files in subdirectories, prevent collision of the
1935 # object files (example: hash.c and libxml/hash.c).
1937 if test -n "$uses_subdirs"; then
1938 subdir_options=' subdir-objects'
1940 echo "AUTOMAKE_OPTIONS = 1.5 foreign${subdir_options}"
1943 echo "ACLOCAL_AMFLAGS = -I ${testsbase_inverse}/${m4base}"
1946 # Nothing is being added to SUBDIRS; nevertheless the existence of this
1947 # variable is needed to avoid an error from automake:
1948 # "AM_GNU_GETTEXT used but SUBDIRS not defined"
1951 echo "TESTS_ENVIRONMENT ="
1952 echo "noinst_PROGRAMS ="
1953 if ! $for_test; then
1954 echo "check_PROGRAMS ="
1956 echo "noinst_HEADERS ="
1957 echo "noinst_LIBRARIES ="
1958 if $use_libtests; then
1960 echo "noinst_LIBRARIES += libtests.a"
1962 echo "check_LIBRARIES = libtests.a"
1965 # Automake versions < 1.9b create an empty pkgdatadir at installation time
1966 # if you specify pkgdata_DATA to empty. This is a workaround.
1967 if grep '^pkgdata_DATA *+=' allsnippets.tmp > /dev/null; then
1968 echo "pkgdata_DATA ="
1971 echo "BUILT_SOURCES ="
1973 echo "MOSTLYCLEANFILES = core *.stackdump"
1974 echo "MOSTLYCLEANDIRS ="
1976 echo "DISTCLEANFILES ="
1977 echo "MAINTAINERCLEANFILES ="
1979 echo "AM_CPPFLAGS = \\"
1980 echo " -I. -I\$(srcdir) \\"
1981 echo " -I${testsbase_inverse} -I\$(srcdir)/${testsbase_inverse} \\"
1982 echo " -I${testsbase_inverse}/${sourcebase-lib} -I\$(srcdir)/${testsbase_inverse}/${sourcebase-lib}"
1984 local_ldadd_before=''
1985 local_ldadd_after=''
1986 if $use_libtests; then
1987 # All test programs need to be linked with libtests.a.
1988 # It needs to be passed to the linker before ${libname}.${libext}, since
1989 # the tests-related modules depend on the main modules.
1990 # It also needs to be passed to the linker after ${libname}.${libext}
1991 # because the latter might contain incomplete modules (such as the 'error'
1992 # module whose dependency to 'progname' is voluntarily omitted).
1993 # The LIBTESTS_LIBDEPS can be passed to the linker once or twice, it does
1995 local_ldadd_before=' libtests.a'
1996 local_ldadd_after=' libtests.a $(LIBTESTS_LIBDEPS)'
1998 echo "LDADD =${local_ldadd_before} ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext}${local_ldadd_after}"
2000 if $use_libtests; then
2001 echo "libtests_a_SOURCES ="
2002 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
2003 # automake during its analyses looks for $(LIBOBJS), not for @LIBOBJS@.
2004 echo "libtests_a_LIBADD = \$(${macro_prefix}tests_LIBOBJS)"
2005 echo "libtests_a_DEPENDENCIES = \$(${macro_prefix}tests_LIBOBJS)"
2006 echo "EXTRA_libtests_a_SOURCES ="
2007 # The circular dependency in LDADD requires this.
2008 echo "AM_LIBTOOLFLAGS = --preserve-dup-deps"
2011 cat allsnippets.tmp \
2012 | sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
2013 echo "# Clean up after Solaris cc."
2015 echo " rm -rf SunWS_cache"
2017 echo "mostlyclean-local: mostlyclean-generic"
2018 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
2019 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
2020 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
2024 rm -f allsnippets.tmp
2027 # func_emit_initmacro_start macro_prefix
2028 # emits the first few statements of the gl_INIT macro to standard output.
2029 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
2030 func_emit_initmacro_start ()
2032 macro_prefix_arg="$1"
2033 # Overriding AC_LIBOBJ and AC_REPLACE_FUNCS has the effect of storing
2034 # platform-dependent object files in ${macro_prefix_arg}_LIBOBJS instead of
2035 # LIBOBJS. The purpose is to allow several gnulib instantiations under
2036 # a single configure.ac file. (AC_CONFIG_LIBOBJ_DIR does not allow this
2038 # Furthermore it avoids an automake error like this when a Makefile.am
2039 # that uses pieces of gnulib also uses $(LIBOBJ):
2040 # automatically discovered file `error.c' should not be explicitly mentioned
2041 echo " m4_pushdef([AC_LIBOBJ], m4_defn([${macro_prefix_arg}_LIBOBJ]))"
2042 echo " m4_pushdef([AC_REPLACE_FUNCS], m4_defn([${macro_prefix_arg}_REPLACE_FUNCS]))"
2043 # Overriding AC_LIBSOURCES has the same purpose of avoiding the automake
2044 # error when a Makefile.am that uses pieces of gnulib also uses $(LIBOBJ):
2045 # automatically discovered file `error.c' should not be explicitly mentioned
2046 # We let automake know about the files to be distributed through the
2047 # EXTRA_lib_SOURCES variable.
2048 echo " m4_pushdef([AC_LIBSOURCES], m4_defn([${macro_prefix_arg}_LIBSOURCES]))"
2052 # func_emit_initmacro_end macro_prefix
2053 # emits the last few statements of the gl_INIT macro to standard output.
2054 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
2055 func_emit_initmacro_end ()
2057 macro_prefix_arg="$1"
2058 echo " m4_popdef([AC_LIBSOURCES])"
2059 echo " m4_popdef([AC_REPLACE_FUNCS])"
2060 echo " m4_popdef([AC_LIBOBJ])"
2061 echo " AC_CONFIG_COMMANDS_PRE(["
2062 echo " ${macro_prefix_arg}_libobjs="
2063 echo " ${macro_prefix_arg}_ltlibobjs="
2064 echo " if test -n \"\$${macro_prefix_arg}_LIBOBJS\"; then"
2065 echo " # Remove the extension."
2066 echo " sed_drop_objext='s/\\.o\$//;s/\\.obj\$//'"
2067 echo " for i in \`for i in \$${macro_prefix_arg}_LIBOBJS; do echo \"\$i\"; done | sed \"\$sed_drop_objext\" | sort | uniq\`; do"
2068 echo " ${macro_prefix_arg}_libobjs=\"\$${macro_prefix_arg}_libobjs \$i.\$ac_objext\""
2069 echo " ${macro_prefix_arg}_ltlibobjs=\"\$${macro_prefix_arg}_ltlibobjs \$i.lo\""
2072 echo " AC_SUBST([${macro_prefix_arg}_LIBOBJS], [\$${macro_prefix_arg}_libobjs])"
2073 echo " AC_SUBST([${macro_prefix_arg}_LTLIBOBJS], [\$${macro_prefix_arg}_ltlibobjs])"
2077 # func_emit_initmacro_done macro_prefix sourcebase
2078 # emits a few statements after the gl_INIT macro to standard output.
2079 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
2080 # - sourcebase directory relative to destdir where to place source code
2081 func_emit_initmacro_done ()
2083 macro_prefix_arg="$1"
2086 echo "# Like AC_LIBOBJ, except that the module name goes"
2087 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
2088 echo "AC_DEFUN([${macro_prefix_arg}_LIBOBJ], ["
2089 echo " AS_LITERAL_IF([\$1], [${macro_prefix_arg}_LIBSOURCES([\$1.c])])dnl"
2090 echo " ${macro_prefix_arg}_LIBOBJS=\"\$${macro_prefix_arg}_LIBOBJS \$1.\$ac_objext\""
2093 echo "# m4_foreach_w is provided by autoconf-2.59c and later."
2094 echo "# This definition is to accommodate developers using versions"
2095 echo "# of autoconf older than that."
2096 echo "m4_ifndef([m4_foreach_w],"
2097 echo " [m4_define([m4_foreach_w],"
2098 echo " [m4_foreach([\$1], m4_split(m4_normalize([\$2]), [ ]), [\$3])])])"
2100 echo "# Like AC_REPLACE_FUNCS, except that the module name goes"
2101 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
2102 echo "AC_DEFUN([${macro_prefix_arg}_REPLACE_FUNCS], ["
2103 echo " m4_foreach_w([gl_NAME], [\$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl"
2104 echo " AC_CHECK_FUNCS([\$1], , [${macro_prefix_arg}_LIBOBJ(\$ac_func)])"
2107 echo "# Like AC_LIBSOURCES, except the directory where the source file is"
2108 echo "# expected is derived from the gnulib-tool parametrization,"
2109 echo "# and alloca is special cased (for the alloca-opt module)."
2110 echo "# We could also entirely rely on EXTRA_lib..._SOURCES."
2111 echo "AC_DEFUN([${macro_prefix_arg}_LIBSOURCES], ["
2112 echo " m4_foreach([_gl_NAME], [\$1], ["
2113 echo " m4_if(_gl_NAME, [alloca.c], [], ["
2114 echo " m4_syscmd([test -r $sourcebase_arg/]_gl_NAME[ || test ! -d $sourcebase_arg])dnl"
2115 echo " m4_if(m4_sysval, [0], [],"
2116 echo " [AC_FATAL([missing $sourcebase_arg/]_gl_NAME)])"
2122 # func_import modules
2123 # Uses also the variables
2124 # - destdir target directory
2125 # - local_gnulib_dir from --local-dir
2126 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
2127 # - libname library name
2128 # - sourcebase directory relative to destdir where to place source code
2129 # - m4base directory relative to destdir where to place *.m4 macros
2130 # - pobase directory relative to destdir where to place *.po files
2131 # - docbase directory relative to destdir where to place doc files
2132 # - testsbase directory relative to destdir where to place unit test code
2133 # - auxdir directory relative to destdir where to place build aux files
2134 # - inctests true if --with-tests was given, blank otherwise
2135 # - avoidlist list of modules to avoid, from --avoid
2136 # - lgpl yes or a number if library's license shall be LGPL,
2138 # - makefile_name from --makefile-name
2139 # - libtool true if --libtool was given, false if --no-libtool was
2140 # given, blank otherwise
2141 # - guessed_libtool true if the configure.ac file uses libtool, false otherwise
2142 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
2143 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
2144 # - vc_files true if --vc-files was given, false if --no-vc-files was
2145 # given, blank otherwise
2146 # - autoconf_minversion minimum supported autoconf version
2147 # - doit : if actions shall be executed, false if only to be printed
2148 # - symbolic true if files should be symlinked, copied otherwise
2149 # - lsymbolic true if files from local_gnulib_dir should be symlinked,
2151 # - do_copyrights true if copyright notices in files should be replaced,
2155 # Get the cached settings.
2156 cached_local_gnulib_dir=
2157 cached_specified_modules=
2167 cached_makefile_name=
2169 cached_macro_prefix=
2173 if test -f "$destdir"/$m4base/gnulib-cache.m4; then
2174 cached_libtool=false
2180 s,^.*gl_LOCAL_DIR([[ ]*\([^])]*\).*$,cached_local_gnulib_dir="\1",p
2183 s,^.*gl_MODULES([[ ]*\([^])]*\).*$,cached_specified_modules="\1",p
2186 s,^.*gl_AVOID([[ ]*\([^])]*\).*$,cached_avoidlist="\1",p
2189 s,^.*gl_SOURCE_BASE([[ ]*\([^])]*\).*$,cached_sourcebase="\1",p
2192 s,^.*gl_M4_BASE([[ ]*\([^])]*\).*$,cached_m4base="\1",p
2195 s,^.*gl_PO_BASE([[ ]*\([^])]*\).*$,cached_pobase="\1",p
2198 s,^.*gl_DOC_BASE([[ ]*\([^])]*\).*$,cached_docbase="\1",p
2201 s,^.*gl_TESTS_BASE([[ ]*\([^])]*\).*$,cached_testsbase="\1",p
2204 s,^.*$,cached_inctests=true,p
2207 s,^.*gl_LIB([[ ]*\([^])]*\).*$,cached_libname="\1",p
2210 s,^.*gl_LGPL([[ ]*\([^])]*\).*$,cached_lgpl="\1",p
2213 s,^.*$,cached_lgpl=yes,p
2215 /gl_MAKEFILE_NAME(/ {
2216 s,^.*gl_MAKEFILE_NAME([[ ]*\([^])]*\).*$,cached_makefile_name="\1",p
2219 s,^.*$,cached_libtool=true,p
2221 /gl_MACRO_PREFIX(/ {
2222 s,^.*gl_MACRO_PREFIX([[ ]*\([^])]*\).*$,cached_macro_prefix="\1",p
2225 s,^.*gl_PO_DOMAIN([[ ]*\([^])]*\).*$,cached_po_domain="\1",p
2228 s,^.*gl_VC_FILES([[ ]*\([^])]*\).*$,cached_vc_files="\1",p
2230 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-cache.m4`
2231 if test -f "$destdir"/$m4base/gnulib-comp.m4; then
2236 /AC_DEFUN(\['"${cached_macro_prefix}"'_FILE_LIST\], \[/ {
2237 s,^.*$,cached_files=",p
2249 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-comp.m4`
2253 # Merge the cached settings with the specified ones.
2254 # The m4base must be the same as expected from the pathname.
2255 if test -n "$cached_m4base" && test "$cached_m4base" != "$m4base"; then
2256 func_fatal_error "$m4base/gnulib-cache.m4 is expected to contain gl_M4_BASE([$m4base])"
2258 # The local_gnulib_dir defaults to the cached one. Recall that the cached one
2259 # is relative to $destdir, whereas the one we use is relative to . or absolute.
2260 if test -z "$local_gnulib_dir"; then
2261 if test -n "$cached_local_gnulib_dir"; then
2264 local_gnulib_dir="$destdir/$cached_local_gnulib_dir" ;;
2266 case "$cached_local_gnulib_dir" in
2268 local_gnulib_dir="$destdir/$cached_local_gnulib_dir" ;;
2270 func_relconcat "$destdir" "$cached_local_gnulib_dir"
2271 local_gnulib_dir="$relconcat" ;;
2276 # Append the cached and the specified module names. So that
2277 # "gnulib-tool --import foo" means to add the module foo.
2278 specified_modules="$cached_specified_modules $1"
2279 # Append the cached and the specified avoidlist. This is probably better
2280 # than dropping the cached one when --avoid is specified at least once.
2281 avoidlist=`for m in $cached_avoidlist $avoidlist; do echo $m; done | LC_ALL=C sort -u`
2282 avoidlist=`echo $avoidlist`
2284 # The sourcebase defaults to the cached one.
2285 if test -z "$sourcebase"; then
2286 sourcebase="$cached_sourcebase"
2287 if test -z "$sourcebase"; then
2288 func_fatal_error "missing --source-base option"
2291 # The pobase defaults to the cached one.
2292 if test -z "$pobase"; then
2293 pobase="$cached_pobase"
2295 # The docbase defaults to the cached one.
2296 if test -z "$docbase"; then
2297 docbase="$cached_docbase"
2298 if test -z "$docbase"; then
2299 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."
2302 # The testsbase defaults to the cached one.
2303 if test -z "$testsbase"; then
2304 testsbase="$cached_testsbase"
2305 if test -z "$testsbase"; then
2306 func_fatal_error "missing --tests-base option"
2309 # Require the tests if specified either way.
2310 if test -z "$inctests"; then
2311 inctests="$cached_inctests"
2313 # The libname defaults to the cached one.
2314 if test -z "$supplied_libname"; then
2315 libname="$cached_libname"
2316 if test -z "$libname"; then
2317 func_fatal_error "missing --lib option"
2320 # Require LGPL if specified either way.
2321 if test -z "$lgpl"; then
2324 # The makefile_name defaults to the cached one.
2325 if test -z "$makefile_name"; then
2326 makefile_name="$cached_makefile_name"
2328 # Use libtool if specified either way, or if guessed.
2329 if test -z "$libtool"; then
2330 if test -n "$cached_m4base"; then
2331 libtool="$cached_libtool"
2333 libtool="$guessed_libtool"
2336 # The macro_prefix defaults to the cached one.
2337 if test -z "$macro_prefix"; then
2338 macro_prefix="$cached_macro_prefix"
2339 if test -z "$macro_prefix"; then
2340 func_fatal_error "missing --macro-prefix option"
2343 # The po_domain defaults to the cached one.
2344 if test -z "$po_domain"; then
2345 po_domain="$cached_po_domain"
2347 # The vc_files defaults to the cached one.
2348 if test -z "$vc_files"; then
2349 vc_files="$cached_vc_files"
2352 # Canonicalize the list of specified modules.
2353 specified_modules=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
2355 # Determine final module list.
2356 modules="$specified_modules"
2357 func_modules_transitive_closure
2358 if test $verbose -ge 0; then
2359 echo "Module list with included dependencies:"
2360 echo "$modules" | sed -e 's/^/ /'
2362 final_modules="$modules"
2364 # Determine main module list and tests-related module list separately.
2365 # The main module list is the transitive closure of the specified modules,
2366 # ignoring tests modules. Its lib/* sources go into $sourcebase/. If --lgpl
2367 # is specified, it will consist only of LGPLed source.
2368 # The tests-related module list is the transitive closure of the specified
2369 # modules, including tests modules, minus the main module list. Its lib/*
2370 # sources (brought in through dependencies of *-tests modules) go into
2371 # $testsbase/. It may contain GPLed source, even if --lgpl is specified.
2372 # Determine main module list.
2373 saved_inctests="$inctests"
2375 modules="$specified_modules"
2376 func_modules_transitive_closure
2377 main_modules="$modules"
2378 inctests="$saved_inctests"
2379 if test $verbose -ge 1; then
2380 echo "Main module list:"
2381 echo "$main_modules" | sed -e 's/^/ /'
2383 # Determine tests-related module list.
2384 echo "$final_modules" | LC_ALL=C sort -u > "$tmp"/final-modules
2385 testsrelated_modules=`echo "$main_modules" | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/final-modules`
2386 if test $verbose -ge 1; then
2387 echo "Tests-related module list:"
2388 echo "$testsrelated_modules" | sed -e 's/^/ /'
2391 # Add the dummy module to the main module list if needed.
2392 modules="$main_modules"
2393 func_modules_add_dummy
2394 main_modules="$modules"
2396 # Determine whether a $testsbase/libtests.a is needed.
2398 for module in $testsrelated_modules; do
2399 func_verify_nontests_module
2400 if test -n "$module"; then
2401 all_files=`func_get_filelist $module`
2402 lib_files=`for f in $all_files; do \
2406 done | sed -e 's,^lib/,,'`
2407 if test -n "$lib_files"; then
2414 # Add the dummy module to the tests-related module list if needed.
2415 if $use_libtests; then
2416 modules="$testsrelated_modules"
2417 func_modules_add_dummy
2418 testsrelated_modules="$modules"
2421 # If --lgpl, verify that the licenses of modules are compatible.
2422 if test -n "$lgpl"; then
2423 for module in $main_modules; do
2424 license=`func_get_license $module`
2426 'GPLed build tool') ;;
2427 'public domain' | 'unlimited' | 'unmodifiable license text') ;;
2433 *) func_fatal_error "incompatible license on module $module: $license" ;;
2439 *) func_fatal_error "incompatible license on module $module: $license" ;;
2442 *) func_fatal_error "invalid value lgpl=$lgpl" ;;
2449 # Show banner notice of every module.
2450 modules="$main_modules"
2453 # Determine script to apply to imported library files.
2454 sed_transform_lib_file=
2455 for module in $main_modules; do
2456 if test $module = config-h; then
2457 # Assume config.h exists, and that -DHAVE_CONFIG_H is omitted.
2458 sed_transform_lib_file=$sed_transform_lib_file'
2459 s/^#ifdef[ ]*HAVE_CONFIG_H[ ]*$/#if 1/
2464 sed_transform_main_lib_file="$sed_transform_lib_file"
2465 if test -n "$do_copyrights"; then
2466 if test -n "$lgpl"; then
2470 sed_transform_main_lib_file=$sed_transform_main_lib_file'
2471 s/GNU General/GNU Lesser General/g
2475 sed_transform_main_lib_file=$sed_transform_main_lib_file'
2476 s/GNU General/GNU Lesser General/g
2477 s/version [23]\([ ,]\)/version 2.1\1/g
2480 *) func_fatal_error "invalid value lgpl=$lgpl" ;;
2484 sed_transform_main_lib_file=$sed_transform_main_lib_file'
2485 s/GNU Lesser General/GNU General/g
2486 s/GNU Library General/GNU General/g
2487 s/version \(2\|2\.1\)\([ ,]\)/version 3\2/g
2492 # Determine script to apply to library files that go into $testsbase/.
2493 sed_transform_testsrelated_lib_file="$sed_transform_lib_file"
2494 if test -n "$do_copyrights"; then
2496 sed_transform_testsrelated_lib_file=$sed_transform_testsrelated_lib_file'
2497 s/GNU Lesser General/GNU General/g
2498 s/GNU Library General/GNU General/g
2499 s/version \(2\|2\.1\)\([ ,]\)/version 3\2/g
2503 # Determine the final file lists.
2504 # They must be computed separately, because files in lib/* go into
2505 # $sourcebase/ if they are in the main file list but into $testsbase/
2506 # if they are in the tests-related file list. Furthermore lib/dummy.c
2508 # Determine final main file list.
2509 modules="$main_modules"
2510 func_modules_to_filelist
2512 # Determine final tests-related file list.
2513 modules="$testsrelated_modules"
2514 func_modules_to_filelist
2515 testsrelated_files=`echo "$files" | sed -e 's,^lib/,tests=lib/,'`
2516 # Merge both file lists.
2517 sed_remove_empty_lines='/^$/d'
2518 files=`{ echo "$main_files"; echo "$testsrelated_files"; } | sed -e "$sed_remove_empty_lines" | LC_ALL=C sort -u`
2519 if test $verbose -ge 0; then
2521 sed_prettyprint_files='s,^tests=lib/\(.*\)$,lib/\1 -> tests/\1,'
2522 echo "$files" | sed -e "$sed_prettyprint_files" -e 's/^/ /'
2526 || func_fatal_error "refusing to do nothing"
2528 # Add m4/gnulib-tool.m4 to the file list. It is not part of any module.
2529 new_files="$files m4/gnulib-tool.m4"
2530 old_files="$cached_files"
2531 if test -f "$destdir"/$m4base/gnulib-tool.m4; then
2532 func_append old_files " m4/gnulib-tool.m4"
2535 sed_rewrite_old_files="\
2536 s,^build-aux/,$auxdir/,
2537 s,^doc/,$cached_docbase/,
2538 s,^lib/,$cached_sourcebase/,
2539 s,^m4/,$cached_m4base/,
2540 s,^tests/,$cached_testsbase/,
2541 s,^tests=lib/,$cached_testsbase/,
2543 sed_rewrite_new_files="\
2544 s,^build-aux/,$auxdir/,
2546 s,^lib/,$sourcebase/,
2548 s,^tests/,$testsbase/,
2549 s,^tests=lib/,$testsbase/,
2552 # Create directories.
2553 { echo "$sourcebase"
2555 if test -n "$pobase"; then
2558 docfiles=`echo "$files" | sed -n -e 's,^doc/,,p'`
2559 if test -n "$docfiles"; then
2562 if test -n "$inctests"; then
2566 for f in $files; do echo $f; done \
2567 | sed -e "$sed_rewrite_new_files" \
2568 | sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
2571 { # Rearrange file descriptors. Needed because "while ... done < ..."
2572 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
2573 exec 5<&0 < "$tmp"/dirs
2575 if test ! -d "$destdir/$d"; then
2577 echo "Creating directory $destdir/$d"
2578 mkdir -p "$destdir/$d" || func_fatal_error "failed"
2580 echo "Create directory $destdir/$d"
2587 # func_dest_tmpfilename file
2588 # determines the name of a temporary file (file is relative to destdir).
2590 # - tmpfile absolute filename of the temporary file
2591 func_dest_tmpfilename ()
2594 # Put the new contents of $file in a file in the same directory (needed
2595 # to guarantee that an 'mv' to "$destdir/$file" works).
2596 tmpfile="$destdir/$1.tmp"
2598 # Put the new contents of $file in a file in a temporary directory
2599 # (because the directory of "$file" might not exist).
2600 tmpfile="$tmp"/`basename "$1"`.tmp
2604 # Copy files or make symbolic links. Remove obsolete files.
2608 # Construct a table with 2 columns: rewritten-file-name original-file-name,
2609 # representing the files according to the last gnulib-tool invocation.
2610 for f in $old_files; do echo $f; done \
2611 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_old_files" \
2614 # Construct a table with 2 columns: rewritten-file-name original-file-name,
2615 # representing the files after this gnulib-tool invocation.
2616 for f in $new_files; do echo $f; done \
2617 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" \
2620 # First the files that are in old-files, but not in new-files:
2621 sed_take_first_column='s,'"$delimiter"'.*,,'
2622 for g in `LC_ALL=C join -t"$delimiter" -v1 "$tmp"/old-files "$tmp"/new-files | sed -e "$sed_take_first_column"`; do
2623 # Remove the file. Do nothing if the user already removed it.
2624 if test -f "$destdir/$g" || test -h "$destdir/$g"; then
2626 echo "Removing file $g (backup in ${g}~)"
2627 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error "failed"
2629 echo "Remove file $g (backup in ${g}~)"
2631 func_append removed_files "$g$nl"
2634 # func_add_or_update handles a file that ought to be present afterwards.
2636 # - f the original file name
2637 # - g the rewritten file name
2638 # - already_present nonempty if the file already exists, empty otherwise
2639 func_add_or_update ()
2643 tests=lib/*) f=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
2645 func_dest_tmpfilename "$g"
2646 func_lookup_file "$f"
2647 cp "$lookedup_file" "$tmpfile" || func_fatal_error "failed"
2648 if test -n "$sed_transform_main_lib_file"; then
2651 sed -e "$sed_transform_main_lib_file" \
2652 < "$lookedup_file" > "$tmpfile" || func_fatal_error "failed"
2656 if test -n "$sed_transform_testsrelated_lib_file"; then
2659 sed -e "$sed_transform_testsrelated_lib_file" \
2660 < "$lookedup_file" > "$tmpfile" || func_fatal_error "failed"
2664 if test -f "$destdir/$g"; then
2665 # The file already exists.
2666 if cmp "$destdir/$g" "$tmpfile" > /dev/null; then
2667 : # The file has not changed.
2671 if test -n "$already_present"; then
2672 echo "Updating file $g (backup in ${g}~)"
2674 echo "Replacing file $g (non-gnulib code backed up in ${g}~) !!"
2676 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error "failed"
2677 if { test -n "$symbolic" \
2678 || { test -n "$lsymbolic" \
2679 && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; } \
2680 && test -z "$lookedup_tmp" \
2681 && cmp "$lookedup_file" "$tmpfile" > /dev/null; then
2682 func_ln_if_changed "$lookedup_file" "$destdir/$g"
2684 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error "failed"
2687 if test -n "$already_present"; then
2688 echo "Update file $g (backup in ${g}~)"
2690 echo "Replace file $g (non-gnulib code backed up in ${g}~) !!"
2696 # Don't protest if the file should be there but isn't: it happens
2697 # frequently that developers don't put autogenerated files into CVS.
2699 echo "Copying file $g"
2700 if { test -n "$symbolic" \
2701 || { test -n "$lsymbolic" \
2702 && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; } \
2703 && test -z "$lookedup_tmp" \
2704 && cmp "$lookedup_file" "$tmpfile" > /dev/null; then
2705 func_ln_if_changed "$lookedup_file" "$destdir/$g"
2707 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error "failed"
2712 func_append added_files "$g$nl"
2716 # Then the files that are in new-files, but not in old-files:
2717 sed_take_last_column='s,^.*'"$delimiter"',,'
2719 LC_ALL=C join -t"$delimiter" -v2 "$tmp"/old-files "$tmp"/new-files \
2720 | sed -e "$sed_take_last_column" \
2721 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/added-files
2722 { # Rearrange file descriptors. Needed because "while ... done < ..."
2723 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
2724 exec 5<&0 < "$tmp"/added-files
2730 # Then the files that are in new-files and in old-files:
2731 already_present=true
2732 LC_ALL=C join -t"$delimiter" "$tmp"/old-files "$tmp"/new-files \
2733 | sed -e "$sed_take_last_column" \
2734 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/kept-files
2735 { # Rearrange file descriptors. Needed because "while ... done < ..."
2736 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
2737 exec 5<&0 < "$tmp"/kept-files
2744 # Command-line invocation printed in a comment in generated gnulib-cache.m4.
2745 actioncmd="gnulib-tool --import"
2746 func_append actioncmd " --dir=$destdir"
2747 if test -n "$local_gnulib_dir"; then
2748 func_append actioncmd " --local-dir=$local_gnulib_dir"
2750 func_append actioncmd " --lib=$libname"
2751 func_append actioncmd " --source-base=$sourcebase"
2752 func_append actioncmd " --m4-base=$m4base"
2753 if test -n "$pobase"; then
2754 func_append actioncmd " --po-base=$pobase"
2756 func_append actioncmd " --doc-base=$docbase"
2757 func_append actioncmd " --aux-dir=$auxdir"
2758 if test -n "$inctests"; then
2759 func_append actioncmd " --with-tests"
2761 for module in $avoidlist; do
2762 func_append actioncmd " --avoid=$module"
2764 if test -n "$lgpl"; then
2765 if test "$lgpl" = yes; then
2766 func_append actioncmd " --lgpl"
2768 func_append actioncmd " --lgpl=$lgpl"
2771 if test -n "$makefile_name"; then
2772 func_append actioncmd " --makefile-name=$makefile_name"
2774 if test "$libtool" = true; then
2775 func_append actioncmd " --libtool"
2777 func_append actioncmd " --no-libtool"
2779 func_append actioncmd " --macro-prefix=$macro_prefix"
2780 if test -n "$po_domain"; then
2781 func_append actioncmd " --po-domain=$po_domain"
2783 if test -n "$vc_files"; then
2784 if test "$vc_files" = true; then
2785 func_append actioncmd " --vc-files"
2787 func_append actioncmd " --no-vc-files"
2790 func_append actioncmd " `echo $specified_modules`"
2792 # Default the makefile name to Makefile.am.
2793 if test -n "$makefile_name"; then
2794 makefile_am=$makefile_name
2796 makefile_am=Makefile.am
2799 # Create normal Makefile.ams.
2802 # Create library makefile.
2803 func_dest_tmpfilename $sourcebase/$makefile_am
2804 modules="$main_modules"
2805 func_emit_lib_Makefile_am > "$tmpfile"
2806 if test -f "$destdir"/$sourcebase/$makefile_am; then
2807 if cmp "$destdir"/$sourcebase/$makefile_am "$tmpfile" > /dev/null; then
2811 echo "Updating $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
2812 mv -f "$destdir"/$sourcebase/$makefile_am "$destdir"/$sourcebase/$makefile_am~
2813 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
2815 echo "Update $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
2821 echo "Creating $sourcebase/$makefile_am"
2822 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
2824 echo "Create $sourcebase/$makefile_am"
2827 func_append added_files "$sourcebase/$makefile_am$nl"
2830 # Create po/ directory.
2831 if test -n "$pobase"; then
2832 # Create po makefile and auxiliary files.
2833 for file in Makefile.in.in remove-potcdate.sin; do
2834 func_dest_tmpfilename $pobase/$file
2835 func_lookup_file build-aux/po/$file
2836 cat "$lookedup_file" > "$tmpfile"
2837 if test -f "$destdir"/$pobase/$file; then
2838 if cmp "$destdir"/$pobase/$file "$tmpfile" > /dev/null; then
2842 echo "Updating $pobase/$file (backup in $pobase/$file~)"
2843 mv -f "$destdir"/$pobase/$file "$destdir"/$pobase/$file~
2844 mv -f "$tmpfile" "$destdir"/$pobase/$file
2846 echo "Update $pobase/$file (backup in $pobase/$file~)"
2852 echo "Creating $pobase/$file"
2853 mv -f "$tmpfile" "$destdir"/$pobase/$file
2855 echo "Create $pobase/$file"
2858 func_append added_files "$pobase/$file$nl"
2861 # Create po makefile parametrization, part 1.
2862 func_dest_tmpfilename $pobase/Makevars
2863 func_emit_po_Makevars > "$tmpfile"
2864 if test -f "$destdir"/$pobase/Makevars; then
2865 if cmp "$destdir"/$pobase/Makevars "$tmpfile" > /dev/null; then
2869 echo "Updating $pobase/Makevars (backup in $pobase/Makevars~)"
2870 mv -f "$destdir"/$pobase/Makevars "$destdir"/$pobase/Makevars~
2871 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
2873 echo "Update $pobase/Makevars (backup in $pobase/Makevars~)"
2879 echo "Creating $pobase/Makevars"
2880 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
2882 echo "Create $pobase/Makevars"
2885 func_append added_files "$pobase/Makevars$nl"
2887 # Create po makefile parametrization, part 2.
2888 func_dest_tmpfilename $pobase/POTFILES.in
2889 func_emit_po_POTFILES_in > "$tmpfile"
2890 if test -f "$destdir"/$pobase/POTFILES.in; then
2891 if cmp "$destdir"/$pobase/POTFILES.in "$tmpfile" > /dev/null; then
2895 echo "Updating $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
2896 mv -f "$destdir"/$pobase/POTFILES.in "$destdir"/$pobase/POTFILES.in~
2897 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.in
2899 echo "Update $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
2905 echo "Creating $pobase/POTFILES.in"
2906 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.in
2908 echo "Create $pobase/POTFILES.in"
2911 func_append added_files "$pobase/POTFILES.in$nl"
2914 TP_URL="http://translationproject.org/latest/"
2915 TP_RSYNC_URI="translationproject.org::tp/latest/"
2917 echo "Fetching gnulib PO files from $TP_URL"
2918 (cd "$destdir"/$pobase \
2919 && { # Prefer rsync over wget if it is available, since it consumes
2920 # less network bandwidth, due to compression.
2921 if type rsync 2>/dev/null | grep / > /dev/null; then
2922 rsync -Lrtz "${TP_RSYNC_URI}gnulib/" .
2924 wget --quiet -r -l1 -nd -np -A.po "${TP_URL}gnulib"
2929 echo "Fetch gnulib PO files from $TP_URL"
2931 # Create po/LINGUAS.
2933 func_dest_tmpfilename $pobase/LINGUAS
2934 (cd "$destdir"/$pobase \
2935 && { echo '# Set of available languages.'
2936 LC_ALL=C ls -1 *.po | sed -e 's,\.po$,,'
2939 if test -f "$destdir"/$pobase/LINGUAS; then
2940 if cmp "$destdir"/$pobase/LINGUAS "$tmpfile" > /dev/null; then
2943 echo "Updating $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
2944 mv -f "$destdir"/$pobase/LINGUAS "$destdir"/$pobase/LINGUAS~
2945 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
2948 echo "Creating $pobase/LINGUAS"
2949 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
2950 func_append added_files "$pobase/LINGUAS$nl"
2953 if test -f "$destdir"/$pobase/LINGUAS; then
2954 echo "Update $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
2956 echo "Create $pobase/LINGUAS"
2961 # Create m4/gnulib-cache.m4.
2962 func_dest_tmpfilename $m4base/gnulib-cache.m4
2964 func_emit_copyright_notice
2966 echo "# This file represents the specification of how gnulib-tool is used."
2967 echo "# It acts as a cache: It is written and read by gnulib-tool."
2968 echo "# In projects using CVS, this file is meant to be stored in CVS,"
2969 echo "# like the configure.ac and various Makefile.am files."
2972 echo "# Specification in the form of a command-line invocation:"
2975 echo "# Specification in the form of a few gnulib-tool.m4 macro invocations:"
2976 # Store the local_gnulib_dir relative to destdir.
2977 case "$local_gnulib_dir" in
2979 relative_local_gnulib_dir="$local_gnulib_dir" ;;
2982 /*) relative_local_gnulib_dir="$local_gnulib_dir" ;;
2984 # destdir, local_gnulib_dir are both relative.
2985 func_relativize "$destdir" "$local_gnulib_dir"
2986 relative_local_gnulib_dir="$reldir" ;;
2989 echo "gl_LOCAL_DIR([$relative_local_gnulib_dir])"
2990 echo "gl_MODULES(["`echo $specified_modules`"])"
2991 echo "gl_AVOID([$avoidlist])"
2992 echo "gl_SOURCE_BASE([$sourcebase])"
2993 echo "gl_M4_BASE([$m4base])"
2994 echo "gl_PO_BASE([$pobase])"
2995 echo "gl_DOC_BASE([$docbase])"
2996 echo "gl_TESTS_BASE([$testsbase])"
2997 test -z "$inctests" || echo "gl_WITH_TESTS"
2998 echo "gl_LIB([$libname])"
2999 if test -n "$lgpl"; then
3000 if test "$lgpl" = yes; then
3003 echo "gl_LGPL([$lgpl])"
3006 echo "gl_MAKEFILE_NAME([$makefile_name])"
3007 if test "$libtool" = true; then
3010 echo "gl_MACRO_PREFIX([$macro_prefix])"
3011 echo "gl_PO_DOMAIN([$po_domain])"
3012 if test -n "$vc_files"; then
3013 echo "gl_VC_FILES([$vc_files])"
3016 if test -f "$destdir"/$m4base/gnulib-cache.m4; then
3017 if cmp "$destdir"/$m4base/gnulib-cache.m4 "$tmpfile" > /dev/null; then
3021 echo "Updating $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
3022 mv -f "$destdir"/$m4base/gnulib-cache.m4 "$destdir"/$m4base/gnulib-cache.m4~
3023 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.m4
3025 echo "Update $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
3029 echo "# gnulib-cache.m4 ends here"
3036 echo "Creating $m4base/gnulib-cache.m4"
3037 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.m4
3039 echo "Create $m4base/gnulib-cache.m4"
3045 # Create m4/gnulib-comp.m4.
3046 func_dest_tmpfilename $m4base/gnulib-comp.m4
3048 echo "# DO NOT EDIT! GENERATED AUTOMATICALLY!"
3049 func_emit_copyright_notice
3051 echo "# This file represents the compiled summary of the specification in"
3052 echo "# gnulib-cache.m4. It lists the computed macro invocations that need"
3053 echo "# to be invoked from configure.ac."
3054 echo "# In projects using CVS, this file can be treated like other built files."
3057 echo "# This macro should be invoked from $configure_ac, in the section"
3058 echo "# \"Checks for programs\", right after AC_PROG_CC, and certainly before"
3059 echo "# any checks for libraries, header files, types and library functions."
3060 echo "AC_DEFUN([${macro_prefix}_EARLY],"
3062 echo " m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
3063 echo " m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
3064 echo " m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
3065 echo " m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
3066 echo " AC_REQUIRE([AC_PROG_RANLIB])"
3067 if test -n "$uses_subdirs"; then
3068 echo " AC_REQUIRE([AM_PROG_CC_C_O])"
3070 if grep AC_GNU_SOURCE "$destdir"/$m4base/*.m4 >/dev/null 2>/dev/null; then
3071 echo " AC_REQUIRE([AC_GNU_SOURCE])"
3073 for module in $final_modules; do
3075 if test -n "$module"; then
3076 func_get_autoconf_early_snippet "$module"
3079 | sed -e '/^$/d;' -e 's/^/ /'
3082 echo "# This macro should be invoked from $configure_ac, in the section"
3083 echo "# \"Check for header files, types and library functions\"."
3084 echo "AC_DEFUN([${macro_prefix}_INIT],"
3086 if test "$libtool" = true; then
3087 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
3088 echo " gl_cond_libtool=true"
3090 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
3091 echo " gl_cond_libtool=false"
3093 echo " gl_ltlibdeps="
3095 if test "$auxdir" != "build-aux"; then
3096 sed_replace_build_aux='
3098 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
3099 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
3103 sed_replace_build_aux=
3105 func_emit_initmacro_start $macro_prefix
3106 echo " gl_source_base='$sourcebase'"
3107 for module in $main_modules; do
3109 if test -n "$module"; then
3110 func_get_autoconf_snippet "$module" \
3111 | sed -e '/^$/d;' -e 's/^/ /' \
3112 -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./' \
3113 -e "$sed_replace_build_aux"
3114 if test "$module" = 'alloca' && test "$libtool" = true; then
3115 echo 'changequote(,)dnl'
3116 echo 'LTALLOCA=`echo "$ALLOCA" | sed '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
3117 echo 'changequote([, ])dnl'
3118 echo 'AC_SUBST([LTALLOCA])'
3122 func_emit_initmacro_end $macro_prefix
3123 echo " gltests_libdeps="
3124 echo " gltests_ltlibdeps="
3125 func_emit_initmacro_start ${macro_prefix}tests
3126 echo " gl_source_base='$testsbase'"
3127 for module in $testsrelated_modules; do
3129 if test -n "$module"; then
3130 func_get_autoconf_snippet "$module" \
3131 | sed -e '/^$/d;' -e 's/^/ /' \
3132 -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./' \
3133 -e "$sed_replace_build_aux" \
3134 -e 's/\$gl_cond_libtool/false/g' \
3135 -e 's/gl_libdeps/gltests_libdeps/g' \
3136 -e 's/gl_ltlibdeps/gltests_ltlibdeps/g'
3139 func_emit_initmacro_end ${macro_prefix}tests
3140 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
3141 # created using libtool, because libtool already handles the dependencies.
3142 if test "$libtool" != true; then
3143 libname_upper=`echo "$libname" | LC_ALL=C tr 'a-z-' 'A-Z_'`
3144 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
3145 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
3146 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
3147 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
3149 if $use_libtests; then
3150 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
3151 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
3154 func_emit_initmacro_done $macro_prefix $sourcebase
3155 func_emit_initmacro_done ${macro_prefix}tests $testsbase
3157 echo "# This macro records the list of files which have been installed by"
3158 echo "# gnulib-tool and may be removed by future gnulib-tool invocations."
3159 echo "AC_DEFUN([${macro_prefix}_FILE_LIST], ["
3160 echo "$files" | sed -e 's,^, ,'
3163 if test -f "$destdir"/$m4base/gnulib-comp.m4; then
3164 if cmp "$destdir"/$m4base/gnulib-comp.m4 "$tmpfile" > /dev/null; then
3168 echo "Updating $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
3169 mv -f "$destdir"/$m4base/gnulib-comp.m4 "$destdir"/$m4base/gnulib-comp.m4~
3170 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.m4
3172 echo "Update $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
3176 echo "# gnulib-comp.m4 ends here"
3183 echo "Creating $m4base/gnulib-comp.m4"
3184 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.m4
3186 echo "Create $m4base/gnulib-comp.m4"
3192 if test -n "$inctests"; then
3193 # Create tests makefile.
3194 func_dest_tmpfilename $testsbase/$makefile_am
3195 modules="$testsrelated_modules"
3196 func_emit_tests_Makefile_am > "$tmpfile"
3197 if test -f "$destdir"/$testsbase/$makefile_am; then
3198 if cmp "$destdir"/$testsbase/$makefile_am "$tmpfile" > /dev/null; then
3202 echo "Updating $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
3203 mv -f "$destdir"/$testsbase/$makefile_am "$destdir"/$testsbase/$makefile_am~
3204 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
3206 echo "Update $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
3212 echo "Creating $testsbase/$makefile_am"
3213 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
3215 echo "Create $testsbase/$makefile_am"
3218 func_append added_files "$testsbase/$makefile_am$nl"
3222 if test "$vc_files" != false; then
3223 # Update the .cvsignore and .gitignore files.
3224 { echo "$added_files" | sed -e '/^$/d' -e 's,\([^/]*\)$,|A|\1,'
3225 echo "$removed_files" | sed -e '/^$/d' -e 's,\([^/]*\)$,|R|\1,'
3226 } | LC_ALL=C sort -t'|' -k1,1 > "$tmp"/fileset-changes
3227 { # Rearrange file descriptors. Needed because "while ... done < ..."
3228 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
3229 exec 5<&0 < "$tmp"/fileset-changes
3230 func_update_ignorelist ()
3233 if test -f "$destdir/$dir$ignore"; then
3234 if test -n "$dir_added" || test -n "$dir_removed"; then
3235 LC_ALL=C sort "$destdir/$dir$ignore" > "$tmp"/ignore
3236 echo "$dir_added" | sed -e '/^$/d' | LC_ALL=C sort -u \
3237 | LC_ALL=C join -v 2 "$tmp"/ignore - > "$tmp"/ignore-added
3238 echo "$dir_removed" | sed -e '/^$/d' | LC_ALL=C sort -u \
3239 | LC_ALL=C join -v 2 "$tmp"/ignore - > "$tmp"/ignore-removed
3240 if test -s "$tmp"/ignore-added || test -s "$tmp"/ignore-removed; then
3242 echo "Updating $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
3243 mv -f "$destdir/$dir$ignore" "$destdir/$dir$ignore"~
3244 sed -e 's,^,/^,' -e 's,$,\$/d,' < "$tmp"/ignore-removed > "$tmp"/sed-ignore-removed
3245 cat "$destdir/$dir$ignore"~ "$tmp"/ignore-added \
3246 | sed -f "$tmp"/sed-ignore-removed \
3247 > "$destdir/$dir$ignore"
3249 echo "Update $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
3254 if test -n "$dir_added"; then
3256 echo "Creating $destdir/$dir$ignore"
3258 if test "$ignore" = .cvsignore; then
3260 # Automake generates Makefile rules that create .dirstamp files.
3263 echo "$dir_added" | sed -e '/^$/d' | LC_ALL=C sort -u
3264 } > "$destdir/$dir$ignore"
3266 echo "Create $destdir/$dir$ignore"
3276 if test -d "$destdir/CVS" || test -d "$destdir/${dir}CVS" || test -f "$destdir/${dir}.cvsignore"; then
3277 func_update_ignorelist .cvsignore
3279 if test -d "$destdir/.git" || test -f "$destdir/${dir}.gitignore"; then
3280 func_update_ignorelist .gitignore
3287 # Why not ''read next_dir op file'' ? Because the dir column can be empty.
3288 next_dir=`echo "$line" | sed -e 's,|.*,,'`
3289 op=`echo "$line" | sed -e 's,^[^|]*|\([^|]*\)|.*$,\1,'`
3290 file=`echo "$line" | sed -e 's,^[^|]*|[^|]*|,,'`
3291 if test "$next_dir" != "$last_dir"; then
3292 func_done_dir "$last_dir" "$last_dir_added" "$last_dir_removed"
3293 last_dir="$next_dir"
3298 A) func_append last_dir_added "$file$nl";;
3299 R) func_append last_dir_removed "$file$nl";;
3302 func_done_dir "$last_dir" "$last_dir_added" "$last_dir_removed"
3309 echo "You may need to add #include directives for the following .h files."
3310 # Intersect $specified_modules and $main_modules
3311 # (since $specified_modules is not necessarily of subset of $main_modules
3312 # - some may have been skipped through --avoid, and since the elements of
3313 # $main_modules but not in $specified_modules can go away without explicit
3314 # notice - through changes in the module dependencies).
3315 echo "$specified_modules" > "$tmp"/modules1 # a sorted list, one module per line
3316 echo "$main_modules" > "$tmp"/modules2 # also a sorted list, one module per line
3317 # First the #include <...> directives without #ifs, sorted for convenience,
3318 # then the #include "..." directives without #ifs, sorted for convenience,
3319 # then the #include directives that are surrounded by #ifs. Not sorted.
3320 for module in `LC_ALL=C join "$tmp"/modules1 "$tmp"/modules2`; do
3321 include_directive=`func_get_include_directive "$module"`
3322 case "$nl$include_directive" in
3324 echo "$include_directive" 1>&5
3327 echo "$include_directive" | grep -v 'include "' 1>&6
3328 echo "$include_directive" | grep 'include "' 1>&7
3331 done 5> "$tmp"/include-if 6> "$tmp"/include-angles 7> "$tmp"/include-quotes
3333 LC_ALL=C sort -u "$tmp"/include-angles
3334 LC_ALL=C sort -u "$tmp"/include-quotes
3335 cat "$tmp"/include-if
3336 ) | sed -e '/^$/d' -e 's/^/ /'
3337 rm -f "$tmp"/include-angles "$tmp"/include-quotes "$tmp"/include-if
3339 for module in $main_modules; do
3340 func_get_link_directive "$module"
3342 | LC_ALL=C sort -u | sed -e '/^$/d' -e 's/^/ /' > "$tmp"/link
3343 if test `wc -l < "$tmp"/link` != 0; then
3345 echo "You may need to use the following Makefile variables when linking."
3346 echo "Use them in <program>_LDADD when linking a program, or"
3347 echo "in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library."
3353 echo "Don't forget to"
3354 if test "$makefile_am" = Makefile.am; then
3355 echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
3357 echo " - \"include $makefile_name\" from within \"$sourcebase/Makefile.am\","
3359 if test -n "$pobase"; then
3360 echo " - add \"$pobase/Makefile.in\" to AC_CONFIG_FILES in $configure_ac,"
3362 if test -n "$inctests"; then
3363 if test "$makefile_am" = Makefile.am; then
3364 echo " - add \"$testsbase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
3366 echo " - \"include $makefile_name\" from within \"$testsbase/Makefile.am\","
3369 if test "$makefile_am" = Makefile.am; then
3370 sourcebase_dir=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'`
3371 sourcebase_base=`basename "$sourcebase"`
3372 echo " - mention \"${sourcebase_base}\" in SUBDIRS in ${sourcebase_dir}Makefile.am,"
3374 if test -n "$pobase"; then
3375 pobase_dir=`echo "$pobase" | sed -n -e 's,/[^/]*$,/,p'`
3376 pobase_base=`basename "$pobase"`
3377 echo " - mention \"${pobase_base}\" in SUBDIRS in ${pobase_dir}Makefile.am,"
3379 if test -n "$inctests"; then
3380 if test "$makefile_am" = Makefile.am; then
3381 testsbase_dir=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'`
3382 testsbase_base=`basename "$testsbase"`
3383 echo " - mention \"${testsbase_base}\" in SUBDIRS in ${testsbase_dir}Makefile.am,"
3386 echo " - mention \"-I ${m4base}\" in ACLOCAL_AMFLAGS in Makefile.am,"
3387 echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after AC_PROG_CC,"
3388 echo " - invoke ${macro_prefix}_INIT in $configure_ac."
3391 # func_create_testdir testdir modules
3393 # - local_gnulib_dir from --local-dir
3394 # - auxdir directory relative to destdir where to place build aux files
3395 func_create_testdir ()
3399 if test -z "$modules"; then
3400 # All modules together.
3401 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
3402 # Except fnmatch-posix, which conflicts with fnmatch-gnu. FIXME.
3403 # Except ftruncate, mountlist, which abort the configuration on mingw. FIXME.
3404 modules=`func_all_modules`
3405 modules=`for m in $modules; do case $m in config-h | fnmatch-posix | ftruncate | mountlist) ;; *) echo $m;; esac; done`
3407 modules=`for m in $modules; do echo $m; done | LC_ALL=C sort -u`
3409 # Check that the license of every module is consistent with the license of
3411 saved_modules="$modules"
3412 saved_inctests="$inctests"
3413 # When computing transitive closures, don't consider $module to depend on
3414 # $module-tests. Need this becauses tests are implicitly GPL and may depend
3415 # on GPL modules - therefore we don't want a warning in this case.
3417 for requested_module in $saved_modules; do
3418 requested_license=`func_get_license "$requested_module"`
3419 if test "$requested_license" != GPL; then
3420 # Here we use func_modules_transitive_closure, not just
3421 # func_get_dependencies, so that we also detect weird situations like
3422 # an LGPL module which depends on a GPLed build tool module which depends
3424 modules="$requested_module"
3425 func_modules_transitive_closure
3426 for module in $modules; do
3427 license=`func_get_license "$module"`
3429 'GPLed build tool') ;;
3430 'public domain' | 'unlimited' | 'unmodifiable license text') ;;
3432 case "$requested_license" in
3435 GPLv2+ | LGPLv2+) ;;
3436 *) echo "warning: module $requested_module depends on a module with an incompatible license: $module" 1>&2 ;;
3442 *) echo "warning: module $requested_module depends on a module with an incompatible license: $module" 1>&2 ;;
3448 *) echo "warning: module $requested_module depends on a module with an incompatible license: $module" 1>&2 ;;
3457 modules="$saved_modules"
3458 inctests="$saved_inctests"
3460 # Subdirectory names.
3470 # Determine final module list.
3471 func_modules_transitive_closure
3472 if test $verbose -ge 0; then
3473 echo "Module list with included dependencies:"
3474 echo "$modules" | sed -e 's/^/ /'
3477 # Add the dummy module if needed.
3478 func_modules_add_dummy
3480 # Show banner notice of every module.
3483 # Determine final file list.
3484 func_modules_to_filelist
3485 if test $verbose -ge 0; then
3487 echo "$files" | sed -e 's/^/ /'
3490 sed_rewrite_files="\
3491 s,^build-aux/,$auxdir/,
3493 s,^lib/,$sourcebase/,
3495 s,^tests/,$testsbase/,
3498 # Create directories.
3499 for f in $files; do echo $f; done \
3500 | sed -e "$sed_rewrite_files" \
3501 | sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
3502 | LC_ALL=C sort -u \
3504 { # Rearrange file descriptors. Needed because "while ... done < ..."
3505 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
3506 exec 5<&0 < "$tmp"/dirs
3508 mkdir -p "$testdir/$d"
3513 # Copy files or make symbolic links.
3515 for f in $files; do echo $f; done \
3516 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_files" \
3519 { # Rearrange file descriptors. Needed because "while ... done < ..."
3520 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
3521 exec 5<&0 < "$tmp"/files
3523 func_lookup_file "$f"
3524 if test -n "$lookedup_tmp"; then
3525 cp -p "$lookedup_file" "$testdir/$g"
3527 ln "$lookedup_file" "$testdir/$g" 2>/dev/null ||
3528 if { test -n "$symbolic" \
3529 || { test -n "$lsymbolic" \
3530 && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; }; then
3531 func_ln "$lookedup_file" "$testdir/$g"
3533 cp -p "$lookedup_file" "$testdir/$g"
3540 # Create Makefile.ams that are for testing.
3543 # Create $sourcebase/Makefile.am.
3544 mkdir -p "$testdir/$sourcebase"
3545 func_emit_lib_Makefile_am > "$testdir/$sourcebase/Makefile.am"
3546 any_uses_subdirs="$uses_subdirs"
3548 # Create $m4base/Makefile.am.
3549 mkdir -p "$testdir/$m4base"
3550 (echo "## Process this file with automake to produce Makefile.in."
3556 echo "EXTRA_DIST += "`echo "$f" | sed -e 's,^m4/,,'` ;;
3559 ) > "$testdir/$m4base/Makefile.am"
3561 subdirs="$sourcebase $m4base"
3562 subdirs_with_configure_ac=""
3564 if false && test -f "$testdir"/$m4base/gettext.m4; then
3565 # Avoid stupid error message from automake:
3566 # "AM_GNU_GETTEXT used but `po' not in SUBDIRS"
3567 mkdir -p "$testdir/po"
3568 (echo "## Process this file with automake to produce Makefile.in."
3569 ) > "$testdir/po/Makefile.am"
3570 func_append subdirs " po"
3573 if test -n "$inctests"; then
3574 test -d "$testdir/$testsbase" || mkdir "$testdir/$testsbase"
3575 # Viewed from the $testsbase subdirectory, $auxdir is different.
3576 saved_auxdir="$auxdir"
3577 auxdir=`echo "$testsbase/"|sed 's%[^/][^/]*//*%../%g'`"$auxdir"
3578 # Create $testsbase/Makefile.am.
3580 func_emit_tests_Makefile_am > "$testdir/$testsbase/Makefile.am"
3581 any_uses_subdirs="$any_uses_subdirs$uses_subdirs"
3582 # Create $testsbase/configure.ac.
3583 (echo "# Process this file with autoconf to produce a configure script."
3584 echo "AC_INIT([dummy], [0])"
3585 echo "AC_CONFIG_AUX_DIR([$auxdir])"
3586 echo "AM_INIT_AUTOMAKE"
3588 echo "AM_CONFIG_HEADER([config.h])"
3591 echo "AC_PROG_INSTALL"
3592 echo "AC_PROG_MAKE_SET"
3593 echo "AC_PROG_RANLIB"
3595 if grep AC_GNU_SOURCE "$testdir/$m4base"/*.m4 >/dev/null 2>/dev/null; then
3596 echo "AC_GNU_SOURCE"
3599 for module in $modules; do
3601 if test -n "$module"; then
3602 func_get_autoconf_early_snippet "$module"
3605 | sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
3606 if test "$libtool" = true; then
3607 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
3608 echo "gl_cond_libtool=true"
3610 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
3611 echo "gl_cond_libtool=false"
3613 echo "gl_ltlibdeps="
3615 # Wrap the set of autoconf snippets into an autoconf macro that is then
3616 # invoked. This is needed because autoconf does not support AC_REQUIRE
3618 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
3619 # but we want the AC_REQUIRE to have its normal meaning (provide one
3620 # expansion of the required macro before the current point, and only one
3622 echo "AC_DEFUN([gl_INIT], ["
3623 sed_replace_build_aux='
3625 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
3626 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
3629 func_emit_initmacro_start $macro_prefix
3630 # We don't have explicit ordering constraints between the various
3631 # autoconf snippets. It's cleanest to put those of the library before
3632 # those of the tests.
3633 echo "gl_source_base='../$sourcebase'"
3634 for module in $modules; do
3635 func_verify_nontests_module
3636 if test -n "$module"; then
3637 func_get_autoconf_snippet "$module" \
3638 | sed -e "$sed_replace_build_aux"
3641 echo "gl_source_base='.'"
3642 for module in $modules; do
3643 func_verify_tests_module
3644 if test -n "$module"; then
3645 func_get_autoconf_snippet "$module" \
3646 | sed -e "$sed_replace_build_aux"
3649 func_emit_initmacro_end $macro_prefix
3650 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
3651 # created using libtool, because libtool already handles the dependencies.
3652 if test "$libtool" != true; then
3653 libname_upper=`echo "$libname" | LC_ALL=C tr 'a-z-' 'A-Z_'`
3654 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
3655 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
3656 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
3657 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
3660 func_emit_initmacro_done $macro_prefix $sourcebase # FIXME use $sourcebase or $testsbase?
3664 # Usually $testsbase/config.h will be a superset of config.h. Verify this
3665 # by "merging" config.h into $testsbase/config.h; look out for gcc warnings.
3666 echo "AH_TOP([#include \"../config.h\"])"
3668 echo "AC_OUTPUT([Makefile])"
3669 ) > "$testdir/$testsbase/configure.ac"
3670 auxdir="$saved_auxdir"
3671 func_append subdirs " $testsbase"
3672 subdirs_with_configure_ac="$subdirs_with_configure_ac $testsbase"
3675 # Create Makefile.am.
3676 (echo "## Process this file with automake to produce Makefile.in."
3678 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
3680 echo "SUBDIRS = $subdirs"
3682 echo "ACLOCAL_AMFLAGS = -I $m4base"
3683 ) > "$testdir/Makefile.am"
3685 # Create configure.ac.
3686 (echo "# Process this file with autoconf to produce a configure script."
3687 echo "AC_INIT([dummy], [0])"
3688 if test "$auxdir" != "."; then
3689 echo "AC_CONFIG_AUX_DIR([$auxdir])"
3691 echo "AM_INIT_AUTOMAKE"
3693 echo "AM_CONFIG_HEADER([config.h])"
3696 echo "AC_PROG_INSTALL"
3697 echo "AC_PROG_MAKE_SET"
3699 echo "# For autobuild."
3700 echo "AC_CANONICAL_BUILD"
3701 echo "AC_CANONICAL_HOST"
3703 echo "m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
3704 echo "m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
3705 echo "m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
3706 echo "m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
3708 echo "AC_PROG_RANLIB"
3710 if test -n "$any_uses_subdirs"; then
3711 echo "AM_PROG_CC_C_O"
3714 if grep AC_GNU_SOURCE "$testdir/$m4base"/*.m4 >/dev/null 2>/dev/null; then
3715 echo "AC_GNU_SOURCE"
3718 for module in $modules; do
3719 func_verify_nontests_module
3720 if test -n "$module"; then
3721 func_get_autoconf_early_snippet "$module"
3724 | sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
3725 if test "$libtool" = true; then
3726 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
3727 echo "gl_cond_libtool=true"
3729 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
3730 echo "gl_cond_libtool=false"
3732 echo "gl_ltlibdeps="
3734 # Wrap the set of autoconf snippets into an autoconf macro that is then
3735 # invoked. This is needed because autoconf does not support AC_REQUIRE
3737 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
3738 # but we want the AC_REQUIRE to have its normal meaning (provide one
3739 # expansion of the required macro before the current point, and only one
3741 echo "AC_DEFUN([gl_INIT], ["
3742 if test "$auxdir" != "build-aux"; then
3743 sed_replace_build_aux='
3745 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
3746 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
3750 sed_replace_build_aux=
3752 func_emit_initmacro_start $macro_prefix
3753 echo "gl_source_base='$sourcebase'"
3754 for module in $modules; do
3755 func_verify_nontests_module
3756 if test -n "$module"; then
3757 func_get_autoconf_snippet "$module" \
3758 | sed -e "$sed_replace_build_aux"
3761 func_emit_initmacro_end $macro_prefix
3762 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
3763 # created using libtool, because libtool already handles the dependencies.
3764 if test "$libtool" != true; then
3765 libname_upper=`echo "$libname" | LC_ALL=C tr 'a-z-' 'A-Z_'`
3766 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
3767 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
3768 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
3769 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
3772 func_emit_initmacro_done $macro_prefix $sourcebase
3776 if test -n "$subdirs_with_configure_ac"; then
3777 echo "AC_CONFIG_SUBDIRS(["`echo $subdirs_with_configure_ac`"])"
3779 makefiles="Makefile"
3780 for d in $subdirs; do
3781 # For subdirs that have a configure.ac by their own, it's the subdir's
3782 # configure.ac which creates the subdir's Makefile.am, not this one.
3783 case " $subdirs_with_configure_ac " in
3785 *) func_append makefiles " $d/Makefile" ;;
3788 echo "AC_OUTPUT([$makefiles])"
3789 ) > "$testdir/configure.ac"
3791 # Create autogenerated files.
3793 # Do not use "${AUTORECONF} --force --install", because it may invoke
3794 # autopoint, which brings in older versions of some of our .m4 files.
3795 if test -f $m4base/gettext.m4; then
3796 func_execute_command ${AUTOPOINT} --force || func_exit 1
3797 for f in $m4base/*.m4~; do
3798 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit 1
3801 func_execute_command ${ACLOCAL} -I $m4base || func_exit 1
3802 if ! test -d build-aux; then
3803 func_execute_command mkdir build-aux || func_exit 1
3805 func_execute_command ${AUTOCONF} || func_exit 1
3806 func_execute_command ${AUTOHEADER} || func_exit 1
3807 func_execute_command ${AUTOMAKE} --add-missing --copy || func_exit 1
3809 if test -n "$inctests"; then
3810 # Create autogenerated files.
3811 (cd "$testdir/$testsbase" || func_exit 1
3812 # Do not use "${AUTORECONF} --force --install", because it may invoke
3813 # autopoint, which brings in older versions of some of our .m4 files.
3814 if test -f ../$m4base/gettext.m4; then
3815 func_execute_command ${AUTOPOINT} --force || func_exit 1
3816 for f in ../$m4base/*.m4~; do
3817 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit 1
3820 func_execute_command ${ACLOCAL} -I ../$m4base || func_exit 1
3821 if ! test -d ../build-aux; then
3822 func_execute_command mkdir ../build-aux
3824 func_execute_command ${AUTOCONF} || func_exit 1
3825 func_execute_command ${AUTOHEADER} || func_exit 1
3826 func_execute_command ${AUTOMAKE} --add-missing --copy || func_exit 1
3829 # Need to run configure and make once, to create built files that are to be
3830 # distributed (such as getdate.c).
3831 # Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...".
3832 cleaned_files=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \
3833 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
3834 cleaned_files=`for file in $cleaned_files; do echo " $file "; done`
3835 # Extract the value of "BUILT_SOURCES += ...". Remove variable references
3836 # such $(FOO_H) because they don't refer to distributed files.
3837 sed_remove_make_variables='s,[$]([A-Za-z0-9_]*),,g'
3838 built_sources=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \
3839 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
3840 | sed -e "$sed_remove_make_variables"`
3841 distributed_built_sources=`for file in $built_sources; do
3842 case "$cleaned_files" in
3847 if test -n "$distributed_built_sources"; then
3849 ./configure || func_exit 1
3851 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
3852 make built_sources || func_exit 1
3854 make distclean || func_exit 1
3859 # func_create_megatestdir megatestdir allmodules
3861 # - local_gnulib_dir from --local-dir
3862 # - auxdir directory relative to destdir where to place build aux files
3863 func_create_megatestdir ()
3867 if test -z "$allmodules"; then
3868 allmodules=`func_all_modules`
3872 # First, all modules one by one.
3873 for onemodule in $allmodules; do
3874 func_create_testdir "$megatestdir/$onemodule" $onemodule
3875 func_append megasubdirs "$onemodule "
3877 # Then, all modules all together.
3878 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
3879 # Except fnmatch-posix, which conflicts with fnmatch-gnu. FIXME.
3880 allmodules=`for m in $allmodules; do if test $m != config-h && test $m != fnmatch-posix; then echo $m; fi; done`
3881 func_create_testdir "$megatestdir/ALL" "$allmodules"
3882 func_append megasubdirs "ALL"
3885 cvsdate=`if test -f "$gnulib_dir/CVS/Entries"; then \
3886 vc_witness="$gnulib_dir/CVS/Entries"; \
3888 vc_witness="$gnulib_dir/.git/refs/heads/master"; \
3890 sh "$gnulib_dir/build-aux/mdate-sh" "$vc_witness" \
3891 | sed -e 's,January,01,' -e 's,Jan,01,' \
3892 -e 's,February,02,' -e 's,Feb,02,' \
3893 -e 's,March,03,' -e 's,Mar,03,' \
3894 -e 's,April,04,' -e 's,Apr,04,' \
3896 -e 's,June,06,' -e 's,Jun,06,' \
3897 -e 's,July,07,' -e 's,Jul,07,' \
3898 -e 's,August,08,' -e 's,Aug,08,' \
3899 -e 's,September,09,' -e 's,Sep,09,' \
3900 -e 's,October,10,' -e 's,Oct,10,' \
3901 -e 's,November,11,' -e 's,Nov,11,' \
3902 -e 's,December,12,' -e 's,Dec,12,' \
3903 -e 's,^,00,' -e 's,^[0-9]*\([0-9][0-9] \),\1,' \
3904 -e 's,^\([0-9]*\) \([0-9]*\) \([0-9]*\),\3\2\1,'`
3906 echo "CVSDATE=$cvsdate"
3907 echo "test -d logs || mkdir logs"
3908 echo "for module in $megasubdirs; do"
3909 echo " echo \"Working on module \$module...\""
3910 echo " safemodule=\`echo \$module | sed -e 's|/|-|g'\`"
3911 echo " (echo \"To: gnulib@autobuild.josefsson.org\""
3914 echo " : autobuild project... \$module"
3915 echo " : autobuild revision... cvs-\$CVSDATE-000000"
3916 echo " : autobuild timestamp... \`date \"+%Y%m%d-%H%M%S\"\`"
3917 echo " : autobuild hostname... \`hostname\`"
3918 echo " cd \$module && ./configure \$CONFIGURE_OPTIONS && make && make check && make distclean"
3920 echo " ) 2>&1 | { if test -n \"\$AUTOBUILD_SUBST\"; then sed -e \"\$AUTOBUILD_SUBST\"; else cat; fi; } > logs/\$safemodule"
3922 ) > "$megatestdir/do-autobuild"
3923 chmod a+x "$megatestdir/do-autobuild"
3925 # Create Makefile.am.
3926 (echo "## Process this file with automake to produce Makefile.in."
3928 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
3930 echo "SUBDIRS = $megasubdirs"
3932 echo "EXTRA_DIST = do-autobuild"
3933 ) > "$megatestdir/Makefile.am"
3935 # Create configure.ac.
3936 (echo "# Process this file with autoconf to produce a configure script."
3937 echo "AC_INIT([dummy], [0])"
3938 if test "$auxdir" != "."; then
3939 echo "AC_CONFIG_AUX_DIR([$auxdir])"
3941 echo "AM_INIT_AUTOMAKE"
3943 echo "AC_PROG_MAKE_SET"
3945 echo "AC_CONFIG_SUBDIRS([$megasubdirs])"
3946 echo "AC_OUTPUT([Makefile])"
3947 ) > "$megatestdir/configure.ac"
3949 # Create autogenerated files.
3951 # Do not use "${AUTORECONF} --install", because autoreconf operates
3952 # recursively, but the subdirectories are already finished, therefore
3953 # calling autoreconf here would only waste lots of CPU time.
3954 func_execute_command ${ACLOCAL} || func_exit 1
3955 func_execute_command mkdir build-aux
3956 func_execute_command ${AUTOCONF} || func_exit 1
3957 func_execute_command ${AUTOMAKE} --add-missing --copy || func_exit 1
3963 func_fatal_error "no mode specified" ;;
3972 if test -z "$destdir"; then
3975 test -d "$destdir" \
3976 || func_fatal_error "destination directory does not exist: $destdir"
3978 # Prefer configure.ac to configure.in.
3979 if test -f "$destdir"/configure.ac; then
3980 configure_ac="$destdir/configure.ac"
3982 if test -f "$destdir"/configure.in; then
3983 configure_ac="$destdir/configure.in"
3985 func_fatal_error "cannot find $destdir/configure.ac"
3989 # Analyze configure.ac.
3991 guessed_libtool=false
3996 /AC_CONFIG_AUX_DIR/ {
3997 s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^])]*\).*$,guessed_auxdir="\1",p
3999 /A[CM]_PROG_LIBTOOL/ {
4000 s,^.*$,guessed_libtool=true,p
4002 eval `sed -n -e "$my_sed_traces" < "$configure_ac"`
4004 if test -z "$auxdir"; then
4005 auxdir="$guessed_auxdir"
4008 # Determine where to apply func_import.
4009 if test -n "$m4base"; then
4010 # Apply func_import to a particular gnulib directory.
4011 # Any number of additional modules can be given.
4012 if test ! -f "$destdir/$m4base"/gnulib-cache.m4; then
4013 # First use of gnulib in the given m4base.
4014 test -n "$supplied_libname" || supplied_libname=true
4015 test -n "$sourcebase" || sourcebase="lib"
4016 test -n "$docbase" || docbase="doc"
4017 test -n "$testsbase" || testsbase="tests"
4018 test -n "$macro_prefix" || macro_prefix="gl"
4022 # Apply func_import to all gnulib directories.
4023 # To get this list of directories, look at Makefile.am. (Not at
4024 # configure, because it may be omitted from CVS. Also, don't run
4025 # "find $destdir -name gnulib-cache.m4", as it might be too expensive.)
4028 if test -f "$destdir"/Makefile.am; then
4029 aclocal_amflags=`sed -n 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/p' "$destdir"/Makefile.am`
4031 for arg in $aclocal_amflags; do
4032 if test -n "$m4dir_is_next"; then
4033 # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
4037 if test -f "$destdir/$arg"/gnulib-cache.m4; then
4038 func_append m4dirs " $arg"
4039 m4dirs_count=`expr $m4dirs_count + 1`
4045 if test "X$arg" = "X-I"; then
4053 # No Makefile.am! Oh well. Look at the last generated aclocal.m4.
4054 if test -f "$destdir"/aclocal.m4; then
4055 sedexpr1='s,^m4_include(\[\(.*\)])$,\1,p'
4056 sedexpr2='s,^[^/]*$,.,'
4057 sedexpr3='s,/[^/]*$,,'
4058 m4dirs=`sed -n -e "$sedexpr1" aclocal.m4 | sed -e "$sedexpr2" -e "$sedexpr3" | LC_ALL=C sort -u`
4059 m4dirs_count=`echo "$m4dirs" | wc -l`
4062 if test $m4dirs_count = 0; then
4063 # First use of gnulib in a package.
4064 # Any number of additional modules can be given.
4065 test -n "$supplied_libname" || supplied_libname=true
4066 test -n "$sourcebase" || sourcebase="lib"
4068 test -n "$docbase" || docbase="doc"
4069 test -n "$testsbase" || testsbase="tests"
4070 test -n "$macro_prefix" || macro_prefix="gl"
4073 if test $m4dirs_count = 1; then
4074 # There's only one use of gnulib here. Assume the user means it.
4075 # Any number of additional modules can be given.
4076 for m4base in $m4dirs; do
4080 # Ambiguous - guess what the user meant.
4081 if test $# = 0; then
4082 # No further arguments. Guess the user wants to update all of them.
4083 for m4base in $m4dirs; do
4084 # Perform func_import in a subshell, so that variable values
4086 # local_gnulib_dir, avoidlist, sourcebase, m4base, pobase,
4087 # docbase, testsbase, inctests, libname, lgpl, makefile_name,
4088 # libtool, macro_prefix, po_domain, vc_files
4089 # don't propagate from one directory to another.
4090 (func_import) || func_exit 1
4094 func_fatal_error "Ambiguity: to which directory should the modules be added? Please specify at least --m4-base=..."
4102 if test -z "$destdir"; then
4103 func_fatal_error "please specify --dir option"
4106 test -d "$destdir" \
4107 || func_fatal_error "could not create destination directory"
4108 test -n "$auxdir" || auxdir="build-aux"
4109 func_create_testdir "$destdir" "$*"
4112 create-megatestdir )
4113 if test -z "$destdir"; then
4114 func_fatal_error "please specify --dir option"
4116 mkdir "$destdir" || func_fatal_error "could not create destination directory"
4117 test -n "$auxdir" || auxdir="build-aux"
4118 func_create_megatestdir "$destdir" "$*"
4122 test -n "$destdir" || destdir=testdir$$
4123 mkdir "$destdir" || func_fatal_error "could not create destination directory"
4124 test -n "$auxdir" || auxdir="build-aux"
4125 func_create_testdir "$destdir" "$*"
4129 ../configure || func_exit 1
4131 make check || func_exit 1
4132 make distclean || func_exit 1
4133 remaining=`find . -type f -print`
4134 if test -n "$remaining"; then
4135 echo "Remaining files:" $remaining 1>&2
4136 echo "gnulib-tool: *** Stop." 1>&2
4145 test -n "$destdir" || destdir=testdir$$
4146 mkdir "$destdir" || func_fatal_error "could not create destination directory"
4147 test -n "$auxdir" || auxdir="build-aux"
4148 func_create_megatestdir "$destdir" "$*"
4156 remaining=`find . -type f -print`
4157 if test -n "$remaining"; then
4158 echo "Remaining files:" $remaining 1>&2
4159 echo "gnulib-tool: *** Stop." 1>&2
4167 extract-description )
4171 if test -n "$module"; then
4172 func_get_description "$module"
4181 if test -n "$module"; then
4182 func_get_notice "$module"
4191 if test -n "$module"; then
4192 func_get_filelist "$module"
4197 extract-dependencies )
4201 if test -n "$module"; then
4202 func_get_dependencies "$module"
4207 extract-autoconf-snippet )
4211 if test -n "$module"; then
4212 func_get_autoconf_snippet "$module"
4217 extract-automake-snippet )
4221 if test -n "$module"; then
4222 func_get_automake_snippet "$module"
4227 extract-include-directive )
4231 if test -n "$module"; then
4232 func_get_include_directive "$module"
4237 extract-link-directive )
4241 if test -n "$module"; then
4242 func_get_link_directive "$module"
4251 if test -n "$module"; then
4252 func_get_license "$module"
4257 extract-maintainer )
4261 if test -n "$module"; then
4262 func_get_maintainer "$module"
4267 extract-tests-module )
4271 if test -n "$module"; then
4272 func_get_tests_module "$module"
4278 func_fatal_error "unknown operation mode --$mode" ;;
4282 # Undo the effect of the previous 'trap' command. Some shellology:
4283 # We cannot use "trap - 0 1 2 3 13 15", because Solaris sh would attempt to
4284 # execute the command "-". "trap '' ..." is fine only for signal 0 (= normal
4285 # exit); for the others we need to call 'exit' explicitly. The value of $? is
4286 # 128 + signal number and is set before the trap-registered command is run.
4288 trap 'func_exit $?' 1 2 3 13 15
4293 # indent-tabs-mode: nil
4294 # whitespace-check-buffer-indent: nil