3 # Copyright (C) 2002-2010 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"
67 if test -z "${MAKE}"; then
71 # When using GNU sed, turn off as many GNU extensions as possible,
72 # to minimize the risk of accidentally using non-portable features.
73 # However, do this only for gnulib-tool itself, not for the code that
74 # gnulib-tool generates, since we don't want "sed --posix" to leak
75 # into makefiles. And do it only for sed versions 4.2 or newer,
76 # because "sed --posix" is buggy in GNU sed 4.1.5, see
77 # <http://lists.gnu.org/archive/html/bug-gnulib/2009-02/msg00225.html>.
78 if (alias) > /dev/null 2>&1 \
79 && echo | sed --posix -e d >/dev/null 2>&1 \
80 && case `sed --version | sed -e 's/^[^0-9]*//' -e 1q` in \
81 [1-3]* | 4.[01]*) false;; \
85 # Define sed as an alias.
86 # It is not always possible to use aliases. Aliases are guaranteed to work
87 # if the executing shell is bash and either it is invoked as /bin/sh or
88 # is a version >= 2.0, supporting shopt. This is the common case.
89 # Two other approaches (use of a variable $sed or of a function func_sed
90 # instead of an alias) require massive, fragile code changes.
91 # An other approach (use of function sed) requires `which sed` - but
92 # 'which' is hard to emulate, due to missing "test -x" on some platforms.
93 if test -n "$BASH_VERSION"; then
94 shopt -s expand_aliases >/dev/null 2>&1
96 alias sed='sed --posix'
99 # sed_noop is a sed expression that does nothing.
100 # An empty expression does not work with the native 'sed' on AIX 6.1.
104 # outputs to stdout the --help usage message.
108 Usage: gnulib-tool --list
109 gnulib-tool --import [module1 ... moduleN]
111 gnulib-tool --create-testdir --dir=directory [module1 ... moduleN]
112 gnulib-tool --create-megatestdir --dir=directory [module1 ... moduleN]
113 gnulib-tool --test --dir=directory module1 ... moduleN
114 gnulib-tool --megatest --dir=directory [module1 ... moduleN]
115 gnulib-tool --extract-description module
116 gnulib-tool --extract-status module
117 gnulib-tool --extract-notice module
118 gnulib-tool --extract-applicability module
119 gnulib-tool --extract-filelist module
120 gnulib-tool --extract-dependencies module
121 gnulib-tool --extract-autoconf-snippet module
122 gnulib-tool --extract-automake-snippet module
123 gnulib-tool --extract-include-directive module
124 gnulib-tool --extract-link-directive module
125 gnulib-tool --extract-license module
126 gnulib-tool --extract-maintainer module
127 gnulib-tool --extract-tests-module module
128 gnulib-tool --copy-file file [destination]
131 --list print the available module names
132 --import import the given modules into the current package;
133 if no modules are specified, update the current
134 package from the current gnulib
135 --update update the current package, restore files omitted
137 --create-testdir create a scratch package with the given modules
138 --create-megatestdir create a mega scratch package with the given modules
139 one by one and all together
140 --test test the combination of the given modules
141 (recommended to use CC=\"gcc -Wall\" here)
142 --megatest test the given modules one by one and all together
143 (recommended to use CC=\"gcc -Wall\" here)
144 --extract-description extract the description
145 --extract-status extract the status (obsolete or not)
146 --extract-notice extract the notice or banner
147 --extract-filelist extract the list of files
148 --extract-dependencies extract the dependencies
149 --extract-autoconf-snippet extract the snippet for configure.ac
150 --extract-automake-snippet extract the snippet for library makefile
151 --extract-include-directive extract the #include directive
152 --extract-link-directive extract the linker directive
153 --extract-license report the license terms of the source files
155 --extract-maintainer report the maintainer(s) inside gnulib
156 --extract-tests-module report the unit test module, if it exists
157 --copy-file copy a file that is not part of any module
160 --dir=DIRECTORY Specify the target directory.
161 For --import, this specifies where your
162 configure.ac can be found. Defaults to current
164 --local-dir=DIRECTORY Specify a local override directory where to look
165 up files before looking in gnulib's directory.
166 --verbose Increase verbosity. May be repeated.
167 --quiet Decrease verbosity. May be repeated.
168 --no-cache Disable module caching optimization.
170 Options for --import:
171 --lib=LIBRARY Specify the library name. Defaults to 'libgnu'.
172 --source-base=DIRECTORY
173 Directory relative to --dir where source code is
174 placed (default \"lib\").
175 --m4-base=DIRECTORY Directory relative to --dir where *.m4 macros are
176 placed (default \"m4\").
177 --po-base=DIRECTORY Directory relative to --dir where *.po files are
178 placed (default \"po\").
179 --doc-base=DIRECTORY Directory relative to --dir where doc files are
180 placed (default \"doc\").
181 --tests-base=DIRECTORY
182 Directory relative to --dir where unit tests are
183 placed (default \"tests\").
184 --aux-dir=DIRECTORY Directory relative to --dir where auxiliary build
185 tools are placed (default \"build-aux\").
186 --with-tests Include unit tests for the included modules.
187 --with-obsolete Include obsolete modules when they occur among the
188 dependencies. By default, dependencies to obsolete
190 --avoid=MODULE Avoid including the given MODULE. Useful if you
191 have code that provides equivalent functionality.
192 This option can be repeated.
193 --lgpl[=2|=3] Abort if modules aren't available under the LGPL.
194 Also modify license template from GPL to LGPL.
195 The version number of the LGPL can be specified;
196 the default is currently LGPLv3.
197 --makefile-name=NAME Name of makefile in automake syntax in the
198 source-base and tests-base directories
199 (default \"Makefile.am\").
200 --libtool Use libtool rules.
201 --no-libtool Don't use libtool rules.
202 --macro-prefix=PREFIX Specify the prefix of the macros 'gl_EARLY' and
203 'gl_INIT'. Default is 'gl'.
204 --po-domain=NAME Specify the prefix of the i18n domain. Usually use
205 the package name. A suffix '-gnulib' is appended.
206 --vc-files Update version control related files.
207 --no-vc-files Don't update version control related files
208 (.gitignore and/or .cvsignore).
209 --no-changelog Don't update or create ChangeLog files.
211 Options for --import and --update:
212 --dry-run For --import, only print what would have been done.
213 -s, --symbolic, --symlink Make symbolic links instead of copying files.
214 --local-symlink Make symbolic links instead of copying files, only
215 for files from the local override directory.
216 -S, --more-symlinks Make symbolic links instead of copying files, and
217 don't replace copyright notices.
219 Report bugs to <bug-gnulib@gnu.org>."
223 # outputs to stdout the --version message.
227 if test -d "$gnulib_dir"/.git \
228 && (git --version) >/dev/null 2>/dev/null \
229 && (date --version) >/dev/null 2>/dev/null; then
230 # gnulib checked out from git.
231 sed_extract_first_date='/^Date/{
235 date=`cd "$gnulib_dir" && git log ChangeLog | sed -n -e "$sed_extract_first_date"`
236 # Turn "Fri Mar 21 07:16:51 2008 -0600" into "Mar 21 2008 07:16:51 -0600".
237 sed_year_before_time='s/^[^ ]* \([^ ]*\) \([0-9]*\) \([0-9:]*\) \([0-9]*\) /\1 \2 \4 \3 /'
238 date=`echo "$date" | sed -e "$sed_year_before_time"`
239 # Use GNU date to compute the time in GMT.
240 date=`date -d "$date" -u +"%Y-%m-%d %H:%M:%S"`
241 version=' '`cd "$gnulib_dir" && ./build-aux/git-version-gen /dev/null | sed -e 's/-dirty/-modified/'`
243 if test -d "$gnulib_dir"/CVS \
244 && (cvs --version) >/dev/null 2>/dev/null; then
245 # gnulib checked out from CVS.
246 sed_extract_first_date='/^date: /{
247 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
250 date=`cd "$gnulib_dir" && cvs log -N ChangeLog 2>/dev/null | sed -n -e "$sed_extract_first_date"`
252 # gnulib copy without versioning information.
253 date=`sed -e 's/ .*//;q' "$gnulib_dir"/ChangeLog`
257 year=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed -e 's,^.* ,,'`
259 gnulib-tool (GNU $package $date)$version
260 Copyright (C) $year Free Software Foundation, Inc.
261 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
262 This is free software: you are free to change and redistribute it.
263 There is NO WARRANTY, to the extent permitted by law.
265 Written by" "Bruno Haible" "and" "Simon Josefsson"
268 # func_emit_copyright_notice
269 # outputs to stdout a header for a generated file.
270 func_emit_copyright_notice ()
272 sed -n -e '/Copyright/ {
275 }' < "$self_abspathname"
277 echo "# This file is free software, distributed under the terms of the GNU"
278 echo "# General Public License. As a special exception to the GNU General"
279 echo "# Public License, this file may be distributed as part of a program"
280 echo "# that contains a configuration script generated by Autoconf, under"
281 echo "# the same distribution terms as the rest of that program."
283 echo "# Generated by gnulib-tool."
287 # exits with a given status.
288 # This function needs to be used, rather than 'exit', when a 'trap' handler is
289 # in effect that refers to $?.
296 # locates the directory where the gnulib repository lives
298 # - progname name of this program
300 # - self_abspathname absolute pathname of gnulib-tool
301 # - gnulib_dir absolute pathname of gnulib repository
305 /*) self_abspathname="$progname" ;;
306 */*) self_abspathname=`pwd`/"$progname" ;;
309 # Iterate through the elements of $PATH.
310 # We use IFS=: instead of
311 # for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'`
312 # because the latter does not work when some PATH element contains spaces.
313 # We use a canonicalized $pathx instead of $PATH, because empty PATH
314 # elements are by definition equivalent to '.', however field splitting
315 # according to IFS=: loses empty fields in many shells:
316 # - /bin/sh on OSF/1 and Solaris loses all empty fields (at the
317 # beginning, at the end, and in the middle),
318 # - /bin/sh on IRIX and /bin/ksh on IRIX and OSF/1 lose empty fields
319 # at the beginning and at the end,
320 # - GNU bash, /bin/sh on AIX and HP-UX, and /bin/ksh on AIX, HP-UX,
321 # Solaris lose empty fields at the end.
322 # The 'case' statement is an optimization, to avoid evaluating the
323 # explicit canonicalization command when $PATH contains no empty fields.
325 if test "${PATH_SEPARATOR+set}" != set; then
327 { echo "#! /bin/sh"; echo "exit 0"; } > "$tmp"/conf.sh
328 chmod +x "$tmp"/conf.sh
329 if (PATH="/nonexistent;$tmp"; conf.sh) >/dev/null 2>&1; then
336 if test "$PATH_SEPARATOR" = ";"; then
337 # On Windows, programs are searched in "." before $PATH.
340 # On Unix, we have to convert empty PATH elements to ".".
344 pathx=`echo ":$PATH:" | sed -e 's/:::*/:.:/g' -e 's/^://' -e 's/:\$//'`
349 IFS="$PATH_SEPARATOR"
353 if test -x "$d/$progname" && test ! -d "$d/$progname"; then
354 self_abspathname="$d/$progname"
359 if test -z "$self_abspathname"; then
360 func_fatal_error "could not locate the gnulib-tool program - how did you invoke it?"
364 while test -h "$self_abspathname"; do
365 # Resolve symbolic link.
366 linkval=`func_readlink "$self_abspathname"`
367 test -n "$linkval" || break
369 /* ) self_abspathname="$linkval" ;;
370 * ) self_abspathname=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;;
373 gnulib_dir=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
377 # creates a temporary directory.
379 # - progname name of this program
381 # - tmp pathname of freshly created temporary directory
384 # Use the environment variable TMPDIR, falling back to /tmp. This allows
385 # users to specify a different temporary directory, for example, if their
386 # /tmp is filled up or too small.
389 # Use the mktemp program if available. If not available, hide the error
391 tmp=`(umask 077 && mktemp -d "$TMPDIR/glXXXXXX") 2>/dev/null` &&
392 test -n "$tmp" && test -d "$tmp"
395 # Use a simple mkdir command. It is guaranteed to fail if the directory
396 # already exists. $RANDOM is bash specific and expands to empty in shells
397 # other than bash, ksh and zsh. Its use does not increase security;
398 # rather, it minimizes the probability of failure in a very cluttered /tmp
400 tmp=$TMPDIR/gl$$-$RANDOM
401 (umask 077 && mkdir "$tmp")
404 echo "$progname: cannot create a temporary directory in $TMPDIR" >&2
409 # func_append var value
410 # appends the given value to the shell variable var.
411 if ( foo=bar; foo+=baz && test "$foo" = barbaz ) >/dev/null 2>&1; then
412 # Use bash's += operator. It reduces complexity of appending repeatedly to
413 # a single variable from O(n^2) to O(n).
418 fast_func_append=true
422 eval "$1=\"\$$1\$2\""
424 fast_func_append=false
427 # func_remove_prefix var prefix
428 # removes the given prefix from the value of the shell variable var.
429 # var should be the name of a shell variable.
430 # Its value should not contain a newline and not start or end with whitespace.
431 # prefix should not contain the characters "$`\{}[]^|.
432 if ( foo=bar; eval 'test "${foo#b}" = ar' ) >/dev/null 2>&1; then
433 func_remove_prefix ()
437 fast_func_remove_prefix=true
439 func_remove_prefix ()
441 eval "value=\"\$$1\""
445 sed_escape_dots='s/\([.]\)/\\\1/g'
446 prefix=`echo "$prefix" | sed -e "$sed_escape_dots"`
449 value=`echo "$value" | sed -e "s|^${prefix}||"`
450 eval "$1=\"\$value\""
452 fast_func_remove_prefix=false
455 # func_remove_suffix var suffix
456 # removes the given suffix from the value of the shell variable var.
457 # var should be the name of a shell variable.
458 # Its value should not contain a newline and not start or end with whitespace.
459 # suffix should not contain the characters "$`\{}[]^|.
460 if ( foo=bar; eval 'test "${foo%r}" = ba' ) >/dev/null 2>&1; then
461 func_remove_suffix ()
465 fast_func_remove_suffix=true
467 func_remove_suffix ()
469 eval "value=\"\$$1\""
473 sed_escape_dots='s/\([.]\)/\\\1/g'
474 suffix=`echo "$suffix" | sed -e "$sed_escape_dots"`
477 value=`echo "$value" | sed -e "s|${suffix}\$||"`
478 eval "$1=\"\$value\""
480 fast_func_remove_suffix=false
483 # func_fatal_error message
484 # outputs to stderr a fatal error message, and terminates the program.
486 # - progname name of this program
489 echo "$progname: *** $1" 1>&2
490 echo "$progname: *** Stop." 1>&2
494 # func_warning message
495 # Outputs to stderr a warning message,
498 echo "gnulib-tool: warning: $1" 1>&2
501 # func_readlink SYMLINK
502 # outputs the target of the given symlink.
503 if (type -p readlink) > /dev/null 2>&1; then
506 # Use the readlink program from GNU coreutils.
512 # Use two sed invocations. A single sed -n -e 's,^.* -> \(.*\)$,\1,p'
513 # would do the wrong thing if the link target contains " -> ".
514 LC_ALL=C ls -l "$1" | sed -e 's, -> ,#%%#,' | sed -n -e 's,^.*#%%#\(.*\)$,\1,p'
518 # func_relativize DIR1 DIR2
519 # computes a relative pathname RELDIR such that DIR1/RELDIR = DIR2.
521 # - DIR1 relative pathname, relative to the current directory
522 # - DIR2 relative pathname, relative to the current directory
524 # - reldir relative pathname of DIR2, relative to DIR1
530 sed_first='s,^\([^/]*\)/.*$,\1,'
531 sed_rest='s,^[^/]*/*,,'
532 sed_last='s,^.*/\([^/]*\)$,\1,'
533 sed_butlast='s,/*[^/]*$,,'
534 while test -n "$dir1"; do
535 first=`echo "$dir1" | sed -e "$sed_first"`
536 if test "$first" != "."; then
537 if test "$first" = ".."; then
538 dir2=`echo "$dir0" | sed -e "$sed_last"`/"$dir2"
539 dir0=`echo "$dir0" | sed -e "$sed_butlast"`
541 first2=`echo "$dir2" | sed -e "$sed_first"`
542 if test "$first2" = "$first"; then
543 dir2=`echo "$dir2" | sed -e "$sed_rest"`
547 dir0="$dir0"/"$first"
550 dir1=`echo "$dir1" | sed -e "$sed_rest"`
555 # func_relconcat DIR1 DIR2
556 # computes a relative pathname DIR1/DIR2, with obvious simplifications.
558 # - DIR1 relative pathname, relative to the current directory
559 # - DIR2 relative pathname, relative to DIR1
561 # - relconcat DIR1/DIR2, relative to the current directory
566 sed_first='s,^\([^/]*\)/.*$,\1,'
567 sed_rest='s,^[^/]*/*,,'
568 sed_last='s,^.*/\([^/]*\)$,\1,'
569 sed_butlast='s,/*[^/]*$,,'
571 first=`echo "$dir2" | sed -e "$sed_first"`
572 if test "$first" = "."; then
573 dir2=`echo "$dir2" | sed -e "$sed_rest"`
574 if test -z "$dir2"; then
579 last=`echo "$dir1" | sed -e "$sed_last"`
580 while test "$last" = "."; do
581 dir1=`echo "$dir1" | sed -e "$sed_butlast"`
582 last=`echo "$dir1" | sed -e "$sed_last"`
584 if test -z "$dir1"; then
588 if test "$first" = ".."; then
589 if test "$last" = ".."; then
590 relconcat="$dir1/$dir2"
593 dir1=`echo "$dir1" | sed -e "$sed_butlast"`
594 dir2=`echo "$dir2" | sed -e "$sed_rest"`
595 if test -z "$dir1"; then
599 if test -z "$dir2"; then
604 relconcat="$dir1/$dir2"
612 # Like ln -s, except that SRC is given relative to the current directory (or
613 # absolute), not given relative to the directory of DEST.
619 *) # SRC is relative.
622 ln -s "`pwd`/$1" "$2" ;;
623 *) # DEST is relative too.
624 ln_destdir=`echo "$2" | sed -e 's,[^/]*$,,'`
625 test -n "$ln_destdir" || ln_destdir="."
626 func_relativize "$ln_destdir" "$1"
634 # func_ln_if_changed SRC DEST
635 # Like func_ln, but avoids munging timestamps if the link is correct.
636 func_ln_if_changed ()
638 if test $# -ne 2; then
639 echo "usage: func_ln_if_changed SRC DEST" >&2
641 ln_target=`func_readlink "$2"`
642 if test -h "$2" && test "$1" = "$ln_target"; then
651 # Resets SIGPIPE to its default behaviour. SIGPIPE is signalled when a process
652 # writes into a pipe with no readers, i.e. a pipe where all readers have
653 # already closed their file descriptor that read from it or exited entirely.
654 # The default behaviour is to terminate the current process without an error
656 # When "trap '' SIGPIPE" is in effect, the behaviour (at least with bash) is to
657 # terminate the current process with an error message.
658 # This function should be called at the beginning of a command that only
659 # produces output to stdout (i.e. no side effects!), when the command that
660 # will read from this pipe might prematurely exit or close its standard input
662 if test -n "$BASH_VERSION"; then
663 # The problem has only been reported with bash. Probably it occurs only with
664 # bash-3.2. For the reasons, see
665 # <http://lists.gnu.org/archive/html/bug-bash/2008-12/msg00050.html>.
666 # Note that Solaris sh does not understand "trap - SIGPIPE".
667 func_reset_sigpipe ()
672 func_reset_sigpipe ()
678 # Ensure an 'echo' command that does not interpret backslashes.
680 # echo '\n' | wc -l prints 1 when OK, 2 when KO
681 # echo '\t' | grep t > /dev/null has return code 0 when OK, 1 when KO
682 # This problem is a weird heritage from SVR4. BSD got it right (except that
683 # BSD echo interprets '-n' as an option, which is also not desirable).
684 # Nowadays the problem occurs in 4 situations:
685 # - in bash, when the shell option xpg_echo is set (bash >= 2.04)
686 # or when it was built with --enable-usg-echo-default (bash >= 2.0)
687 # or when it was built with DEFAULT_ECHO_TO_USG (bash < 2.0),
688 # - in zsh, when sh-emulation is not set,
689 # - in ksh (e.g. AIX /bin/sh and Solaris /usr/xpg4/bin/sh are ksh instances,
690 # and HP-UX /bin/sh and IRIX /bin/sh behave similarly),
691 # - in Solaris /bin/sh and OSF/1 /bin/sh.
692 # We try the following workarounds:
693 # - for all: respawn using $CONFIG_SHELL if that is set and works.
694 # - for bash >= 2.04: unset the shell option xpg_echo.
695 # - for bash >= 2.0: define echo to a function that uses the printf built-in.
696 # - for bash < 2.0: define echo to a function that uses cat of a here document.
697 # - for zsh: turn sh-emulation on.
698 # - for ksh: alias echo to 'print -r'.
699 # - for ksh: alias echo to a function that uses cat of a here document.
700 # - for Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh and rely on
701 # the ksh workaround.
702 # - otherwise: respawn using /bin/sh and rely on the workarounds.
703 # When respawning, we pass --no-reexec as first argument, so as to avoid
704 # turning this script into a fork bomb in unlucky situations.
706 if echo '\t' | grep t > /dev/null; then
707 have_echo=yes # Lucky!
709 # Try the workarounds.
710 # Respawn using $CONFIG_SHELL if that is set and works.
711 if test -z "$have_echo" \
712 && test "X$1" != "X--no-reexec" \
713 && test -n "$CONFIG_SHELL" \
714 && test -f "$CONFIG_SHELL" \
715 && $CONFIG_SHELL -c "echo '\\t' | grep t > /dev/null"; then
716 exec $CONFIG_SHELL "$0" --no-reexec "$@"
719 # For bash >= 2.04: unset the shell option xpg_echo.
720 if test -z "$have_echo" \
721 && test -n "$BASH_VERSION" \
722 && (shopt -o xpg_echo; echo '\t' | grep t > /dev/null) 2>/dev/null; then
726 # For bash >= 2.0: define echo to a function that uses the printf built-in.
727 # For bash < 2.0: define echo to a function that uses cat of a here document.
728 # (There is no win in using 'printf' over 'cat' if it is not a shell built-in.)
729 if test -z "$have_echo" \
730 && test -n "$BASH_VERSION"; then \
731 if type printf 2>/dev/null | grep / > /dev/null; then
732 # 'printf' is not a shell built-in.
740 # 'printf' is a shell built-in.
746 if echo '\t' | grep t > /dev/null; then
750 # For zsh: turn sh-emulation on.
751 if test -z "$have_echo" \
752 && test -n "$ZSH_VERSION" \
753 && (emulate sh) >/dev/null 2>&1; then
756 # For ksh: alias echo to 'print -r'.
757 if test -z "$have_echo" \
758 && (type print) >/dev/null 2>&1; then
759 # A 'print' command exists.
760 if type print 2>/dev/null | grep / > /dev/null; then
763 # 'print' is a shell built-in.
764 if (print -r '\told' | grep told > /dev/null) 2>/dev/null; then
765 # 'print' is the ksh shell built-in.
766 alias echo='print -r'
770 if test -z "$have_echo" \
771 && echo '\t' | grep t > /dev/null; then
774 # For ksh: alias echo to a function that uses cat of a here document.
775 # The ksh manual page says:
776 # "Aliasing is performed when scripts are read, not while they are executed.
777 # Therefore, for an alias to take effect, the alias definition command has
778 # to be executed before the command which references the alias is read."
779 # Because of this, we have to play strange tricks with have_echo, to ensure
780 # that the top-level statement containing the test starts after the 'alias'
782 if test -z "$have_echo"; then
789 alias echo=bsd_echo 2>/dev/null
791 if test -z "$have_echo" \
792 && echo '\t' | grep t > /dev/null; then
795 if test -z "$have_echo"; then
796 unalias echo 2>/dev/null
798 # For Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh.
799 if test -z "$have_echo" \
800 && test "X$1" != "X--no-reexec" \
801 && test -f /bin/ksh; then
802 exec /bin/ksh "$0" --no-reexec "$@"
805 # Otherwise: respawn using /bin/sh.
806 if test -z "$have_echo" \
807 && test "X$1" != "X--no-reexec" \
808 && test -f /bin/sh; then
809 exec /bin/sh "$0" --no-reexec "$@"
812 if test -z "$have_echo"; then
813 func_fatal_error "Shell does not support 'echo' correctly. Please install GNU bash and set the environment variable CONFIG_SHELL to point to it."
815 if echo '\t' | grep t > /dev/null; then
818 func_fatal_error "Shell does not support 'echo' correctly. Workaround does not work. Please report this as a bug to bug-gnulib@gnu.org."
820 if test "X$1" = "X--no-reexec"; then
824 # Command-line option processing.
825 # Removes the OPTIONS from the arguments. Sets the variables:
826 # - mode list or import or create-testdir or create-megatestdir
827 # - destdir from --dir
828 # - local_gnulib_dir from --local-dir
829 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
830 # - libname, supplied_libname from --lib
831 # - sourcebase from --source-base
832 # - m4base from --m4-base
833 # - pobase from --po-base
834 # - docbase from --doc-base
835 # - testsbase from --tests-base
836 # - auxdir from --aux-dir
837 # - inctests true if --with-tests was given, blank otherwise
838 # - incobsolete true if --with-obsolete was given, blank otherwise
839 # - avoidlist list of modules to avoid, from --avoid
840 # - lgpl yes or a number if --lgpl was given, blank otherwise
841 # - makefile_name from --makefile-name
842 # - libtool true if --libtool was given, false if --no-libtool was
843 # given, blank otherwise
844 # - macro_prefix from --macro-prefix
845 # - po_domain from --po-domain
846 # - vc_files true if --vc-files was given, false if --no-vc-files was
847 # given, blank otherwise
848 # - autoconf_minversion minimum supported autoconf version
849 # - do_changelog false if --no-changelog was given, : otherwise
850 # - doit : if actions shall be executed, false if only to be printed
851 # - symbolic true if --symlink or --more-symlinks was given, blank
853 # - lsymbolic true if --local-symlink was given, blank otherwise
854 # - do_copyrights blank if --more-symlinks was given, true otherwise
886 while test $# -gt 0; do
891 --import | --impor | --impo | --imp | --im | --i )
894 --update | --updat | --upda | --upd | --up | --u )
897 --create-testdir | --create-testdi | --create-testd | --create-test | --create-tes | --create-te | --create-t )
900 --create-megatestdir | --create-megatestdi | --create-megatestd | --create-megatest | --create-megates | --create-megate | --create-megat | --create-mega | --create-meg | --create-me | --create-m )
901 mode=create-megatestdir
903 --test | --tes | --te | --t )
906 --megatest | --megates | --megate | --megat | --mega | --meg | --me | --m )
910 mode=`echo "X$1" | sed -e 's/^X--//'`
912 --copy-file | --copy-fil | --copy-fi | --copy-f | --copy- | --copy | --cop | --co )
918 func_fatal_error "missing argument for --dir"
923 destdir=`echo "X$1" | sed -e 's/^X--dir=//'`
928 func_fatal_error "missing argument for --local-dir"
933 local_gnulib_dir=`echo "X$1" | sed -e 's/^X--local-dir=//'`
935 --verbose | --verbos | --verbo | --verb )
936 verbose=`expr $verbose + 1`
938 --quiet | --quie | --qui | --qu | --q )
939 verbose=`expr $verbose - 1`
941 --no-cache | --no-cach | --no-cac | --no-ca )
947 func_fatal_error "missing argument for --lib"
950 supplied_libname=true
953 libname=`echo "X$1" | sed -e 's/^X--lib=//'`
954 supplied_libname=true
959 func_fatal_error "missing argument for --source-base"
964 sourcebase=`echo "X$1" | sed -e 's/^X--source-base=//'`
969 func_fatal_error "missing argument for --m4-base"
974 m4base=`echo "X$1" | sed -e 's/^X--m4-base=//'`
979 func_fatal_error "missing argument for --po-base"
984 pobase=`echo "X$1" | sed -e 's/^X--po-base=//'`
989 func_fatal_error "missing argument for --doc-base"
994 docbase=`echo "X$1" | sed -e 's/^X--doc-base=//'`
999 func_fatal_error "missing argument for --tests-base"
1004 testsbase=`echo "X$1" | sed -e 's/^X--tests-base=//'`
1008 if test $# = 0; then
1009 func_fatal_error "missing argument for --aux-dir"
1014 auxdir=`echo "X$1" | sed -e 's/^X--aux-dir=//'`
1024 if test $# = 0; then
1025 func_fatal_error "missing argument for --avoid"
1027 func_append avoidlist " $1"
1030 arg=`echo "X$1" | sed -e 's/^X--avoid=//'`
1031 func_append avoidlist " $arg"
1037 arg=`echo "X$1" | sed -e 's/^X--lgpl=//'`
1040 *) func_fatal_error "invalid LGPL version number for --lgpl" ;;
1046 if test $# = 0; then
1047 func_fatal_error "missing argument for --makefile-name"
1052 makefile_name=`echo "X$1" | sed -e 's/^X--makefile-name=//'`
1062 if test $# = 0; then
1063 func_fatal_error "missing argument for --macro-prefix"
1068 macro_prefix=`echo "X$1" | sed -e 's/^X--macro-prefix=//'`
1072 if test $# = 0; then
1073 func_fatal_error "missing argument for --po-domain"
1078 po_domain=`echo "X$1" | sed -e 's/^X--po-domain=//'`
1086 --no-changelog | --no-changelo | --no-changel | --no-change | --no-chang | --no-chan | --no-cha | --no-ch )
1092 -s | --symbolic | --symboli | --symbol | --symbo | --symb | --symlink | --symlin | --symli | --syml | --sym | --sy )
1095 --local-symlink | --local-symlin | --local-symli | --local-syml | --local-sym | --local-sy | --local-s )
1098 -S | --more-symlinks | --more-symlink | --more-symlin | --more-symli | --more-syml | --more-sym | --more-sy | --more-s | --more- | --more | --mor | --mo )
1102 --help | --hel | --he | --h )
1105 --version | --versio | --versi | --vers )
1109 # Stop option processing
1113 echo "gnulib-tool: unknown option $1" 1>&2
1114 echo "Try 'gnulib-tool --help' for more information." 1>&2
1121 if test "$mode" = update; then
1122 if test $# != 0; then
1123 echo "gnulib-tool: too many arguments in 'update' mode" 1>&2
1124 echo "Try 'gnulib-tool --help' for more information." 1>&2
1125 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1126 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1129 if test -n "$local_gnulib_dir" || test -n "$supplied_libname" \
1130 || test -n "$sourcebase" || test -n "$m4base" || test -n "$pobase" \
1131 || test -n "$docbase" || test -n "$testsbase" || test -n "$auxdir" \
1132 || test -n "$inctests" || test -n "$incobsolete" \
1133 || test -n "$avoidlist" || test -n "$lgpl" || test -n "$makefile_name" \
1134 || test -n "$macro_prefix" || test -n "$po_domain" \
1135 || test -n "$vc_files"; then
1136 echo "gnulib-tool: invalid options for 'update' mode" 1>&2
1137 echo "Try 'gnulib-tool --help' for more information." 1>&2
1138 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1139 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1144 if test -n "$pobase" && test -z "$po_domain"; then
1145 echo "gnulib-tool: together with --po-base, you need to specify --po-domain" 1>&2
1146 echo "Try 'gnulib-tool --help' for more information." 1>&2
1149 if test -z "$pobase" && test -n "$po_domain"; then
1150 func_warning "--po-domain has no effect without a --po-base option"
1153 # Determine the minimum supported autoconf version from the project's
1155 DEFAULT_AUTOCONF_MINVERSION="2.59"
1156 autoconf_minversion=
1158 if { test "$mode" = import || test "$mode" = update; } && test -n "$destdir"; then
1159 if test -f "$destdir"/configure.ac; then
1160 configure_ac="$destdir/configure.ac"
1162 if test -f "$destdir"/configure.in; then
1163 configure_ac="$destdir/configure.in"
1167 if test -f configure.ac; then
1168 configure_ac="configure.ac"
1170 if test -f configure.in; then
1171 configure_ac="configure.in"
1175 if test -n "$configure_ac"; then
1176 # Use sed, not autoconf --trace, to look for the AC_PREREQ invocation,
1177 # because when some m4 files are omitted from a CVS repository,
1178 # "autoconf --trace=AC_PREREQ" fails with an error message like this:
1179 # m4: aclocal.m4:851: Cannot open m4/absolute-header.m4: No such file or directory
1180 # autom4te: m4 failed with exit status: 1
1187 s,^.*AC_PREREQ([[ ]*\([^])]*\).*$,\1,p
1189 prereqs=`sed -n -e "$my_sed_traces" < "$configure_ac"`
1190 if test -n "$prereqs"; then
1191 autoconf_minversion=`
1192 for version in $prereqs; do echo $version; done |
1193 LC_ALL=C sort -nru | sed -e 1q
1197 if test -z "$autoconf_minversion"; then
1198 autoconf_minversion=$DEFAULT_AUTOCONF_MINVERSION
1200 case "$autoconf_minversion" in
1201 1.* | 2.[0-4]* | 2.5[0-8]*)
1202 func_fatal_error "minimum supported autoconf version is 2.59. Try adding AC_PREREQ([$DEFAULT_AUTOCONF_MINVERSION]) to your configure.ac." ;;
1205 # Remove trailing slashes from the directory names. This is necessary for
1206 # m4base (to avoid an error in func_import) and optional for the others.
1207 sed_trimtrailingslashes='s,\([^/]\)//*$,\1,'
1208 case "$local_gnulib_dir" in
1209 */ ) local_gnulib_dir=`echo "$local_gnulib_dir" | sed -e "$sed_trimtrailingslashes"` ;;
1211 case "$sourcebase" in
1212 */ ) sourcebase=`echo "$sourcebase" | sed -e "$sed_trimtrailingslashes"` ;;
1215 */ ) m4base=`echo "$m4base" | sed -e "$sed_trimtrailingslashes"` ;;
1218 */ ) pobase=`echo "$pobase" | sed -e "$sed_trimtrailingslashes"` ;;
1221 */ ) docbase=`echo "$docbase" | sed -e "$sed_trimtrailingslashes"` ;;
1223 case "$testsbase" in
1224 */ ) testsbase=`echo "$testsbase" | sed -e "$sed_trimtrailingslashes"` ;;
1227 */ ) auxdir=`echo "$auxdir" | sed -e "$sed_trimtrailingslashes"` ;;
1233 trap 'exit_status=$?
1234 if test "$signal" != 0; then
1235 echo "caught signal $signal" >&2
1238 exit $exit_status' 0
1239 for signal in 1 2 3 13 15; do
1240 trap '{ signal='$signal'; func_exit 1; }' $signal
1244 # func_lookup_file file
1245 # looks up a file in $local_gnulib_dir or $gnulib_dir, or combines it through
1248 # - local_gnulib_dir from --local-dir
1250 # - lookedup_file name of the merged (combined) file
1251 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
1255 if test -n "$local_gnulib_dir" && test -f "$local_gnulib_dir/$lkfile"; then
1256 lookedup_file="$local_gnulib_dir/$lkfile"
1259 if test -f "$gnulib_dir/$lkfile"; then
1260 if test -n "$local_gnulib_dir" && test -f "$local_gnulib_dir/$lkfile.diff"; then
1261 lkbase=`echo "$lkfile" | sed -e 's,^.*/,,'`
1262 rm -f "$tmp/$lkbase"
1263 cp "$gnulib_dir/$lkfile" "$tmp/$lkbase"
1264 patch -s "$tmp/$lkbase" < "$local_gnulib_dir/$lkfile.diff" \
1265 || func_fatal_error "patch file $local_gnulib_dir/$lkfile.diff didn't apply cleanly"
1266 lookedup_file="$tmp/$lkbase"
1269 lookedup_file="$gnulib_dir/$lkfile"
1273 func_fatal_error "file $gnulib_dir/$lkfile not found"
1280 # - local_gnulib_dir from --local-dir
1283 # Filter out metainformation files like README, which are not modules.
1284 # Filter out unit test modules; they can be retrieved through
1285 # --extract-tests-module if desired.
1287 (cd "$gnulib_dir" && find modules -type f -print | sed -e 's,^modules/,,')
1288 if test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules"; then
1289 (cd "$local_gnulib_dir" && find modules -type f -print | sed -e 's,^modules/,,' -e 's,\.diff$,,')
1292 | sed -e '/^CVS\//d' -e '/\/CVS\//d' \
1293 -e '/^ChangeLog$/d' -e '/\/ChangeLog$/d' \
1294 -e '/^COPYING$/d' -e '/\/COPYING$/d' \
1295 -e '/^README$/d' -e '/\/README$/d' \
1296 -e '/^TEMPLATE$/d' \
1297 -e '/^TEMPLATE-EXTENDED$/d' \
1298 -e '/^TEMPLATE-TESTS$/d' \
1301 | sed -e '/-tests$/d' \
1305 # func_verify_module
1306 # verifies a module name
1308 # - local_gnulib_dir from --local-dir
1309 # - module module name argument
1310 func_verify_module ()
1312 if { test -f "$gnulib_dir/modules/$module" \
1313 || { test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules" \
1314 && test -f "$local_gnulib_dir/modules/$module"; }; } \
1315 && test "CVS" != "$module" \
1316 && test "ChangeLog" != "$module" \
1317 && test "COPYING" != "$module" \
1318 && test "README" != "$module" \
1319 && test "TEMPLATE" != "$module" \
1320 && test "TEMPLATE-EXTENDED" != "$module" \
1321 && test "TEMPLATE-TESTS" != "$module"; then
1322 # OK, $module is a correct module name.
1323 # Verify that building the module description with 'patch' succeeds.
1324 func_lookup_file "modules/$module"
1326 func_warning "module $module doesn't exist"
1331 # func_verify_nontests_module
1332 # verifies a module name, excluding tests modules
1334 # - local_gnulib_dir from --local-dir
1335 # - module module name argument
1336 func_verify_nontests_module ()
1339 *-tests ) module= ;;
1340 * ) func_verify_module ;;
1344 # func_verify_tests_module
1345 # verifies a module name, considering only tests modules
1347 # - local_gnulib_dir from --local-dir
1348 # - module module name argument
1349 func_verify_tests_module ()
1352 *-tests ) func_verify_module ;;
1357 # func_cache_var file
1359 # return the cache variable name corresponding to $file.
1362 if test -n "$BASH_VERSION"; then
1365 cachevar=c_${1//[!a-zA-Z0-9_]/_}
1372 cachevar=c_`echo "$1" | LC_ALL=C sed 's/[^a-zA-Z0-9_]/_/g'` ;;
1379 # Extract headers from module descriptions.
1380 # NOTE: Keep this in sync with sed_extract_prog below!
1381 sed_extract_cache_prog="
1382 s/^Description:[ ]*$/desc/
1383 s/^Status:[ ]*$/status/
1384 s/^Notice:[ ]*$/notice/
1385 s/^Applicability:[ ]*$/applicability/
1386 s/^Files:[ ]*$/files/
1387 s/^Depends-on:[ ]*$/deps/
1388 s/^configure\.ac-early:[ ]*$/config_early/
1389 s/^configure\.ac:[ ]*$/config/
1390 s/^Makefile\.am:[ ]*$/makefile/
1391 s/^Include:[ ]*$/include/
1393 s/^License:[ ]*$/license/
1394 s/^Maintainer:[ ]*$/maint/"
1396 # func_cache_lookup_module file
1398 # look up a module, like 'func_lookup_file modules/$file', and store all of its
1399 # relevant data in a cache. If already cached, do not look it up again.
1404 # - ${cachevar}_cached
1405 # - ${cachevar}_desc
1406 # - ${cachevar}_status
1408 func_cache_lookup_module ()
1411 if eval test -z \"\$${cachevar}_cached\"; then
1412 func_lookup_file "modules/$1"
1413 # Turn module descriptions into shell script assignments,
1414 # suitable to be eval'ed. All active characters are escaped.
1417 # Some module's description
1422 # c_MODULE_cached='yes
1425 # 'Some module'\''s description
1430 # The script consists of four parts:
1431 # 1) Insert the "c_MODULE_cached='yes" line,
1432 # 2) The 'match' loop, treating non-header lines by escaping single
1433 # quotes and adding a closing quote in the last line,
1434 # 3) The 'header' treatment, closing the last quote and inserting
1435 # the "c_MODULE_HEADER=" assignment line as well starting the
1436 # following line with an opening quote, if any.
1437 # 4) Special treatment if two headers are only separated by one newline.
1439 1i\'$nl$cachevar'_cached='\''yes\'$nl'
1443 '"$sed_extract_cache_prog"'
1452 s/\([a-zA-Z0-9_]\{1,\}\)[ ]*$/'\'\\$nl${cachevar}_'\1=/
1457 '"$sed_extract_cache_prog"'
1467 # Strip trailing newlines from quoted variable assignment strings.
1468 sed_strip_trailing_nl='
1478 s/\n\n*\('\''\)$/\1/
1480 cache_script=`sed "$sed_cache_module" < "$lookedup_file" \
1481 | sed "$sed_strip_trailing_nl"`
1482 eval "$cache_script"
1486 # Extract headers from module descriptions, without caching.
1487 # NOTE: Keep this in sync with sed_extract_cache_prog above!
1488 sed_extract_prog=':[ ]*$/ {
1491 s/^Description:[ ]*$//
1494 s/^Applicability:[ ]*$//
1496 s/^Depends-on:[ ]*$//
1497 s/^configure\.ac-early:[ ]*$//
1498 s/^configure\.ac:[ ]*$//
1499 s/^Makefile\.am:[ ]*$//
1503 s/^Maintainer:[ ]*$//
1511 # func_get_description module
1513 # - local_gnulib_dir from --local-dir
1514 func_get_description ()
1517 func_cache_lookup_module "$1"
1518 eval "echo \"\$${cachevar}_desc\""
1520 func_lookup_file "modules/$1"
1521 sed -n -e "/^Description$sed_extract_prog" < "$lookedup_file"
1525 # func_get_status module
1527 # - local_gnulib_dir from --local-dir
1531 func_cache_lookup_module "$1"
1532 eval "echo \"\$${cachevar}_status\""
1534 func_lookup_file "modules/$1"
1535 sed -n -e "/^Status$sed_extract_prog" < "$lookedup_file"
1539 # func_get_notice module
1541 # - local_gnulib_dir from --local-dir
1545 func_cache_lookup_module "$1"
1546 eval "echo \"\$${cachevar}_notice\""
1548 func_lookup_file "modules/$1"
1549 sed -n -e "/^Notice$sed_extract_prog" < "$lookedup_file"
1553 # func_get_applicability module
1555 # - local_gnulib_dir from --local-dir
1556 # The expected result (on stdout) is either 'main', or 'tests', or 'all'.
1557 func_get_applicability ()
1560 func_cache_lookup_module "$1"
1561 eval my_applicability=\$${cachevar}_applicability
1563 func_lookup_file "modules/$1"
1564 my_applicability=`sed -n -e "/^Applicability$sed_extract_prog" < "$lookedup_file"`
1566 if test -n "$my_applicability"; then
1567 echo $my_applicability
1569 # The default is 'main' or 'tests', depending on the module's name.
1571 *-tests) echo tests;;
1577 # func_get_filelist module
1579 # - local_gnulib_dir from --local-dir
1580 func_get_filelist ()
1583 func_cache_lookup_module "$1"
1584 eval "echo \"\$${cachevar}_files\""
1586 func_lookup_file "modules/$1"
1587 sed -n -e "/^Files$sed_extract_prog" < "$lookedup_file"
1590 echo m4/gnulib-common.m4
1591 case "$autoconf_minversion" in
1598 # func_filter_filelist outputvar separator filelist prefix suffix removed_prefix removed_suffix [added_prefix [added_suffix]]
1599 # stores in outputvar the filtered and processed filelist. Filtering: Only the
1600 # elements starting with prefix and ending with suffix are considered.
1601 # Processing: removed_prefix and removed_suffix are removed from each element,
1602 # added_prefix and added_suffix are added to each element.
1603 # prefix, suffix should not contain shell-special characters.
1604 # removed_prefix, removed_suffix should not contain the characters "$`\{}[]^|.
1605 # added_prefix, added_suffix should not contain the characters \|&.
1606 func_filter_filelist ()
1608 if test "$2" != "$nl" \
1609 || { $fast_func_append \
1610 && { test -z "$6" || $fast_func_remove_prefix; } \
1611 && { test -z "$7" || $fast_func_remove_suffix; }; \
1615 # Do not quote possibly-empty parameters in case patterns,
1616 # AIX and HP-UX ksh won't match them if they are empty.
1619 if test -n "$6"; then
1620 func_remove_prefix fff "$6"
1622 if test -n "$7"; then
1623 func_remove_suffix fff "$7"
1626 if test -z "$ffflist"; then
1629 func_append ffflist "$2${fff}"
1635 sed_fff_filter="s|^$6\(.*\)$7\$|$8\\1$9|"
1636 ffflist=`for fff in $3; do
1638 $4*$5) echo "$fff" ;;
1640 done | sed -e "$sed_fff_filter"`
1642 eval "$1=\"\$ffflist\""
1645 # func_get_dependencies module
1647 # - local_gnulib_dir from --local-dir
1648 func_get_dependencies ()
1650 # ${module}-tests always implicitly depends on ${module}.
1654 func_remove_suffix fgd1 '-tests'
1658 # Then the explicit dependencies listed in the module description.
1660 func_cache_lookup_module "$1"
1661 eval "echo \"\$${cachevar}_deps\""
1663 func_lookup_file "modules/$1"
1664 sed -n -e "/^Depends-on$sed_extract_prog" < "$lookedup_file"
1668 # func_get_autoconf_early_snippet module
1670 # - local_gnulib_dir from --local-dir
1671 func_get_autoconf_early_snippet ()
1674 func_cache_lookup_module "$1"
1675 eval "echo \"\$${cachevar}_config_early\""
1677 func_lookup_file "modules/$1"
1678 sed -n -e "/^configure\.ac-early$sed_extract_prog" < "$lookedup_file"
1682 # func_get_autoconf_snippet module
1684 # - local_gnulib_dir from --local-dir
1685 func_get_autoconf_snippet ()
1688 func_cache_lookup_module "$1"
1689 eval "echo \"\$${cachevar}_config\""
1691 func_lookup_file "modules/$1"
1692 sed -n -e "/^configure\.ac$sed_extract_prog" < "$lookedup_file"
1696 # func_get_automake_snippet module
1698 # - local_gnulib_dir from --local-dir
1699 func_get_automake_snippet ()
1702 func_cache_lookup_module "$1"
1703 eval "echo \"\$${cachevar}_makefile\""
1705 func_lookup_file "modules/$1"
1706 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
1710 # *-tests module live in tests/, not lib/.
1711 # Synthesize an EXTRA_DIST augmentation.
1712 all_files=`func_get_filelist $1`
1713 func_filter_filelist tests_files " " "$all_files" 'tests/' '' 'tests/' ''
1714 extra_files="$tests_files"
1715 if test -n "$extra_files"; then
1716 echo "EXTRA_DIST +=" $extra_files
1721 # Synthesize an EXTRA_DIST augmentation.
1722 sed_combine_lines='/\\$/{
1729 sed_extract_mentioned_files='s/^lib_SOURCES[ ]*+=[ ]*//p'
1731 already_mentioned_files=` \
1732 { eval 'echo "$'${cachevar}'_makefile"'; echo; } \
1733 | sed -e "$sed_combine_lines" \
1734 | sed -n -e "$sed_extract_mentioned_files" | sed -e 's/#.*//'`
1736 already_mentioned_files=` \
1737 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file" \
1738 | sed -e "$sed_combine_lines" \
1739 | sed -n -e "$sed_extract_mentioned_files" | sed -e 's/#.*//'`
1741 all_files=`func_get_filelist $1`
1742 func_filter_filelist lib_files "$nl" "$all_files" 'lib/' '' 'lib/' ''
1743 # Remove $already_mentioned_files from $lib_files.
1744 echo "$lib_files" | LC_ALL=C sort -u > "$tmp"/lib-files
1745 extra_files=`func_reset_sigpipe; \
1746 for f in $already_mentioned_files; do echo $f; done \
1747 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/lib-files`
1748 if test -n "$extra_files"; then
1749 echo "EXTRA_DIST +=" $extra_files
1752 # Synthesize also an EXTRA_lib_SOURCES augmentation.
1753 # This is necessary so that automake can generate the right list of
1755 # A possible approach would be to use autom4te --trace of the redefined
1756 # AC_LIBOBJ and AC_REPLACE_FUNCS macros when creating the Makefile.am
1757 # (use autom4te --trace, not just grep, so that AC_LIBOBJ invocations
1758 # inside autoconf's built-in macros are not missed).
1759 # But it's simpler and more robust to do it here, based on the file list.
1760 # If some .c file exists and is not used with AC_LIBOBJ - for example,
1761 # a .c file is preprocessed into another .c file for BUILT_SOURCES -,
1762 # automake will generate a useless dependency; this is harmless.
1764 relocatable-prog-wrapper) ;;
1766 func_filter_filelist extra_files "$nl" "$extra_files" '' '.c' '' ''
1767 if test -n "$extra_files"; then
1768 echo "EXTRA_lib_SOURCES +=" $extra_files
1773 # Synthesize an EXTRA_DIST augmentation also for the files in build-aux/.
1774 func_filter_filelist buildaux_files "$nl" "$all_files" 'build-aux/' '' 'build-aux/' ''
1775 if test -n "$buildaux_files"; then
1776 sed_prepend_auxdir='s,^,$(top_srcdir)/'"$auxdir"'/,'
1777 echo "EXTRA_DIST += "`echo "$buildaux_files" | sed -e "$sed_prepend_auxdir"`
1780 # Synthesize an EXTRA_DIST augmentation also for the files from top/.
1781 func_filter_filelist top_files "$nl" "$all_files" 'top/' '' 'top/' ''
1782 if test -n "$top_files"; then
1783 sed_prepend_topdir='s,^,$(top_srcdir)/,'
1784 echo "EXTRA_DIST += "`echo "$top_files" | sed -e "$sed_prepend_topdir"`
1791 # func_get_include_directive module
1793 # - local_gnulib_dir from --local-dir
1794 func_get_include_directive ()
1797 func_cache_lookup_module "$1"
1798 eval "echo \"\$${cachevar}_include\"" | \
1799 sed -e 's/^\(["<]\)/#include \1/'
1801 func_lookup_file "modules/$1"
1802 sed -n -e "/^Include$sed_extract_prog" < "$lookedup_file" | \
1803 sed -e 's/^\(["<]\)/#include \1/'
1807 # func_get_link_directive module
1809 # - local_gnulib_dir from --local-dir
1810 func_get_link_directive ()
1813 func_cache_lookup_module "$1"
1814 eval "echo \"\$${cachevar}_link\""
1816 func_lookup_file "modules/$1"
1817 sed -n -e "/^Link$sed_extract_prog" < "$lookedup_file"
1821 # func_get_license module
1823 # - local_gnulib_dir from --local-dir
1828 func_cache_lookup_module "$1"
1829 eval "echo \"\$${cachevar}_license\""
1831 func_lookup_file "modules/$1"
1832 sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
1834 # The default is GPL.
1836 } | sed -e 's,^ *$,,' | sed -e 1q
1839 # func_get_maintainer module
1841 # - local_gnulib_dir from --local-dir
1842 func_get_maintainer ()
1845 func_cache_lookup_module "$1"
1846 eval "echo \"\$${cachevar}_maint\""
1848 func_lookup_file "modules/$1"
1849 sed -n -e "/^Maintainer$sed_extract_prog" < "$lookedup_file"
1853 # func_get_tests_module module
1855 # - local_gnulib_dir from --local-dir
1856 func_get_tests_module ()
1858 # The naming convention for tests modules is hardwired: ${module}-tests.
1859 if test -f "$gnulib_dir/modules/$1"-tests \
1860 || { test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules" \
1861 && test -f "$local_gnulib_dir/modules/$1"-tests; }; then
1866 # func_acceptable module
1867 # tests whether a module is acceptable.
1869 # - avoidlist list of modules to avoid
1872 for avoid in $avoidlist; do
1873 if test "$avoid" = "$1"; then
1880 # func_modules_transitive_closure
1882 # - local_gnulib_dir from --local-dir
1883 # - modules list of specified modules
1884 # - inctests true if tests should be included, blank otherwise
1885 # - incobsolete true if obsolete modules among dependencies should be
1886 # included, blank otherwise
1887 # - avoidlist list of modules to avoid
1888 # - tmp pathname of a temporary directory
1890 # - modules list of modules, including dependencies
1891 func_modules_transitive_closure ()
1893 # In order to process every module only once (for speed), process an "input
1894 # list" of modules, producing an "output list" of modules. During each round,
1895 # more modules can be queued in the input list. Once a module on the input
1896 # list has been processed, it is added to the "handled list", so we can avoid
1897 # to process it again.
1899 inmodules="$modules"
1901 while test -n "$inmodules"; do
1902 inmodules_this_round="$inmodules"
1903 inmodules= # Accumulator, queue for next round
1904 for module in $inmodules_this_round; do
1906 if test -n "$module"; then
1907 if func_acceptable $module; then
1908 func_append outmodules " $module"
1909 deps=`func_get_dependencies $module`
1910 # Duplicate dependencies are harmless, but Jim wants a warning.
1911 duplicated_deps=`echo "$deps" | LC_ALL=C sort | LC_ALL=C uniq -d`
1912 if test -n "$duplicated_deps"; then
1913 func_warning "module $module has duplicated dependencies: "`echo $duplicated_deps`
1915 for dep in $deps; do
1916 if test -n "$incobsolete" \
1917 || { status=`func_get_status $dep`; test "$status" != obsolete; }; then
1918 func_append inmodules " $dep"
1921 if test -n "$inctests"; then
1922 testsmodule=`func_get_tests_module $module`
1923 if test -n "$testsmodule"; then
1924 func_append inmodules " $testsmodule"
1930 handledmodules=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
1931 # Remove $handledmodules from $inmodules.
1932 for m in $inmodules; do echo $m; done | LC_ALL=C sort -u > "$tmp"/queued-modules
1933 inmodules=`func_reset_sigpipe; echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
1935 modules=`for m in $outmodules; do echo $m; done | LC_ALL=C sort -u`
1936 rm -f "$tmp"/queued-modules
1939 # func_modules_add_dummy
1941 # - local_gnulib_dir from --local-dir
1942 # - modules list of modules, including dependencies
1944 # - modules list of modules, including 'dummy' if needed
1945 func_modules_add_dummy ()
1947 # Determine whether any module provides a lib_SOURCES augmentation.
1949 sed_remove_backslash_newline=':a
1956 for module in $modules; do
1957 func_verify_nontests_module
1958 if test -n "$module"; then
1959 # Extract the value of "lib_SOURCES += ...".
1960 for file in `func_get_automake_snippet "$module" | sed -e "$sed_remove_backslash_newline" | sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'`; do
1961 # Ignore .h files since they are not compiled.
1965 have_lib_SOURCES=yes
1972 # Add the dummy module, to make sure the library will be non-empty.
1973 if test -z "$have_lib_SOURCES"; then
1974 if func_acceptable "dummy"; then
1975 func_append modules " dummy"
1980 # func_modules_notice
1982 # - local_gnulib_dir from --local-dir
1983 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
1984 # - modules list of modules, including dependencies
1985 func_modules_notice ()
1987 if test $verbose -ge -1; then
1988 for module in $modules; do
1990 if test -n "$module"; then
1991 msg=`func_get_notice $module`
1992 if test -n "$msg"; then
1993 echo "Notice from module $module:"
1994 echo "$msg" | sed -e 's/^/ /'
2001 # func_modules_to_filelist
2003 # - local_gnulib_dir from --local-dir
2004 # - modules list of modules, including dependencies
2006 # - files list of files
2007 func_modules_to_filelist ()
2010 for module in $modules; do
2012 if test -n "$module"; then
2013 fs=`func_get_filelist $module`
2014 func_append files " $fs"
2017 files=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
2020 # func_execute_command command [args...]
2021 # Executes a command.
2022 # Uses also the variables
2023 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
2024 func_execute_command ()
2026 if test $verbose -ge 0; then
2030 # Commands like automake produce output to stderr even when they succeed.
2031 # Turn this output off if the command succeeds.
2032 "$@" > "$tmp"/cmdout 2>&1
2034 if test $cmdret = 0; then
2038 cat "$tmp"/cmdout 1>&2
2045 # func_dest_tmpfilename file
2046 # determines the name of a temporary file (file is relative to destdir).
2048 # - destdir target directory
2049 # - doit : if actions shall be executed, false if only to be printed
2050 # - tmp pathname of a temporary directory
2052 # - tmpfile absolute filename of the temporary file
2053 func_dest_tmpfilename ()
2056 # Put the new contents of $file in a file in the same directory (needed
2057 # to guarantee that an 'mv' to "$destdir/$file" works).
2058 tmpfile="$destdir/$1.tmp"
2060 # Put the new contents of $file in a file in a temporary directory
2061 # (because the directory of "$file" might not exist).
2062 tmpfile="$tmp"/`basename "$1"`.tmp
2067 # copies a file from gnulib into the destination directory. The destination
2068 # is known to not exist.
2070 # - destdir target directory
2071 # - local_gnulib_dir from --local-dir
2072 # - f the original file name
2073 # - lookedup_file name of the merged (combined) file
2074 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
2075 # - g the rewritten file name
2076 # - tmpfile absolute filename of the temporary file
2077 # - doit : if actions shall be executed, false if only to be printed
2078 # - symbolic true if files should be symlinked, copied otherwise
2079 # - lsymbolic true if files from local_gnulib_dir should be symlinked,
2084 echo "Copying file $g"
2085 if { test -n "$symbolic" \
2086 || { test -n "$lsymbolic" \
2087 && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; } \
2088 && test -z "$lookedup_tmp" \
2089 && cmp "$lookedup_file" "$tmpfile" > /dev/null; then
2090 func_ln_if_changed "$lookedup_file" "$destdir/$g"
2092 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error "failed"
2100 # copies a file from gnulib into the destination directory. The destination
2101 # is known to exist.
2103 # - destdir target directory
2104 # - local_gnulib_dir from --local-dir
2105 # - f the original file name
2106 # - lookedup_file name of the merged (combined) file
2107 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
2108 # - g the rewritten file name
2109 # - tmpfile absolute filename of the temporary file
2110 # - doit : if actions shall be executed, false if only to be printed
2111 # - symbolic true if files should be symlinked, copied otherwise
2112 # - lsymbolic true if files from local_gnulib_dir should be symlinked,
2114 # - already_present nonempty if the file should already exist, empty otherwise
2117 if cmp "$destdir/$g" "$tmpfile" > /dev/null; then
2118 : # The file has not changed.
2122 if test -n "$already_present"; then
2123 echo "Updating file $g (backup in ${g}~)"
2125 echo "Replacing file $g (non-gnulib code backed up in ${g}~) !!"
2127 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error "failed"
2128 if { test -n "$symbolic" \
2129 || { test -n "$lsymbolic" \
2130 && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; } \
2131 && test -z "$lookedup_tmp" \
2132 && cmp "$lookedup_file" "$tmpfile" > /dev/null; then
2133 func_ln_if_changed "$lookedup_file" "$destdir/$g"
2135 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error "failed"
2138 if test -n "$already_present"; then
2139 echo "Update file $g (backup in ${g}~)"
2141 echo "Replace file $g (non-gnulib code backed up in ${g}~) !!"
2147 # func_emit_lib_Makefile_am
2148 # emits the contents of library makefile to standard output.
2150 # - local_gnulib_dir from --local-dir
2151 # - modules list of modules, including dependencies
2152 # - libname library name
2153 # - pobase directory relative to destdir where to place *.po files
2154 # - auxdir directory relative to destdir where to place build aux files
2155 # - makefile_name from --makefile-name
2156 # - libtool true if libtool will be used, false or blank otherwise
2157 # - macro_prefix prefix of gl_LIBOBJS macros to use
2158 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
2159 # - actioncmd (optional) command that will reproduce this invocation
2160 # - for_test true if creating a package for testing, false otherwise
2161 # - destfile filename relative to destdir of makefile being generated
2163 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val}
2164 # list of edits to be done to Makefile.am variables
2166 # - uses_subdirs nonempty if object files in subdirs exist
2167 func_emit_lib_Makefile_am ()
2169 # When creating an includable Makefile.am snippet, augment variables with
2170 # += instead of assigning them.
2171 if test -n "$makefile_name"; then
2176 if test "$libtool" = true; then
2179 sed_eliminate_LDFLAGS="$sed_noop"
2183 sed_eliminate_LDFLAGS='/^lib_LDFLAGS[ ]*+=/d'
2186 # When creating a package for testing: Attempt to provoke failures,
2187 # especially link errors, already during "make" rather than during
2188 # "make check", because "make check" is not possible in a cross-compiling
2189 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
2190 sed_transform_check_PROGRAMS='s,check_PROGRAMS,noinst_PROGRAMS,g'
2192 sed_transform_check_PROGRAMS="$sed_noop"
2194 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
2195 echo "## Process this file with automake to produce Makefile.in."
2196 func_emit_copyright_notice
2197 if test -n "$actioncmd"; then
2198 # The maximum line length (excluding the terminating newline) of any file
2199 # that is to be preprocessed by config.status is 3070. config.status uses
2200 # awk, and the HP-UX 11.00 awk fails if a line has length >= 3071;
2201 # similarly, the IRIX 6.5 awk fails if a line has length >= 3072.
2202 len=`echo "$actioncmd" | wc -c`
2203 if test -n "$len" && test "$len" -le 3000; then
2204 echo "# Reproduce by: $actioncmd"
2210 for module in $modules; do
2211 func_verify_nontests_module
2212 if test -n "$module"; then
2214 func_get_automake_snippet "$module" |
2215 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
2216 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
2217 -e "$sed_eliminate_LDFLAGS" \
2218 -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' \
2219 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
2220 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
2221 -e "$sed_transform_check_PROGRAMS"
2222 if test "$module" = 'alloca'; then
2223 echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
2224 echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@"
2226 } > "$tmp"/amsnippet
2227 # Skip the contents if it's entirely empty.
2228 if grep '[^ ]' "$tmp"/amsnippet > /dev/null ; then
2229 echo "## begin gnulib module $module"
2231 cat "$tmp"/amsnippet
2232 echo "## end gnulib module $module"
2235 rm -f "$tmp"/amsnippet
2236 # Test whether there are some source files in subdirectories.
2237 for f in `func_get_filelist "$module"`; do
2247 } > "$tmp"/allsnippets
2248 if test -z "$makefile_name"; then
2249 # If there are source files in subdirectories, prevent collision of the
2250 # object files (example: hash.c and libxml/hash.c).
2252 if test -n "$uses_subdirs"; then
2253 subdir_options=' subdir-objects'
2255 echo "AUTOMAKE_OPTIONS = 1.5 gnits${subdir_options}"
2258 if test -z "$makefile_name"; then
2260 echo "noinst_HEADERS ="
2261 echo "noinst_LIBRARIES ="
2262 echo "noinst_LTLIBRARIES ="
2263 # Automake versions < 1.9b create an empty pkgdatadir at installation time
2264 # if you specify pkgdata_DATA to empty. This is a workaround.
2265 if grep '^pkgdata_DATA *+=' "$tmp"/allsnippets > /dev/null; then
2266 echo "pkgdata_DATA ="
2269 echo "BUILT_SOURCES ="
2272 echo "MOSTLYCLEANFILES $assign core *.stackdump"
2273 if test -z "$makefile_name"; then
2274 echo "MOSTLYCLEANDIRS ="
2276 echo "DISTCLEANFILES ="
2277 echo "MAINTAINERCLEANFILES ="
2279 # Execute edits that apply to the Makefile.am being generated.
2281 while test $edit != $makefile_am_edits; do
2282 edit=`expr $edit + 1`
2283 eval dir=\"\$makefile_am_edit${edit}_dir\"
2284 eval var=\"\$makefile_am_edit${edit}_var\"
2285 eval val=\"\$makefile_am_edit${edit}_val\"
2286 if test -n "$var"; then
2287 if test "${dir}Makefile.am" = "$destfile" || test "./${dir}Makefile.am" = "$destfile"; then
2288 echo "${var} += ${val}"
2289 eval "makefile_am_edit${edit}_var="
2293 if test -z "$makefile_name"; then
2295 echo "AM_CPPFLAGS ="
2299 if LC_ALL=C grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$tmp"/allsnippets > /dev/null \
2300 || { test -n "$makefile_name" \
2301 && test -f "$sourcebase/Makefile.am" \
2302 && LC_ALL=C grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$sourcebase/Makefile.am" > /dev/null; \
2304 # One of the snippets or the user's Makefile.am already specifies an
2305 # installation location for the library. Don't confuse automake by saying
2306 # it should not be installed.
2309 # By default, the generated library should not be installed.
2310 echo "noinst_${perhapsLT}LIBRARIES += $libname.$libext"
2313 echo "${libname}_${libext}_SOURCES ="
2314 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
2315 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
2316 echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
2317 echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
2318 echo "EXTRA_${libname}_${libext}_SOURCES ="
2319 if test "$libtool" = true; then
2320 echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)"
2323 if test -n "$pobase"; then
2324 echo "AM_CPPFLAGS += -DDEFAULT_TEXT_DOMAIN=\\\"${po_domain}-gnulib\\\""
2327 cat "$tmp"/allsnippets \
2328 | sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
2330 echo "mostlyclean-local: mostlyclean-generic"
2331 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
2332 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
2333 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
2337 rm -f "$tmp"/allsnippets
2340 # func_emit_po_Makevars
2341 # emits the contents of po/ makefile parameterization to standard output.
2343 # - local_gnulib_dir from --local-dir
2344 # - sourcebase directory relative to destdir where to place source code
2345 # - pobase directory relative to destdir where to place *.po files
2346 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
2347 func_emit_po_Makevars ()
2349 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
2350 func_emit_copyright_notice
2352 echo "# Usually the message domain is the same as the package name."
2353 echo "# But here it has a '-gnulib' suffix."
2354 echo "DOMAIN = ${po_domain}-gnulib"
2356 echo "# These two variables depend on the location of this directory."
2357 echo "subdir = ${pobase}"
2358 echo "top_builddir = "`echo "$pobase" | sed -e 's,//*,/,g' -e 's,[^/][^/]*,..,g'`
2361 # These options get passed to xgettext.
2362 XGETTEXT_OPTIONS = \
2363 --keyword=_ --flag=_:1:pass-c-format \
2364 --keyword=N_ --flag=N_:1:pass-c-format \
2365 --keyword='proper_name:1,"This is a proper name. See the gettext manual, section Names."' \
2366 --keyword='proper_name_utf8:1,"This is a proper name. See the gettext manual, section Names."' \
2367 --flag=error:3:c-format --flag=error_at_line:5:c-format
2369 # This is the copyright holder that gets inserted into the header of the
2370 # $(DOMAIN).pot file. gnulib is copyrighted by the FSF.
2371 COPYRIGHT_HOLDER = Free Software Foundation, Inc.
2373 # This is the email address or URL to which the translators shall report
2374 # bugs in the untranslated strings:
2375 # - Strings which are not entire sentences, see the maintainer guidelines
2376 # in the GNU gettext documentation, section 'Preparing Strings'.
2377 # - Strings which use unclear terms or require additional context to be
2379 # - Strings which make invalid assumptions about notation of date, time or
2381 # - Pluralisation problems.
2382 # - Incorrect English spelling.
2383 # - Incorrect formatting.
2384 # It can be your email address, or a mailing list address where translators
2385 # can write to without being subscribed, or the URL of a web page through
2386 # which the translators can contact you.
2387 MSGID_BUGS_ADDRESS = bug-gnulib@gnu.org
2389 # This is the list of locale categories, beyond LC_MESSAGES, for which the
2390 # message catalogs shall be used. It is usually empty.
2391 EXTRA_LOCALE_CATEGORIES =
2393 # This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
2394 # context. Possible values are "yes" and "no". Set this to yes if the
2395 # package uses functions taking also a message context, like pgettext(), or
2396 # if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
2401 # func_emit_po_POTFILES_in
2402 # emits the file list to be passed to xgettext to standard output.
2404 # - local_gnulib_dir from --local-dir
2405 # - sourcebase directory relative to destdir where to place source code
2406 # - files list of new files
2407 func_emit_po_POTFILES_in ()
2409 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
2410 func_emit_copyright_notice
2412 echo "# List of files which contain translatable strings."
2413 echo "$files" | sed -n -e "s,^lib/,$sourcebase/,p"
2416 # func_emit_tests_Makefile_am
2417 # emits the contents of tests makefile to standard output.
2419 # - local_gnulib_dir from --local-dir
2420 # - modules list of modules, including dependencies
2421 # - libname library name
2422 # - auxdir directory relative to destdir where to place build aux files
2423 # - makefile_name from --makefile-name
2424 # - libtool true if libtool will be used, false or blank otherwise
2425 # - sourcebase relative directory containing lib source code
2426 # - m4base relative directory containing autoconf macros
2427 # - testsbase relative directory containing unit test code
2428 # - macro_prefix prefix of gl_LIBOBJS macros to use
2429 # - for_test true if creating a package for testing, false otherwise
2430 # - use_libtests true if a libtests.a should be built, false otherwise
2431 # - destfile filename relative to destdir of makefile being generated
2433 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val}
2434 # list of edits to be done to Makefile.am variables
2436 # - uses_subdirs nonempty if object files in subdirs exist
2437 func_emit_tests_Makefile_am ()
2439 if test "$libtool" = true; then
2441 sed_eliminate_LDFLAGS="$sed_noop"
2444 sed_eliminate_LDFLAGS='/^lib_LDFLAGS[ ]*+=/d'
2447 # When creating a package for testing: Attempt to provoke failures,
2448 # especially link errors, already during "make" rather than during
2449 # "make check", because "make check" is not possible in a cross-compiling
2450 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
2451 sed_transform_check_PROGRAMS='s,check_PROGRAMS,noinst_PROGRAMS,g'
2453 sed_transform_check_PROGRAMS="$sed_noop"
2455 testsbase_inverse=`echo "$testsbase" | sed -e 's,/$,,' | sed -e 's,[^/][^/]*,..,g'`
2456 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
2457 echo "## Process this file with automake to produce Makefile.in."
2458 func_emit_copyright_notice
2462 for module in $modules; do
2464 func_verify_tests_module
2468 if test -n "$module"; then
2470 func_get_automake_snippet "$module" |
2471 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
2472 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
2473 -e "$sed_eliminate_LDFLAGS" \
2474 -e 's,lib_\([A-Z][A-Z]*\),libtests_a_\1,g' \
2475 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
2476 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
2477 -e "$sed_transform_check_PROGRAMS"
2478 if $use_libtests && test "$module" = 'alloca'; then
2479 echo "libtests_a_LIBADD += @${perhapsLT}ALLOCA@"
2480 echo "libtests_a_DEPENDENCIES += @${perhapsLT}ALLOCA@"
2482 } > "$tmp"/amsnippet
2483 # Skip the contents if it's entirely empty.
2484 if grep '[^ ]' "$tmp"/amsnippet > /dev/null ; then
2485 echo "## begin gnulib module $module"
2487 cat "$tmp"/amsnippet
2488 echo "## end gnulib module $module"
2491 rm -f "$tmp"/amsnippet
2492 # Test whether there are some source files in subdirectories.
2493 for f in `func_get_filelist "$module"`; do
2495 lib/*/*.c | tests/*/*.c)
2503 } > "$tmp"/allsnippets
2504 # Generate dependencies here, since it eases the debugging of test failures.
2505 # If there are source files in subdirectories, prevent collision of the
2506 # object files (example: hash.c and libxml/hash.c).
2508 if test -n "$uses_subdirs"; then
2509 subdir_options=' subdir-objects'
2511 echo "AUTOMAKE_OPTIONS = 1.5 foreign${subdir_options}"
2514 echo "ACLOCAL_AMFLAGS = -I ${testsbase_inverse}/${m4base}"
2517 # Nothing is being added to SUBDIRS; nevertheless the existence of this
2518 # variable is needed to avoid an error from automake:
2519 # "AM_GNU_GETTEXT used but SUBDIRS not defined"
2522 echo "XFAIL_TESTS ="
2523 echo "TESTS_ENVIRONMENT ="
2524 echo "noinst_PROGRAMS ="
2525 if ! $for_test; then
2526 echo "check_PROGRAMS ="
2528 echo "noinst_HEADERS ="
2529 echo "noinst_LIBRARIES ="
2530 if $use_libtests; then
2532 echo "noinst_LIBRARIES += libtests.a"
2534 echo "check_LIBRARIES = libtests.a"
2537 # Automake versions < 1.9b create an empty pkgdatadir at installation time
2538 # if you specify pkgdata_DATA to empty. This is a workaround.
2539 if grep '^pkgdata_DATA *+=' "$tmp"/allsnippets > /dev/null; then
2540 echo "pkgdata_DATA ="
2543 echo "BUILT_SOURCES ="
2545 echo "MOSTLYCLEANFILES = core *.stackdump"
2546 echo "MOSTLYCLEANDIRS ="
2548 echo "DISTCLEANFILES ="
2549 echo "MAINTAINERCLEANFILES ="
2550 # Execute edits that apply to the Makefile.am being generated.
2552 while test $edit != $makefile_am_edits; do
2553 edit=`expr $edit + 1`
2554 eval dir=\"\$makefile_am_edit${edit}_dir\"
2555 eval var=\"\$makefile_am_edit${edit}_var\"
2556 eval val=\"\$makefile_am_edit${edit}_val\"
2557 if test -n "$var"; then
2558 if test "${dir}Makefile.am" = "$destfile" || test "./${dir}Makefile.am" = "$destfile"; then
2559 echo "${var} += ${val}"
2560 eval "makefile_am_edit${edit}_var="
2565 echo "AM_CPPFLAGS = \\"
2566 echo " -I. -I\$(srcdir) \\"
2567 echo " -I${testsbase_inverse} -I\$(srcdir)/${testsbase_inverse} \\"
2568 echo " -I${testsbase_inverse}/${sourcebase-lib} -I\$(srcdir)/${testsbase_inverse}/${sourcebase-lib}"
2570 local_ldadd_before=''
2571 local_ldadd_after=''
2572 if $use_libtests; then
2573 # All test programs need to be linked with libtests.a.
2574 # It needs to be passed to the linker before ${libname}.${libext}, since
2575 # the tests-related modules depend on the main modules.
2576 # It also needs to be passed to the linker after ${libname}.${libext}
2577 # because the latter might contain incomplete modules (such as the 'error'
2578 # module whose dependency to 'progname' is voluntarily omitted).
2579 # The LIBTESTS_LIBDEPS can be passed to the linker once or twice, it does
2581 local_ldadd_before=' libtests.a'
2582 local_ldadd_after=' libtests.a $(LIBTESTS_LIBDEPS)'
2584 echo "LDADD =${local_ldadd_before} ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext}${local_ldadd_after}"
2586 if $use_libtests; then
2587 echo "libtests_a_SOURCES ="
2588 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
2589 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
2590 echo "libtests_a_LIBADD = \$(${macro_prefix}tests_LIBOBJS)"
2591 echo "libtests_a_DEPENDENCIES = \$(${macro_prefix}tests_LIBOBJS)"
2592 echo "EXTRA_libtests_a_SOURCES ="
2593 # The circular dependency in LDADD requires this.
2594 echo "AM_LIBTOOLFLAGS = --preserve-dup-deps"
2597 # Many test scripts use ${EXEEXT} or ${srcdir}.
2598 # EXEEXT is defined by AC_PROG_CC through autoconf.
2599 # srcdir is defined by autoconf and automake.
2600 echo "TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='\$(srcdir)'"
2602 cat "$tmp"/allsnippets \
2603 | sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
2604 echo "# Clean up after Solaris cc."
2606 echo " rm -rf SunWS_cache"
2608 echo "mostlyclean-local: mostlyclean-generic"
2609 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
2610 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
2611 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
2615 rm -f "$tmp"/allsnippets
2618 # func_emit_initmacro_start macro_prefix
2619 # emits the first few statements of the gl_INIT macro to standard output.
2620 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
2621 func_emit_initmacro_start ()
2623 macro_prefix_arg="$1"
2624 # Overriding AC_LIBOBJ and AC_REPLACE_FUNCS has the effect of storing
2625 # platform-dependent object files in ${macro_prefix_arg}_LIBOBJS instead of
2626 # LIBOBJS. The purpose is to allow several gnulib instantiations under
2627 # a single configure.ac file. (AC_CONFIG_LIBOBJ_DIR does not allow this
2629 # Furthermore it avoids an automake error like this when a Makefile.am
2630 # that uses pieces of gnulib also uses $(LIBOBJ):
2631 # automatically discovered file `error.c' should not be explicitly mentioned
2632 echo " m4_pushdef([AC_LIBOBJ], m4_defn([${macro_prefix_arg}_LIBOBJ]))"
2633 echo " m4_pushdef([AC_REPLACE_FUNCS], m4_defn([${macro_prefix_arg}_REPLACE_FUNCS]))"
2634 # Overriding AC_LIBSOURCES has the same purpose of avoiding the automake
2635 # error when a Makefile.am that uses pieces of gnulib also uses $(LIBOBJ):
2636 # automatically discovered file `error.c' should not be explicitly mentioned
2637 # We let automake know about the files to be distributed through the
2638 # EXTRA_lib_SOURCES variable.
2639 echo " m4_pushdef([AC_LIBSOURCES], m4_defn([${macro_prefix_arg}_LIBSOURCES]))"
2640 # Create data variables for checking the presence of files that are mentioned
2641 # as AC_LIBSOURCES arguments. These are m4 variables, not shell variables,
2642 # because we want the check to happen when the configure file is created,
2643 # not when it is run. ${macro_prefix_arg}_LIBSOURCES_LIST is the list of
2644 # files to check for. ${macro_prefix_arg}_LIBSOURCES_DIR is the subdirectory
2645 # in which to expect them.
2646 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_LIST], [])"
2647 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_DIR], [])"
2651 # func_emit_initmacro_end macro_prefix
2652 # emits the last few statements of the gl_INIT macro to standard output.
2653 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
2654 func_emit_initmacro_end ()
2656 macro_prefix_arg="$1"
2657 # Check the presence of files that are mentioned as AC_LIBSOURCES arguments.
2658 # The check is performed only when autoconf is run from the directory where
2659 # the configure.ac resides; if it is run from a different directory, the
2661 echo " m4_ifval(${macro_prefix_arg}_LIBSOURCES_LIST, ["
2662 echo " m4_syscmd([test ! -d ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[ ||"
2663 echo " for gl_file in ]${macro_prefix_arg}_LIBSOURCES_LIST[ ; do"
2664 echo " if test ! -r ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file ; then"
2665 echo " echo \"missing file ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file\" >&2"
2669 echo " m4_if(m4_sysval, [0], [],"
2670 echo " [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])"
2672 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_DIR])"
2673 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_LIST])"
2674 echo " m4_popdef([AC_LIBSOURCES])"
2675 echo " m4_popdef([AC_REPLACE_FUNCS])"
2676 echo " m4_popdef([AC_LIBOBJ])"
2677 echo " AC_CONFIG_COMMANDS_PRE(["
2678 echo " ${macro_prefix_arg}_libobjs="
2679 echo " ${macro_prefix_arg}_ltlibobjs="
2680 echo " if test -n \"\$${macro_prefix_arg}_LIBOBJS\"; then"
2681 echo " # Remove the extension."
2682 echo " sed_drop_objext='s/\\.o\$//;s/\\.obj\$//'"
2683 echo " for i in \`for i in \$${macro_prefix_arg}_LIBOBJS; do echo \"\$i\"; done | sed -e \"\$sed_drop_objext\" | sort | uniq\`; do"
2684 echo " ${macro_prefix_arg}_libobjs=\"\$${macro_prefix_arg}_libobjs \$i.\$ac_objext\""
2685 echo " ${macro_prefix_arg}_ltlibobjs=\"\$${macro_prefix_arg}_ltlibobjs \$i.lo\""
2688 echo " AC_SUBST([${macro_prefix_arg}_LIBOBJS], [\$${macro_prefix_arg}_libobjs])"
2689 echo " AC_SUBST([${macro_prefix_arg}_LTLIBOBJS], [\$${macro_prefix_arg}_ltlibobjs])"
2693 # func_emit_initmacro_done macro_prefix sourcebase
2694 # emits a few statements after the gl_INIT macro to standard output.
2695 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
2696 # - sourcebase directory relative to destdir where to place source code
2697 func_emit_initmacro_done ()
2699 macro_prefix_arg="$1"
2702 echo "# Like AC_LIBOBJ, except that the module name goes"
2703 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
2704 echo "AC_DEFUN([${macro_prefix_arg}_LIBOBJ], ["
2705 echo " AS_LITERAL_IF([\$1], [${macro_prefix_arg}_LIBSOURCES([\$1.c])])dnl"
2706 echo " ${macro_prefix_arg}_LIBOBJS=\"\$${macro_prefix_arg}_LIBOBJS \$1.\$ac_objext\""
2709 echo "# Like AC_REPLACE_FUNCS, except that the module name goes"
2710 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
2711 echo "AC_DEFUN([${macro_prefix_arg}_REPLACE_FUNCS], ["
2712 echo " m4_foreach_w([gl_NAME], [\$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl"
2713 echo " AC_CHECK_FUNCS([\$1], , [${macro_prefix_arg}_LIBOBJ(\$ac_func)])"
2716 echo "# Like AC_LIBSOURCES, except the directory where the source file is"
2717 echo "# expected is derived from the gnulib-tool parameterization,"
2718 echo "# and alloca is special cased (for the alloca-opt module)."
2719 echo "# We could also entirely rely on EXTRA_lib..._SOURCES."
2720 echo "AC_DEFUN([${macro_prefix_arg}_LIBSOURCES], ["
2721 echo " m4_foreach([_gl_NAME], [\$1], ["
2722 echo " m4_if(_gl_NAME, [alloca.c], [], ["
2723 echo " m4_define([${macro_prefix_arg}_LIBSOURCES_DIR], [$sourcebase_arg])"
2724 echo " m4_append([${macro_prefix_arg}_LIBSOURCES_LIST], _gl_NAME, [ ])"
2730 # func_import modules
2731 # Uses also the variables
2732 # - destdir target directory
2733 # - local_gnulib_dir from --local-dir
2734 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
2735 # - libname library name
2736 # - sourcebase directory relative to destdir where to place source code
2737 # - m4base directory relative to destdir where to place *.m4 macros
2738 # - pobase directory relative to destdir where to place *.po files
2739 # - docbase directory relative to destdir where to place doc files
2740 # - testsbase directory relative to destdir where to place unit test code
2741 # - auxdir directory relative to destdir where to place build aux files
2742 # - inctests true if --with-tests was given, blank otherwise
2743 # - incobsolete true if --with-obsolete was given, blank otherwise
2744 # - avoidlist list of modules to avoid, from --avoid
2745 # - lgpl yes or a number if library's license shall be LGPL,
2747 # - makefile_name from --makefile-name
2748 # - libtool true if --libtool was given, false if --no-libtool was
2749 # given, blank otherwise
2750 # - guessed_libtool true if the configure.ac file uses libtool, false otherwise
2751 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
2752 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
2753 # - vc_files true if --vc-files was given, false if --no-vc-files was
2754 # given, blank otherwise
2755 # - autoconf_minversion minimum supported autoconf version
2756 # - doit : if actions shall be executed, false if only to be printed
2757 # - symbolic true if files should be symlinked, copied otherwise
2758 # - lsymbolic true if files from local_gnulib_dir should be symlinked,
2760 # - do_copyrights true if copyright notices in files should be replaced,
2764 # Get the cached settings.
2765 cached_local_gnulib_dir=
2766 cached_specified_modules=
2777 cached_makefile_name=
2779 cached_macro_prefix=
2783 if test -f "$destdir"/$m4base/gnulib-cache.m4; then
2784 cached_libtool=false
2790 s,^.*gl_LOCAL_DIR([[ ]*\([^]"$`\\)]*\).*$,cached_local_gnulib_dir="\1",p
2800 s,^.*gl_MODULES([[ ]*\([^]"$`\\)]*\).*$,cached_specified_modules="\1",p
2802 /gl_WITH_OBSOLETE/ {
2803 s,^.*$,cached_incobsolete=true,p
2806 s,^.*gl_AVOID([[ ]*\([^]"$`\\)]*\).*$,cached_avoidlist="\1",p
2809 s,^.*gl_SOURCE_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_sourcebase="\1",p
2812 s,^.*gl_M4_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_m4base="\1",p
2815 s,^.*gl_PO_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_pobase="\1",p
2818 s,^.*gl_DOC_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_docbase="\1",p
2821 s,^.*gl_TESTS_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_testsbase="\1",p
2824 s,^.*$,cached_inctests=true,p
2827 s,^.*gl_LIB([[ ]*\([^]"$`\\)]*\).*$,cached_libname="\1",p
2830 s,^.*gl_LGPL([[ ]*\([^]"$`\\)]*\).*$,cached_lgpl="\1",p
2833 s,^.*$,cached_lgpl=yes,p
2835 /gl_MAKEFILE_NAME(/ {
2836 s,^.*gl_MAKEFILE_NAME([[ ]*\([^]"$`\\)]*\).*$,cached_makefile_name="\1",p
2839 s,^.*$,cached_libtool=true,p
2841 /gl_MACRO_PREFIX(/ {
2842 s,^.*gl_MACRO_PREFIX([[ ]*\([^]"$`\\)]*\).*$,cached_macro_prefix="\1",p
2845 s,^.*gl_PO_DOMAIN([[ ]*\([^]"$`\\)]*\).*$,cached_po_domain="\1",p
2848 s,^.*gl_VC_FILES([[ ]*\([^]"$`\\)]*\).*$,cached_vc_files="\1",p
2850 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-cache.m4`
2851 if test -f "$destdir"/$m4base/gnulib-comp.m4; then
2856 /AC_DEFUN(\['"${cached_macro_prefix}"'_FILE_LIST\], \[/ {
2857 s,^.*$,cached_files=",p
2870 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-comp.m4`
2874 # Merge the cached settings with the specified ones.
2875 # The m4base must be the same as expected from the pathname.
2876 if test -n "$cached_m4base" && test "$cached_m4base" != "$m4base"; then
2877 func_fatal_error "$m4base/gnulib-cache.m4 is expected to contain gl_M4_BASE([$m4base])"
2879 # The local_gnulib_dir defaults to the cached one. Recall that the cached one
2880 # is relative to $destdir, whereas the one we use is relative to . or absolute.
2881 if test -z "$local_gnulib_dir"; then
2882 if test -n "$cached_local_gnulib_dir"; then
2885 local_gnulib_dir="$destdir/$cached_local_gnulib_dir" ;;
2887 case "$cached_local_gnulib_dir" in
2889 local_gnulib_dir="$destdir/$cached_local_gnulib_dir" ;;
2891 func_relconcat "$destdir" "$cached_local_gnulib_dir"
2892 local_gnulib_dir="$relconcat" ;;
2897 # Append the cached and the specified module names. So that
2898 # "gnulib-tool --import foo" means to add the module foo.
2899 specified_modules="$cached_specified_modules $1"
2900 # Included obsolete modules among the dependencies if specified either way.
2901 if test -z "$incobsolete"; then
2902 incobsolete="$cached_incobsolete"
2904 # Append the cached and the specified avoidlist. This is probably better
2905 # than dropping the cached one when --avoid is specified at least once.
2906 avoidlist=`for m in $cached_avoidlist $avoidlist; do echo $m; done | LC_ALL=C sort -u`
2907 avoidlist=`echo $avoidlist`
2909 # The sourcebase defaults to the cached one.
2910 if test -z "$sourcebase"; then
2911 sourcebase="$cached_sourcebase"
2912 if test -z "$sourcebase"; then
2913 func_fatal_error "missing --source-base option"
2916 # The pobase defaults to the cached one.
2917 if test -z "$pobase"; then
2918 pobase="$cached_pobase"
2920 # The docbase defaults to the cached one.
2921 if test -z "$docbase"; then
2922 docbase="$cached_docbase"
2923 if test -z "$docbase"; then
2924 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."
2927 # The testsbase defaults to the cached one.
2928 if test -z "$testsbase"; then
2929 testsbase="$cached_testsbase"
2930 if test -z "$testsbase"; then
2931 func_fatal_error "missing --tests-base option"
2934 # Require the tests if specified either way.
2935 if test -z "$inctests"; then
2936 inctests="$cached_inctests"
2938 # The libname defaults to the cached one.
2939 if test -z "$supplied_libname"; then
2940 libname="$cached_libname"
2941 if test -z "$libname"; then
2942 func_fatal_error "missing --lib option"
2945 # Require LGPL if specified either way.
2946 if test -z "$lgpl"; then
2949 # The makefile_name defaults to the cached one.
2950 if test -z "$makefile_name"; then
2951 makefile_name="$cached_makefile_name"
2953 # Use libtool if specified either way, or if guessed.
2954 if test -z "$libtool"; then
2955 if test -n "$cached_m4base"; then
2956 libtool="$cached_libtool"
2958 libtool="$guessed_libtool"
2961 # The macro_prefix defaults to the cached one.
2962 if test -z "$macro_prefix"; then
2963 macro_prefix="$cached_macro_prefix"
2964 if test -z "$macro_prefix"; then
2965 func_fatal_error "missing --macro-prefix option"
2968 # The po_domain defaults to the cached one.
2969 if test -z "$po_domain"; then
2970 po_domain="$cached_po_domain"
2972 # The vc_files defaults to the cached one.
2973 if test -z "$vc_files"; then
2974 vc_files="$cached_vc_files"
2977 # Canonicalize the list of specified modules.
2978 specified_modules=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
2980 # Determine final module list.
2981 modules="$specified_modules"
2982 func_modules_transitive_closure
2983 if test $verbose -ge 0; then
2984 echo "Module list with included dependencies:"
2985 echo "$modules" | sed -e 's/^/ /'
2987 final_modules="$modules"
2989 # Determine main module list and tests-related module list separately.
2990 # The main module list is the transitive closure of the specified modules,
2991 # ignoring tests modules. Its lib/* sources go into $sourcebase/. If --lgpl
2992 # is specified, it will consist only of LGPLed source.
2993 # The tests-related module list is the transitive closure of the specified
2994 # modules, including tests modules, minus the main module list excluding
2995 # modules of applicability 'all'. Its lib/* sources (brought in through
2996 # dependencies of *-tests modules) go into $testsbase/. It may contain GPLed
2997 # source, even if --lgpl is specified.
2998 # Determine main module list.
2999 saved_inctests="$inctests"
3001 modules="$specified_modules"
3002 func_modules_transitive_closure
3003 main_modules="$modules"
3004 inctests="$saved_inctests"
3005 if test $verbose -ge 1; then
3006 echo "Main module list:"
3007 echo "$main_modules" | sed -e 's/^/ /'
3009 # Determine tests-related module list.
3010 echo "$final_modules" | LC_ALL=C sort -u > "$tmp"/final-modules
3011 testsrelated_modules=`func_reset_sigpipe
3012 for module in $main_modules; do
3013 if test \`func_get_applicability $module\` = main; then
3017 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/final-modules`
3018 if test $verbose -ge 1; then
3019 echo "Tests-related module list:"
3020 echo "$testsrelated_modules" | sed -e 's/^/ /'
3023 # Add the dummy module to the main module list if needed.
3024 modules="$main_modules"
3025 func_modules_add_dummy
3026 main_modules="$modules"
3028 # Determine whether a $testsbase/libtests.a is needed.
3030 for module in $testsrelated_modules; do
3031 func_verify_nontests_module
3032 if test -n "$module"; then
3033 all_files=`func_get_filelist $module`
3034 # Test whether some file in $all_files lies in lib/.
3035 for f in $all_files; do
3046 # Add the dummy module to the tests-related module list if needed.
3047 if $use_libtests; then
3048 modules="$testsrelated_modules"
3049 func_modules_add_dummy
3050 testsrelated_modules="$modules"
3053 # If --lgpl, verify that the licenses of modules are compatible.
3054 if test -n "$lgpl"; then
3055 license_incompatibilities=
3056 for module in $main_modules; do
3057 license=`func_get_license $module`
3059 'GPLed build tool') ;;
3060 'public domain' | 'unlimited' | 'unmodifiable license text') ;;
3065 LGPL | LGPLv2+ | LGPLv3+) ;;
3066 *) func_append license_incompatibilities "$module $license$nl" ;;
3072 *) func_append license_incompatibilities "$module $license$nl" ;;
3075 *) func_fatal_error "invalid value lgpl=$lgpl" ;;
3080 if test -n "$license_incompatibilities"; then
3081 # Format the license incompatibilities as a table.
3082 sed_expand_column1_width50_indent17='s,^\([^ ]*\) ,\1 ,
3083 s,^\(.................................................[^ ]*\) *, \1 ,'
3084 license_incompatibilities=`echo "$license_incompatibilities" | sed -e "$sed_expand_column1_width50_indent17"`
3085 func_fatal_error "incompatible license on modules:$nl$license_incompatibilities"
3089 # Show banner notice of every module.
3090 modules="$main_modules"
3093 # Determine script to apply to imported library files.
3094 sed_transform_lib_file=
3095 for module in $main_modules; do
3096 if test $module = config-h; then
3097 # Assume config.h exists, and that -DHAVE_CONFIG_H is omitted.
3098 sed_transform_lib_file=$sed_transform_lib_file'
3099 s/^#ifdef[ ]*HAVE_CONFIG_H[ ]*$/#if 1/
3104 sed_transform_main_lib_file="$sed_transform_lib_file"
3105 if test -n "$do_copyrights"; then
3106 if test -n "$lgpl"; then
3110 sed_transform_main_lib_file=$sed_transform_main_lib_file'
3111 s/GNU General/GNU Lesser General/g
3115 sed_transform_main_lib_file=$sed_transform_main_lib_file'
3116 s/GNU General/GNU Lesser General/g
3117 s/version [23]\([ ,]\)/version 2.1\1/g
3120 *) func_fatal_error "invalid value lgpl=$lgpl" ;;
3124 sed_transform_main_lib_file=$sed_transform_main_lib_file'
3125 s/GNU Lesser General/GNU General/g
3126 s/GNU Library General/GNU General/g
3127 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
3132 # Determine script to apply to auxiliary files that go into $auxdir/.
3133 sed_transform_build_aux_file=
3134 if test -n "$do_copyrights"; then
3136 sed_transform_build_aux_file=$sed_transform_build_aux_file'
3137 s/GNU Lesser General/GNU General/g
3138 s/GNU Library General/GNU General/g
3139 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
3143 # Determine script to apply to library files that go into $testsbase/.
3144 sed_transform_testsrelated_lib_file="$sed_transform_lib_file"
3145 if test -n "$do_copyrights"; then
3147 sed_transform_testsrelated_lib_file=$sed_transform_testsrelated_lib_file'
3148 s/GNU Lesser General/GNU General/g
3149 s/GNU Library General/GNU General/g
3150 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
3154 # Determine the final file lists.
3155 # They must be computed separately, because files in lib/* go into
3156 # $sourcebase/ if they are in the main file list but into $testsbase/
3157 # if they are in the tests-related file list. Furthermore lib/dummy.c
3159 # Determine final main file list.
3160 modules="$main_modules"
3161 func_modules_to_filelist
3163 # Determine final tests-related file list.
3164 modules="$testsrelated_modules"
3165 func_modules_to_filelist
3166 testsrelated_files=`echo "$files" | sed -e 's,^lib/,tests=lib/,'`
3167 # Merge both file lists.
3168 sed_remove_empty_lines='/^$/d'
3169 files=`{ echo "$main_files"; echo "$testsrelated_files"; } | sed -e "$sed_remove_empty_lines" | LC_ALL=C sort -u`
3170 if test $verbose -ge 0; then
3172 sed_prettyprint_files='s,^tests=lib/\(.*\)$,lib/\1 -> tests/\1,'
3173 echo "$files" | sed -e "$sed_prettyprint_files" -e 's/^/ /'
3177 || func_fatal_error "refusing to do nothing"
3179 # Add m4/gnulib-tool.m4 to the file list. It is not part of any module.
3180 new_files="$files m4/gnulib-tool.m4"
3181 old_files="$cached_files"
3182 if test -f "$destdir"/$m4base/gnulib-tool.m4; then
3183 func_append old_files " m4/gnulib-tool.m4"
3186 rewritten='%REWRITTEN%'
3187 sed_rewrite_old_files="\
3188 s,^build-aux/,$rewritten$auxdir/,
3189 s,^doc/,$rewritten$cached_docbase/,
3190 s,^lib/,$rewritten$cached_sourcebase/,
3191 s,^m4/,$rewritten$cached_m4base/,
3192 s,^tests/,$rewritten$cached_testsbase/,
3193 s,^tests=lib/,$rewritten$cached_testsbase/,
3196 sed_rewrite_new_files="\
3197 s,^build-aux/,$rewritten$auxdir/,
3198 s,^doc/,$rewritten$docbase/,
3199 s,^lib/,$rewritten$sourcebase/,
3200 s,^m4/,$rewritten$m4base/,
3201 s,^tests/,$rewritten$testsbase/,
3202 s,^tests=lib/,$rewritten$testsbase/,
3206 # Create directories.
3207 { echo "$sourcebase"
3209 if test -n "$pobase"; then
3212 docfiles=`echo "$files" | sed -n -e 's,^doc/,,p'`
3213 if test -n "$docfiles"; then
3216 if test -n "$inctests"; then
3220 for f in $files; do echo $f; done \
3221 | sed -e "$sed_rewrite_new_files" \
3222 | sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
3225 { # Rearrange file descriptors. Needed because "while ... done < ..."
3226 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
3227 exec 5<&0 < "$tmp"/dirs
3229 if test ! -d "$destdir/$d"; then
3231 echo "Creating directory $destdir/$d"
3232 mkdir -p "$destdir/$d" || func_fatal_error "failed"
3234 echo "Create directory $destdir/$d"
3241 # Copy files or make symbolic links. Remove obsolete files.
3245 # Construct a table with 2 columns: rewritten-file-name original-file-name,
3246 # representing the files according to the last gnulib-tool invocation.
3247 for f in $old_files; do echo $f; done \
3248 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_old_files" \
3251 # Construct a table with 2 columns: rewritten-file-name original-file-name,
3252 # representing the files after this gnulib-tool invocation.
3253 for f in $new_files; do echo $f; done \
3254 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" \
3257 # First the files that are in old-files, but not in new-files:
3258 sed_take_first_column='s,'"$delimiter"'.*,,'
3259 for g in `LC_ALL=C join -t"$delimiter" -v1 "$tmp"/old-files "$tmp"/new-files | sed -e "$sed_take_first_column"`; do
3260 # Remove the file. Do nothing if the user already removed it.
3261 if test -f "$destdir/$g" || test -h "$destdir/$g"; then
3263 echo "Removing file $g (backup in ${g}~)"
3264 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error "failed"
3266 echo "Remove file $g (backup in ${g}~)"
3268 func_append removed_files "$g$nl"
3271 # func_add_or_update handles a file that ought to be present afterwards.
3273 # - f the original file name
3274 # - g the rewritten file name
3275 # - already_present nonempty if the file should already exist, empty
3277 func_add_or_update ()
3281 tests=lib/*) f=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
3283 func_dest_tmpfilename "$g"
3284 func_lookup_file "$f"
3285 cp "$lookedup_file" "$tmpfile" || func_fatal_error "failed"
3286 if test -n "$sed_transform_main_lib_file"; then
3289 sed -e "$sed_transform_main_lib_file" \
3290 < "$lookedup_file" > "$tmpfile" || func_fatal_error "failed"
3294 if test -n "$sed_transform_build_aux_file"; then
3297 sed -e "$sed_transform_build_aux_file" \
3298 < "$lookedup_file" > "$tmpfile" || func_fatal_error "failed"
3302 if test -n "$sed_transform_testsrelated_lib_file"; then
3305 sed -e "$sed_transform_testsrelated_lib_file" \
3306 < "$lookedup_file" > "$tmpfile" || func_fatal_error "failed"
3310 if test -f "$destdir/$g"; then
3311 # The file already exists.
3315 # Don't protest if the file should be there but isn't: it happens
3316 # frequently that developers don't put autogenerated files into CVS.
3318 func_append added_files "$g$nl"
3322 # Then the files that are in new-files, but not in old-files:
3323 sed_take_last_column='s,^.*'"$delimiter"',,'
3325 LC_ALL=C join -t"$delimiter" -v2 "$tmp"/old-files "$tmp"/new-files \
3326 | sed -e "$sed_take_last_column" \
3327 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/added-files
3328 { # Rearrange file descriptors. Needed because "while ... done < ..."
3329 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
3330 exec 5<&0 < "$tmp"/added-files
3336 # Then the files that are in new-files and in old-files:
3337 already_present=true
3338 LC_ALL=C join -t"$delimiter" "$tmp"/old-files "$tmp"/new-files \
3339 | sed -e "$sed_take_last_column" \
3340 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/kept-files
3341 { # Rearrange file descriptors. Needed because "while ... done < ..."
3342 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
3343 exec 5<&0 < "$tmp"/kept-files
3350 # Command-line invocation printed in a comment in generated gnulib-cache.m4.
3351 actioncmd="gnulib-tool --import"
3352 func_append actioncmd " --dir=$destdir"
3353 if test -n "$local_gnulib_dir"; then
3354 func_append actioncmd " --local-dir=$local_gnulib_dir"
3356 func_append actioncmd " --lib=$libname"
3357 func_append actioncmd " --source-base=$sourcebase"
3358 func_append actioncmd " --m4-base=$m4base"
3359 if test -n "$pobase"; then
3360 func_append actioncmd " --po-base=$pobase"
3362 func_append actioncmd " --doc-base=$docbase"
3363 func_append actioncmd " --tests-base=$testsbase"
3364 func_append actioncmd " --aux-dir=$auxdir"
3365 if test -n "$inctests"; then
3366 func_append actioncmd " --with-tests"
3368 if test -n "$incobsolete"; then
3369 func_append actioncmd " --with-obsolete"
3371 for module in $avoidlist; do
3372 func_append actioncmd " --avoid=$module"
3374 if test -n "$lgpl"; then
3375 if test "$lgpl" = yes; then
3376 func_append actioncmd " --lgpl"
3378 func_append actioncmd " --lgpl=$lgpl"
3381 if test -n "$makefile_name"; then
3382 func_append actioncmd " --makefile-name=$makefile_name"
3384 if test "$libtool" = true; then
3385 func_append actioncmd " --libtool"
3387 func_append actioncmd " --no-libtool"
3389 func_append actioncmd " --macro-prefix=$macro_prefix"
3390 if test -n "$po_domain"; then
3391 func_append actioncmd " --po-domain=$po_domain"
3393 if test -n "$vc_files"; then
3394 if test "$vc_files" = true; then
3395 func_append actioncmd " --vc-files"
3397 func_append actioncmd " --no-vc-files"
3400 func_append actioncmd " `echo $specified_modules`"
3402 # Default the makefile name to Makefile.am.
3403 if test -n "$makefile_name"; then
3404 makefile_am=$makefile_name
3406 makefile_am=Makefile.am
3409 # Create normal Makefile.ams.
3412 # Setup list of Makefile.am edits that are to be performed afterwards.
3413 # Some of these edits apply to files that we will generate; others are
3414 # under the responsibility of the developer.
3416 # func_note_Makefile_am_edit dir var value
3417 # remembers that ${dir}Makefile.am needs to be edited to that ${var} mentions
3419 func_note_Makefile_am_edit ()
3421 makefile_am_edits=`expr $makefile_am_edits + 1`
3422 eval makefile_am_edit${makefile_am_edits}_dir=\"\$1\"
3423 eval makefile_am_edit${makefile_am_edits}_var=\"\$2\"
3424 eval makefile_am_edit${makefile_am_edits}_val=\"\$3\"
3426 if test "$makefile_am" = Makefile.am; then
3427 sourcebase_dir=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'`
3428 sourcebase_base=`basename "$sourcebase"`
3429 func_note_Makefile_am_edit "$sourcebase_dir" SUBDIRS "$sourcebase_base"
3431 if test -n "$pobase"; then
3432 pobase_dir=`echo "$pobase" | sed -n -e 's,/[^/]*$,/,p'`
3433 pobase_base=`basename "$pobase"`
3434 func_note_Makefile_am_edit "$pobase_dir" SUBDIRS "$pobase_base"
3436 if test -n "$inctests"; then
3437 if test "$makefile_am" = Makefile.am; then
3438 testsbase_dir=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'`
3439 testsbase_base=`basename "$testsbase"`
3440 func_note_Makefile_am_edit "$testsbase_dir" SUBDIRS "$testsbase_base"
3443 func_note_Makefile_am_edit "" ACLOCAL_AMFLAGS "-I ${m4base}"
3445 # Find the first parent directory of $m4base that contains or will contain
3447 sed_last='s,^.*/\([^/][^/]*\)//*$,\1/,
3449 sed_butlast='s,[^/][^/]*//*$,,'
3450 dir1="${m4base}/"; dir2=""
3451 while test -n "$dir1" \
3452 && ! { test -f "${destdir}/${dir1}Makefile.am" \
3453 || test "${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
3454 || test "./${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
3455 || { test -n "$inctests" \
3456 && { test "${dir1}Makefile.am" = "$testsbase/$makefile_am" \
3457 || test "./${dir1}Makefile.am" = "$testsbase/$makefile_am"; }; }; }; do
3458 dir2=`echo "$dir1" | sed -e "$sed_last"`"$dir2"
3459 dir1=`echo "$dir1" | sed -e "$sed_butlast"`
3461 func_note_Makefile_am_edit "$dir1" EXTRA_DIST "${dir2}gnulib-cache.m4"
3464 # Create library makefile.
3465 func_dest_tmpfilename $sourcebase/$makefile_am
3466 destfile="$sourcebase/$makefile_am"
3467 modules="$main_modules"
3468 func_emit_lib_Makefile_am > "$tmpfile"
3469 if test -f "$destdir"/$sourcebase/$makefile_am; then
3470 if cmp "$destdir"/$sourcebase/$makefile_am "$tmpfile" > /dev/null; then
3474 echo "Updating $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
3475 mv -f "$destdir"/$sourcebase/$makefile_am "$destdir"/$sourcebase/$makefile_am~
3476 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
3478 echo "Update $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
3484 echo "Creating $sourcebase/$makefile_am"
3485 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
3487 echo "Create $sourcebase/$makefile_am"
3490 func_append added_files "$sourcebase/$makefile_am$nl"
3493 # Create po/ directory.
3494 if test -n "$pobase"; then
3495 # Create po makefile and auxiliary files.
3496 for file in Makefile.in.in remove-potcdate.sin; do
3497 func_dest_tmpfilename $pobase/$file
3498 func_lookup_file build-aux/po/$file
3499 cat "$lookedup_file" > "$tmpfile"
3500 if test -f "$destdir"/$pobase/$file; then
3501 if cmp "$destdir"/$pobase/$file "$tmpfile" > /dev/null; then
3505 echo "Updating $pobase/$file (backup in $pobase/$file~)"
3506 mv -f "$destdir"/$pobase/$file "$destdir"/$pobase/$file~
3507 mv -f "$tmpfile" "$destdir"/$pobase/$file
3509 echo "Update $pobase/$file (backup in $pobase/$file~)"
3515 echo "Creating $pobase/$file"
3516 mv -f "$tmpfile" "$destdir"/$pobase/$file
3518 echo "Create $pobase/$file"
3521 func_append added_files "$pobase/$file$nl"
3524 # Create po makefile parameterization, part 1.
3525 func_dest_tmpfilename $pobase/Makevars
3526 func_emit_po_Makevars > "$tmpfile"
3527 if test -f "$destdir"/$pobase/Makevars; then
3528 if cmp "$destdir"/$pobase/Makevars "$tmpfile" > /dev/null; then
3532 echo "Updating $pobase/Makevars (backup in $pobase/Makevars~)"
3533 mv -f "$destdir"/$pobase/Makevars "$destdir"/$pobase/Makevars~
3534 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
3536 echo "Update $pobase/Makevars (backup in $pobase/Makevars~)"
3542 echo "Creating $pobase/Makevars"
3543 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
3545 echo "Create $pobase/Makevars"
3548 func_append added_files "$pobase/Makevars$nl"
3550 # Create po makefile parameterization, part 2.
3551 func_dest_tmpfilename $pobase/POTFILES.in
3552 func_emit_po_POTFILES_in > "$tmpfile"
3553 if test -f "$destdir"/$pobase/POTFILES.in; then
3554 if cmp "$destdir"/$pobase/POTFILES.in "$tmpfile" > /dev/null; then
3558 echo "Updating $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
3559 mv -f "$destdir"/$pobase/POTFILES.in "$destdir"/$pobase/POTFILES.in~
3560 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.in
3562 echo "Update $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
3568 echo "Creating $pobase/POTFILES.in"
3569 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.in
3571 echo "Create $pobase/POTFILES.in"
3574 func_append added_files "$pobase/POTFILES.in$nl"
3577 TP_URL="http://translationproject.org/latest/"
3578 TP_RSYNC_URI="translationproject.org::tp/latest/"
3580 echo "Fetching gnulib PO files from $TP_URL"
3581 (cd "$destdir"/$pobase \
3582 && { # Prefer rsync over wget if it is available, since it consumes
3583 # less network bandwidth, due to compression.
3584 if type rsync 2>/dev/null | grep / > /dev/null; then
3585 rsync -Lrtz "${TP_RSYNC_URI}gnulib/" .
3587 wget --quiet -r -l1 -nd -np -A.po "${TP_URL}gnulib"
3592 echo "Fetch gnulib PO files from $TP_URL"
3594 # Create po/LINGUAS.
3596 func_dest_tmpfilename $pobase/LINGUAS
3597 (cd "$destdir"/$pobase \
3598 && { echo '# Set of available languages.'
3599 LC_ALL=C ls -1 *.po | sed -e 's,\.po$,,'
3602 if test -f "$destdir"/$pobase/LINGUAS; then
3603 if cmp "$destdir"/$pobase/LINGUAS "$tmpfile" > /dev/null; then
3606 echo "Updating $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
3607 mv -f "$destdir"/$pobase/LINGUAS "$destdir"/$pobase/LINGUAS~
3608 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
3611 echo "Creating $pobase/LINGUAS"
3612 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
3613 func_append added_files "$pobase/LINGUAS$nl"
3616 if test -f "$destdir"/$pobase/LINGUAS; then
3617 echo "Update $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
3619 echo "Create $pobase/LINGUAS"
3624 # Create m4/gnulib-cache.m4.
3625 func_dest_tmpfilename $m4base/gnulib-cache.m4
3627 func_emit_copyright_notice
3629 echo "# This file represents the specification of how gnulib-tool is used."
3630 echo "# It acts as a cache: It is written and read by gnulib-tool."
3631 echo "# In projects using CVS, this file is meant to be stored in CVS,"
3632 echo "# like the configure.ac and various Makefile.am files."
3635 echo "# Specification in the form of a command-line invocation:"
3638 echo "# Specification in the form of a few gnulib-tool.m4 macro invocations:"
3639 # Store the local_gnulib_dir relative to destdir.
3640 case "$local_gnulib_dir" in
3642 relative_local_gnulib_dir="$local_gnulib_dir" ;;
3645 /*) relative_local_gnulib_dir="$local_gnulib_dir" ;;
3647 # destdir, local_gnulib_dir are both relative.
3648 func_relativize "$destdir" "$local_gnulib_dir"
3649 relative_local_gnulib_dir="$reldir" ;;
3652 echo "gl_LOCAL_DIR([$relative_local_gnulib_dir])"
3654 echo "$specified_modules" | sed -e 's/^/ /g'
3656 test -z "$incobsolete" || echo "gl_WITH_OBSOLETE"
3657 echo "gl_AVOID([$avoidlist])"
3658 echo "gl_SOURCE_BASE([$sourcebase])"
3659 echo "gl_M4_BASE([$m4base])"
3660 echo "gl_PO_BASE([$pobase])"
3661 echo "gl_DOC_BASE([$docbase])"
3662 echo "gl_TESTS_BASE([$testsbase])"
3663 test -z "$inctests" || echo "gl_WITH_TESTS"
3664 echo "gl_LIB([$libname])"
3665 if test -n "$lgpl"; then
3666 if test "$lgpl" = yes; then
3669 echo "gl_LGPL([$lgpl])"
3672 echo "gl_MAKEFILE_NAME([$makefile_name])"
3673 if test "$libtool" = true; then
3676 echo "gl_MACRO_PREFIX([$macro_prefix])"
3677 echo "gl_PO_DOMAIN([$po_domain])"
3678 if test -n "$vc_files"; then
3679 echo "gl_VC_FILES([$vc_files])"
3682 if test -f "$destdir"/$m4base/gnulib-cache.m4; then
3683 if cmp "$destdir"/$m4base/gnulib-cache.m4 "$tmpfile" > /dev/null; then
3687 echo "Updating $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
3688 mv -f "$destdir"/$m4base/gnulib-cache.m4 "$destdir"/$m4base/gnulib-cache.m4~
3689 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.m4
3691 echo "Update $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
3695 echo "# gnulib-cache.m4 ends here"
3702 echo "Creating $m4base/gnulib-cache.m4"
3703 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.m4
3705 echo "Create $m4base/gnulib-cache.m4"
3711 # Create m4/gnulib-comp.m4.
3712 func_dest_tmpfilename $m4base/gnulib-comp.m4
3714 echo "# DO NOT EDIT! GENERATED AUTOMATICALLY!"
3715 func_emit_copyright_notice
3717 echo "# This file represents the compiled summary of the specification in"
3718 echo "# gnulib-cache.m4. It lists the computed macro invocations that need"
3719 echo "# to be invoked from configure.ac."
3720 echo "# In projects using CVS, this file can be treated like other built files."
3723 echo "# This macro should be invoked from $configure_ac, in the section"
3724 echo "# \"Checks for programs\", right after AC_PROG_CC, and certainly before"
3725 echo "# any checks for libraries, header files, types and library functions."
3726 echo "AC_DEFUN([${macro_prefix}_EARLY],"
3728 echo " m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
3729 echo " m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
3730 echo " m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
3731 echo " m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
3732 echo " AC_REQUIRE([AC_PROG_RANLIB])"
3733 if test -n "$uses_subdirs"; then
3734 echo " AC_REQUIRE([AM_PROG_CC_C_O])"
3736 for module in $final_modules; do
3738 if test -n "$module"; then
3739 func_get_autoconf_early_snippet "$module"
3742 | sed -e '/^$/d;' -e 's/^/ /'
3745 echo "# This macro should be invoked from $configure_ac, in the section"
3746 echo "# \"Check for header files, types and library functions\"."
3747 echo "AC_DEFUN([${macro_prefix}_INIT],"
3749 if test "$libtool" = true; then
3750 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
3751 echo " gl_cond_libtool=true"
3753 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
3754 echo " gl_cond_libtool=false"
3756 echo " gl_ltlibdeps="
3758 if test "$auxdir" != "build-aux"; then
3759 sed_replace_build_aux='
3761 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
3762 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
3766 sed_replace_build_aux="$sed_noop"
3768 func_emit_initmacro_start $macro_prefix
3769 echo " gl_source_base='$sourcebase'"
3770 for module in $main_modules; do
3772 if test -n "$module"; then
3773 func_get_autoconf_snippet "$module" \
3774 | sed -e '/^$/d;' -e 's/^/ /' \
3775 -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./' \
3776 -e "$sed_replace_build_aux"
3777 if test "$module" = 'alloca' && test "$libtool" = true; then
3778 echo 'changequote(,)dnl'
3779 echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
3780 echo 'changequote([, ])dnl'
3781 echo 'AC_SUBST([LTALLOCA])'
3785 func_emit_initmacro_end $macro_prefix
3786 echo " gltests_libdeps="
3787 echo " gltests_ltlibdeps="
3788 func_emit_initmacro_start ${macro_prefix}tests
3789 echo " gl_source_base='$testsbase'"
3790 for module in $testsrelated_modules; do
3792 if test -n "$module"; then
3793 func_get_autoconf_snippet "$module" \
3794 | sed -e '/^$/d;' -e 's/^/ /' \
3795 -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./' \
3796 -e "$sed_replace_build_aux" \
3797 -e 's/\$gl_cond_libtool/false/g' \
3798 -e 's/gl_libdeps/gltests_libdeps/g' \
3799 -e 's/gl_ltlibdeps/gltests_ltlibdeps/g'
3802 func_emit_initmacro_end ${macro_prefix}tests
3803 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
3804 # created using libtool, because libtool already handles the dependencies.
3805 if test "$libtool" != true; then
3806 libname_upper=`echo "$libname" | LC_ALL=C tr 'a-z-' 'A-Z_'`
3807 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
3808 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
3809 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
3810 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
3812 if $use_libtests; then
3813 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
3814 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
3817 func_emit_initmacro_done $macro_prefix $sourcebase
3818 func_emit_initmacro_done ${macro_prefix}tests $testsbase
3820 echo "# This macro records the list of files which have been installed by"
3821 echo "# gnulib-tool and may be removed by future gnulib-tool invocations."
3822 echo "AC_DEFUN([${macro_prefix}_FILE_LIST], ["
3823 echo "$files" | sed -e 's,^, ,'
3826 if test -f "$destdir"/$m4base/gnulib-comp.m4; then
3827 if cmp "$destdir"/$m4base/gnulib-comp.m4 "$tmpfile" > /dev/null; then
3831 echo "Updating $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
3832 mv -f "$destdir"/$m4base/gnulib-comp.m4 "$destdir"/$m4base/gnulib-comp.m4~
3833 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.m4
3835 echo "Update $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
3839 echo "# gnulib-comp.m4 ends here"
3846 echo "Creating $m4base/gnulib-comp.m4"
3847 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.m4
3849 echo "Create $m4base/gnulib-comp.m4"
3855 if test -n "$inctests"; then
3856 # Create tests makefile.
3857 func_dest_tmpfilename $testsbase/$makefile_am
3858 destfile="$testsbase/$makefile_am"
3859 modules="$testsrelated_modules"
3860 func_emit_tests_Makefile_am > "$tmpfile"
3861 if test -f "$destdir"/$testsbase/$makefile_am; then
3862 if cmp "$destdir"/$testsbase/$makefile_am "$tmpfile" > /dev/null; then
3866 echo "Updating $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
3867 mv -f "$destdir"/$testsbase/$makefile_am "$destdir"/$testsbase/$makefile_am~
3868 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
3870 echo "Update $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
3876 echo "Creating $testsbase/$makefile_am"
3877 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
3879 echo "Create $testsbase/$makefile_am"
3882 func_append added_files "$testsbase/$makefile_am$nl"
3886 if test "$vc_files" != false; then
3887 # Update the .cvsignore and .gitignore files.
3888 { echo "$added_files" | sed -e '/^$/d' -e 's,\([^/]*\)$,|A|\1,'
3889 echo "$removed_files" | sed -e '/^$/d' -e 's,\([^/]*\)$,|R|\1,'
3890 # Treat gnulib-comp.m4 like an added file, even if it already existed.
3891 echo "$m4base/|A|gnulib-comp.m4"
3892 } | LC_ALL=C sort -t'|' -k1,1 > "$tmp"/fileset-changes
3893 { # Rearrange file descriptors. Needed because "while ... done < ..."
3894 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
3895 exec 5<&0 < "$tmp"/fileset-changes
3896 func_update_ignorelist ()
3899 if test "$ignore" = .gitignore; then
3900 # In a .gitignore file, "foo" applies to the current directory and all
3901 # subdirectories, whereas "/foo" applies to the current directory only.
3904 doubly_escaped_anchor='\\/'
3908 doubly_escaped_anchor=''
3910 if test -f "$destdir/$dir$ignore"; then
3911 if test -n "$dir_added" || test -n "$dir_removed"; then
3912 sed -e "s|^$anchor||" < "$destdir/$dir$ignore" | LC_ALL=C sort > "$tmp"/ignore
3914 echo "$dir_added" | sed -e '/^$/d' | LC_ALL=C sort -u \
3915 | LC_ALL=C join -v 1 - "$tmp"/ignore > "$tmp"/ignore-added
3916 echo "$dir_removed" | sed -e '/^$/d' | LC_ALL=C sort -u \
3917 | LC_ALL=C join -v 1 - "$tmp"/ignore > "$tmp"/ignore-removed
3919 if test -s "$tmp"/ignore-added || test -s "$tmp"/ignore-removed; then
3921 echo "Updating $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
3922 mv -f "$destdir/$dir$ignore" "$destdir/$dir$ignore"~
3923 { sed -e 's,/,\\/,g' -e 's,^,/^,' -e 's,$,\$/d,' < "$tmp"/ignore-removed
3924 if test -n "$anchor"; then sed -e 's,/,\\/,g' -e "s,^,/^${doubly_escaped_anchor}," -e 's,$,$/d,' < "$tmp"/ignore-removed; fi
3925 } > "$tmp"/sed-ignore-removed
3926 { cat "$destdir/$dir$ignore"~
3927 sed -e "s|^|$anchor|" < "$tmp"/ignore-added
3928 } | sed -f "$tmp"/sed-ignore-removed \
3929 > "$destdir/$dir$ignore"
3931 echo "Update $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
3936 if test -n "$dir_added"; then
3938 echo "Creating $destdir/$dir$ignore"
3940 if test "$ignore" = .cvsignore; then
3942 # Automake generates Makefile rules that create .dirstamp files.
3945 echo "$dir_added" | sed -e '/^$/d' -e "s|^|$anchor|" | LC_ALL=C sort -u
3946 } > "$destdir/$dir$ignore"
3948 echo "Create $destdir/$dir$ignore"
3958 if test -d "$destdir/CVS" || test -d "$destdir/${dir}CVS" || test -f "$destdir/${dir}.cvsignore"; then
3959 func_update_ignorelist .cvsignore
3961 if test -d "$destdir/.git" || test -f "$destdir/${dir}.gitignore"; then
3962 func_update_ignorelist .gitignore
3969 # Why not ''read next_dir op file'' ? Because the dir column can be empty.
3970 next_dir=`echo "$line" | sed -e 's,|.*,,'`
3971 op=`echo "$line" | sed -e 's,^[^|]*|\([^|]*\)|.*$,\1,'`
3972 file=`echo "$line" | sed -e 's,^[^|]*|[^|]*|,,'`
3973 if test "$next_dir" != "$last_dir"; then
3974 func_done_dir "$last_dir" "$last_dir_added" "$last_dir_removed"
3975 last_dir="$next_dir"
3980 A) func_append last_dir_added "$file$nl";;
3981 R) func_append last_dir_removed "$file$nl";;
3984 func_done_dir "$last_dir" "$last_dir_added" "$last_dir_removed"
3991 echo "You may need to add #include directives for the following .h files."
3992 # Intersect $specified_modules and $main_modules
3993 # (since $specified_modules is not necessarily of subset of $main_modules
3994 # - some may have been skipped through --avoid, and since the elements of
3995 # $main_modules but not in $specified_modules can go away without explicit
3996 # notice - through changes in the module dependencies).
3997 echo "$specified_modules" > "$tmp"/modules1 # a sorted list, one module per line
3998 echo "$main_modules" > "$tmp"/modules2 # also a sorted list, one module per line
3999 # First the #include <...> directives without #ifs, sorted for convenience,
4000 # then the #include "..." directives without #ifs, sorted for convenience,
4001 # then the #include directives that are surrounded by #ifs. Not sorted.
4002 for module in `LC_ALL=C join "$tmp"/modules1 "$tmp"/modules2`; do
4003 include_directive=`func_get_include_directive "$module"`
4004 case "$nl$include_directive" in
4006 echo "$include_directive" 1>&5
4009 echo "$include_directive" | grep -v 'include "' 1>&6
4010 echo "$include_directive" | grep 'include "' 1>&7
4013 done 5> "$tmp"/include-if 6> "$tmp"/include-angles 7> "$tmp"/include-quotes
4015 LC_ALL=C sort -u "$tmp"/include-angles
4016 LC_ALL=C sort -u "$tmp"/include-quotes
4017 cat "$tmp"/include-if
4018 ) | sed -e '/^$/d' -e 's/^/ /'
4019 rm -f "$tmp"/include-angles "$tmp"/include-quotes "$tmp"/include-if
4021 for module in $main_modules; do
4022 func_get_link_directive "$module"
4024 | LC_ALL=C sort -u | sed -e '/^$/d' -e 's/^/ /' > "$tmp"/link
4025 if test `wc -l < "$tmp"/link` != 0; then
4027 echo "You may need to use the following Makefile variables when linking."
4028 echo "Use them in <program>_LDADD when linking a program, or"
4029 echo "in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library."
4035 echo "Don't forget to"
4036 if test "$makefile_am" = Makefile.am; then
4037 echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
4039 echo " - \"include $makefile_name\" from within \"$sourcebase/Makefile.am\","
4041 if test -n "$pobase"; then
4042 echo " - add \"$pobase/Makefile.in\" to AC_CONFIG_FILES in $configure_ac,"
4044 if test -n "$inctests"; then
4045 if test "$makefile_am" = Makefile.am; then
4046 echo " - add \"$testsbase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
4048 echo " - \"include $makefile_name\" from within \"$testsbase/Makefile.am\","
4052 while test $edit != $makefile_am_edits; do
4053 edit=`expr $edit + 1`
4054 eval dir=\"\$makefile_am_edit${edit}_dir\"
4055 eval var=\"\$makefile_am_edit${edit}_var\"
4056 eval val=\"\$makefile_am_edit${edit}_val\"
4057 if test -n "$var"; then
4058 echo " - mention \"${val}\" in ${var} in ${dir}Makefile.am,"
4061 echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after AC_PROG_CC,"
4062 echo " - invoke ${macro_prefix}_INIT in $configure_ac."
4065 # func_create_testdir testdir modules
4067 # - local_gnulib_dir from --local-dir
4068 # - auxdir directory relative to destdir where to place build aux files
4069 func_create_testdir ()
4073 if test -z "$modules"; then
4074 # All modules together.
4075 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
4076 # Except ftruncate, mountlist, which abort the configuration on mingw. FIXME.
4077 modules=`func_all_modules`
4078 modules=`for m in $modules; do case $m in config-h | ftruncate | mountlist) ;; *) echo $m;; esac; done`
4080 modules=`for m in $modules; do echo $m; done | LC_ALL=C sort -u`
4082 # Check that the license of every module is consistent with the license of
4084 saved_modules="$modules"
4085 saved_inctests="$inctests"
4086 # When computing transitive closures, don't consider $module to depend on
4087 # $module-tests. Need this becauses tests are implicitly GPL and may depend
4088 # on GPL modules - therefore we don't want a warning in this case.
4090 for requested_module in $saved_modules; do
4091 requested_license=`func_get_license "$requested_module"`
4092 if test "$requested_license" != GPL; then
4093 # Here we use func_modules_transitive_closure, not just
4094 # func_get_dependencies, so that we also detect weird situations like
4095 # an LGPL module which depends on a GPLed build tool module which depends
4097 modules="$requested_module"
4098 func_modules_transitive_closure
4099 for module in $modules; do
4100 license=`func_get_license "$module"`
4102 'GPLed build tool') ;;
4103 'public domain' | 'unlimited' | 'unmodifiable license text') ;;
4105 case "$requested_license" in
4108 GPLv2+ | LGPLv2+) ;;
4109 *) func_warning "module $requested_module depends on a module with an incompatible license: $module" ;;
4115 *) func_warning "module $requested_module depends on a module with an incompatible license: $module" ;;
4121 *) func_warning "module $requested_module depends on a module with an incompatible license: $module" ;;
4130 modules="$saved_modules"
4131 inctests="$saved_inctests"
4133 # Subdirectory names.
4143 # Determine final module list.
4144 func_modules_transitive_closure
4145 if test $verbose -ge 0; then
4146 echo "Module list with included dependencies:"
4147 echo "$modules" | sed -e 's/^/ /'
4150 # Add the dummy module if needed.
4151 func_modules_add_dummy
4153 # Show banner notice of every module.
4156 # Determine final file list.
4157 func_modules_to_filelist
4158 if test $verbose -ge 0; then
4160 echo "$files" | sed -e 's/^/ /'
4163 rewritten='%REWRITTEN%'
4164 sed_rewrite_files="\
4165 s,^build-aux/,$rewritten$auxdir/,
4166 s,^doc/,$rewritten$docbase/,
4167 s,^lib/,$rewritten$sourcebase/,
4168 s,^m4/,$rewritten$m4base/,
4169 s,^tests/,$rewritten$testsbase/,
4173 # Create directories.
4174 for f in $files; do echo $f; done \
4175 | sed -e "$sed_rewrite_files" \
4176 | sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
4177 | LC_ALL=C sort -u \
4179 { # Rearrange file descriptors. Needed because "while ... done < ..."
4180 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
4181 exec 5<&0 < "$tmp"/dirs
4183 mkdir -p "$testdir/$d"
4188 # Copy files or make symbolic links.
4190 for f in $files; do echo $f; done \
4191 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_files" \
4194 { # Rearrange file descriptors. Needed because "while ... done < ..."
4195 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
4196 exec 5<&0 < "$tmp"/files
4198 func_lookup_file "$f"
4199 if test -n "$lookedup_tmp"; then
4200 cp -p "$lookedup_file" "$testdir/$g"
4202 ln "$lookedup_file" "$testdir/$g" 2>/dev/null ||
4203 if { test -n "$symbolic" \
4204 || { test -n "$lsymbolic" \
4205 && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; }; then
4206 func_ln "$lookedup_file" "$testdir/$g"
4208 cp -p "$lookedup_file" "$testdir/$g"
4215 # Create Makefile.ams that are for testing.
4218 # No special edits are needed.
4221 # Create $sourcebase/Makefile.am.
4222 mkdir -p "$testdir/$sourcebase"
4223 destfile="$sourcebase/Makefile.am"
4224 func_emit_lib_Makefile_am > "$testdir/$sourcebase/Makefile.am"
4225 any_uses_subdirs="$uses_subdirs"
4227 # Create $m4base/Makefile.am.
4228 mkdir -p "$testdir/$m4base"
4229 (echo "## Process this file with automake to produce Makefile.in."
4235 echo "EXTRA_DIST += "`echo "$f" | sed -e 's,^m4/,,'` ;;
4238 ) > "$testdir/$m4base/Makefile.am"
4240 subdirs="$sourcebase $m4base"
4241 subdirs_with_configure_ac=""
4243 if false && test -f "$testdir"/$m4base/gettext.m4; then
4244 # Avoid stupid error message from automake:
4245 # "AM_GNU_GETTEXT used but `po' not in SUBDIRS"
4246 mkdir -p "$testdir/po"
4247 (echo "## Process this file with automake to produce Makefile.in."
4248 ) > "$testdir/po/Makefile.am"
4249 func_append subdirs " po"
4252 if test -n "$inctests"; then
4253 test -d "$testdir/$testsbase" || mkdir "$testdir/$testsbase"
4254 # Viewed from the $testsbase subdirectory, $auxdir is different.
4255 saved_auxdir="$auxdir"
4256 auxdir=`echo "$testsbase/" | sed -e 's%[^/][^/]*//*%../%g'`"$auxdir"
4257 # Create $testsbase/Makefile.am.
4259 destfile="$testsbase/Makefile.am"
4260 func_emit_tests_Makefile_am > "$testdir/$testsbase/Makefile.am"
4261 any_uses_subdirs="$any_uses_subdirs$uses_subdirs"
4262 # Create $testsbase/configure.ac.
4263 (echo "# Process this file with autoconf to produce a configure script."
4264 echo "AC_INIT([dummy], [0])"
4265 echo "AC_CONFIG_AUX_DIR([$auxdir])"
4266 echo "AM_INIT_AUTOMAKE"
4268 echo "AC_CONFIG_HEADERS([config.h])"
4271 echo "AC_PROG_INSTALL"
4272 echo "AC_PROG_MAKE_SET"
4273 echo "AC_PROG_RANLIB"
4275 if test -n "$uses_subdirs"; then
4276 echo "AM_PROG_CC_C_O"
4279 for module in $modules; do
4281 if test -n "$module"; then
4283 gnumakefile | maintainer-makefile)
4284 # These modules are meant to be used only in the top-level directory.
4287 func_get_autoconf_early_snippet "$module"
4292 | sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
4293 if test "$libtool" = true; then
4294 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
4295 echo "gl_cond_libtool=true"
4297 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
4298 echo "gl_cond_libtool=false"
4300 echo "gl_ltlibdeps="
4302 # Wrap the set of autoconf snippets into an autoconf macro that is then
4303 # invoked. This is needed because autoconf does not support AC_REQUIRE
4305 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
4306 # but we want the AC_REQUIRE to have its normal meaning (provide one
4307 # expansion of the required macro before the current point, and only one
4309 echo "AC_DEFUN([gl_INIT], ["
4310 sed_replace_build_aux='
4312 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
4313 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
4316 func_emit_initmacro_start $macro_prefix
4317 # We don't have explicit ordering constraints between the various
4318 # autoconf snippets. It's cleanest to put those of the library before
4319 # those of the tests.
4320 echo "gl_source_base='../$sourcebase'"
4321 for module in $modules; do
4322 func_verify_nontests_module
4323 if test -n "$module"; then
4325 gnumakefile | maintainer-makefile)
4326 # These modules are meant to be used only in the top-level directory.
4329 func_get_autoconf_snippet "$module" \
4330 | sed -e "$sed_replace_build_aux"
4335 echo "gl_source_base='.'"
4336 for module in $modules; do
4337 func_verify_tests_module
4338 if test -n "$module"; then
4339 func_get_autoconf_snippet "$module" \
4340 | sed -e "$sed_replace_build_aux"
4343 func_emit_initmacro_end $macro_prefix
4344 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
4345 # created using libtool, because libtool already handles the dependencies.
4346 if test "$libtool" != true; then
4347 libname_upper=`echo "$libname" | LC_ALL=C tr 'a-z-' 'A-Z_'`
4348 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
4349 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
4350 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
4351 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
4354 func_emit_initmacro_done $macro_prefix $sourcebase # FIXME use $sourcebase or $testsbase?
4358 # Usually $testsbase/config.h will be a superset of config.h. Verify this
4359 # by "merging" config.h into $testsbase/config.h; look out for gcc warnings.
4360 echo "AH_TOP([#include \"../config.h\"])"
4362 echo "AC_CONFIG_FILES([Makefile])"
4364 ) > "$testdir/$testsbase/configure.ac"
4365 auxdir="$saved_auxdir"
4366 func_append subdirs " $testsbase"
4367 subdirs_with_configure_ac="$subdirs_with_configure_ac $testsbase"
4370 # Create Makefile.am.
4371 (echo "## Process this file with automake to produce Makefile.in."
4373 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
4375 echo "SUBDIRS = $subdirs"
4377 echo "ACLOCAL_AMFLAGS = -I $m4base"
4378 ) > "$testdir/Makefile.am"
4380 # Create configure.ac.
4381 (echo "# Process this file with autoconf to produce a configure script."
4382 echo "AC_INIT([dummy], [0])"
4383 if test "$auxdir" != "."; then
4384 echo "AC_CONFIG_AUX_DIR([$auxdir])"
4386 echo "AM_INIT_AUTOMAKE"
4388 echo "AC_CONFIG_HEADERS([config.h])"
4391 echo "AC_PROG_INSTALL"
4392 echo "AC_PROG_MAKE_SET"
4394 echo "# For autobuild."
4395 echo "AC_CANONICAL_BUILD"
4396 echo "AC_CANONICAL_HOST"
4398 echo "m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
4399 echo "m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
4400 echo "m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
4401 echo "m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
4403 echo "AC_PROG_RANLIB"
4405 if test -n "$any_uses_subdirs"; then
4406 echo "AM_PROG_CC_C_O"
4409 for module in $modules; do
4410 func_verify_nontests_module
4411 if test -n "$module"; then
4412 func_get_autoconf_early_snippet "$module"
4415 | sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
4416 if test "$libtool" = true; then
4417 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
4418 echo "gl_cond_libtool=true"
4420 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
4421 echo "gl_cond_libtool=false"
4423 echo "gl_ltlibdeps="
4425 # Wrap the set of autoconf snippets into an autoconf macro that is then
4426 # invoked. This is needed because autoconf does not support AC_REQUIRE
4428 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
4429 # but we want the AC_REQUIRE to have its normal meaning (provide one
4430 # expansion of the required macro before the current point, and only one
4432 echo "AC_DEFUN([gl_INIT], ["
4433 if test "$auxdir" != "build-aux"; then
4434 sed_replace_build_aux='
4436 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
4437 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
4441 sed_replace_build_aux="$sed_noop"
4443 func_emit_initmacro_start $macro_prefix
4444 echo "gl_source_base='$sourcebase'"
4445 for module in $modules; do
4446 func_verify_nontests_module
4447 if test -n "$module"; then
4448 func_get_autoconf_snippet "$module" \
4449 | sed -e "$sed_replace_build_aux"
4452 func_emit_initmacro_end $macro_prefix
4453 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
4454 # created using libtool, because libtool already handles the dependencies.
4455 if test "$libtool" != true; then
4456 libname_upper=`echo "$libname" | LC_ALL=C tr 'a-z-' 'A-Z_'`
4457 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
4458 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
4459 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
4460 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
4463 func_emit_initmacro_done $macro_prefix $sourcebase
4467 if test -n "$subdirs_with_configure_ac"; then
4468 echo "AC_CONFIG_SUBDIRS(["`echo $subdirs_with_configure_ac`"])"
4470 makefiles="Makefile"
4471 for d in $subdirs; do
4472 # For subdirs that have a configure.ac by their own, it's the subdir's
4473 # configure.ac which creates the subdir's Makefile.am, not this one.
4474 case " $subdirs_with_configure_ac " in
4476 *) func_append makefiles " $d/Makefile" ;;
4479 echo "AC_CONFIG_FILES([$makefiles])"
4481 ) > "$testdir/configure.ac"
4483 # Create autogenerated files.
4485 # Do not use "${AUTORECONF} --force --install", because it may invoke
4486 # autopoint, which brings in older versions of some of our .m4 files.
4487 if test -f $m4base/gettext.m4; then
4488 func_execute_command ${AUTOPOINT} --force || func_exit 1
4489 for f in $m4base/*.m4~; do
4491 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit 1
4495 func_execute_command ${ACLOCAL} -I $m4base || func_exit 1
4496 if ! test -d build-aux; then
4497 func_execute_command mkdir build-aux || func_exit 1
4499 func_execute_command ${AUTOCONF} || func_exit 1
4500 func_execute_command ${AUTOHEADER} || func_exit 1
4501 func_execute_command ${AUTOMAKE} --add-missing --copy || func_exit 1
4503 if test -n "$inctests"; then
4504 # Create autogenerated files.
4505 (cd "$testdir/$testsbase" || func_exit 1
4506 # Do not use "${AUTORECONF} --force --install", because it may invoke
4507 # autopoint, which brings in older versions of some of our .m4 files.
4508 if test -f ../$m4base/gettext.m4; then
4509 func_execute_command ${AUTOPOINT} --force || func_exit 1
4510 for f in ../$m4base/*.m4~; do
4512 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit 1
4516 func_execute_command ${ACLOCAL} -I ../$m4base || func_exit 1
4517 if ! test -d ../build-aux; then
4518 func_execute_command mkdir ../build-aux
4520 func_execute_command ${AUTOCONF} || func_exit 1
4521 func_execute_command ${AUTOHEADER} || func_exit 1
4522 func_execute_command ${AUTOMAKE} --add-missing --copy || func_exit 1
4525 # Need to run configure and make once, to create built files that are to be
4526 # distributed (such as getdate.c).
4527 # Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...".
4528 cleaned_files=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \
4529 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
4530 cleaned_files=`for file in $cleaned_files; do echo " $file "; done`
4531 # Extract the value of "BUILT_SOURCES += ...". Remove variable references
4532 # such $(FOO_H) because they don't refer to distributed files.
4533 sed_remove_make_variables='s,[$]([A-Za-z0-9_]*),,g'
4534 built_sources=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \
4535 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
4536 | sed -e "$sed_remove_make_variables"`
4537 distributed_built_sources=`for file in $built_sources; do
4538 case "$cleaned_files" in
4543 if test -n "$distributed_built_sources"; then
4545 ./configure || func_exit 1
4547 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
4548 $MAKE built_sources || func_exit 1
4550 $MAKE distclean || func_exit 1
4555 # func_create_megatestdir megatestdir allmodules
4557 # - local_gnulib_dir from --local-dir
4558 # - auxdir directory relative to destdir where to place build aux files
4559 func_create_megatestdir ()
4563 if test -z "$allmodules"; then
4564 allmodules=`func_all_modules`
4568 # First, all modules one by one.
4569 for onemodule in $allmodules; do
4570 func_create_testdir "$megatestdir/$onemodule" $onemodule
4571 func_append megasubdirs "$onemodule "
4573 # Then, all modules all together.
4574 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
4575 allmodules=`for m in $allmodules; do if test $m != config-h; then echo $m; fi; done`
4576 func_create_testdir "$megatestdir/ALL" "$allmodules"
4577 func_append megasubdirs "ALL"
4580 cvsdate=`if test -f "$gnulib_dir/CVS/Entries"; then \
4581 vc_witness="$gnulib_dir/CVS/Entries"; \
4583 vc_witness="$gnulib_dir/.git/refs/heads/master"; \
4585 sh "$gnulib_dir/build-aux/mdate-sh" "$vc_witness" \
4586 | sed -e 's,January,01,' -e 's,Jan,01,' \
4587 -e 's,February,02,' -e 's,Feb,02,' \
4588 -e 's,March,03,' -e 's,Mar,03,' \
4589 -e 's,April,04,' -e 's,Apr,04,' \
4591 -e 's,June,06,' -e 's,Jun,06,' \
4592 -e 's,July,07,' -e 's,Jul,07,' \
4593 -e 's,August,08,' -e 's,Aug,08,' \
4594 -e 's,September,09,' -e 's,Sep,09,' \
4595 -e 's,October,10,' -e 's,Oct,10,' \
4596 -e 's,November,11,' -e 's,Nov,11,' \
4597 -e 's,December,12,' -e 's,Dec,12,' \
4598 -e 's,^,00,' -e 's,^[0-9]*\([0-9][0-9] \),\1,' \
4599 -e 's,^\([0-9]*\) \([0-9]*\) \([0-9]*\),\3\2\1,'`
4601 echo "CVSDATE=$cvsdate"
4602 echo ": \${MAKE=make}"
4603 echo "test -d logs || mkdir logs"
4604 echo "for module in $megasubdirs; do"
4605 echo " echo \"Working on module \$module...\""
4606 echo " safemodule=\`echo \$module | sed -e 's|/|-|g'\`"
4607 echo " (echo \"To: gnulib@autobuild.josefsson.org\""
4610 echo " : autobuild project... \$module"
4611 echo " : autobuild revision... cvs-\$CVSDATE-000000"
4612 echo " : autobuild timestamp... \`date \"+%Y%m%d-%H%M%S\"\`"
4613 echo " : autobuild hostname... \`hostname\`"
4614 echo " cd \$module && ./configure \$CONFIGURE_OPTIONS && \$MAKE && \$MAKE check && \$MAKE distclean"
4616 echo " ) 2>&1 | { if test -n \"\$AUTOBUILD_SUBST\"; then sed -e \"\$AUTOBUILD_SUBST\"; else cat; fi; } > logs/\$safemodule"
4618 ) > "$megatestdir/do-autobuild"
4619 chmod a+x "$megatestdir/do-autobuild"
4621 # Create Makefile.am.
4622 (echo "## Process this file with automake to produce Makefile.in."
4624 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
4626 echo "SUBDIRS = $megasubdirs"
4628 echo "EXTRA_DIST = do-autobuild"
4629 ) > "$megatestdir/Makefile.am"
4631 # Create configure.ac.
4632 (echo "# Process this file with autoconf to produce a configure script."
4633 echo "AC_INIT([dummy], [0])"
4634 if test "$auxdir" != "."; then
4635 echo "AC_CONFIG_AUX_DIR([$auxdir])"
4637 echo "AM_INIT_AUTOMAKE"
4639 echo "AC_PROG_MAKE_SET"
4641 echo "AC_CONFIG_SUBDIRS([$megasubdirs])"
4642 echo "AC_CONFIG_FILES([Makefile])"
4644 ) > "$megatestdir/configure.ac"
4646 # Create autogenerated files.
4648 # Do not use "${AUTORECONF} --install", because autoreconf operates
4649 # recursively, but the subdirectories are already finished, therefore
4650 # calling autoreconf here would only waste lots of CPU time.
4651 func_execute_command ${ACLOCAL} || func_exit 1
4652 func_execute_command mkdir build-aux
4653 func_execute_command ${AUTOCONF} || func_exit 1
4654 func_execute_command ${AUTOMAKE} --add-missing --copy || func_exit 1
4660 func_fatal_error "no mode specified" ;;
4669 if test -z "$destdir"; then
4672 test -d "$destdir" \
4673 || func_fatal_error "destination directory does not exist: $destdir"
4675 # Prefer configure.ac to configure.in.
4676 if test -f "$destdir"/configure.ac; then
4677 configure_ac="$destdir/configure.ac"
4679 if test -f "$destdir"/configure.in; then
4680 configure_ac="$destdir/configure.in"
4682 func_fatal_error "cannot find $destdir/configure.ac - make sure you run gnulib-tool from within your package's directory"
4686 # Analyze configure.ac.
4688 guessed_libtool=false
4693 /AC_CONFIG_AUX_DIR/ {
4694 s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^]"$`\\)]*\).*$,guessed_auxdir="\1",p
4696 /A[CM]_PROG_LIBTOOL/ {
4697 s,^.*$,guessed_libtool=true,p
4699 eval `sed -n -e "$my_sed_traces" < "$configure_ac"`
4701 if test -z "$auxdir"; then
4702 auxdir="$guessed_auxdir"
4705 # Determine where to apply func_import.
4706 if test -n "$m4base"; then
4707 # Apply func_import to a particular gnulib directory.
4708 # Any number of additional modules can be given.
4709 if test ! -f "$destdir/$m4base"/gnulib-cache.m4; then
4710 # First use of gnulib in the given m4base.
4711 test -n "$supplied_libname" || supplied_libname=true
4712 test -n "$sourcebase" || sourcebase="lib"
4713 test -n "$docbase" || docbase="doc"
4714 test -n "$testsbase" || testsbase="tests"
4715 test -n "$macro_prefix" || macro_prefix="gl"
4719 # Apply func_import to all gnulib directories.
4720 # To get this list of directories, look at Makefile.am. (Not at
4721 # configure, because it may be omitted from CVS. Also, don't run
4722 # "find $destdir -name gnulib-cache.m4", as it might be too expensive.)
4725 if test -f "$destdir"/Makefile.am; then
4726 aclocal_amflags=`sed -n -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/p' "$destdir"/Makefile.am`
4728 for arg in $aclocal_amflags; do
4729 if test -n "$m4dir_is_next"; then
4730 # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
4734 if test -f "$destdir/$arg"/gnulib-cache.m4; then
4735 func_append m4dirs " $arg"
4736 m4dirs_count=`expr $m4dirs_count + 1`
4742 if test "X$arg" = "X-I"; then
4750 # No Makefile.am! Oh well. Look at the last generated aclocal.m4.
4751 if test -f "$destdir"/aclocal.m4; then
4752 sedexpr1='s,^m4_include(\[\(.*\)])$,\1,p'
4753 sedexpr2='s,^[^/]*$,.,'
4754 sedexpr3='s,/[^/]*$,,'
4755 m4dirs=`sed -n -e "$sedexpr1" aclocal.m4 | sed -e "$sedexpr2" -e "$sedexpr3" | LC_ALL=C sort -u`
4756 m4dirs_count=`printf %s "$m4dirs" | wc -l`
4759 if test $m4dirs_count = 0; then
4760 # First use of gnulib in a package.
4761 # Any number of additional modules can be given.
4762 test -n "$supplied_libname" || supplied_libname=true
4763 test -n "$sourcebase" || sourcebase="lib"
4765 test -n "$docbase" || docbase="doc"
4766 test -n "$testsbase" || testsbase="tests"
4767 test -n "$macro_prefix" || macro_prefix="gl"
4770 if test $m4dirs_count = 1; then
4771 # There's only one use of gnulib here. Assume the user means it.
4772 # Any number of additional modules can be given.
4773 for m4base in $m4dirs; do
4777 # Ambiguous - guess what the user meant.
4778 if test $# = 0; then
4779 # No further arguments. Guess the user wants to update all of them.
4780 for m4base in $m4dirs; do
4781 # Perform func_import in a subshell, so that variable values
4783 # local_gnulib_dir, incobsolete, avoidlist, sourcebase, m4base,
4784 # pobase, docbase, testsbase, inctests, libname, lgpl,
4785 # makefile_name, libtool, macro_prefix, po_domain, vc_files
4786 # don't propagate from one directory to another.
4787 (func_import) || func_exit 1
4791 func_fatal_error "Ambiguity: to which directory should the modules be added? Please specify at least --m4-base=..."
4799 if test -z "$destdir"; then
4800 func_fatal_error "please specify --dir option"
4803 test -d "$destdir" \
4804 || func_fatal_error "could not create destination directory"
4805 test -n "$auxdir" || auxdir="build-aux"
4806 func_create_testdir "$destdir" "$*"
4809 create-megatestdir )
4810 if test -z "$destdir"; then
4811 func_fatal_error "please specify --dir option"
4813 mkdir "$destdir" || func_fatal_error "could not create destination directory"
4814 test -n "$auxdir" || auxdir="build-aux"
4815 func_create_megatestdir "$destdir" "$*"
4819 test -n "$destdir" || destdir=testdir$$
4820 mkdir "$destdir" || func_fatal_error "could not create destination directory"
4821 test -n "$auxdir" || auxdir="build-aux"
4822 func_create_testdir "$destdir" "$*"
4826 ../configure || func_exit 1
4827 $MAKE || func_exit 1
4828 $MAKE check || func_exit 1
4829 $MAKE distclean || func_exit 1
4830 remaining=`find . -type f -print`
4831 if test -n "$remaining"; then
4832 echo "Remaining files:" $remaining 1>&2
4833 echo "gnulib-tool: *** Stop." 1>&2
4842 test -n "$destdir" || destdir=testdir$$
4843 mkdir "$destdir" || func_fatal_error "could not create destination directory"
4844 test -n "$auxdir" || auxdir="build-aux"
4845 func_create_megatestdir "$destdir" "$*"
4853 remaining=`find . -type f -print`
4854 if test -n "$remaining"; then
4855 echo "Remaining files:" $remaining 1>&2
4856 echo "gnulib-tool: *** Stop." 1>&2
4864 extract-description )
4868 if test -n "$module"; then
4869 func_get_description "$module"
4878 if test -n "$module"; then
4879 func_get_status "$module"
4888 if test -n "$module"; then
4889 func_get_notice "$module"
4894 extract-applicability )
4898 if test -n "$module"; then
4899 func_get_applicability "$module"
4908 if test -n "$module"; then
4909 func_get_filelist "$module"
4914 extract-dependencies )
4918 if test -n "$module"; then
4919 func_get_dependencies "$module"
4924 extract-autoconf-snippet )
4928 if test -n "$module"; then
4929 func_get_autoconf_snippet "$module"
4934 extract-automake-snippet )
4938 if test -n "$module"; then
4939 func_get_automake_snippet "$module"
4944 extract-include-directive )
4948 if test -n "$module"; then
4949 func_get_include_directive "$module"
4954 extract-link-directive )
4958 if test -n "$module"; then
4959 func_get_link_directive "$module"
4968 if test -n "$module"; then
4969 func_get_license "$module"
4974 extract-maintainer )
4978 if test -n "$module"; then
4979 func_get_maintainer "$module"
4984 extract-tests-module )
4988 if test -n "$module"; then
4989 func_get_tests_module "$module"
4995 # Verify the number of arguments.
4996 if test $# -lt 1 || test $# -gt 2; then
4997 func_fatal_error "invalid number of arguments for --$mode"
5000 # The first argument is the file to be copied.
5002 # Verify the file exists.
5003 func_lookup_file "$f"
5005 # The second argument is the destination; either a directory ot a file.
5006 # It defaults to the current directory.
5008 test -n "$dest" || dest='.'
5009 test -n "$sourcebase" || sourcebase="lib"
5010 test -n "$m4base" || m4base="m4"
5011 test -n "$docbase" || docbase="doc"
5012 test -n "$testsbase" || testsbase="tests"
5013 test -n "$auxdir" || auxdir="build-aux"
5014 rewritten='%REWRITTEN%'
5015 sed_rewrite_files="\
5016 s,^build-aux/,$rewritten$auxdir/,
5017 s,^doc/,$rewritten$docbase/,
5018 s,^lib/,$rewritten$sourcebase/,
5019 s,^m4/,$rewritten$m4base/,
5020 s,^tests/,$rewritten$testsbase/,
5023 if test -d "$dest"; then
5025 g=`echo "$f" | sed -e "$sed_rewrite_files"`
5027 destdir=`dirname "$dest"`
5028 g=`basename "$dest"`
5031 # Create the directory for destfile.
5032 d=`dirname "$destdir/$g"`
5034 if test -n "$d" && test ! -d "$d"; then
5035 mkdir -p "$d" || func_fatal_error "failed"
5039 func_dest_tmpfilename "$g"
5040 cp "$lookedup_file" "$tmpfile" || func_fatal_error "failed"
5041 already_present=true
5042 if test -f "$destdir/$g"; then
5043 # The file already exists.
5047 # Don't protest if the file should be there but isn't: it happens
5048 # frequently that developers don't put autogenerated files into CVS.
5055 func_fatal_error "unknown operation mode --$mode" ;;
5059 # Undo the effect of the previous 'trap' command. Some shellology:
5060 # We cannot use "trap - 0 1 2 3 13 15", because Solaris sh would attempt to
5061 # execute the command "-". "trap '' ..." is fine only for signal 0 (= normal
5062 # exit); for the others we need to call 'exit' explicitly. The value of $? is
5063 # 128 + signal number and is set before the trap-registered command is run.
5065 trap 'func_exit $?' 1 2 3 13 15
5070 # indent-tabs-mode: nil
5071 # whitespace-check-buffer-indent: nil