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 --no-changelog don't update or create ChangeLog files
182 Options for --import and --update:
183 --dry-run For --import, only print what would have been done.
184 -s, --symbolic, --symlink Make symbolic links instead of copying files.
185 --local-symlink Make symbolic links instead of copying files, only
186 for files from the local override directory.
187 -S, --more-symlinks Make symbolic links instead of copying files, and
188 don't replace copyright notices.
190 Report bugs to <bug-gnulib@gnu.org>."
194 # outputs to stdout the --version message.
198 if test -d "$gnulib_dir"/.git \
199 && (git --version) >/dev/null 2>/dev/null \
200 && (date --version) >/dev/null 2>/dev/null; then
201 # gnulib checked out from git.
202 sed_extract_first_date='/^Date/{
206 date=`cd "$gnulib_dir" && git log ChangeLog | sed -n -e "$sed_extract_first_date"`
207 # Turn "Fri Mar 21 07:16:51 2008 -0600" into "Mar 21 2008 07:16:51 -0600".
208 sed_year_before_time='s/^[^ ]* \([^ ]*\) \([0-9]*\) \([0-9:]*\) \([0-9]*\) /\1 \2 \4 \3 /'
209 date=`echo "$date" | sed -e "$sed_year_before_time"`
210 # Use GNU date to compute the time in GMT.
211 date=`date -d "$date" -u +"%Y-%m-%d %H:%M:%S"`
212 version=' '`"$gnulib_dir"/build-aux/git-version-gen /dev/null | sed -e 's/-dirty/-modified/'`
214 if test -d "$gnulib_dir"/CVS \
215 && (cvs --version) >/dev/null 2>/dev/null; then
216 # gnulib checked out from CVS.
217 sed_extract_first_date='/^date: /{
218 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
221 date=`cd "$gnulib_dir" && cvs log -N ChangeLog 2>/dev/null | sed -n -e "$sed_extract_first_date"`
223 # gnulib copy without versioning information.
224 date=`sed -e 's/ .*//;q' "$gnulib_dir"/ChangeLog`
228 year=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed 's,^.* ,,'`
230 gnulib-tool (GNU $package $date)$version
231 Copyright (C) $year Free Software Foundation, Inc.
232 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
233 This is free software: you are free to change and redistribute it.
234 There is NO WARRANTY, to the extent permitted by law.
236 Written by" "Bruno Haible" "and" "Simon Josefsson"
239 # func_emit_copyright_notice
240 # outputs to stdout a header for a generated file.
241 func_emit_copyright_notice ()
243 sed -n '/Copyright/ {
246 }' < "$self_abspathname"
248 echo "# This file is free software, distributed under the terms of the GNU"
249 echo "# General Public License. As a special exception to the GNU General"
250 echo "# Public License, this file may be distributed as part of a program"
251 echo "# that contains a configuration script generated by Autoconf, under"
252 echo "# the same distribution terms as the rest of that program."
254 echo "# Generated by gnulib-tool."
265 # locates the directory where the gnulib repository lives
267 # - self_abspathname absolute pathname of gnulib-tool
268 # - gnulib_dir absolute pathname of gnulib repository
272 /*) self_abspathname="$0" ;;
273 */*) self_abspathname=`pwd`/"$0" ;;
276 # Iterate through the elements of $PATH.
277 # We use IFS=: instead of
278 # for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'`
279 # because the latter does not work when some PATH element contains spaces.
280 # We use a canonicalized $pathx instead of $PATH, because empty PATH
281 # elements are by definition equivalent to '.', however field splitting
282 # according to IFS=: loses empty fields in many shells:
283 # - /bin/sh on OSF/1 and Solaris loses all empty fields (at the
284 # beginning, at the end, and in the middle),
285 # - /bin/sh on IRIX and /bin/ksh on IRIX and OSF/1 lose empty fields
286 # at the beginning and at the end,
287 # - GNU bash, /bin/sh on AIX and HP-UX, and /bin/ksh on AIX, HP-UX,
288 # Solaris lose empty fields at the end.
289 # The 'case' statement is an optimization, to avoid evaluating the
290 # explicit canonicalization command when $PATH contains no empty fields.
292 if test "${PATH_SEPARATOR+set}" != set; then
294 { echo "#! /bin/sh"; echo "exit 0"; } > "$tmp"/conf.sh
295 chmod +x "$tmp"/conf.sh
296 if (PATH="/nonexistent;$tmp"; conf.sh) >/dev/null 2>&1; then
303 if test "$PATH_SEPARATOR" = ";"; then
304 # On Windows, programs are searched in "." before $PATH.
307 # On Unix, we have to convert empty PATH elements to ".".
311 pathx=`echo ":$PATH:" | sed -e 's/:::*/:.:/g' -e 's/^://' -e 's/:\$//'`
316 IFS="$PATH_SEPARATOR"
320 if test -x "$d/$0" && test ! -d "$d/$0"; then
321 self_abspathname="$d/$0"
326 if test -z "$self_abspathname"; then
327 func_fatal_error "could not locate the gnulib-tool program - how did you invoke it?"
331 while test -h "$self_abspathname"; do
332 # Resolve symbolic link.
333 linkval=`func_readlink "$self_abspathname"`
334 test -n "$linkval" || break
336 /* ) self_abspathname="$linkval" ;;
337 * ) self_abspathname=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;;
340 gnulib_dir=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
344 # creates a temporary directory.
346 # - tmp pathname of freshly created temporary directory
349 # Use the environment variable TMPDIR, falling back to /tmp. This allows
350 # users to specify a different temporary directory, for example, if their
351 # /tmp is filled up or too small.
354 # Use the mktemp program if available. If not available, hide the error
356 tmp=`(umask 077 && mktemp -d "$TMPDIR/glXXXXXX") 2>/dev/null` &&
357 test -n "$tmp" && test -d "$tmp"
360 # Use a simple mkdir command. It is guaranteed to fail if the directory
361 # already exists. $RANDOM is bash specific and expands to empty in shells
362 # other than bash, ksh and zsh. Its use does not increase security;
363 # rather, it minimizes the probability of failure in a very cluttered /tmp
365 tmp=$TMPDIR/gl$$-$RANDOM
366 (umask 077 && mkdir "$tmp")
369 echo "$0: cannot create a temporary directory in $TMPDIR" >&2
374 # func_append var value
375 # appends the given value to the shell variable var.
376 if ( foo=bar; foo+=baz && test "$foo" = barbaz ) >/dev/null 2>&1; then
377 # Use bash's += operator. It reduces complexity of appending repeatedly to
378 # a single variable from O(n^2) to O(n).
386 eval "$1=\"\$$1\$2\""
390 # func_fatal_error message
391 # outputs to stderr a fatal error message, and terminates the program.
394 echo "gnulib-tool: *** $1" 1>&2
395 echo "gnulib-tool: *** Stop." 1>&2
399 # func_readlink SYMLINK
400 # outputs the target of the given symlink.
401 if (type -p readlink) > /dev/null 2>&1; then
404 # Use the readlink program from GNU coreutils.
410 # Use two sed invocations. A single sed -n -e 's,^.* -> \(.*\)$,\1,p'
411 # would do the wrong thing if the link target contains " -> ".
412 LC_ALL=C ls -l "$1" | sed -e 's, -> ,#%%#,' | sed -n -e 's,^.*#%%#\(.*\)$,\1,p'
416 # func_relativize DIR1 DIR2
417 # computes a relative pathname RELDIR such that DIR1/RELDIR = DIR2.
419 # - DIR1 relative pathname, relative to the current directory
420 # - DIR2 relative pathname, relative to the current directory
422 # - reldir relative pathname of DIR2, relative to DIR1
428 sed_first='s,^\([^/]*\)/.*$,\1,'
429 sed_rest='s,^[^/]*/*,,'
430 sed_last='s,^.*/\([^/]*\)$,\1,'
431 sed_butlast='s,/*[^/]*$,,'
432 while test -n "$dir1"; do
433 first=`echo "$dir1" | sed -e "$sed_first"`
434 if test "$first" != "."; then
435 if test "$first" = ".."; then
436 dir2=`echo "$dir0" | sed -e "$sed_last"`/"$dir2"
437 dir0=`echo "$dir0" | sed -e "$sed_butlast"`
439 first2=`echo "$dir2" | sed -e "$sed_first"`
440 if test "$first2" = "$first"; then
441 dir2=`echo "$dir2" | sed -e "$sed_rest"`
445 dir0="$dir0"/"$first"
448 dir1=`echo "$dir1" | sed -e "$sed_rest"`
453 # func_relconcat DIR1 DIR2
454 # computes a relative pathname DIR1/DIR2, with obvious simplifications.
456 # - DIR1 relative pathname, relative to the current directory
457 # - DIR2 relative pathname, relative to DIR1
459 # - relconcat DIR1/DIR2, relative to the current directory
464 sed_first='s,^\([^/]*\)/.*$,\1,'
465 sed_rest='s,^[^/]*/*,,'
466 sed_last='s,^.*/\([^/]*\)$,\1,'
467 sed_butlast='s,/*[^/]*$,,'
469 first=`echo "$dir2" | sed -e "$sed_first"`
470 if test "$first" = "."; then
471 dir2=`echo "$dir2" | sed -e "$sed_rest"`
472 if test -z "$dir2"; then
477 last=`echo "$dir1" | sed -e "$sed_last"`
478 while test "$last" = "."; do
479 dir1=`echo "$dir1" | sed -e "$sed_butlast"`
480 last=`echo "$dir1" | sed -e "$sed_last"`
482 if test -z "$dir1"; then
486 if test "$first" = ".."; then
487 if test "$last" = ".."; then
488 relconcat="$dir1/$dir2"
491 dir1=`echo "$dir1" | sed -e "$sed_butlast"`
492 dir2=`echo "$dir2" | sed -e "$sed_rest"`
493 if test -z "$dir1"; then
497 if test -z "$dir2"; then
502 relconcat="$dir1/$dir2"
510 # Like ln -s, except that SRC is given relative to the current directory (or
511 # absolute), not given relative to the directory of DEST.
517 *) # SRC is relative.
520 ln -s "`pwd`/$1" "$2" ;;
521 *) # DEST is relative too.
522 ln_destdir=`echo "$2" | sed -e 's,[^/]*$,,'`
523 test -n "$ln_destdir" || ln_destdir="."
524 func_relativize "$ln_destdir" "$1"
532 # func_ln_if_changed SRC DEST
533 # Like func_ln, but avoids munging timestamps if the link is correct.
534 func_ln_if_changed ()
536 if test $# -ne 2; then
537 echo "usage: func_ln_if_changed SRC DEST" >&2
539 ln_target=`func_readlink "$2"`
540 if test -h "$2" && test "$1" = "$ln_target"; then
548 # Ensure an 'echo' command that does not interpret backslashes.
550 # echo '\n' | wc -l prints 1 when OK, 2 when KO
551 # echo '\t' | grep t > /dev/null has return code 0 when OK, 1 when KO
552 # This problem is a weird heritage from SVR4. BSD got it right (except that
553 # BSD echo interprets '-n' as an option, which is also not desirable).
554 # Nowadays the problem occurs in 4 situations:
555 # - in bash, when the shell option xpg_echo is set (bash >= 2.04)
556 # or when it was built with --enable-usg-echo-default (bash >= 2.0)
557 # or when it was built with DEFAULT_ECHO_TO_USG (bash < 2.0),
558 # - in zsh, when sh-emulation is not set,
559 # - in ksh (e.g. AIX /bin/sh and Solaris /usr/xpg4/bin/sh are ksh instances,
560 # and HP-UX /bin/sh and IRIX /bin/sh behave similarly),
561 # - in Solaris /bin/sh and OSF/1 /bin/sh.
562 # We try the following workarounds:
563 # - for all: respawn using $CONFIG_SHELL if that is set and works.
564 # - for bash >= 2.04: unset the shell option xpg_echo.
565 # - for bash >= 2.0: define echo to a function that uses the printf built-in.
566 # - for bash < 2.0: define echo to a function that uses cat of a here document.
567 # - for zsh: turn sh-emulation on.
568 # - for ksh: alias echo to 'print -r'.
569 # - for ksh: alias echo to a function that uses cat of a here document.
570 # - for Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh and rely on
571 # the ksh workaround.
572 # - otherwise: respawn using /bin/sh and rely on the workarounds.
573 # When respawning, we pass --no-reexec as first argument, so as to avoid
574 # turning this script into a fork bomb in unlucky situations.
576 if echo '\t' | grep t > /dev/null; then
577 have_echo=yes # Lucky!
579 # Try the workarounds.
580 # Respawn using $CONFIG_SHELL if that is set and works.
581 if test -z "$have_echo" \
582 && test "X$1" != "X--no-reexec" \
583 && test -n "$CONFIG_SHELL" \
584 && test -f "$CONFIG_SHELL" \
585 && $CONFIG_SHELL -c 'echo '\t' | grep t > /dev/null'; then
586 exec $CONFIG_SHELL "$0" --no-reexec "$@"
589 # For bash >= 2.04: unset the shell option xpg_echo.
590 if test -z "$have_echo" \
591 && test -n "$BASH_VERSION" \
592 && (shopt -o xpg_echo; echo '\t' | grep t > /dev/null) 2>/dev/null; then
596 # For bash >= 2.0: define echo to a function that uses the printf built-in.
597 # For bash < 2.0: define echo to a function that uses cat of a here document.
598 # (There is no win in using 'printf' over 'cat' if it is not a shell built-in.)
599 if test -z "$have_echo" \
600 && test -n "$BASH_VERSION"; then \
601 if type printf 2>/dev/null | grep / > /dev/null; then
602 # 'printf' is not a shell built-in.
610 # 'printf' is a shell built-in.
616 if echo '\t' | grep t > /dev/null; then
620 # For zsh: turn sh-emulation on.
621 if test -z "$have_echo" \
622 && test -n "$ZSH_VERSION" \
623 && (emulate sh) >/dev/null 2>&1; then
626 # For ksh: alias echo to 'print -r'.
627 if test -z "$have_echo" \
628 && (type print) >/dev/null 2>&1; then
629 # A 'print' command exists.
630 if type print 2>/dev/null | grep / > /dev/null; then
633 # 'print' is a shell built-in.
634 if (print -r '\told' | grep told > /dev/null) 2>/dev/null; then
635 # 'print' is the ksh shell built-in.
636 alias echo='print -r'
640 if test -z "$have_echo" \
641 && echo '\t' | grep t > /dev/null; then
644 # For ksh: alias echo to a function that uses cat of a here document.
645 # The ksh manual page says:
646 # "Aliasing is performed when scripts are read, not while they are executed.
647 # Therefore, for an alias to take effect, the alias definition command has
648 # to be executed before the command which references the alias is read."
649 # Because of this, we have to play strange tricks with have_echo, to ensure
650 # that the top-level statement containing the test starts after the 'alias'
652 if test -z "$have_echo"; then
659 alias echo=bsd_echo 2>/dev/null
661 if test -z "$have_echo" \
662 && echo '\t' | grep t > /dev/null; then
665 if test -z "$have_echo"; then
666 unalias echo 2>/dev/null
668 # For Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh.
669 if test -z "$have_echo" \
670 && test "X$1" != "X--no-reexec" \
671 && test -f /bin/ksh; then
672 exec /bin/ksh "$0" --no-reexec "$@"
675 # Otherwise: respawn using /bin/sh.
676 if test -z "$have_echo" \
677 && test "X$1" != "X--no-reexec" \
678 && test -f /bin/sh; then
679 exec /bin/sh "$0" --no-reexec "$@"
682 if test -z "$have_echo"; then
683 func_fatal_error "Shell does not support 'echo' correctly. Please install GNU bash and set the environment variable CONFIG_SHELL to point to it."
685 if echo '\t' | grep t > /dev/null; then
688 func_fatal_error "Shell does not support 'echo' correctly. Workaround does not work. Please report this as a bug to bug-gnulib@gnu.org."
690 if test "X$1" = "X--no-reexec"; then
694 # Command-line option processing.
695 # Removes the OPTIONS from the arguments. Sets the variables:
696 # - mode list or import or create-testdir or create-megatestdir
697 # - destdir from --dir
698 # - local_gnulib_dir from --local-dir
699 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
700 # - libname, supplied_libname from --lib
701 # - sourcebase from --source-base
702 # - m4base from --m4-base
703 # - pobase from --po-base
704 # - docbase from --doc-base
705 # - testsbase from --tests-base
706 # - auxdir from --aux-dir
707 # - inctests true if --with-tests was given, blank otherwise
708 # - avoidlist list of modules to avoid, from --avoid
709 # - lgpl yes or a number if --lgpl was given, blank otherwise
710 # - makefile_name from --makefile-name
711 # - libtool true if --libtool was given, false if --no-libtool was
712 # given, blank otherwise
713 # - macro_prefix from --macro-prefix
714 # - po_domain from --po-domain
715 # - autoconf_minversion minimum supported autoconf version
716 # - do_changelog false if --no-changelog was given, : otherwise
717 # - doit : if actions shall be executed, false if only to be printed
718 # - symbolic true if --symlink or --more-symlinks was given, blank
720 # - lsymbolic true if --local-symlink was given, blank otherwise
721 # - do_copyrights blank if --more-symlinks was given, true otherwise
750 while test $# -gt 0; do
755 --import | --impor | --impo | --imp | --im | --i )
758 --update | --updat | --upda | --upd | --up | --u )
761 --create-testdir | --create-testdi | --create-testd | --create-test | --create-tes | --create-te | --create-t )
764 --create-megatestdir | --create-megatestdi | --create-megatestd | --create-megatest | --create-megates | --create-megate | --create-megat | --create-mega | --create-meg | --create-me | --create-m )
765 mode=create-megatestdir
767 --test | --tes | --te | --t )
770 --megatest | --megates | --megate | --megat | --mega | --meg | --me | --m )
774 mode=`echo "X$1" | sed -e 's/^X--//'`
779 func_fatal_error "missing argument for --dir"
784 destdir=`echo "X$1" | sed -e 's/^X--dir=//'`
789 func_fatal_error "missing argument for --local-dir"
794 local_gnulib_dir=`echo "X$1" | sed -e 's/^X--local-dir=//'`
796 --verbose | --verbos | --verbo | --verb )
797 verbose=`expr $verbose + 1`
799 --quiet | --quie | --qui | --qu | --q )
800 verbose=`expr $verbose - 1`
805 func_fatal_error "missing argument for --lib"
808 supplied_libname=true
811 libname=`echo "X$1" | sed -e 's/^X--lib=//'`
812 supplied_libname=true
817 func_fatal_error "missing argument for --source-base"
822 sourcebase=`echo "X$1" | sed -e 's/^X--source-base=//'`
827 func_fatal_error "missing argument for --m4-base"
832 m4base=`echo "X$1" | sed -e 's/^X--m4-base=//'`
837 func_fatal_error "missing argument for --po-base"
842 pobase=`echo "X$1" | sed -e 's/^X--po-base=//'`
847 func_fatal_error "missing argument for --doc-base"
852 docbase=`echo "X$1" | sed -e 's/^X--doc-base=//'`
857 func_fatal_error "missing argument for --tests-base"
862 testsbase=`echo "X$1" | sed -e 's/^X--tests-base=//'`
867 func_fatal_error "missing argument for --aux-dir"
872 auxdir=`echo "X$1" | sed -e 's/^X--aux-dir=//'`
880 func_fatal_error "missing argument for --avoid"
882 func_append avoidlist " $1"
885 arg=`echo "X$1" | sed -e 's/^X--avoid=//'`
886 func_append avoidlist " $arg"
892 arg=`echo "X$1" | sed -e 's/^X--lgpl=//'`
895 *) func_fatal_error "invalid LGPL version number for --lgpl" ;;
902 func_fatal_error "missing argument for --makefile-name"
907 makefile_name=`echo "X$1" | sed -e 's/^X--makefile-name=//'`
918 func_fatal_error "missing argument for --macro-prefix"
923 macro_prefix=`echo "X$1" | sed -e 's/^X--macro-prefix=//'`
928 func_fatal_error "missing argument for --po-domain"
933 po_domain=`echo "X$1" | sed -e 's/^X--po-domain=//'`
935 --no-changelog | --no-changelo | --no-changel | --no-change | --no-chang | --no-chan | --no-cha | --no-ch | --no-c )
941 -s | --symbolic | --symboli | --symbol | --symbo | --symb | --symlink | --symlin | --symli | --syml | --sym | --sy )
944 --local-symlink | --local-symlin | --local-symli | --local-syml | --local-sym | --local-sy | --local-s )
947 -S | --more-symlinks | --more-symlink | --more-symlin | --more-symli | --more-syml | --more-sym | --more-sy | --more-s | --more- | --more | --mor | --mo )
951 --help | --hel | --he | --h )
954 --version | --versio | --versi | --vers )
958 # Stop option processing
962 echo "gnulib-tool: unknown option $1" 1>&2
963 echo "Try 'gnulib-tool --help' for more information." 1>&2
970 if test "$mode" = update; then
971 if test $# != 0; then
972 echo "gnulib-tool: too many arguments in 'update' mode" 1>&2
973 echo "Try 'gnulib-tool --help' for more information." 1>&2
974 echo "If you really want to modify the gnulib configuration of your project," 1>&2
975 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
978 if test -n "$local_gnulib_dir" || test -n "$supplied_libname" \
979 || test -n "$sourcebase" || test -n "$m4base" || test -n "$pobase" \
980 || test -n "$docbase" || test -n "$testsbase" || test -n "$auxdir" \
981 || test -n "$inctests" || test -n "$avoidlist" || test -n "$lgpl" \
982 || test -n "$makefile_name" || test -n "$macro_prefix" \
983 || test -n "$po_domain"; then
984 echo "gnulib-tool: invalid options for '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
992 if test -n "$pobase" && test -z "$po_domain"; then
993 echo "gnulib-tool: together with --po-base, you need to specify --po-domain" 1>&2
994 echo "Try 'gnulib-tool --help' for more information." 1>&2
997 if test -z "$pobase" && test -n "$po_domain"; then
998 echo "gnulib-tool: warning: --po-domain has no effect without a --po-base option" 1>&2
1001 # Determine the minimum supported autoconf version from the project's
1003 DEFAULT_AUTOCONF_MINVERSION="2.59"
1004 autoconf_minversion=
1006 if { test "$mode" = import || test "$mode" = update; } && test -n "$destdir"; then
1007 if test -f "$destdir"/configure.ac; then
1008 configure_ac="$destdir/configure.ac"
1010 if test -f "$destdir"/configure.in; then
1011 configure_ac="$destdir/configure.in"
1015 if test -f configure.ac; then
1016 configure_ac="configure.ac"
1018 if test -f configure.in; then
1019 configure_ac="configure.in"
1023 if test -n "$configure_ac"; then
1024 # Use sed, not autoconf --trace, to look for the AC_PREREQ invocation,
1025 # because when some m4 files are omitted from a CVS repository,
1026 # "autoconf --trace=AC_PREREQ" fails with an error message like this:
1027 # m4: aclocal.m4:851: Cannot open m4/absolute-header.m4: No such file or directory
1028 # autom4te: m4 failed with exit status: 1
1035 s,^.*AC_PREREQ([[ ]*\([^])]*\).*$,\1,p
1037 prereqs=`sed -n -e "$my_sed_traces" < "$configure_ac"`
1038 if test -n "$prereqs"; then
1039 autoconf_minversion=`
1040 for version in $prereqs; do echo $version; done |
1041 LC_ALL=C sort -nru | sed 1q
1045 if test -z "$autoconf_minversion"; then
1046 autoconf_minversion=$DEFAULT_AUTOCONF_MINVERSION
1048 case "$autoconf_minversion" in
1049 1.* | 2.[0-4]* | 2.5[0-8]*)
1050 func_fatal_error "minimum supported autoconf version is 2.59. Try adding AC_PREREQ([$DEFAULT_AUTOCONF_MINVERSION]) to your configure.ac." ;;
1053 # Remove trailing slashes from the directory names. This is necessary for
1054 # m4base (to avoid an error in func_import) and optional for the others.
1055 sed_trimtrailingslashes='s,\([^/]\)//*$,\1,'
1056 case "$local_gnulib_dir" in
1057 */ ) local_gnulib_dir=`echo "$local_gnulib_dir" | sed -e "$sed_trimtrailingslashes"` ;;
1059 case "$sourcebase" in
1060 */ ) sourcebase=`echo "$sourcebase" | sed -e "$sed_trimtrailingslashes"` ;;
1063 */ ) m4base=`echo "$m4base" | sed -e "$sed_trimtrailingslashes"` ;;
1066 */ ) pobase=`echo "$pobase" | sed -e "$sed_trimtrailingslashes"` ;;
1069 */ ) docbase=`echo "$docbase" | sed -e "$sed_trimtrailingslashes"` ;;
1071 case "$testsbase" in
1072 */ ) testsbase=`echo "$testsbase" | sed -e "$sed_trimtrailingslashes"` ;;
1075 */ ) auxdir=`echo "$auxdir" | sed -e "$sed_trimtrailingslashes"` ;;
1081 trap 'exit_status=$?
1082 if test "$signal" != 0; then
1083 echo "caught signal $signal" >&2
1086 exit $exit_status' 0
1087 for signal in 1 2 3 13 15; do
1088 trap '{ signal='$signal'; func_exit 1; }' $signal
1092 # func_lookup_file file
1093 # looks up a file in $local_gnulib_dir or $gnulib_dir, or combines it through
1096 # - local_gnulib_dir from --local-dir
1098 # - lookedup_file name of the merged (combined) file
1099 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
1103 if test -n "$local_gnulib_dir" && test -f "$local_gnulib_dir/$lkfile"; then
1104 lookedup_file="$local_gnulib_dir/$lkfile"
1107 if test -f "$gnulib_dir/$lkfile"; then
1108 if test -n "$local_gnulib_dir" && test -f "$local_gnulib_dir/$lkfile.diff"; then
1109 lkbase=`echo "$lkfile" | sed -e 's,^.*/,,'`
1110 rm -f "$tmp/$lkbase"
1111 cp "$gnulib_dir/$lkfile" "$tmp/$lkbase"
1112 patch -s "$tmp/$lkbase" < "$local_gnulib_dir/$lkfile.diff" \
1113 || func_fatal_error "patch file $local_gnulib_dir/$lkfile.diff didn't apply cleanly"
1114 lookedup_file="$tmp/$lkbase"
1117 lookedup_file="$gnulib_dir/$lkfile"
1121 func_fatal_error "file $gnulib_dir/$lkfile not found"
1128 # - local_gnulib_dir from --local-dir
1131 # Filter out metainformation files like README, which are not modules.
1132 # Filter out unit test modules; they can be retrieved through
1133 # --extract-tests-module if desired.
1135 (cd "$gnulib_dir" && find modules -type f -print | sed -e 's,^modules/,,')
1136 if test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules"; then
1137 (cd "$local_gnulib_dir" && find modules -type f -print | sed -e 's,^modules/,,' -e 's,\.diff$,,')
1140 | sed -e '/^CVS\//d' -e '/\/CVS\//d' \
1141 -e '/^ChangeLog$/d' -e '/\/ChangeLog$/d' \
1142 -e '/^COPYING$/d' -e '/\/COPYING$/d' \
1143 -e '/^README$/d' -e '/\/README$/d' \
1144 -e '/^TEMPLATE$/d' \
1145 -e '/^TEMPLATE-EXTENDED$/d' \
1146 -e '/^TEMPLATE-TESTS$/d' \
1149 | sed -e '/-tests$/d' \
1153 # func_verify_module
1154 # verifies a module name
1156 # - local_gnulib_dir from --local-dir
1157 # - module module name argument
1158 func_verify_module ()
1160 if { test -f "$gnulib_dir/modules/$module" \
1161 || { test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules" \
1162 && test -f "$local_gnulib_dir/modules/$module"; }; } \
1163 && test "CVS" != "$module" \
1164 && test "ChangeLog" != "$module" \
1165 && test "COPYING" != "$module" \
1166 && test "README" != "$module" \
1167 && test "TEMPLATE" != "$module" \
1168 && test "TEMPLATE-EXTENDED" != "$module" \
1169 && test "TEMPLATE-TESTS" != "$module"; then
1170 # OK, $module is a correct module name.
1171 # Verify that building the module description with 'patch' succeeds.
1172 func_lookup_file "modules/$module"
1174 echo "gnulib-tool: module $module doesn't exist" 1>&2
1179 # func_verify_nontests_module
1180 # verifies a module name, excluding tests modules
1182 # - local_gnulib_dir from --local-dir
1183 # - module module name argument
1184 func_verify_nontests_module ()
1187 *-tests ) module= ;;
1188 * ) func_verify_module ;;
1192 # func_verify_tests_module
1193 # verifies a module name, considering only tests modules
1195 # - local_gnulib_dir from --local-dir
1196 # - module module name argument
1197 func_verify_tests_module ()
1200 *-tests ) func_verify_module ;;
1205 sed_extract_prog=':[ ]*$/ {
1208 s/^Description:[ ]*$//
1211 s/^Depends-on:[ ]*$//
1212 s/^configure\.ac-early:[ ]*$//
1213 s/^configure\.ac:[ ]*$//
1214 s/^Makefile\.am:[ ]*$//
1218 s/^Maintainer:[ ]*$//
1225 # func_get_description module
1227 # - local_gnulib_dir from --local-dir
1228 func_get_description ()
1230 func_lookup_file "modules/$1"
1231 sed -n -e "/^Description$sed_extract_prog" < "$lookedup_file"
1234 # func_get_notice module
1236 # - local_gnulib_dir from --local-dir
1239 func_lookup_file "modules/$1"
1240 sed -n -e "/^Notice$sed_extract_prog" < "$lookedup_file"
1243 # func_get_filelist module
1245 # - local_gnulib_dir from --local-dir
1246 func_get_filelist ()
1248 func_lookup_file "modules/$1"
1249 sed -n -e "/^Files$sed_extract_prog" < "$lookedup_file"
1250 echo m4/gnulib-common.m4
1251 case "$autoconf_minversion" in
1253 #echo m4/onceonly.m4
1254 echo m4/onceonly_2_57.m4
1259 # func_get_dependencies module
1261 # - local_gnulib_dir from --local-dir
1262 func_get_dependencies ()
1264 # ${module}-tests always implicitly depends on ${module}.
1265 echo "$1" | sed -n -e 's/-tests$//p'
1266 # Then the explicit dependencies listed in the module description.
1267 func_lookup_file "modules/$1"
1268 sed -n -e "/^Depends-on$sed_extract_prog" < "$lookedup_file"
1271 # func_get_autoconf_early_snippet module
1273 # - local_gnulib_dir from --local-dir
1274 func_get_autoconf_early_snippet ()
1276 func_lookup_file "modules/$1"
1277 sed -n -e "/^configure\.ac-early$sed_extract_prog" < "$lookedup_file"
1280 # func_get_autoconf_snippet module
1282 # - local_gnulib_dir from --local-dir
1283 func_get_autoconf_snippet ()
1285 func_lookup_file "modules/$1"
1286 sed -n -e "/^configure\.ac$sed_extract_prog" < "$lookedup_file"
1289 # func_get_automake_snippet module
1291 # - local_gnulib_dir from --local-dir
1292 func_get_automake_snippet ()
1294 func_lookup_file "modules/$1"
1295 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
1298 # *-tests module live in tests/, not lib/.
1299 # Synthesize an EXTRA_DIST augmentation.
1300 all_files=`func_get_filelist $1`
1301 tests_files=`for f in $all_files; do \
1303 tests/*) echo $f ;; \
1305 done | sed -e 's,^tests/,,'`
1306 extra_files="$tests_files"
1307 if test -n "$extra_files"; then
1308 echo "EXTRA_DIST +=" $extra_files
1313 # Synthesize an EXTRA_DIST augmentation.
1314 sed_combine_lines='/\\$/{
1321 sed_extract_mentioned_files='s/^lib_SOURCES[ ]*+=[ ]*//p'
1322 already_mentioned_files=` \
1323 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file" \
1324 | sed -e "$sed_combine_lines" \
1325 | sed -n -e "$sed_extract_mentioned_files" | sed -e 's/#.*//'`
1326 all_files=`func_get_filelist $1`
1327 lib_files=`for f in $all_files; do \
1331 done | sed -e 's,^lib/,,'`
1332 # Remove $already_mentioned_files from $lib_files.
1333 echo "$lib_files" | LC_ALL=C sort -u > "$tmp"/lib-files
1334 extra_files=`for f in $already_mentioned_files; do echo $f; done \
1335 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/lib-files`
1336 if test -n "$extra_files"; then
1337 echo "EXTRA_DIST +=" $extra_files
1340 # Synthesize also an EXTRA_lib_SOURCES augmentation.
1341 # This is necessary so that automake can generate the right list of
1343 # A possible approach would be to use autom4te --trace of the redefined
1344 # AC_LIBOBJ and AC_REPLACE_FUNCS macros when creating the Makefile.am
1345 # (use autom4te --trace, not just grep, so that AC_LIBOBJ invocations
1346 # inside autoconf's built-in macros are not missed).
1347 # But it's simpler and more robust to do it here, based on the file list.
1348 # If some .c file exists and is not used with AC_LIBOBJ - for example,
1349 # a .c file is preprocessed into another .c file for BUILT_SOURCES -,
1350 # automake will generate a useless dependency; this is harmless.
1352 relocatable-prog-wrapper) ;;
1354 sed_extract_c_files='/\.c$/p'
1355 extra_files=`echo "$extra_files" | sed -n -e "$sed_extract_c_files"`
1356 if test -n "$extra_files"; then
1357 echo "EXTRA_lib_SOURCES +=" $extra_files
1362 # Synthesize an EXTRA_DIST augmentation also for the files in build-aux/.
1363 buildaux_files=`for f in $all_files; do \
1365 build-aux/*) echo $f ;; \
1367 done | sed -e 's,^build-aux/,,'`
1368 if test -n "$buildaux_files"; then
1369 sed_prepend_auxdir='s,^,$(top_srcdir)/'"$auxdir"'/,'
1370 echo "EXTRA_DIST += "`echo "$buildaux_files" | sed -e "$sed_prepend_auxdir"`
1373 # Synthesize an EXTRA_DIST augmentation also for the files from top/.
1374 top_files=`for f in $all_files; do \
1378 done | sed -e 's,^top/,,'`
1379 if test -n "$top_files"; then
1380 sed_prepend_topdir='s,^,$(top_srcdir)/,'
1381 echo "EXTRA_DIST += "`echo "$top_files" | sed -e "$sed_prepend_topdir"`
1388 # func_get_include_directive module
1390 # - local_gnulib_dir from --local-dir
1391 func_get_include_directive ()
1393 func_lookup_file "modules/$1"
1394 sed -n -e "/^Include$sed_extract_prog" < "$lookedup_file" | \
1395 sed -e 's/^\(["<]\)/#include \1/'
1398 # func_get_link_directive module
1400 # - local_gnulib_dir from --local-dir
1401 func_get_link_directive ()
1403 func_lookup_file "modules/$1"
1404 sed -n -e "/^Link$sed_extract_prog" < "$lookedup_file"
1407 # func_get_license module
1409 # - local_gnulib_dir from --local-dir
1412 func_lookup_file "modules/$1"
1413 { sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
1414 # The default is GPL.
1416 } | sed -e 's,^ *$,,' | sed -e 1q
1419 # func_get_maintainer module
1421 # - local_gnulib_dir from --local-dir
1422 func_get_maintainer ()
1424 func_lookup_file "modules/$1"
1425 sed -n -e "/^Maintainer$sed_extract_prog" < "$lookedup_file"
1428 # func_get_tests_module module
1430 # - local_gnulib_dir from --local-dir
1431 func_get_tests_module ()
1433 # The naming convention for tests modules is hardwired: ${module}-tests.
1434 if test -f "$gnulib_dir/modules/$1"-tests \
1435 || { test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules" \
1436 && test -f "$local_gnulib_dir/modules/$1"-tests; }; then
1441 # func_acceptable module
1442 # tests whether a module is acceptable.
1444 # - avoidlist list of modules to avoid
1447 for avoid in $avoidlist; do
1448 if test "$avoid" = "$1"; then
1455 # func_modules_transitive_closure
1457 # - local_gnulib_dir from --local-dir
1458 # - modules list of specified modules
1459 # - inctests true if tests should be included, blank otherwise
1460 # - avoidlist list of modules to avoid
1461 # - tmp pathname of a temporary directory
1463 # - modules list of modules, including dependencies
1464 func_modules_transitive_closure ()
1466 # In order to process every module only once (for speed), process an "input
1467 # list" of modules, producing an "output list" of modules. During each round,
1468 # more modules can be queued in the input list. Once a module on the input
1469 # list has been processed, it is added to the "handled list", so we can avoid
1470 # to process it again.
1472 inmodules="$modules"
1474 while test -n "$inmodules"; do
1475 inmodules_this_round="$inmodules"
1476 inmodules= # Accumulator, queue for next round
1477 for module in $inmodules_this_round; do
1479 if test -n "$module"; then
1480 if func_acceptable $module; then
1481 func_append outmodules " $module"
1482 deps=`func_get_dependencies $module`
1483 # Duplicate dependencies are harmless, but Jim wants a warning.
1484 duplicated_deps=`echo "$deps" | LC_ALL=C sort | LC_ALL=C uniq -d`
1485 if test -n "$duplicated_deps"; then
1486 echo "warning: module $module has duplicated dependencies: "`echo $duplicated_deps` 1>&2
1488 func_append inmodules " $deps"
1489 if test -n "$inctests"; then
1490 testsmodule=`func_get_tests_module $module`
1491 if test -n "$testsmodule"; then
1492 func_append inmodules " $testsmodule"
1498 handledmodules=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
1499 # Remove $handledmodules from $inmodules.
1500 for m in $inmodules; do echo $m; done | LC_ALL=C sort -u > "$tmp"/queued-modules
1501 inmodules=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
1503 modules=`for m in $outmodules; do echo $m; done | LC_ALL=C sort -u`
1504 rm -f "$tmp"/queued-modules
1507 # func_modules_add_dummy
1509 # - local_gnulib_dir from --local-dir
1510 # - modules list of modules, including dependencies
1512 # - modules list of modules, including 'dummy' if needed
1513 func_modules_add_dummy ()
1516 sed_remove_backslash_newline=':a
1523 for module in $modules; do
1524 func_verify_nontests_module
1525 if test -n "$module"; then
1526 # Extract the value of "lib_SOURCES += ...".
1527 for file in `func_get_automake_snippet "$module" | sed -e "$sed_remove_backslash_newline" | sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'`; do
1528 # Ignore .h files since they are not compiled.
1531 *) have_lib_SOURCES=yes ;;
1536 # Add the dummy module, to make sure the library will be non-empty.
1537 if test -z "$have_lib_SOURCES"; then
1538 if func_acceptable "dummy"; then
1539 func_append modules " dummy"
1544 # func_modules_notice
1546 # - local_gnulib_dir from --local-dir
1547 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
1548 # - modules list of modules, including dependencies
1549 func_modules_notice ()
1551 if test $verbose -ge -1; then
1552 for module in $modules; do
1554 if test -n "$module"; then
1555 msg=`func_get_notice $module`
1556 if test -n "$msg"; then
1557 echo "Notice from module $module:"
1558 echo "$msg" | sed -e 's/^/ /'
1565 # func_modules_to_filelist
1567 # - local_gnulib_dir from --local-dir
1568 # - modules list of modules, including dependencies
1570 # - files list of files
1571 func_modules_to_filelist ()
1574 for module in $modules; do
1576 if test -n "$module"; then
1577 fs=`func_get_filelist $module`
1578 func_append files " $fs"
1581 files=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
1584 # func_execute_command command [args...]
1585 # Executes a command.
1586 # Uses also the variables
1587 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
1588 func_execute_command ()
1590 if test $verbose -ge 0; then
1594 # Commands like automake produce output to stderr even when the succeed.
1595 # Turn this output off if the command succeeds.
1596 "$@" > "$tmp"/cmdout 2>&1
1598 if test $cmdret = 0; then
1602 cat "$tmp"/cmdout 1>&2
1609 # func_emit_lib_Makefile_am
1610 # emits the contents of library makefile to standard output.
1612 # - local_gnulib_dir from --local-dir
1613 # - modules list of modules, including dependencies
1614 # - libname library name
1615 # - pobase directory relative to destdir where to place *.po files
1616 # - auxdir directory relative to destdir where to place build aux files
1617 # - makefile_name from --makefile-name
1618 # - libtool true if libtool will be used, false or blank otherwise
1619 # - macro_prefix prefix of gl_LIBOBJS macros to use
1620 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
1621 # - actioncmd (optional) command that will reproduce this invocation
1622 # - for_test true if creating a package for testing, false otherwise
1624 # - uses_subdirs nonempty if object files in subdirs exist
1625 func_emit_lib_Makefile_am ()
1627 # When creating an includable Makefile.am snippet, augment variables with
1628 # += instead of assigning them.
1629 if test -n "$makefile_name"; then
1634 if test "$libtool" = true; then
1637 sed_eliminate_LDFLAGS=
1641 sed_eliminate_LDFLAGS='/^lib_LDFLAGS[ ]*+=/d'
1644 # When creating a package for testing: Attempt to provoke failures,
1645 # especially link errors, already during "make" rather than during
1646 # "make check", because "make check" is not possible in a cross-compiling
1647 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
1648 sed_transform_check_PROGRAMS='s,check_PROGRAMS,noinst_PROGRAMS,g'
1650 sed_transform_check_PROGRAMS=
1652 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
1653 echo "## Process this file with automake to produce Makefile.in."
1654 func_emit_copyright_notice
1655 if test -n "$actioncmd"; then
1656 echo "# Reproduce by: $actioncmd"
1661 for module in $modules; do
1662 func_verify_nontests_module
1663 if test -n "$module"; then
1665 func_get_automake_snippet "$module" |
1666 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
1667 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
1668 -e "$sed_eliminate_LDFLAGS" \
1669 -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' \
1670 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
1671 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
1672 -e "$sed_transform_check_PROGRAMS"
1673 if test "$module" = 'alloca'; then
1674 echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
1675 echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@"
1678 # Skip the contents if its entirely empty.
1679 if grep '[^ ]' amsnippet.tmp > /dev/null ; then
1680 echo "## begin gnulib module $module"
1683 echo "## end gnulib module $module"
1687 # Test whether there are some source files in subdirectories.
1688 for f in `func_get_filelist "$module"`; do
1690 lib/*/*.c) uses_subdirs=yes ;;
1696 if test -z "$makefile_name"; then
1697 # If there are source files in subdirectories, prevent collision of the
1698 # object files (example: hash.c and libxml/hash.c).
1700 if test -n "$uses_subdirs"; then
1701 subdir_options=' subdir-objects'
1703 echo "AUTOMAKE_OPTIONS = 1.5 gnits${subdir_options}"
1706 if test -z "$makefile_name"; then
1707 echo "noinst_HEADERS ="
1708 echo "noinst_LIBRARIES ="
1709 echo "noinst_LTLIBRARIES ="
1710 # Automake versions < 1.9b create an empty pkgdatadir at installation time
1711 # if you specify pkgdata_DATA to empty. This is a workaround.
1712 if grep '^pkgdata_DATA *+=' allsnippets.tmp > /dev/null; then
1713 echo "pkgdata_DATA ="
1716 echo "BUILT_SOURCES ="
1719 echo "MOSTLYCLEANFILES $assign core *.stackdump"
1720 if test -z "$makefile_name"; then
1721 echo "MOSTLYCLEANDIRS ="
1723 echo "DISTCLEANFILES ="
1724 echo "MAINTAINERCLEANFILES ="
1726 echo "AM_CPPFLAGS ="
1729 if LC_ALL=C grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *= *$libname\\.$libext\$" allsnippets.tmp > /dev/null; then
1730 # One of the snippets already specifies an installation location for the
1731 # library. Don't confuse automake by saying it should not be installed.
1734 # By default, the generated library should not be installed.
1735 echo "noinst_${perhapsLT}LIBRARIES += $libname.$libext"
1738 echo "${libname}_${libext}_SOURCES ="
1739 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
1740 # automake during its analyses looks for $(LIBOBJS), not for @LIBOBJS@.
1741 echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
1742 echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
1743 echo "EXTRA_${libname}_${libext}_SOURCES ="
1744 if test "$libtool" = true; then
1745 echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)"
1748 if test -n "$pobase"; then
1749 echo "AM_CPPFLAGS += -DDEFAULT_TEXT_DOMAIN=\\\"${po_domain}-gnulib\\\""
1752 cat allsnippets.tmp \
1753 | sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
1755 echo "mostlyclean-local: mostlyclean-generic"
1756 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
1757 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
1758 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
1762 rm -f allsnippets.tmp
1765 # func_emit_po_Makevars
1766 # emits the contents of po/ makefile parametrization to standard output.
1768 # - local_gnulib_dir from --local-dir
1769 # - sourcebase directory relative to destdir where to place source code
1770 # - pobase directory relative to destdir where to place *.po files
1771 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
1772 func_emit_po_Makevars ()
1774 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
1775 func_emit_copyright_notice
1777 echo "# Usually the message domain is the same as the package name."
1778 echo "# But here it has a '-gnulib' suffix."
1779 echo "DOMAIN = ${po_domain}-gnulib"
1781 echo "# These two variables depend on the location of this directory."
1782 echo "subdir = ${pobase}"
1783 echo "top_builddir = "`echo "$pobase" | sed -e 's,//*,/,g' -e 's,[^/][^/]*,..,g'`
1786 # These options get passed to xgettext.
1787 XGETTEXT_OPTIONS = \
1788 --keyword=_ --flag=_:1:pass-c-format \
1789 --keyword=N_ --flag=N_:1:pass-c-format \
1790 --keyword='proper_name:1,"This is a proper name. See the gettext manual, section Names."' \
1791 --keyword='proper_name_utf8:1,"This is a proper name. See the gettext manual, section Names."' \
1792 --flag=error:3:c-format --flag=error_at_line:5:c-format
1794 # This is the copyright holder that gets inserted into the header of the
1795 # $(DOMAIN).pot file. gnulib is copyrighted by the FSF.
1796 COPYRIGHT_HOLDER = Free Software Foundation, Inc.
1798 # This is the email address or URL to which the translators shall report
1799 # bugs in the untranslated strings:
1800 # - Strings which are not entire sentences, see the maintainer guidelines
1801 # in the GNU gettext documentation, section 'Preparing Strings'.
1802 # - Strings which use unclear terms or require additional context to be
1804 # - Strings which make invalid assumptions about notation of date, time or
1806 # - Pluralisation problems.
1807 # - Incorrect English spelling.
1808 # - Incorrect formatting.
1809 # It can be your email address, or a mailing list address where translators
1810 # can write to without being subscribed, or the URL of a web page through
1811 # which the translators can contact you.
1812 MSGID_BUGS_ADDRESS = bug-gnulib@gnu.org
1814 # This is the list of locale categories, beyond LC_MESSAGES, for which the
1815 # message catalogs shall be used. It is usually empty.
1816 EXTRA_LOCALE_CATEGORIES =
1818 # This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
1819 # context. Possible values are "yes" and "no". Set this to yes if the
1820 # package uses functions taking also a message context, like pgettext(), or
1821 # if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
1826 # func_emit_po_POTFILES_in
1827 # emits the file list to be passed to xgettext to standard output.
1829 # - local_gnulib_dir from --local-dir
1830 # - sourcebase directory relative to destdir where to place source code
1831 # - files list of new files
1832 func_emit_po_POTFILES_in ()
1834 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
1835 func_emit_copyright_notice
1837 echo "# List of files which contain translatable strings."
1838 echo "$files" | sed -n -e "s,^lib/,$sourcebase/,p"
1841 # func_emit_tests_Makefile_am
1842 # emits the contents of tests makefile to standard output.
1844 # - local_gnulib_dir from --local-dir
1845 # - modules list of modules, including dependencies
1846 # - libname library name
1847 # - auxdir directory relative to destdir where to place build aux files
1848 # - makefile_name from --makefile-name
1849 # - libtool true if libtool will be used, false or blank otherwise
1850 # - sourcebase relative directory containing lib source code
1851 # - m4base relative directory containing autoconf macros
1852 # - testsbase relative directory containing unit test code
1853 # - macro_prefix prefix of gl_LIBOBJS macros to use
1854 # - for_test true if creating a package for testing, false otherwise
1855 # - use_libtests true if a libtests.a should be built, false otherwise
1857 # - uses_subdirs nonempty if object files in subdirs exist
1858 func_emit_tests_Makefile_am ()
1860 if test "$libtool" = true; then
1862 sed_eliminate_LDFLAGS=
1865 sed_eliminate_LDFLAGS='/^lib_LDFLAGS[ ]*+=/d'
1868 # When creating a package for testing: Attempt to provoke failures,
1869 # especially link errors, already during "make" rather than during
1870 # "make check", because "make check" is not possible in a cross-compiling
1871 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
1872 sed_transform_check_PROGRAMS='s,check_PROGRAMS,noinst_PROGRAMS,g'
1874 sed_transform_check_PROGRAMS=
1876 testsbase_inverse=`echo "$testsbase" | sed -e 's,/$,,' | sed -e 's,[^/][^/]*,..,g'`
1877 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
1878 echo "## Process this file with automake to produce Makefile.in."
1879 func_emit_copyright_notice
1883 for module in $modules; do
1885 func_verify_tests_module
1889 if test -n "$module"; then
1891 func_get_automake_snippet "$module" |
1892 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
1893 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
1894 -e "$sed_eliminate_LDFLAGS" \
1895 -e 's,lib_\([A-Z][A-Z]*\),libtests_a_\1,g' \
1896 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
1897 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
1898 -e "$sed_transform_check_PROGRAMS"
1899 if $use_libtests && test "$module" = 'alloca'; then
1900 echo "libtests_a_LIBADD += @${perhapsLT}ALLOCA@"
1901 echo "libtests_a_DEPENDENCIES += @${perhapsLT}ALLOCA@"
1904 # Skip the contents if its entirely empty.
1905 if grep '[^ ]' amsnippet.tmp > /dev/null ; then
1906 echo "## begin gnulib module $module"
1909 echo "## end gnulib module $module"
1913 # Test whether there are some source files in subdirectories.
1914 for f in `func_get_filelist "$module"`; do
1916 lib/*/*.c | tests/*/*.c) uses_subdirs=yes ;;
1922 # Generate dependencies here, since it eases the debugging of test failures.
1923 # If there are source files in subdirectories, prevent collision of the
1924 # object files (example: hash.c and libxml/hash.c).
1926 if test -n "$uses_subdirs"; then
1927 subdir_options=' subdir-objects'
1929 echo "AUTOMAKE_OPTIONS = 1.5 foreign${subdir_options}"
1932 echo "ACLOCAL_AMFLAGS = -I ${testsbase_inverse}/${m4base}"
1935 # Nothing is being added to SUBDIRS; nevertheless the existence of this
1936 # variable is needed to avoid an error from automake:
1937 # "AM_GNU_GETTEXT used but SUBDIRS not defined"
1940 echo "TESTS_ENVIRONMENT ="
1941 echo "noinst_PROGRAMS ="
1942 if ! $for_test; then
1943 echo "check_PROGRAMS ="
1945 echo "noinst_HEADERS ="
1946 echo "noinst_LIBRARIES ="
1947 if $use_libtests; then
1949 echo "noinst_LIBRARIES += libtests.a"
1951 echo "check_LIBRARIES = libtests.a"
1954 # Automake versions < 1.9b create an empty pkgdatadir at installation time
1955 # if you specify pkgdata_DATA to empty. This is a workaround.
1956 if grep '^pkgdata_DATA *+=' allsnippets.tmp > /dev/null; then
1957 echo "pkgdata_DATA ="
1960 echo "BUILT_SOURCES ="
1962 echo "MOSTLYCLEANFILES = core *.stackdump"
1963 echo "MOSTLYCLEANDIRS ="
1965 echo "DISTCLEANFILES ="
1966 echo "MAINTAINERCLEANFILES ="
1968 echo "AM_CPPFLAGS = \\"
1969 echo " -I. -I\$(srcdir) \\"
1970 echo " -I${testsbase_inverse} -I\$(srcdir)/${testsbase_inverse} \\"
1971 echo " -I${testsbase_inverse}/${sourcebase-lib} -I\$(srcdir)/${testsbase_inverse}/${sourcebase-lib}"
1973 local_ldadd_before=''
1974 local_ldadd_after=''
1975 if $use_libtests; then
1976 # All test programs need to be linked with libtests.a.
1977 # It needs to be passed to the linker before ${libname}.${libext}, since
1978 # the tests-related modules depend on the main modules.
1979 # It also needs to be passed to the linker after ${libname}.${libext}
1980 # because the latter might contain incomplete modules (such as the 'error'
1981 # module whose dependency to 'progname' is voluntarily omitted).
1982 # The LIBTESTS_LIBDEPS can be passed to the linker once or twice, it does
1984 local_ldadd_before=' libtests.a'
1985 local_ldadd_after=' libtests.a $(LIBTESTS_LIBDEPS)'
1987 echo "LDADD =${local_ldadd_before} ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext}${local_ldadd_after}"
1989 if $use_libtests; then
1990 echo "libtests_a_SOURCES ="
1991 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
1992 # automake during its analyses looks for $(LIBOBJS), not for @LIBOBJS@.
1993 echo "libtests_a_LIBADD = \$(${macro_prefix}tests_LIBOBJS)"
1994 echo "libtests_a_DEPENDENCIES = \$(${macro_prefix}tests_LIBOBJS)"
1995 echo "EXTRA_libtests_a_SOURCES ="
1996 # The circular dependency in LDADD requires this.
1997 echo "AM_LIBTOOLFLAGS = --preserve-dup-deps"
2000 cat allsnippets.tmp \
2001 | sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
2002 echo "# Clean up after Solaris cc."
2004 echo " rm -rf SunWS_cache"
2006 echo "mostlyclean-local: mostlyclean-generic"
2007 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
2008 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
2009 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
2013 rm -f allsnippets.tmp
2016 # func_emit_initmacro_start macro_prefix
2017 # emits the first few statements of the gl_INIT macro to standard output.
2018 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
2019 func_emit_initmacro_start ()
2021 macro_prefix_arg="$1"
2022 # Overriding AC_LIBOBJ and AC_REPLACE_FUNCS has the effect of storing
2023 # platform-dependent object files in ${macro_prefix_arg}_LIBOBJS instead of
2024 # LIBOBJS. The purpose is to allow several gnulib instantiations under
2025 # a single configure.ac file. (AC_CONFIG_LIBOBJ_DIR does not allow this
2027 # Furthermore it avoids an automake error like this when a Makefile.am
2028 # that uses pieces of gnulib also uses $(LIBOBJ):
2029 # automatically discovered file `error.c' should not be explicitly mentioned
2030 echo " m4_pushdef([AC_LIBOBJ], m4_defn([${macro_prefix_arg}_LIBOBJ]))"
2031 echo " m4_pushdef([AC_REPLACE_FUNCS], m4_defn([${macro_prefix_arg}_REPLACE_FUNCS]))"
2032 # Overriding AC_LIBSOURCES has the same purpose of avoiding the automake
2033 # error when a Makefile.am that uses pieces of gnulib also uses $(LIBOBJ):
2034 # automatically discovered file `error.c' should not be explicitly mentioned
2035 # We let automake know about the files to be distributed through the
2036 # EXTRA_lib_SOURCES variable.
2037 echo " m4_pushdef([AC_LIBSOURCES], m4_defn([${macro_prefix_arg}_LIBSOURCES]))"
2040 # func_emit_initmacro_end macro_prefix
2041 # emits the last few statements of the gl_INIT macro to standard output.
2042 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
2043 func_emit_initmacro_end ()
2045 macro_prefix_arg="$1"
2046 echo " m4_popdef([AC_LIBSOURCES])"
2047 echo " m4_popdef([AC_REPLACE_FUNCS])"
2048 echo " m4_popdef([AC_LIBOBJ])"
2049 echo " AC_CONFIG_COMMANDS_PRE(["
2050 echo " ${macro_prefix_arg}_libobjs="
2051 echo " ${macro_prefix_arg}_ltlibobjs="
2052 echo " if test -n \"\$${macro_prefix_arg}_LIBOBJS\"; then"
2053 echo " # Remove the extension."
2054 echo " sed_drop_objext='s/\\.o\$//;s/\\.obj\$//'"
2055 echo " for i in \`for i in \$${macro_prefix_arg}_LIBOBJS; do echo \"\$i\"; done | sed \"\$sed_drop_objext\" | sort | uniq\`; do"
2056 echo " ${macro_prefix_arg}_libobjs=\"\$${macro_prefix_arg}_libobjs \$i.\$ac_objext\""
2057 echo " ${macro_prefix_arg}_ltlibobjs=\"\$${macro_prefix_arg}_ltlibobjs \$i.lo\""
2060 echo " AC_SUBST([${macro_prefix_arg}_LIBOBJS], [\$${macro_prefix_arg}_libobjs])"
2061 echo " AC_SUBST([${macro_prefix_arg}_LTLIBOBJS], [\$${macro_prefix_arg}_ltlibobjs])"
2065 # func_emit_initmacro_done macro_prefix sourcebase
2066 # emits a few statements after the gl_INIT macro to standard output.
2067 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
2068 # - sourcebase directory relative to destdir where to place source code
2069 func_emit_initmacro_done ()
2071 macro_prefix_arg="$1"
2074 echo "# Like AC_LIBOBJ, except that the module name goes"
2075 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
2076 echo "AC_DEFUN([${macro_prefix_arg}_LIBOBJ], ["
2077 echo " AS_LITERAL_IF([\$1], [${macro_prefix_arg}_LIBSOURCES([\$1.c])])dnl"
2078 echo " ${macro_prefix_arg}_LIBOBJS=\"\$${macro_prefix_arg}_LIBOBJS \$1.\$ac_objext\""
2081 echo "# m4_foreach_w is provided by autoconf-2.59c and later."
2082 echo "# This definition is to accommodate developers using versions"
2083 echo "# of autoconf older than that."
2084 echo "m4_ifndef([m4_foreach_w],"
2085 echo " [m4_define([m4_foreach_w],"
2086 echo " [m4_foreach([\$1], m4_split(m4_normalize([\$2]), [ ]), [\$3])])])"
2088 echo "# Like AC_REPLACE_FUNCS, except that the module name goes"
2089 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
2090 echo "AC_DEFUN([${macro_prefix_arg}_REPLACE_FUNCS], ["
2091 echo " m4_foreach_w([gl_NAME], [\$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl"
2092 echo " AC_CHECK_FUNCS([\$1], , [${macro_prefix_arg}_LIBOBJ(\$ac_func)])"
2095 echo "# Like AC_LIBSOURCES, except the directory where the source file is"
2096 echo "# expected is derived from the gnulib-tool parametrization,"
2097 echo "# and alloca is special cased (for the alloca-opt module)."
2098 echo "# We could also entirely rely on EXTRA_lib..._SOURCES."
2099 echo "AC_DEFUN([${macro_prefix_arg}_LIBSOURCES], ["
2100 echo " m4_foreach([_gl_NAME], [\$1], ["
2101 echo " m4_if(_gl_NAME, [alloca.c], [], ["
2102 echo " m4_syscmd([test -r $sourcebase_arg/]_gl_NAME[ || test ! -d $sourcebase_arg])dnl"
2103 echo " m4_if(m4_sysval, [0], [],"
2104 echo " [AC_FATAL([missing $sourcebase_arg/]_gl_NAME)])"
2110 # func_import modules
2111 # Uses also the variables
2112 # - destdir target directory
2113 # - local_gnulib_dir from --local-dir
2114 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
2115 # - libname library name
2116 # - sourcebase directory relative to destdir where to place source code
2117 # - m4base directory relative to destdir where to place *.m4 macros
2118 # - pobase directory relative to destdir where to place *.po files
2119 # - docbase directory relative to destdir where to place doc files
2120 # - testsbase directory relative to destdir where to place unit test code
2121 # - auxdir directory relative to destdir where to place build aux files
2122 # - inctests true if --with-tests was given, blank otherwise
2123 # - avoidlist list of modules to avoid, from --avoid
2124 # - lgpl yes or a number if library's license shall be LGPL,
2126 # - makefile_name from --makefile-name
2127 # - libtool true if --libtool was given, false if --no-libtool was
2128 # given, blank otherwise
2129 # - guessed_libtool true if the configure.ac file uses libtool, false otherwise
2130 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
2131 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
2132 # - autoconf_minversion minimum supported autoconf version
2133 # - doit : if actions shall be executed, false if only to be printed
2134 # - symbolic true if files should be symlinked, copied otherwise
2135 # - lsymbolic true if files from local_gnulib_dir should be symlinked,
2137 # - do_copyrights true if copyright notices in files should be replaced,
2141 # Get the cached settings.
2142 cached_local_gnulib_dir=
2143 cached_specified_modules=
2153 cached_makefile_name=
2155 cached_macro_prefix=
2158 if test -f "$destdir"/$m4base/gnulib-cache.m4; then
2159 cached_libtool=false
2165 s,^.*gl_LOCAL_DIR([[ ]*\([^])]*\).*$,cached_local_gnulib_dir="\1",p
2168 s,^.*gl_MODULES([[ ]*\([^])]*\).*$,cached_specified_modules="\1",p
2171 s,^.*gl_AVOID([[ ]*\([^])]*\).*$,cached_avoidlist="\1",p
2174 s,^.*gl_SOURCE_BASE([[ ]*\([^])]*\).*$,cached_sourcebase="\1",p
2177 s,^.*gl_M4_BASE([[ ]*\([^])]*\).*$,cached_m4base="\1",p
2180 s,^.*gl_PO_BASE([[ ]*\([^])]*\).*$,cached_pobase="\1",p
2183 s,^.*gl_DOC_BASE([[ ]*\([^])]*\).*$,cached_docbase="\1",p
2186 s,^.*gl_TESTS_BASE([[ ]*\([^])]*\).*$,cached_testsbase="\1",p
2189 s,^.*$,cached_inctests=true,p
2192 s,^.*gl_LIB([[ ]*\([^])]*\).*$,cached_libname="\1",p
2195 s,^.*gl_LGPL([[ ]*\([^])]*\).*$,cached_lgpl="\1",p
2198 s,^.*$,cached_lgpl=yes,p
2200 /gl_MAKEFILE_NAME(/ {
2201 s,^.*gl_MAKEFILE_NAME([[ ]*\([^])]*\).*$,cached_makefile_name="\1",p
2204 s,^.*$,cached_libtool=true,p
2206 /gl_MACRO_PREFIX(/ {
2207 s,^.*gl_MACRO_PREFIX([[ ]*\([^])]*\).*$,cached_macro_prefix="\1",p
2210 s,^.*gl_PO_DOMAIN([[ ]*\([^])]*\).*$,cached_po_domain="\1",p
2212 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-cache.m4`
2213 if test -f "$destdir"/$m4base/gnulib-comp.m4; then
2218 /AC_DEFUN(\['"${cached_macro_prefix}"'_FILE_LIST\], \[/ {
2219 s,^.*$,cached_files=",p
2231 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-comp.m4`
2235 # Merge the cached settings with the specified ones.
2236 # The m4base must be the same as expected from the pathname.
2237 if test -n "$cached_m4base" && test "$cached_m4base" != "$m4base"; then
2238 func_fatal_error "$m4base/gnulib-cache.m4 is expected to contain gl_M4_BASE([$m4base])"
2240 # The local_gnulib_dir defaults to the cached one. Recall that the cached one
2241 # is relative to $destdir, whereas the one we use is relative to . or absolute.
2242 if test -z "$local_gnulib_dir"; then
2243 if test -n "$cached_local_gnulib_dir"; then
2246 local_gnulib_dir="$destdir/$cached_local_gnulib_dir" ;;
2248 case "$cached_local_gnulib_dir" in
2250 local_gnulib_dir="$destdir/$cached_local_gnulib_dir" ;;
2252 func_relconcat "$destdir" "$cached_local_gnulib_dir"
2253 local_gnulib_dir="$relconcat" ;;
2258 # Append the cached and the specified module names. So that
2259 # "gnulib-tool --import foo" means to add the module foo.
2260 specified_modules="$cached_specified_modules $1"
2261 # Append the cached and the specified avoidlist. This is probably better
2262 # than dropping the cached one when --avoid is specified at least once.
2263 avoidlist=`for m in $cached_avoidlist $avoidlist; do echo $m; done | LC_ALL=C sort -u`
2264 avoidlist=`echo $avoidlist`
2266 # The sourcebase defaults to the cached one.
2267 if test -z "$sourcebase"; then
2268 sourcebase="$cached_sourcebase"
2269 if test -z "$sourcebase"; then
2270 func_fatal_error "missing --source-base option"
2273 # The pobase defaults to the cached one.
2274 if test -z "$pobase"; then
2275 pobase="$cached_pobase"
2277 # The docbase defaults to the cached one.
2278 if test -z "$docbase"; then
2279 docbase="$cached_docbase"
2280 if test -z "$docbase"; then
2281 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."
2284 # The testsbase defaults to the cached one.
2285 if test -z "$testsbase"; then
2286 testsbase="$cached_testsbase"
2287 if test -z "$testsbase"; then
2288 func_fatal_error "missing --tests-base option"
2291 # Require the tests if specified either way.
2292 if test -z "$inctests"; then
2293 inctests="$cached_inctests"
2295 # The libname defaults to the cached one.
2296 if test -z "$supplied_libname"; then
2297 libname="$cached_libname"
2298 if test -z "$libname"; then
2299 func_fatal_error "missing --lib option"
2302 # Require LGPL if specified either way.
2303 if test -z "$lgpl"; then
2306 # The makefile_name defaults to the cached one.
2307 if test -z "$makefile_name"; then
2308 makefile_name="$cached_makefile_name"
2310 # Use libtool if specified either way, or if guessed.
2311 if test -z "$libtool"; then
2312 if test -n "$cached_m4base"; then
2313 libtool="$cached_libtool"
2315 libtool="$guessed_libtool"
2318 # The macro_prefix defaults to the cached one.
2319 if test -z "$macro_prefix"; then
2320 macro_prefix="$cached_macro_prefix"
2321 if test -z "$macro_prefix"; then
2322 func_fatal_error "missing --macro-prefix option"
2325 # The po_domain defaults to the cached one.
2326 if test -z "$po_domain"; then
2327 po_domain="$cached_po_domain"
2330 # Canonicalize the list of specified modules.
2331 specified_modules=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
2333 # Determine final module list.
2334 modules="$specified_modules"
2335 func_modules_transitive_closure
2336 if test $verbose -ge 0; then
2337 echo "Module list with included dependencies:"
2338 echo "$modules" | sed -e 's/^/ /'
2340 final_modules="$modules"
2342 # Determine main module list and tests-related module list separately.
2343 # The main module list is the transitive closure of the specified modules,
2344 # ignoring tests modules. Its lib/* sources go into $sourcebase/. If --lgpl
2345 # is specified, it will consist only of LGPLed source.
2346 # The tests-related module list is the transitive closure of the specified
2347 # modules, including tests modules, minus the main module list. Its lib/*
2348 # sources (brought in through dependencies of *-tests modules) go into
2349 # $testsbase/. It may contain GPLed source, even if --lgpl is specified.
2350 # Determine main module list.
2351 saved_inctests="$inctests"
2353 modules="$specified_modules"
2354 func_modules_transitive_closure
2355 main_modules="$modules"
2356 inctests="$saved_inctests"
2357 if test $verbose -ge 1; then
2358 echo "Main module list:"
2359 echo "$main_modules" | sed -e 's/^/ /'
2361 # Determine tests-related module list.
2362 echo "$final_modules" | LC_ALL=C sort -u > "$tmp"/final-modules
2363 testsrelated_modules=`echo "$main_modules" | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/final-modules`
2364 if test $verbose -ge 1; then
2365 echo "Tests-related module list:"
2366 echo "$testsrelated_modules" | sed -e 's/^/ /'
2369 # Add the dummy module to the main module list if needed.
2370 modules="$main_modules"
2371 func_modules_add_dummy
2372 main_modules="$modules"
2374 # Determine whether a $testsbase/libtests.a is needed.
2376 for module in $testsrelated_modules; do
2377 func_verify_nontests_module
2378 if test -n "$module"; then
2379 all_files=`func_get_filelist $module`
2380 lib_files=`for f in $all_files; do \
2384 done | sed -e 's,^lib/,,'`
2385 if test -n "$lib_files"; then
2392 # Add the dummy module to the tests-related module list if needed.
2393 if $use_libtests; then
2394 modules="$testsrelated_modules"
2395 func_modules_add_dummy
2396 testsrelated_modules="$modules"
2399 # If --lgpl, verify that the licenses of modules are compatible.
2400 if test -n "$lgpl"; then
2401 for module in $main_modules; do
2402 license=`func_get_license $module`
2404 'GPLed build tool') ;;
2405 'public domain' | 'unlimited' | 'unmodifiable license text') ;;
2411 *) func_fatal_error "incompatible license on module $module: $license" ;;
2417 *) func_fatal_error "incompatible license on module $module: $license" ;;
2420 *) func_fatal_error "invalid value lgpl=$lgpl" ;;
2427 # Show banner notice of every module.
2428 modules="$main_modules"
2431 # Determine script to apply to imported library files.
2432 sed_transform_lib_file=
2433 for module in $main_modules; do
2434 if test $module = config-h; then
2435 # Assume config.h exists, and that -DHAVE_CONFIG_H is omitted.
2436 sed_transform_lib_file=$sed_transform_lib_file'
2437 s/^#ifdef[ ]*HAVE_CONFIG_H[ ]*$/#if 1/
2442 sed_transform_main_lib_file="$sed_transform_lib_file"
2443 if test -n "$do_copyrights"; then
2444 if test -n "$lgpl"; then
2448 sed_transform_main_lib_file=$sed_transform_main_lib_file'
2449 s/GNU General/GNU Lesser General/g
2453 sed_transform_main_lib_file=$sed_transform_main_lib_file'
2454 s/GNU General/GNU Lesser General/g
2455 s/version [23]\([ ,]\)/version 2.1\1/g
2458 *) func_fatal_error "invalid value lgpl=$lgpl" ;;
2462 sed_transform_main_lib_file=$sed_transform_main_lib_file'
2463 s/GNU Lesser General/GNU General/g
2464 s/GNU Library General/GNU General/g
2465 s/version \(2\|2\.1\)\([ ,]\)/version 3\2/g
2470 # Determine script to apply to library files that go into $testsbase/.
2471 sed_transform_testsrelated_lib_file="$sed_transform_lib_file"
2472 if test -n "$do_copyrights"; then
2474 sed_transform_testsrelated_lib_file=$sed_transform_testsrelated_lib_file'
2475 s/GNU Lesser General/GNU General/g
2476 s/GNU Library General/GNU General/g
2477 s/version \(2\|2\.1\)\([ ,]\)/version 3\2/g
2481 # Determine the final file lists.
2482 # They must be computed separately, because files in lib/* go into
2483 # $sourcebase/ if they are in the main file list but into $testsbase/
2484 # if they are in the tests-related file list. Furthermore lib/dummy.c
2486 # Determine final main file list.
2487 modules="$main_modules"
2488 func_modules_to_filelist
2490 # Determine final tests-related file list.
2491 modules="$testsrelated_modules"
2492 func_modules_to_filelist
2493 testsrelated_files=`echo "$files" | sed -e 's,^lib/,tests=lib/,'`
2494 # Merge both file lists.
2495 sed_remove_empty_lines='/^$/d'
2496 files=`{ echo "$main_files"; echo "$testsrelated_files"; } | sed -e "$sed_remove_empty_lines" | LC_ALL=C sort -u`
2497 if test $verbose -ge 0; then
2499 sed_prettyprint_files='s,^tests=lib/\(.*\)$,lib/\1 -> tests/\1,'
2500 echo "$files" | sed -e "$sed_prettyprint_files" -e 's/^/ /'
2504 || func_fatal_error "refusing to do nothing"
2506 # Add m4/gnulib-tool.m4 to the file list. It is not part of any module.
2507 new_files="$files m4/gnulib-tool.m4"
2508 old_files="$cached_files"
2509 if test -f "$destdir"/$m4base/gnulib-tool.m4; then
2510 func_append old_files " m4/gnulib-tool.m4"
2513 sed_rewrite_old_files="\
2514 s,^build-aux/,$auxdir/,
2515 s,^doc/,$cached_docbase/,
2516 s,^lib/,$cached_sourcebase/,
2517 s,^m4/,$cached_m4base/,
2518 s,^tests/,$cached_testsbase/,
2519 s,^tests=lib/,$cached_testsbase/,
2521 sed_rewrite_new_files="\
2522 s,^build-aux/,$auxdir/,
2524 s,^lib/,$sourcebase/,
2526 s,^tests/,$testsbase/,
2527 s,^tests=lib/,$testsbase/,
2530 # Create directories.
2531 { echo "$sourcebase"
2533 if test -n "$pobase"; then
2536 docfiles=`echo "$files" | sed -n -e 's,^doc/,,p'`
2537 if test -n "$docfiles"; then
2540 if test -n "$inctests"; then
2544 for f in $files; do echo $f; done \
2545 | sed -e "$sed_rewrite_new_files" \
2546 | sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
2549 { # Rearrange file descriptors. Needed because "while ... done < ..."
2550 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
2551 exec 5<&0 < "$tmp"/dirs
2553 if test ! -d "$destdir/$d"; then
2555 echo "Creating directory $destdir/$d"
2556 mkdir -p "$destdir/$d" || func_fatal_error "failed"
2558 echo "Create directory $destdir/$d"
2565 # func_dest_tmpfilename file
2566 # determines the name of a temporary file (file is relative to destdir).
2568 # - tmpfile absolute filename of the temporary file
2569 func_dest_tmpfilename ()
2572 # Put the new contents of $file in a file in the same directory (needed
2573 # to guarantee that an 'mv' to "$destdir/$file" works).
2574 tmpfile="$destdir/$1.tmp"
2576 # Put the new contents of $file in a file in a temporary directory
2577 # (because the directory of "$file" might not exist).
2578 tmpfile="$tmp"/`basename "$1"`.tmp
2582 # Copy files or make symbolic links. Remove obsolete files.
2586 # Construct a table with 2 columns: rewritten-file-name original-file-name,
2587 # representing the files according to the last gnulib-tool invocation.
2588 for f in $old_files; do echo $f; done \
2589 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_old_files" \
2592 # Construct a table with 2 columns: rewritten-file-name original-file-name,
2593 # representing the files after this gnulib-tool invocation.
2594 for f in $new_files; do echo $f; done \
2595 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" \
2598 # First the files that are in old-files, but not in new-files:
2599 sed_take_first_column='s,'"$delimiter"'.*,,'
2600 for g in `LC_ALL=C join -t"$delimiter" -v1 "$tmp"/old-files "$tmp"/new-files | sed -e "$sed_take_first_column"`; do
2601 # Remove the file. Do nothing if the user already removed it.
2602 if test -f "$destdir/$g" || test -h "$destdir/$g"; then
2604 echo "Removing file $g (backup in ${g}~)"
2605 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error "failed"
2607 echo "Remove file $g (backup in ${g}~)"
2609 func_append removed_files "$g$nl"
2612 # func_add_or_update handles a file that ought to be present afterwards.
2614 # - f the original file name
2615 # - g the rewritten file name
2616 # - already_present nonempty if the file already exists, empty otherwise
2617 func_add_or_update ()
2621 tests=lib/*) f=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
2623 func_dest_tmpfilename "$g"
2624 func_lookup_file "$f"
2625 cp "$lookedup_file" "$tmpfile" || func_fatal_error "failed"
2626 if test -n "$sed_transform_main_lib_file"; then
2629 sed -e "$sed_transform_main_lib_file" \
2630 < "$lookedup_file" > "$tmpfile" || func_fatal_error "failed"
2634 if test -n "$sed_transform_testsrelated_lib_file"; then
2637 sed -e "$sed_transform_testsrelated_lib_file" \
2638 < "$lookedup_file" > "$tmpfile" || func_fatal_error "failed"
2642 if test -f "$destdir/$g"; then
2643 # The file already exists.
2644 if cmp "$destdir/$g" "$tmpfile" > /dev/null; then
2645 : # The file has not changed.
2649 if test -n "$already_present"; then
2650 echo "Updating file $g (backup in ${g}~)"
2652 echo "Replacing file $g (non-gnulib code backuped in ${g}~) !!"
2654 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error "failed"
2655 if { test -n "$symbolic" \
2656 || { test -n "$lsymbolic" \
2657 && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; } \
2658 && test -z "$lookedup_tmp" \
2659 && cmp "$lookedup_file" "$tmpfile" > /dev/null; then
2660 func_ln_if_changed "$lookedup_file" "$destdir/$g"
2662 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error "failed"
2665 if test -n "$already_present"; then
2666 echo "Update file $g (backup in ${g}~)"
2668 echo "Replace file $g (non-gnulib code backuped in ${g}~) !!"
2674 # Don't protest if the file should be there but isn't: it happens
2675 # frequently that developers don't put autogenerated files into CVS.
2677 echo "Copying file $g"
2678 if { test -n "$symbolic" \
2679 || { test -n "$lsymbolic" \
2680 && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; } \
2681 && test -z "$lookedup_tmp" \
2682 && cmp "$lookedup_file" "$tmpfile" > /dev/null; then
2683 func_ln_if_changed "$lookedup_file" "$destdir/$g"
2685 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error "failed"
2690 func_append added_files "$g$nl"
2694 # Then the files that are in new-files, but not in old-files:
2695 sed_take_last_column='s,^.*'"$delimiter"',,'
2697 LC_ALL=C join -t"$delimiter" -v2 "$tmp"/old-files "$tmp"/new-files \
2698 | sed -e "$sed_take_last_column" \
2699 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/added-files
2700 { # Rearrange file descriptors. Needed because "while ... done < ..."
2701 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
2702 exec 5<&0 < "$tmp"/added-files
2708 # Then the files that are in new-files and in old-files:
2709 already_present=true
2710 LC_ALL=C join -t"$delimiter" "$tmp"/old-files "$tmp"/new-files \
2711 | sed -e "$sed_take_last_column" \
2712 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/kept-files
2713 { # Rearrange file descriptors. Needed because "while ... done < ..."
2714 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
2715 exec 5<&0 < "$tmp"/kept-files
2722 # Command-line invocation printed in a comment in generated gnulib-cache.m4.
2723 actioncmd="gnulib-tool --import"
2724 func_append actioncmd " --dir=$destdir"
2725 if test -n "$local_gnulib_dir"; then
2726 func_append actioncmd " --local-dir=$local_gnulib_dir"
2728 func_append actioncmd " --lib=$libname"
2729 func_append actioncmd " --source-base=$sourcebase"
2730 func_append actioncmd " --m4-base=$m4base"
2731 if test -n "$pobase"; then
2732 func_append actioncmd " --po-base=$pobase"
2734 func_append actioncmd " --doc-base=$docbase"
2735 func_append actioncmd " --aux-dir=$auxdir"
2736 if test -n "$inctests"; then
2737 func_append actioncmd " --with-tests"
2739 for module in $avoidlist; do
2740 func_append actioncmd " --avoid=$module"
2742 if test -n "$lgpl"; then
2743 if test "$lgpl" = yes; then
2744 func_append actioncmd " --lgpl"
2746 func_append actioncmd " --lgpl=$lgpl"
2749 if test -n "$makefile_name"; then
2750 func_append actioncmd " --makefile-name=$makefile_name"
2752 if test "$libtool" = true; then
2753 func_append actioncmd " --libtool"
2755 func_append actioncmd " --no-libtool"
2757 func_append actioncmd " --macro-prefix=$macro_prefix"
2758 if test -n "$po_domain"; then
2759 func_append actioncmd " --po-domain=$po_domain"
2761 func_append actioncmd " `echo $specified_modules`"
2763 # Default the makefile name to Makefile.am.
2764 if test -n "$makefile_name"; then
2765 makefile_am=$makefile_name
2767 makefile_am=Makefile.am
2770 # Create normal Makefile.ams.
2773 # Create library makefile.
2774 func_dest_tmpfilename $sourcebase/$makefile_am
2775 modules="$main_modules"
2776 func_emit_lib_Makefile_am > "$tmpfile"
2777 if test -f "$destdir"/$sourcebase/$makefile_am; then
2778 if cmp "$destdir"/$sourcebase/$makefile_am "$tmpfile" > /dev/null; then
2782 echo "Updating $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
2783 mv -f "$destdir"/$sourcebase/$makefile_am "$destdir"/$sourcebase/$makefile_am~
2784 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
2786 echo "Update $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
2792 echo "Creating $sourcebase/$makefile_am"
2793 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
2795 echo "Create $sourcebase/$makefile_am"
2798 func_append added_files "$sourcebase/$makefile_am$nl"
2801 # Create po/ directory.
2802 if test -n "$pobase"; then
2803 # Create po makefile and auxiliary files.
2804 for file in Makefile.in.in remove-potcdate.sin; do
2805 func_dest_tmpfilename $pobase/$file
2806 func_lookup_file build-aux/po/$file
2807 cat "$lookedup_file" > "$tmpfile"
2808 if test -f "$destdir"/$pobase/$file; then
2809 if cmp "$destdir"/$pobase/$file "$tmpfile" > /dev/null; then
2813 echo "Updating $pobase/$file (backup in $pobase/$file~)"
2814 mv -f "$destdir"/$pobase/$file "$destdir"/$pobase/$file~
2815 mv -f "$tmpfile" "$destdir"/$pobase/$file
2817 echo "Update $pobase/$file (backup in $pobase/$file~)"
2823 echo "Creating $pobase/$file"
2824 mv -f "$tmpfile" "$destdir"/$pobase/$file
2826 echo "Create $pobase/$file"
2829 func_append added_files "$pobase/$file$nl"
2832 # Create po makefile parametrization, part 1.
2833 func_dest_tmpfilename $pobase/Makevars
2834 func_emit_po_Makevars > "$tmpfile"
2835 if test -f "$destdir"/$pobase/Makevars; then
2836 if cmp "$destdir"/$pobase/Makevars "$tmpfile" > /dev/null; then
2840 echo "Updating $pobase/Makevars (backup in $pobase/Makevars~)"
2841 mv -f "$destdir"/$pobase/Makevars "$destdir"/$pobase/Makevars~
2842 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
2844 echo "Update $pobase/Makevars (backup in $pobase/Makevars~)"
2850 echo "Creating $pobase/Makevars"
2851 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
2853 echo "Create $pobase/Makevars"
2856 func_append added_files "$pobase/Makevars$nl"
2858 # Create po makefile parametrization, part 2.
2859 func_dest_tmpfilename $pobase/POTFILES.in
2860 func_emit_po_POTFILES_in > "$tmpfile"
2861 if test -f "$destdir"/$pobase/POTFILES.in; then
2862 if cmp "$destdir"/$pobase/POTFILES.in "$tmpfile" > /dev/null; then
2866 echo "Updating $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
2867 mv -f "$destdir"/$pobase/POTFILES.in "$destdir"/$pobase/POTFILES.in~
2868 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.in
2870 echo "Update $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
2876 echo "Creating $pobase/POTFILES.in"
2877 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.in
2879 echo "Create $pobase/POTFILES.in"
2882 func_append added_files "$pobase/POTFILES.in$nl"
2885 TP_URL="http://translationproject.org/latest/"
2886 TP_RSYNC_URI="translationproject.org::tp/latest/"
2888 echo "Fetching gnulib PO files from $TP_URL"
2889 (cd "$destdir"/$pobase \
2890 && { # Prefer rsync over wget if it is available, since it consumes
2891 # less network bandwidth, due to compression.
2892 if type rsync 2>/dev/null | grep / > /dev/null; then
2893 rsync -Lrtz "${TP_RSYNC_URI}gnulib/" .
2895 wget --quiet -r -l1 -nd -np -A.po "${TP_URL}gnulib"
2900 echo "Fetch gnulib PO files from $TP_URL"
2902 # Create po/LINGUAS.
2904 func_dest_tmpfilename $pobase/LINGUAS
2905 (cd "$destdir"/$pobase \
2906 && { echo '# Set of available languages.'
2907 LC_ALL=C ls -1 *.po | sed -e 's,\.po$,,'
2910 if test -f "$destdir"/$pobase/LINGUAS; then
2911 if cmp "$destdir"/$pobase/LINGUAS "$tmpfile" > /dev/null; then
2914 echo "Updating $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
2915 mv -f "$destdir"/$pobase/LINGUAS "$destdir"/$pobase/LINGUAS~
2916 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
2919 echo "Creating $pobase/LINGUAS"
2920 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
2921 func_append added_files "$pobase/LINGUAS$nl"
2924 if test -f "$destdir"/$pobase/LINGUAS; then
2925 echo "Update $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
2927 echo "Create $pobase/LINGUAS"
2932 # Create m4/gnulib-cache.m4.
2933 func_dest_tmpfilename $m4base/gnulib-cache.m4
2935 func_emit_copyright_notice
2937 echo "# This file represents the specification of how gnulib-tool is used."
2938 echo "# It acts as a cache: It is written and read by gnulib-tool."
2939 echo "# In projects using CVS, this file is meant to be stored in CVS,"
2940 echo "# like the configure.ac and various Makefile.am files."
2943 echo "# Specification in the form of a command-line invocation:"
2946 echo "# Specification in the form of a few gnulib-tool.m4 macro invocations:"
2947 # Store the local_gnulib_dir relative to destdir.
2948 case "$local_gnulib_dir" in
2950 relative_local_gnulib_dir="$local_gnulib_dir" ;;
2953 /*) relative_local_gnulib_dir="$local_gnulib_dir" ;;
2955 # destdir, local_gnulib_dir are both relative.
2956 func_relativize "$destdir" "$local_gnulib_dir"
2957 relative_local_gnulib_dir="$reldir" ;;
2960 echo "gl_LOCAL_DIR([$relative_local_gnulib_dir])"
2961 echo "gl_MODULES(["`echo $specified_modules`"])"
2962 echo "gl_AVOID([$avoidlist])"
2963 echo "gl_SOURCE_BASE([$sourcebase])"
2964 echo "gl_M4_BASE([$m4base])"
2965 echo "gl_PO_BASE([$pobase])"
2966 echo "gl_DOC_BASE([$docbase])"
2967 echo "gl_TESTS_BASE([$testsbase])"
2968 test -z "$inctests" || echo "gl_WITH_TESTS"
2969 echo "gl_LIB([$libname])"
2970 if test -n "$lgpl"; then
2971 if test "$lgpl" = yes; then
2974 echo "gl_LGPL([$lgpl])"
2977 echo "gl_MAKEFILE_NAME([$makefile_name])"
2978 if test "$libtool" = true; then
2981 echo "gl_MACRO_PREFIX([$macro_prefix])"
2982 echo "gl_PO_DOMAIN([$po_domain])"
2984 if test -f "$destdir"/$m4base/gnulib-cache.m4; then
2985 if cmp "$destdir"/$m4base/gnulib-cache.m4 "$tmpfile" > /dev/null; then
2989 echo "Updating $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
2990 mv -f "$destdir"/$m4base/gnulib-cache.m4 "$destdir"/$m4base/gnulib-cache.m4~
2991 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.m4
2993 echo "Update $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
2997 echo "# gnulib-cache.m4 ends here"
3004 echo "Creating $m4base/gnulib-cache.m4"
3005 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.m4
3007 echo "Create $m4base/gnulib-cache.m4"
3013 # Create m4/gnulib-comp.m4.
3014 func_dest_tmpfilename $m4base/gnulib-comp.m4
3016 echo "# DO NOT EDIT! GENERATED AUTOMATICALLY!"
3017 func_emit_copyright_notice
3019 echo "# This file represents the compiled summary of the specification in"
3020 echo "# gnulib-cache.m4. It lists the computed macro invocations that need"
3021 echo "# to be invoked from configure.ac."
3022 echo "# In projects using CVS, this file can be treated like other built files."
3025 echo "# This macro should be invoked from $configure_ac, in the section"
3026 echo "# \"Checks for programs\", right after AC_PROG_CC, and certainly before"
3027 echo "# any checks for libraries, header files, types and library functions."
3028 echo "AC_DEFUN([${macro_prefix}_EARLY],"
3030 echo " m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
3031 echo " m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
3032 echo " m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
3033 echo " m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
3034 echo " AC_REQUIRE([AC_PROG_RANLIB])"
3035 if test -n "$uses_subdirs"; then
3036 echo " AC_REQUIRE([AM_PROG_CC_C_O])"
3038 if grep AC_GNU_SOURCE "$destdir"/$m4base/*.m4 >/dev/null 2>/dev/null; then
3039 echo " AC_REQUIRE([AC_GNU_SOURCE])"
3041 for module in $final_modules; do
3043 if test -n "$module"; then
3044 func_get_autoconf_early_snippet "$module"
3047 | sed -e '/^$/d;' -e 's/^/ /'
3050 echo "# This macro should be invoked from $configure_ac, in the section"
3051 echo "# \"Check for header files, types and library functions\"."
3052 echo "AC_DEFUN([${macro_prefix}_INIT],"
3054 if test "$libtool" = true; then
3055 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
3056 echo " gl_cond_libtool=true"
3058 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
3059 echo " gl_cond_libtool=false"
3061 echo " gl_ltlibdeps="
3063 if test "$auxdir" != "build-aux"; then
3064 sed_replace_build_aux='
3066 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
3067 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
3071 sed_replace_build_aux=
3073 func_emit_initmacro_start $macro_prefix
3074 echo " gl_source_base='$sourcebase'"
3075 for module in $main_modules; do
3077 if test -n "$module"; then
3078 func_get_autoconf_snippet "$module" \
3079 | sed -e '/^$/d;' -e 's/^/ /' \
3080 -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./' \
3081 -e "$sed_replace_build_aux"
3082 if test "$module" = 'alloca' && test "$libtool" = true; then
3083 echo 'changequote(,)dnl'
3084 echo 'LTALLOCA=`echo "$ALLOCA" | sed '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
3085 echo 'changequote([, ])dnl'
3086 echo 'AC_SUBST([LTALLOCA])'
3090 func_emit_initmacro_end $macro_prefix
3091 echo " gltests_libdeps="
3092 echo " gltests_ltlibdeps="
3093 func_emit_initmacro_start ${macro_prefix}tests
3094 echo " gl_source_base='$testsbase'"
3095 for module in $testsrelated_modules; do
3097 if test -n "$module"; then
3098 func_get_autoconf_snippet "$module" \
3099 | sed -e '/^$/d;' -e 's/^/ /' \
3100 -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./' \
3101 -e "$sed_replace_build_aux" \
3102 -e 's/\$gl_cond_libtool/false/g' \
3103 -e 's/gl_libdeps/gltests_libdeps/g' \
3104 -e 's/gl_ltlibdeps/gltests_ltlibdeps/g'
3107 func_emit_initmacro_end ${macro_prefix}tests
3108 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
3109 # created using libtool, because libtool already handles the dependencies.
3110 if test "$libtool" != true; then
3111 libname_upper=`echo "$libname" | LC_ALL=C tr 'a-z-' 'A-Z_'`
3112 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
3113 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
3114 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
3115 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
3117 if $use_libtests; then
3118 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
3119 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
3122 func_emit_initmacro_done $macro_prefix $sourcebase
3123 func_emit_initmacro_done ${macro_prefix}tests $testsbase
3125 echo "# This macro records the list of files which have been installed by"
3126 echo "# gnulib-tool and may be removed by future gnulib-tool invocations."
3127 echo "AC_DEFUN([${macro_prefix}_FILE_LIST], ["
3128 echo "$files" | sed -e 's,^, ,'
3131 if test -f "$destdir"/$m4base/gnulib-comp.m4; then
3132 if cmp "$destdir"/$m4base/gnulib-comp.m4 "$tmpfile" > /dev/null; then
3136 echo "Updating $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
3137 mv -f "$destdir"/$m4base/gnulib-comp.m4 "$destdir"/$m4base/gnulib-comp.m4~
3138 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.m4
3140 echo "Update $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
3144 echo "# gnulib-comp.m4 ends here"
3151 echo "Creating $m4base/gnulib-comp.m4"
3152 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.m4
3154 echo "Create $m4base/gnulib-comp.m4"
3160 if test -n "$inctests"; then
3161 # Create tests makefile.
3162 func_dest_tmpfilename $testsbase/$makefile_am
3163 modules="$testsrelated_modules"
3164 func_emit_tests_Makefile_am > "$tmpfile"
3165 if test -f "$destdir"/$testsbase/$makefile_am; then
3166 if cmp "$destdir"/$testsbase/$makefile_am "$tmpfile" > /dev/null; then
3170 echo "Updating $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
3171 mv -f "$destdir"/$testsbase/$makefile_am "$destdir"/$testsbase/$makefile_am~
3172 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
3174 echo "Update $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
3180 echo "Creating $testsbase/$makefile_am"
3181 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
3183 echo "Create $testsbase/$makefile_am"
3186 func_append added_files "$testsbase/$makefile_am$nl"
3190 # Update the .cvsignore and .gitignore files.
3191 { echo "$added_files" | sed -e '/^$/d' -e 's,\([^/]*\)$,|A|\1,'
3192 echo "$removed_files" | sed -e '/^$/d' -e 's,\([^/]*\)$,|R|\1,'
3193 } | LC_ALL=C sort -t'|' -k1,1 > "$tmp"/fileset-changes
3194 { # Rearrange file descriptors. Needed because "while ... done < ..."
3195 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
3196 exec 5<&0 < "$tmp"/fileset-changes
3197 func_update_ignorelist ()
3200 if test -f "$destdir/$dir$ignore"; then
3201 if test -n "$dir_added" || test -n "$dir_removed"; then
3202 LC_ALL=C sort "$destdir/$dir$ignore" > "$tmp"/ignore
3203 echo "$dir_added" | sed -e '/^$/d' | LC_ALL=C sort -u \
3204 | LC_ALL=C join -v 2 "$tmp"/ignore - > "$tmp"/ignore-added
3205 echo "$dir_removed" | sed -e '/^$/d' | LC_ALL=C sort -u \
3206 | LC_ALL=C join -v 2 "$tmp"/ignore - > "$tmp"/ignore-removed
3207 if test -s "$tmp"/ignore-added || test -s "$tmp"/ignore-removed; then
3209 echo "Updating $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
3210 mv -f "$destdir/$dir$ignore" "$destdir/$dir$ignore"~
3211 sed -e 's,^,/^,' -e 's,$,\$/d,' < "$tmp"/ignore-removed > "$tmp"/sed-ignore-removed
3212 cat "$destdir/$dir$ignore"~ "$tmp"/ignore-added \
3213 | sed -f "$tmp"/sed-ignore-removed \
3214 > "$destdir/$dir$ignore"
3216 echo "Update $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
3221 if test -n "$dir_added"; then
3223 echo "Creating $destdir/$dir$ignore"
3225 if test "$ignore" = .cvsignore; then
3227 # Automake generates Makefile rules that create .dirstamp files.
3230 echo "$dir_added" | sed -e '/^$/d' | LC_ALL=C sort -u
3231 } > "$destdir/$dir$ignore"
3233 echo "Create $destdir/$dir$ignore"
3243 if test -d "$destdir/CVS" || test -d "$destdir/${dir}CVS" || test -f "$destdir/${dir}.cvsignore"; then
3244 func_update_ignorelist .cvsignore
3246 if test -d "$destdir/.git" || test -f "$destdir/${dir}.gitignore"; then
3247 func_update_ignorelist .gitignore
3254 # Why not ''read next_dir op file'' ? Because the dir column can be empty.
3255 next_dir=`echo "$line" | sed -e 's,|.*,,'`
3256 op=`echo "$line" | sed -e 's,^[^|]*|\([^|]*\)|.*$,\1,'`
3257 file=`echo "$line" | sed -e 's,^[^|]*|[^|]*|,,'`
3258 if test "$next_dir" != "$last_dir"; then
3259 func_done_dir "$last_dir" "$last_dir_added" "$last_dir_removed"
3260 last_dir="$next_dir"
3265 A) func_append last_dir_added "$file$nl";;
3266 R) func_append last_dir_removed "$file$nl";;
3269 func_done_dir "$last_dir" "$last_dir_added" "$last_dir_removed"
3275 echo "You may need to add #include directives for the following .h files."
3276 # Intersect $specified_modules and $main_modules
3277 # (since $specified_modules is not necessarily of subset of $main_modules
3278 # - some may have been skipped through --avoid, and since the elements of
3279 # $main_modules but not in $specified_modules can go away without explicit
3280 # notice - through changes in the module dependencies).
3281 echo "$specified_modules" > "$tmp"/modules1 # a sorted list, one module per line
3282 echo "$main_modules" > "$tmp"/modules2 # also a sorted list, one module per line
3283 # First the #include <...> directives without #ifs, sorted for convenience,
3284 # then the #include "..." directives without #ifs, sorted for convenience,
3285 # then the #include directives that are surrounded by #ifs. Not sorted.
3286 for module in `LC_ALL=C join "$tmp"/modules1 "$tmp"/modules2`; do
3287 include_directive=`func_get_include_directive "$module"`
3288 case "$nl$include_directive" in
3290 echo "$include_directive" 1>&5
3293 echo "$include_directive" | grep -v 'include "' 1>&6
3294 echo "$include_directive" | grep 'include "' 1>&7
3297 done 5> "$tmp"/include-if 6> "$tmp"/include-angles 7> "$tmp"/include-quotes
3299 LC_ALL=C sort -u "$tmp"/include-angles
3300 LC_ALL=C sort -u "$tmp"/include-quotes
3301 cat "$tmp"/include-if
3302 ) | sed -e '/^$/d' -e 's/^/ /'
3303 rm -f "$tmp"/include-angles "$tmp"/include-quotes "$tmp"/include-if
3305 for module in $main_modules; do
3306 func_get_link_directive "$module"
3308 | LC_ALL=C sort -u | sed -e '/^$/d' -e 's/^/ /' > "$tmp"/link
3309 if test `wc -l < "$tmp"/link` != 0; then
3311 echo "You may need to use the following Makefile variables when linking."
3312 echo "Use them in <program>_LDADD when linking a program, or"
3313 echo "in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library."
3319 echo "Don't forget to"
3320 if test "$makefile_am" = Makefile.am; then
3321 echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
3323 echo " - \"include $makefile_name\" from within \"$sourcebase/Makefile.am\","
3325 if test -n "$pobase"; then
3326 echo " - add \"$pobase/Makefile.in\" to AC_CONFIG_FILES in $configure_ac,"
3328 if test -n "$inctests"; then
3329 if test "$makefile_am" = Makefile.am; then
3330 echo " - add \"$testsbase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
3332 echo " - \"include $makefile_name\" from within \"$testsbase/Makefile.am\","
3335 if test "$makefile_am" = Makefile.am; then
3336 sourcebase_dir=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'`
3337 sourcebase_base=`basename "$sourcebase"`
3338 echo " - mention \"${sourcebase_base}\" in SUBDIRS in ${sourcebase_dir}Makefile.am,"
3340 if test -n "$pobase"; then
3341 pobase_dir=`echo "$pobase" | sed -n -e 's,/[^/]*$,/,p'`
3342 pobase_base=`basename "$pobase"`
3343 echo " - mention \"${pobase_base}\" in SUBDIRS in ${pobase_dir}Makefile.am,"
3345 if test -n "$inctests"; then
3346 if test "$makefile_am" = Makefile.am; then
3347 testsbase_dir=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'`
3348 testsbase_base=`basename "$testsbase"`
3349 echo " - mention \"${testsbase_base}\" in SUBDIRS in ${testsbase_dir}Makefile.am,"
3352 echo " - mention \"-I ${m4base}\" in ACLOCAL_AMFLAGS in Makefile.am,"
3353 echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after AC_PROG_CC,"
3354 echo " - invoke ${macro_prefix}_INIT in $configure_ac."
3357 # func_create_testdir testdir modules
3359 # - local_gnulib_dir from --local-dir
3360 # - auxdir directory relative to destdir where to place build aux files
3361 func_create_testdir ()
3365 if test -z "$modules"; then
3366 # All modules together.
3367 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
3368 # Except fnmatch-posix, which conflicts with fnmatch-gnu. FIXME.
3369 # Except ftruncate, mountlist, which abort the configuration on mingw. FIXME.
3370 modules=`func_all_modules`
3371 modules=`for m in $modules; do case $m in config-h | fnmatch-posix | ftruncate | mountlist) ;; *) echo $m;; esac; done`
3373 modules=`for m in $modules; do echo $m; done | LC_ALL=C sort -u`
3375 # Check that the license of every module is consistent with the license of
3377 saved_modules="$modules"
3378 saved_inctests="$inctests"
3379 # When computing transitive closures, don't consider $module to depend on
3380 # $module-tests. Need this becauses tests are implicitly GPL and may depend
3381 # on GPL modules - therefore we don't want a warning in this case.
3383 for requested_module in $saved_modules; do
3384 requested_license=`func_get_license "$requested_module"`
3385 if test "$requested_license" != GPL; then
3386 # Here we use func_modules_transitive_closure, not just
3387 # func_get_dependencies, so that we also detect weird situations like
3388 # an LGPL module which depends on a GPLed build tool module which depends
3390 modules="$requested_module"
3391 func_modules_transitive_closure
3392 for module in $modules; do
3393 license=`func_get_license "$module"`
3395 'GPLed build tool') ;;
3396 'public domain' | 'unlimited' | 'unmodifiable license text') ;;
3398 case "$requested_license" in
3401 GPLv2+ | LGPLv2+) ;;
3402 *) echo "warning: module $requested_module depends on a module with an incompatible license: $module" 1>&2 ;;
3408 *) echo "warning: module $requested_module depends on a module with an incompatible license: $module" 1>&2 ;;
3414 *) echo "warning: module $requested_module depends on a module with an incompatible license: $module" 1>&2 ;;
3423 modules="$saved_modules"
3424 inctests="$saved_inctests"
3426 # Subdirectory names.
3435 # Determine final module list.
3436 func_modules_transitive_closure
3437 if test $verbose -ge 0; then
3438 echo "Module list with included dependencies:"
3439 echo "$modules" | sed -e 's/^/ /'
3442 # Add the dummy module if needed.
3443 func_modules_add_dummy
3445 # Show banner notice of every module.
3448 # Determine final file list.
3449 func_modules_to_filelist
3450 if test $verbose -ge 0; then
3452 echo "$files" | sed -e 's/^/ /'
3455 sed_rewrite_files="\
3456 s,^build-aux/,$auxdir/,
3458 s,^lib/,$sourcebase/,
3460 s,^tests/,$testsbase/,
3463 # Create directories.
3464 for f in $files; do echo $f; done \
3465 | sed -e "$sed_rewrite_files" \
3466 | sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
3467 | LC_ALL=C sort -u \
3469 { # Rearrange file descriptors. Needed because "while ... done < ..."
3470 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
3471 exec 5<&0 < "$tmp"/dirs
3473 mkdir -p "$testdir/$d"
3478 # Copy files or make symbolic links.
3480 for f in $files; do echo $f; done \
3481 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_files" \
3484 { # Rearrange file descriptors. Needed because "while ... done < ..."
3485 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
3486 exec 5<&0 < "$tmp"/files
3488 func_lookup_file "$f"
3489 if test -n "$lookedup_tmp"; then
3490 cp -p "$lookedup_file" "$testdir/$g"
3492 ln "$lookedup_file" "$testdir/$g" 2>/dev/null ||
3493 if { test -n "$symbolic" \
3494 || { test -n "$lsymbolic" \
3495 && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; }; then
3496 func_ln "$lookedup_file" "$testdir/$g"
3498 cp -p "$lookedup_file" "$testdir/$g"
3505 # Create Makefile.ams that are for testing.
3508 # Create $sourcebase/Makefile.am.
3509 mkdir -p "$testdir/$sourcebase"
3510 func_emit_lib_Makefile_am > "$testdir/$sourcebase/Makefile.am"
3511 any_uses_subdirs="$uses_subdirs"
3513 # Create $m4base/Makefile.am.
3514 mkdir -p "$testdir/$m4base"
3515 (echo "## Process this file with automake to produce Makefile.in."
3521 echo "EXTRA_DIST += "`echo "$f" | sed -e 's,^m4/,,'` ;;
3524 ) > "$testdir/$m4base/Makefile.am"
3526 subdirs="$sourcebase $m4base"
3527 subdirs_with_configure_ac=""
3529 if false && test -f "$testdir"/$m4base/gettext.m4; then
3530 # Avoid stupid error message from automake:
3531 # "AM_GNU_GETTEXT used but `po' not in SUBDIRS"
3532 mkdir -p "$testdir/po"
3533 (echo "## Process this file with automake to produce Makefile.in."
3534 ) > "$testdir/po/Makefile.am"
3535 func_append subdirs " po"
3538 if test -n "$inctests"; then
3539 test -d "$testdir/$testsbase" || mkdir "$testdir/$testsbase"
3540 # Viewed from the $testsbase subdirectory, $auxdir is different.
3541 saved_auxdir="$auxdir"
3542 auxdir=`echo "$testsbase/"|sed 's%[^/][^/]*//*%../%g'`"$auxdir"
3543 # Create $testsbase/Makefile.am.
3545 func_emit_tests_Makefile_am > "$testdir/$testsbase/Makefile.am"
3546 any_uses_subdirs="$any_uses_subdirs$uses_subdirs"
3547 # Create $testsbase/configure.ac.
3548 (echo "# Process this file with autoconf to produce a configure script."
3549 echo "AC_INIT([dummy], [0])"
3550 echo "AC_CONFIG_AUX_DIR([$auxdir])"
3551 echo "AM_INIT_AUTOMAKE"
3553 echo "AM_CONFIG_HEADER([config.h])"
3556 echo "AC_PROG_INSTALL"
3557 echo "AC_PROG_MAKE_SET"
3558 echo "AC_PROG_RANLIB"
3560 if grep AC_GNU_SOURCE "$testdir/$m4base"/*.m4 >/dev/null 2>/dev/null; then
3561 echo "AC_GNU_SOURCE"
3564 for module in $modules; do
3566 if test -n "$module"; then
3567 func_get_autoconf_early_snippet "$module"
3570 | sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
3571 if test "$libtool" = true; then
3572 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
3573 echo "gl_cond_libtool=true"
3575 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
3576 echo "gl_cond_libtool=false"
3578 echo "gl_ltlibdeps="
3580 # Wrap the set of autoconf snippets into an autoconf macro that is then
3581 # invoked. This is needed because autoconf does not support AC_REQUIRE
3583 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
3584 # but we want the AC_REQUIRE to have its normal meaning (provide one
3585 # expansion of the required macro before the current point, and only one
3587 echo "AC_DEFUN([gl_INIT], ["
3588 sed_replace_build_aux='
3590 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
3591 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
3594 func_emit_initmacro_start $macro_prefix
3595 # We don't have explicit ordering constraints between the various
3596 # autoconf snippets. It's cleanest to put those of the library before
3597 # those of the tests.
3598 echo "gl_source_base='../$sourcebase'"
3599 for module in $modules; do
3600 func_verify_nontests_module
3601 if test -n "$module"; then
3602 func_get_autoconf_snippet "$module" \
3603 | sed -e "$sed_replace_build_aux"
3606 echo "gl_source_base='.'"
3607 for module in $modules; do
3608 func_verify_tests_module
3609 if test -n "$module"; then
3610 func_get_autoconf_snippet "$module" \
3611 | sed -e "$sed_replace_build_aux"
3614 func_emit_initmacro_end $macro_prefix
3615 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
3616 # created using libtool, because libtool already handles the dependencies.
3617 if test "$libtool" != true; then
3618 libname_upper=`echo "$libname" | LC_ALL=C tr 'a-z-' 'A-Z_'`
3619 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
3620 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
3621 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
3622 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
3625 func_emit_initmacro_done $macro_prefix $sourcebase # FIXME use $sourcebase or $testsbase?
3629 # Usually $testsbase/config.h will be a superset of config.h. Verify this
3630 # by "merging" config.h into $testsbase/config.h; look out for gcc warnings.
3631 echo "AH_TOP([#include \"../config.h\"])"
3633 echo "AC_OUTPUT([Makefile])"
3634 ) > "$testdir/$testsbase/configure.ac"
3635 auxdir="$saved_auxdir"
3636 func_append subdirs " $testsbase"
3637 subdirs_with_configure_ac="$subdirs_with_configure_ac $testsbase"
3640 # Create Makefile.am.
3641 (echo "## Process this file with automake to produce Makefile.in."
3643 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
3645 echo "SUBDIRS = $subdirs"
3647 echo "ACLOCAL_AMFLAGS = -I $m4base"
3648 ) > "$testdir/Makefile.am"
3650 # Create configure.ac.
3651 (echo "# Process this file with autoconf to produce a configure script."
3652 echo "AC_INIT([dummy], [0])"
3653 if test "$auxdir" != "."; then
3654 echo "AC_CONFIG_AUX_DIR([$auxdir])"
3656 echo "AM_INIT_AUTOMAKE"
3658 echo "AM_CONFIG_HEADER([config.h])"
3661 echo "AC_PROG_INSTALL"
3662 echo "AC_PROG_MAKE_SET"
3664 echo "# For autobuild."
3665 echo "AC_CANONICAL_BUILD"
3666 echo "AC_CANONICAL_HOST"
3668 echo "m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
3669 echo "m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
3670 echo "m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
3671 echo "m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
3673 echo "AC_PROG_RANLIB"
3675 if test -n "$any_uses_subdirs"; then
3676 echo "AM_PROG_CC_C_O"
3679 if grep AC_GNU_SOURCE "$testdir/$m4base"/*.m4 >/dev/null 2>/dev/null; then
3680 echo "AC_GNU_SOURCE"
3683 for module in $modules; do
3684 func_verify_nontests_module
3685 if test -n "$module"; then
3686 func_get_autoconf_early_snippet "$module"
3689 | sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
3690 if test "$libtool" = true; then
3691 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
3692 echo "gl_cond_libtool=true"
3694 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
3695 echo "gl_cond_libtool=false"
3697 echo "gl_ltlibdeps="
3699 # Wrap the set of autoconf snippets into an autoconf macro that is then
3700 # invoked. This is needed because autoconf does not support AC_REQUIRE
3702 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
3703 # but we want the AC_REQUIRE to have its normal meaning (provide one
3704 # expansion of the required macro before the current point, and only one
3706 echo "AC_DEFUN([gl_INIT], ["
3707 if test "$auxdir" != "build-aux"; then
3708 sed_replace_build_aux='
3710 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
3711 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
3715 sed_replace_build_aux=
3717 func_emit_initmacro_start $macro_prefix
3718 echo "gl_source_base='$sourcebase'"
3719 for module in $modules; do
3720 func_verify_nontests_module
3721 if test -n "$module"; then
3722 func_get_autoconf_snippet "$module" \
3723 | sed -e "$sed_replace_build_aux"
3726 func_emit_initmacro_end $macro_prefix
3727 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
3728 # created using libtool, because libtool already handles the dependencies.
3729 if test "$libtool" != true; then
3730 libname_upper=`echo "$libname" | LC_ALL=C tr 'a-z-' 'A-Z_'`
3731 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
3732 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
3733 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
3734 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
3737 func_emit_initmacro_done $macro_prefix $sourcebase
3741 if test -n "$subdirs_with_configure_ac"; then
3742 echo "AC_CONFIG_SUBDIRS(["`echo $subdirs_with_configure_ac`"])"
3744 makefiles="Makefile"
3745 for d in $subdirs; do
3746 # For subdirs that have a configure.ac by their own, it's the subdir's
3747 # configure.ac which creates the subdir's Makefile.am, not this one.
3748 case " $subdirs_with_configure_ac " in
3750 *) func_append makefiles " $d/Makefile" ;;
3753 echo "AC_OUTPUT([$makefiles])"
3754 ) > "$testdir/configure.ac"
3756 # Create autogenerated files.
3758 # Do not use "${AUTORECONF} --force --install", because it may invoke
3759 # autopoint, which brings in older versions of some of our .m4 files.
3760 if test -f $m4base/gettext.m4; then
3761 func_execute_command ${AUTOPOINT} --force || func_exit 1
3762 for f in $m4base/*.m4~; do
3763 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit 1
3766 func_execute_command ${ACLOCAL} -I $m4base || func_exit 1
3767 if ! test -d build-aux; then
3768 func_execute_command mkdir build-aux || func_exit 1
3770 func_execute_command ${AUTOCONF} || func_exit 1
3771 func_execute_command ${AUTOHEADER} || func_exit 1
3772 func_execute_command ${AUTOMAKE} --add-missing --copy || func_exit 1
3774 if test -n "$inctests"; then
3775 # Create autogenerated files.
3776 (cd "$testdir/$testsbase" || func_exit 1
3777 # Do not use "${AUTORECONF} --force --install", because it may invoke
3778 # autopoint, which brings in older versions of some of our .m4 files.
3779 if test -f ../$m4base/gettext.m4; then
3780 func_execute_command ${AUTOPOINT} --force || func_exit 1
3781 for f in ../$m4base/*.m4~; do
3782 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit 1
3785 func_execute_command ${ACLOCAL} -I ../$m4base || func_exit 1
3786 if ! test -d ../build-aux; then
3787 func_execute_command mkdir ../build-aux
3789 func_execute_command ${AUTOCONF} || func_exit 1
3790 func_execute_command ${AUTOHEADER} || func_exit 1
3791 func_execute_command ${AUTOMAKE} --add-missing --copy || func_exit 1
3794 # Need to run configure and make once, to create built files that are to be
3795 # distributed (such as getdate.c).
3796 # Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...".
3797 cleaned_files=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \
3798 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
3799 cleaned_files=`for file in $cleaned_files; do echo " $file "; done`
3800 # Extract the value of "BUILT_SOURCES += ...". Remove variable references
3801 # such $(FOO_H) because they don't refer to distributed files.
3802 sed_remove_make_variables='s,[$]([A-Za-z0-9_]*),,g'
3803 built_sources=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \
3804 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
3805 | sed -e "$sed_remove_make_variables"`
3806 distributed_built_sources=`for file in $built_sources; do
3807 case "$cleaned_files" in
3812 if test -n "$distributed_built_sources"; then
3814 ./configure || func_exit 1
3816 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
3817 make built_sources || func_exit 1
3819 make distclean || func_exit 1
3824 # func_create_megatestdir megatestdir allmodules
3826 # - local_gnulib_dir from --local-dir
3827 # - auxdir directory relative to destdir where to place build aux files
3828 func_create_megatestdir ()
3832 if test -z "$allmodules"; then
3833 allmodules=`func_all_modules`
3837 # First, all modules one by one.
3838 for onemodule in $allmodules; do
3839 func_create_testdir "$megatestdir/$onemodule" $onemodule
3840 func_append megasubdirs "$onemodule "
3842 # Then, all modules all together.
3843 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
3844 # Except fnmatch-posix, which conflicts with fnmatch-gnu. FIXME.
3845 allmodules=`for m in $allmodules; do if test $m != config-h && test $m != fnmatch-posix; then echo $m; fi; done`
3846 func_create_testdir "$megatestdir/ALL" "$allmodules"
3847 func_append megasubdirs "ALL"
3850 cvsdate=`if test -f "$gnulib_dir/CVS/Entries"; then \
3851 vc_witness="$gnulib_dir/CVS/Entries"; \
3853 vc_witness="$gnulib_dir/.git/refs/heads/master"; \
3855 sh "$gnulib_dir/build-aux/mdate-sh" "$vc_witness" \
3856 | sed -e 's,January,01,' -e 's,Jan,01,' \
3857 -e 's,February,02,' -e 's,Feb,02,' \
3858 -e 's,March,03,' -e 's,Mar,03,' \
3859 -e 's,April,04,' -e 's,Apr,04,' \
3861 -e 's,June,06,' -e 's,Jun,06,' \
3862 -e 's,July,07,' -e 's,Jul,07,' \
3863 -e 's,August,08,' -e 's,Aug,08,' \
3864 -e 's,September,09,' -e 's,Sep,09,' \
3865 -e 's,October,10,' -e 's,Oct,10,' \
3866 -e 's,November,11,' -e 's,Nov,11,' \
3867 -e 's,December,12,' -e 's,Dec,12,' \
3868 -e 's,^,00,' -e 's,^[0-9]*\([0-9][0-9] \),\1,' \
3869 -e 's,^\([0-9]*\) \([0-9]*\) \([0-9]*\),\3\2\1,'`
3871 echo "CVSDATE=$cvsdate"
3872 echo "test -d logs || mkdir logs"
3873 echo "for module in $megasubdirs; do"
3874 echo " echo \"Working on module \$module...\""
3875 echo " safemodule=\`echo \$module | sed -e 's|/|-|g'\`"
3876 echo " (echo \"To: gnulib@autobuild.josefsson.org\""
3879 echo " : autobuild project... \$module"
3880 echo " : autobuild revision... cvs-\$CVSDATE-000000"
3881 echo " : autobuild timestamp... \`date \"+%Y%m%d-%H%M%S\"\`"
3882 echo " : autobuild hostname... \`hostname\`"
3883 echo " cd \$module && ./configure \$CONFIGURE_OPTIONS && make && make check && make distclean"
3885 echo " ) 2>&1 | { if test -n \"\$AUTOBUILD_SUBST\"; then sed -e \"\$AUTOBUILD_SUBST\"; else cat; fi; } > logs/\$safemodule"
3887 ) > "$megatestdir/do-autobuild"
3888 chmod a+x "$megatestdir/do-autobuild"
3890 # Create Makefile.am.
3891 (echo "## Process this file with automake to produce Makefile.in."
3893 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
3895 echo "SUBDIRS = $megasubdirs"
3897 echo "EXTRA_DIST = do-autobuild"
3898 ) > "$megatestdir/Makefile.am"
3900 # Create configure.ac.
3901 (echo "# Process this file with autoconf to produce a configure script."
3902 echo "AC_INIT([dummy], [0])"
3903 if test "$auxdir" != "."; then
3904 echo "AC_CONFIG_AUX_DIR([$auxdir])"
3906 echo "AM_INIT_AUTOMAKE"
3908 echo "AC_PROG_MAKE_SET"
3910 echo "AC_CONFIG_SUBDIRS([$megasubdirs])"
3911 echo "AC_OUTPUT([Makefile])"
3912 ) > "$megatestdir/configure.ac"
3914 # Create autogenerated files.
3916 # Do not use "${AUTORECONF} --install", because autoreconf operates
3917 # recursively, but the subdirectories are already finished, therefore
3918 # calling autoreconf here would only waste lots of CPU time.
3919 func_execute_command ${ACLOCAL} || func_exit 1
3920 func_execute_command mkdir build-aux
3921 func_execute_command ${AUTOCONF} || func_exit 1
3922 func_execute_command ${AUTOMAKE} --add-missing --copy || func_exit 1
3928 func_fatal_error "no mode specified" ;;
3937 if test -z "$destdir"; then
3940 test -d "$destdir" \
3941 || func_fatal_error "destination directory does not exist: $destdir"
3943 # Prefer configure.ac to configure.in.
3944 if test -f "$destdir"/configure.ac; then
3945 configure_ac="$destdir/configure.ac"
3947 if test -f "$destdir"/configure.in; then
3948 configure_ac="$destdir/configure.in"
3950 func_fatal_error "cannot find $destdir/configure.ac"
3954 # Analyze configure.ac.
3956 guessed_libtool=false
3961 /AC_CONFIG_AUX_DIR/ {
3962 s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^])]*\).*$,guessed_auxdir="\1",p
3964 /A[CM]_PROG_LIBTOOL/ {
3965 s,^.*$,guessed_libtool=true,p
3967 eval `sed -n -e "$my_sed_traces" < "$configure_ac"`
3969 if test -z "$auxdir"; then
3970 auxdir="$guessed_auxdir"
3973 # Determine where to apply func_import.
3974 if test -n "$m4base"; then
3975 # Apply func_import to a particular gnulib directory.
3976 # Any number of additional modules can be given.
3977 if test ! -f "$destdir/$m4base"/gnulib-cache.m4; then
3978 # First use of gnulib in the given m4base.
3979 test -n "$supplied_libname" || supplied_libname=true
3980 test -n "$sourcebase" || sourcebase="lib"
3981 test -n "$docbase" || docbase="doc"
3982 test -n "$testsbase" || testsbase="tests"
3983 test -n "$macro_prefix" || macro_prefix="gl"
3987 # Apply func_import to all gnulib directories.
3988 # To get this list of directories, look at Makefile.am. (Not at
3989 # configure, because it may be omitted from CVS. Also, don't run
3990 # "find $destdir -name gnulib-cache.m4", as it might be too expensive.)
3993 if test -f "$destdir"/Makefile.am; then
3994 aclocal_amflags=`sed -n 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/p' "$destdir"/Makefile.am`
3996 for arg in $aclocal_amflags; do
3997 if test -n "$m4dir_is_next"; then
3998 # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
4002 if test -f "$destdir/$arg"/gnulib-cache.m4; then
4003 func_append m4dirs " $arg"
4004 m4dirs_count=`expr $m4dirs_count + 1`
4010 if test "X$arg" = "X-I"; then
4018 # No Makefile.am! Oh well. Look at the last generated aclocal.m4.
4019 if test -f "$destdir"/aclocal.m4; then
4020 sedexpr1='s,^m4_include(\[\(.*\)])$,\1,p'
4021 sedexpr2='s,^[^/]*$,.,'
4022 sedexpr3='s,/[^/]*$,,'
4023 m4dirs=`sed -n -e "$sedexpr1" aclocal.m4 | sed -e "$sedexpr2" -e "$sedexpr3" | LC_ALL=C sort -u`
4024 m4dirs_count=`echo "$m4dirs" | wc -l`
4027 if test $m4dirs_count = 0; then
4028 # First use of gnulib in a package.
4029 # Any number of additional modules can be given.
4030 test -n "$supplied_libname" || supplied_libname=true
4031 test -n "$sourcebase" || sourcebase="lib"
4033 test -n "$docbase" || docbase="doc"
4034 test -n "$testsbase" || testsbase="tests"
4035 test -n "$macro_prefix" || macro_prefix="gl"
4038 if test $m4dirs_count = 1; then
4039 # There's only one use of gnulib here. Assume the user means it.
4040 # Any number of additional modules can be given.
4041 for m4base in $m4dirs; do
4045 # Ambiguous - guess what the user meant.
4046 if test $# = 0; then
4047 # No further arguments. Guess the user wants to update all of them.
4048 for m4base in $m4dirs; do
4049 # Perform func_import in a subshell, so that variable values
4051 # local_gnulib_dir, avoidlist, sourcebase, m4base, pobase,
4052 # docbase, testsbase, inctests, libname, lgpl, makefile_name,
4053 # libtool, macro_prefix, po_domain
4054 # don't propagate from one directory to another.
4055 (func_import) || func_exit 1
4059 func_fatal_error "Ambiguity: to which directory should the modules be added? Please specify at least --m4-base=..."
4067 if test -z "$destdir"; then
4068 func_fatal_error "please specify --dir option"
4071 test -d "$destdir" \
4072 || func_fatal_error "could not create destination directory"
4073 test -n "$auxdir" || auxdir="build-aux"
4074 func_create_testdir "$destdir" "$*"
4077 create-megatestdir )
4078 if test -z "$destdir"; then
4079 func_fatal_error "please specify --dir option"
4081 mkdir "$destdir" || func_fatal_error "could not create destination directory"
4082 test -n "$auxdir" || auxdir="build-aux"
4083 func_create_megatestdir "$destdir" "$*"
4087 test -n "$destdir" || destdir=testdir$$
4088 mkdir "$destdir" || func_fatal_error "could not create destination directory"
4089 test -n "$auxdir" || auxdir="build-aux"
4090 func_create_testdir "$destdir" "$*"
4094 ../configure || func_exit 1
4096 make check || func_exit 1
4097 make distclean || func_exit 1
4098 remaining=`find . -type f -print`
4099 if test -n "$remaining"; then
4100 echo "Remaining files:" $remaining 1>&2
4101 echo "gnulib-tool: *** Stop." 1>&2
4110 test -n "$destdir" || destdir=testdir$$
4111 mkdir "$destdir" || func_fatal_error "could not create destination directory"
4112 test -n "$auxdir" || auxdir="build-aux"
4113 func_create_megatestdir "$destdir" "$*"
4121 remaining=`find . -type f -print`
4122 if test -n "$remaining"; then
4123 echo "Remaining files:" $remaining 1>&2
4124 echo "gnulib-tool: *** Stop." 1>&2
4132 extract-description )
4136 if test -n "$module"; then
4137 func_get_description "$module"
4146 if test -n "$module"; then
4147 func_get_notice "$module"
4156 if test -n "$module"; then
4157 func_get_filelist "$module"
4162 extract-dependencies )
4166 if test -n "$module"; then
4167 func_get_dependencies "$module"
4172 extract-autoconf-snippet )
4176 if test -n "$module"; then
4177 func_get_autoconf_snippet "$module"
4182 extract-automake-snippet )
4186 if test -n "$module"; then
4187 func_get_automake_snippet "$module"
4192 extract-include-directive )
4196 if test -n "$module"; then
4197 func_get_include_directive "$module"
4202 extract-link-directive )
4206 if test -n "$module"; then
4207 func_get_link_directive "$module"
4216 if test -n "$module"; then
4217 func_get_license "$module"
4222 extract-maintainer )
4226 if test -n "$module"; then
4227 func_get_maintainer "$module"
4232 extract-tests-module )
4236 if test -n "$module"; then
4237 func_get_tests_module "$module"
4243 func_fatal_error "unknown operation mode --$mode" ;;
4247 # Undo the effect of the previous 'trap' command. Some shellology:
4248 # We cannot use "trap - 0 1 2 3 13 15", because Solaris sh would attempt to
4249 # execute the command "-". "trap '' ..." is fine only for signal 0 (= normal
4250 # exit); for the others we need to call 'exit' explicitly. The value of $? is
4251 # 128 + signal number and is set before the trap-registered command is run.
4253 trap 'func_exit $?' 1 2 3 13 15
4258 # indent-tabs-mode: nil
4259 # whitespace-check-buffer-indent: nil