3 # Copyright (C) 2002-2020 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.63 is already in your PATH.
55 # AUTOCONFBINDIR=/arch/x86-linux/gnu-inst-autoconf/2.63/bin
56 # AUTOCONFPATH="eval env PATH=${AUTOCONFBINDIR}:\$PATH "
60 # You can set AUTOMAKEPATH to empty if automake 1.11 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 --cache-modules Enable module caching optimization.
232 --no-cache-modules Disable module caching optimization.
233 --verbose Increase verbosity. May be repeated.
234 --quiet Decrease verbosity. May be repeated.
236 Options for --import, --add/remove-import, --update:
238 --dry-run Only print what would have been done.
240 Options for --import, --add/remove-import:
242 --with-tests Include unit tests for the included modules.
244 Options for --create-[mega]testdir, --[mega]test:
246 --without-tests Don't include unit tests for the included modules.
248 Options for --import, --add/remove-import,
249 --create-[mega]testdir, --[mega]test:
251 --with-obsolete Include obsolete modules when they occur among the
252 dependencies. By default, dependencies to obsolete
254 --with-c++-tests Include even unit tests for C++ interoperability.
255 --without-c++-tests Exclude unit tests for C++ interoperability.
256 --with-longrunning-tests
257 Include even unit tests that are long-runners.
258 --without-longrunning-tests
259 Exclude unit tests that are long-runners.
260 --with-privileged-tests
261 Include even unit tests that require root
263 --without-privileged-tests
264 Exclude unit tests that require root privileges.
265 --with-unportable-tests
266 Include even unit tests that fail on some platforms.
267 --without-unportable-tests
268 Exclude unit tests that fail on some platforms.
269 --with-all-tests Include all kinds of problematic unit tests.
270 --avoid=MODULE Avoid including the given MODULE. Useful if you
271 have code that provides equivalent functionality.
272 This option can be repeated.
273 --conditional-dependencies
274 Support conditional dependencies (may save configure
275 time and object code).
276 --no-conditional-dependencies
277 Don't use conditional dependencies.
278 --libtool Use libtool rules.
279 --no-libtool Don't use libtool rules.
281 Options for --import, --add/remove-import:
283 --lib=LIBRARY Specify the library name. Defaults to 'libgnu'.
284 --source-base=DIRECTORY
285 Directory relative to --dir where source code is
286 placed (default \"lib\").
287 --m4-base=DIRECTORY Directory relative to --dir where *.m4 macros are
288 placed (default \"m4\").
289 --po-base=DIRECTORY Directory relative to --dir where *.po files are
290 placed (default \"po\").
291 --doc-base=DIRECTORY Directory relative to --dir where doc files are
292 placed (default \"doc\").
293 --tests-base=DIRECTORY
294 Directory relative to --dir where unit tests are
295 placed (default \"tests\").
296 --aux-dir=DIRECTORY Directory relative to --dir where auxiliary build
297 tools are placed (default comes from configure.ac).
298 --gnu-make Output for GNU Make instead of for the default
300 --lgpl[=2|=3orGPLv2|=3]
301 Abort if modules aren't available under the LGPL.
302 Also modify license template from GPL to LGPL.
303 The version number of the LGPL can be specified;
304 the default is currently LGPLv3.
305 --makefile-name=NAME Name of makefile in the source-base and tests-base
306 directories (default \"Makefile.am\", or
307 \"Makefile.in\" if --gnu-make).
308 --macro-prefix=PREFIX Specify the prefix of the macros 'gl_EARLY' and
309 'gl_INIT'. Default is 'gl'.
310 --po-domain=NAME Specify the prefix of the i18n domain. Usually use
311 the package name. A suffix '-gnulib' is appended.
312 --witness-c-macro=NAME Specify the C macro that is defined when the
313 sources in this directory are compiled or used.
314 --vc-files Update version control related files.
315 --no-vc-files Don't update version control related files
316 (.gitignore and/or .cvsignore).
318 Options for --create-[mega]testdir, --[mega]test:
320 --single-configure Generate a single configure file, not a separate
321 configure file for the tests directory.
323 Options for --import, --add/remove-import, --update,
324 --create-[mega]testdir, --[mega]test:
326 -s, --symbolic, --symlink Make symbolic links instead of copying files.
327 --local-symlink Make symbolic links instead of copying files, only
328 for files from the local override directory.
329 -h, --hardlink Make hard links instead of copying files.
330 --local-hardlink Make hard links instead of copying files, only
331 for files from the local override directory.
333 Options for --import, --add/remove-import, --update:
335 -S, --more-symlinks Make symbolic links instead of copying files, and
336 don't replace copyright notices.
337 -H, --more-hardlinks Make hard links instead of copying files, and
338 don't replace copyright notices.
340 Report bugs to <bug-gnulib@gnu.org>."
344 # outputs to stdout the --version message.
348 if test -d "$gnulib_dir"/.git \
349 && (git
--version) >/dev
/null
2>/dev
/null \
350 && (date --version) >/dev
/null
2>/dev
/null
; then
351 # gnulib checked out from git.
352 sed_extract_first_date
='/^Date/{
356 date=`cd "$gnulib_dir" && git log ChangeLog | sed -n -e "$sed_extract_first_date"`
357 # Turn "Fri Mar 21 07:16:51 2008 -0600" into "Mar 21 2008 07:16:51 -0600".
358 sed_year_before_time
='s/^[^ ]* \([^ ]*\) \([0-9]*\) \([0-9:]*\) \([0-9]*\) /\1 \2 \4 \3 /'
359 date=`echo "$date" | sed -e "$sed_year_before_time"`
360 # Use GNU date to compute the time in GMT.
361 date=`date -d "$date" -u +"%Y-%m-%d %H:%M:%S"`
362 version
=' '`cd "$gnulib_dir" && ./build-aux/git-version-gen /dev/null | sed -e 's/-dirty/-modified/'`
364 # gnulib copy without versioning information.
365 date=`sed -e 's/ .*//;q' "$gnulib_dir"/ChangeLog`
368 year
=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed -e 's,^.* ,,'`
370 gnulib-tool (GNU $package $date)$version
371 Copyright (C) $year Free Software Foundation, Inc.
372 License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
373 This is free software: you are free to change and redistribute it.
374 There is NO WARRANTY, to the extent permitted by law.
376 printf "Written by %s, %s, and %s.\n" "Bruno Haible" "Paul Eggert" "Simon Josefsson"
379 # func_emit_copyright_notice
380 # outputs to stdout a header for a generated file.
381 func_emit_copyright_notice
()
383 sed -n -e '/Copyright/ {
386 }' < "$self_abspathname"
388 echo "# This file is free software; you can redistribute it and/or modify"
389 echo "# it under the terms of the GNU General Public License as published by"
390 echo "# the Free Software Foundation; either version 3 of the License, or"
391 echo "# (at your option) any later version."
393 echo "# This file is distributed in the hope that it will be useful,"
394 echo "# but WITHOUT ANY WARRANTY; without even the implied warranty of"
395 echo "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
396 echo "# GNU General Public License for more details."
398 echo "# You should have received a copy of the GNU General Public License"
399 echo "# along with this file. If not, see <https://www.gnu.org/licenses/>."
401 echo "# As a special exception to the GNU General Public License,"
402 echo "# this file may be distributed as part of a program that"
403 echo "# contains a configuration script generated by Autoconf, under"
404 echo "# the same distribution terms as the rest of that program."
406 echo "# Generated by gnulib-tool."
410 # exits with a given status.
411 # This function needs to be used, rather than 'exit', when a 'trap' handler is
412 # in effect that refers to $?.
419 # locates the directory where the gnulib repository lives
421 # - progname name of this program
423 # - self_abspathname absolute pathname of gnulib-tool
424 # - gnulib_dir absolute pathname of gnulib repository
428 /* | ?
:*) self_abspathname
="$progname" ;;
429 */*) self_abspathname
=`pwd`/"$progname" ;;
432 # Iterate through the elements of $PATH.
433 # We use IFS=: instead of
434 # for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'`
435 # because the latter does not work when some PATH element contains spaces.
436 # We use a canonicalized $pathx instead of $PATH, because empty PATH
437 # elements are by definition equivalent to '.', however field splitting
438 # according to IFS=: loses empty fields in many shells:
439 # - /bin/sh on OSF/1 and Solaris loses all empty fields (at the
440 # beginning, at the end, and in the middle),
441 # - /bin/sh on IRIX and /bin/ksh on IRIX and OSF/1 lose empty fields
442 # at the beginning and at the end,
443 # - GNU bash, /bin/sh on AIX and HP-UX, and /bin/ksh on AIX, HP-UX,
444 # Solaris lose empty fields at the end.
445 # The 'case' statement is an optimization, to avoid evaluating the
446 # explicit canonicalization command when $PATH contains no empty fields.
448 if test "$PATH_SEPARATOR" = ";"; then
449 # On Windows, programs are searched in "." before $PATH.
452 # On Unix, we have to convert empty PATH elements to ".".
456 pathx
=`echo ":$PATH:" | sed -e 's/:::*/:.:/g' -e 's/^://' -e 's/:\$//'`
461 IFS
="$PATH_SEPARATOR"
465 if test -x "$d/$progname" && test ! -d "$d/$progname"; then
466 self_abspathname
="$d/$progname"
471 if test -z "$self_abspathname"; then
472 func_fatal_error
"could not locate the gnulib-tool program - how did you invoke it?"
476 while test -h "$self_abspathname"; do
477 # Resolve symbolic link.
478 linkval
=`func_readlink "$self_abspathname"`
479 test -n "$linkval" ||
break
481 /* | ?
:* ) self_abspathname
="$linkval" ;;
482 * ) self_abspathname
=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;;
485 gnulib_dir
=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
489 # creates a temporary directory.
491 # - progname name of this program
493 # - tmp pathname of freshly created temporary directory
496 # Use the environment variable TMPDIR, falling back to /tmp. This allows
497 # users to specify a different temporary directory, for example, if their
498 # /tmp is filled up or too small.
501 # Use the mktemp program if available. If not available, hide the error
503 tmp
=`(umask 077 && mktemp -d "$TMPDIR/glXXXXXX") 2>/dev/null` &&
504 test -n "$tmp" && test -d "$tmp"
507 # Use a simple mkdir command. It is guaranteed to fail if the directory
508 # already exists. $RANDOM is bash specific and expands to empty in shells
509 # other than bash, ksh and zsh. Its use does not increase security;
510 # rather, it minimizes the probability of failure in a very cluttered /tmp
512 tmp
=$TMPDIR/gl$$
-$RANDOM
513 (umask 077 && mkdir
"$tmp")
516 echo "$progname: cannot create a temporary directory in $TMPDIR" >&2
521 # func_append var value
522 # appends the given value to the shell variable var.
523 if ( foo
=bar
; foo
+=baz
&& test "$foo" = barbaz
) >/dev
/null
2>&1; then
524 # Use bash's += operator. It reduces complexity of appending repeatedly to
525 # a single variable from O(n^2) to O(n).
530 fast_func_append
=true
534 eval "$1=\"\$$1\$2\""
536 fast_func_append
=false
539 # func_remove_prefix var prefix
540 # removes the given prefix from the value of the shell variable var.
541 # var should be the name of a shell variable.
542 # Its value should not contain a newline and not start or end with whitespace.
543 # prefix should not contain the characters "$`\{}[]^|.
544 if ( foo
=bar
; eval 'test "${foo#b}" = ar' ) >/dev
/null
2>&1; then
545 func_remove_prefix
()
549 fast_func_remove_prefix
=true
551 func_remove_prefix
()
553 eval "value=\"\$$1\""
557 sed_escape_dots
='s/\([.]\)/\\\1/g'
558 prefix
=`echo "$prefix" | sed -e "$sed_escape_dots"`
561 value
=`echo "$value" | sed -e "s|^${prefix}||"`
562 eval "$1=\"\$value\""
564 fast_func_remove_prefix
=false
567 # Determine whether we should use ':' or ';' as PATH_SEPARATOR.
568 func_determine_path_separator
()
570 if test "${PATH_SEPARATOR+set}" != set; then
571 # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
572 # contains only /bin. Note that ksh looks also at the FPATH variable,
573 # so we have to set that as well for the test.
575 (PATH
='/bin;/bin'; FPATH
=$PATH; sh
-c :) >/dev
/null
2>&1 \
576 && { (PATH
='/bin:/bin'; FPATH
=$PATH; sh
-c :) >/dev
/null
2>&1 \
577 || PATH_SEPARATOR
=';'
582 # func_path_append pathvar directory
583 # appends directory to pathvar, delimiting directories by PATH_SEPARATOR.
586 if eval "test -n \"\$$1\""; then
587 func_append
"$1" "$PATH_SEPARATOR$2"
593 # func_path_foreach_inner
594 # helper for func_path_foreach because we need new 'args' array
596 # - fpf_dir directory from local_gnulib_path
597 # - fpf_cb callback to be run for fpf_dir
598 func_path_foreach_inner
()
620 # func_path_foreach path method args
621 # Execute method for each directory in path. The method will be called
622 # like `method args` while any argument '%dir%' within args will be replaced
623 # with processed directory from path.
631 IFS
="$PATH_SEPARATOR"
632 for fpf_dir
in $fpf_dirs
635 func_path_foreach_inner
"$@" && fpf_rc
=:
641 # func_remove_suffix var suffix
642 # removes the given suffix from the value of the shell variable var.
643 # var should be the name of a shell variable.
644 # Its value should not contain a newline and not start or end with whitespace.
645 # suffix should not contain the characters "$`\{}[]^|.
646 if ( foo
=bar
; eval 'test "${foo%r}" = ba' ) >/dev
/null
2>&1; then
647 func_remove_suffix
()
651 fast_func_remove_suffix
=true
653 func_remove_suffix
()
655 eval "value=\"\$$1\""
659 sed_escape_dots
='s/\([.]\)/\\\1/g'
660 suffix
=`echo "$suffix" | sed -e "$sed_escape_dots"`
663 value
=`echo "$value" | sed -e "s|${suffix}\$||"`
664 eval "$1=\"\$value\""
666 fast_func_remove_suffix
=false
669 # func_fatal_error message
670 # outputs to stderr a fatal error message, and terminates the program.
672 # - progname name of this program
675 echo "$progname: *** $1" 1>&2
676 echo "$progname: *** Stop." 1>&2
680 # func_warning message
681 # Outputs to stderr a warning message,
684 echo "gnulib-tool: warning: $1" 1>&2
687 # func_readlink SYMLINK
688 # outputs the target of the given symlink.
689 if (type readlink
) > /dev
/null
2>&1; then
692 # Use the readlink program from GNU coreutils.
698 # Use two sed invocations. A single sed -n -e 's,^.* -> \(.*\)$,\1,p'
699 # would do the wrong thing if the link target contains " -> ".
700 LC_ALL
=C
ls -l "$1" |
sed -e 's, -> ,#%%#,' |
sed -n -e 's,^.*#%%#\(.*\)$,\1,p'
704 # func_relativize DIR1 DIR2
705 # computes a relative pathname RELDIR such that DIR1/RELDIR = DIR2.
707 # - DIR1 relative pathname, relative to the current directory
708 # - DIR2 relative pathname, relative to the current directory
710 # - reldir relative pathname of DIR2, relative to DIR1
716 sed_first
='s,^\([^/]*\)/.*$,\1,'
717 sed_rest
='s,^[^/]*/*,,'
718 sed_last
='s,^.*/\([^/]*\)$,\1,'
719 sed_butlast
='s,/*[^/]*$,,'
720 while test -n "$dir1"; do
721 first
=`echo "$dir1" | sed -e "$sed_first"`
722 if test "$first" != "."; then
723 if test "$first" = ".."; then
724 dir2
=`echo "$dir0" | sed -e "$sed_last"`/"$dir2"
725 dir0
=`echo "$dir0" | sed -e "$sed_butlast"`
727 first2
=`echo "$dir2" | sed -e "$sed_first"`
728 if test "$first2" = "$first"; then
729 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
733 dir0
="$dir0"/"$first"
736 dir1
=`echo "$dir1" | sed -e "$sed_rest"`
741 # func_relconcat DIR1 DIR2
742 # computes a relative pathname DIR1/DIR2, with obvious simplifications.
744 # - DIR1 relative pathname, relative to the current directory
745 # - DIR2 relative pathname, relative to DIR1
747 # - relconcat DIR1/DIR2, relative to the current directory
752 sed_first
='s,^\([^/]*\)/.*$,\1,'
753 sed_rest
='s,^[^/]*/*,,'
754 sed_last
='s,^.*/\([^/]*\)$,\1,'
755 sed_butlast
='s,/*[^/]*$,,'
757 first
=`echo "$dir2" | sed -e "$sed_first"`
758 if test "$first" = "."; then
759 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
760 if test -z "$dir2"; then
765 last
=`echo "$dir1" | sed -e "$sed_last"`
766 while test "$last" = "."; do
767 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
768 last
=`echo "$dir1" | sed -e "$sed_last"`
770 if test -z "$dir1"; then
774 if test "$first" = ".."; then
775 if test "$last" = ".."; then
776 relconcat
="$dir1/$dir2"
779 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
780 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
781 if test -z "$dir1"; then
785 if test -z "$dir2"; then
790 relconcat
="$dir1/$dir2"
797 # func_ensure_writable DEST
798 # Ensures the file DEST is writable.
799 func_ensure_writable
()
801 test -w "$1" ||
chmod u
+w
"$1"
805 # Like ln -s, except use cp -p if ln -s fails.
809 echo "$progname: ln -s failed; falling back on cp -p" >&2
812 /* | ?
:*) # SRC is absolute.
814 *) # SRC is relative to the directory of DEST.
816 */*) cp_src
="${2%/*}/$1" ;;
823 func_ensure_writable
"$2"
827 # func_symlink_target SRC DEST
828 # Determines LINK_TARGET such that "ln -s LINK_TARGET DEST" will create a
829 # symbolic link DEST that points to SRC.
831 # - link_target link target, relative to the directory of DEST
832 func_symlink_target
()
837 *) # SRC is relative.
840 link_target
="`pwd`/$1" ;;
841 *) # DEST is relative too.
842 ln_destdir
=`echo "$2" | sed -e 's,[^/]*$,,'`
843 test -n "$ln_destdir" || ln_destdir
="."
844 func_relativize
"$ln_destdir" "$1"
845 link_target
="$reldir"
852 # func_symlink SRC DEST
853 # Like func_ln_s, except that SRC is given relative to the current directory (or
854 # absolute), not given relative to the directory of DEST.
857 func_symlink_target
"$1" "$2"
858 func_ln_s
"$link_target" "$2"
861 # func_symlink_if_changed SRC DEST
862 # Like func_symlink, but avoids munging timestamps if the link is correct.
863 # SRC is given relative to the current directory (or absolute).
864 func_symlink_if_changed
()
866 if test $# -ne 2; then
867 echo "usage: func_symlink_if_changed SRC DEST" >&2
869 func_symlink_target
"$1" "$2"
870 ln_target
=`func_readlink "$2"`
871 if test -h "$2" && test "$link_target" = "$ln_target"; then
875 func_ln_s
"$link_target" "$2"
879 # func_hardlink SRC DEST
880 # Like ln, except use cp -p if ln fails.
881 # SRC is given relative to the current directory (or absolute).
885 echo "$progname: ln failed; falling back on cp -p" >&2
887 func_ensure_writable
"$2"
891 # Ensure an 'echo' command that
892 # 1. does not interpret backslashes and
893 # 2. does not print an error message "broken pipe" when writing into a pipe
896 # Test cases for problem 1:
897 # echo '\n' | wc -l prints 1 when OK, 2 when KO
898 # echo '\t' | grep t > /dev/null has return code 0 when OK, 1 when KO
899 # Test cases for problem 2:
900 # echo hi | true frequently prints
901 # "bash: echo: write error: Broken pipe"
902 # to standard error in bash 3.2.
904 # Problem 1 is a weird heritage from SVR4. BSD got it right (except that
905 # BSD echo interprets '-n' as an option, which is also not desirable).
906 # Nowadays the problem occurs in 4 situations:
907 # - in bash, when the shell option xpg_echo is set (bash >= 2.04)
908 # or when it was built with --enable-usg-echo-default (bash >= 2.0)
909 # or when it was built with DEFAULT_ECHO_TO_USG (bash < 2.0),
910 # - in zsh, when sh-emulation is not set,
911 # - in ksh (e.g. AIX /bin/sh and Solaris /usr/xpg4/bin/sh are ksh instances,
912 # and HP-UX /bin/sh and IRIX /bin/sh behave similarly),
913 # - in Solaris /bin/sh and OSF/1 /bin/sh.
914 # We try the following workarounds:
915 # - for all: respawn using $CONFIG_SHELL if that is set and works.
916 # - for bash >= 2.04: unset the shell option xpg_echo.
917 # - for bash >= 2.0: define echo to a function that uses the printf built-in.
918 # - for bash < 2.0: define echo to a function that uses cat of a here document.
919 # - for zsh: turn sh-emulation on.
920 # - for ksh: alias echo to 'print -r'.
921 # - for ksh: alias echo to a function that uses cat of a here document.
922 # - for Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh and rely on
923 # the ksh workaround.
924 # - otherwise: respawn using /bin/sh and rely on the workarounds.
925 # When respawning, we pass --no-reexec as first argument, so as to avoid
926 # turning this script into a fork bomb in unlucky situations.
928 # Problem 2 is specific to bash 3.2 and affects the 'echo' built-in, but not
929 # the 'printf' built-in. See
930 # <https://lists.gnu.org/r/bug-bash/2008-12/msg00050.html>
931 # <https://lists.gnu.org/r/bug-gnulib/2010-02/msg00154.html>
932 # The workaround is: define echo to a function that uses the printf built-in.
934 if echo '\t' |
grep t
> /dev
/null
; then
935 have_echo
=yes # Lucky!
937 # Try the workarounds.
938 # Respawn using $CONFIG_SHELL if that is set and works.
939 if test -z "$have_echo" \
940 && test "X$1" != "X--no-reexec" \
941 && test -n "$CONFIG_SHELL" \
942 && test -f "$CONFIG_SHELL" \
943 && $CONFIG_SHELL -c "echo '\\t' | grep t > /dev/null"; then
944 exec $CONFIG_SHELL "$0" --no-reexec "$@"
947 # For bash >= 2.04: unset the shell option xpg_echo.
948 if test -z "$have_echo" \
949 && test -n "$BASH_VERSION" \
950 && (shopt -o xpg_echo
; echo '\t' |
grep t
> /dev
/null
) 2>/dev
/null
; then
954 # For bash >= 2.0: define echo to a function that uses the printf built-in.
955 # For bash < 2.0: define echo to a function that uses cat of a here document.
956 # (There is no win in using 'printf' over 'cat' if it is not a shell built-in.)
957 # Also handle problem 2, specific to bash 3.2, here.
958 if { test -z "$have_echo" \
959 ||
case "$BASH_VERSION" in 3.2*) true
;; *) false
;; esac; \
961 && test -n "$BASH_VERSION"; then \
962 if type printf 2>/dev
/null |
grep / > /dev
/null
; then
963 # 'printf' is not a shell built-in.
971 # 'printf' is a shell built-in.
977 if echo '\t' |
grep t
> /dev
/null
; then
981 # For zsh: turn sh-emulation on.
982 if test -z "$have_echo" \
983 && test -n "$ZSH_VERSION" \
984 && (emulate sh
) >/dev
/null
2>&1; then
987 # For ksh: alias echo to 'print -r'.
988 if test -z "$have_echo" \
989 && (type print
) >/dev
/null
2>&1; then
990 # A 'print' command exists.
991 if type print
2>/dev
/null |
grep / > /dev
/null
; then
994 # 'print' is a shell built-in.
995 if (print
-r '\told' |
grep told
> /dev
/null
) 2>/dev
/null
; then
996 # 'print' is the ksh shell built-in.
997 alias echo='print -r'
1001 if test -z "$have_echo" \
1002 && echo '\t' |
grep t
> /dev
/null
; then
1005 # For ksh: alias echo to a function that uses cat of a here document.
1006 # The ksh manual page says:
1007 # "Aliasing is performed when scripts are read, not while they are executed.
1008 # Therefore, for an alias to take effect, the alias definition command has
1009 # to be executed before the command which references the alias is read."
1010 # Because of this, we have to play strange tricks with have_echo, to ensure
1011 # that the top-level statement containing the test starts after the 'alias'
1013 if test -z "$have_echo"; then
1020 if (alias echo=bsd_echo
) 2>/dev
/null
; then
1021 alias echo=bsd_echo
2>/dev
/null
1024 if test -z "$have_echo" \
1025 && echo '\t' |
grep t
> /dev
/null
; then
1028 if test -z "$have_echo"; then
1029 if (alias echo=bsd_echo
) 2>/dev
/null
; then
1030 unalias echo 2>/dev
/null
1033 # For Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh.
1034 if test -z "$have_echo" \
1035 && test "X$1" != "X--no-reexec" \
1036 && test -f /bin
/ksh
; then
1037 exec /bin
/ksh
"$0" --no-reexec "$@"
1040 # Otherwise: respawn using /bin/sh.
1041 if test -z "$have_echo" \
1042 && test "X$1" != "X--no-reexec" \
1043 && test -f /bin
/sh
; then
1044 exec /bin
/sh
"$0" --no-reexec "$@"
1047 if test -z "$have_echo"; then
1048 func_fatal_error
"Shell does not support 'echo' correctly. Please install GNU bash and set the environment variable CONFIG_SHELL to point to it."
1050 if echo '\t' |
grep t
> /dev
/null
; then
1053 func_fatal_error
"Shell does not support 'echo' correctly. Workaround does not work. Please report this as a bug to bug-gnulib@gnu.org."
1055 if test "X$1" = "X--no-reexec"; then
1059 # Unset CDPATH. Otherwise, output from 'cd dir' can surprise callers.
1060 (unset CDPATH
) >/dev
/null
2>&1 && unset CDPATH
1062 # Determine the path separator early because the following option parsing code
1064 func_determine_path_separator
1066 # Command-line option processing.
1067 # Removes the OPTIONS from the arguments. Sets the variables:
1068 # - mode one of: list, find, import, add-import, remove-import,
1069 # update, create-testdir, create-megatestdir, test, megatest,
1071 # - destdir from --dir
1072 # - local_gnulib_path from --local-dir, highest priority dir comes first
1073 # - modcache true or false, from --cache-modules/--no-cache-modules
1074 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
1075 # - libname, supplied_libname from --lib
1076 # - sourcebase from --source-base
1077 # - m4base from --m4-base
1078 # - pobase from --po-base
1079 # - docbase from --doc-base
1080 # - testsbase from --tests-base
1081 # - auxdir from --aux-dir
1082 # - inctests true if --with-tests was given, false if --without-tests
1083 # was given, blank otherwise
1084 # - incobsolete true if --with-obsolete was given, blank otherwise
1085 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
1086 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
1088 # - inc_privileged_tests true if --with-privileged-tests was given, blank
1090 # - inc_unportable_tests true if --with-unportable-tests was given, blank
1092 # - inc_all_tests true if --with-all-tests was given, blank otherwise
1093 # - excl_cxx_tests true if --without-c++-tests was given, blank otherwise
1094 # - excl_longrunning_tests true if --without-longrunning-tests was given,
1096 # - excl_privileged_tests true if --without-privileged-tests was given, blank
1098 # - excl_unportable_tests true if --without-unportable-tests was given, blank
1100 # - single_configure true if --single-configure was given, false otherwise
1101 # - avoidlist list of modules to avoid, from --avoid
1102 # - cond_dependencies true if --conditional-dependencies was given, false if
1103 # --no-conditional-dependencies was given, blank otherwise
1104 # - lgpl yes or a number if --lgpl was given, blank otherwise
1105 # - gnu_make true if --gnu-make was given, false otherwise
1106 # - makefile_name from --makefile-name
1107 # - libtool true if --libtool was given, false if --no-libtool was
1108 # given, blank otherwise
1109 # - macro_prefix from --macro-prefix
1110 # - po_domain from --po-domain
1111 # - witness_c_macro from --witness-c-macro
1112 # - vc_files true if --vc-files was given, false if --no-vc-files was
1113 # given, blank otherwise
1114 # - autoconf_minversion minimum supported autoconf version
1115 # - doit : if actions shall be executed, false if only to be printed
1116 # - copymode symlink if --symlink or --more-symlinks was given,
1117 # hardlink if --hardlink or --more-hardlinks was given,
1119 # - lcopymode symlink if --local-symlink was given,
1120 # hardlink if --local-hardlink was given,
1122 # - do_copyrights blank if --more-symlinks or --more-hardlinks was given,
1141 inc_longrunning_tests
=
1142 inc_privileged_tests
=
1143 inc_unportable_tests
=
1146 excl_longrunning_tests
=
1147 excl_privileged_tests
=
1148 excl_unportable_tests
=
1149 single_configure
=false
1167 while test $# -gt 0; do
1172 --find |
--fin |
--fi |
--f )
1175 --import |
--impor |
--impo |
--imp |
--im |
--i )
1178 --add-import |
--add-impor |
--add-impo |
--add-imp |
--add-im |
--add-i |
--add- |
--add |
--ad )
1181 --remove-import |
--remove-impor |
--remove-impo |
--remove-imp |
--remove-im |
--remove-i |
--remove- |
--remove |
--remov |
--remo |
--rem |
--re |
--r )
1184 --update |
--updat |
--upda |
--upd |
--up |
--u )
1187 --create-testdir |
--create-testdi |
--create-testd |
--create-test |
--create-tes |
--create-te |
--create-t )
1190 --create-megatestdir |
--create-megatestdi |
--create-megatestd |
--create-megatest |
--create-megates |
--create-megate |
--create-megat |
--create-mega |
--create-meg |
--create-me |
--create-m )
1191 mode
=create-megatestdir
1193 --test |
--tes |
--te |
--t )
1196 --megatest |
--megates |
--megate |
--megat |
--mega |
--meg |
--me |
--m )
1200 mode
=`echo "X$1" | sed -e 's/^X--//'`
1202 --copy-file |
--copy-fil |
--copy-fi |
--copy-f |
--copy- |
--copy |
--cop )
1207 if test $# = 0; then
1208 func_fatal_error
"missing argument for --dir"
1213 destdir
=`echo "X$1" | sed -e 's/^X--dir=//'`
1217 if test $# = 0; then
1218 func_fatal_error
"missing argument for --local-dir"
1220 func_path_append local_gnulib_path
"$1"
1223 local_dir
=`echo "X$1" | sed -e 's/^X--local-dir=//'`
1224 func_path_append local_gnulib_path
"$local_dir"
1226 --cache-modules |
--cache-module |
--cache-modul |
--cache-modu |
--cache-mod |
--cache-mo |
--cache-m |
--cache- |
--cache |
--cach |
--cac |
--ca )
1229 --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 )
1232 --verbose |
--verbos |
--verbo |
--verb )
1233 verbose
=`expr $verbose + 1`
1235 --quiet |
--quie |
--qui |
--qu |
--q )
1236 verbose
=`expr $verbose - 1`
1240 if test $# = 0; then
1241 func_fatal_error
"missing argument for --lib"
1244 supplied_libname
=true
1247 libname
=`echo "X$1" | sed -e 's/^X--lib=//'`
1248 supplied_libname
=true
1252 if test $# = 0; then
1253 func_fatal_error
"missing argument for --source-base"
1258 sourcebase
=`echo "X$1" | sed -e 's/^X--source-base=//'`
1262 if test $# = 0; then
1263 func_fatal_error
"missing argument for --m4-base"
1268 m4base
=`echo "X$1" | sed -e 's/^X--m4-base=//'`
1272 if test $# = 0; then
1273 func_fatal_error
"missing argument for --po-base"
1278 pobase
=`echo "X$1" | sed -e 's/^X--po-base=//'`
1282 if test $# = 0; then
1283 func_fatal_error
"missing argument for --doc-base"
1288 docbase
=`echo "X$1" | sed -e 's/^X--doc-base=//'`
1292 if test $# = 0; then
1293 func_fatal_error
"missing argument for --tests-base"
1298 testsbase
=`echo "X$1" | sed -e 's/^X--tests-base=//'`
1302 if test $# = 0; then
1303 func_fatal_error
"missing argument for --aux-dir"
1308 auxdir
=`echo "X$1" | sed -e 's/^X--aux-dir=//'`
1310 --with-tests |
--with-test |
--with-tes |
--with-te |
--with-t)
1313 --with-obsolete |
--with-obsolet |
--with-obsole |
--with-obsol |
--with-obso |
--with-obs |
--with-ob |
--with-o)
1316 --with-c++-tests |
--with-c++-test |
--with-c++-tes |
--with-c++-te |
--with-c++-t |
--with-c++- |
--with-c++ |
--with-c+ |
--with-c)
1319 --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)
1320 inc_longrunning_tests
=true
1322 --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)
1323 inc_privileged_tests
=true
1325 --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)
1326 inc_unportable_tests
=true
1328 --with-all-tests |
--with-all-test |
--with-all-tes |
--with-all-te |
--with-all-t |
--with-all- |
--with-all |
--with-al |
--with-a)
1331 --without-tests |
--without-test |
--without-tes |
--without-te |
--without-t)
1334 --without-c++-tests |
--without-c++-test |
--without-c++-tes |
--without-c++-te |
--without-c++-t |
--without-c++- |
--without-c++ |
--without-c+ |
--without-c)
1337 --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)
1338 excl_longrunning_tests
=true
1340 --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)
1341 excl_privileged_tests
=true
1343 --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)
1344 excl_unportable_tests
=true
1346 --single-configure |
--single-configur |
--single-configu |
--single-config |
--single-confi |
--single-conf |
--single-con |
--single-con |
--single-co |
--single-c |
--single- |
--single |
--singl |
--sing |
--sin |
--si)
1347 single_configure
=true
1351 if test $# = 0; then
1352 func_fatal_error
"missing argument for --avoid"
1354 func_append avoidlist
" $1"
1357 arg
=`echo "X$1" | sed -e 's/^X--avoid=//'`
1358 func_append avoidlist
" $arg"
1360 --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)
1361 cond_dependencies
=true
1363 --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)
1364 cond_dependencies
=false
1370 arg
=`echo "X$1" | sed -e 's/^X--lgpl=//'`
1372 2 |
3orGPLv2 |
3) ;;
1373 *) func_fatal_error
"invalid LGPL version number for --lgpl" ;;
1382 if test $# = 0; then
1383 func_fatal_error
"missing argument for --makefile-name"
1388 makefile_name
=`echo "X$1" | sed -e 's/^X--makefile-name=//'`
1398 if test $# = 0; then
1399 func_fatal_error
"missing argument for --macro-prefix"
1404 macro_prefix
=`echo "X$1" | sed -e 's/^X--macro-prefix=//'`
1408 if test $# = 0; then
1409 func_fatal_error
"missing argument for --po-domain"
1414 po_domain
=`echo "X$1" | sed -e 's/^X--po-domain=//'`
1418 if test $# = 0; then
1419 func_fatal_error
"missing argument for --witness-c-macro"
1421 witness_c_macro
="$1"
1423 --witness-c-macro=* )
1424 witness_c_macro
=`echo "X$1" | sed -e 's/^X--witness-c-macro=//'`
1432 --no-changelog |
--no-changelo |
--no-changel |
--no-change |
--no-chang |
--no-chan |
--no-cha |
--no-ch )
1433 # A no-op for backward compatibility.
1438 -s |
--symbolic |
--symboli |
--symbol |
--symbo |
--symb |
--symlink |
--symlin |
--symli |
--syml |
--sym |
--sy )
1441 --local-symlink |
--local-symlin |
--local-symli |
--local-syml |
--local-sym |
--local-sy |
--local-s )
1444 -h |
--hardlink |
--hardlin |
--hardli |
--hardl |
--hard |
--har |
--ha )
1447 --local-hardlink |
--local-hardlin |
--local-hardli |
--local-hardl |
--local-hard |
--local-har |
--local-ha |
--local-h )
1450 -S |
--more-symlinks |
--more-symlink |
--more-symlin |
--more-symli |
--more-syml |
--more-sym |
--more-sy |
--more-s )
1454 -H |
--more-hardlinks |
--more-hardlink |
--more-hardlin |
--more-hardli |
--more-hardl |
--more-hard |
--more-har |
--more-ha |
--more-h )
1458 --help |
--hel |
--he )
1461 --version |
--versio |
--versi |
--vers )
1465 # Stop option processing
1469 echo "gnulib-tool: unknown option $1" 1>&2
1470 echo "Try 'gnulib-tool --help' for more information." 1>&2
1477 if case "$mode" in import | add-import | remove-import
) true
;; *) false
;; esac; then
1478 if test -n "$excl_cxx_tests" ||
test -n "$excl_longrunning_tests" \
1479 ||
test -n "$excl_privileged_tests" ||
test -n "$excl_unportable_tests" \
1480 ||
test "$single_configure" != false
; then
1481 echo "gnulib-tool: invalid options for '$mode' mode" 1>&2
1482 echo "Try 'gnulib-tool --help' for more information." 1>&2
1486 if test "$mode" = update
; then
1487 if test $# != 0; then
1488 echo "gnulib-tool: too many arguments in 'update' mode" 1>&2
1489 echo "Try 'gnulib-tool --help' for more information." 1>&2
1490 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1491 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1494 if test -n "$local_gnulib_path" ||
test -n "$supplied_libname" \
1495 ||
test -n "$sourcebase" ||
test -n "$m4base" ||
test -n "$pobase" \
1496 ||
test -n "$docbase" ||
test -n "$testsbase" ||
test -n "$auxdir" \
1497 ||
test -n "$inctests" ||
test -n "$incobsolete" \
1498 ||
test -n "$inc_cxx_tests" ||
test -n "$inc_longrunning_tests" \
1499 ||
test -n "$inc_privileged_tests" ||
test -n "$inc_unportable_tests" \
1500 ||
test -n "$inc_all_tests" \
1501 ||
test -n "$excl_cxx_tests" ||
test -n "$excl_longrunning_tests" \
1502 ||
test -n "$excl_privileged_tests" ||
test -n "$excl_unportable_tests" \
1503 ||
test -n "$avoidlist" ||
test -n "$lgpl" ||
test -n "$makefile_name" \
1504 ||
test -n "$macro_prefix" ||
test -n "$po_domain" \
1505 ||
test -n "$witness_c_macro" ||
test -n "$vc_files"; then
1506 echo "gnulib-tool: invalid options for 'update' mode" 1>&2
1507 echo "Try 'gnulib-tool --help' for more information." 1>&2
1508 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1509 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1513 if test -n "$pobase" && test -z "$po_domain"; then
1514 echo "gnulib-tool: together with --po-base, you need to specify --po-domain" 1>&2
1515 echo "Try 'gnulib-tool --help' for more information." 1>&2
1518 if test -z "$pobase" && test -n "$po_domain"; then
1519 func_warning
"--po-domain has no effect without a --po-base option"
1521 case $mode,$gnu_make in
1523 echo "gnulib-tool: --gnu-make not supported when including tests"
1526 # Canonicalize the inctests variable.
1528 import | add-import | remove-import | update
)
1529 if test -z "$inctests"; then
1533 create-testdir | create-megatestdir |
test | megatest
)
1534 if test -z "$inctests"; then
1539 # Now the only possible values of "$inctests" are true and false
1540 # (or blank but then it is irrelevant).
1542 # Determine the minimum supported autoconf version from the project's
1544 DEFAULT_AUTOCONF_MINVERSION
="2.63"
1545 autoconf_minversion
=
1547 if case "$mode" in import | add-import | remove-import | update
) true
;; *) false
;; esac \
1548 && test -n "$destdir"; then
1549 if test -f "$destdir"/configure.ac
; then
1550 configure_ac
="$destdir/configure.ac"
1552 if test -f "$destdir"/configure.
in; then
1553 configure_ac
="$destdir/configure.in"
1557 if test -f configure.ac
; then
1558 configure_ac
="configure.ac"
1560 if test -f configure.
in; then
1561 configure_ac
="configure.in"
1565 if test -n "$configure_ac"; then
1566 # Use sed, not autoconf --trace, to look for the AC_PREREQ invocation,
1567 # because when some m4 files are omitted from a version control repository,
1568 # "autoconf --trace=AC_PREREQ" fails with an error message like this:
1569 # m4: aclocal.m4:851: Cannot open m4/absolute-header.m4: No such file or directory
1570 # autom4te: m4 failed with exit status: 1
1577 s,^.*AC_PREREQ([[ ]*\([^])]*\).*$,\1,p
1579 prereqs
=`sed -n -e "$my_sed_traces" < "$configure_ac"`
1580 if test -n "$prereqs"; then
1581 autoconf_minversion
=`
1582 for version in $prereqs; do echo $version; done |
1583 LC_ALL=C sort -nru | sed -e 1q
1587 if test -z "$autoconf_minversion"; then
1588 autoconf_minversion
=$DEFAULT_AUTOCONF_MINVERSION
1590 case "$autoconf_minversion" in
1591 1.
* |
2.
[0-5]* |
2.6[0-2]*)
1592 func_fatal_error
"minimum supported autoconf version is 2.63. Try adding AC_PREREQ([$DEFAULT_AUTOCONF_MINVERSION]) to your configure.ac." ;;
1595 # Remove trailing slashes from the directory names. This is necessary for
1596 # m4base (to avoid an error in func_import) and optional for the others.
1597 sed_trimtrailingslashes
='s,\([^/]\)//*$,\1,'
1598 old_local_gnulib_path
="$local_gnulib_path"
1602 for dir
in $old_local_gnulib_path
1606 */ ) dir
=`echo "$dir" | sed -e "$sed_trimtrailingslashes"` ;;
1608 func_path_append local_gnulib_path
"$dir"
1611 case "$sourcebase" in
1612 */ ) sourcebase
=`echo "$sourcebase" | sed -e "$sed_trimtrailingslashes"` ;;
1615 */ ) m4base
=`echo "$m4base" | sed -e "$sed_trimtrailingslashes"` ;;
1618 */ ) pobase
=`echo "$pobase" | sed -e "$sed_trimtrailingslashes"` ;;
1621 */ ) docbase
=`echo "$docbase" | sed -e "$sed_trimtrailingslashes"` ;;
1623 case "$testsbase" in
1624 */ ) testsbase
=`echo "$testsbase" | sed -e "$sed_trimtrailingslashes"` ;;
1627 */ ) auxdir
=`echo "$auxdir" | sed -e "$sed_trimtrailingslashes"` ;;
1633 trap 'exit_status=$?
1634 if test "$signal" != 0; then
1635 echo "caught signal $signal" >&2
1638 exit $exit_status' 0
1639 for signal
in 1 2 3 13 15; do
1640 trap '{ signal='$signal'; func_exit 1; }' $signal
1644 # Note: The 'eval' silences stderr output in dash.
1645 if (declare -A x
&& { x
[f
/2]='foo'; x
[f
/3]='bar'; eval test '${x[f/2]}' = foo
; }) 2>/dev
/null
; then
1646 # Zsh 4 and Bash 4 have associative arrays.
1647 have_associative
=true
1649 # For other shells, use 'eval' with computed shell variable names.
1650 have_associative
=false
1653 # func_lookup_local_file_cb dir file
1654 # returns true and sets func_lookup_local_file_result if the file $dir/$file
1656 func_lookup_local_file_cb
()
1658 test -n "$func_lookup_local_file_result" && return 1 # already found?
1659 test -f "$1/$2" ||
return 1
1660 func_lookup_local_file_result
=$1/$2
1664 # func_lookup_local_file file
1665 # looks up a file in $local_gnulib_path.
1667 # - local_gnulib_path from --local-dir
1669 # - func_lookup_local_file_result name of the file, valid only when the
1670 # function succeeded.
1671 func_lookup_local_file
()
1673 func_lookup_local_file_result
=
1674 func_path_foreach
"$local_gnulib_path" func_lookup_local_file_cb
%dir
% "$1"
1677 # func_lookup_file_cb dir
1678 # does one step in processing the $local_gnulib_path, looking for $dir/$lkfile
1679 # and $dir/$lkfile.diff.
1680 func_lookup_file_cb
()
1682 # If we found the file already in a --local-dir of higher priority, nothing
1684 if test -z "$lookedup_file"; then
1685 # Otherwise, look for $dir/$lkfile and $dir/$lkfile.diff.
1686 if test -f "$1/$lkfile"; then
1687 lookedup_file
="$1/$lkfile"
1689 if test -f "$1/$lkfile.diff"; then
1690 lkpatches
="$1/$lkfile.diff${lkpatches:+$PATH_SEPARATOR$lkpatches}"
1696 # func_lookup_file file
1697 # looks up a file in $local_gnulib_path or $gnulib_dir, or combines it through
1700 # - local_gnulib_path from --local-dir
1702 # - lookedup_file name of the merged (combined) file
1703 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
1707 # Each element in $local_gnulib_path is a directory whose contents overrides
1708 # or amends the result of the lookup in the rest of $local_gnulib_path and
1709 # $gnulib_dir. So, the first element of $local_gnulib_path is the highest
1713 func_path_foreach
"$local_gnulib_path" func_lookup_file_cb
%dir
%
1714 # Treat $gnulib_dir like a lowest-priority --local-dir, except that here we
1715 # don't look for .diff files.
1716 if test -z "$lookedup_file"; then
1717 if test -f "$gnulib_dir/$lkfile"; then
1718 lookedup_file
="$gnulib_dir/$lkfile"
1720 func_fatal_error
"file $gnulib_dir/$lkfile not found"
1723 # Now apply the patches, from lowest-priority to highest-priority.
1725 if test -n "$lkpatches"; then
1726 lkbase
=`echo "$lkfile" | sed -e 's,^.*/,,'`
1727 rm -f "$tmp/$lkbase"
1728 cp "$lookedup_file" "$tmp/$lkbase"
1729 func_ensure_writable
"$tmp/$lkbase"
1731 IFS
="$PATH_SEPARATOR"
1732 for patchfile
in $lkpatches; do
1734 patch -s "$tmp/$lkbase" < "$patchfile" >&2 \
1735 || func_fatal_error
"patch file $patchfile didn't apply cleanly"
1738 lookedup_file
="$tmp/$lkbase"
1743 # func_sanitize_modulelist
1744 # receives a list of possible module names on standard input, one per line.
1745 # It removes those which are just file names unrelated to modules, and outputs
1746 # the resulting list to standard output, one per line.
1747 func_sanitize_modulelist
()
1749 sed -e '/^ChangeLog$/d' -e '/\/ChangeLog$/d' \
1750 -e '/^COPYING$/d' -e '/\/COPYING$/d' \
1751 -e '/^README$/d' -e '/\/README$/d' \
1752 -e '/^TEMPLATE$/d' \
1753 -e '/^TEMPLATE-EXTENDED$/d' \
1754 -e '/^TEMPLATE-TESTS$/d' \
1760 # func_modules_in_dir dir
1761 # outputs all module files in dir to standard output.
1762 func_modules_in_dir
()
1764 (test -d "$1" && cd "$1" && find modules
-type f
-print)
1769 # - local_gnulib_path from --local-dir
1772 # Filter out metainformation files like README, which are not modules.
1773 # Filter out unit test modules; they can be retrieved through
1774 # --extract-tests-module if desired.
1776 (cd "$gnulib_dir" && find modules
-type f
-print |
sed -e 's,^modules/,,')
1777 func_path_foreach
"$local_gnulib_path" func_modules_in_dir
%dir
% |
sed -e 's,^modules/,,' -e 's,\.diff$,,'
1779 | func_sanitize_modulelist \
1780 |
sed -e '/-tests$/d' \
1784 # func_exists_local_module dir module
1785 # returns true if module exists in dir
1786 func_exists_local_module
()
1788 test -d "$1/modules" && test -f "$1/modules/$2";
1791 # func_exists_module module
1792 # tests whether a module, given by name, exists
1794 # - local_gnulib_path from --local-dir
1795 func_exists_module
()
1797 { test -f "$gnulib_dir/modules/$1" \
1798 || func_path_foreach
"$local_gnulib_path" func_exists_local_module
%dir
% "$1" ; } \
1799 && test "ChangeLog" != "$1" \
1800 && test "COPYING" != "$1" \
1801 && test "README" != "$1" \
1802 && test "TEMPLATE" != "$1" \
1803 && test "TEMPLATE-EXTENDED" != "$1" \
1804 && test "TEMPLATE-TESTS" != "$1"
1807 # func_verify_module
1808 # verifies a module name
1810 # - local_gnulib_path from --local-dir
1811 # - module module name argument
1813 # - module unchanged if OK, empty if not OK
1814 # - lookedup_file if OK: name of the merged (combined) module description file
1815 # - lookedup_tmp if OK: true if it is located in the tmp directory, blank otherwise
1816 func_verify_module
()
1818 if func_exists_module
"$module"; then
1819 # OK, $module is a correct module name.
1820 # Verify that building the module description with 'patch' succeeds.
1821 func_lookup_file
"modules/$module"
1823 func_warning
"module $module doesn't exist"
1828 # func_verify_nontests_module
1829 # verifies a module name, excluding tests modules
1831 # - local_gnulib_path from --local-dir
1832 # - module module name argument
1833 func_verify_nontests_module
()
1836 *-tests ) module
= ;;
1837 * ) func_verify_module
;;
1841 # func_verify_tests_module
1842 # verifies a module name, considering only tests modules
1844 # - local_gnulib_path from --local-dir
1845 # - module module name argument
1846 func_verify_tests_module
()
1849 *-tests ) func_verify_module
;;
1854 # Suffix of a sed expression that extracts a particular field from a
1855 # module description.
1856 # A field starts with a line that contains a keyword, such as 'Description',
1857 # followed by a colon and optional whitespace. All following lines, up to
1858 # the next field (or end of file if there is none) form the contents of the
1860 # An absent field is equivalent to a field with empty contents.
1861 # NOTE: Keep this in sync with sed_extract_cache_prog below!
1862 sed_extract_prog
=':[ ]*$/ {
1865 s/^Description:[ ]*$//
1869 s/^Applicability:[ ]*$//
1871 s/^Depends-on:[ ]*$//
1872 s/^configure\.ac-early:[ ]*$//
1873 s/^configure\.ac:[ ]*$//
1874 s/^Makefile\.am:[ ]*$//
1878 s/^Maintainer:[ ]*$//
1885 # Piece of a sed expression that converts a field header line to a shell
1887 # NOTE: Keep this in sync with sed_extract_prog above!
1888 sed_extract_field_header
='
1889 s/^Description:[ ]*$/description/
1890 s/^Comment:[ ]*$/comment/
1891 s/^Status:[ ]*$/status/
1892 s/^Notice:[ ]*$/notice/
1893 s/^Applicability:[ ]*$/applicability/
1894 s/^Files:[ ]*$/files/
1895 s/^Depends-on:[ ]*$/dependson/
1896 s/^configure\.ac-early:[ ]*$/configureac_early/
1897 s/^configure\.ac:[ ]*$/configureac/
1898 s/^Makefile\.am:[ ]*$/makefile/
1899 s/^Include:[ ]*$/include/
1901 s/^License:[ ]*$/license/
1902 s/^Maintainer:[ ]*$/maintainer/'
1906 if $have_associative; then
1908 # Declare the associative arrays.
1909 declare -A modcache_cached
1910 sed_to_declare_statement
='s|^.*/\([a-zA-Z0-9_]*\)/$|declare -A modcache_\1|p'
1911 declare_script
=`echo "$sed_extract_field_header" | sed -n -e "$sed_to_declare_statement"`
1912 eval "$declare_script"
1916 # func_cache_var module
1917 # computes the cache variable name corresponding to $module.
1918 # Note: This computation can map different module names to the same
1919 # cachevar (such as 'foo-bar', 'foo_bar', or 'foo/bar'); the caller has
1920 # to protect against this case.
1922 # - cachevar a shell variable name
1923 if (f
=foo
; eval echo '${f//o/e}') < /dev
/null
2>/dev
/null |
grep fee
>/dev
/null
; then
1924 # Bash 2.0 and newer, ksh, and zsh support the syntax
1925 # ${param//pattern/replacement}
1926 # as a shorthand for
1927 # `echo "$param" | sed -e "s/pattern/replacement/g"`.
1928 # Note: The 'eval' is necessary for dash and NetBSD /bin/sh.
1929 eval 'func_cache_var ()
1931 cachevar=c_${1//[!a-zA-Z0-9_]/_}
1938 cachevar
=c_
`echo "$1" | LC_ALL=C sed -e 's/[^a-zA-Z0-9_]/_/g'` ;;
1947 # func_init_sed_convert_to_cache_statements
1949 # - modcachevar_assignment
1951 # - sed_convert_to_cache_statements
1952 func_init_sed_convert_to_cache_statements
()
1954 # 'sed' script that turns a module description into shell script
1955 # assignments, suitable to be eval'ed. All active characters are escaped.
1958 # Some module's description
1963 # modcache_description[$1]=\
1964 # 'Some module'"'"'s description
1966 # modcache_files[$1]=\
1969 # c_MODULE_description_set=set; c_MODULE_description=\
1970 # 'Some module'"'"'s description
1972 # c_MODULE_files_set=set; c_MODULE_files=\
1974 # The script consists of two parts:
1975 # 1) Ignore the lines before the first field header.
1976 # 2) A loop, treating non-field-header lines by escaping single quotes
1977 # and adding a closing quote in the last line,
1978 sed_convert_to_cache_statements
="
1980 # Here we have not yet seen a field header.
1982 # See if the current line contains a field header.
1985 ${sed_extract_field_header}
1988 # No field header. Ignore the line.
1990 # Read the next line. Upon EOF, just exit.
1995 # The current line contains a field header.
1997 # Turn it into the beginning of an assignment.
1998 s/^\\(.*\\)\$/${modcachevar_assignment}\\\\/
2000 # Move it to the hold space. Don't print it yet,
2001 # because we want no assignment if the field is empty.
2004 # Read the next line.
2005 # Upon EOF, the field was empty. Print no assignment. Just exit.
2008 # See if the current line contains a field header.
2011 ${sed_extract_field_header}
2012 # If it is, the previous field was empty. Print no assignment.
2015 # Not a field header.
2017 # Print the previous line, held in the hold space.
2022 # Transform single quotes.
2025 # Prepend a single quote.
2030 # Move it to the hold space.
2033 # Read the next line.
2040 # See if the current line contains a field header.
2043 ${sed_extract_field_header}
2046 # Print the previous line, held in the hold space.
2051 # Transform single quotes.
2058 # Print the previous line, held in the hold space, with a single quote
2059 # to end the assignment.
2069 # Print the previous line, held in the hold space, with a single quote
2070 # to end the assignment.
2077 if ! $sed_comments; then
2079 sed_convert_to_cache_statements
=`echo "$sed_convert_to_cache_statements" \
2080 | sed -e 's/^ *//' -e 's/^#.*//'`
2084 if $have_associative; then
2085 # sed_convert_to_cache_statements does not depend on the module.
2086 modcachevar_assignment
='modcache_\1[$1]='
2087 func_init_sed_convert_to_cache_statements
2090 # func_cache_lookup_module module
2092 # looks up a module, like 'func_lookup_file modules/$module', and stores all
2093 # of its relevant data in a cache in the memory of the processing shell. If
2094 # already cached, it does not look it up again, thus saving file access time.
2096 # - module non-empty string
2097 # Output if $have_associative:
2098 # - modcache_cached[$module] set to yes
2099 # - modcache_description[$module] ==
2100 # - modcache_status[$module] \ set to the field's value, minus the
2101 # - ... / final newline,
2102 # - modcache_maintainer[$module] == or unset if the field's value is empty
2103 # Output if ! $have_associative:
2104 # - cachevar a shell variable name
2105 # - ${cachevar}_cached set to $module
2106 # - ${cachevar}_description ==
2107 # - ${cachevar}_status \ set to the field's value, minus the
2108 # - ... / final newline,
2109 # - ${cachevar}_maintainer == or unset if the field's value is empty
2110 # - ${cachevar}_description_set ==
2111 # - ${cachevar}_status_set \ set to non-empty if the field's value
2112 # - ... / is non-empty,
2113 # - ${cachevar}_maintainer_set == or unset if the field's value is empty
2114 func_cache_lookup_module
()
2116 if $have_associative; then
2117 eval 'cached=${modcache_cached[$1]}'
2120 eval "cached=\"\$${cachevar}_cached\""
2122 if test -z "$cached"; then
2123 # Not found in cache. Look it up on the file system.
2124 func_lookup_file
"modules/$1"
2125 if $have_associative; then
2126 eval 'modcache_cached[$1]=yes'
2128 eval "${cachevar}_cached=\"\$1\""
2130 if ! $have_associative; then
2131 # sed_convert_to_cache_statements depends on the module.
2132 modcachevar_assignment
="${cachevar}"'_\1_set=set; '"${cachevar}"'_\1='
2133 func_init_sed_convert_to_cache_statements
2135 cache_statements
=`LC_ALL=C sed -n -e "$sed_convert_to_cache_statements" < "$lookedup_file"`
2136 eval "$cache_statements"
2138 if ! $have_associative; then
2139 if test "$1" != "$cached"; then
2140 func_fatal_error
"cache variable collision between $1 and $cached"
2148 # func_get_description module
2150 # - local_gnulib_path from --local-dir
2151 # - modcache true or false, from --cache-modules/--no-cache-modules
2152 func_get_description
()
2154 if ! $modcache; then
2155 func_lookup_file
"modules/$1"
2156 sed -n -e "/^Description$sed_extract_prog" < "$lookedup_file"
2158 func_cache_lookup_module
"$1"
2159 # Output the field's value, including the final newline (if any).
2160 if $have_associative; then
2161 if eval 'test -n "${modcache_description[$1]+set}"'; then
2162 eval 'echo "${modcache_description[$1]}"'
2165 eval "field_set=\"\$${cachevar}_description_set\""
2166 if test -n "$field_set"; then
2167 eval "field_value=\"\$${cachevar}_description\""
2168 echo "${field_value}"
2174 # func_get_comment module
2176 # - local_gnulib_path from --local-dir
2177 # - modcache true or false, from --cache-modules/--no-cache-modules
2180 if ! $modcache; then
2181 func_lookup_file
"modules/$1"
2182 sed -n -e "/^Comment$sed_extract_prog" < "$lookedup_file"
2184 func_cache_lookup_module
"$1"
2185 # Output the field's value, including the final newline (if any).
2186 if $have_associative; then
2187 if eval 'test -n "${modcache_comment[$1]+set}"'; then
2188 eval 'echo "${modcache_comment[$1]}"'
2191 eval "field_set=\"\$${cachevar}_comment_set\""
2192 if test -n "$field_set"; then
2193 eval "field_value=\"\$${cachevar}_comment\""
2194 echo "${field_value}"
2200 # func_get_status module
2202 # - local_gnulib_path from --local-dir
2203 # - modcache true or false, from --cache-modules/--no-cache-modules
2206 if ! $modcache; then
2207 func_lookup_file
"modules/$1"
2208 sed -n -e "/^Status$sed_extract_prog" < "$lookedup_file"
2210 func_cache_lookup_module
"$1"
2211 # Output the field's value, including the final newline (if any).
2212 if $have_associative; then
2213 if eval 'test -n "${modcache_status[$1]+set}"'; then
2214 eval 'echo "${modcache_status[$1]}"'
2217 eval "field_set=\"\$${cachevar}_status_set\""
2218 if test -n "$field_set"; then
2219 eval "field_value=\"\$${cachevar}_status\""
2220 echo "${field_value}"
2226 # func_get_notice module
2228 # - local_gnulib_path from --local-dir
2229 # - modcache true or false, from --cache-modules/--no-cache-modules
2232 if ! $modcache; then
2233 func_lookup_file
"modules/$1"
2234 sed -n -e "/^Notice$sed_extract_prog" < "$lookedup_file"
2236 func_cache_lookup_module
"$1"
2237 # Output the field's value, including the final newline (if any).
2238 if $have_associative; then
2239 if eval 'test -n "${modcache_notice[$1]+set}"'; then
2240 eval 'echo "${modcache_notice[$1]}"'
2243 eval "field_set=\"\$${cachevar}_notice_set\""
2244 if test -n "$field_set"; then
2245 eval "field_value=\"\$${cachevar}_notice\""
2246 echo "${field_value}"
2252 # func_get_applicability module
2254 # - local_gnulib_path from --local-dir
2255 # - modcache true or false, from --cache-modules/--no-cache-modules
2256 # The expected result (on stdout) is either 'main', or 'tests', or 'all'.
2257 func_get_applicability
()
2259 if ! $modcache; then
2260 func_lookup_file
"modules/$1"
2261 my_applicability
=`sed -n -e "/^Applicability$sed_extract_prog" < "$lookedup_file"`
2263 func_cache_lookup_module
"$1"
2264 # Get the field's value, without the final newline.
2265 if $have_associative; then
2266 eval 'my_applicability="${modcache_applicability[$1]}"'
2268 eval "my_applicability=\"\$${cachevar}_applicability\""
2271 if test -n "$my_applicability"; then
2272 echo $my_applicability
2274 # The default is 'main' or 'tests', depending on the module's name.
2276 *-tests) echo "tests";;
2282 # func_get_filelist module
2284 # - local_gnulib_path from --local-dir
2285 # - modcache true or false, from --cache-modules/--no-cache-modules
2286 func_get_filelist
()
2288 if ! $modcache; then
2289 func_lookup_file
"modules/$1"
2290 sed -n -e "/^Files$sed_extract_prog" < "$lookedup_file"
2292 func_cache_lookup_module
"$1"
2293 # Output the field's value, including the final newline (if any).
2294 if $have_associative; then
2295 if eval 'test -n "${modcache_files[$1]+set}"'; then
2296 eval 'echo "${modcache_files[$1]}"'
2299 eval "field_set=\"\$${cachevar}_files_set\""
2300 if test -n "$field_set"; then
2301 eval "field_value=\"\$${cachevar}_files\""
2302 echo "${field_value}"
2308 echo m
4/gnulib-common.
m4
2311 # func_filter_filelist outputvar separator filelist prefix suffix removed_prefix removed_suffix [added_prefix [added_suffix]]
2312 # stores in outputvar the filtered and processed filelist. Filtering: Only the
2313 # elements starting with prefix and ending with suffix are considered.
2314 # Processing: removed_prefix and removed_suffix are removed from each element,
2315 # added_prefix and added_suffix are added to each element.
2316 # prefix, suffix should not contain shell-special characters.
2317 # removed_prefix, removed_suffix should not contain the characters "$`\{}[]^|.
2318 # added_prefix, added_suffix should not contain the characters \|&.
2319 func_filter_filelist
()
2321 if test "$2" != "$nl" \
2322 ||
{ $fast_func_append \
2323 && { test -z "$6" ||
$fast_func_remove_prefix; } \
2324 && { test -z "$7" ||
$fast_func_remove_suffix; }; \
2328 # Do not quote possibly-empty parameters in case patterns,
2329 # AIX and HP-UX ksh won't match them if they are empty.
2332 if test -n "$6"; then
2333 func_remove_prefix fff
"$6"
2335 if test -n "$7"; then
2336 func_remove_suffix fff
"$7"
2339 if test -z "$ffflist"; then
2342 func_append ffflist
"$2${fff}"
2348 sed_fff_filter
="s|^$6\(.*\)$7\$|$8\\1$9|"
2349 ffflist
=`for fff in $3; do
2351 $4*$5) echo "$fff" ;;
2353 done | sed -e "$sed_fff_filter"`
2355 eval "$1=\"\$ffflist\""
2358 # func_get_dependencies module
2360 # - local_gnulib_path from --local-dir
2361 # - modcache true or false, from --cache-modules/--no-cache-modules
2362 func_get_dependencies
()
2364 # ${module}-tests implicitly depends on ${module}, if that module exists.
2368 func_remove_suffix fgd1
'-tests'
2369 if func_exists_module
"$fgd1"; then
2374 # Then the explicit dependencies listed in the module description.
2375 { if ! $modcache; then
2376 func_lookup_file
"modules/$1"
2377 sed -n -e "/^Depends-on$sed_extract_prog" < "$lookedup_file"
2379 func_cache_lookup_module
"$1"
2380 # Output the field's value, including the final newline (if any).
2381 if $have_associative; then
2382 if eval 'test -n "${modcache_dependson[$1]+set}"'; then
2383 eval 'echo "${modcache_dependson[$1]}"'
2386 eval "field_set=\"\$${cachevar}_dependson_set\""
2387 if test -n "$field_set"; then
2388 eval "field_value=\"\$${cachevar}_dependson\""
2389 echo "${field_value}"
2397 sed_dependencies_without_conditions
='s/ *\[.*//'
2399 # func_get_autoconf_early_snippet module
2401 # - local_gnulib_path from --local-dir
2402 # - modcache true or false, from --cache-modules/--no-cache-modules
2403 func_get_autoconf_early_snippet
()
2405 if ! $modcache; then
2406 func_lookup_file
"modules/$1"
2407 sed -n -e "/^configure\.ac-early$sed_extract_prog" < "$lookedup_file"
2409 func_cache_lookup_module
"$1"
2410 # Output the field's value, including the final newline (if any).
2411 if $have_associative; then
2412 if eval 'test -n "${modcache_configureac_early[$1]+set}"'; then
2413 eval 'echo "${modcache_configureac_early[$1]}"'
2416 eval "field_set=\"\$${cachevar}_configureac_early_set\""
2417 if test -n "$field_set"; then
2418 eval "field_value=\"\$${cachevar}_configureac_early\""
2419 echo "${field_value}"
2425 # func_get_autoconf_snippet module
2427 # - local_gnulib_path from --local-dir
2428 # - modcache true or false, from --cache-modules/--no-cache-modules
2429 func_get_autoconf_snippet
()
2431 if ! $modcache; then
2432 func_lookup_file
"modules/$1"
2433 sed -n -e "/^configure\.ac$sed_extract_prog" < "$lookedup_file"
2435 func_cache_lookup_module
"$1"
2436 # Output the field's value, including the final newline (if any).
2437 if $have_associative; then
2438 if eval 'test -n "${modcache_configureac[$1]+set}"'; then
2439 eval 'echo "${modcache_configureac[$1]}"'
2442 eval "field_set=\"\$${cachevar}_configureac_set\""
2443 if test -n "$field_set"; then
2444 eval "field_value=\"\$${cachevar}_configureac\""
2445 echo "${field_value}"
2451 # Concatenate lines with trailing slash.
2452 # $1 is an optional filter to restrict the
2453 # concatenation to groups starting with that expression
2455 sed -e "/$1.*"'\\$/{
2464 # func_get_automake_snippet_conditional module
2465 # returns the part of the Makefile.am snippet that can be put inside Automake
2468 # - local_gnulib_path from --local-dir
2469 # - modcache true or false, from --cache-modules/--no-cache-modules
2470 func_get_automake_snippet_conditional
()
2472 if ! $modcache; then
2473 func_lookup_file
"modules/$1"
2474 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
2476 func_cache_lookup_module
"$1"
2477 # Output the field's value, including the final newline (if any).
2478 if $have_associative; then
2479 if eval 'test -n "${modcache_makefile[$1]+set}"'; then
2480 eval 'echo "${modcache_makefile[$1]}"'
2483 eval "field_set=\"\$${cachevar}_makefile_set\""
2484 if test -n "$field_set"; then
2485 eval "field_value=\"\$${cachevar}_makefile\""
2486 echo "${field_value}"
2492 # func_get_automake_snippet_unconditional module
2493 # returns the part of the Makefile.am snippet that must stay outside of
2494 # Automake conditionals.
2496 # - local_gnulib_path from --local-dir
2497 # - modcache true or false, from --cache-modules/--no-cache-modules
2498 func_get_automake_snippet_unconditional
()
2502 # *-tests module live in tests/, not lib/.
2503 # Synthesize an EXTRA_DIST augmentation.
2504 all_files
=`func_get_filelist $1`
2505 func_filter_filelist tests_files
" " "$all_files" 'tests/' '' 'tests/' ''
2506 extra_files
="$tests_files"
2507 if test -n "$extra_files"; then
2508 echo "EXTRA_DIST +=" $extra_files
2513 # Synthesize an EXTRA_DIST augmentation.
2514 sed_extract_mentioned_files
='s/^lib_SOURCES[ ]*+=[ ]*//p'
2515 already_mentioned_files
=` \
2516 { if ! $modcache; then
2517 func_lookup_file "modules/$1"
2518 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
2520 func_cache_lookup_module "$1"
2521 if $have_associative; then
2522 if eval 'test -n "${modcache_makefile[$1]+set}"'; then
2523 eval 'echo "${modcache_makefile[$1]}"'
2526 eval 'field_set="$'"${cachevar}"'_makefile_set"'
2527 if test -n "$field_set"; then
2528 eval 'field_value="$'"${cachevar}"'_makefile"'
2529 echo "${field_value}"
2535 | sed -n -e "$sed_extract_mentioned_files" | sed -e 's/#.*//'`
2536 all_files
=`func_get_filelist $1`
2537 func_filter_filelist lib_files
"$nl" "$all_files" 'lib/' '' 'lib/' ''
2538 # Remove $already_mentioned_files from $lib_files.
2539 echo "$lib_files" | LC_ALL
=C
sort -u > "$tmp"/lib-files
2540 extra_files
=`for f in $already_mentioned_files; do echo $f; done \
2541 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/lib-files`
2542 if test -n "$extra_files"; then
2543 echo "EXTRA_DIST +=" $extra_files
2546 # Synthesize also an EXTRA_lib_SOURCES augmentation.
2547 # This is necessary so that automake can generate the right list of
2549 # A possible approach would be to use autom4te --trace of the redefined
2550 # AC_LIBOBJ and AC_REPLACE_FUNCS macros when creating the Makefile.am
2551 # (use autom4te --trace, not just grep, so that AC_LIBOBJ invocations
2552 # inside autoconf's built-in macros are not missed).
2553 # But it's simpler and more robust to do it here, based on the file list.
2554 # If some .c file exists and is not used with AC_LIBOBJ - for example,
2555 # a .c file is preprocessed into another .c file for BUILT_SOURCES -,
2556 # automake will generate a useless dependency; this is harmless.
2558 relocatable-prog-wrapper
) ;;
2561 func_filter_filelist extra_files
"$nl" "$extra_files" '' '.c' '' ''
2562 if test -n "$extra_files"; then
2563 echo "EXTRA_lib_SOURCES +=" $extra_files
2568 # Synthesize an EXTRA_DIST augmentation also for the files in build-aux/.
2569 func_filter_filelist buildaux_files
"$nl" "$all_files" 'build-aux/' '' 'build-aux/' ''
2570 if test -n "$buildaux_files"; then
2571 sed_prepend_auxdir
='s,^,$(top_srcdir)/'"$auxdir"'/,'
2572 echo "EXTRA_DIST += "`echo "$buildaux_files" | sed -e "$sed_prepend_auxdir"`
2579 # func_get_automake_snippet module
2581 # - local_gnulib_path from --local-dir
2582 # - modcache true or false, from --cache-modules/--no-cache-modules
2583 func_get_automake_snippet
()
2585 func_get_automake_snippet_conditional
"$1"
2586 func_get_automake_snippet_unconditional
"$1"
2589 # func_get_include_directive module
2591 # - local_gnulib_path from --local-dir
2592 # - modcache true or false, from --cache-modules/--no-cache-modules
2593 func_get_include_directive
()
2596 if ! $modcache; then
2597 func_lookup_file
"modules/$1"
2598 sed -n -e "/^Include$sed_extract_prog" < "$lookedup_file"
2600 func_cache_lookup_module
"$1"
2601 # Output the field's value, including the final newline (if any).
2602 if $have_associative; then
2603 if eval 'test -n "${modcache_include[$1]+set}"'; then
2604 eval 'echo "${modcache_include[$1]}"'
2607 eval "field_set=\"\$${cachevar}_include_set\""
2608 if test -n "$field_set"; then
2609 eval "field_value=\"\$${cachevar}_include\""
2610 echo "${field_value}"
2614 } |
sed -e 's/^\(["<]\)/#include \1/'
2617 # func_get_link_directive module
2619 # - local_gnulib_path from --local-dir
2620 # - modcache true or false, from --cache-modules/--no-cache-modules
2621 func_get_link_directive
()
2623 if ! $modcache; then
2624 func_lookup_file
"modules/$1"
2625 sed -n -e "/^Link$sed_extract_prog" < "$lookedup_file"
2627 func_cache_lookup_module
"$1"
2628 # Output the field's value, including the final newline (if any).
2629 if $have_associative; then
2630 if eval 'test -n "${modcache_link[$1]+set}"'; then
2631 eval 'echo "${modcache_link[$1]}"'
2634 eval "field_set=\"\$${cachevar}_link_set\""
2635 if test -n "$field_set"; then
2636 eval "field_value=\"\$${cachevar}_link\""
2637 echo "${field_value}"
2643 # func_get_license_raw module
2645 # - local_gnulib_path from --local-dir
2646 # - modcache true or false, from --cache-modules/--no-cache-modules
2647 func_get_license_raw
()
2649 if ! $modcache; then
2650 func_lookup_file
"modules/$1"
2651 sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
2653 func_cache_lookup_module
"$1"
2654 # Output the field's value, including the final newline (if any).
2655 if $have_associative; then
2656 if eval 'test -n "${modcache_license[$1]+set}"'; then
2657 eval 'echo "${modcache_license[$1]}"'
2660 eval "field_set=\"\$${cachevar}_license_set\""
2661 if test -n "$field_set"; then
2662 eval "field_value=\"\$${cachevar}_license\""
2663 echo "${field_value}"
2669 # func_get_license module
2671 # - local_gnulib_path from --local-dir
2672 # - modcache true or false, from --cache-modules/--no-cache-modules
2675 # Warn if the License field is missing.
2679 license
=`func_get_license_raw "$1"`
2680 if test -z "$license"; then
2681 func_warning
"module $1 lacks a License"
2687 # These modules are under a weaker license only for the purpose of some
2688 # users who hand-edit it and don't use gnulib-tool. For the regular
2689 # gnulib users they are under a stricter license.
2694 func_get_license_raw
"$1"
2695 # The default is GPL.
2697 } |
sed -e 's,^ *$,,' |
sed -e 1q
2702 # func_get_maintainer module
2704 # - local_gnulib_path from --local-dir
2705 # - modcache true or false, from --cache-modules/--no-cache-modules
2706 func_get_maintainer
()
2708 if ! $modcache; then
2709 func_lookup_file
"modules/$1"
2710 sed -n -e "/^Maintainer$sed_extract_prog" < "$lookedup_file"
2712 func_cache_lookup_module
"$1"
2713 # Output the field's value, including the final newline (if any).
2714 if $have_associative; then
2715 if eval 'test -n "${modcache_maintainer[$1]+set}"'; then
2716 eval 'echo "${modcache_maintainer[$1]}"'
2719 eval "field_set=\"\$${cachevar}_maintainer_set\""
2720 if test -n "$field_set"; then
2721 eval "field_value=\"\$${cachevar}_maintainer\""
2722 echo "${field_value}"
2728 # func_get_tests_module module
2730 # - local_gnulib_path from --local-dir
2731 func_get_tests_module
()
2733 # The naming convention for tests modules is hardwired: ${module}-tests.
2734 if test -f "$gnulib_dir/modules/$1"-tests \
2735 || func_path_foreach
"$local_gnulib_path" func_exists_local_module
%dir
% "$1-tests"; then
2740 # func_get_dependencies_recursively module
2742 # - local_gnulib_path from --local-dir
2743 # - modcache true or false, from --cache-modules/--no-cache-modules
2744 func_get_dependencies_recursively
()
2746 # In order to process every module only once (for speed), process an "input
2747 # list" of modules, producing an "output list" of modules. During each round,
2748 # more modules can be queued in the input list. Once a module on the input
2749 # list has been processed, it is added to the "handled list", so we can avoid
2750 # to process it again.
2754 while test -n "$inmodules"; do
2755 inmodules_this_round
="$inmodules"
2756 inmodules
= # Accumulator, queue for next round
2757 for module
in $inmodules_this_round; do
2759 if test -n "$module"; then
2760 func_append outmodules
" $module"
2761 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
2762 for dep
in $deps; do
2763 func_append inmodules
" $dep"
2767 handledmodules
=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
2768 # Remove $handledmodules from $inmodules.
2769 for m
in $inmodules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/queued-modules
2770 inmodules
=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
2772 rm -f "$tmp"/queued-modules
2773 for m
in $outmodules; do echo $m; done | LC_ALL
=C
sort -u
2776 # func_get_link_directive_recursively module
2778 # - local_gnulib_path from --local-dir
2779 # - modcache true or false, from --cache-modules/--no-cache-modules
2780 func_get_link_directive_recursively
()
2782 # In order to process every module only once (for speed), process an "input
2783 # list" of modules, producing an "output list" of modules. During each round,
2784 # more modules can be queued in the input list. Once a module on the input
2785 # list has been processed, it is added to the "handled list", so we can avoid
2786 # to process it again.
2790 while test -n "$inmodules"; do
2791 inmodules_this_round
="$inmodules"
2792 inmodules
= # Accumulator, queue for next round
2793 for module
in $inmodules_this_round; do
2795 if test -n "$module"; then
2796 if grep '^Link:[ ]*$' "$lookedup_file" >/dev
/null
; then
2797 # The module description has a 'Link:' field. Ignore the dependencies.
2798 func_append outmodules
" $module"
2800 # The module description has no 'Link:' field. Recurse through the dependencies.
2801 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
2802 for dep
in $deps; do
2803 func_append inmodules
" $dep"
2808 handledmodules
=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
2809 # Remove $handledmodules from $inmodules.
2810 for m
in $inmodules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/queued-modules
2811 inmodules
=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
2813 rm -f "$tmp"/queued-modules
2814 for m
in $outmodules; do func_get_link_directive
"$m"; done | LC_ALL
=C
sort -u |
sed -e '/^$/d'
2817 # func_acceptable module
2818 # tests whether a module is acceptable.
2820 # - avoidlist list of modules to avoid
2823 for avoid
in $avoidlist; do
2824 if test "$avoid" = "$1"; then
2831 # sed expression to keep the first 32 characters of each line.
2832 sed_first_32_chars
='s/^\(................................\).*/\1/'
2834 # func_module_shellfunc_name module
2835 # computes the shell function name that will contain the m4 macros for the module.
2837 # - macro_prefix prefix to use
2839 # - shellfunc shell function name
2840 func_module_shellfunc_name
()
2844 shellfunc
=func_
${macro_prefix}_gnulib_m4code_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2846 shellfunc
=func_
${macro_prefix}_gnulib_m4code_
$1 ;;
2850 # func_module_shellvar_name module
2851 # computes the shell variable name the will be set to true once the m4 macros
2852 # for the module have been executed.
2854 # - shellvar shell variable name
2855 func_module_shellvar_name
()
2859 shellvar
=${macro_prefix}_gnulib_enabled_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2861 shellvar
=${macro_prefix}_gnulib_enabled_
$1 ;;
2865 # func_module_conditional_name module
2866 # computes the automake conditional name for the module.
2868 # - conditional name of automake conditional
2869 func_module_conditional_name
()
2873 conditional
=${macro_prefix}_GNULIB_ENABLED_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2875 conditional
=${macro_prefix}_GNULIB_ENABLED_
$1 ;;
2879 # func_uncond_add_module B
2880 # notes the presence of B as an unconditional module.
2882 # func_conddep_add_module A B cond
2883 # notes the presence of a conditional dependency from module A to module B,
2884 # subject to the condition that A is enabled and cond is true.
2886 # func_cond_module_p B
2887 # tests whether module B is conditional.
2889 # func_cond_module_condition A B
2890 # returns the condition when B should be enabled as a dependency of A, once the
2891 # m4 code for A has been executed.
2892 # Output: - condition
2894 if $have_associative; then
2895 declare -A conddep_isuncond
2896 declare -A conddep_dependers
2897 declare -A conddep_condition
2898 func_uncond_add_module
()
2900 eval 'conddep_isuncond[$1]=true'
2901 eval 'unset conddep_dependers[$1]'
2903 func_conddep_add_module
()
2905 eval 'isuncond="${conddep_isuncond[$2]}"'
2906 if test -z "$isuncond"; then
2907 # No unconditional dependency to B known at this point.
2908 eval 'conddep_dependers[$2]="${conddep_dependers[$2]} $1"'
2909 eval 'conddep_condition[$1---$2]="$3"'
2912 func_cond_module_p
()
2914 eval 'previous_dependers="${conddep_dependers[$1]}"'
2915 test -n "$previous_dependers"
2917 func_cond_module_condition
()
2919 eval 'condition="${conddep_condition[$1---$2]}"'
2922 func_uncond_add_module
()
2926 suffix
=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2930 eval 'conddep_isuncond_'"$suffix"'=true'
2931 eval 'unset conddep_dependers_'"$suffix"
2933 func_conddep_add_module
()
2937 suffix
=`echo "$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2941 eval 'isuncond="${conddep_isuncond_'"$suffix"'}"'
2942 if test -z "$isuncond"; then
2943 eval 'conddep_dependers_'"$suffix"'="${conddep_dependers_'"$suffix"'} $1"'
2944 suffix
=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
2945 eval 'conddep_condition_'"$suffix"'="$3"'
2948 func_cond_module_p
()
2952 suffix
=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2956 eval 'previous_dependers="${conddep_dependers_'"$suffix"'}"'
2957 test -n "$previous_dependers"
2959 func_cond_module_condition
()
2961 suffix
=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
2962 eval 'condition="${conddep_condition_'"$suffix"'}"'
2966 # func_modules_transitive_closure
2968 # - local_gnulib_path from --local-dir
2969 # - gnu_make true if --gnu-make was given, false otherwise
2970 # - modcache true or false, from --cache-modules/--no-cache-modules
2971 # - modules list of specified modules
2972 # - inctests true if tests should be included, false otherwise
2973 # - incobsolete true if obsolete modules among dependencies should be
2974 # included, blank otherwise
2975 # - inc_cxx_tests true if C++ interoperability tests should be included,
2977 # - inc_longrunning_tests true if long-runnings tests should be included,
2979 # - inc_privileged_tests true if tests that require root privileges should be
2980 # included, blank otherwise
2981 # - inc_unportable_tests true if tests that fail on some platforms should be
2982 # included, blank otherwise
2983 # - inc_all_direct_tests true if all kinds of problematic unit tests among
2984 # the unit tests of the specified modules should be
2985 # included, blank otherwise
2986 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
2987 # the unit tests of the dependencies should be
2988 # included, blank otherwise
2989 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
2991 # - excl_longrunning_tests true if long-runnings tests should be excluded,
2993 # - excl_privileged_tests true if tests that require root privileges should be
2994 # excluded, blank otherwise
2995 # - excl_unportable_tests true if tests that fail on some platforms should be
2996 # excluded, blank otherwise
2997 # - avoidlist list of modules to avoid
2998 # - cond_dependencies true if conditional dependencies shall be supported,
3000 # - tmp pathname of a temporary directory
3002 # - modules list of modules, including dependencies
3003 # - conddep_dependers, conddep_condition information about conditionally
3005 func_modules_transitive_closure
()
3007 sed_escape_dependency
='s|\([/.]\)|\\\1|g'
3008 # In order to process every module only once (for speed), process an "input
3009 # list" of modules, producing an "output list" of modules. During each round,
3010 # more modules can be queued in the input list. Once a module on the input
3011 # list has been processed, it is added to the "handled list", so we can avoid
3012 # to process it again.
3014 inmodules
="$modules"
3016 fmtc_inc_all_tests
="$inc_all_direct_tests"
3017 if test "$cond_dependencies" = true
; then
3018 for module
in $inmodules; do
3020 if test -n "$module"; then
3021 if func_acceptable
$module; then
3022 func_uncond_add_module
$module
3027 while test -n "$inmodules"; do
3028 inmodules_this_round
="$inmodules"
3029 inmodules
= # Accumulator, queue for next round
3030 for module
in $inmodules_this_round; do
3032 if test -n "$module"; then
3033 if func_acceptable
$module; then
3034 func_append outmodules
" $module"
3035 if test "$cond_dependencies" = true
; then
3037 && func_get_automake_snippet_conditional
$module \
3038 |
grep '^if ' > /dev
/null
; then
3039 # A module whose Makefile.am snippet contains a reference to an
3040 # automake conditional. If we were to use it conditionally, we
3041 # would get an error
3042 # configure: error: conditional "..." was never defined.
3043 # because automake 1.11.1 does not handle nested conditionals
3044 # correctly. As a workaround, make the module unconditional.
3045 func_uncond_add_module
$module
3047 if func_cond_module_p
$module; then
3053 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
3054 # Duplicate dependencies are harmless, but Jim wants a warning.
3055 duplicated_deps
=`echo "$deps" | LC_ALL=C sort | LC_ALL=C uniq -d`
3056 if test -n "$duplicated_deps"; then
3057 func_warning
"module $module has duplicated dependencies: "`echo $duplicated_deps`
3060 testsmodule
=`func_get_tests_module $module`
3061 if test -n "$testsmodule"; then
3062 deps
="$deps $testsmodule"
3065 for dep
in $deps; do
3066 # Determine whether to include the dependency or tests module.
3068 for word
in `func_get_status $dep`; do
3071 test -n "$incobsolete" \
3075 test -z "$excl_cxx_tests" \
3077 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_cxx_tests" \
3081 test -z "$excl_longrunning_tests" \
3083 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_longrunning_tests" \
3087 test -z "$excl_privileged_tests" \
3089 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_privileged_tests" \
3093 test -z "$excl_unportable_tests" \
3095 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_unportable_tests" \
3099 test -n "$fmtc_inc_all_tests" \
3104 if $inc && func_acceptable
"$dep"; then
3105 func_append inmodules
" $dep"
3106 if test "$cond_dependencies" = true
; then
3107 escaped_dep
=`echo "$dep" | sed -e "$sed_escape_dependency"`
3108 sed_extract_condition1
='/^ *'"$escaped_dep"' *$/{
3111 sed_extract_condition2
='/^ *'"$escaped_dep"' *\[.*\] *$/{
3112 s/^ *'"$escaped_dep"' *\[\(.*\)\] *$/\1/p
3114 condition
=`func_get_dependencies $module | sed -n -e "$sed_extract_condition1" -e "$sed_extract_condition2"`
3115 if test "$condition" = true
; then
3118 if test -n "$condition"; then
3119 func_conddep_add_module
"$module" "$dep" "$condition"
3121 if $conditional; then
3122 func_conddep_add_module
"$module" "$dep" true
3124 func_uncond_add_module
"$dep"
3133 handledmodules
=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
3134 # Remove $handledmodules from $inmodules.
3135 for m
in $inmodules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/queued-modules
3136 inmodules
=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
3137 fmtc_inc_all_tests
="$inc_all_indirect_tests"
3139 modules
=`for m in $outmodules; do echo $m; done | LC_ALL=C sort -u`
3140 rm -f "$tmp"/queued-modules
3143 # func_show_module_list
3145 # - specified_modules list of specified modules (one per line, sorted)
3146 # - modules complete list of modules (one per line, sorted)
3147 # - tmp pathname of a temporary directory
3148 func_show_module_list
()
3154 # Assume xterm compatible escape sequences.
3155 bold_on
=`printf '\033[1m'`
3156 bold_off
=`printf '\033[0m'`
3161 echo "Module list with included dependencies (indented):"
3162 echo "$specified_modules" |
sed -e '/^$/d' -e 's/$/| /' > "$tmp"/specified-modules
3163 echo "$modules" |
sed -e '/^$/d' \
3164 | LC_ALL
=C
join -t '|' -a2 "$tmp"/specified-modules
- \
3165 |
sed -e 's/^\(.*\)|.*/|\1/' -e 's/^/ /' -e 's/^ |\(.*\)$/ '"${bold_on}"'\1'"${bold_off}"'/'
3168 # func_modules_transitive_closure_separately
3169 # Determine main module list and tests-related module list separately.
3170 # The main module list is the transitive closure of the specified modules,
3171 # ignoring tests modules. Its lib/* sources go into $sourcebase/. If --lgpl
3172 # is specified, it will consist only of LGPLed source.
3173 # The tests-related module list is the transitive closure of the specified
3174 # modules, including tests modules, minus the main module list excluding
3175 # modules of applicability 'all'. Its lib/* sources (brought in through
3176 # dependencies of *-tests modules) go into $testsbase/. It may contain GPLed
3177 # source, even if --lgpl is specified.
3179 # - local_gnulib_path from --local-dir
3180 # - modcache true or false, from --cache-modules/--no-cache-modules
3181 # - specified_modules list of specified modules
3182 # - inctests true if tests should be included, false otherwise
3183 # - incobsolete true if obsolete modules among dependencies should be
3184 # included, blank otherwise
3185 # - inc_cxx_tests true if C++ interoperability tests should be included,
3187 # - inc_longrunning_tests true if long-runnings tests should be included,
3189 # - inc_privileged_tests true if tests that require root privileges should be
3190 # included, blank otherwise
3191 # - inc_unportable_tests true if tests that fail on some platforms should be
3192 # included, blank otherwise
3193 # - inc_all_direct_tests true if all kinds of problematic unit tests among
3194 # the unit tests of the specified modules should be
3195 # included, blank otherwise
3196 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
3197 # the unit tests of the dependencies should be
3198 # included, blank otherwise
3199 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
3201 # - excl_longrunning_tests true if long-runnings tests should be excluded,
3203 # - excl_privileged_tests true if tests that require root privileges should be
3204 # excluded, blank otherwise
3205 # - excl_unportable_tests true if tests that fail on some platforms should be
3206 # excluded, blank otherwise
3207 # - avoidlist list of modules to avoid
3208 # - cond_dependencies true if conditional dependencies shall be supported,
3210 # - tmp pathname of a temporary directory
3212 # - main_modules list of modules, including dependencies
3213 # - testsrelated_modules list of tests-related modules, including dependencies
3214 # - conddep_dependers, conddep_condition information about conditionally
3216 func_modules_transitive_closure_separately
()
3218 # Determine main module list.
3219 saved_inctests
="$inctests"
3221 modules
="$specified_modules"
3222 func_modules_transitive_closure
3223 main_modules
="$modules"
3224 inctests
="$saved_inctests"
3225 if test $verbose -ge 1; then
3226 echo "Main module list:"
3227 echo "$main_modules" |
sed -e 's/^/ /'
3229 # Determine tests-related module list.
3230 echo "$final_modules" | LC_ALL
=C
sort -u > "$tmp"/final-modules
3231 testsrelated_modules
=`for module in $main_modules; do
3232 if test \`func_get_applicability
$module\
` = main; then
3236 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/final-modules`
3237 # If testsrelated_modules consists only of modules with applicability 'all',
3238 # set it to empty (because such modules are only helper modules for other modules).
3239 have_nontrivial_testsrelated_modules
=
3240 for module
in $testsrelated_modules; do
3241 if test `func_get_applicability $module` != all
; then
3242 have_nontrivial_testsrelated_modules
=yes
3246 if test -z "$have_nontrivial_testsrelated_modules"; then
3247 testsrelated_modules
=
3249 if test $verbose -ge 1; then
3250 echo "Tests-related module list:"
3251 echo "$testsrelated_modules" |
sed -e 's/^/ /'
3255 # func_determine_use_libtests
3256 # Determines whether a $testsbase/libtests.a is needed.
3258 # - local_gnulib_path from --local-dir
3259 # - modcache true or false, from --cache-modules/--no-cache-modules
3260 # - testsrelated_modules list of tests-related modules, including dependencies
3262 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
3263 func_determine_use_libtests
()
3266 for module
in $testsrelated_modules; do
3267 func_verify_nontests_module
3268 if test -n "$module"; then
3269 all_files
=`func_get_filelist $module`
3270 # Test whether some file in $all_files lies in lib/.
3271 for f
in $all_files; do
3283 # func_modules_add_dummy
3285 # - local_gnulib_path from --local-dir
3286 # - modcache true or false, from --cache-modules/--no-cache-modules
3287 # - modules list of modules, including dependencies
3289 # - modules list of modules, including 'dummy' if needed
3290 func_modules_add_dummy
()
3292 # Determine whether any module provides a lib_SOURCES augmentation.
3294 for module
in $modules; do
3295 func_verify_nontests_module
3296 if test -n "$module"; then
3297 if test "$cond_dependencies" = true
&& func_cond_module_p
$module; then
3298 # Ignore conditional modules, since they are not guaranteed to
3299 # contribute to lib_SOURCES.
3302 # Extract the value of "lib_SOURCES += ...".
3303 for file in `func_get_automake_snippet "$module" | combine_lines |
3304 sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'`; do
3305 # Ignore .h files since they are not compiled.
3309 have_lib_SOURCES
=yes
3317 # Add the dummy module, to make sure the library will be non-empty.
3318 if test -z "$have_lib_SOURCES"; then
3319 if func_acceptable
"dummy"; then
3320 func_append modules
" dummy"
3325 # func_modules_add_dummy_separately
3327 # - local_gnulib_path from --local-dir
3328 # - modcache true or false, from --cache-modules/--no-cache-modules
3329 # - main_modules list of modules, including dependencies
3330 # - testsrelated_modules list of tests-related modules, including dependencies
3331 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
3333 # - main_modules list of modules, including 'dummy' if needed
3334 # - testsrelated_modules list of tests-related modules, including 'dummy' if
3336 func_modules_add_dummy_separately
()
3338 # Add the dummy module to the main module list if needed.
3339 modules
="$main_modules"
3340 func_modules_add_dummy
3341 main_modules
="$modules"
3343 # Add the dummy module to the tests-related module list if needed.
3344 if $use_libtests; then
3345 modules
="$testsrelated_modules"
3346 func_modules_add_dummy
3347 testsrelated_modules
="$modules"
3351 # func_modules_notice
3353 # - local_gnulib_path from --local-dir
3354 # - modcache true or false, from --cache-modules/--no-cache-modules
3355 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
3356 # - modules list of modules, including dependencies
3357 func_modules_notice
()
3359 if test $verbose -ge -1; then
3360 for module
in $modules; do
3362 if test -n "$module"; then
3363 msg
=`func_get_notice $module`
3364 if test -n "$msg"; then
3365 echo "Notice from module $module:"
3366 echo "$msg" |
sed -e 's/^/ /'
3373 # func_modules_to_filelist
3375 # - local_gnulib_path from --local-dir
3376 # - modcache true or false, from --cache-modules/--no-cache-modules
3377 # - modules list of modules, including dependencies
3379 # - files list of files
3380 func_modules_to_filelist
()
3383 for module
in $modules; do
3385 if test -n "$module"; then
3386 fs
=`func_get_filelist $module`
3387 func_append files
" $fs"
3390 files
=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
3393 # func_modules_to_filelist_separately
3394 # Determine the final file lists.
3395 # They must be computed separately, because files in lib/* go into
3396 # $sourcebase/ if they are in the main file list but into $testsbase/
3397 # if they are in the tests-related file list. Furthermore lib/dummy.c
3400 # - local_gnulib_path from --local-dir
3401 # - modcache true or false, from --cache-modules/--no-cache-modules
3402 # - main_modules list of modules, including dependencies
3403 # - testsrelated_modules list of tests-related modules, including dependencies
3404 func_modules_to_filelist_separately
()
3406 # Determine final main file list.
3407 modules
="$main_modules"
3408 func_modules_to_filelist
3410 # Determine final tests-related file list.
3411 modules
="$testsrelated_modules"
3412 func_modules_to_filelist
3413 testsrelated_files
=`echo "$files" | sed -e 's,^lib/,tests=lib/,'`
3414 # Merge both file lists.
3415 sed_remove_empty_lines
='/^$/d'
3416 files
=`{ echo "$main_files"; echo "$testsrelated_files"; } | sed -e "$sed_remove_empty_lines" | LC_ALL=C sort -u`
3417 if test $verbose -ge 0; then
3419 sed_prettyprint_files
='s,^tests=lib/\(.*\)$,lib/\1 -> tests/\1,'
3420 echo "$files" |
sed -e "$sed_prettyprint_files" -e 's/^/ /'
3424 # func_compute_include_guard_prefix
3425 # Determine include_guard_prefix.
3427 # - macro_prefix prefix of gl_LIBOBJS macros to use
3429 # - include_guard_prefix replacement for ${gl_include_guard_prefix}
3430 # - sed_replace_include_guard_prefix
3431 # sed expression for resolving ${gl_include_guard_prefix}
3432 func_compute_include_guard_prefix
()
3434 if test "$macro_prefix" = gl
; then
3435 include_guard_prefix
='GL'
3437 include_guard_prefix
='GL_'`echo "$macro_prefix" | LC_ALL=C tr '[a-z]' '[A-Z]'`
3439 sed_replace_include_guard_prefix
='s/\${gl_include_guard_prefix}/'"${include_guard_prefix}"'/g'
3442 # func_execute_command command [args...]
3443 # Executes a command.
3444 # Uses also the variables
3445 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
3446 func_execute_command
()
3448 if test $verbose -ge 0; then
3452 # Commands like automake produce output to stderr even when they succeed.
3453 # Turn this output off if the command succeeds.
3454 "$@" > "$tmp"/cmdout
2>&1
3456 if test $cmdret = 0; then
3460 cat "$tmp"/cmdout
1>&2
3467 # func_dest_tmpfilename file
3468 # determines the name of a temporary file (file is relative to destdir).
3470 # - destdir target directory
3471 # - doit : if actions shall be executed, false if only to be printed
3472 # - tmp pathname of a temporary directory
3474 # - tmpfile absolute filename of the temporary file
3475 func_dest_tmpfilename
()
3478 # Put the new contents of $file in a file in the same directory (needed
3479 # to guarantee that an 'mv' to "$destdir/$file" works).
3480 tmpfile
="$destdir/$1.tmp"
3482 # Put the new contents of $file in a file in a temporary directory
3483 # (because the directory of "$file" might not exist).
3484 tmpfile
="$tmp"/`basename "$1"`.tmp
3488 # func_is_local_file lookedup_file file
3489 # check whether file should be instantiated from local gnulib directory
3490 func_is_local_file
()
3493 func_remove_suffix dname
"/$2"
3494 func_path_foreach
"$local_gnulib_path" test %dir
% = "$dname"
3498 # determines whether the file $f should be copied, symlinked, or hardlinked.
3500 # - copymode copy mode for files in general
3501 # - lcopymode copy mode for files from local_gnulib_path
3502 # - f the original file name
3503 # - lookedup_file name of the merged (combined) file
3505 # - copyaction copy or symlink or hardlink
3508 if test -n "$lcopymode" && func_is_local_file
"$lookedup_file" "$f"; then
3509 copyaction
="$lcopymode"
3511 if test -n "$copymode"; then
3512 copyaction
="$copymode"
3520 # copies a file from gnulib into the destination directory. The destination
3521 # is known to not exist.
3523 # - destdir target directory
3524 # - local_gnulib_path from --local-dir
3525 # - modcache true or false, from --cache-modules/--no-cache-modules
3526 # - f the original file name
3527 # - lookedup_file name of the merged (combined) file
3528 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
3529 # - g the rewritten file name
3530 # - tmpfile absolute filename of the temporary file
3531 # - doit : if actions shall be executed, false if only to be printed
3532 # - copymode copy mode for files in general
3533 # - lcopymode copy mode for files from local_gnulib_path
3537 echo "Copying file $g"
3539 if test "$copyaction" = symlink \
3540 && test -z "$lookedup_tmp" \
3541 && cmp -s "$lookedup_file" "$tmpfile"; then
3542 func_symlink_if_changed
"$lookedup_file" "$destdir/$g"
3544 if test "$copyaction" = hardlink \
3545 && test -z "$lookedup_tmp" \
3546 && cmp -s "$lookedup_file" "$tmpfile"; then
3547 func_hardlink
"$lookedup_file" "$destdir/$g"
3549 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error
"failed"
3558 # copies a file from gnulib into the destination directory. The destination
3559 # is known to exist.
3561 # - destdir target directory
3562 # - local_gnulib_path from --local-dir
3563 # - modcache true or false, from --cache-modules/--no-cache-modules
3564 # - f the original file name
3565 # - lookedup_file name of the merged (combined) file
3566 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
3567 # - g the rewritten file name
3568 # - tmpfile absolute filename of the temporary file
3569 # - doit : if actions shall be executed, false if only to be printed
3570 # - copymode copy mode for files in general
3571 # - lcopymode copy mode for files from local_gnulib_path
3572 # - already_present nonempty if the file should already exist, empty otherwise
3575 if cmp -s "$destdir/$g" "$tmpfile"; then
3576 : # The file has not changed.
3580 if test -n "$already_present"; then
3581 echo "Updating file $g (backup in ${g}~)"
3583 echo "Replacing file $g (non-gnulib code backed up in ${g}~) !!"
3585 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error
"failed"
3587 if test "$copyaction" = symlink \
3588 && test -z "$lookedup_tmp" \
3589 && cmp -s "$lookedup_file" "$tmpfile"; then
3590 func_symlink_if_changed
"$lookedup_file" "$destdir/$g"
3592 if test "$copyaction" = hardlink \
3593 && test -z "$lookedup_tmp" \
3594 && cmp -s "$lookedup_file" "$tmpfile"; then
3595 func_hardlink
"$lookedup_file" "$destdir/$g"
3597 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error
"failed"
3601 if test -n "$already_present"; then
3602 echo "Update file $g (backup in ${g}~)"
3604 echo "Replace file $g (non-gnulib code backed up in ${g}~) !!"
3610 # func_emit_lib_Makefile_am
3611 # emits the contents of library makefile to standard output.
3613 # - local_gnulib_path from --local-dir
3614 # - modcache true or false, from --cache-modules/--no-cache-modules
3615 # - modules list of modules, including dependencies
3616 # - libname library name
3617 # - pobase directory relative to destdir where to place *.po files
3618 # - auxdir directory relative to destdir where to place build aux files
3619 # - gnu_make true if --gnu-make was given, false otherwise
3620 # - makefile_name from --makefile-name
3621 # - libtool true if libtool will be used, false or blank otherwise
3622 # - macro_prefix prefix of gl_LIBOBJS macros to use
3623 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
3624 # - witness_c_macro from --witness-c-macro
3625 # - actioncmd (optional) command that will reproduce this invocation
3626 # - for_test true if creating a package for testing, false otherwise
3627 # - sed_replace_include_guard_prefix
3628 # sed expression for resolving ${gl_include_guard_prefix}
3629 # - destfile filename relative to destdir of makefile being generated
3631 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val,dotfirst}
3632 # list of edits to be done to Makefile.am variables
3634 # - uses_subdirs nonempty if object files in subdirs exist
3635 func_emit_lib_Makefile_am
()
3638 # When using GNU make, or when creating an includable Makefile.am snippet,
3639 # augment variables with += instead of assigning them.
3640 if $gnu_make ||
test -n "$makefile_name"; then
3645 if test "$libtool" = true
; then
3648 sed_eliminate_LDFLAGS
="$sed_noop"
3652 sed_eliminate_LDFLAGS
='/^lib_LDFLAGS[ ]*+=/d'
3655 # When creating a package for testing: Attempt to provoke failures,
3656 # especially link errors, already during "make" rather than during
3657 # "make check", because "make check" is not possible in a cross-compiling
3658 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
3659 sed_transform_check_PROGRAMS
='s,check_PROGRAMS,noinst_PROGRAMS,g'
3661 sed_transform_check_PROGRAMS
="$sed_noop"
3663 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3665 echo "## Process this file with automake to produce Makefile.in."
3666 func_emit_copyright_notice
3667 if test -n "$actioncmd"; then
3668 printf '# Reproduce by:\n%s\n' "$actioncmd"
3673 for module
in $modules; do
3674 func_verify_nontests_module
3675 if test -n "$module"; then
3677 func_get_automake_snippet_conditional
"$module" |
3679 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
3680 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
3681 -e "$sed_eliminate_LDFLAGS" \
3682 -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' \
3683 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
3684 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
3685 -e "$sed_transform_check_PROGRAMS" \
3686 -e "$sed_replace_include_guard_prefix"
3687 if test "$module" = 'alloca'; then
3688 echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
3689 echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@"
3691 } | combine_lines
"${libname}_${libext}_SOURCES" > "$tmp"/amsnippet1
3693 func_get_automake_snippet_unconditional
"$module" |
3694 LC_ALL
=C
sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g'
3695 } > "$tmp"/amsnippet2
3696 # Skip the contents if it's entirely empty.
3697 if grep '[^ ]' "$tmp"/amsnippet1
"$tmp"/amsnippet2
> /dev
/null
; then
3698 echo "## begin gnulib module $module"
3700 echo "ifeq (,\$(OMIT_GNULIB_MODULE_$module))"
3701 convert_to_gnu_make
='s/^if \(.*\)/ifneq (,$(\1))/'
3703 convert_to_gnu_make
=
3706 if test "$cond_dependencies" = true
; then
3707 if func_cond_module_p
"$module"; then
3708 func_module_conditional_name
"$module"
3710 echo "ifneq (,\$($conditional))"
3712 echo "if $conditional"
3716 sed "$convert_to_gnu_make" "$tmp"/amsnippet1
3717 if test "$cond_dependencies" = true
; then
3718 if func_cond_module_p
"$module"; then
3722 sed "$convert_to_gnu_make" "$tmp"/amsnippet2
3726 echo "## end gnulib module $module"
3729 rm -f "$tmp"/amsnippet1
"$tmp"/amsnippet2
3730 # Test whether there are some source files in subdirectories.
3731 for f
in `func_get_filelist "$module"`; do
3741 } > "$tmp"/allsnippets
3742 if test -z "$makefile_name"; then
3743 # If there are source files in subdirectories, prevent collision of the
3744 # object files (example: hash.c and libxml/hash.c).
3746 if test -n "$uses_subdirs"; then
3747 subdir_options
=' subdir-objects'
3749 echo "AUTOMAKE_OPTIONS = 1.11 gnits${subdir_options}"
3752 if test -z "$makefile_name"; then
3754 echo "noinst_HEADERS ="
3755 echo "noinst_LIBRARIES ="
3756 echo "noinst_LTLIBRARIES ="
3757 # Automake versions < 1.11.4 create an empty pkgdatadir at
3758 # installation time if you specify pkgdata_DATA to empty.
3759 # See automake bugs #10997 and #11030:
3760 # * https://debbugs.gnu.org/10997
3761 # * https://debbugs.gnu.org/11030
3762 # So we need this workaround.
3763 if grep '^pkgdata_DATA *+=' "$tmp"/allsnippets
> /dev
/null
; then
3764 echo "pkgdata_DATA ="
3767 echo "BUILT_SOURCES ="
3770 echo "MOSTLYCLEANFILES $assign core *.stackdump"
3771 if test -z "$makefile_name"; then
3772 echo "MOSTLYCLEANDIRS ="
3774 echo "DISTCLEANFILES ="
3775 echo "MAINTAINERCLEANFILES ="
3778 echo "# Start of GNU Make output."
3780 # Put autoconf output into a temporary file, so that its exit status
3781 # can be checked from the shell. Signal any error by putting a
3782 # syntax error into the output makefile.
3783 ${AUTOCONF} -t 'AC_SUBST:$1 = @$1@' "$configure_ac" \
3784 >"$tmp"/makeout
2>"$tmp"/makeout2
&&
3785 LC_ALL
=C
sort -u "$tmp"/makeout ||
{
3786 echo "== gnulib-tool GNU Make output failed as follows =="
3787 sed 's/^/# stderr: /' "$tmp"/makeout2
3789 rm -f "$tmp"/makeout
"$tmp"/makeout2
3791 echo "# End of GNU Make output."
3793 echo "# No GNU Make output."
3795 # Execute edits that apply to the Makefile.am being generated.
3797 while test $edit != $makefile_am_edits; do
3798 edit
=`expr $edit + 1`
3799 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
3800 eval var
=\"\
$makefile_am_edit${edit}_var
\"
3801 eval val
=\"\
$makefile_am_edit${edit}_val
\"
3802 eval dotfirst
=\"\
$makefile_am_edit${edit}_dotfirst
\"
3803 if test -n "$var"; then
3804 if test "${dir}Makefile.am" = "$destfile" ||
test "./${dir}Makefile.am" = "$destfile"; then
3805 if test "${var}" = SUBDIRS
&& test -n "$dotfirst"; then
3806 # The added subdirectory ${val} needs to be mentioned after '.'.
3807 # Since we don't have '.' among SUBDIRS so far, add it now.
3810 echo "${var} += ${val}"
3811 eval "makefile_am_edit${edit}_var="
3815 if test -n "$witness_c_macro"; then
3816 cppflags_part1
=" -D$witness_c_macro=1"
3821 cppflags_part2
=" -DGNULIB_STRICT_CHECKING=1"
3825 if test -z "$makefile_name"; then
3827 echo "AM_CPPFLAGS =$cppflags_part1$cppflags_part2"
3830 if test -n "$cppflags_part1$cppflags_part2"; then
3832 echo "AM_CPPFLAGS +=$cppflags_part1$cppflags_part2"
3836 if LC_ALL
=C
grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$tmp"/allsnippets
> /dev
/null \
3837 ||
{ test -n "$makefile_name" \
3838 && test -f "$sourcebase/Makefile.am" \
3839 && LC_ALL
=C
grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$sourcebase/Makefile.am" > /dev
/null
; \
3841 # One of the snippets or the user's Makefile.am already specifies an
3842 # installation location for the library. Don't confuse automake by saying
3843 # it should not be installed.
3846 # By default, the generated library should not be installed.
3847 echo "noinst_${perhapsLT}LIBRARIES += $libname.$libext"
3850 echo "${libname}_${libext}_SOURCES ="
3851 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
3852 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
3853 echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
3854 echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
3855 echo "EXTRA_${libname}_${libext}_SOURCES ="
3856 if test "$libtool" = true
; then
3857 echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)"
3858 echo "${libname}_${libext}_LDFLAGS += -no-undefined"
3859 # Synthesize an ${libname}_${libext}_LDFLAGS augmentation by combining
3860 # the link dependencies of all modules.
3861 for module
in $modules; do
3862 func_verify_nontests_module
3863 if test -n "$module"; then
3864 func_get_link_directive
"$module"
3867 | LC_ALL
=C
sed -e '/^$/d' -e 's/ when linking with libtool.*//' \
3868 | LC_ALL
=C
sort -u \
3869 | LC_ALL
=C
sed -e 's/^/'"${libname}_${libext}"'_LDFLAGS += /'
3872 if test -n "$pobase"; then
3873 echo "AM_CPPFLAGS += -DDEFAULT_TEXT_DOMAIN=\\\"${po_domain}-gnulib\\\""
3876 cat "$tmp"/allsnippets \
3877 |
sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
3879 echo "mostlyclean-local: mostlyclean-generic"
3880 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
3881 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
3882 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
3886 rm -f "$tmp"/allsnippets
3889 # func_emit_po_Makevars
3890 # emits the contents of po/ makefile parameterization to standard output.
3892 # - local_gnulib_path from --local-dir
3893 # - modcache true or false, from --cache-modules/--no-cache-modules
3894 # - sourcebase directory relative to destdir where to place source code
3895 # - pobase directory relative to destdir where to place *.po files
3896 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
3897 func_emit_po_Makevars
()
3899 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3900 func_emit_copyright_notice
3902 echo "# Usually the message domain is the same as the package name."
3903 echo "# But here it has a '-gnulib' suffix."
3904 echo "DOMAIN = ${po_domain}-gnulib"
3906 echo "# These two variables depend on the location of this directory."
3907 echo "subdir = ${pobase}"
3908 echo "top_builddir = "`echo "$pobase" | sed -e 's,//*,/,g' -e 's,[^/][^/]*,..,g'`
3911 # These options get passed to xgettext.
3912 XGETTEXT_OPTIONS
= \
3913 --keyword=_
--flag=_
:1:pass-c-format \
3914 --keyword=N_
--flag=N_
:1:pass-c-format \
3915 --keyword='proper_name:1,"This is a proper name. See the gettext manual, section Names."' \
3916 --keyword='proper_name_utf8:1,"This is a proper name. See the gettext manual, section Names."' \
3917 --flag=error
:3:c-format
--flag=error_at_line
:5:c-format
3919 # This is the copyright holder that gets inserted into the header of the
3920 # $(DOMAIN).pot file. gnulib is copyrighted by the FSF.
3921 COPYRIGHT_HOLDER
= Free Software Foundation
, Inc.
3923 # This is the email address or URL to which the translators shall report
3924 # bugs in the untranslated strings:
3925 # - Strings which are not entire sentences, see the maintainer guidelines
3926 # in the GNU gettext documentation, section 'Preparing Strings'.
3927 # - Strings which use unclear terms or require additional context to be
3929 # - Strings which make invalid assumptions about notation of date, time or
3931 # - Pluralisation problems.
3932 # - Incorrect English spelling.
3933 # - Incorrect formatting.
3934 # It can be your email address, or a mailing list address where translators
3935 # can write to without being subscribed, or the URL of a web page through
3936 # which the translators can contact you.
3937 MSGID_BUGS_ADDRESS
= bug-gnulib@gnu.org
3939 # This is the list of locale categories, beyond LC_MESSAGES, for which the
3940 # message catalogs shall be used. It is usually empty.
3941 EXTRA_LOCALE_CATEGORIES
=
3943 # This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
3944 # context. Possible values are "yes" and "no". Set this to yes if the
3945 # package uses functions taking also a message context, like pgettext(), or
3946 # if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
3951 # func_emit_po_POTFILES_in
3952 # emits the file list to be passed to xgettext to standard output.
3954 # - local_gnulib_path from --local-dir
3955 # - modcache true or false, from --cache-modules/--no-cache-modules
3956 # - sourcebase directory relative to destdir where to place source code
3957 # - files list of new files
3958 func_emit_po_POTFILES_in
()
3960 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3961 func_emit_copyright_notice
3963 echo "# List of files which contain translatable strings."
3964 echo "$files" |
sed -n -e "s,^lib/,$sourcebase/,p"
3967 # func_emit_tests_Makefile_am witness_macro
3968 # emits the contents of tests makefile to standard output.
3970 # - local_gnulib_path from --local-dir
3971 # - modcache true or false, from --cache-modules/--no-cache-modules
3972 # - modules list of modules, including dependencies
3973 # - libname library name
3974 # - auxdir directory relative to destdir where to place build aux files
3975 # - gnu_make true if --gnu-make was given, false otherwise
3976 # - makefile_name from --makefile-name
3977 # - libtool true if libtool will be used, false or blank otherwise
3978 # - sourcebase relative directory containing lib source code
3979 # - m4base relative directory containing autoconf macros
3980 # - testsbase relative directory containing unit test code
3981 # - macro_prefix prefix of gl_LIBOBJS macros to use
3982 # - witness_c_macro from --witness-c-macro
3983 # - for_test true if creating a package for testing, false otherwise
3984 # - single_configure true if a single configure file should be generated,
3985 # false for a separate configure file for the tests
3986 # - use_libtests true if a libtests.a should be built, false otherwise
3987 # - sed_replace_include_guard_prefix
3988 # sed expression for resolving ${gl_include_guard_prefix}
3989 # - destfile filename relative to destdir of makefile being generated
3991 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val,dotfirst}
3992 # list of edits to be done to Makefile.am variables
3994 # - uses_subdirs nonempty if object files in subdirs exist
3995 func_emit_tests_Makefile_am
()
3998 if test "$libtool" = true
; then
4001 sed_eliminate_LDFLAGS
="$sed_noop"
4005 sed_eliminate_LDFLAGS
='/^lib_LDFLAGS[ ]*+=/d'
4008 # When creating a package for testing: Attempt to provoke failures,
4009 # especially link errors, already during "make" rather than during
4010 # "make check", because "make check" is not possible in a cross-compiling
4011 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
4012 sed_transform_check_PROGRAMS
='s,check_PROGRAMS,noinst_PROGRAMS,g'
4014 sed_transform_check_PROGRAMS
="$sed_noop"
4016 testsbase_inverse
=`echo "$testsbase" | sed -e 's,/$,,' | sed -e 's,[^/][^/]*,..,g'`
4017 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
4018 echo "## Process this file with automake to produce Makefile.in."
4019 func_emit_copyright_notice
4023 for module
in $modules; do
4024 if $for_test && ! $single_configure; then
4025 func_verify_tests_module
4029 if test -n "$module"; then
4031 func_get_automake_snippet
"$module" |
4033 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
4034 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
4035 -e "$sed_eliminate_LDFLAGS" \
4036 -e 's,lib_\([A-Z][A-Z]*\),libtests_a_\1,g' \
4037 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
4038 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
4039 -e "$sed_transform_check_PROGRAMS" \
4040 -e "$sed_replace_include_guard_prefix"
4041 if $use_libtests && test "$module" = 'alloca'; then
4042 echo "libtests_a_LIBADD += @ALLOCA@"
4043 echo "libtests_a_DEPENDENCIES += @ALLOCA@"
4045 } > "$tmp"/amsnippet
4046 # Skip the contents if it's entirely empty.
4047 if grep '[^ ]' "$tmp"/amsnippet
> /dev
/null
; then
4048 # Mention long-running tests at the end.
4050 for word
in `func_get_status "$module"`; do
4051 if test "$word" = 'longrunning-test'; then
4056 { echo "## begin gnulib module $module"
4058 echo "ifeq (,\$(OMIT_GNULIB_MODULE_$module))"
4061 cat "$tmp"/amsnippet
4065 echo "## end gnulib module $module"
4069 rm -f "$tmp"/amsnippet
4070 # Test whether there are some source files in subdirectories.
4071 for f
in `func_get_filelist "$module"`; do
4073 lib
/*/*.c |
tests
/*/*.c
)
4081 } 3> "$tmp"/main_snippets
4> "$tmp"/longrunning_snippets
4082 # Generate dependencies here, since it eases the debugging of test failures.
4083 # If there are source files in subdirectories, prevent collision of the
4084 # object files (example: hash.c and libxml/hash.c).
4086 if test -n "$uses_subdirs"; then
4087 subdir_options
=' subdir-objects'
4089 echo "AUTOMAKE_OPTIONS = 1.11 foreign${subdir_options}"
4091 if $for_test && ! $single_configure; then
4092 echo "ACLOCAL_AMFLAGS = -I ${testsbase_inverse}/${m4base}"
4095 # Nothing is being added to SUBDIRS; nevertheless the existence of this
4096 # variable is needed to avoid an error from automake:
4097 # "AM_GNU_GETTEXT used but SUBDIRS not defined"
4100 echo "XFAIL_TESTS ="
4101 echo "TESTS_ENVIRONMENT ="
4102 echo "noinst_PROGRAMS ="
4103 if ! $for_test; then
4104 echo "check_PROGRAMS ="
4106 echo "EXTRA_PROGRAMS ="
4107 echo "noinst_HEADERS ="
4108 echo "noinst_LIBRARIES ="
4109 if $use_libtests; then
4111 echo "noinst_LIBRARIES += libtests.a"
4113 echo "check_LIBRARIES = libtests.a"
4116 # Automake versions < 1.11.4 create an empty pkgdatadir at
4117 # installation time if you specify pkgdata_DATA to empty.
4118 # See automake bugs #10997 and #11030:
4119 # * https://debbugs.gnu.org/10997
4120 # * https://debbugs.gnu.org/11030
4121 # So we need this workaround.
4122 if grep '^pkgdata_DATA *+=' "$tmp"/main_snippets
"$tmp"/longrunning_snippets
> /dev
/null
; then
4123 echo "pkgdata_DATA ="
4126 echo "BUILT_SOURCES ="
4128 echo "MOSTLYCLEANFILES = core *.stackdump"
4129 echo "MOSTLYCLEANDIRS ="
4131 echo "DISTCLEANFILES ="
4132 echo "MAINTAINERCLEANFILES ="
4133 # Execute edits that apply to the Makefile.am being generated.
4135 while test $edit != $makefile_am_edits; do
4136 edit
=`expr $edit + 1`
4137 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
4138 eval var
=\"\
$makefile_am_edit${edit}_var
\"
4139 eval val
=\"\
$makefile_am_edit${edit}_val
\"
4140 eval dotfirst
=\"\
$makefile_am_edit${edit}_dotfirst
\"
4141 if test -n "$var"; then
4142 if test "${dir}Makefile.am" = "$destfile" ||
test "./${dir}Makefile.am" = "$destfile"; then
4143 if test "${var}" = SUBDIRS
&& test -n "$dotfirst"; then
4144 # The added subdirectory ${val} needs to be mentioned after '.'.
4145 # But we have '.' among SUBDIRS already, so do nothing.
4148 echo "${var} += ${val}"
4149 eval "makefile_am_edit${edit}_var="
4154 echo "AM_CPPFLAGS = \\"
4156 echo " -DGNULIB_STRICT_CHECKING=1 \\"
4158 if test -n "$witness_c_macro"; then
4159 echo " -D$witness_c_macro=1 \\"
4161 if test -n "${witness_macro}"; then
4162 echo " -D@${witness_macro}@=1 \\"
4164 echo " -I. -I\$(srcdir) \\"
4165 echo " -I${testsbase_inverse} -I\$(srcdir)/${testsbase_inverse} \\"
4166 echo " -I${testsbase_inverse}/${sourcebase-lib} -I\$(srcdir)/${testsbase_inverse}/${sourcebase-lib}"
4168 if $use_libtests; then
4169 # All test programs need to be linked with libtests.a.
4170 # It needs to be passed to the linker before ${libname}.${libext}, since
4171 # the tests-related modules depend on the main modules.
4172 # It also needs to be passed to the linker after ${libname}.${libext}
4173 # because the latter might contain incomplete modules (such as the 'error'
4174 # module whose dependency to 'progname' is voluntarily omitted).
4175 # The LIBTESTS_LIBDEPS can be passed to the linker once or twice, it does
4177 echo "LDADD = libtests.a ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext} libtests.a ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext} \$(LIBTESTS_LIBDEPS)"
4179 echo "LDADD = ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext}"
4182 if $use_libtests; then
4183 echo "libtests_a_SOURCES ="
4184 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
4185 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
4186 echo "libtests_a_LIBADD = \$(${macro_prefix}tests_LIBOBJS)"
4187 echo "libtests_a_DEPENDENCIES = \$(${macro_prefix}tests_LIBOBJS)"
4188 echo "EXTRA_libtests_a_SOURCES ="
4189 # The circular dependency in LDADD requires this.
4190 echo "AM_LIBTOOLFLAGS = --preserve-dup-deps"
4193 # Many test scripts use ${EXEEXT} or ${srcdir}.
4194 # EXEEXT is defined by AC_PROG_CC through autoconf.
4195 # srcdir is defined by autoconf and automake.
4196 echo "TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='\$(srcdir)'"
4198 cat "$tmp"/main_snippets
"$tmp"/longrunning_snippets \
4199 |
sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
4200 echo "# Clean up after Solaris cc."
4202 echo " rm -rf SunWS_cache"
4204 echo "mostlyclean-local: mostlyclean-generic"
4205 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
4206 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
4207 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
4211 rm -f "$tmp"/main_snippets
"$tmp"/longrunning_snippets
4214 # func_emit_initmacro_start macro_prefix
4215 # emits the first few statements of the gl_INIT macro to standard output.
4216 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4217 func_emit_initmacro_start
()
4219 macro_prefix_arg
="$1"
4220 # Overriding AC_LIBOBJ and AC_REPLACE_FUNCS has the effect of storing
4221 # platform-dependent object files in ${macro_prefix_arg}_LIBOBJS instead of
4222 # LIBOBJS. The purpose is to allow several gnulib instantiations under
4223 # a single configure.ac file. (AC_CONFIG_LIBOBJ_DIR does not allow this
4225 # Furthermore it avoids an automake error like this when a Makefile.am
4226 # that uses pieces of gnulib also uses $(LIBOBJ):
4227 # automatically discovered file `error.c' should not be explicitly mentioned
4228 echo " m4_pushdef([AC_LIBOBJ], m4_defn([${macro_prefix_arg}_LIBOBJ]))"
4229 echo " m4_pushdef([AC_REPLACE_FUNCS], m4_defn([${macro_prefix_arg}_REPLACE_FUNCS]))"
4230 # Overriding AC_LIBSOURCES has the same purpose of avoiding the automake
4231 # error when a Makefile.am that uses pieces of gnulib also uses $(LIBOBJ):
4232 # automatically discovered file `error.c' should not be explicitly mentioned
4233 # We let automake know about the files to be distributed through the
4234 # EXTRA_lib_SOURCES variable.
4235 echo " m4_pushdef([AC_LIBSOURCES], m4_defn([${macro_prefix_arg}_LIBSOURCES]))"
4236 # Create data variables for checking the presence of files that are mentioned
4237 # as AC_LIBSOURCES arguments. These are m4 variables, not shell variables,
4238 # because we want the check to happen when the configure file is created,
4239 # not when it is run. ${macro_prefix_arg}_LIBSOURCES_LIST is the list of
4240 # files to check for. ${macro_prefix_arg}_LIBSOURCES_DIR is the subdirectory
4241 # in which to expect them.
4242 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_LIST], [])"
4243 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_DIR], [])"
4247 # func_emit_initmacro_end macro_prefix
4248 # emits the last few statements of the gl_INIT macro to standard output.
4249 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4250 func_emit_initmacro_end
()
4252 macro_prefix_arg
="$1"
4253 # Check the presence of files that are mentioned as AC_LIBSOURCES arguments.
4254 # The check is performed only when autoconf is run from the directory where
4255 # the configure.ac resides; if it is run from a different directory, the
4257 echo " m4_ifval(${macro_prefix_arg}_LIBSOURCES_LIST, ["
4258 echo " m4_syscmd([test ! -d ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[ ||"
4259 echo " for gl_file in ]${macro_prefix_arg}_LIBSOURCES_LIST[ ; do"
4260 echo " if test ! -r ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file ; then"
4261 echo " echo \"missing file ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file\" >&2"
4265 echo " m4_if(m4_sysval, [0], [],"
4266 echo " [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])"
4268 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_DIR])"
4269 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_LIST])"
4270 echo " m4_popdef([AC_LIBSOURCES])"
4271 echo " m4_popdef([AC_REPLACE_FUNCS])"
4272 echo " m4_popdef([AC_LIBOBJ])"
4273 echo " AC_CONFIG_COMMANDS_PRE(["
4274 echo " ${macro_prefix_arg}_libobjs="
4275 echo " ${macro_prefix_arg}_ltlibobjs="
4276 echo " if test -n \"\$${macro_prefix_arg}_LIBOBJS\"; then"
4277 echo " # Remove the extension."
4278 echo " sed_drop_objext='s/\\.o\$//;s/\\.obj\$//'"
4279 echo " for i in \`for i in \$${macro_prefix_arg}_LIBOBJS; do echo \"\$i\"; done | sed -e \"\$sed_drop_objext\" | sort | uniq\`; do"
4280 echo " ${macro_prefix_arg}_libobjs=\"\$${macro_prefix_arg}_libobjs \$i.\$ac_objext\""
4281 echo " ${macro_prefix_arg}_ltlibobjs=\"\$${macro_prefix_arg}_ltlibobjs \$i.lo\""
4284 echo " AC_SUBST([${macro_prefix_arg}_LIBOBJS], [\$${macro_prefix_arg}_libobjs])"
4285 echo " AC_SUBST([${macro_prefix_arg}_LTLIBOBJS], [\$${macro_prefix_arg}_ltlibobjs])"
4289 # func_emit_initmacro_done macro_prefix sourcebase
4290 # emits a few statements after the gl_INIT macro to standard output.
4291 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4292 # - sourcebase directory relative to destdir where to place source code
4293 func_emit_initmacro_done
()
4295 macro_prefix_arg
="$1"
4298 echo "# Like AC_LIBOBJ, except that the module name goes"
4299 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
4300 echo "AC_DEFUN([${macro_prefix_arg}_LIBOBJ], ["
4301 echo " AS_LITERAL_IF([\$1], [${macro_prefix_arg}_LIBSOURCES([\$1.c])])dnl"
4302 echo " ${macro_prefix_arg}_LIBOBJS=\"\$${macro_prefix_arg}_LIBOBJS \$1.\$ac_objext\""
4305 echo "# Like AC_REPLACE_FUNCS, except that the module name goes"
4306 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
4307 echo "AC_DEFUN([${macro_prefix_arg}_REPLACE_FUNCS], ["
4308 echo " m4_foreach_w([gl_NAME], [\$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl"
4309 echo " AC_CHECK_FUNCS([\$1], , [${macro_prefix_arg}_LIBOBJ(\$ac_func)])"
4312 echo "# Like AC_LIBSOURCES, except the directory where the source file is"
4313 echo "# expected is derived from the gnulib-tool parameterization,"
4314 echo "# and alloca is special cased (for the alloca-opt module)."
4315 echo "# We could also entirely rely on EXTRA_lib..._SOURCES."
4316 echo "AC_DEFUN([${macro_prefix_arg}_LIBSOURCES], ["
4317 echo " m4_foreach([_gl_NAME], [\$1], ["
4318 echo " m4_if(_gl_NAME, [alloca.c], [], ["
4319 echo " m4_define([${macro_prefix_arg}_LIBSOURCES_DIR], [$sourcebase_arg])"
4320 echo " m4_append([${macro_prefix_arg}_LIBSOURCES_LIST], _gl_NAME, [ ])"
4326 # func_emit_autoconf_snippet indentation
4327 # emits the autoconf snippet of a module.
4329 # - indentation spaces to prepend on each line
4330 # - local_gnulib_path from --local-dir
4331 # - modcache true or false, from --cache-modules/--no-cache-modules
4332 # - sed_replace_build_aux sed expression that replaces reference to build-aux
4333 # - sed_replace_include_guard_prefix
4334 # sed expression for resolving ${gl_include_guard_prefix}
4335 # - module the module name
4336 # - toplevel true or false. 'false' means a subordinate use of
4338 # - disable_libtool true or false. It tells whether to disable libtool
4339 # handling even if it has been specified through the
4340 # command line options.
4341 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
4343 func_emit_autoconf_snippet
()
4346 if { case $module in
4347 gnumakefile | maintainer-makefile
)
4348 # These modules are meant to be used only in the top-level directory.
4354 func_get_autoconf_snippet
"$module" \
4355 |
sed -e '/^$/d;' -e "s/^/$indentation/" \
4356 -e "$sed_replace_build_aux" \
4357 -e "$sed_replace_include_guard_prefix" \
4358 |
{ if $disable_libtool; then
4359 sed -e 's/\$gl_cond_libtool/false/g' \
4360 -e 's/gl_libdeps/gltests_libdeps/g' \
4361 -e 's/gl_ltlibdeps/gltests_ltlibdeps/g'
4366 |
{ if $disable_gettext; then
4367 sed -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./'
4369 # Don't indent AM_GNU_GETTEXT_VERSION line, as that confuses
4370 # autopoint through at least GNU gettext version 0.18.2.
4371 sed -e 's/^ *AM_GNU_GETTEXT_VERSION/AM_GNU_GETTEXT_VERSION/'
4374 if test "$module" = 'alloca' && test "$libtool" = true
&& ! $disable_libtool; then
4375 echo 'changequote(,)dnl'
4376 echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
4377 echo 'changequote([, ])dnl'
4378 echo 'AC_SUBST([LTALLOCA])'
4383 # func_emit_autoconf_snippets modules referenceable_modules verifier toplevel disable_libtool disable_gettext
4384 # collects and emit the autoconf snippets of a set of modules.
4386 # - local_gnulib_path from --local-dir
4387 # - modcache true or false, from --cache-modules/--no-cache-modules
4388 # - sed_replace_build_aux sed expression that replaces reference to build-aux
4389 # - sed_replace_include_guard_prefix
4390 # sed expression for resolving ${gl_include_guard_prefix}
4391 # - modules the list of modules.
4392 # - referenceable_modules the list of modules which may be referenced as dependencies.
4393 # - verifier one of func_verify_module, func_verify_nontests_module,
4394 # func_verify_tests_module. It selects the subset of
4395 # $modules to consider.
4396 # - toplevel true or false. 'false' means a subordinate use of
4398 # - disable_libtool true or false. It tells whether to disable libtool
4399 # handling even if it has been specified through the
4400 # command line options.
4401 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
4403 func_emit_autoconf_snippets
()
4405 referenceable_modules
="$2"
4408 disable_libtool
="$5"
4409 disable_gettext
="$6"
4410 if test "$cond_dependencies" = true
; then
4411 for m
in $referenceable_modules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/modules
4412 # Emit the autoconf code for the unconditional modules.
4413 for module
in $1; do
4415 if test -n "$module"; then
4416 if func_cond_module_p
"$module"; then
4419 func_emit_autoconf_snippet
" "
4423 # Initialize the shell variables indicating that the modules are enabled.
4424 for module
in $1; do
4426 if test -n "$module"; then
4427 if func_cond_module_p
"$module"; then
4428 func_module_shellvar_name
"$module"
4429 echo " $shellvar=false"
4433 # Emit the autoconf code for the conditional modules, each in a separate
4434 # function. This makes it possible to support cycles among conditional
4436 for module
in $1; do
4438 if test -n "$module"; then
4439 if func_cond_module_p
"$module"; then
4440 func_module_shellfunc_name
"$module"
4441 func_module_shellvar_name
"$module"
4442 echo " $shellfunc ()"
4444 echo " if ! \$$shellvar; then"
4445 func_emit_autoconf_snippet
" "
4446 echo " $shellvar=true"
4447 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
4448 # Intersect $deps with the modules list $1.
4449 deps
=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
4450 for dep
in $deps; do
4451 if func_cond_module_p
"$dep"; then
4452 func_module_shellfunc_name
"$dep"
4453 func_cond_module_condition
"$module" "$dep"
4454 if test "$condition" != true
; then
4455 echo " if $condition; then"
4462 # The autoconf code for $dep has already been emitted above and
4463 # therefore is already executed when this function is run.
4472 # Emit the dependencies from the unconditional to the conditional modules.
4473 for module
in $1; do
4475 if test -n "$module"; then
4476 if func_cond_module_p
"$module"; then
4479 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
4480 # Intersect $deps with the modules list $1.
4481 deps
=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
4482 for dep
in $deps; do
4483 if func_cond_module_p
"$dep"; then
4484 func_module_shellfunc_name
"$dep"
4485 func_cond_module_condition
"$module" "$dep"
4486 if test "$condition" != true
; then
4487 echo " if $condition; then"
4494 # The autoconf code for $dep has already been emitted above and
4495 # therefore is already executed when this code is run.
4502 # Define the Automake conditionals.
4503 echo " m4_pattern_allow([^${macro_prefix}_GNULIB_ENABLED_])"
4504 for module
in $1; do
4506 if test -n "$module"; then
4507 if func_cond_module_p
"$module"; then
4508 func_module_conditional_name
"$module"
4509 func_module_shellvar_name
"$module"
4510 echo " AM_CONDITIONAL([$conditional], [\$$shellvar])"
4515 # Ignore the conditions, and enable all modules unconditionally.
4516 for module
in $1; do
4518 if test -n "$module"; then
4519 func_emit_autoconf_snippet
" "
4525 # func_emit_pre_early_macros require indentation modules
4526 # The require parameter can be ':' (AC_REQUIRE) or 'false' (direct call).
4527 func_emit_pre_early_macros
()
4530 echo "${2}# Pre-early section."
4532 _pre_early_snippet
="echo \"${2}AC_REQUIRE([\$_pre_early_macro])\""
4534 _pre_early_snippet
="echo \"${2}\$_pre_early_macro\""
4537 # We need to call gl_USE_SYSTEM_EXTENSIONS before gl_PROG_AR_RANLIB. Doing
4538 # AC_REQUIRE in configure-ac.early is not early enough.
4539 _pre_early_macro
="gl_USE_SYSTEM_EXTENSIONS"
4540 case "${nl}${3}${nl}" in
4541 *${nl}extensions
${nl}*) eval "$_pre_early_snippet" ;;
4544 _pre_early_macro
="gl_PROG_AR_RANLIB"
4545 eval "$_pre_early_snippet"
4549 # func_reconstruct_cached_dir
4550 # callback for func_reconstruct_cached_local_gnulib_path
4552 # - destdir from --dir
4554 # - local_gnulib_path restored '--local-dir' path from cache
4555 func_reconstruct_cached_dir
()
4558 if test -n "$cached_dir"; then
4561 func_path_append local_gnulib_path
"$destdir/$cached_dir" ;;
4563 case "$cached_dir" in
4565 func_path_append local_gnulib_path
"$destdir/$cached_dir" ;;
4567 func_relconcat
"$destdir" "$cached_dir"
4568 func_path_append local_gnulib_path
"$relconcat" ;;
4574 # func_reconstruct_cached_local_gnulib_path
4575 # reconstruct local_gnulib_path from cached_local_gnulib_path to be set
4576 # relatively to $destdir again.
4578 # - cached_local_gnulib_path local_gnulib_path stored within gnulib-cache.m4
4579 # - destdir from --dir
4581 # - local_gnulib_path restored '--local-dir' path from cache
4582 func_reconstruct_cached_local_gnulib_path
()
4584 func_path_foreach
"$cached_local_gnulib_path" func_reconstruct_cached_dir
%dir
%
4587 # func_import modules
4588 # Uses also the variables
4589 # - mode import or add-import or remove-import or update
4590 # - destdir target directory
4591 # - local_gnulib_path from --local-dir
4592 # - modcache true or false, from --cache-modules/--no-cache-modules
4593 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
4594 # - libname library name
4595 # - supplied_libname true if --lib was given, blank otherwise
4596 # - sourcebase directory relative to destdir where to place source code
4597 # - m4base directory relative to destdir where to place *.m4 macros
4598 # - pobase directory relative to destdir where to place *.po files
4599 # - docbase directory relative to destdir where to place doc files
4600 # - testsbase directory relative to destdir where to place unit test code
4601 # - auxdir directory relative to destdir where to place build aux files
4602 # - inctests true if --with-tests was given, false otherwise
4603 # - incobsolete true if --with-obsolete was given, blank otherwise
4604 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
4605 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
4607 # - inc_privileged_tests true if --with-privileged-tests was given, blank
4609 # - inc_unportable_tests true if --with-unportable-tests was given, blank
4611 # - inc_all_tests true if --with-all-tests was given, blank otherwise
4612 # - avoidlist list of modules to avoid, from --avoid
4613 # - cond_dependencies true if --conditional-dependencies was given, false if
4614 # --no-conditional-dependencies was given, blank otherwise
4615 # - lgpl yes or a number if library's license shall be LGPL,
4617 # - makefile_name from --makefile-name
4618 # - libtool true if --libtool was given, false if --no-libtool was
4619 # given, blank otherwise
4620 # - guessed_libtool true if the configure.ac file uses libtool, false otherwise
4621 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4622 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
4623 # - witness_c_macro from --witness-c-macro
4624 # - vc_files true if --vc-files was given, false if --no-vc-files was
4625 # given, blank otherwise
4626 # - autoconf_minversion minimum supported autoconf version
4627 # - doit : if actions shall be executed, false if only to be printed
4628 # - copymode copy mode for files in general
4629 # - lcopymode copy mode for files from local_gnulib_path
4630 # - do_copyrights true if copyright notices in files should be replaced,
4634 # Get the cached settings.
4635 # In 'import' mode, we read them only for the purpose of knowing the old
4636 # installed file list, and don't use them as defaults.
4637 cached_local_gnulib_path
=
4638 cached_specified_modules
=
4640 cached_inc_cxx_tests
=
4641 cached_inc_longrunning_tests
=
4642 cached_inc_privileged_tests
=
4643 cached_inc_unportable_tests
=
4644 cached_inc_all_tests
=
4654 cached_makefile_name
=
4655 cached_cond_dependencies
=
4657 cached_macro_prefix
=
4659 cached_witness_c_macro
=
4662 if test -f "$destdir"/$m4base/gnulib-cache.
m4; then
4663 cached_libtool
=false
4669 s,^.*gl_LOCAL_DIR([[ ]*\([^]"$`\\)]*\).*$,cached_local_gnulib_path="\1",p
4679 s,^.*gl_MODULES([[ ]*\([^]"$`\\)]*\).*$,cached_specified_modules="\1",p
4681 /gl_WITH_OBSOLETE/ {
4682 s,^.*$,cached_incobsolete=true,p
4684 /gl_WITH_CXX_TESTS/ {
4685 s,^.*$,cached_inc_cxx_tests=true,p
4687 /gl_WITH_LONGRUNNING_TESTS/ {
4688 s,^.*$,cached_inc_longrunning_tests=true,p
4690 /gl_WITH_PRIVILEGED_TESTS/ {
4691 s,^.*$,cached_inc_privileged_tests=true,p
4693 /gl_WITH_UNPORTABLE_TESTS/ {
4694 s,^.*$,cached_inc_unportable_tests=true,p
4696 /gl_WITH_ALL_TESTS/ {
4697 s,^.*$,cached_inc_all_tests=true,p
4700 s,^.*gl_AVOID([[ ]*\([^]"$`\\)]*\).*$,cached_avoidlist="\1",p
4703 s,^.*gl_SOURCE_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_sourcebase="\1",p
4706 s,^.*gl_M4_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_m4base="\1",p
4709 s,^.*gl_PO_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_pobase="\1",p
4712 s,^.*gl_DOC_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_docbase="\1",p
4715 s,^.*gl_TESTS_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_testsbase="\1",p
4718 s,^.*$,cached_inctests=true,p
4721 s,^.*gl_LIB([[ ]*\([^]"$`\\)]*\).*$,cached_libname="\1",p
4724 s,^.*gl_LGPL([[ ]*\([^]"$`\\)]*\).*$,cached_lgpl="\1",p
4727 s,^.*$,cached_lgpl=yes,p
4729 /gl_MAKEFILE_NAME(/ {
4730 s,^.*gl_MAKEFILE_NAME([[ ]*\([^]"$`\\)]*\).*$,cached_makefile_name="\1",p
4732 /gl_CONDITIONAL_DEPENDENCIES/ {
4733 s,^.*$,cached_cond_dependencies=true,p
4736 s,^.*$,cached_libtool=true,p
4738 /gl_MACRO_PREFIX(/ {
4739 s,^.*gl_MACRO_PREFIX([[ ]*\([^]"$`\\)]*\).*$,cached_macro_prefix="\1",p
4742 s,^.*gl_PO_DOMAIN([[ ]*\([^]"$`\\)]*\).*$,cached_po_domain="\1",p
4744 /gl_WITNESS_C_MACRO(/ {
4745 s,^.*gl_WITNESS_C_MACRO([[ ]*\([^]"$`\\)]*\).*$,cached_witness_c_macro="\1",p
4748 s,^.*gl_VC_FILES([[ ]*\([^]"$`\\)]*\).*$,cached_vc_files="\1",p
4750 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-cache.m4`
4751 if test -f "$destdir"/$m4base/gnulib-comp.
m4; then
4756 /AC_DEFUN(\['"${cached_macro_prefix}"'_FILE_LIST\], \[/ {
4757 s,^.*$,cached_files=",p
4770 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-comp.m4`
4774 if test "$mode" = import
; then
4775 # In 'import' mode, the new set of specified modules overrides the cached
4776 # set of modules. Ignore the cached settings.
4777 specified_modules
="$1"
4779 # Merge the cached settings with the specified ones.
4780 # The m4base must be the same as expected from the pathname.
4781 if test -n "$cached_m4base" && test "$cached_m4base" != "$m4base"; then
4782 func_fatal_error
"$m4base/gnulib-cache.m4 is expected to contain gl_M4_BASE([$m4base])"
4784 # The local_gnulib_path defaults to the cached one. Recall that the cached one
4785 # is relative to $destdir, whereas the one we use is relative to . or absolute.
4786 if test -z "$local_gnulib_path"; then
4787 func_reconstruct_cached_local_gnulib_path
4791 # Append the cached and the specified module names. So that
4792 # "gnulib-tool --add-import foo" means to add the module foo.
4793 specified_modules
="$cached_specified_modules $1"
4796 # Take the cached module names, minus the specified module names.
4798 if $have_associative; then
4799 # Use an associative array, for O(N) worst-case run time.
4800 declare -A to_remove
4802 eval 'to_remove[$m]=yes'
4804 for module
in $cached_specified_modules; do
4805 if eval 'test -z "${to_remove[$module]}"'; then
4806 func_append specified_modules
"$module "
4810 # This loop has O(N**2) worst-case run time.
4811 for module
in $cached_specified_modules; do
4814 if test "$m" = "$module"; then
4819 if test -z "$to_remove"; then
4820 func_append specified_modules
"$module "
4826 # Take the cached module names. There are no specified module names.
4827 specified_modules
="$cached_specified_modules"
4830 # Included obsolete modules among the dependencies if specified either way.
4831 if test -z "$incobsolete"; then
4832 incobsolete
="$cached_incobsolete"
4834 # Included special kinds of tests modules among the dependencies if specified
4836 if test -z "$inc_cxx_tests"; then
4837 inc_cxx_tests
="$cached_inc_cxx_tests"
4839 if test -z "$inc_longrunning_tests"; then
4840 inc_longrunning_tests
="$cached_inc_longrunning_tests"
4842 if test -z "$inc_privileged_tests"; then
4843 inc_privileged_tests
="$cached_inc_privileged_tests"
4845 if test -z "$inc_unportable_tests"; then
4846 inc_unportable_tests
="$cached_inc_unportable_tests"
4848 if test -z "$inc_all_tests"; then
4849 inc_all_tests
="$cached_inc_all_tests"
4851 # Append the cached and the specified avoidlist. This is probably better
4852 # than dropping the cached one when --avoid is specified at least once.
4853 avoidlist
=`for m in $cached_avoidlist $avoidlist; do echo $m; done | LC_ALL=C sort -u`
4854 avoidlist
=`echo $avoidlist`
4856 # The sourcebase defaults to the cached one.
4857 if test -z "$sourcebase"; then
4858 sourcebase
="$cached_sourcebase"
4859 if test -z "$sourcebase"; then
4860 func_fatal_error
"missing --source-base option"
4863 # The pobase defaults to the cached one.
4864 if test -z "$pobase"; then
4865 pobase
="$cached_pobase"
4867 # The docbase defaults to the cached one.
4868 if test -z "$docbase"; then
4869 docbase
="$cached_docbase"
4870 if test -z "$docbase"; then
4871 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."
4874 # The testsbase defaults to the cached one.
4875 if test -z "$testsbase"; then
4876 testsbase
="$cached_testsbase"
4877 if test -z "$testsbase"; then
4878 func_fatal_error
"missing --tests-base option"
4881 # Require the tests if specified either way.
4882 if ! $inctests; then
4883 inctests
="$cached_inctests"
4884 if test -z "$inctests"; then
4888 # The libname defaults to the cached one.
4889 if test -z "$supplied_libname"; then
4890 libname
="$cached_libname"
4891 if test -z "$libname"; then
4892 func_fatal_error
"missing --lib option"
4895 # Require LGPL if specified either way.
4896 if test -z "$lgpl"; then
4899 # The makefile_name defaults to the cached one.
4900 if test -z "$makefile_name"; then
4901 makefile_name
="$cached_makefile_name"
4903 # Use conditional dependencies if specified either way.
4904 if test -z "$cond_dependencies"; then
4905 cond_dependencies
="$cached_cond_dependencies"
4907 # Use libtool if specified either way, or if guessed.
4908 if test -z "$libtool"; then
4909 if test -n "$cached_m4base"; then
4910 libtool
="$cached_libtool"
4912 libtool
="$guessed_libtool"
4915 # The macro_prefix defaults to the cached one.
4916 if test -z "$macro_prefix"; then
4917 macro_prefix
="$cached_macro_prefix"
4918 if test -z "$macro_prefix"; then
4919 func_fatal_error
"missing --macro-prefix option"
4922 # The po_domain defaults to the cached one.
4923 if test -z "$po_domain"; then
4924 po_domain
="$cached_po_domain"
4926 # The witness_c_macro defaults to the cached one.
4927 if test -z "$witness_c_macro"; then
4928 witness_c_macro
="$cached_witness_c_macro"
4930 # The vc_files defaults to the cached one.
4931 if test -z "$vc_files"; then
4932 vc_files
="$cached_vc_files"
4934 # Ensure constraints.
4935 if test "$cond_dependencies" = true
&& $inctests; then
4936 echo "gnulib-tool: option --conditional-dependencies is not supported with --with-tests" 1>&2
4940 # --without-*-tests options are not supported here.
4942 excl_longrunning_tests
=
4943 excl_privileged_tests
=
4944 excl_unportable_tests
=
4946 # Canonicalize the list of specified modules.
4947 specified_modules
=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
4949 # Include all kinds of tests modules if --with-all-tests was specified.
4950 inc_all_direct_tests
="$inc_all_tests"
4951 inc_all_indirect_tests
="$inc_all_tests"
4953 # Determine final module list.
4954 modules
="$specified_modules"
4955 func_modules_transitive_closure
4956 if test $verbose -ge 0; then
4957 func_show_module_list
4959 final_modules
="$modules"
4961 # Determine main module list and tests-related module list separately.
4962 func_modules_transitive_closure_separately
4964 # Determine whether a $testsbase/libtests.a is needed.
4965 func_determine_use_libtests
4967 # Add the dummy module to the main module list or to the tests-related module
4969 func_modules_add_dummy_separately
4971 # If --lgpl, verify that the licenses of modules are compatible.
4972 if test -n "$lgpl"; then
4973 license_incompatibilities
=
4974 for module
in $main_modules; do
4975 license
=`func_get_license $module`
4977 'GPLed build tool') ;;
4978 'public domain' |
'unlimited' |
'unmodifiable license text') ;;
4983 LGPLv2
+ |
'LGPLv3+ or GPLv2' | LGPLv3
+ | LGPL
) ;;
4984 *) func_append license_incompatibilities
"$module $license$nl" ;;
4989 LGPLv2
+ |
'LGPLv3+ or GPLv2') ;;
4990 *) func_append license_incompatibilities
"$module $license$nl" ;;
4996 *) func_append license_incompatibilities
"$module $license$nl" ;;
4999 *) func_fatal_error
"invalid value lgpl=$lgpl" ;;
5004 if test -n "$license_incompatibilities"; then
5005 # Format the license incompatibilities as a table.
5006 sed_expand_column1_width50_indent17
='s,^\([^ ]*\) ,\1 ,
5007 s,^\(.................................................[^ ]*\) *, \1 ,'
5008 license_incompatibilities
=`echo "$license_incompatibilities" | sed -e "$sed_expand_column1_width50_indent17"`
5009 func_fatal_error
"incompatible license on modules:$nl$license_incompatibilities"
5013 # Show banner notice of every module.
5014 modules
="$main_modules"
5017 # Determine script to apply to imported library files.
5018 sed_transform_lib_file
=
5019 for module
in $main_modules; do
5020 if test $module = config-h
; then
5021 # Assume config.h exists, and that -DHAVE_CONFIG_H is omitted.
5022 sed_transform_lib_file
=$sed_transform_lib_file'
5023 s/^#ifdef[ ]*HAVE_CONFIG_H[ ]*$/#if 1/
5028 sed_transform_main_lib_file
="$sed_transform_lib_file"
5029 if test -n "$do_copyrights"; then
5030 if test -n "$lgpl"; then
5034 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
5035 s/GNU General/GNU Lesser General/g
5036 s/General Public License/Lesser General Public License/g
5037 s/Lesser Lesser General Public License/Lesser General Public License/g
5041 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
5042 /^ *This program is free software/i\
5043 This program is free software: you can redistribute it and\/or\
5044 modify it under the terms of either:\
5046 * the GNU Lesser General Public License as published by the Free\
5047 Software Foundation; either version 3 of the License, or (at your\
5048 option) any later version.\
5052 * the GNU General Public License as published by the Free\
5053 Software Foundation; either version 2 of the License, or (at your\
5054 option) any later version.\
5056 or both in parallel, as here.
5057 /^ *This program is free software/,/^$/d
5061 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
5062 s/GNU General/GNU Lesser General/g
5063 s/General Public License/Lesser General Public License/g
5064 s/Lesser Lesser General Public License/Lesser General Public License/g
5066 s/version [23]\([ ,]\)/version 2.1\1/g
5069 *) func_fatal_error
"invalid value lgpl=$lgpl" ;;
5073 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
5074 s/GNU Lesser General/GNU General/g
5075 s/Lesser General Public License/General Public License/g
5077 s/GNU Library General/GNU General/g
5078 s/Library General Public License/General Public License/g
5080 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
5085 # Determine script to apply to auxiliary files that go into $auxdir/.
5086 sed_transform_build_aux_file
=
5087 if test -n "$do_copyrights"; then
5089 sed_transform_build_aux_file
=$sed_transform_build_aux_file'
5090 s/GNU Lesser General/GNU General/g
5091 s/Lesser General Public License/General Public License/g
5093 s/GNU Library General/GNU General/g
5094 s/Library General Public License/General Public License/g
5096 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
5100 # Determine script to apply to library files that go into $testsbase/.
5101 sed_transform_testsrelated_lib_file
="$sed_transform_lib_file"
5102 if test -n "$do_copyrights"; then
5104 sed_transform_testsrelated_lib_file
=$sed_transform_testsrelated_lib_file'
5105 s/GNU Lesser General/GNU General/g
5106 s/Lesser General Public License/General Public License/g
5108 s/GNU Library General/GNU General/g
5109 s/Library General Public License/General Public License/g
5111 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
5115 # Determine the final file lists.
5116 func_modules_to_filelist_separately
5119 || func_fatal_error
"refusing to do nothing"
5121 # Add m4/gnulib-tool.m4 to the file list. It is not part of any module.
5122 new_files
="$files m4/gnulib-tool.m4"
5123 old_files
="$cached_files"
5124 if test -f "$destdir"/$m4base/gnulib-tool.
m4; then
5125 func_append old_files
" m4/gnulib-tool.m4"
5128 rewritten
='%REWRITTEN%'
5129 sed_rewrite_old_files
="\
5130 s,^build-aux/,$rewritten$auxdir/,
5131 s,^doc/,$rewritten$cached_docbase/,
5132 s,^lib/,$rewritten$cached_sourcebase/,
5133 s,^m4/,$rewritten$cached_m4base/,
5134 s,^tests/,$rewritten$cached_testsbase/,
5135 s,^tests=lib/,$rewritten$cached_testsbase/,
5138 sed_rewrite_new_files
="\
5139 s,^build-aux/,$rewritten$auxdir/,
5140 s,^doc/,$rewritten$docbase/,
5141 s,^lib/,$rewritten$sourcebase/,
5142 s,^m4/,$rewritten$m4base/,
5143 s,^tests/,$rewritten$testsbase/,
5144 s,^tests=lib/,$rewritten$testsbase/,
5148 # Determine whether to put anything into $testsbase.
5149 testsfiles
=`echo "$files" | sed -n -e 's,^tests/,,p' -e 's,^tests=lib/,,p'`
5150 if test -n "$testsfiles"; then
5156 # Create directories.
5157 { echo "$sourcebase"
5159 if test -n "$pobase"; then
5162 docfiles
=`echo "$files" | sed -n -e 's,^doc/,,p'`
5163 if test -n "$docfiles"; then
5170 for f
in $files; do echo $f; done \
5171 |
sed -e "$sed_rewrite_new_files" \
5172 |
sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
5175 { # Rearrange file descriptors. Needed because "while ... done < ..."
5176 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5177 exec 5<&0 < "$tmp"/dirs
5179 if test ! -d "$destdir/$d"; then
5181 echo "Creating directory $destdir/$d"
5182 mkdir
-p "$destdir/$d" || func_fatal_error
"failed"
5184 echo "Create directory $destdir/$d"
5191 # Copy files or make symbolic links or hard links. Remove obsolete files.
5195 # Construct a table with 2 columns: rewritten-file-name original-file-name,
5196 # representing the files according to the last gnulib-tool invocation.
5197 for f
in $old_files; do echo $f; done \
5198 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_old_files" \
5201 # Construct a table with 2 columns: rewritten-file-name original-file-name,
5202 # representing the files after this gnulib-tool invocation.
5203 for f
in $new_files; do echo $f; done \
5204 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" \
5207 # First the files that are in old-files, but not in new-files:
5208 sed_take_first_column
='s,'"$delimiter"'.*,,'
5209 for g
in `LC_ALL=C join -t"$delimiter" -v1 "$tmp"/old-files "$tmp"/new-files | sed -e "$sed_take_first_column"`; do
5210 # Remove the file. Do nothing if the user already removed it.
5211 if test -f "$destdir/$g" ||
test -h "$destdir/$g"; then
5213 echo "Removing file $g (backup in ${g}~)"
5214 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error
"failed"
5216 echo "Remove file $g (backup in ${g}~)"
5218 func_append removed_files
"$g$nl"
5221 # func_add_or_update handles a file that ought to be present afterwards.
5223 # - f the original file name
5224 # - g the rewritten file name
5225 # - already_present nonempty if the file should already exist, empty
5227 func_add_or_update
()
5231 tests
=lib
/*) f
=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
5233 func_dest_tmpfilename
"$g"
5234 func_lookup_file
"$f"
5235 cp "$lookedup_file" "$tmpfile" || func_fatal_error
"failed"
5236 func_ensure_writable
"$tmpfile"
5239 # Don't process binary files with sed.
5242 if test -n "$sed_transform_main_lib_file"; then
5245 sed -e "$sed_transform_main_lib_file" \
5246 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
5250 if test -n "$sed_transform_build_aux_file"; then
5253 sed -e "$sed_transform_build_aux_file" \
5254 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
5258 if test -n "$sed_transform_testsrelated_lib_file"; then
5261 sed -e "$sed_transform_testsrelated_lib_file" \
5262 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
5268 if test -f "$destdir/$g"; then
5269 # The file already exists.
5273 # Don't protest if the file should be there but isn't: it happens
5274 # frequently that developers don't put autogenerated files under version control.
5276 func_append added_files
"$g$nl"
5280 # Then the files that are in new-files, but not in old-files:
5281 sed_take_last_column
='s,^.*'"$delimiter"',,'
5283 LC_ALL
=C
join -t"$delimiter" -v2 "$tmp"/old-files
"$tmp"/new-files \
5284 |
sed -e "$sed_take_last_column" \
5285 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/added-files
5286 { # Rearrange file descriptors. Needed because "while ... done < ..."
5287 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5288 exec 5<&0 < "$tmp"/added-files
5294 # Then the files that are in new-files and in old-files:
5295 already_present
=true
5296 LC_ALL
=C
join -t"$delimiter" "$tmp"/old-files
"$tmp"/new-files \
5297 |
sed -e "$sed_take_last_column" \
5298 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/kept-files
5299 { # Rearrange file descriptors. Needed because "while ... done < ..."
5300 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5301 exec 5<&0 < "$tmp"/kept-files
5308 # Command-line invocation printed in a comment in generated gnulib-cache.m4.
5309 actioncmd
="# gnulib-tool --import"
5312 func_append_local_dir
()
5314 func_append
"$1" " --local-dir=$2"
5316 func_path_foreach
"$local_gnulib_path" func_append_local_dir actioncmd
%dir
%
5318 # Break the action command log into multiple lines.
5319 # Emacs puts some gnulib-tool log lines in its source repository, and
5320 # git send-email rejects patch lines longer than 998 characters.
5321 # Also, config.status uses awk, and the HP-UX 11.00 awk fails if a
5322 # line has length >= 3071; similarly, the IRIX 6.5 awk fails if a
5323 # line has length >= 3072.
5324 func_append_actionarg
()
5326 func_append actioncmd
" \\$nl# $1"
5328 func_append_actionarg
"--lib=$libname"
5329 func_append_actionarg
"--source-base=$sourcebase"
5330 func_append_actionarg
"--m4-base=$m4base"
5331 if test -n "$pobase"; then
5332 func_append_actionarg
"--po-base=$pobase"
5334 func_append_actionarg
"--doc-base=$docbase"
5335 func_append_actionarg
"--tests-base=$testsbase"
5336 func_append_actionarg
"--aux-dir=$auxdir"
5338 func_append_actionarg
"--with-tests"
5340 if test -n "$incobsolete"; then
5341 func_append_actionarg
"--with-obsolete"
5343 if test -n "$inc_cxx_tests"; then
5344 func_append_actionarg
"--with-c++-tests"
5346 if test -n "$inc_longrunning_tests"; then
5347 func_append_actionarg
"--with-longrunning-tests"
5349 if test -n "$inc_privileged_tests"; then
5350 func_append_actionarg
"--with-privileged-tests"
5352 if test -n "$inc_unportable_tests"; then
5353 func_append_actionarg
"--with-unportable-tests"
5355 if test -n "$inc_all_tests"; then
5356 func_append_actionarg
"--with-all-tests"
5358 if test -n "$lgpl"; then
5359 if test "$lgpl" = yes; then
5360 func_append_actionarg
"--lgpl"
5362 func_append_actionarg
"--lgpl=$lgpl"
5366 func_append_actionarg
"--gnu-make"
5368 if test -n "$makefile_name"; then
5369 func_append_actionarg
"--makefile-name=$makefile_name"
5371 if test "$cond_dependencies" = true
; then
5372 func_append_actionarg
"--conditional-dependencies"
5374 func_append_actionarg
"--no-conditional-dependencies"
5376 if test "$libtool" = true
; then
5377 func_append_actionarg
"--libtool"
5379 func_append_actionarg
"--no-libtool"
5381 func_append_actionarg
"--macro-prefix=$macro_prefix"
5382 if test -n "$po_domain"; then
5383 func_append_actionarg
"--po-domain=$po_domain"
5385 if test -n "$witness_c_macro"; then
5386 func_append_actionarg
"--witness-c-macro=$witness_c_macro"
5388 if test -n "$vc_files"; then
5389 if test "$vc_files" = true
; then
5390 func_append_actionarg
"--vc-files"
5392 func_append_actionarg
"--no-vc-files"
5395 for module
in $avoidlist; do
5396 func_append_actionarg
"--avoid=$module"
5398 for module
in $specified_modules; do
5399 func_append_actionarg
"$module"
5402 # Determine include_guard_prefix.
5403 func_compute_include_guard_prefix
5405 # Default the makefile name to Makefile.am.
5406 if test -n "$makefile_name"; then
5407 makefile_am
=$makefile_name
5409 makefile_am
=Makefile.am
5412 # Create normal Makefile.ams.
5415 # Setup list of Makefile.am edits that are to be performed afterwards.
5416 # Some of these edits apply to files that we will generate; others are
5417 # under the responsibility of the developer.
5419 # func_note_Makefile_am_edit dir var value [dotfirst]
5420 # remembers that ${dir}Makefile.am needs to be edited to that ${var} mentions
5422 # If ${dotfirst} is non-empty, this mention needs to be present after '.'.
5423 # This is a special hack for the SUBDIRS variable, cf.
5424 # <https://www.gnu.org/software/automake/manual/html_node/Subdirectories.html>.
5425 func_note_Makefile_am_edit
()
5427 makefile_am_edits
=`expr $makefile_am_edits + 1`
5428 eval makefile_am_edit
${makefile_am_edits}_dir
=\"\
$1\"
5429 eval makefile_am_edit
${makefile_am_edits}_var
=\"\
$2\"
5430 eval makefile_am_edit
${makefile_am_edits}_val
=\"\
$3\"
5431 eval makefile_am_edit
${makefile_am_edits}_dotfirst
=\"\
$4\"
5433 if test "$makefile_am" = Makefile.am
; then
5434 sourcebase_dir
=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'`
5435 sourcebase_base
=`basename "$sourcebase"`
5436 func_note_Makefile_am_edit
"$sourcebase_dir" SUBDIRS
"$sourcebase_base"
5438 if test -n "$pobase"; then
5439 pobase_dir
=`echo "$pobase" | sed -n -e 's,/[^/]*$,/,p'`
5440 pobase_base
=`basename "$pobase"`
5441 func_note_Makefile_am_edit
"$pobase_dir" SUBDIRS
"$pobase_base"
5444 if test "$makefile_am" = Makefile.am
; then
5445 testsbase_dir
=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'`
5446 testsbase_base
=`basename "$testsbase"`
5447 func_note_Makefile_am_edit
"$testsbase_dir" SUBDIRS
"$testsbase_base" true
5450 func_note_Makefile_am_edit
"" ACLOCAL_AMFLAGS
"-I ${m4base}"
5452 # Find the first parent directory of $m4base that contains or will contain
5454 sed_last
='s,^.*/\([^/][^/]*\)//*$,\1/,
5456 sed_butlast
='s,[^/][^/]*//*$,,'
5457 dir1
="${m4base}/"; dir2
=""
5458 while test -n "$dir1" \
5459 && ! { test -f "${destdir}/${dir1}Makefile.am" \
5460 ||
test "${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
5461 ||
test "./${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
5463 && { test "${dir1}Makefile.am" = "$testsbase/$makefile_am" \
5464 ||
test "./${dir1}Makefile.am" = "$testsbase/$makefile_am"; }; }; }; do
5465 dir2
=`echo "$dir1" | sed -e "$sed_last"`"$dir2"
5466 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
5468 func_note_Makefile_am_edit
"$dir1" EXTRA_DIST
"${dir2}gnulib-cache.m4"
5471 # Create library makefile.
5472 func_dest_tmpfilename
$sourcebase/$makefile_am
5473 destfile
="$sourcebase/$makefile_am"
5474 modules
="$main_modules"
5475 func_emit_lib_Makefile_am
> "$tmpfile"
5476 if test -f "$destdir"/$sourcebase/$makefile_am; then
5477 if cmp -s "$destdir"/$sourcebase/$makefile_am "$tmpfile"; then
5481 echo "Updating $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
5482 mv -f "$destdir"/$sourcebase/$makefile_am "$destdir"/$sourcebase/$makefile_am~
5483 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
5485 echo "Update $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
5491 echo "Creating $sourcebase/$makefile_am"
5492 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
5494 echo "Create $sourcebase/$makefile_am"
5497 func_append added_files
"$sourcebase/$makefile_am$nl"
5500 # Create po/ directory.
5501 if test -n "$pobase"; then
5502 # Create po makefile and auxiliary files.
5503 for file in Makefile.
in.
in remove-potcdate.sin
; do
5504 func_dest_tmpfilename
$pobase/$file
5505 func_lookup_file build-aux
/po
/$file
5506 cat "$lookedup_file" > "$tmpfile"
5507 if test -f "$destdir"/$pobase/$file; then
5508 if cmp -s "$destdir"/$pobase/$file "$tmpfile"; then
5512 echo "Updating $pobase/$file (backup in $pobase/$file~)"
5513 mv -f "$destdir"/$pobase/$file "$destdir"/$pobase/$file~
5514 mv -f "$tmpfile" "$destdir"/$pobase/$file
5516 echo "Update $pobase/$file (backup in $pobase/$file~)"
5522 echo "Creating $pobase/$file"
5523 mv -f "$tmpfile" "$destdir"/$pobase/$file
5525 echo "Create $pobase/$file"
5528 func_append added_files
"$pobase/$file$nl"
5531 # Create po makefile parameterization, part 1.
5532 func_dest_tmpfilename
$pobase/Makevars
5533 func_emit_po_Makevars
> "$tmpfile"
5534 if test -f "$destdir"/$pobase/Makevars
; then
5535 if cmp -s "$destdir"/$pobase/Makevars
"$tmpfile"; then
5539 echo "Updating $pobase/Makevars (backup in $pobase/Makevars~)"
5540 mv -f "$destdir"/$pobase/Makevars
"$destdir"/$pobase/Makevars~
5541 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
5543 echo "Update $pobase/Makevars (backup in $pobase/Makevars~)"
5549 echo "Creating $pobase/Makevars"
5550 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
5552 echo "Create $pobase/Makevars"
5555 func_append added_files
"$pobase/Makevars$nl"
5557 # Create po makefile parameterization, part 2.
5558 func_dest_tmpfilename
$pobase/POTFILES.
in
5559 func_emit_po_POTFILES_in
> "$tmpfile"
5560 if test -f "$destdir"/$pobase/POTFILES.
in; then
5561 if cmp -s "$destdir"/$pobase/POTFILES.
in "$tmpfile"; then
5565 echo "Updating $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
5566 mv -f "$destdir"/$pobase/POTFILES.
in "$destdir"/$pobase/POTFILES.
in~
5567 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.
in
5569 echo "Update $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
5575 echo "Creating $pobase/POTFILES.in"
5576 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.
in
5578 echo "Create $pobase/POTFILES.in"
5581 func_append added_files
"$pobase/POTFILES.in$nl"
5584 TP_URL
="https://translationproject.org/latest/"
5586 echo "Fetching gnulib PO files from $TP_URL"
5587 (cd "$destdir"/$pobase \
5588 && wget
--no-verbose --mirror --level=1 -nd -A.po
-P .
"${TP_URL}gnulib/"
5591 echo "Fetch gnulib PO files from $TP_URL"
5593 # Create po/LINGUAS.
5595 func_dest_tmpfilename
$pobase/LINGUAS
5596 (cd "$destdir"/$pobase \
5597 && { echo '# Set of available languages.'
5598 LC_ALL
=C
ls -1 *.po |
sed -e 's,\.po$,,'
5601 if test -f "$destdir"/$pobase/LINGUAS
; then
5602 if cmp -s "$destdir"/$pobase/LINGUAS
"$tmpfile"; then
5605 echo "Updating $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
5606 mv -f "$destdir"/$pobase/LINGUAS
"$destdir"/$pobase/LINGUAS~
5607 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
5610 echo "Creating $pobase/LINGUAS"
5611 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
5612 func_append added_files
"$pobase/LINGUAS$nl"
5615 if test -f "$destdir"/$pobase/LINGUAS
; then
5616 echo "Update $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
5618 echo "Create $pobase/LINGUAS"
5623 # func_count_relative_local_gnulib_path
5624 # gl_LOCAL_DIR requires local_gnulib_path to be set relatively to destdir
5626 # - local_gnulib_path from --local-dir
5627 # - destdir from --dir
5629 # - relative_local_dir path to be stored into gl_LOCAL_DIR
5630 func_count_relative_local_gnulib_path
()
5632 relative_local_gnulib_path
=
5634 IFS
="$PATH_SEPARATOR"
5635 for local_dir
in $local_gnulib_path
5638 # Store the local_dir relative to destdir.
5639 case "$local_dir" in
5641 relative_local_dir
="$local_dir" ;;
5644 /*) relative_local_dir
="$local_dir" ;;
5646 # destdir, local_dir are both relative.
5647 func_relativize
"$destdir" "$local_dir"
5648 relative_local_dir
="$reldir" ;;
5651 func_path_append relative_local_gnulib_path
"$relative_local_dir"
5656 # Create m4/gnulib-cache.m4.
5657 func_dest_tmpfilename
$m4base/gnulib-cache.
m4
5659 func_emit_copyright_notice
5661 echo "# This file represents the specification of how gnulib-tool is used."
5662 echo "# It acts as a cache: It is written and read by gnulib-tool."
5663 echo "# In projects that use version control, this file is meant to be put under"
5664 echo "# version control, like the configure.ac and various Makefile.am files."
5667 echo "# Specification in the form of a command-line invocation:"
5668 printf '%s\n' "$actioncmd"
5670 echo "# Specification in the form of a few gnulib-tool.m4 macro invocations:"
5671 func_count_relative_local_gnulib_path
5672 echo "gl_LOCAL_DIR([$relative_local_gnulib_path])"
5674 echo "$specified_modules" |
sed -e 's/^/ /g'
5676 test -z "$incobsolete" ||
echo "gl_WITH_OBSOLETE"
5677 test -z "$inc_cxx_tests" ||
echo "gl_WITH_CXX_TESTS"
5678 test -z "$inc_longrunning_tests" ||
echo "gl_WITH_LONGRUNNING_TESTS"
5679 test -z "$inc_privileged_tests" ||
echo "gl_WITH_PRIVILEGED_TESTS"
5680 test -z "$inc_unportable_tests" ||
echo "gl_WITH_UNPORTABLE_TESTS"
5681 test -z "$inc_all_tests" ||
echo "gl_WITH_ALL_TESTS"
5682 echo "gl_AVOID([$avoidlist])"
5683 echo "gl_SOURCE_BASE([$sourcebase])"
5684 echo "gl_M4_BASE([$m4base])"
5685 echo "gl_PO_BASE([$pobase])"
5686 echo "gl_DOC_BASE([$docbase])"
5687 echo "gl_TESTS_BASE([$testsbase])"
5689 echo "gl_WITH_TESTS"
5691 echo "gl_LIB([$libname])"
5692 if test -n "$lgpl"; then
5693 if test "$lgpl" = yes; then
5696 echo "gl_LGPL([$lgpl])"
5699 echo "gl_MAKEFILE_NAME([$makefile_name])"
5700 if test "$cond_dependencies" = true
; then
5701 echo "gl_CONDITIONAL_DEPENDENCIES"
5703 if test "$libtool" = true
; then
5706 echo "gl_MACRO_PREFIX([$macro_prefix])"
5707 echo "gl_PO_DOMAIN([$po_domain])"
5708 echo "gl_WITNESS_C_MACRO([$witness_c_macro])"
5709 if test -n "$vc_files"; then
5710 echo "gl_VC_FILES([$vc_files])"
5713 if test -f "$destdir"/$m4base/gnulib-cache.
m4; then
5714 if cmp -s "$destdir"/$m4base/gnulib-cache.
m4 "$tmpfile"; then
5718 echo "Updating $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
5719 mv -f "$destdir"/$m4base/gnulib-cache.
m4 "$destdir"/$m4base/gnulib-cache.
m4~
5720 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.
m4
5722 echo "Update $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
5726 echo "# gnulib-cache.m4 ends here"
5733 echo "Creating $m4base/gnulib-cache.m4"
5734 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.
m4
5736 echo "Create $m4base/gnulib-cache.m4"
5742 # Create m4/gnulib-comp.m4.
5743 func_dest_tmpfilename
$m4base/gnulib-comp.
m4
5745 echo "# DO NOT EDIT! GENERATED AUTOMATICALLY!"
5746 func_emit_copyright_notice
5748 echo "# This file represents the compiled summary of the specification in"
5749 echo "# gnulib-cache.m4. It lists the computed macro invocations that need"
5750 echo "# to be invoked from configure.ac."
5751 echo "# In projects that use version control, this file can be treated like"
5752 echo "# other built files."
5755 echo "# This macro should be invoked from $configure_ac, in the section"
5756 echo "# \"Checks for programs\", right after AC_PROG_CC, and certainly before"
5757 echo "# any checks for libraries, header files, types and library functions."
5758 echo "AC_DEFUN([${macro_prefix}_EARLY],"
5760 echo " m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
5761 echo " m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
5762 echo " m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
5763 echo " m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
5765 func_emit_pre_early_macros
: ' ' "$final_modules"
5767 if ! $gnu_make && test -n "$uses_subdirs"; then
5768 echo " AC_REQUIRE([AM_PROG_CC_C_O])"
5770 for module
in $final_modules; do
5772 if test -n "$module"; then
5773 echo "# Code from module $module:"
5774 func_get_autoconf_early_snippet
"$module"
5777 |
sed -e '/^$/d;' -e 's/^/ /'
5780 echo "# This macro should be invoked from $configure_ac, in the section"
5781 echo "# \"Check for header files, types and library functions\"."
5782 echo "AC_DEFUN([${macro_prefix}_INIT],"
5784 if test "$libtool" = true
; then
5785 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
5786 echo " gl_cond_libtool=true"
5788 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
5789 echo " gl_cond_libtool=false"
5791 echo " gl_ltlibdeps="
5793 if test "$auxdir" != "build-aux"; then
5794 sed_replace_build_aux
='
5796 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
5797 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
5801 sed_replace_build_aux
="$sed_noop"
5803 echo " gl_m4_base='$m4base'"
5804 func_emit_initmacro_start
$macro_prefix
5805 echo " gl_source_base='$sourcebase'"
5806 if test -n "$witness_c_macro"; then
5807 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$witness_c_macro])"
5809 func_emit_autoconf_snippets
"$main_modules" "$main_modules" func_verify_module true false true
5810 if test -n "$witness_c_macro"; then
5811 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
5813 echo " # End of code from modules"
5814 func_emit_initmacro_end
$macro_prefix
5815 echo " gltests_libdeps="
5816 echo " gltests_ltlibdeps="
5817 func_emit_initmacro_start
${macro_prefix}tests
5818 echo " gl_source_base='$testsbase'"
5819 # Define a tests witness macro that depends on the package.
5820 # PACKAGE is defined by AM_INIT_AUTOMAKE, PACKAGE_TARNAME is defined by AC_INIT.
5821 # See <https://lists.gnu.org/r/automake/2009-05/msg00145.html>.
5822 echo "changequote(,)dnl"
5823 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"
5824 echo "changequote([, ])dnl"
5825 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
5826 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
5827 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
5828 func_emit_autoconf_snippets
"$testsrelated_modules" "$main_modules $testsrelated_modules" func_verify_module true true true
5829 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
5830 func_emit_initmacro_end
${macro_prefix}tests
5831 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
5832 # created using libtool, because libtool already handles the dependencies.
5833 if test "$libtool" != true
; then
5834 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
5835 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
5836 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
5837 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
5838 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
5840 if $use_libtests; then
5841 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
5842 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
5845 func_emit_initmacro_done
$macro_prefix $sourcebase
5846 func_emit_initmacro_done
${macro_prefix}tests
$testsbase
5848 echo "# This macro records the list of files which have been installed by"
5849 echo "# gnulib-tool and may be removed by future gnulib-tool invocations."
5850 echo "AC_DEFUN([${macro_prefix}_FILE_LIST], ["
5851 echo "$files" |
sed -e 's,^, ,'
5854 if test -f "$destdir"/$m4base/gnulib-comp.
m4; then
5855 if cmp -s "$destdir"/$m4base/gnulib-comp.
m4 "$tmpfile"; then
5859 echo "Updating $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
5860 mv -f "$destdir"/$m4base/gnulib-comp.
m4 "$destdir"/$m4base/gnulib-comp.
m4~
5861 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.
m4
5863 echo "Update $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
5867 echo "# gnulib-comp.m4 ends here"
5874 echo "Creating $m4base/gnulib-comp.m4"
5875 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.
m4
5877 echo "Create $m4base/gnulib-comp.m4"
5884 # Create tests makefile.
5885 func_dest_tmpfilename
$testsbase/$makefile_am
5886 destfile
="$testsbase/$makefile_am"
5887 modules
="$testsrelated_modules"
5888 func_emit_tests_Makefile_am
"${macro_prefix}tests_WITNESS" > "$tmpfile"
5889 if test -f "$destdir"/$testsbase/$makefile_am; then
5890 if cmp -s "$destdir"/$testsbase/$makefile_am "$tmpfile"; then
5894 echo "Updating $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
5895 mv -f "$destdir"/$testsbase/$makefile_am "$destdir"/$testsbase/$makefile_am~
5896 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
5898 echo "Update $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
5904 echo "Creating $testsbase/$makefile_am"
5905 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
5907 echo "Create $testsbase/$makefile_am"
5910 func_append added_files
"$testsbase/$makefile_am$nl"
5914 if test "$vc_files" != false
; then
5915 # Update the .cvsignore and .gitignore files.
5916 { echo "$added_files" |
sed -e '/^$/d' -e 's,\([^/]*\)$,|A|\1,'
5917 echo "$removed_files" |
sed -e '/^$/d' -e 's,\([^/]*\)$,|R|\1,'
5918 # Treat gnulib-comp.m4 like an added file, even if it already existed.
5919 echo "$m4base/|A|gnulib-comp.m4"
5920 } | LC_ALL
=C
sort -t'|' -k1,1 > "$tmp"/fileset-changes
5921 { # Rearrange file descriptors. Needed because "while ... done < ..."
5922 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5923 exec 5<&0 < "$tmp"/fileset-changes
5924 func_update_ignorelist
()
5927 if test "$ignore" = .gitignore
; then
5928 # In a .gitignore file, "foo" applies to the current directory and all
5929 # subdirectories, whereas "/foo" applies to the current directory only.
5932 doubly_escaped_anchor
='\\/'
5936 doubly_escaped_anchor
=''
5938 if test -f "$destdir/$dir$ignore"; then
5939 if test -n "$dir_added" ||
test -n "$dir_removed"; then
5940 sed -e "s|^$anchor||" < "$destdir/$dir$ignore" | LC_ALL
=C
sort > "$tmp"/ignore
5941 (echo "$dir_added" |
sed -e '/^$/d' | LC_ALL
=C
sort -u \
5942 | LC_ALL
=C
join -v 1 - "$tmp"/ignore
> "$tmp"/ignore-added
5943 echo "$dir_removed" |
sed -e '/^$/d' | LC_ALL
=C
sort -u \
5944 > "$tmp"/ignore-removed
5946 if test -s "$tmp"/ignore-added ||
test -s "$tmp"/ignore-removed
; then
5948 echo "Updating $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
5949 mv -f "$destdir/$dir$ignore" "$destdir/$dir$ignore"~
5950 { sed -e 's,/,\\/,g' -e 's,^,/^,' -e 's,$,\$/d,' < "$tmp"/ignore-removed
5951 if test -n "$anchor"; then sed -e 's,/,\\/,g' -e "s,^,/^${doubly_escaped_anchor}," -e 's,$,$/d,' < "$tmp"/ignore-removed
; fi
5952 } > "$tmp"/sed-ignore-removed
5953 { cat "$destdir/$dir$ignore"~
5954 sed -e "s|^|$anchor|" < "$tmp"/ignore-added
5955 } |
sed -f "$tmp"/sed-ignore-removed \
5956 > "$destdir/$dir$ignore"
5958 echo "Update $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
5963 if test -n "$dir_added"; then
5965 echo "Creating $destdir/$dir$ignore"
5967 if test "$ignore" = .cvsignore
; then
5969 # Automake generates Makefile rules that create .dirstamp files.
5972 echo "$dir_added" |
sed -e '/^$/d' -e "s|^|$anchor|" | LC_ALL
=C
sort -u
5973 } > "$destdir/$dir$ignore"
5975 echo "Create $destdir/$dir$ignore"
5985 if test -d "$destdir/CVS" ||
test -d "$destdir/${dir}CVS" ||
test -f "$destdir/${dir}.cvsignore"; then
5986 func_update_ignorelist .cvsignore
5988 if test -d "$destdir/.git" ||
test -f "$destdir/${dir}.gitignore"; then
5989 func_update_ignorelist .gitignore
5996 # Why not ''read next_dir op file'' ? Because the dir column can be empty.
5997 next_dir
=`echo "$line" | sed -e 's,|.*,,'`
5998 op
=`echo "$line" | sed -e 's,^[^|]*|\([^|]*\)|.*$,\1,'`
5999 file=`echo "$line" | sed -e 's,^[^|]*|[^|]*|,,'`
6000 if test "$next_dir" != "$last_dir"; then
6001 func_done_dir
"$last_dir" "$last_dir_added" "$last_dir_removed"
6002 last_dir
="$next_dir"
6007 A
) func_append last_dir_added
"$file$nl";;
6008 R
) func_append last_dir_removed
"$file$nl";;
6011 func_done_dir
"$last_dir" "$last_dir_added" "$last_dir_removed"
6018 echo "You may need to add #include directives for the following .h files."
6019 # Intersect $specified_modules and $main_modules
6020 # (since $specified_modules is not necessarily of subset of $main_modules
6021 # - some may have been skipped through --avoid, and since the elements of
6022 # $main_modules but not in $specified_modules can go away without explicit
6023 # notice - through changes in the module dependencies).
6024 echo "$specified_modules" > "$tmp"/modules1
# a sorted list, one module per line
6025 echo "$main_modules" > "$tmp"/modules2
# also a sorted list, one module per line
6026 # First the #include <...> directives without #ifs, sorted for convenience,
6027 # then the #include "..." directives without #ifs, sorted for convenience,
6028 # then the #include directives that are surrounded by #ifs. Not sorted.
6029 for module
in `LC_ALL=C join "$tmp"/modules1 "$tmp"/modules2`; do
6030 include_directive
=`func_get_include_directive "$module"`
6031 case "$nl$include_directive" in
6033 echo "$include_directive" 1>&5
6036 echo "$include_directive" |
grep -v 'include "' 1>&6
6037 echo "$include_directive" |
grep 'include "' 1>&7
6040 done 5> "$tmp"/include-if
6> "$tmp"/include-angles
7> "$tmp"/include-quotes
6042 LC_ALL
=C
sort -u "$tmp"/include-angles
6043 LC_ALL
=C
sort -u "$tmp"/include-quotes
6044 cat "$tmp"/include-if
6045 ) |
sed -e '/^$/d' -e 's/^/ /'
6046 rm -f "$tmp"/include-angles
"$tmp"/include-quotes
"$tmp"/include-if
6048 for module
in $main_modules; do
6049 func_get_link_directive
"$module"
6051 | LC_ALL
=C
sort -u |
sed -e '/^$/d' -e 's/^/ /' > "$tmp"/link
6052 if test `wc -l < "$tmp"/link` != 0; then
6054 echo "You may need to use the following Makefile variables when linking."
6055 echo "Use them in <program>_LDADD when linking a program, or"
6056 echo "in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library."
6062 echo "Don't forget to"
6063 if test "$makefile_am" = Makefile.am
; then
6064 echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
6066 echo " - \"include $makefile_name\" from within \"$sourcebase/Makefile.am\","
6068 if test -n "$pobase"; then
6069 echo " - add \"$pobase/Makefile.in\" to AC_CONFIG_FILES in $configure_ac,"
6072 if test "$makefile_am" = Makefile.am
; then
6073 echo " - add \"$testsbase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
6075 echo " - \"include $makefile_name\" from within \"$testsbase/Makefile.am\","
6079 while test $edit != $makefile_am_edits; do
6080 edit
=`expr $edit + 1`
6081 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
6082 eval var
=\"\
$makefile_am_edit${edit}_var
\"
6083 eval val
=\"\
$makefile_am_edit${edit}_val
\"
6084 if test -n "$var"; then
6085 echo " - mention \"${val}\" in ${var} in ${dir}Makefile.am,"
6088 if grep '^ *AC_PROG_CC_STDC' "$configure_ac" > /dev
/null
; then
6089 position_early_after
=AC_PROG_CC_STDC
6091 if grep '^ *AC_PROG_CC_C99' "$configure_ac" > /dev
/null
; then
6092 position_early_after
=AC_PROG_CC_C99
6094 position_early_after
=AC_PROG_CC
6097 echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after $position_early_after,"
6098 echo " - invoke ${macro_prefix}_INIT in $configure_ac."
6101 # func_create_testdir testdir modules
6103 # - local_gnulib_path from --local-dir
6104 # - modcache true or false, from --cache-modules/--no-cache-modules
6105 # - auxdir directory relative to destdir where to place build aux files
6106 # - inctests true if tests should be included, false otherwise
6107 # - incobsolete true if obsolete modules among dependencies should be
6108 # included, blank otherwise
6109 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
6111 # - excl_longrunning_tests true if long-runnings tests should be excluded,
6113 # - excl_privileged_tests true if tests that require root privileges should be
6114 # excluded, blank otherwise
6115 # - excl_unportable_tests true if tests that fail on some platforms should be
6116 # excluded, blank otherwise
6117 # - single_configure true if a single configure file should be generated,
6118 # false for a separate configure file for the tests
6119 # - avoidlist list of modules to avoid
6120 # - cond_dependencies true if --conditional-dependencies was given, false if
6121 # --no-conditional-dependencies was given, blank otherwise
6122 # - libtool true if --libtool was given, false if --no-libtool was
6123 # given, blank otherwise
6124 # - copymode copy mode for files in general
6125 # - lcopymode copy mode for files from local_gnulib_path
6126 func_create_testdir
()
6130 if test -z "$modules"; then
6131 # All modules together.
6132 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
6133 # Except non-recursive-gnulib-prefix-hack, which represents a nonstandard
6134 # way of using Automake.
6135 # Except timevar, which lacks the required file timevar.def.
6136 # Except ftruncate, mountlist, which abort the configuration on mingw. FIXME.
6137 # Except lib-ignore, which leads to link errors when Sun C++ is used. FIXME.
6138 modules
=`func_all_modules`
6139 modules
=`for m in $modules; do case $m in config-h | non-recursive-gnulib-prefix-hack | timevar | ftruncate | mountlist | lib-ignore) ;; *) echo $m;; esac; done`
6141 specified_modules
="$modules"
6143 # Canonicalize the list of specified modules.
6144 specified_modules
=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
6146 # Test modules which invoke AC_CONFIG_FILES cannot be used with
6147 # --with-tests --single-configure. Avoid them.
6148 if $inctests && $single_configure; then
6149 avoidlist
="$avoidlist havelib-tests"
6152 # Unlike in func_import, here we want to include all kinds of tests for the
6153 # directly specified modules, but not for dependencies.
6154 inc_all_direct_tests
=true
6155 inc_all_indirect_tests
="$inc_all_tests"
6157 # Check that the license of every module is consistent with the license of
6159 saved_inctests
="$inctests"
6160 # When computing transitive closures, don't consider $module to depend on
6161 # $module-tests. Need this because tests are implicitly GPL and may depend
6162 # on GPL modules - therefore we don't want a warning in this case.
6164 for requested_module
in $specified_modules; do
6165 requested_license
=`func_get_license "$requested_module"`
6166 if test "$requested_license" != GPL
; then
6167 # Here we use func_modules_transitive_closure, not just
6168 # func_get_dependencies, so that we also detect weird situations like
6169 # an LGPL module which depends on a GPLed build tool module which depends
6171 modules
="$requested_module"
6172 func_modules_transitive_closure
6173 for module
in $modules; do
6174 license
=`func_get_license "$module"`
6176 'GPLed build tool') ;;
6177 'public domain' |
'unlimited' |
'unmodifiable license text') ;;
6179 case "$requested_license" in
6182 LGPLv2
+ |
'LGPLv3+ or GPLv2' | LGPLv3
+ | LGPL | GPLv2
+ | GPLv3
+ | GPL
) ;;
6183 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6188 LGPLv2
+ |
'LGPLv3+ or GPLv2' | GPLv2
+) ;;
6189 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6194 LGPLv2
+ |
'LGPLv3+ or GPLv2' | LGPLv3
+ | LGPL
) ;;
6195 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6200 LGPLv2
+ |
'LGPLv3+ or GPLv2') ;;
6201 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6207 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6216 inctests
="$saved_inctests"
6218 # Subdirectory names.
6229 # Determine final module list.
6230 modules
="$specified_modules"
6231 func_modules_transitive_closure
6232 if test $verbose -ge 0; then
6233 func_show_module_list
6235 final_modules
="$modules"
6237 if $single_configure; then
6238 # Determine main module list and tests-related module list separately.
6239 func_modules_transitive_closure_separately
6242 if $single_configure; then
6243 # Determine whether a $testsbase/libtests.a is needed.
6244 func_determine_use_libtests
6247 # Add the dummy module if needed.
6248 if $single_configure; then
6249 func_modules_add_dummy_separately
6251 func_modules_add_dummy
6255 # If $single_configure, we use the module lists $main_modules and
6256 # $testsrelated_modules; $modules is merely a temporary variable.
6257 # Whereas if ! $configure, the module list is $modules.
6259 # Show banner notice of every module.
6260 if $single_configure; then
6261 modules
="$main_modules"
6267 # Determine final file list.
6268 if $single_configure; then
6269 func_modules_to_filelist_separately
6271 func_modules_to_filelist
6272 if test $verbose -ge 0; then
6274 echo "$files" |
sed -e 's/^/ /'
6277 # Add files for which the copy in gnulib is newer than the one that
6278 # "automake --add-missing --copy" would provide.
6279 files
="$files build-aux/config.guess"
6280 files
="$files build-aux/config.sub"
6281 files
=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
6283 rewritten
='%REWRITTEN%'
6284 sed_rewrite_files
="\
6285 s,^build-aux/,$rewritten$auxdir/,
6286 s,^doc/,$rewritten$docbase/,
6287 s,^lib/,$rewritten$sourcebase/,
6288 s,^m4/,$rewritten$m4base/,
6289 s,^tests/,$rewritten$testsbase/,
6290 s,^tests=lib/,$rewritten$testsbase/,
6294 # Create directories.
6295 for f
in $files; do echo $f; done \
6296 |
sed -e "$sed_rewrite_files" \
6297 |
sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
6298 | LC_ALL
=C
sort -u \
6300 { # Rearrange file descriptors. Needed because "while ... done < ..."
6301 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
6302 exec 5<&0 < "$tmp"/dirs
6304 mkdir
-p "$testdir/$d"
6309 # Copy files or make symbolic links or hard links.
6311 for f
in $files; do echo $f; done \
6312 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_files" \
6315 { # Rearrange file descriptors. Needed because "while ... done < ..."
6316 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
6317 exec 5<&0 < "$tmp"/files
6320 tests
=lib
/*) f
=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
6322 func_lookup_file
"$f"
6323 if test -n "$lookedup_tmp"; then
6324 cp -p "$lookedup_file" "$testdir/$g"
6325 func_ensure_writable
"$testdir/$g"
6328 if test "$copyaction" = symlink
; then
6329 func_symlink
"$lookedup_file" "$testdir/$g"
6331 if test "$copyaction" = hardlink
; then
6332 func_hardlink
"$lookedup_file" "$testdir/$g"
6334 cp -p "$lookedup_file" "$testdir/$g"
6335 func_ensure_writable
"$testdir/$g"
6343 # Determine include_guard_prefix.
6344 func_compute_include_guard_prefix
6346 # Create Makefile.ams that are for testing.
6349 # No special edits are needed.
6352 # Create $sourcebase/Makefile.am.
6353 mkdir
-p "$testdir/$sourcebase"
6354 destfile
="$sourcebase/Makefile.am"
6355 if $single_configure; then
6356 modules
="$main_modules"
6358 func_emit_lib_Makefile_am
> "$testdir/$sourcebase/Makefile.am"
6359 any_uses_subdirs
="$uses_subdirs"
6361 # Create $m4base/Makefile.am.
6362 mkdir
-p "$testdir/$m4base"
6363 (echo "## Process this file with automake to produce Makefile.in."
6369 echo "EXTRA_DIST += "`echo "$f" | sed -e 's,^m4/,,'` ;;
6372 ) > "$testdir/$m4base/Makefile.am"
6374 subdirs
="$sourcebase $m4base"
6375 subdirs_with_configure_ac
=""
6377 if false
&& test -f "$testdir"/$m4base/gettext.
m4; then
6378 # Avoid stupid error message from automake:
6379 # "AM_GNU_GETTEXT used but `po' not in SUBDIRS"
6380 mkdir
-p "$testdir/po"
6381 (echo "## Process this file with automake to produce Makefile.in."
6382 ) > "$testdir/po/Makefile.am"
6383 func_append subdirs
" po"
6387 test -d "$testdir/$testsbase" || mkdir
"$testdir/$testsbase"
6388 if $single_configure; then
6389 # Create $testsbase/Makefile.am.
6390 destfile
="$testsbase/Makefile.am"
6391 modules
="$testsrelated_modules"
6392 func_emit_tests_Makefile_am
"${macro_prefix}tests_WITNESS" > "$testdir/$testsbase/Makefile.am"
6394 # Viewed from the $testsbase subdirectory, $auxdir is different.
6395 saved_auxdir
="$auxdir"
6396 auxdir
=`echo "$testsbase/" | sed -e 's%[^/][^/]*//*%../%g'`"$auxdir"
6397 # Create $testsbase/Makefile.am.
6399 destfile
="$testsbase/Makefile.am"
6400 func_emit_tests_Makefile_am
"" > "$testdir/$testsbase/Makefile.am"
6401 any_uses_subdirs
="$any_uses_subdirs$uses_subdirs"
6402 # Create $testsbase/configure.ac.
6403 (echo "# Process this file with autoconf to produce a configure script."
6404 echo "AC_INIT([dummy], [0])"
6405 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6406 echo "AM_INIT_AUTOMAKE"
6408 echo "AC_CONFIG_HEADERS([config.h])"
6411 echo "AC_PROG_INSTALL"
6412 echo "AC_PROG_MAKE_SET"
6414 func_emit_pre_early_macros false
'' "$modules"
6416 if test -n "$uses_subdirs"; then
6417 echo "AM_PROG_CC_C_O"
6420 for module
in $modules; do
6422 if test -n "$module"; then
6424 gnumakefile | maintainer-makefile
)
6425 # These modules are meant to be used only in the top-level directory.
6428 func_get_autoconf_early_snippet
"$module"
6433 |
sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
6434 if test "$libtool" = true
; then
6435 echo "LT_INIT([win32-dll])"
6436 echo "LT_LANG([C++])"
6437 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
6438 echo "gl_cond_libtool=true"
6440 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
6441 echo "gl_cond_libtool=false"
6443 echo "gl_ltlibdeps="
6445 # Wrap the set of autoconf snippets into an autoconf macro that is then
6446 # invoked. This is needed because autoconf does not support AC_REQUIRE
6448 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
6449 # but we want the AC_REQUIRE to have its normal meaning (provide one
6450 # expansion of the required macro before the current point, and only one
6452 echo "AC_DEFUN([gl_INIT], ["
6453 sed_replace_build_aux
='
6455 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
6456 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
6459 echo "gl_m4_base='../$m4base'"
6460 func_emit_initmacro_start
$macro_prefix
6461 # We don't have explicit ordering constraints between the various
6462 # autoconf snippets. It's cleanest to put those of the library before
6463 # those of the tests.
6464 echo "gl_source_base='../$sourcebase'"
6465 func_emit_autoconf_snippets
"$modules" "$modules" func_verify_nontests_module false false false
6466 echo "gl_source_base='.'"
6467 func_emit_autoconf_snippets
"$modules" "$modules" func_verify_tests_module false false false
6468 func_emit_initmacro_end
$macro_prefix
6469 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
6470 # created using libtool, because libtool already handles the dependencies.
6471 if test "$libtool" != true
; then
6472 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
6473 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
6474 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
6475 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
6476 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
6479 func_emit_initmacro_done
$macro_prefix $sourcebase # FIXME use $sourcebase or $testsbase?
6483 # Usually $testsbase/config.h will be a superset of config.h. Verify this
6484 # by "merging" config.h into $testsbase/config.h; look out for gcc warnings.
6485 echo "AH_TOP([#include \"../config.h\"])"
6487 echo "AC_CONFIG_FILES([Makefile])"
6489 ) > "$testdir/$testsbase/configure.ac"
6490 auxdir
="$saved_auxdir"
6491 subdirs_with_configure_ac
="$subdirs_with_configure_ac $testsbase"
6493 func_append subdirs
" $testsbase"
6496 # Create Makefile.am.
6497 (echo "## Process this file with automake to produce Makefile.in."
6499 echo "AUTOMAKE_OPTIONS = 1.11 foreign"
6501 echo "SUBDIRS = $subdirs"
6503 echo "ACLOCAL_AMFLAGS = -I $m4base"
6504 ) > "$testdir/Makefile.am"
6506 # Create configure.ac.
6507 (echo "# Process this file with autoconf to produce a configure script."
6508 echo "AC_INIT([dummy], [0])"
6509 if test "$auxdir" != "."; then
6510 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6512 echo "AM_INIT_AUTOMAKE"
6514 echo "AC_CONFIG_HEADERS([config.h])"
6517 echo "AC_PROG_INSTALL"
6518 echo "AC_PROG_MAKE_SET"
6520 echo "# For autobuild."
6521 echo "AC_CANONICAL_BUILD"
6522 echo "AC_CANONICAL_HOST"
6524 echo "m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
6525 echo "m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
6526 echo "m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
6527 echo "m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
6529 func_emit_pre_early_macros false
'' "$final_modules"
6531 if test -n "$any_uses_subdirs"; then
6532 echo "AM_PROG_CC_C_O"
6535 for module
in $final_modules; do
6536 if $single_configure; then
6539 func_verify_nontests_module
6541 if test -n "$module"; then
6542 func_get_autoconf_early_snippet
"$module"
6545 |
sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
6546 if test "$libtool" = true
; then
6547 echo "LT_INIT([win32-dll])"
6548 echo "LT_LANG([C++])"
6549 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
6550 echo "gl_cond_libtool=true"
6552 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
6553 echo "gl_cond_libtool=false"
6555 echo "gl_ltlibdeps="
6557 # Wrap the set of autoconf snippets into an autoconf macro that is then
6558 # invoked. This is needed because autoconf does not support AC_REQUIRE
6560 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
6561 # but we want the AC_REQUIRE to have its normal meaning (provide one
6562 # expansion of the required macro before the current point, and only one
6564 echo "AC_DEFUN([gl_INIT], ["
6565 if test "$auxdir" != "build-aux"; then
6566 sed_replace_build_aux
='
6568 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
6569 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
6573 sed_replace_build_aux
="$sed_noop"
6575 echo "gl_m4_base='$m4base'"
6576 func_emit_initmacro_start
$macro_prefix
6577 echo "gl_source_base='$sourcebase'"
6578 if $single_configure; then
6579 func_emit_autoconf_snippets
"$main_modules" "$main_modules" func_verify_module true false false
6581 func_emit_autoconf_snippets
"$modules" "$modules" func_verify_nontests_module true false false
6583 func_emit_initmacro_end
$macro_prefix
6584 if $single_configure; then
6585 echo " gltests_libdeps="
6586 echo " gltests_ltlibdeps="
6587 func_emit_initmacro_start
${macro_prefix}tests
6588 echo " gl_source_base='$testsbase'"
6589 # Define a tests witness macro.
6590 echo " ${macro_prefix}tests_WITNESS=IN_GNULIB_TESTS"
6591 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
6592 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
6593 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
6594 func_emit_autoconf_snippets
"$testsrelated_modules" "$main_modules $testsrelated_modules" func_verify_module true false false
6595 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
6596 func_emit_initmacro_end
${macro_prefix}tests
6598 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
6599 # created using libtool, because libtool already handles the dependencies.
6600 if test "$libtool" != true
; then
6601 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
6602 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
6603 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
6604 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
6605 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
6607 if $single_configure; then
6608 if $use_libtests; then
6609 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
6610 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
6614 func_emit_initmacro_done
$macro_prefix $sourcebase
6615 if $single_configure; then
6616 func_emit_initmacro_done
${macro_prefix}tests
$testsbase
6621 if test -n "$subdirs_with_configure_ac"; then
6622 echo "AC_CONFIG_SUBDIRS(["`echo $subdirs_with_configure_ac`"])"
6624 makefiles
="Makefile"
6625 for d
in $subdirs; do
6626 # For subdirs that have a configure.ac by their own, it's the subdir's
6627 # configure.ac which creates the subdir's Makefile.am, not this one.
6628 case " $subdirs_with_configure_ac " in
6630 *) func_append makefiles
" $d/Makefile" ;;
6633 echo "AC_CONFIG_FILES([$makefiles])"
6635 ) > "$testdir/configure.ac"
6637 # Create autogenerated files.
6639 # Do not use "${AUTORECONF} --force --install", because it may invoke
6640 # autopoint, which brings in older versions of some of our .m4 files.
6641 if test -f $m4base/gettext.
m4; then
6642 func_execute_command
${AUTOPOINT} --force || func_exit
1
6643 for f
in $m4base/*.
m4~
; do
6645 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit
1
6649 if test "$libtool" = true
; then
6650 func_execute_command
${LIBTOOLIZE} --copy || func_exit
1
6652 func_execute_command
${ACLOCAL} -I $m4base || func_exit
1
6653 if ! test -d build-aux
; then
6654 func_execute_command mkdir build-aux || func_exit
1
6656 func_execute_command
${AUTOCONF} || func_exit
1
6657 # Explicit 'touch config.h.in': see <https://savannah.gnu.org/support/index.php?109406>.
6658 func_execute_command
${AUTOHEADER} &&
6659 func_execute_command
touch config.h.
in ||
6661 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6662 rm -rf autom4te.cache
6664 if $inctests && ! $single_configure; then
6665 # Create autogenerated files.
6666 (cd "$testdir/$testsbase" || func_exit
1
6667 # Do not use "${AUTORECONF} --force --install", because it may invoke
6668 # autopoint, which brings in older versions of some of our .m4 files.
6669 if test -f ..
/$m4base/gettext.
m4; then
6670 func_execute_command
${AUTOPOINT} --force || func_exit
1
6671 for f
in ..
/$m4base/*.
m4~
; do
6673 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit
1
6677 func_execute_command
${ACLOCAL} -I ..
/$m4base || func_exit
1
6678 if ! test -d ..
/build-aux
; then
6679 func_execute_command mkdir ..
/build-aux
6681 func_execute_command
${AUTOCONF} || func_exit
1
6682 # Explicit 'touch config.h.in': see <https://savannah.gnu.org/support/index.php?109406>.
6683 func_execute_command
${AUTOHEADER} &&
6684 func_execute_command
touch config.h.
in ||
6686 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6687 rm -rf autom4te.cache
6690 # Need to run configure and make once, to create built files that are to be
6691 # distributed (such as parse-datetime.c).
6692 sed_remove_make_variables
='s,[$]([A-Za-z0-9_]*),,g'
6693 # Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...".
6694 cleaned_files
=`combine_lines < "$testdir/$sourcebase/Makefile.am" \
6695 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
6696 cleaned_files
=`for file in $cleaned_files; do echo " $file "; done`
6697 # Extract the value of "BUILT_SOURCES += ...". Remove variable references
6698 # such $(FOO_H) because they don't refer to distributed files.
6699 built_sources
=`combine_lines < "$testdir/$sourcebase/Makefile.am" \
6700 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
6701 | sed -e "$sed_remove_make_variables"`
6702 distributed_built_sources
=`for file in $built_sources; do
6703 case "$cleaned_files" in
6708 tests_distributed_built_sources
=
6710 # Likewise for built files in the $testsbase directory.
6711 tests_cleaned_files
=`combine_lines < "$testdir/$testsbase/Makefile.am" \
6712 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
6713 tests_cleaned_files
=`for file in $tests_cleaned_files; do echo " $file "; done`
6714 tests_built_sources
=`combine_lines < "$testdir/$testsbase/Makefile.am" \
6715 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
6716 | sed -e "$sed_remove_make_variables"`
6717 tests_distributed_built_sources
=`for file in $tests_built_sources; do
6718 case "$tests_cleaned_files" in
6724 if test -n "$distributed_built_sources" ||
test -n "$tests_distributed_built_sources"; then
6726 .
/configure || func_exit
1
6727 if test -n "$distributed_built_sources"; then
6729 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
6730 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6735 if test -n "$tests_distributed_built_sources"; then
6737 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
6738 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6743 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6749 if test -f build-aux
/test-driver
; then
6750 patch build-aux
/test-driver
< "$gnulib_dir"/build-aux
/test-driver.
diff || func_exit
1
6755 # func_create_megatestdir megatestdir allmodules
6757 # - local_gnulib_path from --local-dir
6758 # - modcache true or false, from --cache-modules/--no-cache-modules
6759 # - auxdir directory relative to destdir where to place build aux files
6760 func_create_megatestdir
()
6764 if test -z "$allmodules"; then
6765 allmodules
=`func_all_modules`
6769 # First, all modules one by one.
6770 for onemodule
in $allmodules; do
6771 func_create_testdir
"$megatestdir/$onemodule" $onemodule
6772 func_append megasubdirs
"$onemodule "
6774 # Then, all modules all together.
6775 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
6776 allmodules
=`for m in $allmodules; do if test $m != config-h; then echo $m; fi; done`
6777 func_create_testdir
"$megatestdir/ALL" "$allmodules"
6778 func_append megasubdirs
"ALL"
6781 cvsdate
=`vc_witness="$gnulib_dir/.git/refs/heads/master"; \
6782 sh "$gnulib_dir/build-aux/mdate-sh" "$vc_witness" \
6783 | sed -e 's,January,01,' -e 's,Jan,01,' \
6784 -e 's,February,02,' -e 's,Feb,02,' \
6785 -e 's,March,03,' -e 's,Mar,03,' \
6786 -e 's,April,04,' -e 's,Apr,04,' \
6788 -e 's,June,06,' -e 's,Jun,06,' \
6789 -e 's,July,07,' -e 's,Jul,07,' \
6790 -e 's,August,08,' -e 's,Aug,08,' \
6791 -e 's,September,09,' -e 's,Sep,09,' \
6792 -e 's,October,10,' -e 's,Oct,10,' \
6793 -e 's,November,11,' -e 's,Nov,11,' \
6794 -e 's,December,12,' -e 's,Dec,12,' \
6795 -e 's,^,00,' -e 's,^[0-9]*\([0-9][0-9] \),\1,' \
6796 -e 's,^\([0-9]*\) \([0-9]*\) \([0-9]*\),\3\2\1,'`
6798 echo "CVSDATE=$cvsdate"
6799 echo ": \${MAKE=make}"
6800 echo "test -d logs || mkdir logs"
6801 echo "for module in $megasubdirs; do"
6802 echo " echo \"Working on module \$module...\""
6803 echo " safemodule=\`echo \$module | sed -e 's|/|-|g'\`"
6804 echo " (echo \"To: gnulib@autobuild.josefsson.org\""
6807 echo " : autobuild project... \$module"
6808 echo " : autobuild revision... cvs-\$CVSDATE-000000"
6809 echo " : autobuild timestamp... \`date \"+%Y%m%d-%H%M%S\"\`"
6810 echo " : autobuild hostname... \`hostname\`"
6811 echo " cd \$module && ./configure \$CONFIGURE_OPTIONS && \$MAKE && \$MAKE check && \$MAKE distclean"
6813 echo " ) 2>&1 | { if test -n \"\$AUTOBUILD_SUBST\"; then sed -e \"\$AUTOBUILD_SUBST\"; else cat; fi; } > logs/\$safemodule"
6815 ) > "$megatestdir/do-autobuild"
6816 chmod a
+x
"$megatestdir/do-autobuild"
6818 # Create Makefile.am.
6819 (echo "## Process this file with automake to produce Makefile.in."
6821 echo "AUTOMAKE_OPTIONS = 1.11 foreign"
6823 echo "SUBDIRS = $megasubdirs"
6825 echo "EXTRA_DIST = do-autobuild"
6826 ) > "$megatestdir/Makefile.am"
6828 # Create configure.ac.
6829 (echo "# Process this file with autoconf to produce a configure script."
6830 echo "AC_INIT([dummy], [0])"
6831 if test "$auxdir" != "."; then
6832 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6834 echo "AM_INIT_AUTOMAKE"
6836 echo "AC_PROG_MAKE_SET"
6838 echo "AC_CONFIG_SUBDIRS([$megasubdirs])"
6839 echo "AC_CONFIG_FILES([Makefile])"
6841 ) > "$megatestdir/configure.ac"
6843 # Create autogenerated files.
6845 # Do not use "${AUTORECONF} --install", because autoreconf operates
6846 # recursively, but the subdirectories are already finished, therefore
6847 # calling autoreconf here would only waste lots of CPU time.
6848 func_execute_command
${ACLOCAL} || func_exit
1
6849 func_execute_command mkdir build-aux
6850 func_execute_command
${AUTOCONF} || func_exit
1
6851 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6852 rm -rf autom4te.cache
6853 if test -f build-aux
/test-driver
; then
6854 patch build-aux
/test-driver
< "$gnulib_dir"/build-aux
/test-driver.
diff || func_exit
1
6861 func_fatal_error
"no mode specified" ;;
6868 # sed expression that converts a literal to a basic regular expression.
6869 # Needs to handle . [ \ * ^ $.
6870 sed_literal_to_basic_regex
='s/\\/\\\\/g
6876 if test -f "$gnulib_dir/$filename" \
6877 || func_lookup_local_file
"$filename"; then
6878 filename_anywhere_regex
=`echo "$filename" | sed -e "$sed_literal_to_basic_regex"`
6879 filename_line_regex
='^'"$filename_anywhere_regex"'$'
6882 (cd "$gnulib_dir" && find modules -type f -print | xargs -n 100 grep -l "$filename_line_regex" /dev/null | sed -e 's,^modules/,,')
6883 func_path_foreach "$local_gnulib_path" func_modules_in_dir %dir% | xargs -n 100 grep -l "$filename_anywhere_regex" /dev/null | sed -e 's,^modules/,,' -e 's,\.diff$,,'
6885 | func_sanitize_modulelist \
6888 for module
in $module_candidates; do
6889 if func_get_filelist
$module |
grep "$filename_line_regex" > /dev
/null
; then
6894 func_warning
"file $filename does not exist"
6899 import | add-import | remove-import | update
)
6902 if test -z "$destdir"; then
6905 test -d "$destdir" \
6906 || func_fatal_error
"destination directory does not exist: $destdir"
6908 # Prefer configure.ac to configure.in.
6909 if test -f "$destdir"/configure.ac
; then
6910 configure_ac
="$destdir/configure.ac"
6912 if test -f "$destdir"/configure.
in; then
6913 configure_ac
="$destdir/configure.in"
6915 func_fatal_error
"cannot find $destdir/configure.ac - make sure you run gnulib-tool from within your package's directory"
6919 # Analyze configure.ac.
6921 guessed_libtool
=false
6926 /AC_CONFIG_AUX_DIR/ {
6927 s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^]"$`\\)]*\).*$,guessed_auxdir="\1",p
6929 /A[CM]_PROG_LIBTOOL/ {
6930 s,^.*$,guessed_libtool=true,p
6932 eval `sed -n -e "$my_sed_traces" < "$configure_ac"`
6934 if test -z "$auxdir"; then
6935 auxdir
="$guessed_auxdir"
6938 # Determine where to apply func_import.
6939 if test "$mode" = import
; then
6940 # Apply func_import to a particular gnulib directory.
6941 # The command line contains the complete specification; don't look at
6942 # the contents of gnulib-cache.m4.
6943 test -n "$supplied_libname" || supplied_libname
=true
6944 test -n "$sourcebase" || sourcebase
="lib"
6945 test -n "$m4base" || m4base
="m4"
6946 test -n "$docbase" || docbase
="doc"
6947 test -n "$testsbase" || testsbase
="tests"
6948 test -n "$macro_prefix" || macro_prefix
="gl"
6951 if test -n "$m4base"; then
6952 # Apply func_import to a particular gnulib directory.
6953 # Any number of additional modules can be given.
6954 if test ! -f "$destdir/$m4base"/gnulib-cache.
m4; then
6955 # First use of gnulib in the given m4base.
6956 test -n "$supplied_libname" || supplied_libname
=true
6957 test -n "$sourcebase" || sourcebase
="lib"
6958 test -n "$docbase" || docbase
="doc"
6959 test -n "$testsbase" || testsbase
="tests"
6960 test -n "$macro_prefix" || macro_prefix
="gl"
6964 # Apply func_import to all gnulib directories.
6965 # To get this list of directories, look at Makefile.am. (Not at
6966 # configure, because it may be omitted from version control. Also,
6967 # don't run "find $destdir -name gnulib-cache.m4", as it might be
6971 if test -f "$destdir"/Makefile.am
; then
6972 aclocal_amflags
=`sed -n -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/p' "$destdir"/Makefile.am`
6974 for arg
in $aclocal_amflags; do
6975 if test -n "$m4dir_is_next"; then
6976 # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
6980 if test -f "$destdir/$arg"/gnulib-cache.
m4; then
6981 func_append m4dirs
" $arg"
6982 m4dirs_count
=`expr $m4dirs_count + 1`
6988 if test "X$arg" = "X-I"; then
6996 # No Makefile.am! Oh well. Look at the last generated aclocal.m4.
6997 if test -f "$destdir"/aclocal.
m4; then
6998 sedexpr1
='s,^m4_include(\[\(.*\)])$,\1,p'
6999 sedexpr2
='s,^[^/]*$,.,'
7000 sedexpr3
='s,/[^/]*$,,'
7001 m4dirs
=`sed -n -e "$sedexpr1" aclocal.m4 | sed -e "$sedexpr2" -e "$sedexpr3" | LC_ALL=C sort -u`
7002 m4dirs
=`for arg in $m4dirs; do if test -f "$destdir/$arg"/gnulib-cache.m4; then echo $arg; fi; done`
7003 m4dirs_count
=`for arg in $m4dirs; do echo "$arg"; done | wc -l`
7006 if test $m4dirs_count = 0; then
7007 # First use of gnulib in a package.
7008 # Any number of additional modules can be given.
7009 test -n "$supplied_libname" || supplied_libname
=true
7010 test -n "$sourcebase" || sourcebase
="lib"
7012 test -n "$docbase" || docbase
="doc"
7013 test -n "$testsbase" || testsbase
="tests"
7014 test -n "$macro_prefix" || macro_prefix
="gl"
7017 if test $m4dirs_count = 1; then
7018 # There's only one use of gnulib here. Assume the user means it.
7019 # Any number of additional modules can be given.
7020 for m4base
in $m4dirs; do
7024 # Ambiguous - guess what the user meant.
7025 if test $# = 0; then
7026 # No further arguments. Guess the user wants to update all of them.
7027 for m4base
in $m4dirs; do
7028 # Perform func_import in a subshell, so that variable values
7030 # local_gnulib_path, incobsolete, inc_cxx_tests,
7031 # inc_longrunning_tests, inc_privileged_tests,
7032 # inc_unportable_tests, inc_all_tests, avoidlist, sourcebase,
7033 # m4base, pobase, docbase, testsbase, inctests, libname, lgpl,
7034 # makefile_name, libtool, macro_prefix, po_domain,
7035 # witness_c_macro, vc_files
7036 # don't propagate from one directory to another.
7037 (func_import
) || func_exit
1
7041 func_fatal_error
"Ambiguity: to which directory should the modules be added? Please specify at least --m4-base=..."
7050 if test -z "$destdir"; then
7051 func_fatal_error
"please specify --dir option"
7054 test -d "$destdir" \
7055 || func_fatal_error
"could not create destination directory"
7056 test -n "$auxdir" || auxdir
="build-aux"
7057 func_create_testdir
"$destdir" "$*"
7060 create-megatestdir
)
7061 if test -z "$destdir"; then
7062 func_fatal_error
"please specify --dir option"
7064 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
7065 test -n "$auxdir" || auxdir
="build-aux"
7066 func_create_megatestdir
"$destdir" "$*"
7070 test -n "$destdir" || destdir
=testdir$$
7071 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
7072 test -n "$auxdir" || auxdir
="build-aux"
7073 func_create_testdir
"$destdir" "$*"
7077 ..
/configure || func_exit
1
7078 $MAKE || func_exit
1
7079 $MAKE check || func_exit
1
7080 $MAKE distclean || func_exit
1
7081 remaining
=`find . -type f -print`
7082 if test -n "$remaining"; then
7083 echo "Remaining files:" $remaining 1>&2
7084 echo "gnulib-tool: *** Stop." 1>&2
7093 test -n "$destdir" || destdir
=testdir$$
7094 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
7095 test -n "$auxdir" || auxdir
="build-aux"
7096 func_create_megatestdir
"$destdir" "$*"
7104 remaining
=`find . -type f -print`
7105 if test -n "$remaining"; then
7106 echo "Remaining files:" $remaining 1>&2
7107 echo "gnulib-tool: *** Stop." 1>&2
7115 extract-description
)
7119 if test -n "$module"; then
7120 func_get_description
"$module"
7129 if test -n "$module"; then
7130 func_get_comment
"$module"
7139 if test -n "$module"; then
7140 func_get_status
"$module"
7149 if test -n "$module"; then
7150 func_get_notice
"$module"
7155 extract-applicability
)
7159 if test -n "$module"; then
7160 func_get_applicability
"$module"
7169 if test -n "$module"; then
7170 func_get_filelist
"$module"
7175 extract-dependencies
)
7176 if test -n "$avoidlist"; then
7177 func_fatal_error
"cannot combine --avoid and --extract-dependencies"
7182 if test -n "$module"; then
7183 func_get_dependencies
"$module"
7188 extract-recursive-dependencies
)
7189 if test -n "$avoidlist"; then
7190 func_fatal_error
"cannot combine --avoid and --extract-recursive-dependencies"
7195 if test -n "$module"; then
7196 func_get_dependencies_recursively
"$module"
7201 extract-autoconf-snippet
)
7205 if test -n "$module"; then
7206 func_get_autoconf_snippet
"$module"
7211 extract-automake-snippet
)
7215 if test -n "$module"; then
7216 func_get_automake_snippet
"$module"
7221 extract-include-directive
)
7225 if test -n "$module"; then
7226 func_get_include_directive
"$module"
7231 extract-link-directive
)
7235 if test -n "$module"; then
7236 func_get_link_directive
"$module"
7241 extract-recursive-link-directive
)
7242 if test -n "$avoidlist"; then
7243 func_fatal_error
"cannot combine --avoid and --extract-recursive-link-directive"
7248 if test -n "$module"; then
7249 func_get_link_directive_recursively
"$module"
7258 if test -n "$module"; then
7259 func_get_license
"$module"
7264 extract-maintainer
)
7268 if test -n "$module"; then
7269 func_get_maintainer
"$module"
7274 extract-tests-module
)
7278 if test -n "$module"; then
7279 func_get_tests_module
"$module"
7285 # Verify the number of arguments.
7286 if test $# -lt 1 ||
test $# -gt 2; then
7287 func_fatal_error
"invalid number of arguments for --$mode"
7290 # The first argument is the file to be copied.
7292 # Verify the file exists.
7293 func_lookup_file
"$f"
7295 # The second argument is the destination; either a directory ot a file.
7296 # It defaults to the current directory.
7298 test -n "$dest" || dest
='.'
7299 test -n "$sourcebase" || sourcebase
="lib"
7300 test -n "$m4base" || m4base
="m4"
7301 test -n "$docbase" || docbase
="doc"
7302 test -n "$testsbase" || testsbase
="tests"
7303 test -n "$auxdir" || auxdir
="build-aux"
7304 rewritten
='%REWRITTEN%'
7305 sed_rewrite_files
="\
7306 s,^build-aux/,$rewritten$auxdir/,
7307 s,^doc/,$rewritten$docbase/,
7308 s,^lib/,$rewritten$sourcebase/,
7309 s,^m4/,$rewritten$m4base/,
7310 s,^tests/,$rewritten$testsbase/,
7313 if test -d "$dest"; then
7315 g
=`echo "$f" | sed -e "$sed_rewrite_files"`
7317 destdir
=`dirname "$dest"`
7318 g
=`basename "$dest"`
7321 # Create the directory for destfile.
7322 d
=`dirname "$destdir/$g"`
7324 if test -n "$d" && test ! -d "$d"; then
7325 mkdir
-p "$d" || func_fatal_error
"failed"
7329 func_dest_tmpfilename
"$g"
7330 cp "$lookedup_file" "$tmpfile" || func_fatal_error
"failed"
7331 func_ensure_writable
"$tmpfile"
7332 already_present
=true
7333 if test -f "$destdir/$g"; then
7334 # The file already exists.
7338 # Don't protest if the file should be there but isn't: it happens
7339 # frequently that developers don't put autogenerated files under version
7347 func_fatal_error
"unknown operation mode --$mode" ;;
7350 if test "$copymode" = hardlink
-o "$lcopymode" = hardlink
; then
7351 # Setting hard links modifies the ctime of files in the gnulib checkout.
7352 # This disturbs the result of the next "gitk" invocation.
7353 # Workaround: Let git scan the files. This can be done through
7354 # "git update-index --refresh" or "git status" or "git diff".
7355 if test -d "$gnulib_dir"/.git \
7356 && (git
--version) >/dev
/null
2>/dev
/null
; then
7357 (cd "$gnulib_dir" && git update-index
--refresh >/dev
/null
)
7362 # Undo the effect of the previous 'trap' command. Some shellology:
7363 # We cannot use "trap - 0 1 2 3 13 15", because Solaris sh would attempt to
7364 # execute the command "-". "trap '' ..." is fine only for signal 0 (= normal
7365 # exit); for the others we need to call 'exit' explicitly. The value of $? is
7366 # 128 + signal number and is set before the trap-registered command is run.
7368 trap 'func_exit $?' 1 2 3 13 15
7373 # indent-tabs-mode: nil
7374 # whitespace-check-buffer-indent: nil