3 # Copyright (C) 2002-2024 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 <https://www.gnu.org/licenses/>.
19 # This program is meant for authors or maintainers which want to import
20 # modules from gnulib into their packages.
22 # CODING STYLE for this file:
23 # * Indentation: Indent by 2 spaces. Indent case clauses by 2 spaces as well.
24 # * Shell variable references: Use double-quote around shell variable
25 # references always (except when word splitting is explicitly desired),
26 # even when you know the double-quote are not needed. This style tends to
27 # avoid undesired word splitting caused by omitted double-quotes (the
28 # number one mistake in shell scripts).
29 # When the referenced variable can only have a finite number of possible
30 # values and these values are all simple words (e.g. true and false), it's
31 # OK to omit the double-quotes.
33 # - Use backquotes like in `command`, not $(command).
34 # - Don't use `command` inside double-quotes. Instead assign the result of
35 # `command` to a variable, and use the value of the variable afterwards.
37 # - All functions that don't emulate a program or shell built-in have a name
38 # that starts with 'func_'.
39 # - Document the implicit and explicit arguments of all functions, as well
40 # as their output variables and side effects.
41 # * Use test condition instead of [ condition ].
42 # * Minimize the use of eval; when you need it, make sure the string to be
43 # evaluated has a very simple syntactic structure.
51 # You can set AUTOCONFPATH to empty if autoconf ≥ 2.64 is already in your PATH.
55 # AUTOCONFBINDIR=/arch/x86-linux/gnu-inst-autoconf/2.64/bin
56 # AUTOCONFPATH="eval env PATH=${AUTOCONFBINDIR}:\$PATH "
60 # You can set AUTOMAKEPATH to empty if automake ≥ 1.14 is already in your PATH.
63 # You can set GETTEXTPATH to empty if autopoint ≥ 0.15 is already in your PATH.
66 # You can set LIBTOOLPATH to empty if libtoolize 2.x is already in your PATH.
69 # If you didn't set AUTOCONFPATH and AUTOMAKEPATH, you can also set the
70 # variables AUTOCONF, AUTOHEADER, ACLOCAL, AUTOMAKE, AUTORECONF individually.
71 if test -z "${AUTOCONF}" ||
test -n "${AUTOCONFPATH}"; then
72 AUTOCONF
="${AUTOCONFPATH}autoconf"
74 if test -z "${AUTOHEADER}" ||
test -n "${AUTOCONFPATH}"; then
75 AUTOHEADER
="${AUTOCONFPATH}autoheader"
77 if test -z "${ACLOCAL}" ||
test -n "${AUTOMAKEPATH}"; then
78 ACLOCAL
="${AUTOMAKEPATH}aclocal"
80 if test -z "${AUTOMAKE}" ||
test -n "${AUTOMAKEPATH}"; then
81 AUTOMAKE
="${AUTOMAKEPATH}automake"
83 if test -z "${AUTORECONF}" ||
test -n "${AUTOCONFPATH}"; then
84 AUTORECONF
="${AUTOCONFPATH}autoreconf"
87 # If you didn't set GETTEXTPATH, you can also set the variable AUTOPOINT.
88 if test -z "${AUTOPOINT}" ||
test -n "${GETTEXTPATH}"; then
89 AUTOPOINT
="${GETTEXTPATH}autopoint"
92 # If you didn't set LIBTOOLPATH, you can also set the variable LIBTOOLIZE.
93 if test -z "${LIBTOOLIZE}" ||
test -n "${LIBTOOLPATH}"; then
94 LIBTOOLIZE
="${LIBTOOLPATH}libtoolize"
98 if test -z "${MAKE}"; then
102 # When using GNU sed, turn off as many GNU extensions as possible,
103 # to minimize the risk of accidentally using non-portable features.
104 # However, do this only for gnulib-tool itself, not for the code that
105 # gnulib-tool generates, since we don't want "sed --posix" to leak
106 # into makefiles. And do it only for sed versions 4.2 or newer,
107 # because "sed --posix" is buggy in GNU sed 4.1.5, see
108 # <https://lists.gnu.org/r/bug-gnulib/2009-02/msg00225.html>.
109 if (alias) > /dev
/null
2>&1 \
110 && echo |
sed --posix -e d
>/dev
/null
2>&1 \
111 && case `sed --version | sed -e 's/^[^0-9]*//' -e 1q` in \
112 [1-3]* |
4.
[01]*) false
;; \
116 # Define sed as an alias.
117 # It is not always possible to use aliases. Aliases are guaranteed to work
118 # if the executing shell is bash and either it is invoked as /bin/sh or
119 # is a version >= 2.0, supporting shopt. This is the common case.
120 # Two other approaches (use of a variable $sed or of a function func_sed
121 # instead of an alias) require massive, fragile code changes.
122 # An other approach (use of function sed) requires `which sed` - but
123 # 'which' is hard to emulate, due to missing "test -x" on some platforms.
124 if test -n "$BASH_VERSION"; then
125 shopt -s expand_aliases
>/dev
/null
2>&1
127 alias sed='sed --posix'
130 # sed_noop is a sed expression that does nothing.
131 # An empty expression does not work with the native 'sed' on AIX 6.1.
134 # sed_comments is true or false, depending whether 'sed' supports comments.
135 # AIX 5.3 sed barfs over indented comments.
136 if echo fo |
sed -e 's/f/g/
139 s/o/e/' 2>/dev
/null |
grep ge
> /dev
/null
; then
146 # outputs to stdout the --help usage message.
150 Usage: gnulib-tool --list
151 gnulib-tool --find filename
152 gnulib-tool --import [module1 ... moduleN]
153 gnulib-tool --add-import [module1 ... moduleN]
154 gnulib-tool --remove-import [module1 ... moduleN]
156 gnulib-tool --create-testdir --dir=directory [module1 ... moduleN]
157 gnulib-tool --create-megatestdir --dir=directory [module1 ... moduleN]
158 gnulib-tool --test --dir=directory [module1 ... moduleN]
159 gnulib-tool --megatest --dir=directory [module1 ... moduleN]
160 gnulib-tool --extract-description module
161 gnulib-tool --extract-comment module
162 gnulib-tool --extract-status module
163 gnulib-tool --extract-notice module
164 gnulib-tool --extract-applicability module
165 gnulib-tool --extract-filelist module
166 gnulib-tool --extract-dependencies module
167 gnulib-tool --extract-recursive-dependencies module
168 gnulib-tool --extract-autoconf-snippet module
169 gnulib-tool --extract-automake-snippet module
170 gnulib-tool --extract-include-directive module
171 gnulib-tool --extract-link-directive module
172 gnulib-tool --extract-recursive-link-directive module
173 gnulib-tool --extract-license module
174 gnulib-tool --extract-maintainer module
175 gnulib-tool --extract-tests-module module
176 gnulib-tool --copy-file file [destination]
180 --list print the available module names
181 --find find the modules which contain the specified file
182 --import import the given modules into the current package
183 --add-import augment the list of imports from gnulib into the
184 current package, by adding the given modules;
185 if no modules are specified, update the current
186 package from the current gnulib
187 --remove-import reduce the list of imports from gnulib into the
188 current package, by removing the given modules
189 --update update the current package, restore files omitted
191 --create-testdir create a scratch package with the given modules
192 --create-megatestdir create a mega scratch package with the given modules
193 one by one and all together
194 --test test the combination of the given modules
195 (recommended to use CC=\"gcc -Wall\" here)
196 --megatest test the given modules one by one and all together
197 (recommended to use CC=\"gcc -Wall\" here)
198 --extract-description extract the description
199 --extract-comment extract the comment
200 --extract-status extract the status (obsolete etc.)
201 --extract-notice extract the notice or banner
202 --extract-applicability extract the applicability
203 --extract-filelist extract the list of files
204 --extract-dependencies extract the dependencies
205 --extract-recursive-dependencies extract the dependencies of the module
206 and its dependencies, recursively, all
207 together, but without the conditions
208 --extract-autoconf-snippet extract the snippet for configure.ac
209 --extract-automake-snippet extract the snippet for library makefile
210 --extract-include-directive extract the #include directive
211 --extract-link-directive extract the linker directive
212 --extract-recursive-link-directive extract the linker directive of the
213 module and its dependencies,
214 recursively, all together
215 --extract-license report the license terms of the source files
217 --extract-maintainer report the maintainer(s) inside gnulib
218 --extract-tests-module report the unit test module, if it exists
219 --copy-file copy a file that is not part of any module
220 --help Show this help text.
221 --version Show version and authorship information.
225 --dir=DIRECTORY Specify the target directory.
226 For --import, this specifies where your
227 configure.ac can be found. Defaults to current
229 --local-dir=DIRECTORY Specify a local override directory where to look
230 up files before looking in gnulib's directory.
231 --verbose Increase verbosity. May be repeated.
232 --quiet Decrease verbosity. May be repeated.
234 Options for --import, --add/remove-import, --update:
236 --dry-run Only print what would have been done.
238 Options for --import, --add/remove-import:
240 --with-tests Include unit tests for the included modules.
242 Options for --create-[mega]testdir, --[mega]test:
244 --without-tests Don't include unit tests for the included modules.
246 Options for --import, --add/remove-import,
247 --create-[mega]testdir, --[mega]test:
249 --with-obsolete Include obsolete modules when they occur among the
250 dependencies. By default, dependencies to obsolete
252 --with-c++-tests Include even unit tests for C++ interoperability.
253 --without-c++-tests Exclude unit tests for C++ interoperability.
254 --with-longrunning-tests
255 Include even unit tests that are long-runners.
256 --without-longrunning-tests
257 Exclude unit tests that are long-runners.
258 --with-privileged-tests
259 Include even unit tests that require root
261 --without-privileged-tests
262 Exclude unit tests that require root privileges.
263 --with-unportable-tests
264 Include even unit tests that fail on some platforms.
265 --without-unportable-tests
266 Exclude unit tests that fail on some platforms.
267 --with-all-tests Include all kinds of problematic unit tests.
268 --avoid=MODULE Avoid including the given MODULE. Useful if you
269 have code that provides equivalent functionality.
270 This option can be repeated.
271 --conditional-dependencies
272 Support conditional dependencies (may save configure
273 time and object code).
274 --no-conditional-dependencies
275 Don't use conditional dependencies.
276 --libtool Use libtool rules.
277 --no-libtool Don't use libtool rules.
279 Options for --import, --add/remove-import:
281 --lib=LIBRARY Specify the library name. Defaults to 'libgnu'.
282 --source-base=DIRECTORY
283 Directory relative to --dir where source code is
284 placed (default \"lib\").
285 --m4-base=DIRECTORY Directory relative to --dir where *.m4 macros are
286 placed (default \"m4\").
287 --po-base=DIRECTORY Directory relative to --dir where *.po files are
288 placed (default \"po\").
289 --doc-base=DIRECTORY Directory relative to --dir where doc files are
290 placed (default \"doc\").
291 --tests-base=DIRECTORY
292 Directory relative to --dir where unit tests are
293 placed (default \"tests\").
294 --aux-dir=DIRECTORY Directory relative to --dir where auxiliary build
295 tools are placed (default comes from configure.ac).
296 --gnu-make Output for GNU Make instead of for the default
298 --lgpl[=2|=3orGPLv2|=3]
299 Abort if modules aren't available under the LGPL.
300 Also modify license template from GPL to LGPL.
301 The version number of the LGPL can be specified;
302 the default is currently LGPLv3.
303 --makefile-name=NAME Name of makefile in the source-base and tests-base
304 directories (default \"Makefile.am\", or
305 \"Makefile.in\" if --gnu-make).
306 --tests-makefile-name=NAME
307 Name of makefile in the tests-base directory
308 (default as specified through --makefile-name).
309 --automake-subdir Specify that the makefile in the source-base
310 directory be generated in such a way that it can
311 be 'include'd from the toplevel Makefile.am.
312 --automake-subdir-tests
313 Likewise, but for the tests directory.
314 --macro-prefix=PREFIX Specify the prefix of the macros 'gl_EARLY' and
315 'gl_INIT'. Default is 'gl'.
316 --po-domain=NAME Specify the prefix of the i18n domain. Usually use
317 the package name. A suffix '-gnulib' is appended.
318 --witness-c-macro=NAME Specify the C macro that is defined when the
319 sources in this directory are compiled or used.
320 --vc-files Update version control related files.
321 --no-vc-files Don't update version control related files
322 (.gitignore and/or .cvsignore).
324 Options for --create-[mega]testdir, --[mega]test:
326 --single-configure Generate a single configure file, not a separate
327 configure file for the tests directory.
329 Options for --import, --add/remove-import, --update,
330 --create-[mega]testdir, --[mega]test:
332 -s, --symbolic, --symlink Make symbolic links instead of copying files.
333 --local-symlink Make symbolic links instead of copying files, only
334 for files from the local override directory.
335 -h, --hardlink Make hard links instead of copying files.
336 --local-hardlink Make hard links instead of copying files, only
337 for files from the local override directory.
339 Options for --import, --add/remove-import, --update:
341 -S, --more-symlinks Deprecated; equivalent to --symlink.
342 -H, --more-hardlinks Deprecated; equivalent to --hardlink.
344 Report bugs to <bug-gnulib@gnu.org>."
348 # outputs to stdout the --version message.
352 if test -d "$gnulib_dir"/.git \
353 && (git
--version) >/dev
/null
2>/dev
/null \
354 && (date --version) >/dev
/null
2>/dev
/null
; then
355 # gnulib checked out from git.
356 sed_extract_first_date
='/^Date/{
360 date=`cd "$gnulib_dir" && git log -n 1 --format=medium --date=iso ChangeLog | sed -n -e "$sed_extract_first_date"`
361 # Use GNU date to compute the time in GMT.
362 date=`date -d "$date" -u +"%Y-%m-%d %H:%M:%S"`
363 version
=' '`cd "$gnulib_dir" && ./build-aux/git-version-gen /dev/null | sed -e 's/-dirty/-modified/'`
365 # gnulib copy without versioning information.
366 date=`sed -e 's/ .*//;q' "$gnulib_dir"/ChangeLog`
369 year
=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed -e 's,^.* ,,'`
371 gnulib-tool (GNU $package $date)$version
372 Copyright (C) $year Free Software Foundation, Inc.
373 License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
374 This is free software: you are free to change and redistribute it.
375 There is NO WARRANTY, to the extent permitted by law.
377 printf "Written by %s, %s, and %s.\n" "Bruno Haible" "Paul Eggert" "Simon Josefsson"
380 # func_emit_copyright_notice
381 # outputs to stdout a header for a generated file.
382 func_emit_copyright_notice
()
384 sed -n -e '/Copyright/ {
387 }' < "$self_abspathname"
389 echo "# This file is free software; you can redistribute it and/or modify"
390 echo "# it under the terms of the GNU General Public License as published by"
391 echo "# the Free Software Foundation, either version 3 of the License, or"
392 echo "# (at your option) any later version."
394 echo "# This file is distributed in the hope that it will be useful,"
395 echo "# but WITHOUT ANY WARRANTY; without even the implied warranty of"
396 echo "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
397 echo "# GNU General Public License for more details."
399 echo "# You should have received a copy of the GNU General Public License"
400 echo "# along with this file. If not, see <https://www.gnu.org/licenses/>."
402 echo "# As a special exception to the GNU General Public License,"
403 echo "# this file may be distributed as part of a program that"
404 echo "# contains a configuration script generated by Autoconf, under"
405 echo "# the same distribution terms as the rest of that program."
407 echo "# Generated by gnulib-tool."
411 # exits with a given status.
412 # This function needs to be used, rather than 'exit', when a 'trap' handler is
413 # in effect that refers to $?.
419 # func_fatal_error message
420 # outputs to stderr a fatal error message, and terminates the program.
422 # - progname name of this program
425 echo "$progname: *** $1" 1>&2
426 echo "$progname: *** Stop." 1>&2
430 # func_warning message
431 # Outputs to stderr a warning message,
434 echo "gnulib-tool: warning: $1" 1>&2
437 # func_readlink SYMLINK
438 # outputs the target of the given symlink.
439 if (type readlink
) > /dev
/null
2>&1; then
442 # Use the readlink program from GNU coreutils.
448 # Use two sed invocations. A single sed -n -e 's,^.* -> \(.*\)$,\1,p'
449 # would do the wrong thing if the link target contains " -> ".
450 LC_ALL
=C
ls -l "$1" |
sed -e 's, -> ,#%%#,' |
sed -n -e 's,^.*#%%#\(.*\)$,\1,p'
455 # locates the directory where the gnulib repository lives
457 # - progname name of this program
459 # - self_abspathname absolute pathname of gnulib-tool
460 # - gnulib_dir absolute pathname of gnulib repository
464 /* | ?
:*) self_abspathname
="$progname" ;;
465 */*) self_abspathname
=`pwd`/"$progname" ;;
468 # Iterate through the elements of $PATH.
469 # We use IFS=: instead of
470 # for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'`
471 # because the latter does not work when some PATH element contains spaces.
472 # We use a canonicalized $pathx instead of $PATH, because empty PATH
473 # elements are by definition equivalent to '.', however field splitting
474 # according to IFS=: loses empty fields in many shells:
475 # - /bin/sh on OSF/1 and Solaris loses all empty fields (at the
476 # beginning, at the end, and in the middle),
477 # - /bin/sh on IRIX and /bin/ksh on IRIX and OSF/1 lose empty fields
478 # at the beginning and at the end,
479 # - GNU bash, /bin/sh on AIX and HP-UX, and /bin/ksh on AIX, HP-UX,
480 # Solaris lose empty fields at the end.
481 # The 'case' statement is an optimization, to avoid evaluating the
482 # explicit canonicalization command when $PATH contains no empty fields.
484 if test "$PATH_SEPARATOR" = ";"; then
485 # On Windows, programs are searched in "." before $PATH.
488 # On Unix, we have to convert empty PATH elements to ".".
492 pathx
=`echo ":$PATH:" | sed -e 's/:::*/:.:/g' -e 's/^://' -e 's/:\$//'`
497 IFS
="$PATH_SEPARATOR"
501 if test -x "$d/$progname" && test ! -d "$d/$progname"; then
502 self_abspathname
="$d/$progname"
507 if test -z "$self_abspathname"; then
508 func_fatal_error
"could not locate the gnulib-tool program - how did you invoke it?"
512 while test -h "$self_abspathname"; do
513 # Resolve symbolic link.
514 linkval
=`func_readlink "$self_abspathname"`
515 test -n "$linkval" ||
break
517 /* | ?
:* ) self_abspathname
="$linkval" ;;
518 * ) self_abspathname
=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;;
521 gnulib_dir
=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
525 # creates a temporary directory.
527 # - progname name of this program
529 # - tmp pathname of freshly created temporary directory
532 # Use the environment variable TMPDIR, falling back to /tmp. This allows
533 # users to specify a different temporary directory, for example, if their
534 # /tmp is filled up or too small.
537 # Use the mktemp program if available. If not available, hide the error
539 tmp
=`(umask 077 && mktemp -d "$TMPDIR/glXXXXXX") 2>/dev/null` &&
540 test -n "$tmp" && test -d "$tmp"
543 # Use a simple mkdir command. It is guaranteed to fail if the directory
544 # already exists. $RANDOM is bash specific and expands to empty in shells
545 # other than bash, ksh and zsh. Its use does not increase security;
546 # rather, it minimizes the probability of failure in a very cluttered /tmp
548 tmp
=$TMPDIR/gl$$
-$RANDOM
549 (umask 077 && mkdir
"$tmp")
552 echo "$progname: cannot create a temporary directory in $TMPDIR" >&2
557 # func_append var value
558 # appends the given value to the shell variable var.
559 if ( foo
=bar
; foo
+=baz
&& test "$foo" = barbaz
) >/dev
/null
2>&1; then
560 # Use bash's += operator. It reduces complexity of appending repeatedly to
561 # a single variable from O(n^2) to O(n).
566 fast_func_append
=true
570 eval "$1=\"\$$1\$2\""
572 fast_func_append
=false
575 # func_remove_prefix var prefix
576 # removes the given prefix from the value of the shell variable var.
577 # var should be the name of a shell variable.
578 # Its value should not contain a newline and not start or end with whitespace.
579 # prefix should not contain the characters "$`\{}[]^|.
580 if ( foo
=bar
; eval 'test "${foo#b}" = ar' ) >/dev
/null
2>&1; then
581 func_remove_prefix
()
585 fast_func_remove_prefix
=true
587 func_remove_prefix
()
589 eval "value=\"\$$1\""
593 sed_escape_dots
='s/\([.]\)/\\\1/g'
594 prefix
=`echo "$prefix" | sed -e "$sed_escape_dots"`
597 value
=`echo "$value" | sed -e "s|^${prefix}||"`
598 eval "$1=\"\$value\""
600 fast_func_remove_prefix
=false
603 # Determine whether we should use ':' or ';' as PATH_SEPARATOR.
604 func_determine_path_separator
()
606 if test "${PATH_SEPARATOR+set}" != set; then
607 # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
608 # contains only /bin. Note that ksh looks also at the FPATH variable,
609 # so we have to set that as well for the test.
611 (PATH
='/bin;/bin'; FPATH
=$PATH; sh
-c :) >/dev
/null
2>&1 \
612 && { (PATH
='/bin:/bin'; FPATH
=$PATH; sh
-c :) >/dev
/null
2>&1 \
613 || PATH_SEPARATOR
=';'
618 # func_path_append pathvar directory
619 # appends directory to pathvar, delimiting directories by PATH_SEPARATOR.
622 if eval "test -n \"\$$1\""; then
623 func_append
"$1" "$PATH_SEPARATOR$2"
629 # func_path_foreach_inner
630 # helper for func_path_foreach because we need new 'args' array
632 # - fpf_dir directory from local_gnulib_path
633 # - fpf_cb callback to be run for fpf_dir
634 func_path_foreach_inner
()
656 # func_path_foreach path method args
657 # Execute method for each directory in path. The method will be called
658 # like `method args` while any argument '%dir%' within args will be replaced
659 # with processed directory from path.
667 IFS
="$PATH_SEPARATOR"
668 for fpf_dir
in $fpf_dirs
671 func_path_foreach_inner
"$@" && fpf_rc
=:
677 # func_remove_suffix var suffix
678 # removes the given suffix from the value of the shell variable var.
679 # var should be the name of a shell variable.
680 # Its value should not contain a newline and not start or end with whitespace.
681 # suffix should not contain the characters "$`\{}[]^|.
682 if ( foo
=bar
; eval 'test "${foo%r}" = ba' ) >/dev
/null
2>&1; then
683 func_remove_suffix
()
687 fast_func_remove_suffix
=true
689 func_remove_suffix
()
691 eval "value=\"\$$1\""
695 sed_escape_dots
='s/\([.]\)/\\\1/g'
696 suffix
=`echo "$suffix" | sed -e "$sed_escape_dots"`
699 value
=`echo "$value" | sed -e "s|${suffix}\$||"`
700 eval "$1=\"\$value\""
702 fast_func_remove_suffix
=false
705 # func_relativize DIR1 DIR2
706 # computes a relative pathname RELDIR such that DIR1/RELDIR = DIR2.
708 # - DIR1 relative pathname, relative to the current directory
709 # - DIR2 relative pathname, relative to the current directory
711 # - reldir relative pathname of DIR2, relative to DIR1
717 sed_first
='s,^\([^/]*\)/.*$,\1,'
718 sed_rest
='s,^[^/]*/*,,'
719 sed_last
='s,^.*/\([^/]*\)$,\1,'
720 sed_butlast
='s,/*[^/]*$,,'
721 while test -n "$dir1"; do
722 first
=`echo "$dir1" | sed -e "$sed_first"`
723 if test "$first" != "."; then
724 if test "$first" = ".."; then
725 dir2
=`echo "$dir0" | sed -e "$sed_last"`/"$dir2"
726 dir0
=`echo "$dir0" | sed -e "$sed_butlast"`
728 first2
=`echo "$dir2" | sed -e "$sed_first"`
729 if test "$first2" = "$first"; then
730 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
734 dir0
="$dir0"/"$first"
737 dir1
=`echo "$dir1" | sed -e "$sed_rest"`
742 # func_relconcat DIR1 DIR2
743 # computes a relative pathname DIR1/DIR2, with obvious simplifications.
745 # - DIR1 relative pathname, relative to the current directory
746 # - DIR2 relative pathname, relative to DIR1
748 # - relconcat DIR1/DIR2, relative to the current directory
753 sed_first
='s,^\([^/]*\)/.*$,\1,'
754 sed_rest
='s,^[^/]*/*,,'
755 sed_last
='s,^.*/\([^/]*\)$,\1,'
756 sed_butlast
='s,/*[^/]*$,,'
758 first
=`echo "$dir2" | sed -e "$sed_first"`
759 if test "$first" = "."; then
760 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
761 if test -z "$dir2"; then
766 last
=`echo "$dir1" | sed -e "$sed_last"`
767 while test "$last" = "."; do
768 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
769 last
=`echo "$dir1" | sed -e "$sed_last"`
771 if test -z "$dir1"; then
775 if test "$first" = ".."; then
776 if test "$last" = ".."; then
777 relconcat
="$dir1/$dir2"
780 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
781 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
782 if test -z "$dir1"; then
786 if test -z "$dir2"; then
791 relconcat
="$dir1/$dir2"
798 # func_ensure_writable DEST
799 # Ensures the file DEST is writable.
800 func_ensure_writable
()
802 test -w "$1" ||
chmod u
+w
"$1"
806 # Like ln -s, except use cp -p if ln -s fails.
810 echo "$progname: ln -s failed; falling back on cp -p" >&2
813 /* | ?
:*) # SRC is absolute.
815 *) # SRC is relative to the directory of DEST.
817 */*) cp_src
="${2%/*}/$1" ;;
824 func_ensure_writable
"$2"
828 # func_symlink_target SRC DEST
829 # Determines LINK_TARGET such that "ln -s LINK_TARGET DEST" will create a
830 # symbolic link DEST that points to SRC.
832 # - link_target link target, relative to the directory of DEST
833 func_symlink_target
()
838 *) # SRC is relative.
841 link_target
="`pwd`/$1" ;;
842 *) # DEST is relative too.
843 ln_destdir
=`echo "$2" | sed -e 's,[^/]*$,,'`
844 test -n "$ln_destdir" || ln_destdir
="."
845 func_relativize
"$ln_destdir" "$1"
846 link_target
="$reldir"
853 # func_symlink SRC DEST
854 # Like func_ln_s, except that SRC is given relative to the current directory (or
855 # absolute), not given relative to the directory of DEST.
858 func_symlink_target
"$1" "$2"
859 func_ln_s
"$link_target" "$2"
862 # func_symlink_if_changed SRC DEST
863 # Like func_symlink, but avoids munging timestamps if the link is correct.
864 # SRC is given relative to the current directory (or absolute).
865 func_symlink_if_changed
()
867 if test $# -ne 2; then
868 echo "usage: func_symlink_if_changed SRC DEST" >&2
870 func_symlink_target
"$1" "$2"
871 ln_target
=`func_readlink "$2"`
872 if test -h "$2" && test "$link_target" = "$ln_target"; then
876 func_ln_s
"$link_target" "$2"
880 # func_hardlink SRC DEST
881 # Like ln, except use cp -p if ln fails.
882 # SRC is given relative to the current directory (or absolute).
886 echo "$progname: ln failed; falling back on cp -p" >&2
888 func_ensure_writable
"$2"
892 # Ensure an 'echo' command that
893 # 1. does not interpret backslashes and
894 # 2. does not print an error message "broken pipe" when writing into a pipe
897 # Test cases for problem 1:
898 # echo '\n' | wc -l prints 1 when OK, 2 when KO
899 # echo '\t' | grep t > /dev/null has return code 0 when OK, 1 when KO
900 # Test cases for problem 2:
901 # echo hi | true frequently prints
902 # "bash: echo: write error: Broken pipe"
903 # to standard error in bash 3.2.
905 # Problem 1 is a weird heritage from SVR4. BSD got it right (except that
906 # BSD echo interprets '-n' as an option, which is also not desirable).
907 # Nowadays the problem occurs in 4 situations:
908 # - in bash, when the shell option xpg_echo is set (bash >= 2.04)
909 # or when it was built with --enable-usg-echo-default (bash >= 2.0)
910 # or when it was built with DEFAULT_ECHO_TO_USG (bash < 2.0),
911 # - in zsh, when sh-emulation is not set,
912 # - in ksh (e.g. AIX /bin/sh and Solaris /usr/xpg4/bin/sh are ksh instances,
913 # and HP-UX /bin/sh and IRIX /bin/sh behave similarly),
914 # - in Solaris /bin/sh and OSF/1 /bin/sh.
915 # We try the following workarounds:
916 # - for all: respawn using $CONFIG_SHELL if that is set and works.
917 # - for bash >= 2.04: unset the shell option xpg_echo.
918 # - for bash >= 2.0: define echo to a function that uses the printf built-in.
919 # - for bash < 2.0: define echo to a function that uses cat of a here document.
920 # - for zsh: turn sh-emulation on.
921 # - for ksh: alias echo to 'print -r'.
922 # - for ksh: alias echo to a function that uses cat of a here document.
923 # - for Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh and rely on
924 # the ksh workaround.
925 # - otherwise: respawn using /bin/sh and rely on the workarounds.
926 # When respawning, we pass --no-reexec as first argument, so as to avoid
927 # turning this script into a fork bomb in unlucky situations.
929 # Problem 2 is specific to bash 3.2 and affects the 'echo' built-in, but not
930 # the 'printf' built-in. See
931 # <https://lists.gnu.org/r/bug-bash/2008-12/msg00050.html>
932 # <https://lists.gnu.org/r/bug-gnulib/2010-02/msg00154.html>
933 # The workaround is: define echo to a function that uses the printf built-in.
935 if echo '\t' |
grep t
> /dev
/null
; then
936 have_echo
=yes # Lucky!
938 # Try the workarounds.
939 # Respawn using $CONFIG_SHELL if that is set and works.
940 if test -z "$have_echo" \
941 && test "X$1" != "X--no-reexec" \
942 && test -n "$CONFIG_SHELL" \
943 && test -f "$CONFIG_SHELL" \
944 && $CONFIG_SHELL -c "echo '\\t' | grep t > /dev/null"; then
945 exec $CONFIG_SHELL "$0" --no-reexec "$@"
948 # For bash >= 2.04: unset the shell option xpg_echo.
949 if test -z "$have_echo" \
950 && test -n "$BASH_VERSION" \
951 && (shopt -o xpg_echo
; echo '\t' |
grep t
> /dev
/null
) 2>/dev
/null
; then
955 # For bash >= 2.0: define echo to a function that uses the printf built-in.
956 # For bash < 2.0: define echo to a function that uses cat of a here document.
957 # (There is no win in using 'printf' over 'cat' if it is not a shell built-in.)
958 # Also handle problem 2, specific to bash 3.2, here.
959 if { test -z "$have_echo" \
960 ||
case "$BASH_VERSION" in 3.2*) true
;; *) false
;; esac; \
962 && test -n "$BASH_VERSION"; then \
963 if type printf 2>/dev
/null |
grep / > /dev
/null
; then
964 # 'printf' is not a shell built-in.
972 # 'printf' is a shell built-in.
978 if echo '\t' |
grep t
> /dev
/null
; then
982 # For zsh: turn sh-emulation on.
983 if test -z "$have_echo" \
984 && test -n "$ZSH_VERSION" \
985 && (emulate sh
) >/dev
/null
2>&1; then
988 # For ksh: alias echo to 'print -r'.
989 if test -z "$have_echo" \
990 && (type print
) >/dev
/null
2>&1; then
991 # A 'print' command exists.
992 if type print
2>/dev
/null |
grep / > /dev
/null
; then
995 # 'print' is a shell built-in.
996 if (print
-r '\told' |
grep told
> /dev
/null
) 2>/dev
/null
; then
997 # 'print' is the ksh shell built-in.
998 alias echo='print -r'
1002 if test -z "$have_echo" \
1003 && echo '\t' |
grep t
> /dev
/null
; then
1006 # For ksh: alias echo to a function that uses cat of a here document.
1007 # The ksh manual page says:
1008 # "Aliasing is performed when scripts are read, not while they are executed.
1009 # Therefore, for an alias to take effect, the alias definition command has
1010 # to be executed before the command which references the alias is read."
1011 # Because of this, we have to play strange tricks with have_echo, to ensure
1012 # that the top-level statement containing the test starts after the 'alias'
1014 if test -z "$have_echo"; then
1021 if (alias echo=bsd_echo
) 2>/dev
/null
; then
1022 alias echo=bsd_echo
2>/dev
/null
1025 if test -z "$have_echo" \
1026 && echo '\t' |
grep t
> /dev
/null
; then
1029 if test -z "$have_echo"; then
1030 if (alias echo=bsd_echo
) 2>/dev
/null
; then
1031 unalias echo 2>/dev
/null
1034 # For Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh.
1035 if test -z "$have_echo" \
1036 && test "X$1" != "X--no-reexec" \
1037 && test -f /bin
/ksh
; then
1038 exec /bin
/ksh
"$0" --no-reexec "$@"
1041 # Otherwise: respawn using /bin/sh.
1042 if test -z "$have_echo" \
1043 && test "X$1" != "X--no-reexec" \
1044 && test -f /bin
/sh
; then
1045 exec /bin
/sh
"$0" --no-reexec "$@"
1048 if test -z "$have_echo"; then
1049 func_fatal_error
"Shell does not support 'echo' correctly. Please install GNU bash and set the environment variable CONFIG_SHELL to point to it."
1051 if echo '\t' |
grep t
> /dev
/null
; then
1054 func_fatal_error
"Shell does not support 'echo' correctly. Workaround does not work. Please report this as a bug to bug-gnulib@gnu.org."
1056 if test "X$1" = "X--no-reexec"; then
1062 trap 'exit_status=$?
1063 if test "$signal" != EXIT; then
1064 echo "caught signal SIG$signal" >&2
1067 exit $exit_status' EXIT
1068 for signal
in HUP INT QUIT PIPE TERM
; do
1069 trap '{ signal='$signal'; func_exit 1; }' $signal
1073 # The 'join' program does not exist on all platforms (e.g. Alpine Linux), and
1074 # on macOS 12.6, FreeBSD 14.0, NetBSD 9.3 it is buggy, see
1075 # <https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=232405>.
1076 # Search for a working 'join' program, by trying $JOIN, join, gjoin,
1078 echo a
> "$tmp"/join-input-1
1079 { echo; echo a
; } > "$tmp"/join-input-2
1080 if test -n "$JOIN" \
1081 && LC_ALL
=C
$JOIN "$tmp"/join-input-1
"$tmp"/join-input-2
>/dev
/null \
1082 && LC_ALL
=C
$JOIN "$tmp"/join-input-1
"$tmp"/join-input-2 |
grep a
>/dev
/null \
1083 && LC_ALL
=C
$JOIN "$tmp"/join-input-2
"$tmp"/join-input-1 |
grep a
>/dev
/null
; then
1086 if (type join) >/dev
/null
2>&1 \
1087 && LC_ALL
=C
join "$tmp"/join-input-1
"$tmp"/join-input-2 |
grep a
>/dev
/null \
1088 && LC_ALL
=C
join "$tmp"/join-input-2
"$tmp"/join-input-1 |
grep a
>/dev
/null
; then
1091 if (type gjoin
) >/dev
/null
2>&1 \
1092 && LC_ALL
=C gjoin
"$tmp"/join-input-1
"$tmp"/join-input-2 |
grep a
>/dev
/null \
1093 && LC_ALL
=C gjoin
"$tmp"/join-input-2
"$tmp"/join-input-1 |
grep a
>/dev
/null
; then
1096 if (type join) >/dev
/null
2>&1; then
1097 echo "$progname: 'join' program is buggy. Consider installing GNU coreutils." >&2
1100 echo "$progname: 'join' program not found. Consider installing GNU coreutils." >&2
1107 # Unset CDPATH. Otherwise, output from 'cd dir' can surprise callers.
1108 (unset CDPATH
) >/dev
/null
2>&1 && unset CDPATH
1110 # Determine the path separator early because the following option parsing code
1112 func_determine_path_separator
1114 # Command-line option processing.
1115 # Removes the OPTIONS from the arguments. Sets the variables:
1116 # - mode one of: list, find, import, add-import, remove-import,
1117 # update, create-testdir, create-megatestdir, test, megatest,
1119 # - destdir from --dir
1120 # - local_gnulib_path from --local-dir, highest priority dir comes first
1121 # - modcache true or false, from --cache-modules/--no-cache-modules
1122 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
1123 # - libname, supplied_libname from --lib
1124 # - sourcebase from --source-base
1125 # - m4base from --m4-base
1126 # - pobase from --po-base
1127 # - docbase from --doc-base
1128 # - testsbase from --tests-base
1129 # - auxdir from --aux-dir
1130 # - inctests true if --with-tests was given, false if --without-tests
1131 # was given, blank otherwise
1132 # - incobsolete true if --with-obsolete was given, blank otherwise
1133 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
1134 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
1136 # - inc_privileged_tests true if --with-privileged-tests was given, blank
1138 # - inc_unportable_tests true if --with-unportable-tests was given, blank
1140 # - inc_all_tests true if --with-all-tests was given, blank otherwise
1141 # - excl_cxx_tests true if --without-c++-tests was given, blank otherwise
1142 # - excl_longrunning_tests true if --without-longrunning-tests was given,
1144 # - excl_privileged_tests true if --without-privileged-tests was given, blank
1146 # - excl_unportable_tests true if --without-unportable-tests was given, blank
1148 # - single_configure true if --single-configure was given, false otherwise
1149 # - avoidlist list of modules to avoid, from --avoid
1150 # - cond_dependencies true if --conditional-dependencies was given, false if
1151 # --no-conditional-dependencies was given, blank otherwise
1152 # - lgpl yes or a number if --lgpl was given, blank otherwise
1153 # - gnu_make true if --gnu-make was given, false otherwise
1154 # - makefile_name from --makefile-name
1155 # - tests_makefile_name from --tests-makefile-name
1156 # - automake_subdir true if --automake-subdir was given, false otherwise
1157 # - automake_subdir_tests true if --automake-subdir-tests was given, false otherwise
1158 # - libtool true if --libtool was given, false if --no-libtool was
1159 # given, blank otherwise
1160 # - macro_prefix from --macro-prefix
1161 # - po_domain from --po-domain
1162 # - witness_c_macro from --witness-c-macro
1163 # - vc_files true if --vc-files was given, false if --no-vc-files was
1164 # given, blank otherwise
1165 # - autoconf_minversion minimum supported autoconf version
1166 # - doit : if actions shall be executed, false if only to be printed
1167 # - copymode symlink if --symlink or --more-symlinks was given,
1168 # hardlink if --hardlink or --more-hardlinks was given,
1170 # - lcopymode symlink if --local-symlink was given,
1171 # hardlink if --local-hardlink was given,
1190 inc_longrunning_tests
=
1191 inc_privileged_tests
=
1192 inc_unportable_tests
=
1195 excl_longrunning_tests
=
1196 excl_privileged_tests
=
1197 excl_unportable_tests
=
1198 single_configure
=false
1204 tests_makefile_name
=
1205 automake_subdir
=false
1206 automake_subdir_tests
=false
1216 while test $# -gt 0; do
1221 --find |
--fin |
--fi |
--f )
1224 --import |
--impor |
--impo |
--imp |
--im |
--i )
1227 --add-import |
--add-impor |
--add-impo |
--add-imp |
--add-im |
--add-i |
--add- |
--add |
--ad )
1230 --remove-import |
--remove-impor |
--remove-impo |
--remove-imp |
--remove-im |
--remove-i |
--remove- |
--remove |
--remov |
--remo |
--rem |
--re |
--r )
1233 --update |
--updat |
--upda |
--upd |
--up |
--u )
1236 --create-testdir |
--create-testdi |
--create-testd |
--create-test |
--create-tes |
--create-te |
--create-t )
1239 --create-megatestdir |
--create-megatestdi |
--create-megatestd |
--create-megatest |
--create-megates |
--create-megate |
--create-megat |
--create-mega |
--create-meg |
--create-me |
--create-m )
1240 mode
=create-megatestdir
1242 --test |
--tes |
--te |
--t )
1245 --megatest |
--megates |
--megate |
--megat |
--mega |
--meg |
--me |
--m )
1249 mode
=`echo "X$1" | sed -e 's/^X--//'`
1251 --copy-file |
--copy-fil |
--copy-fi |
--copy-f |
--copy- |
--copy |
--cop )
1256 if test $# = 0; then
1257 func_fatal_error
"missing argument for --dir"
1262 destdir
=`echo "X$1" | sed -e 's/^X--dir=//'`
1266 if test $# = 0; then
1267 func_fatal_error
"missing argument for --local-dir"
1269 func_path_append local_gnulib_path
"$1"
1272 local_dir
=`echo "X$1" | sed -e 's/^X--local-dir=//'`
1273 func_path_append local_gnulib_path
"$local_dir"
1275 --cache-modules |
--cache-module |
--cache-modul |
--cache-modu |
--cache-mod |
--cache-mo |
--cache-m |
--cache- |
--cache |
--cach |
--cac |
--ca )
1278 --no-cache-modules |
--no-cache-module |
--no-cache-modul |
--no-cache-modu |
--no-cache-mod |
--no-cache-mo |
--no-cache-m |
--no-cache- |
--no-cache |
--no-cach |
--no-cac |
--no-ca )
1281 --verbose |
--verbos |
--verbo |
--verb )
1282 verbose
=`expr $verbose + 1`
1284 --quiet |
--quie |
--qui |
--qu |
--q )
1285 verbose
=`expr $verbose - 1`
1289 if test $# = 0; then
1290 func_fatal_error
"missing argument for --lib"
1293 supplied_libname
=true
1296 libname
=`echo "X$1" | sed -e 's/^X--lib=//'`
1297 supplied_libname
=true
1301 if test $# = 0; then
1302 func_fatal_error
"missing argument for --source-base"
1307 sourcebase
=`echo "X$1" | sed -e 's/^X--source-base=//'`
1311 if test $# = 0; then
1312 func_fatal_error
"missing argument for --m4-base"
1317 m4base
=`echo "X$1" | sed -e 's/^X--m4-base=//'`
1321 if test $# = 0; then
1322 func_fatal_error
"missing argument for --po-base"
1327 pobase
=`echo "X$1" | sed -e 's/^X--po-base=//'`
1331 if test $# = 0; then
1332 func_fatal_error
"missing argument for --doc-base"
1337 docbase
=`echo "X$1" | sed -e 's/^X--doc-base=//'`
1341 if test $# = 0; then
1342 func_fatal_error
"missing argument for --tests-base"
1347 testsbase
=`echo "X$1" | sed -e 's/^X--tests-base=//'`
1351 if test $# = 0; then
1352 func_fatal_error
"missing argument for --aux-dir"
1357 auxdir
=`echo "X$1" | sed -e 's/^X--aux-dir=//'`
1359 --with-tests |
--with-test |
--with-tes |
--with-te |
--with-t)
1362 --with-obsolete |
--with-obsolet |
--with-obsole |
--with-obsol |
--with-obso |
--with-obs |
--with-ob |
--with-o)
1365 --with-c++-tests |
--with-c++-test |
--with-c++-tes |
--with-c++-te |
--with-c++-t |
--with-c++- |
--with-c++ |
--with-c+ |
--with-c)
1368 --with-longrunning-tests |
--with-longrunning-test |
--with-longrunning-tes |
--with-longrunning-te |
--with-longrunning-t |
--with-longrunning- |
--with-longrunning |
--with-longrunnin |
--with-longrunni |
--with-longrunn |
--with-longrun |
--with-longru |
--with-longr |
--with-long |
--with-lon |
--with-lo |
--with-l)
1369 inc_longrunning_tests
=true
1371 --with-privileged-tests |
--with-privileged-test |
--with-privileged-tes |
--with-privileged-te |
--with-privileged-t |
--with-privileged- |
--with-privileged |
--with-privilege |
--with-privileg |
--with-privile |
--with-privil |
--with-privi |
--with-priv |
--with-pri |
--with-pr |
--with-p)
1372 inc_privileged_tests
=true
1374 --with-unportable-tests |
--with-unportable-test |
--with-unportable-tes |
--with-unportable-te |
--with-unportable-t |
--with-unportable- |
--with-unportable |
--with-unportabl |
--with-unportab |
--with-unporta |
--with-unport |
--with-unpor |
--with-unpo |
--with-unp |
--with-un |
--with-u)
1375 inc_unportable_tests
=true
1377 --with-all-tests |
--with-all-test |
--with-all-tes |
--with-all-te |
--with-all-t |
--with-all- |
--with-all |
--with-al |
--with-a)
1380 --without-tests |
--without-test |
--without-tes |
--without-te |
--without-t)
1383 --without-c++-tests |
--without-c++-test |
--without-c++-tes |
--without-c++-te |
--without-c++-t |
--without-c++- |
--without-c++ |
--without-c+ |
--without-c)
1386 --without-longrunning-tests |
--without-longrunning-test |
--without-longrunning-tes |
--without-longrunning-te |
--without-longrunning-t |
--without-longrunning- |
--without-longrunning |
--without-longrunnin |
--without-longrunni |
--without-longrunn |
--without-longrun |
--without-longru |
--without-longr |
--without-long |
--without-lon |
--without-lo |
--without-l)
1387 excl_longrunning_tests
=true
1389 --without-privileged-tests |
--without-privileged-test |
--without-privileged-tes |
--without-privileged-te |
--without-privileged-t |
--without-privileged- |
--without-privileged |
--without-privilege |
--without-privileg |
--without-privile |
--without-privil |
--without-privi |
--without-priv |
--without-pri |
--without-pr |
--without-p)
1390 excl_privileged_tests
=true
1392 --without-unportable-tests |
--without-unportable-test |
--without-unportable-tes |
--without-unportable-te |
--without-unportable-t |
--without-unportable- |
--without-unportable |
--without-unportabl |
--without-unportab |
--without-unporta |
--without-unport |
--without-unpor |
--without-unpo |
--without-unp |
--without-un |
--without-u)
1393 excl_unportable_tests
=true
1395 --single-configure |
--single-configur |
--single-configu |
--single-config |
--single-confi |
--single-conf |
--single-con |
--single-co |
--single-c |
--single- |
--single |
--singl |
--sing |
--sin |
--si)
1396 single_configure
=true
1400 if test $# = 0; then
1401 func_fatal_error
"missing argument for --avoid"
1403 if test -z "$avoidlist"; then
1406 func_append avoidlist
" $1"
1410 arg
=`echo "X$1" | sed -e 's/^X--avoid=//'`
1411 if test -z "$avoidlist"; then
1414 func_append avoidlist
" $arg"
1417 --conditional-dependencies |
--conditional-dependencie |
--conditional-dependenci |
--conditional-dependenc |
--conditional-dependen |
--conditional-depende |
--conditional-depend |
--conditional-depen |
--conditional-depe |
--conditional-dep |
--conditional-de |
--conditional-d |
--conditional- |
--conditional |
--conditiona |
--condition |
--conditio |
--conditi |
--condit |
--condi |
--cond |
--con)
1418 cond_dependencies
=true
1420 --no-conditional-dependencies |
--no-conditional-dependencie |
--no-conditional-dependenci |
--no-conditional-dependenc |
--no-conditional-dependen |
--no-conditional-depende |
--no-conditional-depend |
--no-conditional-depen |
--no-conditional-depe |
--no-conditional-dep |
--no-conditional-de |
--no-conditional-d |
--no-conditional- |
--no-conditional |
--no-conditiona |
--no-condition |
--no-conditio |
--no-conditi |
--no-condit |
--no-condi |
--no-cond |
--no-con |
--no-co)
1421 cond_dependencies
=false
1427 arg
=`echo "X$1" | sed -e 's/^X--lgpl=//'`
1429 2 |
3orGPLv2 |
3) ;;
1430 *) func_fatal_error
"invalid LGPL version number for --lgpl" ;;
1439 if test $# = 0; then
1440 func_fatal_error
"missing argument for --makefile-name"
1445 makefile_name
=`echo "X$1" | sed -e 's/^X--makefile-name=//'`
1447 --tests-makefile-name )
1449 if test $# = 0; then
1450 func_fatal_error
"missing argument for --tests-makefile-name"
1452 tests_makefile_name
="$1"
1454 --tests-makefile-name=* )
1455 tests_makefile_name
=`echo "X$1" | sed -e 's/^X--tests-makefile-name=//'`
1458 automake_subdir
=true
1460 --automake-subdir-tests )
1461 automake_subdir_tests
=true
1471 if test $# = 0; then
1472 func_fatal_error
"missing argument for --macro-prefix"
1477 macro_prefix
=`echo "X$1" | sed -e 's/^X--macro-prefix=//'`
1481 if test $# = 0; then
1482 func_fatal_error
"missing argument for --po-domain"
1487 po_domain
=`echo "X$1" | sed -e 's/^X--po-domain=//'`
1491 if test $# = 0; then
1492 func_fatal_error
"missing argument for --witness-c-macro"
1494 witness_c_macro
="$1"
1496 --witness-c-macro=* )
1497 witness_c_macro
=`echo "X$1" | sed -e 's/^X--witness-c-macro=//'`
1505 --no-changelog |
--no-changelo |
--no-changel |
--no-change |
--no-chang |
--no-chan |
--no-cha |
--no-ch )
1506 # A no-op for backward compatibility.
1511 -s |
--symbolic |
--symboli |
--symbol |
--symbo |
--symb |
--symlink |
--symlin |
--symli |
--syml |
--sym |
--sy )
1514 --local-symlink |
--local-symlin |
--local-symli |
--local-syml |
--local-sym |
--local-sy |
--local-s )
1517 -h |
--hardlink |
--hardlin |
--hardli |
--hardl |
--hard |
--har |
--ha )
1520 --local-hardlink |
--local-hardlin |
--local-hardli |
--local-hardl |
--local-hard |
--local-har |
--local-ha |
--local-h )
1523 -S |
--more-symlinks |
--more-symlink |
--more-symlin |
--more-symli |
--more-syml |
--more-sym |
--more-sy |
--more-s )
1526 -H |
--more-hardlinks |
--more-hardlink |
--more-hardlin |
--more-hardli |
--more-hardl |
--more-hard |
--more-har |
--more-ha |
--more-h )
1529 --help |
--hel |
--he )
1532 --version |
--versio |
--versi |
--vers )
1535 # Undocumented option. Only used for the gnulib-tool test suite.
1537 gnulib_dir
=`echo "X$1" | sed -e 's/^X--gnulib-dir=//'`
1538 gnulib_dir
=`cd "$gnulib_dir" && pwd`
1541 # Stop option processing
1545 echo "gnulib-tool: unknown option $1" 1>&2
1546 echo "Try 'gnulib-tool --help' for more information." 1>&2
1553 if case "$mode" in import | add-import | remove-import
) true
;; *) false
;; esac; then
1554 if test -n "$excl_cxx_tests" ||
test -n "$excl_longrunning_tests" \
1555 ||
test -n "$excl_privileged_tests" ||
test -n "$excl_unportable_tests" \
1556 ||
test "$single_configure" != false
; then
1557 echo "gnulib-tool: invalid options for '$mode' mode" 1>&2
1558 echo "Try 'gnulib-tool --help' for more information." 1>&2
1562 if test "$mode" = update
; then
1563 if test $# != 0; then
1564 echo "gnulib-tool: too many arguments in 'update' mode" 1>&2
1565 echo "Try 'gnulib-tool --help' for more information." 1>&2
1566 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1567 echo "you need to use 'gnulib-tool --import' - at your own risk!" 1>&2
1570 if test -n "$local_gnulib_path" ||
test -n "$supplied_libname" \
1571 ||
test -n "$sourcebase" ||
test -n "$m4base" ||
test -n "$pobase" \
1572 ||
test -n "$docbase" ||
test -n "$testsbase" ||
test -n "$auxdir" \
1573 ||
test -n "$inctests" ||
test -n "$incobsolete" \
1574 ||
test -n "$inc_cxx_tests" ||
test -n "$inc_longrunning_tests" \
1575 ||
test -n "$inc_privileged_tests" ||
test -n "$inc_unportable_tests" \
1576 ||
test -n "$inc_all_tests" \
1577 ||
test -n "$excl_cxx_tests" ||
test -n "$excl_longrunning_tests" \
1578 ||
test -n "$excl_privileged_tests" ||
test -n "$excl_unportable_tests" \
1579 ||
test -n "$avoidlist" ||
test -n "$lgpl" ||
test -n "$makefile_name" \
1580 ||
test -n "$tests_makefile_name" ||
test "$automake_subdir" != false \
1581 ||
test "$automake_subdir_tests" != false \
1582 ||
test -n "$macro_prefix" ||
test -n "$po_domain" \
1583 ||
test -n "$witness_c_macro" ||
test -n "$vc_files"; then
1584 echo "gnulib-tool: invalid options for 'update' mode" 1>&2
1585 echo "Try 'gnulib-tool --help' for more information." 1>&2
1586 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1587 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1591 if test -n "$pobase" && test -z "$po_domain"; then
1592 echo "gnulib-tool: together with --po-base, you need to specify --po-domain" 1>&2
1593 echo "Try 'gnulib-tool --help' for more information." 1>&2
1596 if test -z "$pobase" && test -n "$po_domain"; then
1597 func_warning
"--po-domain has no effect without a --po-base option"
1599 case $mode,$gnu_make in
1601 echo "gnulib-tool: --gnu-make not supported when including tests"
1604 # Canonicalize the inctests variable.
1606 import | add-import | remove-import | update
)
1607 if test -z "$inctests"; then
1611 create-testdir | create-megatestdir |
test | megatest
)
1612 if test -z "$inctests"; then
1617 # Now the only possible values of "$inctests" are true and false
1618 # (or blank but then it is irrelevant).
1620 # Determine the minimum supported autoconf version from the project's
1622 DEFAULT_AUTOCONF_MINVERSION
="2.64"
1623 autoconf_minversion
=
1625 if case "$mode" in import | add-import | remove-import | update
) true
;; *) false
;; esac \
1626 && test -n "$destdir"; then
1627 if test -f "$destdir"/configure.ac
; then
1628 configure_ac
="$destdir/configure.ac"
1630 if test -f "$destdir"/configure.
in; then
1631 configure_ac
="$destdir/configure.in"
1635 if test -f configure.ac
; then
1636 configure_ac
="configure.ac"
1638 if test -f configure.
in; then
1639 configure_ac
="configure.in"
1643 if test -n "$configure_ac"; then
1644 # Use sed, not autoconf --trace, to look for the AC_PREREQ invocation,
1645 # because when some m4 files are omitted from a version control repository,
1646 # "autoconf --trace=AC_PREREQ" fails with an error message like this:
1647 # m4: aclocal.m4:851: Cannot open m4/absolute-header.m4: No such file or directory
1648 # autom4te: m4 failed with exit status: 1
1654 s,^.*AC_PREREQ([[ ]*\([^])]*\).*$,\1,p
1656 prereqs
=`sed -n -e "$my_sed_traces" < "$configure_ac"`
1657 if test -n "$prereqs"; then
1658 autoconf_minversion
=`
1659 for version in $prereqs; do echo $version; done |
1660 LC_ALL=C sort -nru | sed -e 1q
1664 if test -z "$autoconf_minversion"; then
1665 autoconf_minversion
=$DEFAULT_AUTOCONF_MINVERSION
1667 case "$autoconf_minversion" in
1668 1.
* |
2.
[0-5]* |
2.6[0-3]*)
1669 func_fatal_error
"minimum supported autoconf version is 2.64. Try adding AC_PREREQ([$DEFAULT_AUTOCONF_MINVERSION]) to your configure.ac." ;;
1672 # Determine whether --automake-subdir/--automake-subdir-tests are supported.
1673 if $automake_subdir ||
$automake_subdir_tests; then
1674 found_subdir_objects
=false
1675 if test -n "$configure_ac"; then
1680 /AM_INIT_AUTOMAKE/ {
1681 s,^.*AM_INIT_AUTOMAKE([[ ]*\([^])]*\).*$,\1,p
1683 automake_options
=`sed -n -e "$my_sed_traces" < "$configure_ac"`
1684 for option
in $automake_options; do
1686 subdir-objects
) found_subdir_objects
=true
;;
1690 if test -f "${destdir:-.}"/Makefile.am
; then
1691 automake_options
=`sed -n -e 's/^AUTOMAKE_OPTIONS[ ]*=\(.*\)$/\1/p' "${destdir:-.}"/Makefile.am`
1692 for option
in $automake_options; do
1694 subdir-objects
) found_subdir_objects
=true
;;
1698 if ! $found_subdir_objects; then
1699 func_fatal_error
"Option --automake-subdir/--automake-subdir-tests are only supported if the definition of AUTOMAKE_OPTIONS in Makefile.am contains 'subdir-objects'."
1703 # Remove trailing slashes from the directory names. This is necessary for
1704 # m4base (to avoid an error in func_import) and optional for the others.
1705 sed_trimtrailingslashes
='s,\([^/]\)//*$,\1,'
1706 old_local_gnulib_path
="$local_gnulib_path"
1710 for dir
in $old_local_gnulib_path
1714 */ ) dir
=`echo "$dir" | sed -e "$sed_trimtrailingslashes"` ;;
1716 func_path_append local_gnulib_path
"$dir"
1719 case "$sourcebase" in
1720 */ ) sourcebase
=`echo "$sourcebase" | sed -e "$sed_trimtrailingslashes"` ;;
1723 */ ) m4base
=`echo "$m4base" | sed -e "$sed_trimtrailingslashes"` ;;
1726 */ ) pobase
=`echo "$pobase" | sed -e "$sed_trimtrailingslashes"` ;;
1729 */ ) docbase
=`echo "$docbase" | sed -e "$sed_trimtrailingslashes"` ;;
1731 case "$testsbase" in
1732 */ ) testsbase
=`echo "$testsbase" | sed -e "$sed_trimtrailingslashes"` ;;
1735 */ ) auxdir
=`echo "$auxdir" | sed -e "$sed_trimtrailingslashes"` ;;
1739 # Note: The 'eval' silences stderr output in dash.
1740 if (declare -A x
&& { x
[f
/2]='foo'; x
[f
/3]='bar'; eval test '${x[f/2]}' = foo
; }) 2>/dev
/null
; then
1741 # Zsh 4 and Bash 4 have associative arrays.
1742 have_associative
=true
1744 # For other shells, use 'eval' with computed shell variable names.
1745 have_associative
=false
1748 # func_lookup_local_file_cb dir file
1749 # returns true and sets func_lookup_local_file_result if the file $dir/$file
1751 func_lookup_local_file_cb
()
1753 test -n "$func_lookup_local_file_result" && return 1 # already found?
1754 test -f "$1/$2" ||
return 1
1755 func_lookup_local_file_result
=$1/$2
1759 # func_lookup_local_file file
1760 # looks up a file in $local_gnulib_path.
1762 # - local_gnulib_path from --local-dir
1764 # - func_lookup_local_file_result name of the file, valid only when the
1765 # function succeeded.
1766 func_lookup_local_file
()
1768 func_lookup_local_file_result
=
1769 func_path_foreach
"$local_gnulib_path" func_lookup_local_file_cb
%dir
% "$1"
1772 # func_lookup_file_cb dir
1773 # does one step in processing the $local_gnulib_path, looking for $dir/$lkfile
1774 # and $dir/$lkfile.diff.
1775 func_lookup_file_cb
()
1777 # If we found the file already in a --local-dir of higher priority, nothing
1779 if test -z "$lookedup_file"; then
1780 # Otherwise, look for $dir/$lkfile and $dir/$lkfile.diff.
1781 if test -f "$1/$lkfile"; then
1782 lookedup_file
="$1/$lkfile"
1784 if test -f "$1/$lkfile.diff"; then
1785 lkpatches
="$1/$lkfile.diff${lkpatches:+$PATH_SEPARATOR$lkpatches}"
1791 # func_lookup_file file
1792 # looks up a file in $local_gnulib_path or $gnulib_dir, or combines it through
1795 # - local_gnulib_path from --local-dir
1797 # - lookedup_file name of the merged (combined) file
1798 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
1802 # Each element in $local_gnulib_path is a directory whose contents overrides
1803 # or amends the result of the lookup in the rest of $local_gnulib_path and
1804 # $gnulib_dir. So, the first element of $local_gnulib_path is the highest
1808 func_path_foreach
"$local_gnulib_path" func_lookup_file_cb
%dir
%
1809 # Treat $gnulib_dir like a lowest-priority --local-dir, except that here we
1810 # don't look for .diff files.
1811 if test -z "$lookedup_file"; then
1812 if test -f "$gnulib_dir/$lkfile"; then
1813 lookedup_file
="$gnulib_dir/$lkfile"
1815 func_fatal_error
"file $gnulib_dir/$lkfile not found"
1818 # Now apply the patches, from lowest-priority to highest-priority.
1820 if test -n "$lkpatches"; then
1821 lkbase
=`echo "$lkfile" | sed -e 's,^.*/,,'`
1822 rm -f "$tmp/$lkbase"
1823 cp "$lookedup_file" "$tmp/$lkbase"
1824 func_ensure_writable
"$tmp/$lkbase"
1826 IFS
="$PATH_SEPARATOR"
1827 for patchfile
in $lkpatches; do
1829 patch -s "$tmp/$lkbase" < "$patchfile" >&2 \
1830 || func_fatal_error
"patch file $patchfile didn't apply cleanly"
1833 lookedup_file
="$tmp/$lkbase"
1838 # func_sanitize_modulelist
1839 # receives a list of possible module names on standard input, one per line.
1840 # It removes those which are just file names unrelated to modules, and outputs
1841 # the resulting list to standard output, one per line.
1842 func_sanitize_modulelist
()
1844 sed -e '/^ChangeLog$/d' -e '/\/ChangeLog$/d' \
1845 -e '/^COPYING$/d' -e '/\/COPYING$/d' \
1846 -e '/^README$/d' -e '/\/README$/d' \
1847 -e '/^TEMPLATE$/d' \
1848 -e '/^TEMPLATE-EXTENDED$/d' \
1849 -e '/^TEMPLATE-TESTS$/d' \
1857 # func_modules_in_dir dir
1858 # outputs all module files in dir to standard output.
1859 func_modules_in_dir
()
1861 (test -d "$1" && cd "$1" && find modules
-type f
-print)
1866 # - local_gnulib_path from --local-dir
1869 # Filter out metainformation files like README, which are not modules.
1870 # Filter out unit test modules; they can be retrieved through
1871 # --extract-tests-module if desired.
1873 (cd "$gnulib_dir" && find modules
-type f
-print |
sed -e 's,^modules/,,')
1874 func_path_foreach
"$local_gnulib_path" func_modules_in_dir
%dir
% |
sed -e 's,^modules/,,' -e 's,\.diff$,,'
1876 | func_sanitize_modulelist \
1877 |
sed -e '/-tests$/d' \
1881 # func_exists_local_module dir module
1882 # returns true if module exists in dir
1883 func_exists_local_module
()
1885 test -d "$1/modules" && test -f "$1/modules/$2";
1888 # func_exists_module module
1889 # tests whether a module, given by name, exists
1891 # - local_gnulib_path from --local-dir
1892 func_exists_module
()
1894 { test -f "$gnulib_dir/modules/$1" \
1895 || func_path_foreach
"$local_gnulib_path" func_exists_local_module
%dir
% "$1" ; } \
1896 && test "ChangeLog" != "$1" \
1897 && test "COPYING" != "$1" \
1898 && test "README" != "$1" \
1899 && test "TEMPLATE" != "$1" \
1900 && test "TEMPLATE-EXTENDED" != "$1" \
1901 && test "TEMPLATE-TESTS" != "$1"
1904 # func_verify_module
1905 # verifies a module name
1907 # - local_gnulib_path from --local-dir
1908 # - module module name argument
1910 # - module unchanged if OK, empty if not OK
1911 # - lookedup_file if OK: name of the merged (combined) module description file
1912 # - lookedup_tmp if OK: true if it is located in the tmp directory, blank otherwise
1913 func_verify_module
()
1915 if func_exists_module
"$module"; then
1916 # OK, $module is a correct module name.
1917 # Verify that building the module description with 'patch' succeeds.
1918 func_lookup_file
"modules/$module"
1920 func_warning
"module $module doesn't exist"
1925 # func_verify_nontests_module
1926 # verifies a module name, excluding tests modules
1928 # - local_gnulib_path from --local-dir
1929 # - module module name argument
1930 func_verify_nontests_module
()
1933 *-tests ) module
= ;;
1934 * ) func_verify_module
;;
1938 # Suffix of a sed expression that extracts a particular field from a
1939 # module description.
1940 # A field starts with a line that contains a keyword, such as 'Description',
1941 # followed by a colon and optional whitespace. All following lines, up to
1942 # the next field (or end of file if there is none) form the contents of the
1944 # An absent field is equivalent to a field with empty contents.
1945 # NOTE: Keep this in sync with sed_extract_cache_prog below!
1946 sed_extract_prog
=':[ ]*$/ {
1949 s/^Description:[ ]*$//
1953 s/^Applicability:[ ]*$//
1955 s/^Depends-on:[ ]*$//
1956 s/^configure\.ac-early:[ ]*$//
1957 s/^configure\.ac:[ ]*$//
1958 s/^Makefile\.am:[ ]*$//
1962 s/^Maintainer:[ ]*$//
1969 # Piece of a sed expression that converts a field header line to a shell
1971 # NOTE: Keep this in sync with sed_extract_prog above!
1972 sed_extract_field_header
='
1973 s/^Description:[ ]*$/description/
1974 s/^Comment:[ ]*$/comment/
1975 s/^Status:[ ]*$/status/
1976 s/^Notice:[ ]*$/notice/
1977 s/^Applicability:[ ]*$/applicability/
1978 s/^Files:[ ]*$/files/
1979 s/^Depends-on:[ ]*$/dependson/
1980 s/^configure\.ac-early:[ ]*$/configureac_early/
1981 s/^configure\.ac:[ ]*$/configureac/
1982 s/^Makefile\.am:[ ]*$/makefile/
1983 s/^Include:[ ]*$/include/
1985 s/^License:[ ]*$/license/
1986 s/^Maintainer:[ ]*$/maintainer/'
1990 if $have_associative; then
1992 # Declare the associative arrays.
1993 declare -A modcache_cached
1994 sed_to_declare_statement
='s|^.*/\([a-zA-Z0-9_]*\)/$|declare -A modcache_\1|p'
1995 declare_script
=`echo "$sed_extract_field_header" | sed -n -e "$sed_to_declare_statement"`
1996 eval "$declare_script"
2000 # func_cache_var module
2001 # computes the cache variable name corresponding to $module.
2002 # Note: This computation can map different module names to the same
2003 # cachevar (such as 'foo-bar', 'foo_bar', or 'foo/bar'); the caller has
2004 # to protect against this case.
2006 # - cachevar a shell variable name
2007 if (f
=foo
; eval echo '${f//o/e}') < /dev
/null
2>/dev
/null |
grep fee
>/dev
/null
; then
2008 # Bash 2.0 and newer, ksh, and zsh support the syntax
2009 # ${param//pattern/replacement}
2010 # as a shorthand for
2011 # `echo "$param" | sed -e "s/pattern/replacement/g"`.
2012 # Note: The 'eval' is necessary for dash and NetBSD /bin/sh.
2013 eval 'func_cache_var ()
2015 cachevar=c_${1//[!a-zA-Z0-9_]/_}
2022 cachevar
=c_
`echo "$1" | LC_ALL=C sed -e 's/[^a-zA-Z0-9_]/_/g'` ;;
2031 # func_init_sed_convert_to_cache_statements
2033 # - modcachevar_assignment
2035 # - sed_convert_to_cache_statements
2036 func_init_sed_convert_to_cache_statements
()
2038 # 'sed' script that turns a module description into shell script
2039 # assignments, suitable to be eval'ed. All active characters are escaped.
2042 # Some module's description
2047 # modcache_description[$1]=\
2048 # 'Some module'"'"'s description
2050 # modcache_files[$1]=\
2053 # c_MODULE_description_set=set; c_MODULE_description=\
2054 # 'Some module'"'"'s description
2056 # c_MODULE_files_set=set; c_MODULE_files=\
2058 # The script consists of two parts:
2059 # 1) Ignore the lines before the first field header.
2060 # 2) A loop, treating non-field-header lines by escaping single quotes
2061 # and adding a closing quote in the last line,
2062 sed_convert_to_cache_statements
="
2064 # Here we have not yet seen a field header.
2066 # See if the current line contains a field header.
2069 ${sed_extract_field_header}
2072 # No field header. Ignore the line.
2074 # Read the next line. Upon EOF, just exit.
2079 # The current line contains a field header.
2081 # Turn it into the beginning of an assignment.
2082 s/^\\(.*\\)\$/${modcachevar_assignment}\\\\/
2084 # Move it to the hold space. Don't print it yet,
2085 # because we want no assignment if the field is empty.
2088 # Read the next line.
2089 # Upon EOF, the field was empty. Print no assignment. Just exit.
2092 # See if the current line contains a field header.
2095 ${sed_extract_field_header}
2096 # If it is, the previous field was empty. Print no assignment.
2099 # Not a field header.
2101 # Print the previous line, held in the hold space.
2106 # Transform single quotes.
2109 # Prepend a single quote.
2114 # Move it to the hold space.
2117 # Read the next line.
2124 # See if the current line contains a field header.
2127 ${sed_extract_field_header}
2130 # Print the previous line, held in the hold space.
2135 # Transform single quotes.
2142 # Print the previous line, held in the hold space, with a single quote
2143 # to end the assignment.
2153 # Print the previous line, held in the hold space, with a single quote
2154 # to end the assignment.
2161 if ! $sed_comments; then
2163 sed_convert_to_cache_statements
=`echo "$sed_convert_to_cache_statements" \
2164 | sed -e 's/^ *//' -e 's/^#.*//'`
2168 if $have_associative; then
2169 # sed_convert_to_cache_statements does not depend on the module.
2170 modcachevar_assignment
='modcache_\1[$1]='
2171 func_init_sed_convert_to_cache_statements
2174 # func_cache_lookup_module module
2176 # looks up a module, like 'func_lookup_file modules/$module', and stores all
2177 # of its relevant data in a cache in the memory of the processing shell. If
2178 # already cached, it does not look it up again, thus saving file access time.
2180 # - module non-empty string
2181 # Output if $have_associative:
2182 # - modcache_cached[$module] set to yes
2183 # - modcache_description[$module] ==
2184 # - modcache_status[$module] \ set to the field's value, minus the
2185 # - ... / final newline,
2186 # - modcache_maintainer[$module] == or unset if the field's value is empty
2187 # Output if ! $have_associative:
2188 # - cachevar a shell variable name
2189 # - ${cachevar}_cached set to $module
2190 # - ${cachevar}_description ==
2191 # - ${cachevar}_status \ set to the field's value, minus the
2192 # - ... / final newline,
2193 # - ${cachevar}_maintainer == or unset if the field's value is empty
2194 # - ${cachevar}_description_set ==
2195 # - ${cachevar}_status_set \ set to non-empty if the field's value
2196 # - ... / is non-empty,
2197 # - ${cachevar}_maintainer_set == or unset if the field's value is empty
2198 func_cache_lookup_module
()
2200 if $have_associative; then
2201 eval 'cached=${modcache_cached[$1]}'
2204 eval "cached=\"\$${cachevar}_cached\""
2206 if test -z "$cached"; then
2207 # Not found in cache. Look it up on the file system.
2208 func_lookup_file
"modules/$1"
2209 if $have_associative; then
2210 eval 'modcache_cached[$1]=yes'
2212 eval "${cachevar}_cached=\"\$1\""
2214 if ! $have_associative; then
2215 # sed_convert_to_cache_statements depends on the module.
2216 modcachevar_assignment
="${cachevar}"'_\1_set=set; '"${cachevar}"'_\1='
2217 func_init_sed_convert_to_cache_statements
2219 cache_statements
=`LC_ALL=C sed -n -e "$sed_convert_to_cache_statements" < "$lookedup_file"`
2220 eval "$cache_statements"
2222 if ! $have_associative; then
2223 if test "$1" != "$cached"; then
2224 func_fatal_error
"cache variable collision between $1 and $cached"
2232 # func_get_description module
2234 # - local_gnulib_path from --local-dir
2235 # - modcache true or false, from --cache-modules/--no-cache-modules
2236 func_get_description
()
2238 if ! $modcache; then
2239 func_lookup_file
"modules/$1"
2240 sed -n -e "/^Description$sed_extract_prog" < "$lookedup_file"
2242 func_cache_lookup_module
"$1"
2243 # Output the field's value, including the final newline (if any).
2244 if $have_associative; then
2245 if eval 'test -n "${modcache_description[$1]+set}"'; then
2246 eval 'echo "${modcache_description[$1]}"'
2249 eval "field_set=\"\$${cachevar}_description_set\""
2250 if test -n "$field_set"; then
2251 eval "field_value=\"\$${cachevar}_description\""
2252 echo "${field_value}"
2258 # func_get_comment module
2260 # - local_gnulib_path from --local-dir
2261 # - modcache true or false, from --cache-modules/--no-cache-modules
2264 if ! $modcache; then
2265 func_lookup_file
"modules/$1"
2266 sed -n -e "/^Comment$sed_extract_prog" < "$lookedup_file"
2268 func_cache_lookup_module
"$1"
2269 # Output the field's value, including the final newline (if any).
2270 if $have_associative; then
2271 if eval 'test -n "${modcache_comment[$1]+set}"'; then
2272 eval 'echo "${modcache_comment[$1]}"'
2275 eval "field_set=\"\$${cachevar}_comment_set\""
2276 if test -n "$field_set"; then
2277 eval "field_value=\"\$${cachevar}_comment\""
2278 echo "${field_value}"
2284 # func_get_status module
2286 # - local_gnulib_path from --local-dir
2287 # - modcache true or false, from --cache-modules/--no-cache-modules
2290 if ! $modcache; then
2291 func_lookup_file
"modules/$1"
2292 sed -n -e "/^Status$sed_extract_prog" < "$lookedup_file"
2294 func_cache_lookup_module
"$1"
2295 # Output the field's value, including the final newline (if any).
2296 if $have_associative; then
2297 if eval 'test -n "${modcache_status[$1]+set}"'; then
2298 eval 'echo "${modcache_status[$1]}"'
2301 eval "field_set=\"\$${cachevar}_status_set\""
2302 if test -n "$field_set"; then
2303 eval "field_value=\"\$${cachevar}_status\""
2304 echo "${field_value}"
2310 # func_get_notice module
2312 # - local_gnulib_path from --local-dir
2313 # - modcache true or false, from --cache-modules/--no-cache-modules
2316 if ! $modcache; then
2317 func_lookup_file
"modules/$1"
2318 sed -n -e "/^Notice$sed_extract_prog" < "$lookedup_file"
2320 func_cache_lookup_module
"$1"
2321 # Output the field's value, including the final newline (if any).
2322 if $have_associative; then
2323 if eval 'test -n "${modcache_notice[$1]+set}"'; then
2324 eval 'echo "${modcache_notice[$1]}"'
2327 eval "field_set=\"\$${cachevar}_notice_set\""
2328 if test -n "$field_set"; then
2329 eval "field_value=\"\$${cachevar}_notice\""
2330 echo "${field_value}"
2336 # func_get_applicability module
2338 # - local_gnulib_path from --local-dir
2339 # - modcache true or false, from --cache-modules/--no-cache-modules
2340 # The expected result (on stdout) is either 'main', or 'tests', or 'all'.
2341 func_get_applicability
()
2343 if ! $modcache; then
2344 func_lookup_file
"modules/$1"
2345 my_applicability
=`sed -n -e "/^Applicability$sed_extract_prog" < "$lookedup_file"`
2347 func_cache_lookup_module
"$1"
2348 # Get the field's value, without the final newline.
2349 if $have_associative; then
2350 eval 'my_applicability="${modcache_applicability[$1]}"'
2352 eval "my_applicability=\"\$${cachevar}_applicability\""
2355 if test -n "$my_applicability"; then
2356 echo $my_applicability
2358 # The default is 'main' or 'tests', depending on the module's name.
2360 *-tests) echo "tests";;
2366 # func_get_filelist module
2368 # - local_gnulib_path from --local-dir
2369 # - modcache true or false, from --cache-modules/--no-cache-modules
2370 func_get_filelist
()
2372 if ! $modcache; then
2373 func_lookup_file
"modules/$1"
2374 sed -n -e "/^Files$sed_extract_prog" < "$lookedup_file"
2376 func_cache_lookup_module
"$1"
2377 # Output the field's value, including the final newline (if any).
2378 if $have_associative; then
2379 if eval 'test -n "${modcache_files[$1]+set}"'; then
2380 eval 'echo "${modcache_files[$1]}"'
2383 eval "field_set=\"\$${cachevar}_files_set\""
2384 if test -n "$field_set"; then
2385 eval "field_value=\"\$${cachevar}_files\""
2386 echo "${field_value}"
2392 echo m
4/gnulib-common.
m4
2395 # func_filter_filelist outputvar separator filelist prefix suffix removed_prefix removed_suffix [added_prefix [added_suffix]]
2396 # stores in outputvar the filtered and processed filelist. Filtering: Only the
2397 # elements starting with prefix and ending with suffix are considered.
2398 # Processing: removed_prefix and removed_suffix are removed from each element,
2399 # added_prefix and added_suffix are added to each element.
2400 # prefix, suffix should not contain shell-special characters.
2401 # removed_prefix, removed_suffix should not contain the characters "$`\{}[]^|.
2402 # added_prefix, added_suffix should not contain the characters \|&.
2403 func_filter_filelist
()
2405 if test "$2" != "$nl" \
2406 ||
{ $fast_func_append \
2407 && { test -z "$6" ||
$fast_func_remove_prefix; } \
2408 && { test -z "$7" ||
$fast_func_remove_suffix; }; \
2412 # Do not quote possibly-empty parameters in case patterns,
2413 # AIX and HP-UX ksh won't match them if they are empty.
2416 if test -n "$6"; then
2417 func_remove_prefix fff
"$6"
2419 if test -n "$7"; then
2420 func_remove_suffix fff
"$7"
2423 if test -z "$ffflist"; then
2426 func_append ffflist
"$2${fff}"
2432 sed_fff_filter
="s|^$6\(.*\)$7\$|$8\\1$9|"
2433 ffflist
=`for fff in $3; do
2435 $4*$5) echo "$fff" ;;
2437 done | sed -e "$sed_fff_filter"`
2439 eval "$1=\"\$ffflist\""
2442 # func_get_dependencies module
2444 # - local_gnulib_path from --local-dir
2445 # - modcache true or false, from --cache-modules/--no-cache-modules
2446 func_get_dependencies
()
2448 # ${module}-tests implicitly depends on ${module}, if that module exists.
2452 func_remove_suffix fgd1
'-tests'
2453 if func_exists_module
"$fgd1"; then
2458 # Then the explicit dependencies listed in the module description.
2459 { if ! $modcache; then
2460 func_lookup_file
"modules/$1"
2461 sed -n -e "/^Depends-on$sed_extract_prog" < "$lookedup_file"
2463 func_cache_lookup_module
"$1"
2464 # Output the field's value, including the final newline (if any).
2465 if $have_associative; then
2466 if eval 'test -n "${modcache_dependson[$1]+set}"'; then
2467 eval 'echo "${modcache_dependson[$1]}"'
2470 eval "field_set=\"\$${cachevar}_dependson_set\""
2471 if test -n "$field_set"; then
2472 eval "field_value=\"\$${cachevar}_dependson\""
2473 echo "${field_value}"
2481 sed_dependencies_without_conditions
='s/ *\[.*//'
2483 # func_get_autoconf_early_snippet module
2485 # - local_gnulib_path from --local-dir
2486 # - modcache true or false, from --cache-modules/--no-cache-modules
2487 func_get_autoconf_early_snippet
()
2489 if ! $modcache; then
2490 func_lookup_file
"modules/$1"
2491 sed -n -e "/^configure\.ac-early$sed_extract_prog" < "$lookedup_file"
2493 func_cache_lookup_module
"$1"
2494 # Output the field's value, including the final newline (if any).
2495 if $have_associative; then
2496 if eval 'test -n "${modcache_configureac_early[$1]+set}"'; then
2497 eval 'echo "${modcache_configureac_early[$1]}"'
2500 eval "field_set=\"\$${cachevar}_configureac_early_set\""
2501 if test -n "$field_set"; then
2502 eval "field_value=\"\$${cachevar}_configureac_early\""
2503 echo "${field_value}"
2509 # func_get_autoconf_snippet module
2511 # - local_gnulib_path from --local-dir
2512 # - modcache true or false, from --cache-modules/--no-cache-modules
2513 func_get_autoconf_snippet
()
2515 if ! $modcache; then
2516 func_lookup_file
"modules/$1"
2517 sed -n -e "/^configure\.ac$sed_extract_prog" < "$lookedup_file"
2519 func_cache_lookup_module
"$1"
2520 # Output the field's value, including the final newline (if any).
2521 if $have_associative; then
2522 if eval 'test -n "${modcache_configureac[$1]+set}"'; then
2523 eval 'echo "${modcache_configureac[$1]}"'
2526 eval "field_set=\"\$${cachevar}_configureac_set\""
2527 if test -n "$field_set"; then
2528 eval "field_value=\"\$${cachevar}_configureac\""
2529 echo "${field_value}"
2535 # Concatenate lines with trailing slash.
2536 # $1 is an optional filter to restrict the
2537 # concatenation to groups starting with that expression
2539 sed -e "/$1.*"'\\$/{
2548 # func_get_automake_snippet_conditional module
2549 # returns the part of the Makefile.am snippet that can be put inside Automake
2552 # - local_gnulib_path from --local-dir
2553 # - modcache true or false, from --cache-modules/--no-cache-modules
2554 func_get_automake_snippet_conditional
()
2556 if ! $modcache; then
2557 func_lookup_file
"modules/$1"
2558 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
2560 func_cache_lookup_module
"$1"
2561 # Output the field's value, including the final newline (if any).
2562 if $have_associative; then
2563 if eval 'test -n "${modcache_makefile[$1]+set}"'; then
2564 eval 'echo "${modcache_makefile[$1]}"'
2567 eval "field_set=\"\$${cachevar}_makefile_set\""
2568 if test -n "$field_set"; then
2569 eval "field_value=\"\$${cachevar}_makefile\""
2570 echo "${field_value}"
2576 # func_get_automake_snippet_unconditional module
2577 # returns the part of the Makefile.am snippet that must stay outside of
2578 # Automake conditionals.
2580 # - local_gnulib_path from --local-dir
2581 # - modcache true or false, from --cache-modules/--no-cache-modules
2582 # - auxdir directory relative to destdir where to place build aux files
2583 func_get_automake_snippet_unconditional
()
2587 # *-tests module live in tests/, not lib/.
2588 # Synthesize an EXTRA_DIST augmentation.
2589 all_files
=`func_get_filelist $1`
2590 func_filter_filelist tests_files
" " "$all_files" 'tests/' '' 'tests/' ''
2591 extra_files
="$tests_files"
2592 if test -n "$extra_files"; then
2593 echo "EXTRA_DIST +=" $extra_files
2598 # Synthesize an EXTRA_DIST augmentation.
2599 sed_extract_mentioned_files
='s/^lib_SOURCES[ ]*+=[ ]*//p'
2600 already_mentioned_files
=` \
2601 { if ! $modcache; then
2602 func_lookup_file "modules/$1"
2603 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
2605 func_cache_lookup_module "$1"
2606 if $have_associative; then
2607 if eval 'test -n "${modcache_makefile[$1]+set}"'; then
2608 eval 'echo "${modcache_makefile[$1]}"'
2611 eval 'field_set="$'"${cachevar}"'_makefile_set"'
2612 if test -n "$field_set"; then
2613 eval 'field_value="$'"${cachevar}"'_makefile"'
2614 echo "${field_value}"
2620 | sed -n -e "$sed_extract_mentioned_files" | sed -e 's/#.*//'`
2621 all_files
=`func_get_filelist $1`
2622 func_filter_filelist lib_files
"$nl" "$all_files" 'lib/' '' 'lib/' ''
2623 # Remove $already_mentioned_files from $lib_files.
2624 echo "$lib_files" | LC_ALL
=C
sort -u > "$tmp"/lib-files
2625 extra_files
=`for f in $already_mentioned_files; do echo $f; done \
2626 | LC_ALL=C sort -u | LC_ALL=C $JOIN -v 2 - "$tmp"/lib-files`
2627 if test -n "$extra_files"; then
2628 echo "EXTRA_DIST +=" $extra_files
2631 # Synthesize also an EXTRA_lib_SOURCES augmentation.
2632 # This is necessary so that automake can generate the right list of
2634 # A possible approach would be to use autom4te --trace of the redefined
2635 # AC_LIBOBJ and AC_REPLACE_FUNCS macros when creating the Makefile.am
2636 # (use autom4te --trace, not just grep, so that AC_LIBOBJ invocations
2637 # inside autoconf's built-in macros are not missed).
2638 # But it's simpler and more robust to do it here, based on the file list.
2639 # If some .c file exists and is not used with AC_LIBOBJ - for example,
2640 # a .c file is preprocessed into another .c file for BUILT_SOURCES -,
2641 # automake will generate a useless dependency; this is harmless.
2643 relocatable-prog-wrapper
) ;;
2646 func_filter_filelist extra_files
"$nl" "$extra_files" '' '.c' '' ''
2647 if test -n "$extra_files"; then
2648 echo "EXTRA_lib_SOURCES +=" $extra_files
2653 # Synthesize an EXTRA_DIST augmentation also for the files in build-aux/.
2654 func_filter_filelist buildaux_files
"$nl" "$all_files" 'build-aux/' '' 'build-aux/' ''
2655 if test -n "$buildaux_files"; then
2656 if test "$auxdir" != "."; then
2657 auxdir_subdir
="$auxdir/"
2661 sed_prepend_auxdir
='s,^,$(top_srcdir)/'"$auxdir_subdir"','
2662 echo "EXTRA_DIST += "`echo "$buildaux_files" | sed -e "$sed_prepend_auxdir"`
2669 # func_get_automake_snippet module
2671 # - local_gnulib_path from --local-dir
2672 # - modcache true or false, from --cache-modules/--no-cache-modules
2673 # - auxdir directory relative to destdir where to place build aux files
2674 func_get_automake_snippet
()
2676 func_get_automake_snippet_conditional
"$1"
2677 func_get_automake_snippet_unconditional
"$1"
2680 # func_get_include_directive module
2682 # - local_gnulib_path from --local-dir
2683 # - modcache true or false, from --cache-modules/--no-cache-modules
2684 func_get_include_directive
()
2687 if ! $modcache; then
2688 func_lookup_file
"modules/$1"
2689 sed -n -e "/^Include$sed_extract_prog" < "$lookedup_file"
2691 func_cache_lookup_module
"$1"
2692 # Output the field's value, including the final newline (if any).
2693 if $have_associative; then
2694 if eval 'test -n "${modcache_include[$1]+set}"'; then
2695 eval 'echo "${modcache_include[$1]}"'
2698 eval "field_set=\"\$${cachevar}_include_set\""
2699 if test -n "$field_set"; then
2700 eval "field_value=\"\$${cachevar}_include\""
2701 echo "${field_value}"
2705 } |
sed -e 's/^\(["<]\)/#include \1/'
2708 # func_get_link_directive module
2710 # - local_gnulib_path from --local-dir
2711 # - modcache true or false, from --cache-modules/--no-cache-modules
2712 func_get_link_directive
()
2714 if ! $modcache; then
2715 func_lookup_file
"modules/$1"
2716 sed -n -e "/^Link$sed_extract_prog" < "$lookedup_file"
2718 func_cache_lookup_module
"$1"
2719 # Output the field's value, including the final newline (if any).
2720 if $have_associative; then
2721 if eval 'test -n "${modcache_link[$1]+set}"'; then
2722 eval 'echo "${modcache_link[$1]}"'
2725 eval "field_set=\"\$${cachevar}_link_set\""
2726 if test -n "$field_set"; then
2727 eval "field_value=\"\$${cachevar}_link\""
2728 echo "${field_value}"
2734 # func_get_license_raw module
2736 # - local_gnulib_path from --local-dir
2737 # - modcache true or false, from --cache-modules/--no-cache-modules
2738 func_get_license_raw
()
2740 if ! $modcache; then
2741 func_lookup_file
"modules/$1"
2742 sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
2744 func_cache_lookup_module
"$1"
2745 # Output the field's value, including the final newline (if any).
2746 if $have_associative; then
2747 if eval 'test -n "${modcache_license[$1]+set}"'; then
2748 eval 'echo "${modcache_license[$1]}"'
2751 eval "field_set=\"\$${cachevar}_license_set\""
2752 if test -n "$field_set"; then
2753 eval "field_value=\"\$${cachevar}_license\""
2754 echo "${field_value}"
2760 # func_get_license module
2762 # - local_gnulib_path from --local-dir
2763 # - modcache true or false, from --cache-modules/--no-cache-modules
2766 # Warn if the License field is missing.
2770 license
=`func_get_license_raw "$1"`
2771 if test -z "$license"; then
2772 func_warning
"module $1 lacks a License"
2778 # These modules are under a weaker license only for the purpose of some
2779 # users who hand-edit it and don't use gnulib-tool. For the regular
2780 # gnulib users they are under a stricter license.
2785 func_get_license_raw
"$1"
2786 # The default is GPL.
2788 } |
sed -e 's,^ *$,,' |
sed -e 1q
2793 # func_get_maintainer module
2795 # - local_gnulib_path from --local-dir
2796 # - modcache true or false, from --cache-modules/--no-cache-modules
2797 func_get_maintainer
()
2799 if ! $modcache; then
2800 func_lookup_file
"modules/$1"
2801 sed -n -e "/^Maintainer$sed_extract_prog" < "$lookedup_file"
2803 func_cache_lookup_module
"$1"
2804 # Output the field's value, including the final newline (if any).
2805 if $have_associative; then
2806 if eval 'test -n "${modcache_maintainer[$1]+set}"'; then
2807 eval 'echo "${modcache_maintainer[$1]}"'
2810 eval "field_set=\"\$${cachevar}_maintainer_set\""
2811 if test -n "$field_set"; then
2812 eval "field_value=\"\$${cachevar}_maintainer\""
2813 echo "${field_value}"
2819 # func_get_tests_module module
2821 # - local_gnulib_path from --local-dir
2822 func_get_tests_module
()
2824 # The naming convention for tests modules is hardwired: ${module}-tests.
2825 if test -f "$gnulib_dir/modules/$1"-tests \
2826 || func_path_foreach
"$local_gnulib_path" func_exists_local_module
%dir
% "$1-tests"; then
2831 # func_verify_tests_module
2832 # verifies a module name, considering only tests modules and modules with
2833 # applicability 'all'.
2835 # - local_gnulib_path from --local-dir
2836 # - modcache true or false, from --cache-modules/--no-cache-modules
2837 # - module module name argument
2838 func_verify_tests_module
()
2841 if test -n "$module"; then
2842 if test `func_get_applicability $module` = main
; then
2848 # func_repeat_module_in_tests
2849 # tests whether, when the tests have their own configure.ac script, a given
2850 # module should be repeated in the tests, although it was already among the main
2853 # - module module name argument
2854 func_repeat_module_in_tests
()
2857 libtextstyle-optional
)
2858 # This module is special because it relies on a gl_LIBTEXTSTYLE_OPTIONAL
2859 # invocation that it does not itself do or require. Therefore if the
2860 # tests contain such an invocation, the module - as part of tests -
2861 # will produce different AC_SUBSTed variable values than the same module
2862 # - as part of the main configure.ac -.
2869 # func_get_dependencies_recursively module
2871 # - local_gnulib_path from --local-dir
2872 # - modcache true or false, from --cache-modules/--no-cache-modules
2873 func_get_dependencies_recursively
()
2875 # In order to process every module only once (for speed), process an "input
2876 # list" of modules, producing an "output list" of modules. During each round,
2877 # more modules can be queued in the input list. Once a module on the input
2878 # list has been processed, it is added to the "handled list", so we can avoid
2879 # to process it again.
2883 while test -n "$inmodules"; do
2884 inmodules_this_round
="$inmodules"
2885 inmodules
= # Accumulator, queue for next round
2886 for module
in $inmodules_this_round; do
2888 if test -n "$module"; then
2889 func_append outmodules
" $module"
2890 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
2891 for dep
in $deps; do
2892 func_append inmodules
" $dep"
2896 handledmodules
=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
2897 # Remove $handledmodules from $inmodules.
2898 for m
in $inmodules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/queued-modules
2899 inmodules
=`echo "$handledmodules" | LC_ALL=C $JOIN -v 2 - "$tmp"/queued-modules`
2901 rm -f "$tmp"/queued-modules
2902 for m
in $outmodules; do echo $m; done | LC_ALL
=C
sort -u
2905 # func_get_link_directive_recursively module
2907 # - local_gnulib_path from --local-dir
2908 # - modcache true or false, from --cache-modules/--no-cache-modules
2909 func_get_link_directive_recursively
()
2911 # In order to process every module only once (for speed), process an "input
2912 # list" of modules, producing an "output list" of modules. During each round,
2913 # more modules can be queued in the input list. Once a module on the input
2914 # list has been processed, it is added to the "handled list", so we can avoid
2915 # to process it again.
2919 while test -n "$inmodules"; do
2920 inmodules_this_round
="$inmodules"
2921 inmodules
= # Accumulator, queue for next round
2922 for module
in $inmodules_this_round; do
2924 if test -n "$module"; then
2925 if grep '^Link:[ ]*$' "$lookedup_file" >/dev
/null
; then
2926 # The module description has a 'Link:' field. Ignore the dependencies.
2927 func_append outmodules
" $module"
2929 # The module description has no 'Link:' field. Recurse through the dependencies.
2930 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
2931 for dep
in $deps; do
2932 func_append inmodules
" $dep"
2937 handledmodules
=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
2938 # Remove $handledmodules from $inmodules.
2939 for m
in $inmodules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/queued-modules
2940 inmodules
=`echo "$handledmodules" | LC_ALL=C $JOIN -v 2 - "$tmp"/queued-modules`
2942 rm -f "$tmp"/queued-modules
2943 for m
in $outmodules; do func_get_link_directive
"$m"; done | LC_ALL
=C
sort -u |
sed -e '/^$/d'
2946 # func_acceptable module
2947 # tests whether a module is acceptable.
2949 # - avoidlist list of modules to avoid
2952 for avoid
in $avoidlist; do
2953 if test "$avoid" = "$1"; then
2960 # sed expression to keep the first 32 characters of each line.
2961 sed_first_32_chars
='s/^\(................................\).*/\1/'
2963 # func_module_shellfunc_name module
2964 # computes the shell function name that will contain the m4 macros for the module.
2966 # - macro_prefix prefix to use
2968 # - shellfunc shell function name
2969 func_module_shellfunc_name
()
2973 shellfunc
=func_
${macro_prefix}_gnulib_m4code_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2975 shellfunc
=func_
${macro_prefix}_gnulib_m4code_
$1 ;;
2979 # func_module_shellvar_name module
2980 # computes the shell variable name the will be set to true once the m4 macros
2981 # for the module have been executed.
2983 # - shellvar shell variable name
2984 func_module_shellvar_name
()
2988 shellvar
=${macro_prefix}_gnulib_enabled_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2990 shellvar
=${macro_prefix}_gnulib_enabled_
$1 ;;
2994 # func_module_conditional_name module
2995 # computes the automake conditional name for the module.
2997 # - conditional name of automake conditional
2998 func_module_conditional_name
()
3002 conditional
=${macro_prefix}_GNULIB_ENABLED_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
3004 conditional
=${macro_prefix}_GNULIB_ENABLED_
$1 ;;
3008 # func_uncond_add_module B
3009 # notes the presence of B as an unconditional module.
3011 # func_conddep_add_module A B cond
3012 # notes the presence of a conditional dependency from module A to module B,
3013 # subject to the condition that A is enabled and cond is true.
3015 # func_cond_module_p B
3016 # tests whether module B is conditional.
3018 # func_cond_module_condition A B
3019 # returns the condition when B should be enabled as a dependency of A, once the
3020 # m4 code for A has been executed.
3021 # Output: - condition
3023 if $have_associative; then
3024 declare -A conddep_isuncond
3025 declare -A conddep_dependers
3026 declare -A conddep_condition
3027 func_uncond_add_module
()
3029 eval 'conddep_isuncond[$1]=true'
3030 eval 'unset conddep_dependers[$1]'
3032 func_conddep_add_module
()
3034 eval 'isuncond="${conddep_isuncond[$2]}"'
3035 if test -z "$isuncond"; then
3036 # No unconditional dependency to B known at this point.
3037 eval 'conddep_dependers[$2]="${conddep_dependers[$2]} $1"'
3038 eval 'conddep_condition[$1---$2]="$3"'
3041 func_cond_module_p
()
3043 eval 'previous_dependers="${conddep_dependers[$1]}"'
3044 test -n "$previous_dependers"
3046 func_cond_module_condition
()
3048 eval 'condition="${conddep_condition[$1---$2]}"'
3051 func_uncond_add_module
()
3055 suffix
=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
3059 eval 'conddep_isuncond_'"$suffix"'=true'
3060 eval 'unset conddep_dependers_'"$suffix"
3062 func_conddep_add_module
()
3066 suffix
=`echo "$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
3070 eval 'isuncond="${conddep_isuncond_'"$suffix"'}"'
3071 if test -z "$isuncond"; then
3072 eval 'conddep_dependers_'"$suffix"'="${conddep_dependers_'"$suffix"'} $1"'
3073 suffix
=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
3074 eval 'conddep_condition_'"$suffix"'="$3"'
3077 func_cond_module_p
()
3081 suffix
=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
3085 eval 'previous_dependers="${conddep_dependers_'"$suffix"'}"'
3086 test -n "$previous_dependers"
3088 func_cond_module_condition
()
3090 suffix
=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
3091 eval 'condition="${conddep_condition_'"$suffix"'}"'
3095 # func_modules_transitive_closure
3097 # - local_gnulib_path from --local-dir
3098 # - gnu_make true if --gnu-make was given, false otherwise
3099 # - modcache true or false, from --cache-modules/--no-cache-modules
3100 # - modules list of specified modules
3101 # - inctests true if tests should be included, false otherwise
3102 # - incobsolete true if obsolete modules among dependencies should be
3103 # included, blank otherwise
3104 # - inc_cxx_tests true if C++ interoperability tests should be included,
3106 # - inc_longrunning_tests true if long-runnings tests should be included,
3108 # - inc_privileged_tests true if tests that require root privileges should be
3109 # included, blank otherwise
3110 # - inc_unportable_tests true if tests that fail on some platforms should be
3111 # included, blank otherwise
3112 # - inc_all_direct_tests true if all kinds of problematic unit tests among
3113 # the unit tests of the specified modules should be
3114 # included, blank otherwise
3115 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
3116 # the unit tests of the dependencies should be
3117 # included, blank otherwise
3118 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
3120 # - excl_longrunning_tests true if long-runnings tests should be excluded,
3122 # - excl_privileged_tests true if tests that require root privileges should be
3123 # excluded, blank otherwise
3124 # - excl_unportable_tests true if tests that fail on some platforms should be
3125 # excluded, blank otherwise
3126 # - avoidlist list of modules to avoid
3127 # - cond_dependencies true if conditional dependencies shall be supported,
3129 # - tmp pathname of a temporary directory
3131 # - modules list of modules, including dependencies
3132 # - conddep_dependers, conddep_condition information about conditionally
3134 func_modules_transitive_closure
()
3136 sed_escape_dependency
='s|\([/.]\)|\\\1|g'
3137 # In order to process every module only once (for speed), process an "input
3138 # list" of modules, producing an "output list" of modules. During each round,
3139 # more modules can be queued in the input list. Once a module on the input
3140 # list has been processed, it is added to the "handled list", so we can avoid
3141 # to process it again.
3143 inmodules
="$modules"
3145 fmtc_inc_all_tests
="$inc_all_direct_tests"
3146 if test "$cond_dependencies" = true
; then
3147 for module
in $inmodules; do
3149 if test -n "$module"; then
3150 if func_acceptable
$module; then
3151 func_uncond_add_module
$module
3156 while test -n "$inmodules"; do
3157 inmodules_this_round
="$inmodules"
3158 inmodules
= # Accumulator, queue for next round
3159 for module
in $inmodules_this_round; do
3161 if test -n "$module"; then
3162 if func_acceptable
$module; then
3163 func_append outmodules
" $module"
3164 if test "$cond_dependencies" = true
; then
3165 if func_cond_module_p
$module; then
3171 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
3172 # Duplicate dependencies are harmless, but Jim wants a warning.
3173 duplicated_deps
=`echo "$deps" | LC_ALL=C sort | LC_ALL=C uniq -d`
3174 if test -n "$duplicated_deps"; then
3175 func_warning
"module $module has duplicated dependencies: "`echo $duplicated_deps`
3178 testsmodule
=`func_get_tests_module $module`
3179 if test -n "$testsmodule"; then
3180 deps
="$deps $testsmodule"
3183 for dep
in $deps; do
3184 # Determine whether to include the dependency or tests module.
3186 for word
in `func_get_status $dep`; do
3189 test -n "$incobsolete" \
3193 test -z "$excl_cxx_tests" \
3195 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_cxx_tests" \
3199 test -z "$excl_longrunning_tests" \
3201 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_longrunning_tests" \
3205 test -z "$excl_privileged_tests" \
3207 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_privileged_tests" \
3211 test -z "$excl_unportable_tests" \
3213 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_unportable_tests" \
3217 test -n "$fmtc_inc_all_tests" \
3222 if $inc && func_acceptable
"$dep"; then
3223 func_append inmodules
" $dep"
3224 if test "$cond_dependencies" = true
; then
3225 escaped_dep
=`echo "$dep" | sed -e "$sed_escape_dependency"`
3226 sed_extract_condition1
='/^ *'"$escaped_dep"' *$/{
3229 sed_extract_condition2
='/^ *'"$escaped_dep"' *\[.*] *$/{
3230 s/^ *'"$escaped_dep"' *\[\(.*\)] *$/\1/p
3232 condition
=`func_get_dependencies $module | sed -n -e "$sed_extract_condition1" -e "$sed_extract_condition2"`
3233 if test "$condition" = true
; then
3236 if test -n "$condition"; then
3237 func_conddep_add_module
"$module" "$dep" "$condition"
3239 if $conditional; then
3240 func_conddep_add_module
"$module" "$dep" true
3242 func_uncond_add_module
"$dep"
3251 handledmodules
=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
3252 # Remove $handledmodules from $inmodules.
3253 for m
in $inmodules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/queued-modules
3254 inmodules
=`echo "$handledmodules" | LC_ALL=C $JOIN -v 2 - "$tmp"/queued-modules`
3255 fmtc_inc_all_tests
="$inc_all_indirect_tests"
3257 modules
=`for m in $outmodules; do echo $m; done | LC_ALL=C sort -u`
3258 rm -f "$tmp"/queued-modules
3261 # func_show_module_list
3263 # - specified_modules list of specified modules (one per line, sorted)
3264 # - modules complete list of modules (one per line, sorted)
3265 # - tmp pathname of a temporary directory
3266 func_show_module_list
()
3268 if test -n "$TERM" && test -t 1; then
3271 # Assume xterm compatible escape sequences.
3272 bold_on
=`printf '\033[1m'`
3273 bold_off
=`printf '\033[0m'`
3276 # Use the terminfo capability strings for "bold" and "sgr0".
3277 if test "$TERM" = sun-color
&& test "`tput smso`" != "`tput rev`"; then
3278 # Solaris 11 OmniOS: `tput smso` renders as bold,
3279 # `tput rmso` is the same as `tput sgr0`.
3280 bold_on
=`tput smso 2>/dev/null`
3281 bold_off
=`tput rmso 2>/dev/null`
3283 bold_on
=`tput bold 2>/dev/null`
3284 bold_off
=`tput sgr0 2>/dev/null`
3286 if test -z "$bold_on" ||
test -z "$bold_off"; then
3296 echo "Module list with included dependencies (indented):"
3297 echo "$specified_modules" |
sed -e '/^$/d' -e 's/$/| /' > "$tmp"/specified-modules
3298 echo "$modules" |
sed -e '/^$/d' \
3299 | LC_ALL
=C
$JOIN -t '|' -a2 "$tmp"/specified-modules
- \
3300 |
sed -e 's/^\(.*\)|.*/|\1/' -e 's/^/ /' -e 's/^ |\(.*\)$/ '"${bold_on}"'\1'"${bold_off}"'/'
3303 # func_modules_transitive_closure_separately
3304 # Determine main module list and tests-related module list separately.
3305 # The main module list is the transitive closure of the specified modules,
3306 # ignoring tests modules. Its lib/* sources go into $sourcebase/. If --lgpl
3307 # is specified, it will consist only of LGPLed source.
3308 # The tests-related module list is the transitive closure of the specified
3309 # modules, including tests modules, minus the main module list excluding
3310 # modules of applicability 'all'. Its lib/* sources (brought in through
3311 # dependencies of *-tests modules) go into $testsbase/. It may contain GPLed
3312 # source, even if --lgpl is specified.
3314 # - local_gnulib_path from --local-dir
3315 # - modcache true or false, from --cache-modules/--no-cache-modules
3316 # - specified_modules list of specified modules
3317 # - inctests true if tests should be included, false otherwise
3318 # - incobsolete true if obsolete modules among dependencies should be
3319 # included, blank otherwise
3320 # - inc_cxx_tests true if C++ interoperability tests should be included,
3322 # - inc_longrunning_tests true if long-runnings tests should be included,
3324 # - inc_privileged_tests true if tests that require root privileges should be
3325 # included, blank otherwise
3326 # - inc_unportable_tests true if tests that fail on some platforms should be
3327 # included, blank otherwise
3328 # - inc_all_direct_tests true if all kinds of problematic unit tests among
3329 # the unit tests of the specified modules should be
3330 # included, blank otherwise
3331 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
3332 # the unit tests of the dependencies should be
3333 # included, blank otherwise
3334 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
3336 # - excl_longrunning_tests true if long-runnings tests should be excluded,
3338 # - excl_privileged_tests true if tests that require root privileges should be
3339 # excluded, blank otherwise
3340 # - excl_unportable_tests true if tests that fail on some platforms should be
3341 # excluded, blank otherwise
3342 # - avoidlist list of modules to avoid
3343 # - cond_dependencies true if conditional dependencies shall be supported,
3345 # - tmp pathname of a temporary directory
3347 # - main_modules list of modules, including dependencies
3348 # - testsrelated_modules list of tests-related modules, including dependencies
3349 # - conddep_dependers, conddep_condition information about conditionally
3351 func_modules_transitive_closure_separately
()
3353 # Determine main module list.
3354 saved_inctests
="$inctests"
3356 modules
="$specified_modules"
3357 func_modules_transitive_closure
3358 main_modules
="$modules"
3359 inctests
="$saved_inctests"
3360 if test $verbose -ge 1; then
3361 echo "Main module list:"
3362 echo "$main_modules" |
sed -e 's/^/ /'
3364 # Determine tests-related module list.
3365 echo "$final_modules" | LC_ALL
=C
sort -u > "$tmp"/final-modules
3366 testsrelated_modules
=`for module in $main_modules; do
3367 if test \`func_get_applicability
$module\
` = main; then
3371 | LC_ALL=C sort -u | LC_ALL=C $JOIN -v 2 - "$tmp"/final-modules`
3372 # If testsrelated_modules consists only of modules with applicability 'all',
3373 # set it to empty (because such modules are only helper modules for other modules).
3374 have_nontrivial_testsrelated_modules
=
3375 for module
in $testsrelated_modules; do
3376 if test `func_get_applicability $module` != all
; then
3377 have_nontrivial_testsrelated_modules
=yes
3381 if test -z "$have_nontrivial_testsrelated_modules"; then
3382 testsrelated_modules
=
3384 if test $verbose -ge 1; then
3385 echo "Tests-related module list:"
3386 echo "$testsrelated_modules" |
sed -e 's/^/ /'
3390 # func_determine_use_libtests
3391 # Determines whether a $testsbase/libtests.a is needed.
3393 # - local_gnulib_path from --local-dir
3394 # - modcache true or false, from --cache-modules/--no-cache-modules
3395 # - testsrelated_modules list of tests-related modules, including dependencies
3397 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
3398 func_determine_use_libtests
()
3401 for module
in $testsrelated_modules; do
3402 func_verify_nontests_module
3403 if test -n "$module"; then
3404 all_files
=`func_get_filelist $module`
3405 # Test whether some file in $all_files lies in lib/.
3406 for f
in $all_files; do
3418 # func_remove_if_blocks
3419 # removes if...endif blocks from an automake snippet.
3420 func_remove_if_blocks
()
3433 # func_modules_add_dummy
3435 # - local_gnulib_path from --local-dir
3436 # - modcache true or false, from --cache-modules/--no-cache-modules
3437 # - modules list of modules, including dependencies
3439 # - modules list of modules, including 'dummy' if needed
3440 func_modules_add_dummy
()
3442 # Determine whether any module provides a lib_SOURCES augmentation.
3444 for module
in $modules; do
3445 func_verify_nontests_module
3446 if test -n "$module"; then
3447 if test "$cond_dependencies" = true
&& func_cond_module_p
$module; then
3448 # Ignore conditional modules, since they are not guaranteed to
3449 # contribute to lib_SOURCES.
3452 # Extract the value of unconditional "lib_SOURCES += ..." augmentations.
3453 for file in `func_get_automake_snippet "$module" | combine_lines |
3454 func_remove_if_blocks |
3455 sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'`; do
3456 # Ignore .h files since they are not compiled.
3460 have_lib_SOURCES
=yes
3468 # Add the dummy module, to make sure the library will be non-empty.
3469 if test -z "$have_lib_SOURCES"; then
3470 if func_acceptable
"dummy"; then
3471 func_append modules
" dummy"
3476 # func_modules_add_dummy_separately
3478 # - local_gnulib_path from --local-dir
3479 # - modcache true or false, from --cache-modules/--no-cache-modules
3480 # - main_modules list of modules, including dependencies
3481 # - testsrelated_modules list of tests-related modules, including dependencies
3482 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
3484 # - main_modules list of modules, including 'dummy' if needed
3485 # - testsrelated_modules list of tests-related modules, including 'dummy' if
3487 func_modules_add_dummy_separately
()
3489 # Add the dummy module to the main module list if needed.
3490 modules
="$main_modules"
3491 func_modules_add_dummy
3492 main_modules
="$modules"
3494 # Add the dummy module to the tests-related module list if needed.
3495 if $use_libtests; then
3496 modules
="$testsrelated_modules"
3497 func_modules_add_dummy
3498 testsrelated_modules
="$modules"
3502 # func_modules_notice
3504 # - local_gnulib_path from --local-dir
3505 # - modcache true or false, from --cache-modules/--no-cache-modules
3506 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
3507 # - modules list of modules, including dependencies
3508 func_modules_notice
()
3510 if test $verbose -ge -1; then
3511 for module
in $modules; do
3513 if test -n "$module"; then
3514 msg
=`func_get_notice $module`
3515 if test -n "$msg"; then
3516 echo "Notice from module $module:"
3517 echo "$msg" |
sed -e 's/^/ /'
3524 # func_modules_to_filelist
3526 # - local_gnulib_path from --local-dir
3527 # - modcache true or false, from --cache-modules/--no-cache-modules
3528 # - modules list of modules, including dependencies
3530 # - files list of files
3531 func_modules_to_filelist
()
3534 for module
in $modules; do
3536 if test -n "$module"; then
3537 fs
=`func_get_filelist $module`
3538 func_append files
" $fs"
3541 files
=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
3544 # func_modules_to_filelist_separately
3545 # Determine the final file lists.
3546 # They must be computed separately, because files in lib/* go into
3547 # $sourcebase/ if they are in the main file list but into $testsbase/
3548 # if they are in the tests-related file list. Furthermore lib/dummy.c
3551 # - local_gnulib_path from --local-dir
3552 # - modcache true or false, from --cache-modules/--no-cache-modules
3553 # - main_modules list of modules, including dependencies
3554 # - testsrelated_modules list of tests-related modules, including dependencies
3555 func_modules_to_filelist_separately
()
3557 # Determine final main file list.
3558 modules
="$main_modules"
3559 func_modules_to_filelist
3561 # Determine final tests-related file list.
3562 modules
="$testsrelated_modules"
3563 func_modules_to_filelist
3564 testsrelated_files
=`echo "$files" | sed -e 's,^lib/,tests=lib/,'`
3565 # Merge both file lists.
3566 sed_remove_empty_lines
='/^$/d'
3567 files
=`{ echo "$main_files"; echo "$testsrelated_files"; } | sed -e "$sed_remove_empty_lines" | LC_ALL=C sort -u`
3568 if test $verbose -ge 0; then
3570 sed_prettyprint_files
='s,^tests=lib/\(.*\)$,lib/\1 -> tests/\1,'
3571 echo "$files" |
sed -e "$sed_prettyprint_files" -e 's/^/ /'
3575 # func_compute_include_guard_prefix
3576 # Determine include_guard_prefix and module_indicator_prefix.
3578 # - macro_prefix prefix of gl_LIBOBJS macros to use
3580 # - include_guard_prefix replacement for ${gl_include_guard_prefix}
3581 # - sed_replace_include_guard_prefix
3582 # sed expression for resolving ${gl_include_guard_prefix}
3583 # - module_indicator_prefix prefix of GNULIB_<modulename> variables to use
3584 func_compute_include_guard_prefix
()
3586 if test "$macro_prefix" = gl
; then
3587 include_guard_prefix
='GL'
3589 include_guard_prefix
='GL_'`echo "$macro_prefix" | LC_ALL=C tr '[a-z]' '[A-Z]'`
3591 sed_replace_include_guard_prefix
='s/\${gl_include_guard_prefix}/'"${include_guard_prefix}"'/g'
3592 module_indicator_prefix
="${include_guard_prefix}"
3595 # func_execute_command command [args...]
3596 # Executes a command.
3597 # Uses also the variables
3598 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
3599 func_execute_command
()
3601 if test $verbose -ge 0; then
3605 # Commands like automake produce output to stderr even when they succeed.
3606 # Turn this output off if the command succeeds.
3607 "$@" > "$tmp"/cmdout
2>&1
3609 if test $cmdret = 0; then
3613 cat "$tmp"/cmdout
1>&2
3620 # func_dest_tmpfilename file
3621 # determines the name of a temporary file (file is relative to destdir).
3623 # - destdir target directory
3624 # - doit : if actions shall be executed, false if only to be printed
3625 # - tmp pathname of a temporary directory
3627 # - tmpfile absolute filename of the temporary file
3628 func_dest_tmpfilename
()
3631 # Put the new contents of $file in a file in the same directory (needed
3632 # to guarantee that an 'mv' to "$destdir/$file" works).
3633 tmpfile
="$destdir/$1.tmp"
3635 # Put the new contents of $file in a file in a temporary directory
3636 # (because the directory of "$file" might not exist).
3637 tmpfile
="$tmp"/`basename "$1"`.tmp
3641 # func_is_local_file lookedup_file file
3642 # check whether file should be instantiated from local gnulib directory
3643 func_is_local_file
()
3646 func_remove_suffix dname
"/$2"
3647 func_path_foreach
"$local_gnulib_path" test %dir
% = "$dname"
3651 # determines whether the file $f should be copied, symlinked, or hardlinked.
3653 # - copymode copy mode for files in general
3654 # - lcopymode copy mode for files from local_gnulib_path
3655 # - f the original file name
3656 # - lookedup_file name of the merged (combined) file
3658 # - copyaction copy or symlink or hardlink
3661 if test -n "$lcopymode" && func_is_local_file
"$lookedup_file" "$f"; then
3662 copyaction
="$lcopymode"
3664 if test -n "$copymode"; then
3665 copyaction
="$copymode"
3673 # copies a file from gnulib into the destination directory. The destination
3674 # is known to not exist.
3676 # - destdir target directory
3677 # - local_gnulib_path from --local-dir
3678 # - modcache true or false, from --cache-modules/--no-cache-modules
3679 # - f the original file name
3680 # - lookedup_file name of the merged (combined) file
3681 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
3682 # - g the rewritten file name
3683 # - tmpfile absolute filename of the temporary file
3684 # - doit : if actions shall be executed, false if only to be printed
3685 # - copymode copy mode for files in general
3686 # - lcopymode copy mode for files from local_gnulib_path
3690 echo "Copying file $g"
3692 if test "$copyaction" = symlink \
3693 && test -z "$lookedup_tmp" \
3694 && cmp -s "$lookedup_file" "$tmpfile"; then
3695 func_symlink_if_changed
"$lookedup_file" "$destdir/$g"
3697 if test "$copyaction" = hardlink \
3698 && test -z "$lookedup_tmp" \
3699 && cmp -s "$lookedup_file" "$tmpfile"; then
3700 func_hardlink
"$lookedup_file" "$destdir/$g"
3702 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error
"failed"
3711 # copies a file from gnulib into the destination directory. The destination
3712 # is known to exist.
3714 # - destdir target directory
3715 # - local_gnulib_path from --local-dir
3716 # - modcache true or false, from --cache-modules/--no-cache-modules
3717 # - f the original file name
3718 # - lookedup_file name of the merged (combined) file
3719 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
3720 # - g the rewritten file name
3721 # - tmpfile absolute filename of the temporary file
3722 # - doit : if actions shall be executed, false if only to be printed
3723 # - copymode copy mode for files in general
3724 # - lcopymode copy mode for files from local_gnulib_path
3725 # - already_present nonempty if the file should already exist, empty otherwise
3728 if cmp -s "$destdir/$g" "$tmpfile"; then
3729 : # The file has not changed.
3733 if test -n "$already_present"; then
3734 echo "Updating file $g (backup in ${g}~)"
3736 echo "Replacing file $g (non-gnulib code backed up in ${g}~) !!"
3738 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error
"failed"
3740 if test "$copyaction" = symlink \
3741 && test -z "$lookedup_tmp" \
3742 && cmp -s "$lookedup_file" "$tmpfile"; then
3743 func_symlink_if_changed
"$lookedup_file" "$destdir/$g"
3745 if test "$copyaction" = hardlink \
3746 && test -z "$lookedup_tmp" \
3747 && cmp -s "$lookedup_file" "$tmpfile"; then
3748 func_hardlink
"$lookedup_file" "$destdir/$g"
3750 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error
"failed"
3754 if test -n "$already_present"; then
3755 echo "Update file $g (backup in ${g}~)"
3757 echo "Replace file $g (non-gnulib code backed up in ${g}~) !!"
3763 # func_emit_lib_Makefile_am
3764 # emits the contents of library makefile to standard output.
3766 # - local_gnulib_path from --local-dir
3767 # - modcache true or false, from --cache-modules/--no-cache-modules
3768 # - modules list of modules, including dependencies
3769 # - libname library name
3770 # - pobase directory relative to destdir where to place *.po files
3771 # - auxdir directory relative to destdir where to place build aux files
3772 # - gnu_make true if --gnu-make was given, false otherwise
3773 # - makefile_name from --makefile-name
3774 # - automake_subdir true if --automake-subdir was given, false otherwise
3775 # - libtool true if libtool will be used, false or blank otherwise
3776 # - macro_prefix prefix of gl_LIBOBJS macros to use
3777 # - module_indicator_prefix prefix of GNULIB_<modulename> variables to use
3778 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
3779 # - witness_c_macro from --witness-c-macro
3780 # - actioncmd (optional) command that will reproduce this invocation
3781 # - for_test true if creating a package for testing, false otherwise
3782 # - sed_replace_include_guard_prefix
3783 # sed expression for resolving ${gl_include_guard_prefix}
3784 # - destfile filename relative to destdir of makefile being generated
3786 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val,dotfirst}
3787 # list of edits to be done to Makefile.am variables
3788 func_emit_lib_Makefile_am
()
3790 # When using GNU make, or when creating an includable Makefile.am snippet,
3791 # augment variables with += instead of assigning them.
3792 if $gnu_make ||
test -n "$makefile_name"; then
3797 if test "$libtool" = true
; then
3800 sed_eliminate_LDFLAGS
="$sed_noop"
3804 sed_eliminate_LDFLAGS
='/^lib_LDFLAGS[ ]*+=/d'
3806 # Replace NMD, so as to remove redundant "$(MKDIR_P) '.'" invocations.
3807 # The logic is similar to how we define gl_source_base_prefix.
3808 if $automake_subdir; then
3809 sed_eliminate_NMD
='s/^@NMD@//;/^@!NMD@/d'
3811 sed_eliminate_NMD
='/^@NMD@/d;s/^@!NMD@//'
3814 # When creating a package for testing: Attempt to provoke failures,
3815 # especially link errors, already during "make" rather than during
3816 # "make check", because "make check" is not possible in a cross-compiling
3817 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
3818 sed_transform_check_PROGRAMS
='s,check_PROGRAMS,noinst_PROGRAMS,g'
3820 sed_transform_check_PROGRAMS
="$sed_noop"
3822 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3823 if ! $gnu_make; then
3824 echo "## Process this file with automake to produce Makefile.in."
3826 func_emit_copyright_notice
3827 if test -n "$actioncmd"; then
3828 printf '# Reproduce by:\n%s\n' "$actioncmd"
3833 for module
in $modules; do
3834 func_verify_nontests_module
3835 if test -n "$module"; then
3837 func_get_automake_snippet_conditional
"$module" |
3839 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
3840 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
3841 -e "$sed_eliminate_LDFLAGS" \
3842 -e "$sed_eliminate_NMD" \
3843 -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' \
3844 -e 's,\$(GNULIB_,$('"${module_indicator_prefix}"'_GNULIB_,' \
3845 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
3846 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
3847 -e "$sed_transform_check_PROGRAMS" \
3848 -e "$sed_replace_include_guard_prefix"
3849 if test "$module" = 'alloca'; then
3850 echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
3851 echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@"
3853 } | combine_lines
"${libname}_${libext}_SOURCES" > "$tmp"/amsnippet1
3855 func_get_automake_snippet_unconditional
"$module" |
3857 sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' \
3858 -e 's,\$(GNULIB_,$('"${module_indicator_prefix}"'_GNULIB_,'
3859 } > "$tmp"/amsnippet2
3860 # Skip the contents if it's entirely empty.
3861 if grep '[^ ]' "$tmp"/amsnippet1
"$tmp"/amsnippet2
> /dev
/null
; then
3862 echo "## begin gnulib module $module"
3864 echo "ifeq (,\$(OMIT_GNULIB_MODULE_$module))"
3865 convert_to_gnu_make_1
='s/^if \(.*\)/ifneq (,$(\1_CONDITION))/'
3866 convert_to_gnu_make_2
='s|%reldir%/||g'
3867 convert_to_gnu_make_3
='s|%reldir%|.|g'
3870 if test "$cond_dependencies" = true
; then
3871 if func_cond_module_p
"$module"; then
3872 func_module_conditional_name
"$module"
3874 echo "ifneq (,\$(${conditional}_CONDITION))"
3876 echo "if $conditional"
3881 sed -e "$convert_to_gnu_make_1" \
3882 -e "$convert_to_gnu_make_2" \
3883 -e "$convert_to_gnu_make_3" \
3886 cat "$tmp"/amsnippet1
3888 if test "$cond_dependencies" = true
; then
3889 if func_cond_module_p
"$module"; then
3894 sed -e "$convert_to_gnu_make_1" \
3895 -e "$convert_to_gnu_make_2" \
3896 -e "$convert_to_gnu_make_3" \
3899 cat "$tmp"/amsnippet2
3904 echo "## end gnulib module $module"
3907 rm -f "$tmp"/amsnippet1
"$tmp"/amsnippet2
3908 # Test whether there are some source files in subdirectories.
3909 for f
in `func_get_filelist "$module"`; do
3919 } > "$tmp"/allsnippets
3920 if test -z "$makefile_name"; then
3921 # If there are source files in subdirectories, prevent collision of the
3922 # object files (example: hash.c and libxml/hash.c).
3924 if test -n "$uses_subdirs"; then
3925 subdir_options
=' subdir-objects'
3927 echo "AUTOMAKE_OPTIONS = 1.14 gnits${subdir_options}"
3930 if test -z "$makefile_name"; then
3932 echo "noinst_HEADERS ="
3933 echo "noinst_LIBRARIES ="
3934 echo "noinst_LTLIBRARIES ="
3935 echo "pkgdata_DATA ="
3937 echo "BUILT_SOURCES ="
3940 echo "MOSTLYCLEANFILES $assign core *.stackdump"
3941 if test -z "$makefile_name"; then
3942 echo "MOSTLYCLEANDIRS ="
3944 echo "DISTCLEANFILES ="
3945 echo "MAINTAINERCLEANFILES ="
3948 echo "# Start of GNU Make output."
3950 # Put autoconf output into a temporary file, so that its exit status
3951 # can be checked from the shell. Signal any error by putting a
3952 # syntax error into the output makefile.
3953 ${AUTOCONF} -t 'AC_SUBST:$1 = @$1@' "$configure_ac" \
3954 >"$tmp"/makeout
2>"$tmp"/makeout2
&&
3955 LC_ALL
=C
sort -u "$tmp"/makeout ||
{
3956 echo "== gnulib-tool GNU Make output failed as follows =="
3957 sed 's/^/# stderr: /' "$tmp"/makeout2
3959 rm -f "$tmp"/makeout
"$tmp"/makeout2
3961 echo "# End of GNU Make output."
3963 echo "# No GNU Make output."
3965 # Execute edits that apply to the Makefile.am being generated.
3967 while test $edit != $makefile_am_edits; do
3968 edit
=`expr $edit + 1`
3969 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
3970 eval var
=\"\
$makefile_am_edit${edit}_var
\"
3971 eval val
=\"\
$makefile_am_edit${edit}_val
\"
3972 eval dotfirst
=\"\
$makefile_am_edit${edit}_dotfirst
\"
3973 if test -n "$var"; then
3974 if test "${dir}Makefile.am" = "$destfile" ||
test "./${dir}Makefile.am" = "$destfile"; then
3975 if test "${var}" = SUBDIRS
&& test -n "$dotfirst"; then
3976 # The added subdirectory ${val} needs to be mentioned after '.'.
3977 # Since we don't have '.' among SUBDIRS so far, add it now.
3980 echo "${var} += ${val}"
3981 eval "makefile_am_edit${edit}_var="
3985 if test -n "$witness_c_macro"; then
3986 cppflags_part1
=" -D$witness_c_macro=1"
3991 cppflags_part2
=" -DGNULIB_STRICT_CHECKING=1"
3995 if test -z "$makefile_name"; then
3997 echo "AM_CPPFLAGS =$cppflags_part1$cppflags_part2"
4000 if test -n "$cppflags_part1$cppflags_part2"; then
4002 echo "AM_CPPFLAGS +=$cppflags_part1$cppflags_part2"
4006 if LC_ALL
=C
grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$tmp"/allsnippets
> /dev
/null \
4007 ||
{ test -n "$makefile_name" \
4008 && test -f "$sourcebase/Makefile.am" \
4009 && LC_ALL
=C
grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$sourcebase/Makefile.am" > /dev
/null
; \
4011 # One of the snippets or the user's Makefile.am already specifies an
4012 # installation location for the library. Don't confuse automake by saying
4013 # it should not be installed.
4016 # By default, the generated library should not be installed.
4017 echo "noinst_${perhapsLT}LIBRARIES += $libname.$libext"
4020 echo "${libname}_${libext}_SOURCES ="
4021 if ! $for_test; then
4022 echo "${libname}_${libext}_CFLAGS = \$(AM_CFLAGS) \$(GL_CFLAG_GNULIB_WARNINGS)"
4024 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
4025 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
4026 echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
4027 echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
4028 echo "EXTRA_${libname}_${libext}_SOURCES ="
4029 if test "$libtool" = true
; then
4030 echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)"
4031 echo "${libname}_${libext}_LDFLAGS += -no-undefined"
4032 # Synthesize an ${libname}_${libext}_LDFLAGS augmentation by combining
4033 # the link dependencies of all modules.
4034 for module
in $modules; do
4035 func_verify_nontests_module
4036 if test -n "$module"; then
4037 func_get_link_directive
"$module"
4040 | LC_ALL
=C
sed -e '/^$/d' -e 's/ when linking with libtool.*//' \
4041 | LC_ALL
=C
sort -u \
4042 | LC_ALL
=C
sed -e 's/^/'"${libname}_${libext}"'_LDFLAGS += /'
4045 if test -n "$pobase"; then
4046 echo "AM_CPPFLAGS += -DDEFAULT_TEXT_DOMAIN=\\\"${po_domain}-gnulib\\\""
4049 cat "$tmp"/allsnippets \
4050 |
sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
4052 echo "mostlyclean-local: mostlyclean-generic"
4053 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
4054 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
4055 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
4059 # Emit rules to erase .Po and .Plo files for AC_LIBOBJ invocations.
4060 # Extend the 'distclean' rule.
4061 echo "distclean-local: distclean-gnulib-libobjs"
4062 echo "distclean-gnulib-libobjs:"
4063 echo " -rm -f @${macro_prefix}_LIBOBJDEPS@"
4064 # Extend the 'maintainer-clean' rule.
4065 echo "maintainer-clean-local: distclean-gnulib-libobjs"
4066 rm -f "$tmp"/allsnippets
4069 # func_emit_po_Makevars
4070 # emits the contents of po/ makefile parameterization to standard output.
4072 # - local_gnulib_path from --local-dir
4073 # - modcache true or false, from --cache-modules/--no-cache-modules
4074 # - sourcebase directory relative to destdir where to place source code
4075 # - pobase directory relative to destdir where to place *.po files
4076 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
4077 func_emit_po_Makevars
()
4079 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
4080 func_emit_copyright_notice
4082 echo "# Usually the message domain is the same as the package name."
4083 echo "# But here it has a '-gnulib' suffix."
4084 echo "DOMAIN = ${po_domain}-gnulib"
4086 echo "# These two variables depend on the location of this directory."
4087 echo "subdir = ${pobase}"
4088 echo "top_builddir = "`echo "$pobase" | sed -e 's,//*,/,g' -e 's,[^/][^/]*,..,g'`
4091 # These options get passed to xgettext.
4092 XGETTEXT_OPTIONS
= \
4093 --keyword=_
--flag=_
:1:pass-c-format \
4094 --keyword=N_
--flag=N_
:1:pass-c-format \
4095 --keyword='proper_name:1,"This is a proper name. See the gettext manual, section Names."' \
4096 --keyword='proper_name_lite:1,"This is a proper name. See the gettext manual, section Names."' \
4097 --keyword='proper_name_utf8:1,"This is a proper name. See the gettext manual, section Names."' \
4098 --flag=error
:3:c-format
--flag=error_at_line
:5:c-format
4100 # This is the copyright holder that gets inserted into the header of the
4101 # $(DOMAIN).pot file. gnulib is copyrighted by the FSF.
4102 COPYRIGHT_HOLDER
= Free Software Foundation
, Inc.
4104 # This is the email address or URL to which the translators shall report
4105 # bugs in the untranslated strings:
4106 # - Strings which are not entire sentences, see the maintainer guidelines
4107 # in the GNU gettext documentation, section 'Preparing Strings'.
4108 # - Strings which use unclear terms or require additional context to be
4110 # - Strings which make invalid assumptions about notation of date, time or
4112 # - Pluralisation problems.
4113 # - Incorrect English spelling.
4114 # - Incorrect formatting.
4115 # It can be your email address, or a mailing list address where translators
4116 # can write to without being subscribed, or the URL of a web page through
4117 # which the translators can contact you.
4118 MSGID_BUGS_ADDRESS
= bug-gnulib@gnu.org
4120 # This is the list of locale categories, beyond LC_MESSAGES, for which the
4121 # message catalogs shall be used. It is usually empty.
4122 EXTRA_LOCALE_CATEGORIES
=
4124 # This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
4125 # context. Possible values are "yes" and "no". Set this to yes if the
4126 # package uses functions taking also a message context, like pgettext(), or
4127 # if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
4132 # func_emit_po_POTFILES_in
4133 # emits the file list to be passed to xgettext to standard output.
4135 # - local_gnulib_path from --local-dir
4136 # - modcache true or false, from --cache-modules/--no-cache-modules
4137 # - sourcebase directory relative to destdir where to place source code
4138 # - files list of new files
4139 func_emit_po_POTFILES_in
()
4141 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
4142 func_emit_copyright_notice
4144 echo "# List of files which contain translatable strings."
4145 echo "$files" |
sed -n -e "s,^lib/,$sourcebase/,p"
4148 # func_emit_tests_Makefile_am witness_macro
4149 # emits the contents of tests makefile to standard output.
4151 # - local_gnulib_path from --local-dir
4152 # - modcache true or false, from --cache-modules/--no-cache-modules
4153 # - modules list of modules, including dependencies
4154 # - libname library name
4155 # - auxdir directory relative to destdir where to place build aux files
4156 # - gnu_make true if --gnu-make was given, false otherwise
4157 # - makefile_name from --makefile-name
4158 # - tests_makefile_name from --tests-makefile-name
4159 # - libtool true if libtool will be used, false or blank otherwise
4160 # - sourcebase relative directory containing lib source code
4161 # - m4base relative directory containing autoconf macros
4162 # - testsbase relative directory containing unit test code
4163 # - macro_prefix prefix of gl_LIBOBJS macros to use
4164 # - module_indicator_prefix prefix of GNULIB_<modulename> variables to use
4165 # - witness_c_macro from --witness-c-macro
4166 # - for_test true if creating a package for testing, false otherwise
4167 # - single_configure true if a single configure file should be generated,
4168 # false for a separate configure file for the tests
4169 # - use_libtests true if a libtests.a should be built, false otherwise
4170 # - sed_replace_include_guard_prefix
4171 # sed expression for resolving ${gl_include_guard_prefix}
4172 # - destfile filename relative to destdir of makefile being generated
4174 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val,dotfirst}
4175 # list of edits to be done to Makefile.am variables
4176 func_emit_tests_Makefile_am
()
4179 if test "$libtool" = true
; then
4181 sed_eliminate_LDFLAGS
="$sed_noop"
4184 sed_eliminate_LDFLAGS
='/^lib_LDFLAGS[ ]*+=/d'
4186 # Replace NMD, so as to remove redundant "$(MKDIR_P) '.'" invocations.
4187 # The logic is similar to how we define gl_source_base_prefix.
4188 sed_eliminate_NMD
='/^@NMD@/d;s/^@!NMD@//'
4190 # When creating a package for testing: Attempt to provoke failures,
4191 # especially link errors, already during "make" rather than during
4192 # "make check", because "make check" is not possible in a cross-compiling
4193 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
4194 sed_transform_check_PROGRAMS
='s,check_PROGRAMS,noinst_PROGRAMS,g'
4196 sed_transform_check_PROGRAMS
="$sed_noop"
4198 testsbase_inverse
=`echo "$testsbase" | sed -e 's,/$,,' | sed -e 's,[^/][^/]*,..,g'`
4199 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
4200 echo "## Process this file with automake to produce Makefile.in."
4201 func_emit_copyright_notice
4205 for module
in $modules; do
4206 if $for_test && ! $single_configure; then
4207 if `func_repeat_module_in_tests`; then
4210 func_verify_tests_module
4215 if test -n "$module"; then
4217 func_get_automake_snippet_conditional
"$module" |
4219 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
4220 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
4221 -e "$sed_eliminate_LDFLAGS" \
4222 -e "$sed_eliminate_NMD" \
4223 -e 's,lib_\([A-Z][A-Z]*\),libtests_a_\1,g' \
4224 -e 's,\$(GNULIB_,$('"${module_indicator_prefix}"'_GNULIB_,' \
4225 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
4226 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
4227 -e "$sed_transform_check_PROGRAMS" \
4228 -e "$sed_replace_include_guard_prefix"
4229 if $use_libtests && test "$module" = 'alloca'; then
4230 echo "libtests_a_LIBADD += @ALLOCA@"
4231 echo "libtests_a_DEPENDENCIES += @ALLOCA@"
4233 } | combine_lines
"libtests_a_SOURCES" > "$tmp"/amsnippet1
4235 func_get_automake_snippet_unconditional
"$module" |
4237 sed -e 's,lib_\([A-Z][A-Z]*\),libtests_a_\1,g' \
4238 -e 's,\$(GNULIB_,$('"${module_indicator_prefix}"'_GNULIB_,'
4239 } > "$tmp"/amsnippet2
4240 # Skip the contents if it's entirely empty.
4241 if grep '[^ ]' "$tmp"/amsnippet1
"$tmp"/amsnippet2
> /dev
/null
; then
4242 # Mention long-running tests at the end.
4244 for word
in `func_get_status "$module"`; do
4245 if test "$word" = 'longrunning-test'; then
4250 { echo "## begin gnulib module $module"
4252 echo "ifeq (,\$(OMIT_GNULIB_MODULE_$module))"
4253 convert_to_gnu_make_1
='s/^if \(.*\)/ifneq (,$(\1_CONDITION))/'
4254 convert_to_gnu_make_2
='s|%reldir%/||g'
4255 convert_to_gnu_make_3
='s|%reldir%|.|g'
4258 if test "$cond_dependencies" = true
; then
4259 if func_cond_module_p
"$module"; then
4260 func_module_conditional_name
"$module"
4262 echo "ifneq (,\$(${conditional}_CONDITION))"
4264 echo "if $conditional"
4269 sed -e "$convert_to_gnu_make_1" \
4270 -e "$convert_to_gnu_make_2" \
4271 -e "$convert_to_gnu_make_3" \
4274 cat "$tmp"/amsnippet1
4276 if test "$cond_dependencies" = true
; then
4277 if func_cond_module_p
"$module"; then
4282 sed -e "$convert_to_gnu_make_1" \
4283 -e "$convert_to_gnu_make_2" \
4284 -e "$convert_to_gnu_make_3" \
4287 cat "$tmp"/amsnippet2
4292 echo "## end gnulib module $module"
4296 rm -f "$tmp"/amsnippet1
"$tmp"/amsnippet2
4297 # Test whether there are some source files in subdirectories.
4298 for f
in `func_get_filelist "$module"`; do
4300 lib
/*/*.c |
tests
/*/*.c
)
4308 } 3> "$tmp"/main_snippets
4> "$tmp"/longrunning_snippets
4309 # Generate dependencies here, since it eases the debugging of test failures.
4310 # If there are source files in subdirectories, prevent collision of the
4311 # object files (example: hash.c and libxml/hash.c).
4313 if test -n "$uses_subdirs"; then
4314 subdir_options
=' subdir-objects'
4316 echo "AUTOMAKE_OPTIONS = 1.14 foreign${subdir_options}"
4318 if $for_test && ! $single_configure; then
4319 echo "ACLOCAL_AMFLAGS = -I ${testsbase_inverse}/${m4base}"
4322 # Nothing is being added to SUBDIRS; nevertheless the existence of this
4323 # variable is needed to avoid an error from automake:
4324 # "AM_GNU_GETTEXT used but SUBDIRS not defined"
4327 echo "XFAIL_TESTS ="
4328 echo "TESTS_ENVIRONMENT ="
4329 echo "noinst_PROGRAMS ="
4330 if ! $for_test; then
4331 echo "check_PROGRAMS ="
4333 echo "EXTRA_PROGRAMS ="
4334 echo "noinst_HEADERS ="
4335 echo "noinst_LIBRARIES ="
4336 if $use_libtests; then
4338 echo "noinst_LIBRARIES += libtests.a"
4340 echo "check_LIBRARIES = libtests.a"
4343 echo "pkgdata_DATA ="
4345 echo "BUILT_SOURCES ="
4347 echo "MOSTLYCLEANFILES = core *.stackdump"
4348 echo "MOSTLYCLEANDIRS ="
4350 echo "DISTCLEANFILES ="
4351 echo "MAINTAINERCLEANFILES ="
4352 # Execute edits that apply to the Makefile.am being generated.
4354 while test $edit != $makefile_am_edits; do
4355 edit
=`expr $edit + 1`
4356 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
4357 eval var
=\"\
$makefile_am_edit${edit}_var
\"
4358 eval val
=\"\
$makefile_am_edit${edit}_val
\"
4359 eval dotfirst
=\"\
$makefile_am_edit${edit}_dotfirst
\"
4360 if test -n "$var"; then
4361 if test "${dir}Makefile.am" = "$destfile" ||
test "./${dir}Makefile.am" = "$destfile"; then
4362 if test "${var}" = SUBDIRS
&& test -n "$dotfirst"; then
4363 # The added subdirectory ${val} needs to be mentioned after '.'.
4364 # But we have '.' among SUBDIRS already, so do nothing.
4367 echo "${var} += ${val}"
4368 eval "makefile_am_edit${edit}_var="
4373 # Insert a '-Wno-error' option in the compilation commands emitted by
4374 # Automake, between $(AM_CPPFLAGS) and before the reference to @CFLAGS@.
4376 # 1) Because parts of the Gnulib tests exercise corner cases (invalid
4377 # arguments, endless recursions, etc.) that a compiler may warn about,
4378 # even with just the normal '-Wall' option.
4379 # 2) Because every package maintainer has their preferred set of warnings
4380 # that they may want to enforce in the main source code of their package.
4381 # But Gnulib tests are maintained in Gnulib and don't end up in binaries
4382 # that that package installs; therefore it does not make sense for
4383 # package maintainers to enforce the absence of warnings on these tests.
4384 # Why before @CFLAGS@?
4385 # - Because "the user is always right": If a user adds '-Werror' to their
4386 # CFLAGS, they have asked for errors, they will get errors. But they have
4387 # no right to complain about these errors, because Gnulib does not support
4389 cflags_for_gnulib_code
=
4390 if ! $for_test; then
4391 # Enable or disable warnings as suitable for the Gnulib coding style.
4392 cflags_for_gnulib_code
=" \$(GL_CFLAG_GNULIB_WARNINGS)"
4394 echo "CFLAGS = @GL_CFLAG_ALLOW_WARNINGS@${cflags_for_gnulib_code} @CFLAGS@"
4395 echo "CXXFLAGS = @GL_CXXFLAG_ALLOW_WARNINGS@ @CXXFLAGS@"
4397 echo "AM_CPPFLAGS = \\"
4399 echo " -DGNULIB_STRICT_CHECKING=1 \\"
4401 if test -n "$witness_c_macro"; then
4402 echo " -D$witness_c_macro=1 \\"
4404 if test -n "${witness_macro}"; then
4405 echo " -D@${witness_macro}@=1 \\"
4407 echo " -I. -I\$(srcdir) \\"
4408 echo " -I${testsbase_inverse} -I\$(srcdir)/${testsbase_inverse} \\"
4409 echo " -I${testsbase_inverse}/${sourcebase-lib} -I\$(srcdir)/${testsbase_inverse}/${sourcebase-lib}"
4411 if $use_libtests; then
4412 # All test programs need to be linked with libtests.a.
4413 # It needs to be passed to the linker before ${libname}.${libext}, since
4414 # the tests-related modules depend on the main modules.
4415 # It also needs to be passed to the linker after ${libname}.${libext}
4416 # because the latter might contain incomplete modules (such as the
4417 # 'version-etc' module whose dependency to 'version-etc-fsf' is voluntarily
4419 # The LIBTESTS_LIBDEPS can be passed to the linker once or twice, it does
4421 echo "LDADD = libtests.a ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext} libtests.a ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext} libtests.a \$(LIBTESTS_LIBDEPS)"
4423 echo "LDADD = ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext}"
4426 if $use_libtests; then
4427 echo "libtests_a_SOURCES ="
4428 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
4429 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
4430 echo "libtests_a_LIBADD = \$(${macro_prefix}tests_LIBOBJS)"
4431 echo "libtests_a_DEPENDENCIES = \$(${macro_prefix}tests_LIBOBJS)"
4432 echo "EXTRA_libtests_a_SOURCES ="
4433 # The circular dependency in LDADD requires this.
4434 echo "AM_LIBTOOLFLAGS = --preserve-dup-deps"
4437 # Many test scripts use ${EXEEXT} or ${srcdir}.
4438 # EXEEXT is defined by AC_PROG_CC through autoconf.
4439 # srcdir is defined by autoconf and automake.
4440 echo "TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='\$(srcdir)'"
4442 cat "$tmp"/main_snippets
"$tmp"/longrunning_snippets \
4443 |
sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
4444 # Arrange to print a message before compiling the files in this directory.
4445 echo "all: all-notice"
4447 echo " @echo '## ---------------------------------------------------- ##'"
4448 echo " @echo '## ------------------- Gnulib tests ------------------- ##'"
4449 echo " @echo '## You can ignore compiler warnings in this directory. ##'"
4450 echo " @echo '## ---------------------------------------------------- ##'"
4452 # Arrange to print a message before executing the tests in this directory.
4453 echo "check-am: check-notice"
4454 echo "check-notice:"
4455 echo " @echo '## ---------------------------------------------------------------------- ##'"
4456 echo " @echo '## ---------------------------- Gnulib tests ---------------------------- ##'"
4457 echo " @echo '## Please report test failures in this directory to <bug-gnulib@gnu.org>. ##'"
4458 echo " @echo '## ---------------------------------------------------------------------- ##'"
4460 echo "# Clean up after Solaris cc."
4462 echo " rm -rf SunWS_cache"
4464 echo "mostlyclean-local: mostlyclean-generic"
4465 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
4466 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
4467 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
4471 rm -f "$tmp"/main_snippets
"$tmp"/longrunning_snippets
4474 # func_emit_initmacro_start macro_prefix gentests
4475 # emits the first few statements of the gl_INIT macro to standard output.
4476 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4477 # - gentests true if a tests Makefile.am is being generated,
4479 # - module_indicator_prefix prefix of GNULIB_<modulename> variables to use
4480 func_emit_initmacro_start
()
4482 macro_prefix_arg
="$1"
4483 # Overriding AC_LIBOBJ and AC_REPLACE_FUNCS has the effect of storing
4484 # platform-dependent object files in ${macro_prefix_arg}_LIBOBJS instead of
4485 # LIBOBJS. The purpose is to allow several gnulib instantiations under
4486 # a single configure.ac file. (AC_CONFIG_LIBOBJ_DIR does not allow this
4488 # Furthermore it avoids an automake error like this when a Makefile.am
4489 # that uses pieces of gnulib also uses $(LIBOBJ):
4490 # automatically discovered file `error.c' should not be explicitly mentioned
4491 echo " m4_pushdef([AC_LIBOBJ], m4_defn([${macro_prefix_arg}_LIBOBJ]))"
4492 echo " m4_pushdef([AC_REPLACE_FUNCS], m4_defn([${macro_prefix_arg}_REPLACE_FUNCS]))"
4493 # Overriding AC_LIBSOURCES has the same purpose of avoiding the automake
4494 # error when a Makefile.am that uses pieces of gnulib also uses $(LIBOBJ):
4495 # automatically discovered file `error.c' should not be explicitly mentioned
4496 # We let automake know about the files to be distributed through the
4497 # EXTRA_lib_SOURCES variable.
4498 echo " m4_pushdef([AC_LIBSOURCES], m4_defn([${macro_prefix_arg}_LIBSOURCES]))"
4499 # Create data variables for checking the presence of files that are mentioned
4500 # as AC_LIBSOURCES arguments. These are m4 variables, not shell variables,
4501 # because we want the check to happen when the configure file is created,
4502 # not when it is run. ${macro_prefix_arg}_LIBSOURCES_LIST is the list of
4503 # files to check for. ${macro_prefix_arg}_LIBSOURCES_DIR is the subdirectory
4504 # in which to expect them.
4505 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_LIST], [])"
4506 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_DIR], [])"
4507 # Scope for m4 macros.
4508 echo " m4_pushdef([GL_MACRO_PREFIX], [${macro_prefix_arg}])"
4509 # Scope the GNULIB_<modulename> variables.
4510 echo " m4_pushdef([GL_MODULE_INDICATOR_PREFIX], [${module_indicator_prefix}])"
4513 echo " AC_REQUIRE([gl_CC_ALLOW_WARNINGS])"
4514 echo " AC_REQUIRE([gl_CXX_ALLOW_WARNINGS])"
4518 # func_emit_initmacro_end macro_prefix gentests
4519 # emits the last few statements of the gl_INIT macro to standard output.
4520 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4521 # - gentests true if a tests Makefile.am is being generated,
4523 # - automake_subdir true if --automake-subdir was given, false otherwise
4524 # - libtool true if --libtool was given, false if --no-libtool was
4525 # given, blank otherwise
4526 func_emit_initmacro_end
()
4528 macro_prefix_arg
="$1"
4529 # Check the presence of files that are mentioned as AC_LIBSOURCES arguments.
4530 # The check is performed only when autoconf is run from the directory where
4531 # the configure.ac resides; if it is run from a different directory, the
4533 echo " m4_ifval(${macro_prefix_arg}_LIBSOURCES_LIST, ["
4534 echo " m4_syscmd([test ! -d ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[ ||"
4535 echo " for gl_file in ]${macro_prefix_arg}_LIBSOURCES_LIST[ ; do"
4536 echo " if test ! -r ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file ; then"
4537 echo " echo \"missing file ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file\" >&2"
4541 echo " m4_if(m4_sysval, [0], [],"
4542 echo " [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])"
4544 echo " m4_popdef([GL_MODULE_INDICATOR_PREFIX])"
4545 echo " m4_popdef([GL_MACRO_PREFIX])"
4546 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_DIR])"
4547 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_LIST])"
4548 echo " m4_popdef([AC_LIBSOURCES])"
4549 echo " m4_popdef([AC_REPLACE_FUNCS])"
4550 echo " m4_popdef([AC_LIBOBJ])"
4551 echo " AC_CONFIG_COMMANDS_PRE(["
4552 echo " ${macro_prefix_arg}_libobjs="
4553 echo " ${macro_prefix_arg}_ltlibobjs="
4554 echo " ${macro_prefix_arg}_libobjdeps="
4555 echo " if test -n \"\$${macro_prefix_arg}_LIBOBJS\"; then"
4556 echo " # Remove the extension."
4557 echo "changequote(,)dnl"
4558 echo " sed_drop_objext='s/\\.o\$//;s/\\.obj\$//'"
4559 echo " sed_dirname1='s,//*,/,g'"
4560 echo " sed_dirname2='s,\\(.\\)/\$,\\1,'"
4561 echo " sed_dirname3='s,^[^/]*\$,.,'"
4562 echo " sed_dirname4='s,\\(.\\)/[^/]*\$,\\1,'"
4563 echo " sed_basename1='s,.*/,,'"
4564 echo "changequote([, ])dnl"
4565 if $automake_subdir && ! "$2" && test -n "$sourcebase" && test "$sourcebase" != '.'; then
4566 subdir
="$sourcebase/"
4567 elif $automake_subdir_tests && "$2" && test -n "$testsbase" && test "$testsbase" != '.'; then
4568 subdir
="$testsbase/"
4572 echo " for i in \`for i in \$${macro_prefix_arg}_LIBOBJS; do echo \"\$i\"; done | sed -e \"\$sed_drop_objext\" | sort | uniq\`; do"
4573 echo " ${macro_prefix_arg}_libobjs=\"\$${macro_prefix_arg}_libobjs ${subdir}\$i.\$ac_objext\""
4574 echo " ${macro_prefix_arg}_ltlibobjs=\"\$${macro_prefix_arg}_ltlibobjs ${subdir}\$i.lo\""
4575 echo " i_dir=\`echo \"\$i\" | sed -e \"\$sed_dirname1\" -e \"\$sed_dirname2\" -e \"\$sed_dirname3\" -e \"\$sed_dirname4\"\`"
4576 echo " i_base=\`echo \"\$i\" | sed -e \"\$sed_basename1\"\`"
4577 if test "$libtool" = true
; then
4578 echo " ${macro_prefix_arg}_libobjdeps=\"\$${macro_prefix_arg}_libobjdeps ${subdir}\$i_dir/\\\$(DEPDIR)/\$i_base.Plo\""
4580 echo " ${macro_prefix_arg}_libobjdeps=\"\$${macro_prefix_arg}_libobjdeps ${subdir}\$i_dir/\\\$(DEPDIR)/\$i_base.Po\""
4584 echo " AC_SUBST([${macro_prefix_arg}_LIBOBJS], [\$${macro_prefix_arg}_libobjs])"
4585 echo " AC_SUBST([${macro_prefix_arg}_LTLIBOBJS], [\$${macro_prefix_arg}_ltlibobjs])"
4586 echo " AC_SUBST([${macro_prefix_arg}_LIBOBJDEPS], [\$${macro_prefix_arg}_libobjdeps])"
4590 # func_emit_initmacro_done macro_prefix sourcebase
4591 # emits a few statements after the gl_INIT macro to standard output.
4592 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4593 # - sourcebase directory relative to destdir where to place source code
4594 func_emit_initmacro_done
()
4596 macro_prefix_arg
="$1"
4599 echo "# Like AC_LIBOBJ, except that the module name goes"
4600 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
4601 echo "AC_DEFUN([${macro_prefix_arg}_LIBOBJ], ["
4602 echo " AS_LITERAL_IF([\$1], [${macro_prefix_arg}_LIBSOURCES([\$1.c])])dnl"
4603 echo " ${macro_prefix_arg}_LIBOBJS=\"\$${macro_prefix_arg}_LIBOBJS \$1.\$ac_objext\""
4606 echo "# Like AC_REPLACE_FUNCS, except that the module name goes"
4607 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
4608 echo "AC_DEFUN([${macro_prefix_arg}_REPLACE_FUNCS], ["
4609 echo " m4_foreach_w([gl_NAME], [\$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl"
4610 echo " AC_CHECK_FUNCS([\$1], , [${macro_prefix_arg}_LIBOBJ(\$ac_func)])"
4613 echo "# Like AC_LIBSOURCES, except the directory where the source file is"
4614 echo "# expected is derived from the gnulib-tool parameterization,"
4615 echo "# and alloca is special cased (for the alloca-opt module)."
4616 echo "# We could also entirely rely on EXTRA_lib..._SOURCES."
4617 echo "AC_DEFUN([${macro_prefix_arg}_LIBSOURCES], ["
4618 echo " m4_foreach([_gl_NAME], [\$1], ["
4619 echo " m4_if(_gl_NAME, [alloca.c], [], ["
4620 echo " m4_define([${macro_prefix_arg}_LIBSOURCES_DIR], [$sourcebase_arg])"
4621 echo " m4_append([${macro_prefix_arg}_LIBSOURCES_LIST], _gl_NAME, [ ])"
4627 # func_emit_shellvars_init gentests base
4628 # emits some shell variable assignments to standard output.
4629 # - gentests true if a tests Makefile.am is being generated,
4631 # - base base directory, relative to the top-level directory
4632 # - automake_subdir true if --automake-subdir was given, false otherwise
4633 # - automake_subdir_tests true if --automake-subdir-tests was given, false otherwise
4634 func_emit_shellvars_init
()
4636 # Define the base directory, relative to the top-level directory.
4637 echo " gl_source_base='$2'"
4638 # Define the prefix for the file name of generated files.
4639 if $1 && $automake_subdir_tests; then
4640 # When tests share the same Makefile as the whole project, they
4641 # share the same base prefix.
4642 if test "$2" = "$testsbase"; then
4643 echo " gl_source_base_prefix='\$(top_build_prefix)$sourcebase/'"
4645 echo " gl_source_base_prefix='\$(top_build_prefix)$2/'"
4647 elif ! $1 && $automake_subdir; then
4648 echo " gl_source_base_prefix='\$(top_build_prefix)$2/'"
4650 echo " gl_source_base_prefix="
4654 # func_emit_autoconf_snippet indentation
4655 # emits the autoconf snippet of a module.
4657 # - indentation spaces to prepend on each line
4658 # - local_gnulib_path from --local-dir
4659 # - modcache true or false, from --cache-modules/--no-cache-modules
4660 # - sed_replace_build_aux sed expression that replaces reference to build-aux
4661 # - sed_replace_include_guard_prefix
4662 # sed expression for resolving ${gl_include_guard_prefix}
4663 # - module the module name
4664 # - toplevel true or false. 'false' means a subordinate use of
4666 # - disable_libtool true or false. It tells whether to disable libtool
4667 # handling even if it has been specified through the
4668 # command line options.
4669 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
4671 func_emit_autoconf_snippet
()
4674 if { case $module in
4675 gnumakefile | maintainer-makefile
)
4676 # These modules are meant to be used only in the top-level directory.
4682 func_get_autoconf_snippet
"$module" \
4683 |
sed -e '/^$/d;' -e "s/^/$indentation/" \
4684 -e "$sed_replace_build_aux" \
4685 -e "$sed_replace_include_guard_prefix" \
4686 |
{ if $disable_libtool; then
4687 sed -e 's/\$gl_cond_libtool/false/g' \
4688 -e 's/gl_libdeps/gltests_libdeps/g' \
4689 -e 's/gl_ltlibdeps/gltests_ltlibdeps/g'
4694 |
{ if $disable_gettext; then
4695 sed -e 's/AM_GNU_GETTEXT(\[external])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./'
4697 # Don't indent AM_GNU_GETTEXT_VERSION line, as that confuses
4698 # autopoint through at least GNU gettext version 0.18.2.
4699 sed -e 's/^ *AM_GNU_GETTEXT_VERSION/AM_GNU_GETTEXT_VERSION/'
4702 if test "$module" = 'alloca' && test "$libtool" = true
&& ! $disable_libtool; then
4703 echo 'changequote(,)dnl'
4704 echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
4705 echo 'changequote([, ])dnl'
4706 echo 'AC_SUBST([LTALLOCA])'
4711 # func_emit_autoconf_snippets modules referenceable_modules verifier toplevel disable_libtool disable_gettext
4712 # collects and emit the autoconf snippets of a set of modules.
4714 # - local_gnulib_path from --local-dir
4715 # - modcache true or false, from --cache-modules/--no-cache-modules
4716 # - sed_replace_build_aux sed expression that replaces reference to build-aux
4717 # - sed_replace_include_guard_prefix
4718 # sed expression for resolving ${gl_include_guard_prefix}
4719 # - modules the list of modules.
4720 # - referenceable_modules the list of modules which may be referenced as dependencies.
4721 # - verifier one of func_verify_module, func_verify_nontests_module,
4722 # func_verify_tests_module. It selects the subset of
4723 # $modules to consider.
4724 # - toplevel true or false. 'false' means a subordinate use of
4726 # - disable_libtool true or false. It tells whether to disable libtool
4727 # handling even if it has been specified through the
4728 # command line options.
4729 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
4731 func_emit_autoconf_snippets
()
4733 referenceable_modules
="$2"
4736 disable_libtool
="$5"
4737 disable_gettext
="$6"
4738 if test "$cond_dependencies" = true
; then
4739 for m
in $referenceable_modules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/modules
4740 # Emit the autoconf code for the unconditional modules.
4741 for module
in $1; do
4743 if test -n "$module"; then
4744 if func_cond_module_p
"$module"; then
4747 func_emit_autoconf_snippet
" "
4751 # Initialize the shell variables indicating that the modules are enabled.
4752 for module
in $1; do
4754 if test -n "$module"; then
4755 if func_cond_module_p
"$module"; then
4756 func_module_shellvar_name
"$module"
4757 echo " $shellvar=false"
4761 # Emit the autoconf code for the conditional modules, each in a separate
4762 # function. This makes it possible to support cycles among conditional
4764 for module
in $1; do
4766 if test -n "$module"; then
4767 if func_cond_module_p
"$module"; then
4768 func_module_shellfunc_name
"$module"
4769 func_module_shellvar_name
"$module"
4770 echo " $shellfunc ()"
4772 echo " if \$$shellvar; then :; else"
4773 func_emit_autoconf_snippet
" "
4774 echo " $shellvar=true"
4775 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
4776 # Intersect $deps with the modules list $1.
4777 deps
=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C $JOIN - "$tmp"/modules`
4778 for dep
in $deps; do
4779 if func_cond_module_p
"$dep"; then
4780 func_module_shellfunc_name
"$dep"
4781 func_cond_module_condition
"$module" "$dep"
4782 if test "$condition" != true
; then
4783 echo " if $condition; then"
4790 # The autoconf code for $dep has already been emitted above and
4791 # therefore is already executed when this function is run.
4800 # Emit the dependencies from the unconditional to the conditional modules.
4801 for module
in $1; do
4803 if test -n "$module"; then
4804 if func_cond_module_p
"$module"; then
4807 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
4808 # Intersect $deps with the modules list $1.
4809 deps
=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C $JOIN - "$tmp"/modules`
4810 for dep
in $deps; do
4811 if func_cond_module_p
"$dep"; then
4812 func_module_shellfunc_name
"$dep"
4813 func_cond_module_condition
"$module" "$dep"
4814 if test "$condition" != true
; then
4815 echo " if $condition; then"
4822 # The autoconf code for $dep has already been emitted above and
4823 # therefore is already executed when this code is run.
4830 # Define the Automake conditionals.
4831 echo " m4_pattern_allow([^${macro_prefix}_GNULIB_ENABLED_])"
4832 for module
in $1; do
4834 if test -n "$module"; then
4835 if func_cond_module_p
"$module"; then
4836 func_module_conditional_name
"$module"
4837 func_module_shellvar_name
"$module"
4838 echo " AM_CONDITIONAL([$conditional], [\$$shellvar])"
4843 # Ignore the conditions, and enable all modules unconditionally.
4844 for module
in $1; do
4846 if test -n "$module"; then
4847 func_emit_autoconf_snippet
" "
4853 # func_emit_pre_early_macros require indentation modules
4854 # The require parameter can be ':' (AC_REQUIRE) or 'false' (direct call).
4855 func_emit_pre_early_macros
()
4858 echo "${2}# Pre-early section."
4860 _pre_early_snippet
="echo \"${2}AC_REQUIRE([\$_pre_early_macro])\""
4862 _pre_early_snippet
="echo \"${2}\$_pre_early_macro\""
4865 # We need to call gl_USE_SYSTEM_EXTENSIONS before gl_PROG_AR_RANLIB. Doing
4866 # AC_REQUIRE in configure-ac.early is not early enough.
4867 _pre_early_macro
="gl_USE_SYSTEM_EXTENSIONS"
4868 case "${nl}${3}${nl}" in
4869 *${nl}extensions
${nl}*) eval "$_pre_early_snippet" ;;
4872 _pre_early_macro
="gl_PROG_AR_RANLIB"
4873 eval "$_pre_early_snippet"
4877 # func_reconstruct_cached_dir
4878 # callback for func_reconstruct_cached_local_gnulib_path
4880 # - destdir from --dir
4882 # - local_gnulib_path restored '--local-dir' path from cache
4883 func_reconstruct_cached_dir
()
4886 if test -n "$cached_dir"; then
4887 case "$cached_dir" in
4889 func_path_append local_gnulib_path
"$cached_dir" ;;
4893 # XXX This doesn't look right.
4894 func_path_append local_gnulib_path
"$destdir/$cached_dir" ;;
4896 func_relconcat
"$destdir" "$cached_dir"
4897 func_path_append local_gnulib_path
"$relconcat" ;;
4903 # func_reconstruct_cached_local_gnulib_path
4904 # reconstruct local_gnulib_path from cached_local_gnulib_path to be set
4905 # relatively to $destdir again.
4907 # - cached_local_gnulib_path local_gnulib_path stored within gnulib-cache.m4
4908 # - destdir from --dir
4910 # - local_gnulib_path restored '--local-dir' path from cache
4911 func_reconstruct_cached_local_gnulib_path
()
4913 func_path_foreach
"$cached_local_gnulib_path" func_reconstruct_cached_dir
%dir
%
4916 # func_import modules
4917 # Uses also the variables
4918 # - mode import or add-import or remove-import or update
4919 # - destdir target directory
4920 # - local_gnulib_path from --local-dir
4921 # - modcache true or false, from --cache-modules/--no-cache-modules
4922 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
4923 # - libname library name
4924 # - supplied_libname true if --lib was given, blank otherwise
4925 # - sourcebase directory relative to destdir where to place source code
4926 # - m4base directory relative to destdir where to place *.m4 macros
4927 # - pobase directory relative to destdir where to place *.po files
4928 # - docbase directory relative to destdir where to place doc files
4929 # - testsbase directory relative to destdir where to place unit test code
4930 # - auxdir directory relative to destdir where to place build aux files
4931 # - inctests true if --with-tests was given, false otherwise
4932 # - incobsolete true if --with-obsolete was given, blank otherwise
4933 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
4934 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
4936 # - inc_privileged_tests true if --with-privileged-tests was given, blank
4938 # - inc_unportable_tests true if --with-unportable-tests was given, blank
4940 # - inc_all_tests true if --with-all-tests was given, blank otherwise
4941 # - avoidlist list of modules to avoid, from --avoid
4942 # - cond_dependencies true if --conditional-dependencies was given, false if
4943 # --no-conditional-dependencies was given, blank otherwise
4944 # - lgpl yes or a number if library's license shall be LGPL,
4946 # - makefile_name from --makefile-name
4947 # - tests_makefile_name from --tests-makefile-name
4948 # - libtool true if --libtool was given, false if --no-libtool was
4949 # given, blank otherwise
4950 # - guessed_libtool true if the configure.ac file uses libtool, false otherwise
4951 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4952 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
4953 # - witness_c_macro from --witness-c-macro
4954 # - vc_files true if --vc-files was given, false if --no-vc-files was
4955 # given, blank otherwise
4956 # - autoconf_minversion minimum supported autoconf version
4957 # - doit : if actions shall be executed, false if only to be printed
4958 # - copymode copy mode for files in general
4959 # - lcopymode copy mode for files from local_gnulib_path
4962 # Get the cached settings.
4963 # In 'import' mode, we read them only for the purpose of knowing the old
4964 # installed file list, and don't use them as defaults.
4965 cached_local_gnulib_path
=
4966 cached_specified_modules
=
4968 cached_inc_cxx_tests
=
4969 cached_inc_longrunning_tests
=
4970 cached_inc_privileged_tests
=
4971 cached_inc_unportable_tests
=
4972 cached_inc_all_tests
=
4982 cached_makefile_name
=
4983 cached_tests_makefile_name
=
4984 cached_automake_subdir
=
4985 cached_cond_dependencies
=
4987 cached_macro_prefix
=
4989 cached_witness_c_macro
=
4992 if test -f "$destdir"/$m4base/gnulib-cache.
m4; then
4993 cached_libtool
=false
4999 s,^.*gl_LOCAL_DIR([[ ]*\([^]"$`\\)]*\).*$,cached_local_gnulib_path="\1",p
5009 s,^.*gl_MODULES([[ ]*\([^]"$`\\)]*\).*$,cached_specified_modules="\1",p
5011 /gl_WITH_OBSOLETE/ {
5012 s,^.*$,cached_incobsolete=true,p
5014 /gl_WITH_CXX_TESTS/ {
5015 s,^.*$,cached_inc_cxx_tests=true,p
5017 /gl_WITH_LONGRUNNING_TESTS/ {
5018 s,^.*$,cached_inc_longrunning_tests=true,p
5020 /gl_WITH_PRIVILEGED_TESTS/ {
5021 s,^.*$,cached_inc_privileged_tests=true,p
5023 /gl_WITH_UNPORTABLE_TESTS/ {
5024 s,^.*$,cached_inc_unportable_tests=true,p
5026 /gl_WITH_ALL_TESTS/ {
5027 s,^.*$,cached_inc_all_tests=true,p
5030 s,^.*gl_AVOID([[ ]*\([^]"$`\\)]*\).*$,cached_avoidlist="\1",p
5033 s,^.*gl_SOURCE_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_sourcebase="\1",p
5036 s,^.*gl_M4_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_m4base="\1",p
5039 s,^.*gl_PO_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_pobase="\1",p
5042 s,^.*gl_DOC_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_docbase="\1",p
5045 s,^.*gl_TESTS_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_testsbase="\1",p
5048 s,^.*$,cached_inctests=true,p
5051 s,^.*gl_LIB([[ ]*\([^]"$`\\)]*\).*$,cached_libname="\1",p
5054 s,^.*gl_LGPL([[ ]*\([^]"$`\\)]*\).*$,cached_lgpl="\1",p
5057 s,^.*$,cached_lgpl=yes,p
5059 /gl_MAKEFILE_NAME(/ {
5060 s,^.*gl_MAKEFILE_NAME([[ ]*\([^]"$`\\)]*\).*$,cached_makefile_name="\1",p
5062 /gl_TESTS_MAKEFILE_NAME(/ {
5063 s,^.*gl_TESTS_MAKEFILE_NAME([[ ]*\([^]"$`\\)]*\).*$,cached_tests_makefile_name="\1",p
5065 /gl_AUTOMAKE_SUBDIR/ {
5066 s,^.*$,cached_automake_subdir=true,p
5068 /gl_CONDITIONAL_DEPENDENCIES/ {
5069 s,^.*$,cached_cond_dependencies=true,p
5072 s,^.*$,cached_libtool=true,p
5074 /gl_MACRO_PREFIX(/ {
5075 s,^.*gl_MACRO_PREFIX([[ ]*\([^]"$`\\)]*\).*$,cached_macro_prefix="\1",p
5078 s,^.*gl_PO_DOMAIN([[ ]*\([^]"$`\\)]*\).*$,cached_po_domain="\1",p
5080 /gl_WITNESS_C_MACRO(/ {
5081 s,^.*gl_WITNESS_C_MACRO([[ ]*\([^]"$`\\)]*\).*$,cached_witness_c_macro="\1",p
5084 s,^.*gl_VC_FILES([[ ]*\([^]"$`\\)]*\).*$,cached_vc_files="\1",p
5086 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-cache.m4`
5087 if test -f "$destdir"/$m4base/gnulib-comp.
m4; then
5092 /AC_DEFUN(\['"${cached_macro_prefix}"'_FILE_LIST], \[/ {
5093 s,^.*$,cached_files=",p
5106 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-comp.m4`
5110 if test "$mode" = import
; then
5111 # In 'import' mode, the new set of specified modules overrides the cached
5112 # set of modules. Ignore the cached settings.
5113 specified_modules
="$1"
5115 # Merge the cached settings with the specified ones.
5116 # The m4base must be the same as expected from the pathname.
5117 if test -n "$cached_m4base" && test "$cached_m4base" != "$m4base"; then
5118 func_fatal_error
"$m4base/gnulib-cache.m4 is expected to contain gl_M4_BASE([$m4base])"
5120 # The local_gnulib_path defaults to the cached one. Recall that the cached one
5121 # is relative to $destdir, whereas the one we use is relative to . or absolute.
5122 if test -z "$local_gnulib_path"; then
5123 func_reconstruct_cached_local_gnulib_path
5127 # Append the cached and the specified module names. So that
5128 # "gnulib-tool --add-import foo" means to add the module foo.
5129 specified_modules
="$cached_specified_modules $1"
5132 # Take the cached module names, minus the specified module names.
5134 if $have_associative; then
5135 # Use an associative array, for O(N) worst-case run time.
5136 declare -A to_remove
5138 eval 'to_remove[$m]=yes'
5140 for module
in $cached_specified_modules; do
5141 if eval 'test -z "${to_remove[$module]}"'; then
5142 func_append specified_modules
"$module "
5146 # This loop has O(N**2) worst-case run time.
5147 for module
in $cached_specified_modules; do
5150 if test "$m" = "$module"; then
5155 if test -z "$to_remove"; then
5156 func_append specified_modules
"$module "
5162 # Take the cached module names. There are no specified module names.
5163 specified_modules
="$cached_specified_modules"
5166 # Included obsolete modules among the dependencies if specified either way.
5167 if test -z "$incobsolete"; then
5168 incobsolete
="$cached_incobsolete"
5170 # Included special kinds of tests modules among the dependencies if specified
5172 if test -z "$inc_cxx_tests"; then
5173 inc_cxx_tests
="$cached_inc_cxx_tests"
5175 if test -z "$inc_longrunning_tests"; then
5176 inc_longrunning_tests
="$cached_inc_longrunning_tests"
5178 if test -z "$inc_privileged_tests"; then
5179 inc_privileged_tests
="$cached_inc_privileged_tests"
5181 if test -z "$inc_unportable_tests"; then
5182 inc_unportable_tests
="$cached_inc_unportable_tests"
5184 if test -z "$inc_all_tests"; then
5185 inc_all_tests
="$cached_inc_all_tests"
5187 # Append the cached and the specified avoidlist. This is probably better
5188 # than dropping the cached one when --avoid is specified at least once.
5189 avoidlist
=`for m in $cached_avoidlist $avoidlist; do echo $m; done | LC_ALL=C sort -u`
5190 avoidlist
=`echo $avoidlist`
5192 # The sourcebase defaults to the cached one.
5193 if test -z "$sourcebase"; then
5194 sourcebase
="$cached_sourcebase"
5195 if test -z "$sourcebase"; then
5196 func_fatal_error
"missing --source-base option"
5199 # The pobase defaults to the cached one.
5200 if test -z "$pobase"; then
5201 pobase
="$cached_pobase"
5203 # The docbase defaults to the cached one.
5204 if test -z "$docbase"; then
5205 docbase
="$cached_docbase"
5206 if test -z "$docbase"; then
5207 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."
5210 # The testsbase defaults to the cached one.
5211 if test -z "$testsbase"; then
5212 testsbase
="$cached_testsbase"
5213 if test -z "$testsbase"; then
5214 func_fatal_error
"missing --tests-base option"
5217 # Require the tests if specified either way.
5218 if ! $inctests; then
5219 inctests
="$cached_inctests"
5220 if test -z "$inctests"; then
5224 # The libname defaults to the cached one.
5225 if test -z "$supplied_libname"; then
5226 libname
="$cached_libname"
5227 if test -z "$libname"; then
5228 func_fatal_error
"missing --lib option"
5231 # Require LGPL if specified either way.
5232 if test -z "$lgpl"; then
5235 # The makefile_name defaults to the cached one.
5236 if test -z "$makefile_name"; then
5237 makefile_name
="$cached_makefile_name"
5239 # The tests_makefile_name defaults to the cached one.
5240 if test -z "$tests_makefile_name"; then
5241 tests_makefile_name
="$cached_tests_makefile_name"
5243 # Use automake-subdir mode if specified either way.
5244 if ! $automake_subdir; then
5245 automake_subdir
="$cached_automake_subdir"
5246 if test -z "$automake_subdir"; then
5247 automake_subdir
=false
5250 # Use conditional dependencies if specified either way.
5251 if test -z "$cond_dependencies"; then
5252 cond_dependencies
="$cached_cond_dependencies"
5254 # Use libtool if specified either way, or if guessed.
5255 if test -z "$libtool"; then
5256 if test -n "$cached_m4base"; then
5257 libtool
="$cached_libtool"
5259 libtool
="$guessed_libtool"
5262 # The macro_prefix defaults to the cached one.
5263 if test -z "$macro_prefix"; then
5264 macro_prefix
="$cached_macro_prefix"
5265 if test -z "$macro_prefix"; then
5266 func_fatal_error
"missing --macro-prefix option"
5269 # The po_domain defaults to the cached one.
5270 if test -z "$po_domain"; then
5271 po_domain
="$cached_po_domain"
5273 # The witness_c_macro defaults to the cached one.
5274 if test -z "$witness_c_macro"; then
5275 witness_c_macro
="$cached_witness_c_macro"
5277 # The vc_files defaults to the cached one.
5278 if test -z "$vc_files"; then
5279 vc_files
="$cached_vc_files"
5281 # Ensure constraints.
5282 if test "$cond_dependencies" = true
&& $inctests; then
5283 echo "gnulib-tool: option --conditional-dependencies is not supported with --with-tests" 1>&2
5287 # --without-*-tests options are not supported here.
5289 excl_longrunning_tests
=
5290 excl_privileged_tests
=
5291 excl_unportable_tests
=
5293 # Canonicalize the list of specified modules.
5294 specified_modules
=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
5296 # Include all kinds of tests modules if --with-all-tests was specified.
5297 inc_all_direct_tests
="$inc_all_tests"
5298 inc_all_indirect_tests
="$inc_all_tests"
5300 # Determine final module list.
5301 modules
="$specified_modules"
5302 func_modules_transitive_closure
5303 if test $verbose -ge 0; then
5304 func_show_module_list
5306 final_modules
="$modules"
5308 # Determine main module list and tests-related module list separately.
5309 func_modules_transitive_closure_separately
5311 # Determine whether a $testsbase/libtests.a is needed.
5312 func_determine_use_libtests
5314 # Add the dummy module to the main module list or to the tests-related module
5316 func_modules_add_dummy_separately
5318 # If --lgpl, verify that the licenses of modules are compatible.
5319 if test -n "$lgpl"; then
5320 license_incompatibilities
=
5321 for module
in $main_modules; do
5322 license
=`func_get_license $module`
5324 'GPLv2+ build tool' |
'GPLed build tool') ;;
5325 'public domain' |
'unlimited' |
'unmodifiable license text') ;;
5330 LGPLv2
+ |
'LGPLv3+ or GPLv2+' | LGPLv3
+ | LGPL
) ;;
5331 *) func_append license_incompatibilities
"$module $license$nl" ;;
5336 LGPLv2
+ |
'LGPLv3+ or GPLv2+') ;;
5337 *) func_append license_incompatibilities
"$module $license$nl" ;;
5343 *) func_append license_incompatibilities
"$module $license$nl" ;;
5346 *) func_fatal_error
"invalid value lgpl=$lgpl" ;;
5351 if test -n "$license_incompatibilities"; then
5352 # Format the license incompatibilities as a table.
5353 sed_expand_column1_width50_indent17
='s,^\([^ ]*\) ,\1 ,
5354 s,^\(.................................................[^ ]*\) *, \1 ,'
5355 license_incompatibilities
=`echo "$license_incompatibilities" | sed -e "$sed_expand_column1_width50_indent17"`
5356 func_fatal_error
"incompatible license on modules:$nl$license_incompatibilities"
5360 # Show banner notice of every module.
5361 modules
="$main_modules"
5364 # Determine script to apply to imported library files.
5365 sed_transform_lib_file
=
5366 for module
in $main_modules; do
5367 if test $module = config-h
; then
5368 # Assume config.h exists, and that -DHAVE_CONFIG_H is omitted.
5369 sed_transform_lib_file
=$sed_transform_lib_file'
5370 s/^#ifdef[ ]*HAVE_CONFIG_H[ ]*$/#if 1/
5375 sed_transform_main_lib_file
="$sed_transform_lib_file"
5377 # Determine script to apply to auxiliary files that go into $auxdir/.
5378 sed_transform_build_aux_file
=
5380 # Determine script to apply to library files that go into $testsbase/.
5381 sed_transform_testsrelated_lib_file
="$sed_transform_lib_file"
5383 # Determine the final file lists.
5384 func_modules_to_filelist_separately
5387 || func_fatal_error
"refusing to do nothing"
5389 # Add m4/gnulib-tool.m4 to the file list. It is not part of any module.
5390 new_files
="$files m4/gnulib-tool.m4"
5391 old_files
="$cached_files"
5392 if test -f "$destdir"/$m4base/gnulib-tool.
m4; then
5393 func_append old_files
" m4/gnulib-tool.m4"
5396 rewritten
='%REWRITTEN%'
5397 sed_rewrite_old_files
="\
5398 s,^build-aux/,$rewritten$auxdir/,
5399 s,^doc/,$rewritten$cached_docbase/,
5400 s,^lib/,$rewritten$cached_sourcebase/,
5401 s,^m4/,$rewritten$cached_m4base/,
5402 s,^tests/,$rewritten$cached_testsbase/,
5403 s,^tests=lib/,$rewritten$cached_testsbase/,
5406 sed_rewrite_new_files
="\
5407 s,^build-aux/,$rewritten$auxdir/,
5408 s,^doc/,$rewritten$docbase/,
5409 s,^lib/,$rewritten$sourcebase/,
5410 s,^m4/,$rewritten$m4base/,
5411 s,^tests/,$rewritten$testsbase/,
5412 s,^tests=lib/,$rewritten$testsbase/,
5416 # Determine whether to put anything into $testsbase.
5417 testsfiles
=`echo "$files" | sed -n -e 's,^tests/,,p' -e 's,^tests=lib/,,p'`
5418 if test -n "$testsfiles"; then
5424 # Create directories.
5425 { echo "$sourcebase"
5427 if test -n "$pobase"; then
5430 docfiles
=`echo "$files" | sed -n -e 's,^doc/,,p'`
5431 if test -n "$docfiles"; then
5438 for f
in $files; do echo $f; done \
5439 |
sed -e "$sed_rewrite_new_files" \
5440 |
sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
5443 { # Rearrange file descriptors. Needed because "while ... done < ..."
5444 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5445 exec 5<&0 < "$tmp"/dirs
5447 if test ! -d "$destdir/$d"; then
5449 echo "Creating directory $destdir/$d"
5450 mkdir
-p "$destdir/$d" || func_fatal_error
"failed"
5452 echo "Create directory $destdir/$d"
5459 # Copy files or make symbolic links or hard links. Remove obsolete files.
5463 # Construct a table with 2 columns: rewritten-file-name original-file-name,
5464 # representing the files according to the last gnulib-tool invocation.
5465 for f
in $old_files; do echo $f; done \
5466 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_old_files" \
5469 # Construct a table with 2 columns: rewritten-file-name original-file-name,
5470 # representing the files after this gnulib-tool invocation.
5471 for f
in $new_files; do echo $f; done \
5472 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" \
5475 # First the files that are in old-files, but not in new-files:
5476 sed_take_first_column
='s,'"$delimiter"'.*,,'
5477 for g
in `LC_ALL=C $JOIN -t"$delimiter" -v1 "$tmp"/old-files "$tmp"/new-files | sed -e "$sed_take_first_column"`; do
5478 # Remove the file. Do nothing if the user already removed it.
5479 if test -f "$destdir/$g" ||
test -h "$destdir/$g"; then
5481 echo "Removing file $g (backup in ${g}~)"
5482 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error
"failed"
5484 echo "Remove file $g (backup in ${g}~)"
5486 func_append removed_files
"$g$nl"
5489 # func_add_or_update handles a file that ought to be present afterwards.
5491 # - f the original file name
5492 # - g the rewritten file name
5493 # - already_present nonempty if the file should already exist, empty
5495 func_add_or_update
()
5499 tests
=lib
/*) f
=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
5501 func_dest_tmpfilename
"$g"
5502 func_lookup_file
"$f"
5503 cp "$lookedup_file" "$tmpfile" || func_fatal_error
"failed"
5504 func_ensure_writable
"$tmpfile"
5507 # Don't process binary files with sed.
5510 if test -n "$sed_transform_main_lib_file"; then
5513 sed -e "$sed_transform_main_lib_file" \
5514 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
5518 if test -n "$sed_transform_build_aux_file"; then
5521 sed -e "$sed_transform_build_aux_file" \
5522 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
5526 if test -n "$sed_transform_testsrelated_lib_file"; then
5529 sed -e "$sed_transform_testsrelated_lib_file" \
5530 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
5536 if test -f "$destdir/$g"; then
5537 # The file already exists.
5541 # Don't protest if the file should be there but isn't: it happens
5542 # frequently that developers don't put autogenerated files under version control.
5544 func_append added_files
"$g$nl"
5548 # Then the files that are in new-files, but not in old-files:
5549 sed_take_last_column
='s,^.*'"$delimiter"',,'
5551 LC_ALL
=C
$JOIN -t"$delimiter" -v2 "$tmp"/old-files
"$tmp"/new-files \
5552 |
sed -e "$sed_take_last_column" \
5553 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/added-files
5554 { # Rearrange file descriptors. Needed because "while ... done < ..."
5555 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5556 exec 5<&0 < "$tmp"/added-files
5562 # Then the files that are in new-files and in old-files:
5563 already_present
=true
5564 LC_ALL
=C
$JOIN -t"$delimiter" "$tmp"/old-files
"$tmp"/new-files \
5565 |
sed -e "$sed_take_last_column" \
5566 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/kept-files
5567 { # Rearrange file descriptors. Needed because "while ... done < ..."
5568 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5569 exec 5<&0 < "$tmp"/kept-files
5576 # Command-line invocation printed in a comment in generated gnulib-cache.m4.
5577 actioncmd
="# gnulib-tool --import"
5579 # Break the action command log into multiple lines.
5580 # Emacs puts some gnulib-tool log lines in its source repository, and
5581 # git send-email rejects patch lines longer than 998 characters.
5582 # Also, config.status uses awk, and the HP-UX 11.00 awk fails if a
5583 # line has length >= 3071; similarly, the IRIX 6.5 awk fails if a
5584 # line has length >= 3072.
5585 func_append_actionarg
()
5587 func_append actioncmd
" \\$nl# $1"
5591 func_append_actioncmd_local_dir
()
5593 func_append_actionarg
"--local-dir=$1"
5595 func_path_foreach
"$local_gnulib_path" func_append_actioncmd_local_dir
%dir
%
5597 func_append_actionarg
"--lib=$libname"
5598 func_append_actionarg
"--source-base=$sourcebase"
5599 func_append_actionarg
"--m4-base=$m4base"
5600 if test -n "$pobase"; then
5601 func_append_actionarg
"--po-base=$pobase"
5603 func_append_actionarg
"--doc-base=$docbase"
5604 func_append_actionarg
"--tests-base=$testsbase"
5605 func_append_actionarg
"--aux-dir=$auxdir"
5607 func_append_actionarg
"--with-tests"
5609 if test -n "$incobsolete"; then
5610 func_append_actionarg
"--with-obsolete"
5612 if test -n "$inc_cxx_tests"; then
5613 func_append_actionarg
"--with-c++-tests"
5615 if test -n "$inc_longrunning_tests"; then
5616 func_append_actionarg
"--with-longrunning-tests"
5618 if test -n "$inc_privileged_tests"; then
5619 func_append_actionarg
"--with-privileged-tests"
5621 if test -n "$inc_unportable_tests"; then
5622 func_append_actionarg
"--with-unportable-tests"
5624 if test -n "$inc_all_tests"; then
5625 func_append_actionarg
"--with-all-tests"
5627 if test -n "$lgpl"; then
5628 if test "$lgpl" = yes; then
5629 func_append_actionarg
"--lgpl"
5631 func_append_actionarg
"--lgpl=$lgpl"
5635 func_append_actionarg
"--gnu-make"
5637 if test -n "$makefile_name"; then
5638 func_append_actionarg
"--makefile-name=$makefile_name"
5640 if test -n "$tests_makefile_name"; then
5641 func_append_actionarg
"--tests-makefile-name=$tests_makefile_name"
5643 if $automake_subdir; then
5644 func_append_actionarg
"--automake-subdir"
5646 if $automake_subdir_tests; then
5647 func_append_actionarg
"--automake-subdir-tests"
5649 if test "$cond_dependencies" = true
; then
5650 func_append_actionarg
"--conditional-dependencies"
5652 func_append_actionarg
"--no-conditional-dependencies"
5654 if test "$libtool" = true
; then
5655 func_append_actionarg
"--libtool"
5657 func_append_actionarg
"--no-libtool"
5659 func_append_actionarg
"--macro-prefix=$macro_prefix"
5660 if test -n "$po_domain"; then
5661 func_append_actionarg
"--po-domain=$po_domain"
5663 if test -n "$witness_c_macro"; then
5664 func_append_actionarg
"--witness-c-macro=$witness_c_macro"
5666 if test -n "$vc_files"; then
5667 if test "$vc_files" = true
; then
5668 func_append_actionarg
"--vc-files"
5670 func_append_actionarg
"--no-vc-files"
5673 for module
in $avoidlist; do
5674 func_append_actionarg
"--avoid=$module"
5676 for module
in $specified_modules; do
5677 func_append_actionarg
"$module"
5680 # Determine include_guard_prefix and module_indicator_prefix.
5681 func_compute_include_guard_prefix
5683 # Default the source makefile name to Makefile.am.
5684 if test -n "$makefile_name"; then
5685 source_makefile_am
="$makefile_name"
5687 source_makefile_am
='Makefile.am'
5689 # Default the tests makefile name to the source makefile name.
5690 if test -n "$tests_makefile_name"; then
5691 tests_makefile_am
="$tests_makefile_name"
5693 tests_makefile_am
="$source_makefile_am"
5696 # Create normal Makefile.ams.
5699 # Setup list of Makefile.am edits that are to be performed afterwards.
5700 # Some of these edits apply to files that we will generate; others are
5701 # under the responsibility of the developer.
5703 # func_note_Makefile_am_edit dir var value [dotfirst]
5704 # remembers that ${dir}Makefile.am needs to be edited to that ${var} mentions
5706 # If ${dotfirst} is non-empty, this mention needs to be present after '.'.
5707 # This is a special hack for the SUBDIRS variable, cf.
5708 # <https://www.gnu.org/software/automake/manual/html_node/Subdirectories.html>.
5709 func_note_Makefile_am_edit
()
5711 makefile_am_edits
=`expr $makefile_am_edits + 1`
5712 eval makefile_am_edit
${makefile_am_edits}_dir
=\"\
$1\"
5713 eval makefile_am_edit
${makefile_am_edits}_var
=\"\
$2\"
5714 eval makefile_am_edit
${makefile_am_edits}_val
=\"\
$3\"
5715 eval makefile_am_edit
${makefile_am_edits}_dotfirst
=\"\
$4\"
5717 if test "$source_makefile_am" = Makefile.am
; then
5718 sourcebase_dir
=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'`
5719 sourcebase_base
=`basename "$sourcebase"`
5720 func_note_Makefile_am_edit
"$sourcebase_dir" SUBDIRS
"$sourcebase_base"
5722 if test -n "$pobase"; then
5723 pobase_dir
=`echo "$pobase" | sed -n -e 's,/[^/]*$,/,p'`
5724 pobase_base
=`basename "$pobase"`
5725 func_note_Makefile_am_edit
"$pobase_dir" SUBDIRS
"$pobase_base"
5728 if test "$tests_makefile_am" = Makefile.am
; then
5729 testsbase_dir
=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'`
5730 testsbase_base
=`basename "$testsbase"`
5731 func_note_Makefile_am_edit
"$testsbase_dir" SUBDIRS
"$testsbase_base" true
5734 func_note_Makefile_am_edit
"" ACLOCAL_AMFLAGS
"${m4base}"
5736 # Find the first parent directory of $m4base that contains or will contain
5738 sed_last
='s,^.*/\([^/][^/]*\)//*$,\1/,
5740 sed_butlast
='s,[^/][^/]*//*$,,'
5741 dir1
="${m4base}/"; dir2
=""
5742 while test -n "$dir1" \
5743 && ! { test -f "${destdir}/${dir1}Makefile.am" \
5744 ||
test "${dir1}Makefile.am" = "$sourcebase/$source_makefile_am" \
5745 ||
test "./${dir1}Makefile.am" = "$sourcebase/$source_makefile_am" \
5747 && { test "${dir1}Makefile.am" = "$testsbase/$tests_makefile_am" \
5748 ||
test "./${dir1}Makefile.am" = "$testsbase/$tests_makefile_am"; }; }; }; do
5749 dir2
=`echo "$dir1" | sed -e "$sed_last"`"$dir2"
5750 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
5752 func_note_Makefile_am_edit
"$dir1" EXTRA_DIST
"${dir2}gnulib-cache.m4"
5755 # Create po/ directory.
5756 if test -n "$pobase"; then
5757 # Create po makefile and auxiliary files.
5758 for file in Makefile.
in.
in remove-potcdate.sin
; do
5759 func_dest_tmpfilename
$pobase/$file
5760 func_lookup_file build-aux
/po
/$file
5761 cat "$lookedup_file" > "$tmpfile"
5762 if test -f "$destdir"/$pobase/$file; then
5763 if cmp -s "$destdir"/$pobase/$file "$tmpfile"; then
5767 echo "Updating $pobase/$file (backup in $pobase/$file~)"
5768 mv -f "$destdir"/$pobase/$file "$destdir"/$pobase/$file~
5769 mv -f "$tmpfile" "$destdir"/$pobase/$file
5771 echo "Update $pobase/$file (backup in $pobase/$file~)"
5777 echo "Creating $pobase/$file"
5778 mv -f "$tmpfile" "$destdir"/$pobase/$file
5780 echo "Create $pobase/$file"
5783 func_append added_files
"$pobase/$file$nl"
5786 # Create po makefile parameterization, part 1.
5787 func_dest_tmpfilename
$pobase/Makevars
5788 func_emit_po_Makevars
> "$tmpfile"
5789 if test -f "$destdir"/$pobase/Makevars
; then
5790 if cmp -s "$destdir"/$pobase/Makevars
"$tmpfile"; then
5794 echo "Updating $pobase/Makevars (backup in $pobase/Makevars~)"
5795 mv -f "$destdir"/$pobase/Makevars
"$destdir"/$pobase/Makevars~
5796 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
5798 echo "Update $pobase/Makevars (backup in $pobase/Makevars~)"
5804 echo "Creating $pobase/Makevars"
5805 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
5807 echo "Create $pobase/Makevars"
5810 func_append added_files
"$pobase/Makevars$nl"
5812 # Create po makefile parameterization, part 2.
5813 func_dest_tmpfilename
$pobase/POTFILES.
in
5814 func_emit_po_POTFILES_in
> "$tmpfile"
5815 if test -f "$destdir"/$pobase/POTFILES.
in; then
5816 if cmp -s "$destdir"/$pobase/POTFILES.
in "$tmpfile"; then
5820 echo "Updating $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
5821 mv -f "$destdir"/$pobase/POTFILES.
in "$destdir"/$pobase/POTFILES.
in~
5822 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.
in
5824 echo "Update $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
5830 echo "Creating $pobase/POTFILES.in"
5831 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.
in
5833 echo "Create $pobase/POTFILES.in"
5836 func_append added_files
"$pobase/POTFILES.in$nl"
5839 TP_URL
="https://translationproject.org/latest/"
5841 echo "Fetching gnulib PO files from $TP_URL"
5842 (cd "$destdir"/$pobase \
5843 && wget
--no-verbose --mirror --level=1 -nd -A.po
-P .
"${TP_URL}gnulib/"
5846 echo "Fetch gnulib PO files from $TP_URL"
5848 # Create po/LINGUAS.
5850 func_dest_tmpfilename
$pobase/LINGUAS
5851 (cd "$destdir"/$pobase \
5852 && { echo '# Set of available languages.'
5853 LC_ALL
=C
ls -1 *.po |
sed -e 's,\.po$,,'
5856 if test -f "$destdir"/$pobase/LINGUAS
; then
5857 if cmp -s "$destdir"/$pobase/LINGUAS
"$tmpfile"; then
5860 echo "Updating $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
5861 mv -f "$destdir"/$pobase/LINGUAS
"$destdir"/$pobase/LINGUAS~
5862 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
5865 echo "Creating $pobase/LINGUAS"
5866 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
5867 func_append added_files
"$pobase/LINGUAS$nl"
5870 if test -f "$destdir"/$pobase/LINGUAS
; then
5871 echo "Update $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
5873 echo "Create $pobase/LINGUAS"
5878 # func_compute_relative_local_gnulib_path
5879 # gl_LOCAL_DIR requires local_gnulib_path to be set relatively to destdir
5881 # - local_gnulib_path from --local-dir
5882 # - destdir from --dir
5884 # - relative_local_dir path to be stored into gl_LOCAL_DIR
5885 func_compute_relative_local_gnulib_path
()
5887 relative_local_gnulib_path
=
5889 IFS
="$PATH_SEPARATOR"
5890 for local_dir
in $local_gnulib_path
5893 # Store the local_dir relative to destdir.
5894 case "$local_dir" in
5896 relative_local_dir
="$local_dir" ;;
5900 # XXX This doesn't look right.
5901 relative_local_dir
="$local_dir" ;;
5903 # destdir, local_dir are both relative.
5904 func_relativize
"$destdir" "$local_dir"
5905 relative_local_dir
="$reldir" ;;
5908 func_path_append relative_local_gnulib_path
"$relative_local_dir"
5913 # Create m4/gnulib-cache.m4.
5914 func_dest_tmpfilename
$m4base/gnulib-cache.
m4
5916 func_emit_copyright_notice
5918 echo "# This file represents the specification of how gnulib-tool is used."
5919 echo "# It acts as a cache: It is written and read by gnulib-tool."
5920 echo "# In projects that use version control, this file is meant to be put under"
5921 echo "# version control, like the configure.ac and various Makefile.am files."
5924 echo "# Specification in the form of a command-line invocation:"
5925 printf '%s\n' "$actioncmd"
5927 echo "# Specification in the form of a few gnulib-tool.m4 macro invocations:"
5928 func_compute_relative_local_gnulib_path
5929 echo "gl_LOCAL_DIR([$relative_local_gnulib_path])"
5931 echo "$specified_modules" |
sed -e 's/^/ /g'
5933 test -z "$incobsolete" ||
echo "gl_WITH_OBSOLETE"
5934 test -z "$inc_cxx_tests" ||
echo "gl_WITH_CXX_TESTS"
5935 test -z "$inc_longrunning_tests" ||
echo "gl_WITH_LONGRUNNING_TESTS"
5936 test -z "$inc_privileged_tests" ||
echo "gl_WITH_PRIVILEGED_TESTS"
5937 test -z "$inc_unportable_tests" ||
echo "gl_WITH_UNPORTABLE_TESTS"
5938 test -z "$inc_all_tests" ||
echo "gl_WITH_ALL_TESTS"
5939 echo "gl_AVOID([$avoidlist])"
5940 echo "gl_SOURCE_BASE([$sourcebase])"
5941 echo "gl_M4_BASE([$m4base])"
5942 echo "gl_PO_BASE([$pobase])"
5943 echo "gl_DOC_BASE([$docbase])"
5944 echo "gl_TESTS_BASE([$testsbase])"
5946 echo "gl_WITH_TESTS"
5948 echo "gl_LIB([$libname])"
5949 if test -n "$lgpl"; then
5950 if test "$lgpl" = yes; then
5953 echo "gl_LGPL([$lgpl])"
5956 echo "gl_MAKEFILE_NAME([$makefile_name])"
5957 if test -n "$tests_makefile_name"; then
5958 echo "gl_TESTS_MAKEFILE_NAME([$tests_makefile_name])"
5960 if test "$automake_subdir" = true
; then
5961 echo "gl_AUTOMAKE_SUBDIR"
5963 if test "$cond_dependencies" = true
; then
5964 echo "gl_CONDITIONAL_DEPENDENCIES"
5966 if test "$libtool" = true
; then
5969 echo "gl_MACRO_PREFIX([$macro_prefix])"
5970 echo "gl_PO_DOMAIN([$po_domain])"
5971 echo "gl_WITNESS_C_MACRO([$witness_c_macro])"
5972 if test -n "$vc_files"; then
5973 echo "gl_VC_FILES([$vc_files])"
5976 if test -f "$destdir"/$m4base/gnulib-cache.
m4; then
5977 if cmp -s "$destdir"/$m4base/gnulib-cache.
m4 "$tmpfile"; then
5981 echo "Updating $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
5982 mv -f "$destdir"/$m4base/gnulib-cache.
m4 "$destdir"/$m4base/gnulib-cache.
m4~
5983 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.
m4
5985 echo "Update $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
5989 echo "# gnulib-cache.m4 ends here"
5996 echo "Creating $m4base/gnulib-cache.m4"
5997 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.
m4
5999 echo "Create $m4base/gnulib-cache.m4"
6005 # Create m4/gnulib-comp.m4.
6006 func_dest_tmpfilename
$m4base/gnulib-comp.
m4
6008 echo "# DO NOT EDIT! GENERATED AUTOMATICALLY!"
6009 func_emit_copyright_notice
6011 echo "# This file represents the compiled summary of the specification in"
6012 echo "# gnulib-cache.m4. It lists the computed macro invocations that need"
6013 echo "# to be invoked from configure.ac."
6014 echo "# In projects that use version control, this file can be treated like"
6015 echo "# other built files."
6018 echo "# This macro should be invoked from $configure_ac, in the section"
6019 echo "# \"Checks for programs\", right after AC_PROG_CC, and certainly before"
6020 echo "# any checks for libraries, header files, types and library functions."
6021 echo "AC_DEFUN([${macro_prefix}_EARLY],"
6023 echo " m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
6024 echo " m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
6025 echo " m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
6026 echo " m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
6028 func_emit_pre_early_macros
: ' ' "$final_modules"
6030 for module
in $final_modules; do
6032 if test -n "$module"; then
6033 echo "# Code from module $module:"
6034 func_get_autoconf_early_snippet
"$module"
6037 |
sed -e '/^$/d;' -e 's/^/ /'
6040 echo "# This macro should be invoked from $configure_ac, in the section"
6041 echo "# \"Check for header files, types and library functions\"."
6042 echo "AC_DEFUN([${macro_prefix}_INIT],"
6044 # This AC_CONFIG_LIBOBJ_DIR invocation silences an error from the automake
6046 # error: required file './alloca.c' not found
6047 # It is needed because of the last remaining use of AC_LIBSOURCES in
6048 # _AC_LIBOBJ_ALLOCA, invoked from AC_FUNC_ALLOCA.
6049 # All the m4_pushdef/m4_popdef logic in func_emit_initmacro_start/_end
6050 # does not help to avoid this error.
6051 if grep ' lib/alloca\.c$' "$tmp"/new-files
>/dev
/null
; then
6052 # alloca.c will be present in $sourcebase.
6053 echo " AC_CONFIG_LIBOBJ_DIR([$sourcebase])"
6055 if grep ' tests=lib/alloca\.c$' "$tmp"/new-files
>/dev
/null
; then
6056 # alloca.c will be present in $testsbase.
6057 echo " AC_CONFIG_LIBOBJ_DIR([$testsbase])"
6060 if test "$libtool" = true
; then
6061 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
6062 echo " gl_cond_libtool=true"
6064 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
6065 echo " gl_cond_libtool=false"
6067 echo " gl_ltlibdeps="
6069 if test "$auxdir" != "build-aux"; then
6070 sed_replace_build_aux
='
6072 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
6073 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
6077 sed_replace_build_aux
="$sed_noop"
6079 echo " gl_m4_base='$m4base'"
6080 func_emit_initmacro_start
$macro_prefix false
6081 func_emit_shellvars_init false
"$sourcebase"
6082 if test -n "$witness_c_macro"; then
6083 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$witness_c_macro])"
6085 func_emit_autoconf_snippets
"$main_modules" "$main_modules" func_verify_module true false true
6086 if test -n "$witness_c_macro"; then
6087 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
6089 echo " # End of code from modules"
6090 func_emit_initmacro_end
$macro_prefix false
6091 echo " gltests_libdeps="
6092 echo " gltests_ltlibdeps="
6093 func_emit_initmacro_start
${macro_prefix}tests
$gentests
6094 func_emit_shellvars_init true
"$testsbase"
6095 # Define a tests witness macro that depends on the package.
6096 # PACKAGE is defined by AM_INIT_AUTOMAKE, PACKAGE_TARNAME is defined by AC_INIT.
6097 # See <https://lists.gnu.org/r/automake/2009-05/msg00145.html>.
6098 echo "changequote(,)dnl"
6099 echo " ${macro_prefix}tests_WITNESS=IN_\`echo \"\${PACKAGE-\$PACKAGE_TARNAME}\" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'\`_GNULIB_TESTS"
6100 echo "changequote([, ])dnl"
6101 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
6102 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
6103 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
6104 func_emit_autoconf_snippets
"$testsrelated_modules" "$main_modules $testsrelated_modules" func_verify_module true true true
6105 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
6106 func_emit_initmacro_end
${macro_prefix}tests
$gentests
6107 echo " AC_REQUIRE([gl_CC_GNULIB_WARNINGS])"
6108 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
6109 # created using libtool, because libtool already handles the dependencies.
6110 if test "$libtool" != true
; then
6111 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
6112 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
6113 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
6114 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
6115 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
6117 if $use_libtests; then
6118 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
6119 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
6122 func_emit_initmacro_done
$macro_prefix $sourcebase
6123 func_emit_initmacro_done
${macro_prefix}tests
$testsbase
6125 echo "# This macro records the list of files which have been installed by"
6126 echo "# gnulib-tool and may be removed by future gnulib-tool invocations."
6127 echo "AC_DEFUN([${macro_prefix}_FILE_LIST], ["
6128 echo "$files" |
sed -e 's,^, ,'
6131 if test -f "$destdir"/$m4base/gnulib-comp.
m4; then
6132 if cmp -s "$destdir"/$m4base/gnulib-comp.
m4 "$tmpfile"; then
6136 echo "Updating $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
6137 mv -f "$destdir"/$m4base/gnulib-comp.
m4 "$destdir"/$m4base/gnulib-comp.
m4~
6138 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.
m4
6140 echo "Update $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
6144 echo "# gnulib-comp.m4 ends here"
6151 echo "Creating $m4base/gnulib-comp.m4"
6152 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.
m4
6154 echo "Create $m4base/gnulib-comp.m4"
6160 # Create library makefile.
6161 # Do this after creating gnulib-comp.m4, because func_emit_lib_Makefile_am
6162 # can run 'autoconf -t', which reads gnulib-comp.m4.
6163 func_dest_tmpfilename
$sourcebase/$source_makefile_am
6164 destfile
="$sourcebase/$source_makefile_am"
6165 modules
="$main_modules"
6166 if $automake_subdir; then
6167 func_emit_lib_Makefile_am |
"$gnulib_dir"/build-aux
/prefix-gnulib-mk
--from-gnulib-tool --lib-name="$libname" --prefix="$sourcebase/" > "$tmpfile"
6169 func_emit_lib_Makefile_am
> "$tmpfile"
6171 if test -f "$destdir"/$sourcebase/$source_makefile_am; then
6172 if cmp -s "$destdir"/$sourcebase/$source_makefile_am "$tmpfile"; then
6176 echo "Updating $sourcebase/$source_makefile_am (backup in $sourcebase/$source_makefile_am~)"
6177 mv -f "$destdir"/$sourcebase/$source_makefile_am "$destdir"/$sourcebase/$source_makefile_am~
6178 mv -f "$tmpfile" "$destdir"/$sourcebase/$source_makefile_am
6180 echo "Update $sourcebase/$source_makefile_am (backup in $sourcebase/$source_makefile_am~)"
6186 echo "Creating $sourcebase/$source_makefile_am"
6187 mv -f "$tmpfile" "$destdir"/$sourcebase/$source_makefile_am
6189 echo "Create $sourcebase/$source_makefile_am"
6192 func_append added_files
"$sourcebase/$source_makefile_am$nl"
6196 # Create tests makefile.
6197 func_dest_tmpfilename
$testsbase/$tests_makefile_am
6198 destfile
="$testsbase/$tests_makefile_am"
6199 modules
="$testsrelated_modules"
6200 func_emit_tests_Makefile_am
"${macro_prefix}tests_WITNESS" > "$tmpfile"
6201 if test -f "$destdir"/$testsbase/$tests_makefile_am; then
6202 if cmp -s "$destdir"/$testsbase/$tests_makefile_am "$tmpfile"; then
6206 echo "Updating $testsbase/$tests_makefile_am (backup in $testsbase/$tests_makefile_am~)"
6207 mv -f "$destdir"/$testsbase/$tests_makefile_am "$destdir"/$testsbase/$tests_makefile_am~
6208 mv -f "$tmpfile" "$destdir"/$testsbase/$tests_makefile_am
6210 echo "Update $testsbase/$tests_makefile_am (backup in $testsbase/$tests_makefile_am~)"
6216 echo "Creating $testsbase/$tests_makefile_am"
6217 mv -f "$tmpfile" "$destdir"/$testsbase/$tests_makefile_am
6219 echo "Create $testsbase/$tests_makefile_am"
6222 func_append added_files
"$testsbase/$tests_makefile_am$nl"
6226 if test "$vc_files" != false
; then
6227 # Update the .cvsignore and .gitignore files.
6228 { echo "$added_files" |
sed -e '/^$/d' -e 's,\([^/]*\)$,|A|\1,'
6229 echo "$removed_files" |
sed -e '/^$/d' -e 's,\([^/]*\)$,|R|\1,'
6230 # Treat gnulib-comp.m4 like an added file, even if it already existed.
6231 echo "$m4base/|A|gnulib-comp.m4"
6232 } | LC_ALL
=C
sort -t'|' -k1,1 > "$tmp"/fileset-changes
6233 { # Rearrange file descriptors. Needed because "while ... done < ..."
6234 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
6235 exec 5<&0 < "$tmp"/fileset-changes
6236 func_update_ignorelist
()
6239 if test "$ignore" = .gitignore
; then
6240 # In a .gitignore file, "foo" applies to the current directory and all
6241 # subdirectories, whereas "/foo" applies to the current directory only.
6244 doubly_escaped_anchor
='\\/'
6248 doubly_escaped_anchor
=''
6250 if test -f "$destdir/$dir$ignore"; then
6251 if test -n "$dir_added" ||
test -n "$dir_removed"; then
6252 sed -e "s|^$anchor||" < "$destdir/$dir$ignore" | LC_ALL
=C
sort > "$tmp"/ignore
6253 (echo "$dir_added" |
sed -e '/^$/d' | LC_ALL
=C
sort -u \
6254 | LC_ALL
=C
$JOIN -v 1 - "$tmp"/ignore
> "$tmp"/ignore-added
6255 echo "$dir_removed" |
sed -e '/^$/d' | LC_ALL
=C
sort -u \
6256 > "$tmp"/ignore-removed
6258 if test -s "$tmp"/ignore-added ||
test -s "$tmp"/ignore-removed
; then
6260 echo "Updating $dir$ignore (backup in $dir${ignore}~)"
6261 mv -f "$destdir/$dir$ignore" "$destdir/$dir$ignore"~
6262 { sed -e 's,/,\\/,g' -e 's,^,/^,' -e 's,$,\$/d,' < "$tmp"/ignore-removed
6263 if test -n "$anchor"; then sed -e 's,/,\\/,g' -e "s,^,/^${doubly_escaped_anchor}," -e 's,$,$/d,' < "$tmp"/ignore-removed
; fi
6264 } > "$tmp"/sed-ignore-removed
6265 { cat "$destdir/$dir$ignore"~
6266 sed -e "s|^|$anchor|" < "$tmp"/ignore-added
6267 } |
sed -f "$tmp"/sed-ignore-removed \
6268 > "$destdir/$dir$ignore"
6270 echo "Update $dir$ignore (backup in $dir${ignore}~)"
6275 if test -n "$dir_added"; then
6277 echo "Creating $dir$ignore"
6279 if test "$ignore" = .cvsignore
; then
6281 # Automake generates Makefile rules that create .dirstamp files.
6284 echo "$dir_added" |
sed -e '/^$/d' -e "s|^|$anchor|" | LC_ALL
=C
sort -u
6285 } > "$destdir/$dir$ignore"
6287 echo "Create $dir$ignore"
6297 if test -d "$destdir/CVS" ||
test -d "$destdir/${dir}CVS" ||
test -f "$destdir/${dir}.cvsignore"; then
6298 func_update_ignorelist .cvsignore
6300 if test -d "$destdir/.git" ||
test -f "$destdir/.gitignore" ||
test -f "$destdir/${dir}.gitignore"; then
6301 func_update_ignorelist .gitignore
6308 # Why not ''read next_dir op file'' ? Because the dir column can be empty.
6309 next_dir
=`echo "$line" | sed -e 's,|.*,,'`
6310 op
=`echo "$line" | sed -e 's,^[^|]*|\([^|]*\)|.*$,\1,'`
6311 file=`echo "$line" | sed -e 's,^[^|]*|[^|]*|,,'`
6312 if test "$next_dir" != "$last_dir"; then
6313 func_done_dir
"$last_dir" "$last_dir_added" "$last_dir_removed"
6314 last_dir
="$next_dir"
6319 A
) func_append last_dir_added
"$file$nl";;
6320 R
) func_append last_dir_removed
"$file$nl";;
6323 func_done_dir
"$last_dir" "$last_dir_added" "$last_dir_removed"
6330 echo "You may need to add #include directives for the following .h files."
6331 # Intersect $specified_modules and $main_modules
6332 # (since $specified_modules is not necessarily of subset of $main_modules
6333 # - some may have been skipped through --avoid, and since the elements of
6334 # $main_modules but not in $specified_modules can go away without explicit
6335 # notice - through changes in the module dependencies).
6336 echo "$specified_modules" > "$tmp"/modules1
# a sorted list, one module per line
6337 echo "$main_modules" > "$tmp"/modules2
# also a sorted list, one module per line
6338 # First the #include <...> directives without #ifs, sorted for convenience,
6339 # then the #include "..." directives without #ifs, sorted for convenience,
6340 # then the #include directives that are surrounded by #ifs. Not sorted.
6341 for module
in `LC_ALL=C $JOIN "$tmp"/modules1 "$tmp"/modules2`; do
6342 include_directive
=`func_get_include_directive "$module"`
6343 case "$nl$include_directive" in
6345 echo "$include_directive" 1>&5
6348 echo "$include_directive" |
grep -v 'include "' 1>&6
6349 echo "$include_directive" |
grep 'include "' 1>&7
6352 done 5> "$tmp"/include-if
6> "$tmp"/include-angles
7> "$tmp"/include-quotes
6354 LC_ALL
=C
sort -u "$tmp"/include-angles
6355 LC_ALL
=C
sort -u "$tmp"/include-quotes
6356 cat "$tmp"/include-if
6357 ) |
sed -e '/^$/d' -e 's/^/ /'
6358 rm -f "$tmp"/include-angles
"$tmp"/include-quotes
"$tmp"/include-if
6360 for module
in $main_modules; do
6361 func_get_link_directive
"$module"
6363 | LC_ALL
=C
sort -u |
sed -e '/^$/d' -e 's/^/ /' > "$tmp"/link
6364 if test `wc -l < "$tmp"/link` != 0; then
6366 echo "You may need to use the following Makefile variables when linking."
6367 echo "Use them in <program>_LDADD when linking a program, or"
6368 echo "in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library."
6374 echo "Don't forget to"
6375 if test "$source_makefile_am" = Makefile.am
; then
6376 echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
6378 echo " - \"include $source_makefile_am\" from within \"$sourcebase/Makefile.am\","
6380 if test -n "$pobase"; then
6381 echo " - add \"$pobase/Makefile.in\" to AC_CONFIG_FILES in $configure_ac,"
6384 if test "$tests_makefile_am" = Makefile.am
; then
6385 echo " - add \"$testsbase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
6387 echo " - \"include $tests_makefile_am\" from within \"$testsbase/Makefile.am\","
6391 while test $edit != $makefile_am_edits; do
6392 edit
=`expr $edit + 1`
6393 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
6394 eval var
=\"\
$makefile_am_edit${edit}_var
\"
6395 eval val
=\"\
$makefile_am_edit${edit}_val
\"
6396 if test -n "$var"; then
6397 if test "$var" = ACLOCAL_AMFLAGS
; then
6398 echo " - mention \"-I ${val}\" in ${var} in ${dir}Makefile.am"
6399 echo " or add an AC_CONFIG_MACRO_DIRS([${val}]) invocation in $configure_ac,"
6401 echo " - mention \"${val}\" in ${var} in ${dir}Makefile.am,"
6405 if grep '^ *AC_PROG_CC_STDC' "$configure_ac" > /dev
/null
; then
6406 echo " - replace AC_PROG_CC_STDC with AC_PROG_CC in $configure_ac,"
6407 position_early_after
=AC_PROG_CC_STDC
6409 if grep '^ *AC_PROG_CC_C99' "$configure_ac" > /dev
/null
; then
6410 echo " - replace AC_PROG_CC_C99 with AC_PROG_CC in $configure_ac,"
6411 position_early_after
=AC_PROG_CC_C99
6413 position_early_after
=AC_PROG_CC
6416 echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after $position_early_after,"
6417 echo " - invoke ${macro_prefix}_INIT in $configure_ac."
6420 # func_create_testdir testdir modules
6422 # - local_gnulib_path from --local-dir
6423 # - modcache true or false, from --cache-modules/--no-cache-modules
6424 # - auxdir directory relative to destdir where to place build aux files
6425 # - inctests true if tests should be included, false otherwise
6426 # - incobsolete true if obsolete modules among dependencies should be
6427 # included, blank otherwise
6428 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
6430 # - excl_longrunning_tests true if long-runnings tests should be excluded,
6432 # - excl_privileged_tests true if tests that require root privileges should be
6433 # excluded, blank otherwise
6434 # - excl_unportable_tests true if tests that fail on some platforms should be
6435 # excluded, blank otherwise
6436 # - single_configure true if a single configure file should be generated,
6437 # false for a separate configure file for the tests
6438 # - avoidlist list of modules to avoid
6439 # - cond_dependencies true if --conditional-dependencies was given, false if
6440 # --no-conditional-dependencies was given, blank otherwise
6441 # - libtool true if --libtool was given, false if --no-libtool was
6442 # given, blank otherwise
6443 # - copymode copy mode for files in general
6444 # - lcopymode copy mode for files from local_gnulib_path
6445 func_create_testdir
()
6449 if test -z "$modules"; then
6450 # All modules together.
6451 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
6452 # Except non-recursive-gnulib-prefix-hack, which represents a nonstandard
6453 # way of using Automake.
6454 # Except timevar, which lacks the required file timevar.def.
6455 # Except mountlist, which aborts the configuration on mingw. FIXME.
6456 # Except lib-ignore, which leads to link errors when Sun C++ is used. FIXME.
6457 modules
=`func_all_modules`
6458 modules
=`for m in $modules; do case $m in config-h | non-recursive-gnulib-prefix-hack | timevar | mountlist | lib-ignore) ;; *) echo $m;; esac; done`
6460 specified_modules
="$modules"
6462 # Canonicalize the list of specified modules.
6463 specified_modules
=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
6465 # Test modules which invoke AC_CONFIG_FILES cannot be used with
6466 # --with-tests --single-configure. Avoid them.
6467 if $inctests && $single_configure; then
6468 avoidlist
="$avoidlist havelib-tests"
6471 # Unlike in func_import, here we want to include all kinds of tests for the
6472 # directly specified modules, but not for dependencies.
6473 inc_all_direct_tests
=true
6474 inc_all_indirect_tests
="$inc_all_tests"
6476 # Check that the license of every module is consistent with the license of
6478 saved_inctests
="$inctests"
6479 # When computing transitive closures, don't consider $module to depend on
6480 # $module-tests. Need this because tests are implicitly GPL and may depend
6481 # on GPL modules - therefore we don't want a warning in this case.
6483 for requested_module
in $specified_modules; do
6484 requested_license
=`func_get_license "$requested_module"`
6485 if test "$requested_license" != GPL
; then
6486 # Here we use func_modules_transitive_closure, not just
6487 # func_get_dependencies, so that we also detect weird situations like
6488 # an LGPL module which depends on a GPLed build tool module which depends
6490 modules
="$requested_module"
6491 func_modules_transitive_closure
6492 for module
in $modules; do
6493 license
=`func_get_license "$module"`
6495 'GPLv2+ build tool' |
'GPLed build tool') ;;
6496 'public domain' |
'unlimited' |
'unmodifiable license text') ;;
6498 case "$requested_license" in
6501 LGPLv2
+ |
'LGPLv3+ or GPLv2+' | LGPLv3
+ | LGPL | GPLv2
+ | GPLv3
+ | GPL
) ;;
6502 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6507 LGPLv2
+ |
'LGPLv3+ or GPLv2+' | GPLv2
+) ;;
6508 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6513 LGPLv2
+ |
'LGPLv3+ or GPLv2+' | LGPLv3
+ | LGPL
) ;;
6514 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6517 'LGPLv3+ or GPLv2+')
6519 LGPLv2
+ |
'LGPLv3+ or GPLv2+') ;;
6520 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6526 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6535 inctests
="$saved_inctests"
6537 # Subdirectory names.
6548 # Determine final module list.
6549 modules
="$specified_modules"
6550 func_modules_transitive_closure
6551 if test $verbose -ge 0; then
6552 func_show_module_list
6554 final_modules
="$modules"
6556 if $single_configure; then
6557 # Determine main module list and tests-related module list separately.
6558 func_modules_transitive_closure_separately
6561 if $single_configure; then
6562 # Determine whether a $testsbase/libtests.a is needed.
6563 func_determine_use_libtests
6566 # Add the dummy module if needed.
6567 if $single_configure; then
6568 func_modules_add_dummy_separately
6570 func_modules_add_dummy
6574 # If $single_configure, we use the module lists $main_modules and
6575 # $testsrelated_modules; $modules is merely a temporary variable.
6576 # Whereas if ! $single_configure, the module list is $modules.
6578 # Show banner notice of every module.
6579 if $single_configure; then
6580 modules
="$main_modules"
6586 # Determine final file list.
6587 if $single_configure; then
6588 func_modules_to_filelist_separately
6590 main_modules
="$modules"
6591 testsrelated_modules
=`for module in $modules; do
6592 if \`func_repeat_module_in_tests\
`; then
6596 saved_modules
="$modules"
6597 func_modules_to_filelist_separately
6598 modules
="$saved_modules"
6600 # Add files for which the copy in gnulib is newer than the one that
6601 # "automake --add-missing --copy" would provide.
6602 files
="$files build-aux/config.guess"
6603 files
="$files build-aux/config.sub"
6604 files
=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
6606 rewritten
='%REWRITTEN%'
6607 sed_rewrite_files
="\
6608 s,^build-aux/,$rewritten$auxdir/,
6609 s,^doc/,$rewritten$docbase/,
6610 s,^lib/,$rewritten$sourcebase/,
6611 s,^m4/,$rewritten$m4base/,
6612 s,^tests/,$rewritten$testsbase/,
6613 s,^tests=lib/,$rewritten$testsbase/,
6617 # Create directories.
6618 for f
in $files; do echo $f; done \
6619 |
sed -e "$sed_rewrite_files" \
6620 |
sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
6621 | LC_ALL
=C
sort -u \
6623 { # Rearrange file descriptors. Needed because "while ... done < ..."
6624 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
6625 exec 5<&0 < "$tmp"/dirs
6627 mkdir
-p "$testdir/$d"
6632 # Copy files or make symbolic links or hard links.
6634 for f
in $files; do echo $f; done \
6635 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_files" \
6638 { # Rearrange file descriptors. Needed because "while ... done < ..."
6639 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
6640 exec 5<&0 < "$tmp"/files
6643 tests
=lib
/*) f
=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
6645 func_lookup_file
"$f"
6646 if test -n "$lookedup_tmp"; then
6647 cp -p "$lookedup_file" "$testdir/$g"
6648 func_ensure_writable
"$testdir/$g"
6651 if test "$copyaction" = symlink
; then
6652 func_symlink
"$lookedup_file" "$testdir/$g"
6654 if test "$copyaction" = hardlink
; then
6655 func_hardlink
"$lookedup_file" "$testdir/$g"
6657 cp -p "$lookedup_file" "$testdir/$g"
6658 func_ensure_writable
"$testdir/$g"
6666 # Determine include_guard_prefix and module_indicator_prefix.
6667 func_compute_include_guard_prefix
6669 # Create Makefile.ams that are for testing.
6672 # No special edits are needed.
6675 # Create $sourcebase/Makefile.am.
6676 mkdir
-p "$testdir/$sourcebase"
6677 destfile
="$sourcebase/Makefile.am"
6678 if $single_configure; then
6679 modules
="$main_modules"
6681 func_emit_lib_Makefile_am
> "$testdir/$sourcebase/Makefile.am"
6683 # Create $m4base/Makefile.am.
6684 mkdir
-p "$testdir/$m4base"
6685 (echo "## Process this file with automake to produce Makefile.in."
6691 echo "EXTRA_DIST += "`echo "$f" | sed -e 's,^m4/,,'` ;;
6694 ) > "$testdir/$m4base/Makefile.am"
6696 subdirs
="$sourcebase $m4base"
6697 subdirs_with_configure_ac
=""
6699 if false
&& test -f "$testdir"/$m4base/gettext.
m4; then
6700 # Avoid stupid error message from automake:
6701 # "AM_GNU_GETTEXT used but `po' not in SUBDIRS"
6702 mkdir
-p "$testdir/po"
6703 (echo "## Process this file with automake to produce Makefile.in."
6704 ) > "$testdir/po/Makefile.am"
6705 func_append subdirs
" po"
6709 test -d "$testdir/$testsbase" || mkdir
"$testdir/$testsbase"
6710 if $single_configure; then
6711 # Create $testsbase/Makefile.am.
6712 destfile
="$testsbase/Makefile.am"
6713 modules
="$testsrelated_modules"
6714 func_emit_tests_Makefile_am
"${macro_prefix}tests_WITNESS" > "$testdir/$testsbase/Makefile.am"
6716 # Viewed from the $testsbase subdirectory, $auxdir is different.
6717 saved_auxdir
="$auxdir"
6718 auxdir
=`echo "$testsbase/" | sed -e 's%[^/][^/]*//*%../%g'`"$auxdir"
6719 # Create $testsbase/Makefile.am.
6721 destfile
="$testsbase/Makefile.am"
6722 func_emit_tests_Makefile_am
"" > "$testdir/$testsbase/Makefile.am"
6723 # Create $testsbase/configure.ac.
6724 (echo "# Process this file with autoconf to produce a configure script."
6725 echo "AC_INIT([dummy], [0])"
6726 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6727 echo "AM_INIT_AUTOMAKE"
6729 echo "AC_CONFIG_HEADERS([config.h])"
6732 echo "AC_PROG_INSTALL"
6733 echo "AC_PROG_MAKE_SET"
6735 func_emit_pre_early_macros false
'' "$modules"
6737 for module
in $modules; do
6739 if test -n "$module"; then
6741 gnumakefile | maintainer-makefile
)
6742 # These modules are meant to be used only in the top-level directory.
6745 func_get_autoconf_early_snippet
"$module"
6750 |
sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)])/\1/'
6751 if test "$libtool" = true
; then
6752 echo "LT_INIT([win32-dll])"
6753 echo "LT_LANG([C++])"
6754 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
6755 echo "gl_cond_libtool=true"
6757 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
6758 echo "gl_cond_libtool=false"
6760 echo "gl_ltlibdeps="
6762 # Wrap the set of autoconf snippets into an autoconf macro that is then
6763 # invoked. This is needed because autoconf does not support AC_REQUIRE
6765 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
6766 # but we want the AC_REQUIRE to have its normal meaning (provide one
6767 # expansion of the required macro before the current point, and only one
6769 echo "AC_DEFUN([gl_INIT], ["
6770 sed_replace_build_aux
='
6772 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
6773 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
6776 echo "gl_m4_base='../$m4base'"
6777 func_emit_initmacro_start
$macro_prefix true
6778 # We don't have explicit ordering constraints between the various
6779 # autoconf snippets. It's cleanest to put those of the library before
6780 # those of the tests.
6781 func_emit_shellvars_init true
"../$sourcebase"
6782 func_emit_autoconf_snippets
"$modules" "$modules" func_verify_nontests_module false false false
6783 func_emit_shellvars_init true
'.'
6784 func_emit_autoconf_snippets
"$modules" "$modules" func_verify_tests_module false false false
6785 func_emit_initmacro_end
$macro_prefix true
6786 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
6787 # created using libtool, because libtool already handles the dependencies.
6788 if test "$libtool" != true
; then
6789 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
6790 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
6791 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
6792 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
6793 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
6796 func_emit_initmacro_done
$macro_prefix $sourcebase # FIXME use $sourcebase or $testsbase?
6800 # Usually $testsbase/config.h will be a superset of config.h. Verify this
6801 # by "merging" config.h into $testsbase/config.h; look out for gcc warnings.
6802 echo "AH_TOP([#include \"../config.h\"])"
6804 echo "AC_CONFIG_FILES([Makefile])"
6806 ) > "$testdir/$testsbase/configure.ac"
6807 auxdir
="$saved_auxdir"
6808 subdirs_with_configure_ac
="$subdirs_with_configure_ac $testsbase"
6810 func_append subdirs
" $testsbase"
6813 # Create Makefile.am.
6814 (echo "## Process this file with automake to produce Makefile.in."
6816 echo "AUTOMAKE_OPTIONS = 1.14 foreign"
6818 echo "SUBDIRS = $subdirs"
6820 echo "ACLOCAL_AMFLAGS = -I $m4base"
6821 ) > "$testdir/Makefile.am"
6823 # Create configure.ac.
6824 (echo "# Process this file with autoconf to produce a configure script."
6825 echo "AC_INIT([dummy], [0])"
6826 if test "$auxdir" != "."; then
6827 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6829 echo "AM_INIT_AUTOMAKE"
6831 echo "AC_CONFIG_HEADERS([config.h])"
6834 echo "AC_PROG_INSTALL"
6835 echo "AC_PROG_MAKE_SET"
6837 echo "# For autobuild."
6838 echo "AC_CANONICAL_BUILD"
6839 echo "AC_CANONICAL_HOST"
6841 echo "m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
6842 echo "m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
6843 echo "m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
6844 echo "m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
6846 func_emit_pre_early_macros false
'' "$final_modules"
6848 for module
in $final_modules; do
6849 if $single_configure; then
6852 func_verify_nontests_module
6854 if test -n "$module"; then
6855 func_get_autoconf_early_snippet
"$module"
6858 |
sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)])/\1/'
6859 if test "$libtool" = true
; then
6860 echo "LT_INIT([win32-dll])"
6861 echo "LT_LANG([C++])"
6862 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
6863 echo "gl_cond_libtool=true"
6865 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
6866 echo "gl_cond_libtool=false"
6868 echo "gl_ltlibdeps="
6870 # Wrap the set of autoconf snippets into an autoconf macro that is then
6871 # invoked. This is needed because autoconf does not support AC_REQUIRE
6873 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
6874 # but we want the AC_REQUIRE to have its normal meaning (provide one
6875 # expansion of the required macro before the current point, and only one
6877 echo "AC_DEFUN([gl_INIT], ["
6878 if test "$auxdir" != "build-aux"; then
6879 sed_replace_build_aux
='
6881 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
6882 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
6886 sed_replace_build_aux
="$sed_noop"
6888 echo "gl_m4_base='$m4base'"
6889 func_emit_initmacro_start
$macro_prefix false
6890 func_emit_shellvars_init false
"$sourcebase"
6891 if $single_configure; then
6892 func_emit_autoconf_snippets
"$main_modules" "$main_modules" func_verify_module true false false
6894 func_emit_autoconf_snippets
"$modules" "$modules" func_verify_nontests_module true false false
6896 func_emit_initmacro_end
$macro_prefix false
6897 if $single_configure; then
6898 echo " gltests_libdeps="
6899 echo " gltests_ltlibdeps="
6900 func_emit_initmacro_start
${macro_prefix}tests true
6901 func_emit_shellvars_init true
"$testsbase"
6902 # Define a tests witness macro.
6903 echo " ${macro_prefix}tests_WITNESS=IN_GNULIB_TESTS"
6904 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
6905 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
6906 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
6907 func_emit_autoconf_snippets
"$testsrelated_modules" "$main_modules $testsrelated_modules" func_verify_module true false false
6908 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
6909 func_emit_initmacro_end
${macro_prefix}tests true
6911 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
6912 # created using libtool, because libtool already handles the dependencies.
6913 if test "$libtool" != true
; then
6914 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
6915 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
6916 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
6917 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
6918 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
6920 if $single_configure; then
6921 if $use_libtests; then
6922 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
6923 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
6927 func_emit_initmacro_done
$macro_prefix $sourcebase
6928 if $single_configure; then
6929 func_emit_initmacro_done
${macro_prefix}tests
$testsbase
6934 if test -n "$subdirs_with_configure_ac"; then
6935 echo "AC_CONFIG_SUBDIRS(["`echo $subdirs_with_configure_ac`"])"
6937 makefiles
="Makefile"
6938 for d
in $subdirs; do
6939 # For subdirs that have a configure.ac by their own, it's the subdir's
6940 # configure.ac which creates the subdir's Makefile.am, not this one.
6941 case " $subdirs_with_configure_ac " in
6943 *) func_append makefiles
" $d/Makefile" ;;
6946 echo "AC_CONFIG_FILES([$makefiles])"
6948 ) > "$testdir/configure.ac"
6950 # Create autogenerated files.
6952 # Do not use "${AUTORECONF} --force --install", because it may invoke
6953 # autopoint, which brings in older versions of some of our .m4 files.
6954 if test -f $m4base/gettext.
m4; then
6955 func_execute_command
${AUTOPOINT} --force || func_exit
1
6956 for f
in $m4base/*.
m4~
; do
6958 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit
1
6962 if test "$libtool" = true
; then
6963 func_execute_command
${LIBTOOLIZE} --copy || func_exit
1
6965 func_execute_command
${ACLOCAL} -I $m4base || func_exit
1
6966 if ! test -d build-aux
; then
6967 func_execute_command mkdir build-aux || func_exit
1
6969 func_execute_command
${AUTOCONF} || func_exit
1
6970 # Explicit 'touch config.h.in': see <https://savannah.gnu.org/support/index.php?109406>.
6971 func_execute_command
${AUTOHEADER} &&
6972 func_execute_command
touch config.h.
in ||
6974 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6975 rm -rf autom4te.cache
6977 if $inctests && ! $single_configure; then
6978 # Create autogenerated files.
6979 (cd "$testdir/$testsbase" || func_exit
1
6980 # Do not use "${AUTORECONF} --force --install", because it may invoke
6981 # autopoint, which brings in older versions of some of our .m4 files.
6982 if test -f ..
/$m4base/gettext.
m4; then
6983 func_execute_command
${AUTOPOINT} --force || func_exit
1
6984 for f
in ..
/$m4base/*.
m4~
; do
6986 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit
1
6990 func_execute_command
${ACLOCAL} -I ..
/$m4base || func_exit
1
6991 if ! test -d ..
/build-aux
; then
6992 func_execute_command mkdir ..
/build-aux
6994 func_execute_command
${AUTOCONF} || func_exit
1
6995 # Explicit 'touch config.h.in': see <https://savannah.gnu.org/support/index.php?109406>.
6996 func_execute_command
${AUTOHEADER} &&
6997 func_execute_command
touch config.h.
in ||
6999 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
7000 rm -rf autom4te.cache
7003 # Need to run configure and make once, to create built files that are to be
7004 # distributed (such as parse-datetime.c).
7005 sed_remove_make_variables
='s,[$]([A-Za-z0-9_]*),,g'
7006 # Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...".
7007 cleaned_files
=`combine_lines < "$testdir/$sourcebase/Makefile.am" \
7008 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
7009 cleaned_files
=`for file in $cleaned_files; do echo " $file "; done`
7010 # Extract the value of "BUILT_SOURCES += ...". Remove variable references
7011 # such $(FOO_H) because they don't refer to distributed files.
7012 built_sources
=`combine_lines < "$testdir/$sourcebase/Makefile.am" \
7013 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
7014 | sed -e "$sed_remove_make_variables"`
7015 distributed_built_sources
=`for file in $built_sources; do
7016 case "$cleaned_files" in
7021 tests_distributed_built_sources
=
7023 # Likewise for built files in the $testsbase directory.
7024 tests_cleaned_files
=`combine_lines < "$testdir/$testsbase/Makefile.am" \
7025 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
7026 tests_cleaned_files
=`for file in $tests_cleaned_files; do echo " $file "; done`
7027 tests_built_sources
=`combine_lines < "$testdir/$testsbase/Makefile.am" \
7028 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
7029 | sed -e "$sed_remove_make_variables"`
7030 tests_distributed_built_sources
=`for file in $tests_built_sources; do
7031 case "$tests_cleaned_files" in
7037 if test -n "$distributed_built_sources" ||
test -n "$tests_distributed_built_sources"; then
7039 .
/configure || func_exit
1
7040 if test -n "$distributed_built_sources"; then
7042 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
7043 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
7048 if test -n "$tests_distributed_built_sources"; then
7050 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
7051 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
7056 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
7062 if test -f build-aux
/test-driver
; then
7063 echo "patching file build-aux/test-driver"
7064 patch build-aux
/test-driver
< "$gnulib_dir"/build-aux
/test-driver.
diff >/dev
/null
2>&1 \
7065 ||
{ rm -f build-aux
/test-driver.orig build-aux
/test-driver.rej
7066 patch build-aux
/test-driver
< "$gnulib_dir"/build-aux
/test-driver-1.16
.3.
diff >/dev
/null
2>&1 \
7067 ||
{ rm -f build-aux
/test-driver.orig build-aux
/test-driver.rej
7068 func_fatal_error
"could not patch test-driver script"
7075 # func_create_megatestdir megatestdir allmodules
7077 # - local_gnulib_path from --local-dir
7078 # - modcache true or false, from --cache-modules/--no-cache-modules
7079 # - auxdir directory relative to destdir where to place build aux files
7080 func_create_megatestdir
()
7084 if test -z "$allmodules"; then
7085 allmodules
=`func_all_modules`
7089 # First, all modules one by one.
7090 for onemodule
in $allmodules; do
7091 func_create_testdir
"$megatestdir/$onemodule" $onemodule
7092 func_append megasubdirs
"$onemodule "
7094 # Then, all modules all together.
7095 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
7096 allmodules
=`for m in $allmodules; do if test $m != config-h; then echo $m; fi; done`
7097 func_create_testdir
"$megatestdir/ALL" "$allmodules"
7098 func_append megasubdirs
"ALL"
7101 cvsdate
=`vc_witness="$gnulib_dir/.git/refs/heads/master"; \
7102 test -f "$vc_witness" || vc_witness="$gnulib_dir/ChangeLog"
7103 sh "$gnulib_dir/build-aux/mdate-sh" "$vc_witness" \
7104 | sed -e 's,January,01,' -e 's,Jan,01,' \
7105 -e 's,February,02,' -e 's,Feb,02,' \
7106 -e 's,March,03,' -e 's,Mar,03,' \
7107 -e 's,April,04,' -e 's,Apr,04,' \
7109 -e 's,June,06,' -e 's,Jun,06,' \
7110 -e 's,July,07,' -e 's,Jul,07,' \
7111 -e 's,August,08,' -e 's,Aug,08,' \
7112 -e 's,September,09,' -e 's,Sep,09,' \
7113 -e 's,October,10,' -e 's,Oct,10,' \
7114 -e 's,November,11,' -e 's,Nov,11,' \
7115 -e 's,December,12,' -e 's,Dec,12,' \
7116 -e 's,^,00,' -e 's,^[0-9]*\([0-9][0-9] \),\1,' \
7117 -e 's,^\([0-9]*\) \([0-9]*\) \([0-9]*\),\3\2\1,'`
7119 echo "CVSDATE=$cvsdate"
7120 echo ": \${MAKE=make}"
7121 echo "test -d logs || mkdir logs"
7122 echo "for module in $megasubdirs; do"
7123 echo " echo \"Working on module \$module...\""
7124 echo " safemodule=\`echo \$module | sed -e 's|/|-|g'\`"
7125 echo " (echo \"To: gnulib@autobuild.josefsson.org\""
7128 echo " : autobuild project... \$module"
7129 echo " : autobuild revision... cvs-\$CVSDATE-000000"
7130 echo " : autobuild timestamp... \`date \"+%Y%m%d-%H%M%S\"\`"
7131 echo " : autobuild hostname... \`hostname\`"
7132 echo " cd \$module && ./configure \$CONFIGURE_OPTIONS && \$MAKE && \$MAKE check && \$MAKE distclean"
7134 echo " ) 2>&1 | { if test -n \"\$AUTOBUILD_SUBST\"; then sed -e \"\$AUTOBUILD_SUBST\"; else cat; fi; } > logs/\$safemodule"
7136 ) > "$megatestdir/do-autobuild"
7137 chmod a
+x
"$megatestdir/do-autobuild"
7139 # Create Makefile.am.
7140 (echo "## Process this file with automake to produce Makefile.in."
7142 echo "AUTOMAKE_OPTIONS = 1.14 foreign"
7144 echo "SUBDIRS = $megasubdirs"
7146 echo "EXTRA_DIST = do-autobuild"
7147 ) > "$megatestdir/Makefile.am"
7149 # Create configure.ac.
7150 (echo "# Process this file with autoconf to produce a configure script."
7151 echo "AC_INIT([dummy], [0])"
7152 if test "$auxdir" != "."; then
7153 echo "AC_CONFIG_AUX_DIR([$auxdir])"
7155 echo "AM_INIT_AUTOMAKE"
7157 echo "AC_PROG_MAKE_SET"
7159 echo "AC_CONFIG_SUBDIRS([$megasubdirs])"
7160 echo "AC_CONFIG_FILES([Makefile])"
7162 ) > "$megatestdir/configure.ac"
7164 # Create autogenerated files.
7166 # Do not use "${AUTORECONF} --install", because autoreconf operates
7167 # recursively, but the subdirectories are already finished, therefore
7168 # calling autoreconf here would only waste lots of CPU time.
7169 func_execute_command
${ACLOCAL} || func_exit
1
7170 func_execute_command mkdir build-aux
7171 func_execute_command
${AUTOCONF} || func_exit
1
7172 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
7173 rm -rf autom4te.cache
7174 if test -f build-aux
/test-driver
; then
7175 echo "patching file build-aux/test-driver"
7176 patch build-aux
/test-driver
< "$gnulib_dir"/build-aux
/test-driver.
diff >/dev
/null
2>&1 \
7177 ||
{ rm -f build-aux
/test-driver.orig build-aux
/test-driver.rej
7178 patch build-aux
/test-driver
< "$gnulib_dir"/build-aux
/test-driver-1.16
.3.
diff >/dev
/null
2>&1 \
7179 ||
{ rm -f build-aux
/test-driver.orig build-aux
/test-driver.rej
7180 func_fatal_error
"could not patch test-driver script"
7189 func_fatal_error
"no mode specified" ;;
7196 # sed expression that converts a literal to a basic regular expression.
7197 # Needs to handle . [ \ * ^ $.
7198 sed_literal_to_basic_regex
='s/\\/\\\\/g
7202 # func_prefixed_modules_in_dir dir
7203 # outputs all module files in dir to standard output, with dir as prefix.
7204 func_prefixed_modules_in_dir
()
7206 (test -d "$1" && cd "$1" && find modules
-type f
-print |
sed -e "s|^|$1/|")
7210 if test -f "$gnulib_dir/$filename" \
7211 || func_lookup_local_file
"$filename"; then
7212 filename_anywhere_regex
=`echo "$filename" | sed -e "$sed_literal_to_basic_regex"`
7213 filename_line_regex
='^'"$filename_anywhere_regex"'$'
7216 (cd "$gnulib_dir" && find modules -type f -print | xargs -n 100 grep -l "$filename_line_regex" /dev/null | sed -e 's,^modules/,,')
7217 func_path_foreach "$local_gnulib_path" func_prefixed_modules_in_dir %dir% | xargs -n 100 grep -l "$filename_anywhere_regex" /dev/null | sed -e 's,^.*/modules/,,' -e 's,\.diff$,,'
7219 | func_sanitize_modulelist \
7222 for module
in $module_candidates; do
7223 if func_get_filelist
$module |
grep "$filename_line_regex" > /dev
/null
; then
7228 func_warning
"file $filename does not exist"
7233 import | add-import | remove-import | update
)
7236 if test -z "$destdir"; then
7239 test -d "$destdir" \
7240 || func_fatal_error
"destination directory does not exist: $destdir"
7242 # Prefer configure.ac to configure.in.
7243 if test -f "$destdir"/configure.ac
; then
7244 configure_ac
="$destdir/configure.ac"
7246 if test -f "$destdir"/configure.
in; then
7247 configure_ac
="$destdir/configure.in"
7249 func_fatal_error
"cannot find $destdir/configure.ac - make sure you run gnulib-tool from within your package's directory"
7253 # Analyze configure.ac.
7255 guessed_libtool
=false
7261 /AC_CONFIG_AUX_DIR/ {
7262 s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^]"$`\\)]*\).*$,guessed_auxdir="\1",p
7264 /A[CM]_PROG_LIBTOOL/ {
7265 s,^.*$,guessed_libtool=true,p
7267 /AC_CONFIG_MACRO_DIR/ {
7268 s,^.*AC_CONFIG_MACRO_DIR([[ ]*\([^]"$`\\)]*\).*$,guessed_m4dirs="${guessed_m4dirs} \1",p
7270 /AC_CONFIG_MACRO_DIRS/ {
7271 s,^.*AC_CONFIG_MACRO_DIRS([[ ]*\([^]"$`\\)]*\).*$,guessed_m4dirs="${guessed_m4dirs} \1",p
7273 eval `sed -n -e "$my_sed_traces" < "$configure_ac"`
7275 if test -z "$auxdir"; then
7276 auxdir
="$guessed_auxdir"
7279 # Determine where to apply func_import.
7280 if test "$mode" = import
; then
7281 # Apply func_import to a particular gnulib directory.
7282 # The command line contains the complete specification; don't look at
7283 # the contents of gnulib-cache.m4.
7284 test -n "$supplied_libname" || supplied_libname
=true
7285 test -n "$sourcebase" || sourcebase
="lib"
7286 test -n "$m4base" || m4base
="m4"
7287 test -n "$docbase" || docbase
="doc"
7288 test -n "$testsbase" || testsbase
="tests"
7289 test -n "$macro_prefix" || macro_prefix
="gl"
7292 if test -n "$m4base"; then
7293 # Apply func_import to a particular gnulib directory.
7294 # Any number of additional modules can be given.
7295 if test ! -f "$destdir/$m4base"/gnulib-cache.
m4; then
7296 # First use of gnulib in the given m4base.
7297 test -n "$supplied_libname" || supplied_libname
=true
7298 test -n "$sourcebase" || sourcebase
="lib"
7299 test -n "$docbase" || docbase
="doc"
7300 test -n "$testsbase" || testsbase
="tests"
7301 test -n "$macro_prefix" || macro_prefix
="gl"
7305 # Apply func_import to all gnulib directories.
7306 # To get this list of directories, look at Makefile.am. (Not at
7307 # configure, because it may be omitted from version control. Also,
7308 # don't run "find $destdir -name gnulib-cache.m4", as it might be
7312 if test -f "$destdir"/Makefile.am
; then
7313 aclocal_amflags
=`sed -n -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/p' "$destdir"/Makefile.am`
7315 for arg
in $aclocal_amflags; do
7316 if test -n "$m4dir_is_next"; then
7317 # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
7321 if test -f "$destdir/$arg"/gnulib-cache.
m4; then
7322 func_append m4dirs
" $arg"
7323 m4dirs_count
=`expr $m4dirs_count + 1`
7329 if test "X$arg" = "X-I"; then
7336 for arg
in $guessed_m4dirs; do
7337 # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
7341 if test -f "$destdir/$arg"/gnulib-cache.
m4; then
7342 func_append m4dirs
" $arg"
7343 m4dirs_count
=`expr $m4dirs_count + 1`
7349 # No Makefile.am! Oh well. Look at the last generated aclocal.m4.
7350 if test -f "$destdir"/aclocal.
m4; then
7351 sedexpr1
='s,^m4_include(\[\(.*\)])$,\1,p'
7352 sedexpr2
='s,^[^/]*$,.,'
7353 sedexpr3
='s,/[^/]*$,,'
7354 m4dirs
=`sed -n -e "$sedexpr1" aclocal.m4 | sed -e "$sedexpr2" -e "$sedexpr3" | LC_ALL=C sort -u`
7355 m4dirs
=`for arg in $m4dirs; do if test -f "$destdir/$arg"/gnulib-cache.m4; then echo $arg; fi; done`
7356 m4dirs_count
=`for arg in $m4dirs; do echo "$arg"; done | wc -l`
7359 if test $m4dirs_count = 0; then
7360 # First use of gnulib in a package.
7361 # Any number of additional modules can be given.
7362 test -n "$supplied_libname" || supplied_libname
=true
7363 test -n "$sourcebase" || sourcebase
="lib"
7365 test -n "$docbase" || docbase
="doc"
7366 test -n "$testsbase" || testsbase
="tests"
7367 test -n "$macro_prefix" || macro_prefix
="gl"
7370 if test $m4dirs_count = 1; then
7371 # There's only one use of gnulib here. Assume the user means it.
7372 # Any number of additional modules can be given.
7373 for m4base
in $m4dirs; do
7377 # Ambiguous - guess what the user meant.
7378 if test $# = 0; then
7379 # No further arguments. Guess the user wants to update all of them.
7380 for m4base
in $m4dirs; do
7381 # Perform func_import in a subshell, so that variable values
7383 # local_gnulib_path, incobsolete, inc_cxx_tests,
7384 # inc_longrunning_tests, inc_privileged_tests,
7385 # inc_unportable_tests, inc_all_tests, avoidlist, sourcebase,
7386 # m4base, pobase, docbase, testsbase, inctests, libname, lgpl,
7387 # makefile_name, tests_makefile_name, automake_subdir, libtool,
7388 # macro_prefix, po_domain, witness_c_macro, vc_files
7389 # don't propagate from one directory to another.
7390 (func_import
) || func_exit
1
7394 func_fatal_error
"Ambiguity: to which directory should the modules be added? Please specify at least --m4-base=..."
7403 if test -z "$destdir"; then
7404 func_fatal_error
"please specify --dir option"
7407 test -d "$destdir" \
7408 || func_fatal_error
"could not create destination directory"
7409 test -n "$auxdir" || auxdir
="build-aux"
7410 func_create_testdir
"$destdir" "$*"
7413 create-megatestdir
)
7414 if test -z "$destdir"; then
7415 func_fatal_error
"please specify --dir option"
7417 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
7418 test -n "$auxdir" || auxdir
="build-aux"
7419 func_create_megatestdir
"$destdir" "$*"
7423 test -n "$destdir" || destdir
=testdir$$
7424 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
7425 test -n "$auxdir" || auxdir
="build-aux"
7426 func_create_testdir
"$destdir" "$*"
7430 ..
/configure || func_exit
1
7431 $MAKE || func_exit
1
7432 $MAKE check || func_exit
1
7433 $MAKE distclean || func_exit
1
7434 remaining
=`find . -type f -print`
7435 if test -n "$remaining"; then
7436 echo "Remaining files:" $remaining 1>&2
7437 echo "gnulib-tool: *** Stop." 1>&2
7446 test -n "$destdir" || destdir
=testdir$$
7447 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
7448 test -n "$auxdir" || auxdir
="build-aux"
7449 func_create_megatestdir
"$destdir" "$*"
7457 remaining
=`find . -type f -print`
7458 if test -n "$remaining"; then
7459 echo "Remaining files:" $remaining 1>&2
7460 echo "gnulib-tool: *** Stop." 1>&2
7468 extract-description
)
7472 if test -n "$module"; then
7473 func_get_description
"$module"
7482 if test -n "$module"; then
7483 func_get_comment
"$module"
7492 if test -n "$module"; then
7493 func_get_status
"$module"
7502 if test -n "$module"; then
7503 func_get_notice
"$module"
7508 extract-applicability
)
7512 if test -n "$module"; then
7513 func_get_applicability
"$module"
7522 if test -n "$module"; then
7523 func_get_filelist
"$module"
7528 extract-dependencies
)
7529 if test -n "$avoidlist"; then
7530 func_fatal_error
"cannot combine --avoid and --extract-dependencies"
7535 if test -n "$module"; then
7536 func_get_dependencies
"$module"
7541 extract-recursive-dependencies
)
7542 if test -n "$avoidlist"; then
7543 func_fatal_error
"cannot combine --avoid and --extract-recursive-dependencies"
7548 if test -n "$module"; then
7549 func_get_dependencies_recursively
"$module"
7554 extract-autoconf-snippet
)
7558 if test -n "$module"; then
7559 func_get_autoconf_snippet
"$module"
7564 extract-automake-snippet
)
7565 test -n "$auxdir" || auxdir
="build-aux"
7569 if test -n "$module"; then
7570 func_get_automake_snippet
"$module"
7575 extract-include-directive
)
7579 if test -n "$module"; then
7580 func_get_include_directive
"$module"
7585 extract-link-directive
)
7589 if test -n "$module"; then
7590 func_get_link_directive
"$module"
7595 extract-recursive-link-directive
)
7596 if test -n "$avoidlist"; then
7597 func_fatal_error
"cannot combine --avoid and --extract-recursive-link-directive"
7602 if test -n "$module"; then
7603 func_get_link_directive_recursively
"$module"
7612 if test -n "$module"; then
7613 func_get_license
"$module"
7618 extract-maintainer
)
7622 if test -n "$module"; then
7623 func_get_maintainer
"$module"
7628 extract-tests-module
)
7632 if test -n "$module"; then
7633 func_get_tests_module
"$module"
7639 # Verify the number of arguments.
7640 if test $# -lt 1 ||
test $# -gt 2; then
7641 func_fatal_error
"invalid number of arguments for --$mode"
7644 # The first argument is the file to be copied.
7646 # Verify the file exists.
7647 func_lookup_file
"$f"
7649 # The second argument is the destination; either a directory ot a file.
7650 # It defaults to the current directory.
7652 test -n "$dest" || dest
='.'
7653 test -n "$sourcebase" || sourcebase
="lib"
7654 test -n "$m4base" || m4base
="m4"
7655 test -n "$docbase" || docbase
="doc"
7656 test -n "$testsbase" || testsbase
="tests"
7657 test -n "$auxdir" || auxdir
="build-aux"
7658 rewritten
='%REWRITTEN%'
7659 sed_rewrite_files
="\
7660 s,^build-aux/,$rewritten$auxdir/,
7661 s,^doc/,$rewritten$docbase/,
7662 s,^lib/,$rewritten$sourcebase/,
7663 s,^m4/,$rewritten$m4base/,
7664 s,^tests/,$rewritten$testsbase/,
7667 if test -d "$dest"; then
7669 g
=`echo "$f" | sed -e "$sed_rewrite_files"`
7671 destdir
=`dirname "$dest"`
7672 g
=`basename "$dest"`
7675 # Create the directory for destfile.
7676 d
=`dirname "$destdir/$g"`
7678 if test -n "$d" && test ! -d "$d"; then
7679 mkdir
-p "$d" || func_fatal_error
"failed"
7683 func_dest_tmpfilename
"$g"
7684 cp "$lookedup_file" "$tmpfile" || func_fatal_error
"failed"
7685 func_ensure_writable
"$tmpfile"
7686 already_present
=true
7687 if test -f "$destdir/$g"; then
7688 # The file already exists.
7692 # Don't protest if the file should be there but isn't: it happens
7693 # frequently that developers don't put autogenerated files under version
7701 func_fatal_error
"unknown operation mode --$mode" ;;
7704 if test "$copymode" = hardlink
-o "$lcopymode" = hardlink
; then
7705 # Setting hard links modifies the ctime of files in the gnulib checkout.
7706 # This disturbs the result of the next "gitk" invocation.
7707 # Workaround: Let git scan the files. This can be done through
7708 # "git update-index --refresh" or "git status" or "git diff".
7709 if test -d "$gnulib_dir"/.git \
7710 && (git
--version) >/dev
/null
2>/dev
/null
; then
7711 (cd "$gnulib_dir" && git update-index
--refresh >/dev
/null
)
7716 # Undo the effect of the previous 'trap' command. Some shellology:
7717 # We cannot use "trap - EXIT HUP INT QUIT PIPE TERM", because Solaris sh would
7718 # attempt to execute the command "-". "trap '' ..." is fine only for signal EXIT
7719 # (= normal exit); for the others we need to call 'exit' explicitly. The value
7720 # of $? is 128 + signal number and is set before the trap-registered command is
7723 trap 'func_exit $?' HUP INT QUIT PIPE TERM
7728 # indent-tabs-mode: nil
7729 # whitespace-check-buffer-indent: nil