3 # Copyright (C) 2002-2023 Free Software Foundation, Inc.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 # This program is meant for authors or maintainers which want to import
20 # modules from gnulib into their packages.
22 # CODING STYLE for this file:
23 # * Indentation: Indent by 2 spaces. Indent case clauses by 2 spaces as well.
24 # * Shell variable references: Use double-quote around shell variable
25 # references always (except when word splitting is explicitly desired),
26 # even when you know the double-quote are not needed. This style tends to
27 # avoid undesired word splitting caused by omitted double-quotes (the
28 # number one mistake in shell scripts).
29 # When the referenced variable can only have a finite number of possible
30 # values and these values are all simple words (e.g. true and false), it's
31 # OK to omit the double-quotes.
33 # - Use backquotes like in `command`, not $(command).
34 # - Don't use `command` inside double-quotes. Instead assign the result of
35 # `command` to a variable, and use the value of the variable afterwards.
37 # - All functions that don't emulate a program or shell built-in have a name
38 # that starts with 'func_'.
39 # - Document the implicit and explicit arguments of all functions, as well
40 # as their output variables and side effects.
41 # * Use test condition instead of [ condition ].
42 # * Minimize the use of eval; when you need it, make sure the string to be
43 # evaluated has a very simple syntactic structure.
51 # You can set AUTOCONFPATH to empty if autoconf 2.64 is already in your PATH.
55 # AUTOCONFBINDIR=/arch/x86-linux/gnu-inst-autoconf/2.64/bin
56 # AUTOCONFPATH="eval env PATH=${AUTOCONFBINDIR}:\$PATH "
60 # You can set AUTOMAKEPATH to empty if automake 1.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 --tests-makefile-name=NAME
309 Name of makefile in the tests-base directory
310 (default as specified through --makefile-name).
311 --automake-subdir Specify that the makefile in the source-base
312 directory be generated in such a way that it can
313 be 'include'd from the toplevel Makefile.am.
314 --automake-subdir-tests
315 Likewise, but for the tests directory.
316 --macro-prefix=PREFIX Specify the prefix of the macros 'gl_EARLY' and
317 'gl_INIT'. Default is 'gl'.
318 --po-domain=NAME Specify the prefix of the i18n domain. Usually use
319 the package name. A suffix '-gnulib' is appended.
320 --witness-c-macro=NAME Specify the C macro that is defined when the
321 sources in this directory are compiled or used.
322 --vc-files Update version control related files.
323 --no-vc-files Don't update version control related files
324 (.gitignore and/or .cvsignore).
326 Options for --create-[mega]testdir, --[mega]test:
328 --single-configure Generate a single configure file, not a separate
329 configure file for the tests directory.
331 Options for --import, --add/remove-import, --update,
332 --create-[mega]testdir, --[mega]test:
334 -s, --symbolic, --symlink Make symbolic links instead of copying files.
335 --local-symlink Make symbolic links instead of copying files, only
336 for files from the local override directory.
337 -h, --hardlink Make hard links instead of copying files.
338 --local-hardlink Make hard links instead of copying files, only
339 for files from the local override directory.
341 Options for --import, --add/remove-import, --update:
343 -S, --more-symlinks Deprecated; equivalent to --symlink.
344 -H, --more-hardlinks Deprecated; equivalent to --hardlink.
346 Report bugs to <bug-gnulib@gnu.org>."
350 # outputs to stdout the --version message.
354 if test -d "$gnulib_dir"/.git \
355 && (git
--version) >/dev
/null
2>/dev
/null \
356 && (date --version) >/dev
/null
2>/dev
/null
; then
357 # gnulib checked out from git.
358 sed_extract_first_date
='/^Date/{
362 date=`cd "$gnulib_dir" && git log ChangeLog | sed -n -e "$sed_extract_first_date"`
363 # Turn "Fri Mar 21 07:16:51 2008 -0600" into "Mar 21 2008 07:16:51 -0600".
364 sed_year_before_time
='s/^[^ ]* \([^ ]*\) \([0-9]*\) \([0-9:]*\) \([0-9]*\) /\1 \2 \4 \3 /'
365 date=`echo "$date" | sed -e "$sed_year_before_time"`
366 # Use GNU date to compute the time in GMT.
367 date=`date -d "$date" -u +"%Y-%m-%d %H:%M:%S"`
368 version
=' '`cd "$gnulib_dir" && ./build-aux/git-version-gen /dev/null | sed -e 's/-dirty/-modified/'`
370 # gnulib copy without versioning information.
371 date=`sed -e 's/ .*//;q' "$gnulib_dir"/ChangeLog`
374 year
=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed -e 's,^.* ,,'`
376 gnulib-tool (GNU $package $date)$version
377 Copyright (C) $year Free Software Foundation, Inc.
378 License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
379 This is free software: you are free to change and redistribute it.
380 There is NO WARRANTY, to the extent permitted by law.
382 printf "Written by %s, %s, and %s.\n" "Bruno Haible" "Paul Eggert" "Simon Josefsson"
385 # func_emit_copyright_notice
386 # outputs to stdout a header for a generated file.
387 func_emit_copyright_notice
()
389 sed -n -e '/Copyright/ {
392 }' < "$self_abspathname"
394 echo "# This file is free software; you can redistribute it and/or modify"
395 echo "# it under the terms of the GNU General Public License as published by"
396 echo "# the Free Software Foundation, either version 3 of the License, or"
397 echo "# (at your option) any later version."
399 echo "# This file is distributed in the hope that it will be useful,"
400 echo "# but WITHOUT ANY WARRANTY; without even the implied warranty of"
401 echo "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
402 echo "# GNU General Public License for more details."
404 echo "# You should have received a copy of the GNU General Public License"
405 echo "# along with this file. If not, see <https://www.gnu.org/licenses/>."
407 echo "# As a special exception to the GNU General Public License,"
408 echo "# this file may be distributed as part of a program that"
409 echo "# contains a configuration script generated by Autoconf, under"
410 echo "# the same distribution terms as the rest of that program."
412 echo "# Generated by gnulib-tool."
416 # exits with a given status.
417 # This function needs to be used, rather than 'exit', when a 'trap' handler is
418 # in effect that refers to $?.
425 # locates the directory where the gnulib repository lives
427 # - progname name of this program
429 # - self_abspathname absolute pathname of gnulib-tool
430 # - gnulib_dir absolute pathname of gnulib repository
434 /* | ?
:*) self_abspathname
="$progname" ;;
435 */*) self_abspathname
=`pwd`/"$progname" ;;
438 # Iterate through the elements of $PATH.
439 # We use IFS=: instead of
440 # for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'`
441 # because the latter does not work when some PATH element contains spaces.
442 # We use a canonicalized $pathx instead of $PATH, because empty PATH
443 # elements are by definition equivalent to '.', however field splitting
444 # according to IFS=: loses empty fields in many shells:
445 # - /bin/sh on OSF/1 and Solaris loses all empty fields (at the
446 # beginning, at the end, and in the middle),
447 # - /bin/sh on IRIX and /bin/ksh on IRIX and OSF/1 lose empty fields
448 # at the beginning and at the end,
449 # - GNU bash, /bin/sh on AIX and HP-UX, and /bin/ksh on AIX, HP-UX,
450 # Solaris lose empty fields at the end.
451 # The 'case' statement is an optimization, to avoid evaluating the
452 # explicit canonicalization command when $PATH contains no empty fields.
454 if test "$PATH_SEPARATOR" = ";"; then
455 # On Windows, programs are searched in "." before $PATH.
458 # On Unix, we have to convert empty PATH elements to ".".
462 pathx
=`echo ":$PATH:" | sed -e 's/:::*/:.:/g' -e 's/^://' -e 's/:\$//'`
467 IFS
="$PATH_SEPARATOR"
471 if test -x "$d/$progname" && test ! -d "$d/$progname"; then
472 self_abspathname
="$d/$progname"
477 if test -z "$self_abspathname"; then
478 func_fatal_error
"could not locate the gnulib-tool program - how did you invoke it?"
482 while test -h "$self_abspathname"; do
483 # Resolve symbolic link.
484 linkval
=`func_readlink "$self_abspathname"`
485 test -n "$linkval" ||
break
487 /* | ?
:* ) self_abspathname
="$linkval" ;;
488 * ) self_abspathname
=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;;
491 gnulib_dir
=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
495 # creates a temporary directory.
497 # - progname name of this program
499 # - tmp pathname of freshly created temporary directory
502 # Use the environment variable TMPDIR, falling back to /tmp. This allows
503 # users to specify a different temporary directory, for example, if their
504 # /tmp is filled up or too small.
507 # Use the mktemp program if available. If not available, hide the error
509 tmp
=`(umask 077 && mktemp -d "$TMPDIR/glXXXXXX") 2>/dev/null` &&
510 test -n "$tmp" && test -d "$tmp"
513 # Use a simple mkdir command. It is guaranteed to fail if the directory
514 # already exists. $RANDOM is bash specific and expands to empty in shells
515 # other than bash, ksh and zsh. Its use does not increase security;
516 # rather, it minimizes the probability of failure in a very cluttered /tmp
518 tmp
=$TMPDIR/gl$$
-$RANDOM
519 (umask 077 && mkdir
"$tmp")
522 echo "$progname: cannot create a temporary directory in $TMPDIR" >&2
527 # func_append var value
528 # appends the given value to the shell variable var.
529 if ( foo
=bar
; foo
+=baz
&& test "$foo" = barbaz
) >/dev
/null
2>&1; then
530 # Use bash's += operator. It reduces complexity of appending repeatedly to
531 # a single variable from O(n^2) to O(n).
536 fast_func_append
=true
540 eval "$1=\"\$$1\$2\""
542 fast_func_append
=false
545 # func_remove_prefix var prefix
546 # removes the given prefix from the value of the shell variable var.
547 # var should be the name of a shell variable.
548 # Its value should not contain a newline and not start or end with whitespace.
549 # prefix should not contain the characters "$`\{}[]^|.
550 if ( foo
=bar
; eval 'test "${foo#b}" = ar' ) >/dev
/null
2>&1; then
551 func_remove_prefix
()
555 fast_func_remove_prefix
=true
557 func_remove_prefix
()
559 eval "value=\"\$$1\""
563 sed_escape_dots
='s/\([.]\)/\\\1/g'
564 prefix
=`echo "$prefix" | sed -e "$sed_escape_dots"`
567 value
=`echo "$value" | sed -e "s|^${prefix}||"`
568 eval "$1=\"\$value\""
570 fast_func_remove_prefix
=false
573 # Determine whether we should use ':' or ';' as PATH_SEPARATOR.
574 func_determine_path_separator
()
576 if test "${PATH_SEPARATOR+set}" != set; then
577 # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
578 # contains only /bin. Note that ksh looks also at the FPATH variable,
579 # so we have to set that as well for the test.
581 (PATH
='/bin;/bin'; FPATH
=$PATH; sh
-c :) >/dev
/null
2>&1 \
582 && { (PATH
='/bin:/bin'; FPATH
=$PATH; sh
-c :) >/dev
/null
2>&1 \
583 || PATH_SEPARATOR
=';'
588 # func_path_append pathvar directory
589 # appends directory to pathvar, delimiting directories by PATH_SEPARATOR.
592 if eval "test -n \"\$$1\""; then
593 func_append
"$1" "$PATH_SEPARATOR$2"
599 # func_path_foreach_inner
600 # helper for func_path_foreach because we need new 'args' array
602 # - fpf_dir directory from local_gnulib_path
603 # - fpf_cb callback to be run for fpf_dir
604 func_path_foreach_inner
()
626 # func_path_foreach path method args
627 # Execute method for each directory in path. The method will be called
628 # like `method args` while any argument '%dir%' within args will be replaced
629 # with processed directory from path.
637 IFS
="$PATH_SEPARATOR"
638 for fpf_dir
in $fpf_dirs
641 func_path_foreach_inner
"$@" && fpf_rc
=:
647 # func_remove_suffix var suffix
648 # removes the given suffix from the value of the shell variable var.
649 # var should be the name of a shell variable.
650 # Its value should not contain a newline and not start or end with whitespace.
651 # suffix should not contain the characters "$`\{}[]^|.
652 if ( foo
=bar
; eval 'test "${foo%r}" = ba' ) >/dev
/null
2>&1; then
653 func_remove_suffix
()
657 fast_func_remove_suffix
=true
659 func_remove_suffix
()
661 eval "value=\"\$$1\""
665 sed_escape_dots
='s/\([.]\)/\\\1/g'
666 suffix
=`echo "$suffix" | sed -e "$sed_escape_dots"`
669 value
=`echo "$value" | sed -e "s|${suffix}\$||"`
670 eval "$1=\"\$value\""
672 fast_func_remove_suffix
=false
675 # func_fatal_error message
676 # outputs to stderr a fatal error message, and terminates the program.
678 # - progname name of this program
681 echo "$progname: *** $1" 1>&2
682 echo "$progname: *** Stop." 1>&2
686 # func_warning message
687 # Outputs to stderr a warning message,
690 echo "gnulib-tool: warning: $1" 1>&2
693 # func_readlink SYMLINK
694 # outputs the target of the given symlink.
695 if (type readlink
) > /dev
/null
2>&1; then
698 # Use the readlink program from GNU coreutils.
704 # Use two sed invocations. A single sed -n -e 's,^.* -> \(.*\)$,\1,p'
705 # would do the wrong thing if the link target contains " -> ".
706 LC_ALL
=C
ls -l "$1" |
sed -e 's, -> ,#%%#,' |
sed -n -e 's,^.*#%%#\(.*\)$,\1,p'
710 # func_relativize DIR1 DIR2
711 # computes a relative pathname RELDIR such that DIR1/RELDIR = DIR2.
713 # - DIR1 relative pathname, relative to the current directory
714 # - DIR2 relative pathname, relative to the current directory
716 # - reldir relative pathname of DIR2, relative to DIR1
722 sed_first
='s,^\([^/]*\)/.*$,\1,'
723 sed_rest
='s,^[^/]*/*,,'
724 sed_last
='s,^.*/\([^/]*\)$,\1,'
725 sed_butlast
='s,/*[^/]*$,,'
726 while test -n "$dir1"; do
727 first
=`echo "$dir1" | sed -e "$sed_first"`
728 if test "$first" != "."; then
729 if test "$first" = ".."; then
730 dir2
=`echo "$dir0" | sed -e "$sed_last"`/"$dir2"
731 dir0
=`echo "$dir0" | sed -e "$sed_butlast"`
733 first2
=`echo "$dir2" | sed -e "$sed_first"`
734 if test "$first2" = "$first"; then
735 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
739 dir0
="$dir0"/"$first"
742 dir1
=`echo "$dir1" | sed -e "$sed_rest"`
747 # func_relconcat DIR1 DIR2
748 # computes a relative pathname DIR1/DIR2, with obvious simplifications.
750 # - DIR1 relative pathname, relative to the current directory
751 # - DIR2 relative pathname, relative to DIR1
753 # - relconcat DIR1/DIR2, relative to the current directory
758 sed_first
='s,^\([^/]*\)/.*$,\1,'
759 sed_rest
='s,^[^/]*/*,,'
760 sed_last
='s,^.*/\([^/]*\)$,\1,'
761 sed_butlast
='s,/*[^/]*$,,'
763 first
=`echo "$dir2" | sed -e "$sed_first"`
764 if test "$first" = "."; then
765 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
766 if test -z "$dir2"; then
771 last
=`echo "$dir1" | sed -e "$sed_last"`
772 while test "$last" = "."; do
773 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
774 last
=`echo "$dir1" | sed -e "$sed_last"`
776 if test -z "$dir1"; then
780 if test "$first" = ".."; then
781 if test "$last" = ".."; then
782 relconcat
="$dir1/$dir2"
785 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
786 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
787 if test -z "$dir1"; then
791 if test -z "$dir2"; then
796 relconcat
="$dir1/$dir2"
803 # func_ensure_writable DEST
804 # Ensures the file DEST is writable.
805 func_ensure_writable
()
807 test -w "$1" ||
chmod u
+w
"$1"
811 # Like ln -s, except use cp -p if ln -s fails.
815 echo "$progname: ln -s failed; falling back on cp -p" >&2
818 /* | ?
:*) # SRC is absolute.
820 *) # SRC is relative to the directory of DEST.
822 */*) cp_src
="${2%/*}/$1" ;;
829 func_ensure_writable
"$2"
833 # func_symlink_target SRC DEST
834 # Determines LINK_TARGET such that "ln -s LINK_TARGET DEST" will create a
835 # symbolic link DEST that points to SRC.
837 # - link_target link target, relative to the directory of DEST
838 func_symlink_target
()
843 *) # SRC is relative.
846 link_target
="`pwd`/$1" ;;
847 *) # DEST is relative too.
848 ln_destdir
=`echo "$2" | sed -e 's,[^/]*$,,'`
849 test -n "$ln_destdir" || ln_destdir
="."
850 func_relativize
"$ln_destdir" "$1"
851 link_target
="$reldir"
858 # func_symlink SRC DEST
859 # Like func_ln_s, except that SRC is given relative to the current directory (or
860 # absolute), not given relative to the directory of DEST.
863 func_symlink_target
"$1" "$2"
864 func_ln_s
"$link_target" "$2"
867 # func_symlink_if_changed SRC DEST
868 # Like func_symlink, but avoids munging timestamps if the link is correct.
869 # SRC is given relative to the current directory (or absolute).
870 func_symlink_if_changed
()
872 if test $# -ne 2; then
873 echo "usage: func_symlink_if_changed SRC DEST" >&2
875 func_symlink_target
"$1" "$2"
876 ln_target
=`func_readlink "$2"`
877 if test -h "$2" && test "$link_target" = "$ln_target"; then
881 func_ln_s
"$link_target" "$2"
885 # func_hardlink SRC DEST
886 # Like ln, except use cp -p if ln fails.
887 # SRC is given relative to the current directory (or absolute).
891 echo "$progname: ln failed; falling back on cp -p" >&2
893 func_ensure_writable
"$2"
897 # The 'join' program does not exist on all platforms. Where it exists,
898 # we can use it. Where not, bail out.
899 if (type join) >/dev
/null
2>&1; then
902 echo "$progname: 'join' program not found. Consider installing GNU coreutils." >&2
906 # Ensure an 'echo' command that
907 # 1. does not interpret backslashes and
908 # 2. does not print an error message "broken pipe" when writing into a pipe
911 # Test cases for problem 1:
912 # echo '\n' | wc -l prints 1 when OK, 2 when KO
913 # echo '\t' | grep t > /dev/null has return code 0 when OK, 1 when KO
914 # Test cases for problem 2:
915 # echo hi | true frequently prints
916 # "bash: echo: write error: Broken pipe"
917 # to standard error in bash 3.2.
919 # Problem 1 is a weird heritage from SVR4. BSD got it right (except that
920 # BSD echo interprets '-n' as an option, which is also not desirable).
921 # Nowadays the problem occurs in 4 situations:
922 # - in bash, when the shell option xpg_echo is set (bash >= 2.04)
923 # or when it was built with --enable-usg-echo-default (bash >= 2.0)
924 # or when it was built with DEFAULT_ECHO_TO_USG (bash < 2.0),
925 # - in zsh, when sh-emulation is not set,
926 # - in ksh (e.g. AIX /bin/sh and Solaris /usr/xpg4/bin/sh are ksh instances,
927 # and HP-UX /bin/sh and IRIX /bin/sh behave similarly),
928 # - in Solaris /bin/sh and OSF/1 /bin/sh.
929 # We try the following workarounds:
930 # - for all: respawn using $CONFIG_SHELL if that is set and works.
931 # - for bash >= 2.04: unset the shell option xpg_echo.
932 # - for bash >= 2.0: define echo to a function that uses the printf built-in.
933 # - for bash < 2.0: define echo to a function that uses cat of a here document.
934 # - for zsh: turn sh-emulation on.
935 # - for ksh: alias echo to 'print -r'.
936 # - for ksh: alias echo to a function that uses cat of a here document.
937 # - for Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh and rely on
938 # the ksh workaround.
939 # - otherwise: respawn using /bin/sh and rely on the workarounds.
940 # When respawning, we pass --no-reexec as first argument, so as to avoid
941 # turning this script into a fork bomb in unlucky situations.
943 # Problem 2 is specific to bash 3.2 and affects the 'echo' built-in, but not
944 # the 'printf' built-in. See
945 # <https://lists.gnu.org/r/bug-bash/2008-12/msg00050.html>
946 # <https://lists.gnu.org/r/bug-gnulib/2010-02/msg00154.html>
947 # The workaround is: define echo to a function that uses the printf built-in.
949 if echo '\t' |
grep t
> /dev
/null
; then
950 have_echo
=yes # Lucky!
952 # Try the workarounds.
953 # Respawn using $CONFIG_SHELL if that is set and works.
954 if test -z "$have_echo" \
955 && test "X$1" != "X--no-reexec" \
956 && test -n "$CONFIG_SHELL" \
957 && test -f "$CONFIG_SHELL" \
958 && $CONFIG_SHELL -c "echo '\\t' | grep t > /dev/null"; then
959 exec $CONFIG_SHELL "$0" --no-reexec "$@"
962 # For bash >= 2.04: unset the shell option xpg_echo.
963 if test -z "$have_echo" \
964 && test -n "$BASH_VERSION" \
965 && (shopt -o xpg_echo
; echo '\t' |
grep t
> /dev
/null
) 2>/dev
/null
; then
969 # For bash >= 2.0: define echo to a function that uses the printf built-in.
970 # For bash < 2.0: define echo to a function that uses cat of a here document.
971 # (There is no win in using 'printf' over 'cat' if it is not a shell built-in.)
972 # Also handle problem 2, specific to bash 3.2, here.
973 if { test -z "$have_echo" \
974 ||
case "$BASH_VERSION" in 3.2*) true
;; *) false
;; esac; \
976 && test -n "$BASH_VERSION"; then \
977 if type printf 2>/dev
/null |
grep / > /dev
/null
; then
978 # 'printf' is not a shell built-in.
986 # 'printf' is a shell built-in.
992 if echo '\t' |
grep t
> /dev
/null
; then
996 # For zsh: turn sh-emulation on.
997 if test -z "$have_echo" \
998 && test -n "$ZSH_VERSION" \
999 && (emulate sh
) >/dev
/null
2>&1; then
1002 # For ksh: alias echo to 'print -r'.
1003 if test -z "$have_echo" \
1004 && (type print
) >/dev
/null
2>&1; then
1005 # A 'print' command exists.
1006 if type print
2>/dev
/null |
grep / > /dev
/null
; then
1009 # 'print' is a shell built-in.
1010 if (print
-r '\told' |
grep told
> /dev
/null
) 2>/dev
/null
; then
1011 # 'print' is the ksh shell built-in.
1012 alias echo='print -r'
1016 if test -z "$have_echo" \
1017 && echo '\t' |
grep t
> /dev
/null
; then
1020 # For ksh: alias echo to a function that uses cat of a here document.
1021 # The ksh manual page says:
1022 # "Aliasing is performed when scripts are read, not while they are executed.
1023 # Therefore, for an alias to take effect, the alias definition command has
1024 # to be executed before the command which references the alias is read."
1025 # Because of this, we have to play strange tricks with have_echo, to ensure
1026 # that the top-level statement containing the test starts after the 'alias'
1028 if test -z "$have_echo"; then
1035 if (alias echo=bsd_echo
) 2>/dev
/null
; then
1036 alias echo=bsd_echo
2>/dev
/null
1039 if test -z "$have_echo" \
1040 && echo '\t' |
grep t
> /dev
/null
; then
1043 if test -z "$have_echo"; then
1044 if (alias echo=bsd_echo
) 2>/dev
/null
; then
1045 unalias echo 2>/dev
/null
1048 # For Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh.
1049 if test -z "$have_echo" \
1050 && test "X$1" != "X--no-reexec" \
1051 && test -f /bin
/ksh
; then
1052 exec /bin
/ksh
"$0" --no-reexec "$@"
1055 # Otherwise: respawn using /bin/sh.
1056 if test -z "$have_echo" \
1057 && test "X$1" != "X--no-reexec" \
1058 && test -f /bin
/sh
; then
1059 exec /bin
/sh
"$0" --no-reexec "$@"
1062 if test -z "$have_echo"; then
1063 func_fatal_error
"Shell does not support 'echo' correctly. Please install GNU bash and set the environment variable CONFIG_SHELL to point to it."
1065 if echo '\t' |
grep t
> /dev
/null
; then
1068 func_fatal_error
"Shell does not support 'echo' correctly. Workaround does not work. Please report this as a bug to bug-gnulib@gnu.org."
1070 if test "X$1" = "X--no-reexec"; then
1074 # Unset CDPATH. Otherwise, output from 'cd dir' can surprise callers.
1075 (unset CDPATH
) >/dev
/null
2>&1 && unset CDPATH
1077 # Determine the path separator early because the following option parsing code
1079 func_determine_path_separator
1081 # Command-line option processing.
1082 # Removes the OPTIONS from the arguments. Sets the variables:
1083 # - mode one of: list, find, import, add-import, remove-import,
1084 # update, create-testdir, create-megatestdir, test, megatest,
1086 # - destdir from --dir
1087 # - local_gnulib_path from --local-dir, highest priority dir comes first
1088 # - modcache true or false, from --cache-modules/--no-cache-modules
1089 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
1090 # - libname, supplied_libname from --lib
1091 # - sourcebase from --source-base
1092 # - m4base from --m4-base
1093 # - pobase from --po-base
1094 # - docbase from --doc-base
1095 # - testsbase from --tests-base
1096 # - auxdir from --aux-dir
1097 # - inctests true if --with-tests was given, false if --without-tests
1098 # was given, blank otherwise
1099 # - incobsolete true if --with-obsolete was given, blank otherwise
1100 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
1101 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
1103 # - inc_privileged_tests true if --with-privileged-tests was given, blank
1105 # - inc_unportable_tests true if --with-unportable-tests was given, blank
1107 # - inc_all_tests true if --with-all-tests was given, blank otherwise
1108 # - excl_cxx_tests true if --without-c++-tests was given, blank otherwise
1109 # - excl_longrunning_tests true if --without-longrunning-tests was given,
1111 # - excl_privileged_tests true if --without-privileged-tests was given, blank
1113 # - excl_unportable_tests true if --without-unportable-tests was given, blank
1115 # - single_configure true if --single-configure was given, false otherwise
1116 # - avoidlist list of modules to avoid, from --avoid
1117 # - cond_dependencies true if --conditional-dependencies was given, false if
1118 # --no-conditional-dependencies was given, blank otherwise
1119 # - lgpl yes or a number if --lgpl was given, blank otherwise
1120 # - gnu_make true if --gnu-make was given, false otherwise
1121 # - makefile_name from --makefile-name
1122 # - tests_makefile_name from --tests-makefile-name
1123 # - automake_subdir true if --automake-subdir was given, false otherwise
1124 # - automake_subdir_tests true if --automake-subdir-tests was given, false otherwise
1125 # - libtool true if --libtool was given, false if --no-libtool was
1126 # given, blank otherwise
1127 # - macro_prefix from --macro-prefix
1128 # - po_domain from --po-domain
1129 # - witness_c_macro from --witness-c-macro
1130 # - vc_files true if --vc-files was given, false if --no-vc-files was
1131 # given, blank otherwise
1132 # - autoconf_minversion minimum supported autoconf version
1133 # - doit : if actions shall be executed, false if only to be printed
1134 # - copymode symlink if --symlink or --more-symlinks was given,
1135 # hardlink if --hardlink or --more-hardlinks was given,
1137 # - lcopymode symlink if --local-symlink was given,
1138 # hardlink if --local-hardlink was given,
1157 inc_longrunning_tests
=
1158 inc_privileged_tests
=
1159 inc_unportable_tests
=
1162 excl_longrunning_tests
=
1163 excl_privileged_tests
=
1164 excl_unportable_tests
=
1165 single_configure
=false
1171 tests_makefile_name
=
1172 automake_subdir
=false
1173 automake_subdir_tests
=false
1183 while test $# -gt 0; do
1188 --find |
--fin |
--fi |
--f )
1191 --import |
--impor |
--impo |
--imp |
--im |
--i )
1194 --add-import |
--add-impor |
--add-impo |
--add-imp |
--add-im |
--add-i |
--add- |
--add |
--ad )
1197 --remove-import |
--remove-impor |
--remove-impo |
--remove-imp |
--remove-im |
--remove-i |
--remove- |
--remove |
--remov |
--remo |
--rem |
--re |
--r )
1200 --update |
--updat |
--upda |
--upd |
--up |
--u )
1203 --create-testdir |
--create-testdi |
--create-testd |
--create-test |
--create-tes |
--create-te |
--create-t )
1206 --create-megatestdir |
--create-megatestdi |
--create-megatestd |
--create-megatest |
--create-megates |
--create-megate |
--create-megat |
--create-mega |
--create-meg |
--create-me |
--create-m )
1207 mode
=create-megatestdir
1209 --test |
--tes |
--te |
--t )
1212 --megatest |
--megates |
--megate |
--megat |
--mega |
--meg |
--me |
--m )
1216 mode
=`echo "X$1" | sed -e 's/^X--//'`
1218 --copy-file |
--copy-fil |
--copy-fi |
--copy-f |
--copy- |
--copy |
--cop )
1223 if test $# = 0; then
1224 func_fatal_error
"missing argument for --dir"
1229 destdir
=`echo "X$1" | sed -e 's/^X--dir=//'`
1233 if test $# = 0; then
1234 func_fatal_error
"missing argument for --local-dir"
1236 func_path_append local_gnulib_path
"$1"
1239 local_dir
=`echo "X$1" | sed -e 's/^X--local-dir=//'`
1240 func_path_append local_gnulib_path
"$local_dir"
1242 --cache-modules |
--cache-module |
--cache-modul |
--cache-modu |
--cache-mod |
--cache-mo |
--cache-m |
--cache- |
--cache |
--cach |
--cac |
--ca )
1245 --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 )
1248 --verbose |
--verbos |
--verbo |
--verb )
1249 verbose
=`expr $verbose + 1`
1251 --quiet |
--quie |
--qui |
--qu |
--q )
1252 verbose
=`expr $verbose - 1`
1256 if test $# = 0; then
1257 func_fatal_error
"missing argument for --lib"
1260 supplied_libname
=true
1263 libname
=`echo "X$1" | sed -e 's/^X--lib=//'`
1264 supplied_libname
=true
1268 if test $# = 0; then
1269 func_fatal_error
"missing argument for --source-base"
1274 sourcebase
=`echo "X$1" | sed -e 's/^X--source-base=//'`
1278 if test $# = 0; then
1279 func_fatal_error
"missing argument for --m4-base"
1284 m4base
=`echo "X$1" | sed -e 's/^X--m4-base=//'`
1288 if test $# = 0; then
1289 func_fatal_error
"missing argument for --po-base"
1294 pobase
=`echo "X$1" | sed -e 's/^X--po-base=//'`
1298 if test $# = 0; then
1299 func_fatal_error
"missing argument for --doc-base"
1304 docbase
=`echo "X$1" | sed -e 's/^X--doc-base=//'`
1308 if test $# = 0; then
1309 func_fatal_error
"missing argument for --tests-base"
1314 testsbase
=`echo "X$1" | sed -e 's/^X--tests-base=//'`
1318 if test $# = 0; then
1319 func_fatal_error
"missing argument for --aux-dir"
1324 auxdir
=`echo "X$1" | sed -e 's/^X--aux-dir=//'`
1326 --with-tests |
--with-test |
--with-tes |
--with-te |
--with-t)
1329 --with-obsolete |
--with-obsolet |
--with-obsole |
--with-obsol |
--with-obso |
--with-obs |
--with-ob |
--with-o)
1332 --with-c++-tests |
--with-c++-test |
--with-c++-tes |
--with-c++-te |
--with-c++-t |
--with-c++- |
--with-c++ |
--with-c+ |
--with-c)
1335 --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)
1336 inc_longrunning_tests
=true
1338 --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)
1339 inc_privileged_tests
=true
1341 --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)
1342 inc_unportable_tests
=true
1344 --with-all-tests |
--with-all-test |
--with-all-tes |
--with-all-te |
--with-all-t |
--with-all- |
--with-all |
--with-al |
--with-a)
1347 --without-tests |
--without-test |
--without-tes |
--without-te |
--without-t)
1350 --without-c++-tests |
--without-c++-test |
--without-c++-tes |
--without-c++-te |
--without-c++-t |
--without-c++- |
--without-c++ |
--without-c+ |
--without-c)
1353 --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)
1354 excl_longrunning_tests
=true
1356 --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)
1357 excl_privileged_tests
=true
1359 --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)
1360 excl_unportable_tests
=true
1362 --single-configure |
--single-configur |
--single-configu |
--single-config |
--single-confi |
--single-conf |
--single-con |
--single-co |
--single-c |
--single- |
--single |
--singl |
--sing |
--sin |
--si)
1363 single_configure
=true
1367 if test $# = 0; then
1368 func_fatal_error
"missing argument for --avoid"
1370 func_append avoidlist
" $1"
1373 arg
=`echo "X$1" | sed -e 's/^X--avoid=//'`
1374 func_append avoidlist
" $arg"
1376 --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)
1377 cond_dependencies
=true
1379 --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)
1380 cond_dependencies
=false
1386 arg
=`echo "X$1" | sed -e 's/^X--lgpl=//'`
1388 2 |
3orGPLv2 |
3) ;;
1389 *) func_fatal_error
"invalid LGPL version number for --lgpl" ;;
1398 if test $# = 0; then
1399 func_fatal_error
"missing argument for --makefile-name"
1404 makefile_name
=`echo "X$1" | sed -e 's/^X--makefile-name=//'`
1406 --tests-makefile-name )
1408 if test $# = 0; then
1409 func_fatal_error
"missing argument for --tests-makefile-name"
1411 tests_makefile_name
="$1"
1413 --tests-makefile-name=* )
1414 tests_makefile_name
=`echo "X$1" | sed -e 's/^X--tests-makefile-name=//'`
1417 automake_subdir
=true
1419 --automake-subdir-tests )
1420 automake_subdir_tests
=true
1430 if test $# = 0; then
1431 func_fatal_error
"missing argument for --macro-prefix"
1436 macro_prefix
=`echo "X$1" | sed -e 's/^X--macro-prefix=//'`
1440 if test $# = 0; then
1441 func_fatal_error
"missing argument for --po-domain"
1446 po_domain
=`echo "X$1" | sed -e 's/^X--po-domain=//'`
1450 if test $# = 0; then
1451 func_fatal_error
"missing argument for --witness-c-macro"
1453 witness_c_macro
="$1"
1455 --witness-c-macro=* )
1456 witness_c_macro
=`echo "X$1" | sed -e 's/^X--witness-c-macro=//'`
1464 --no-changelog |
--no-changelo |
--no-changel |
--no-change |
--no-chang |
--no-chan |
--no-cha |
--no-ch )
1465 # A no-op for backward compatibility.
1470 -s |
--symbolic |
--symboli |
--symbol |
--symbo |
--symb |
--symlink |
--symlin |
--symli |
--syml |
--sym |
--sy )
1473 --local-symlink |
--local-symlin |
--local-symli |
--local-syml |
--local-sym |
--local-sy |
--local-s )
1476 -h |
--hardlink |
--hardlin |
--hardli |
--hardl |
--hard |
--har |
--ha )
1479 --local-hardlink |
--local-hardlin |
--local-hardli |
--local-hardl |
--local-hard |
--local-har |
--local-ha |
--local-h )
1482 -S |
--more-symlinks |
--more-symlink |
--more-symlin |
--more-symli |
--more-syml |
--more-sym |
--more-sy |
--more-s )
1485 -H |
--more-hardlinks |
--more-hardlink |
--more-hardlin |
--more-hardli |
--more-hardl |
--more-hard |
--more-har |
--more-ha |
--more-h )
1488 --help |
--hel |
--he )
1491 --version |
--versio |
--versi |
--vers )
1495 # Stop option processing
1499 echo "gnulib-tool: unknown option $1" 1>&2
1500 echo "Try 'gnulib-tool --help' for more information." 1>&2
1507 if case "$mode" in import | add-import | remove-import
) true
;; *) false
;; esac; then
1508 if test -n "$excl_cxx_tests" ||
test -n "$excl_longrunning_tests" \
1509 ||
test -n "$excl_privileged_tests" ||
test -n "$excl_unportable_tests" \
1510 ||
test "$single_configure" != false
; then
1511 echo "gnulib-tool: invalid options for '$mode' mode" 1>&2
1512 echo "Try 'gnulib-tool --help' for more information." 1>&2
1516 if test "$mode" = update
; then
1517 if test $# != 0; then
1518 echo "gnulib-tool: too many arguments in 'update' mode" 1>&2
1519 echo "Try 'gnulib-tool --help' for more information." 1>&2
1520 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1521 echo "you need to use 'gnulib-tool --import' - at your own risk!" 1>&2
1524 if test -n "$local_gnulib_path" ||
test -n "$supplied_libname" \
1525 ||
test -n "$sourcebase" ||
test -n "$m4base" ||
test -n "$pobase" \
1526 ||
test -n "$docbase" ||
test -n "$testsbase" ||
test -n "$auxdir" \
1527 ||
test -n "$inctests" ||
test -n "$incobsolete" \
1528 ||
test -n "$inc_cxx_tests" ||
test -n "$inc_longrunning_tests" \
1529 ||
test -n "$inc_privileged_tests" ||
test -n "$inc_unportable_tests" \
1530 ||
test -n "$inc_all_tests" \
1531 ||
test -n "$excl_cxx_tests" ||
test -n "$excl_longrunning_tests" \
1532 ||
test -n "$excl_privileged_tests" ||
test -n "$excl_unportable_tests" \
1533 ||
test -n "$avoidlist" ||
test -n "$lgpl" ||
test -n "$makefile_name" \
1534 ||
test -n "$tests_makefile_name" ||
test "$automake_subdir" != false \
1535 ||
test "$automake_subdir_tests" != false \
1536 ||
test -n "$macro_prefix" ||
test -n "$po_domain" \
1537 ||
test -n "$witness_c_macro" ||
test -n "$vc_files"; then
1538 echo "gnulib-tool: invalid options for 'update' mode" 1>&2
1539 echo "Try 'gnulib-tool --help' for more information." 1>&2
1540 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1541 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1545 if test -n "$pobase" && test -z "$po_domain"; then
1546 echo "gnulib-tool: together with --po-base, you need to specify --po-domain" 1>&2
1547 echo "Try 'gnulib-tool --help' for more information." 1>&2
1550 if test -z "$pobase" && test -n "$po_domain"; then
1551 func_warning
"--po-domain has no effect without a --po-base option"
1553 case $mode,$gnu_make in
1555 echo "gnulib-tool: --gnu-make not supported when including tests"
1558 # Canonicalize the inctests variable.
1560 import | add-import | remove-import | update
)
1561 if test -z "$inctests"; then
1565 create-testdir | create-megatestdir |
test | megatest
)
1566 if test -z "$inctests"; then
1571 # Now the only possible values of "$inctests" are true and false
1572 # (or blank but then it is irrelevant).
1574 # Determine the minimum supported autoconf version from the project's
1576 DEFAULT_AUTOCONF_MINVERSION
="2.64"
1577 autoconf_minversion
=
1579 if case "$mode" in import | add-import | remove-import | update
) true
;; *) false
;; esac \
1580 && test -n "$destdir"; then
1581 if test -f "$destdir"/configure.ac
; then
1582 configure_ac
="$destdir/configure.ac"
1584 if test -f "$destdir"/configure.
in; then
1585 configure_ac
="$destdir/configure.in"
1589 if test -f configure.ac
; then
1590 configure_ac
="configure.ac"
1592 if test -f configure.
in; then
1593 configure_ac
="configure.in"
1597 if test -n "$configure_ac"; then
1598 # Use sed, not autoconf --trace, to look for the AC_PREREQ invocation,
1599 # because when some m4 files are omitted from a version control repository,
1600 # "autoconf --trace=AC_PREREQ" fails with an error message like this:
1601 # m4: aclocal.m4:851: Cannot open m4/absolute-header.m4: No such file or directory
1602 # autom4te: m4 failed with exit status: 1
1608 s,^.*AC_PREREQ([[ ]*\([^])]*\).*$,\1,p
1610 prereqs
=`sed -n -e "$my_sed_traces" < "$configure_ac"`
1611 if test -n "$prereqs"; then
1612 autoconf_minversion
=`
1613 for version in $prereqs; do echo $version; done |
1614 LC_ALL=C sort -nru | sed -e 1q
1618 if test -z "$autoconf_minversion"; then
1619 autoconf_minversion
=$DEFAULT_AUTOCONF_MINVERSION
1621 case "$autoconf_minversion" in
1622 1.
* |
2.
[0-5]* |
2.6[0-3]*)
1623 func_fatal_error
"minimum supported autoconf version is 2.64. Try adding AC_PREREQ([$DEFAULT_AUTOCONF_MINVERSION]) to your configure.ac." ;;
1626 # Determine whether --automake-subdir/--automake-subdir-tests are supported.
1627 if $automake_subdir ||
$automake_subdir_tests; then
1628 found_subdir_objects
=false
1629 if test -n "$configure_ac"; then
1634 /AM_INIT_AUTOMAKE/ {
1635 s,^.*AM_INIT_AUTOMAKE([[ ]*\([^])]*\).*$,\1,p
1637 automake_options
=`sed -n -e "$my_sed_traces" < "$configure_ac"`
1638 for option
in $automake_options; do
1640 subdir-objects
) found_subdir_objects
=true
;;
1644 if test -f "${destdir:-.}"/Makefile.am
; then
1645 automake_options
=`sed -n -e 's/^AUTOMAKE_OPTIONS[ ]*=\(.*\)$/\1/p' "${destdir:-.}"/Makefile.am`
1646 for option
in $automake_options; do
1648 subdir-objects
) found_subdir_objects
=true
;;
1652 if ! $found_subdir_objects; then
1653 func_fatal_error
"Option --automake-subdir/--automake-subdir-tests are only supported if the definition of AUTOMAKE_OPTIONS in Makefile.am contains 'subdir-objects'."
1657 # Remove trailing slashes from the directory names. This is necessary for
1658 # m4base (to avoid an error in func_import) and optional for the others.
1659 sed_trimtrailingslashes
='s,\([^/]\)//*$,\1,'
1660 old_local_gnulib_path
="$local_gnulib_path"
1664 for dir
in $old_local_gnulib_path
1668 */ ) dir
=`echo "$dir" | sed -e "$sed_trimtrailingslashes"` ;;
1670 func_path_append local_gnulib_path
"$dir"
1673 case "$sourcebase" in
1674 */ ) sourcebase
=`echo "$sourcebase" | sed -e "$sed_trimtrailingslashes"` ;;
1677 */ ) m4base
=`echo "$m4base" | sed -e "$sed_trimtrailingslashes"` ;;
1680 */ ) pobase
=`echo "$pobase" | sed -e "$sed_trimtrailingslashes"` ;;
1683 */ ) docbase
=`echo "$docbase" | sed -e "$sed_trimtrailingslashes"` ;;
1685 case "$testsbase" in
1686 */ ) testsbase
=`echo "$testsbase" | sed -e "$sed_trimtrailingslashes"` ;;
1689 */ ) auxdir
=`echo "$auxdir" | sed -e "$sed_trimtrailingslashes"` ;;
1695 trap 'exit_status=$?
1696 if test "$signal" != EXIT; then
1697 echo "caught signal SIG$signal" >&2
1700 exit $exit_status' EXIT
1701 for signal
in HUP INT QUIT PIPE TERM
; do
1702 trap '{ signal='$signal'; func_exit 1; }' $signal
1706 # Note: The 'eval' silences stderr output in dash.
1707 if (declare -A x
&& { x
[f
/2]='foo'; x
[f
/3]='bar'; eval test '${x[f/2]}' = foo
; }) 2>/dev
/null
; then
1708 # Zsh 4 and Bash 4 have associative arrays.
1709 have_associative
=true
1711 # For other shells, use 'eval' with computed shell variable names.
1712 have_associative
=false
1715 # func_lookup_local_file_cb dir file
1716 # returns true and sets func_lookup_local_file_result if the file $dir/$file
1718 func_lookup_local_file_cb
()
1720 test -n "$func_lookup_local_file_result" && return 1 # already found?
1721 test -f "$1/$2" ||
return 1
1722 func_lookup_local_file_result
=$1/$2
1726 # func_lookup_local_file file
1727 # looks up a file in $local_gnulib_path.
1729 # - local_gnulib_path from --local-dir
1731 # - func_lookup_local_file_result name of the file, valid only when the
1732 # function succeeded.
1733 func_lookup_local_file
()
1735 func_lookup_local_file_result
=
1736 func_path_foreach
"$local_gnulib_path" func_lookup_local_file_cb
%dir
% "$1"
1739 # func_lookup_file_cb dir
1740 # does one step in processing the $local_gnulib_path, looking for $dir/$lkfile
1741 # and $dir/$lkfile.diff.
1742 func_lookup_file_cb
()
1744 # If we found the file already in a --local-dir of higher priority, nothing
1746 if test -z "$lookedup_file"; then
1747 # Otherwise, look for $dir/$lkfile and $dir/$lkfile.diff.
1748 if test -f "$1/$lkfile"; then
1749 lookedup_file
="$1/$lkfile"
1751 if test -f "$1/$lkfile.diff"; then
1752 lkpatches
="$1/$lkfile.diff${lkpatches:+$PATH_SEPARATOR$lkpatches}"
1758 # func_lookup_file file
1759 # looks up a file in $local_gnulib_path or $gnulib_dir, or combines it through
1762 # - local_gnulib_path from --local-dir
1764 # - lookedup_file name of the merged (combined) file
1765 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
1769 # Each element in $local_gnulib_path is a directory whose contents overrides
1770 # or amends the result of the lookup in the rest of $local_gnulib_path and
1771 # $gnulib_dir. So, the first element of $local_gnulib_path is the highest
1775 func_path_foreach
"$local_gnulib_path" func_lookup_file_cb
%dir
%
1776 # Treat $gnulib_dir like a lowest-priority --local-dir, except that here we
1777 # don't look for .diff files.
1778 if test -z "$lookedup_file"; then
1779 if test -f "$gnulib_dir/$lkfile"; then
1780 lookedup_file
="$gnulib_dir/$lkfile"
1782 func_fatal_error
"file $gnulib_dir/$lkfile not found"
1785 # Now apply the patches, from lowest-priority to highest-priority.
1787 if test -n "$lkpatches"; then
1788 lkbase
=`echo "$lkfile" | sed -e 's,^.*/,,'`
1789 rm -f "$tmp/$lkbase"
1790 cp "$lookedup_file" "$tmp/$lkbase"
1791 func_ensure_writable
"$tmp/$lkbase"
1793 IFS
="$PATH_SEPARATOR"
1794 for patchfile
in $lkpatches; do
1796 patch -s "$tmp/$lkbase" < "$patchfile" >&2 \
1797 || func_fatal_error
"patch file $patchfile didn't apply cleanly"
1800 lookedup_file
="$tmp/$lkbase"
1805 # func_sanitize_modulelist
1806 # receives a list of possible module names on standard input, one per line.
1807 # It removes those which are just file names unrelated to modules, and outputs
1808 # the resulting list to standard output, one per line.
1809 func_sanitize_modulelist
()
1811 sed -e '/^ChangeLog$/d' -e '/\/ChangeLog$/d' \
1812 -e '/^COPYING$/d' -e '/\/COPYING$/d' \
1813 -e '/^README$/d' -e '/\/README$/d' \
1814 -e '/^TEMPLATE$/d' \
1815 -e '/^TEMPLATE-EXTENDED$/d' \
1816 -e '/^TEMPLATE-TESTS$/d' \
1824 # func_modules_in_dir dir
1825 # outputs all module files in dir to standard output.
1826 func_modules_in_dir
()
1828 (test -d "$1" && cd "$1" && find modules
-type f
-print)
1833 # - local_gnulib_path from --local-dir
1836 # Filter out metainformation files like README, which are not modules.
1837 # Filter out unit test modules; they can be retrieved through
1838 # --extract-tests-module if desired.
1840 (cd "$gnulib_dir" && find modules
-type f
-print |
sed -e 's,^modules/,,')
1841 func_path_foreach
"$local_gnulib_path" func_modules_in_dir
%dir
% |
sed -e 's,^modules/,,' -e 's,\.diff$,,'
1843 | func_sanitize_modulelist \
1844 |
sed -e '/-tests$/d' \
1848 # func_exists_local_module dir module
1849 # returns true if module exists in dir
1850 func_exists_local_module
()
1852 test -d "$1/modules" && test -f "$1/modules/$2";
1855 # func_exists_module module
1856 # tests whether a module, given by name, exists
1858 # - local_gnulib_path from --local-dir
1859 func_exists_module
()
1861 { test -f "$gnulib_dir/modules/$1" \
1862 || func_path_foreach
"$local_gnulib_path" func_exists_local_module
%dir
% "$1" ; } \
1863 && test "ChangeLog" != "$1" \
1864 && test "COPYING" != "$1" \
1865 && test "README" != "$1" \
1866 && test "TEMPLATE" != "$1" \
1867 && test "TEMPLATE-EXTENDED" != "$1" \
1868 && test "TEMPLATE-TESTS" != "$1"
1871 # func_verify_module
1872 # verifies a module name
1874 # - local_gnulib_path from --local-dir
1875 # - module module name argument
1877 # - module unchanged if OK, empty if not OK
1878 # - lookedup_file if OK: name of the merged (combined) module description file
1879 # - lookedup_tmp if OK: true if it is located in the tmp directory, blank otherwise
1880 func_verify_module
()
1882 if func_exists_module
"$module"; then
1883 # OK, $module is a correct module name.
1884 # Verify that building the module description with 'patch' succeeds.
1885 func_lookup_file
"modules/$module"
1887 func_warning
"module $module doesn't exist"
1892 # func_verify_nontests_module
1893 # verifies a module name, excluding tests modules
1895 # - local_gnulib_path from --local-dir
1896 # - module module name argument
1897 func_verify_nontests_module
()
1900 *-tests ) module
= ;;
1901 * ) func_verify_module
;;
1905 # Suffix of a sed expression that extracts a particular field from a
1906 # module description.
1907 # A field starts with a line that contains a keyword, such as 'Description',
1908 # followed by a colon and optional whitespace. All following lines, up to
1909 # the next field (or end of file if there is none) form the contents of the
1911 # An absent field is equivalent to a field with empty contents.
1912 # NOTE: Keep this in sync with sed_extract_cache_prog below!
1913 sed_extract_prog
=':[ ]*$/ {
1916 s/^Description:[ ]*$//
1920 s/^Applicability:[ ]*$//
1922 s/^Depends-on:[ ]*$//
1923 s/^configure\.ac-early:[ ]*$//
1924 s/^configure\.ac:[ ]*$//
1925 s/^Makefile\.am:[ ]*$//
1929 s/^Maintainer:[ ]*$//
1936 # Piece of a sed expression that converts a field header line to a shell
1938 # NOTE: Keep this in sync with sed_extract_prog above!
1939 sed_extract_field_header
='
1940 s/^Description:[ ]*$/description/
1941 s/^Comment:[ ]*$/comment/
1942 s/^Status:[ ]*$/status/
1943 s/^Notice:[ ]*$/notice/
1944 s/^Applicability:[ ]*$/applicability/
1945 s/^Files:[ ]*$/files/
1946 s/^Depends-on:[ ]*$/dependson/
1947 s/^configure\.ac-early:[ ]*$/configureac_early/
1948 s/^configure\.ac:[ ]*$/configureac/
1949 s/^Makefile\.am:[ ]*$/makefile/
1950 s/^Include:[ ]*$/include/
1952 s/^License:[ ]*$/license/
1953 s/^Maintainer:[ ]*$/maintainer/'
1957 if $have_associative; then
1959 # Declare the associative arrays.
1960 declare -A modcache_cached
1961 sed_to_declare_statement
='s|^.*/\([a-zA-Z0-9_]*\)/$|declare -A modcache_\1|p'
1962 declare_script
=`echo "$sed_extract_field_header" | sed -n -e "$sed_to_declare_statement"`
1963 eval "$declare_script"
1967 # func_cache_var module
1968 # computes the cache variable name corresponding to $module.
1969 # Note: This computation can map different module names to the same
1970 # cachevar (such as 'foo-bar', 'foo_bar', or 'foo/bar'); the caller has
1971 # to protect against this case.
1973 # - cachevar a shell variable name
1974 if (f
=foo
; eval echo '${f//o/e}') < /dev
/null
2>/dev
/null |
grep fee
>/dev
/null
; then
1975 # Bash 2.0 and newer, ksh, and zsh support the syntax
1976 # ${param//pattern/replacement}
1977 # as a shorthand for
1978 # `echo "$param" | sed -e "s/pattern/replacement/g"`.
1979 # Note: The 'eval' is necessary for dash and NetBSD /bin/sh.
1980 eval 'func_cache_var ()
1982 cachevar=c_${1//[!a-zA-Z0-9_]/_}
1989 cachevar
=c_
`echo "$1" | LC_ALL=C sed -e 's/[^a-zA-Z0-9_]/_/g'` ;;
1998 # func_init_sed_convert_to_cache_statements
2000 # - modcachevar_assignment
2002 # - sed_convert_to_cache_statements
2003 func_init_sed_convert_to_cache_statements
()
2005 # 'sed' script that turns a module description into shell script
2006 # assignments, suitable to be eval'ed. All active characters are escaped.
2009 # Some module's description
2014 # modcache_description[$1]=\
2015 # 'Some module'"'"'s description
2017 # modcache_files[$1]=\
2020 # c_MODULE_description_set=set; c_MODULE_description=\
2021 # 'Some module'"'"'s description
2023 # c_MODULE_files_set=set; c_MODULE_files=\
2025 # The script consists of two parts:
2026 # 1) Ignore the lines before the first field header.
2027 # 2) A loop, treating non-field-header lines by escaping single quotes
2028 # and adding a closing quote in the last line,
2029 sed_convert_to_cache_statements
="
2031 # Here we have not yet seen a field header.
2033 # See if the current line contains a field header.
2036 ${sed_extract_field_header}
2039 # No field header. Ignore the line.
2041 # Read the next line. Upon EOF, just exit.
2046 # The current line contains a field header.
2048 # Turn it into the beginning of an assignment.
2049 s/^\\(.*\\)\$/${modcachevar_assignment}\\\\/
2051 # Move it to the hold space. Don't print it yet,
2052 # because we want no assignment if the field is empty.
2055 # Read the next line.
2056 # Upon EOF, the field was empty. Print no assignment. Just exit.
2059 # See if the current line contains a field header.
2062 ${sed_extract_field_header}
2063 # If it is, the previous field was empty. Print no assignment.
2066 # Not a field header.
2068 # Print the previous line, held in the hold space.
2073 # Transform single quotes.
2076 # Prepend a single quote.
2081 # Move it to the hold space.
2084 # Read the next line.
2091 # See if the current line contains a field header.
2094 ${sed_extract_field_header}
2097 # Print the previous line, held in the hold space.
2102 # Transform single quotes.
2109 # Print the previous line, held in the hold space, with a single quote
2110 # to end the assignment.
2120 # Print the previous line, held in the hold space, with a single quote
2121 # to end the assignment.
2128 if ! $sed_comments; then
2130 sed_convert_to_cache_statements
=`echo "$sed_convert_to_cache_statements" \
2131 | sed -e 's/^ *//' -e 's/^#.*//'`
2135 if $have_associative; then
2136 # sed_convert_to_cache_statements does not depend on the module.
2137 modcachevar_assignment
='modcache_\1[$1]='
2138 func_init_sed_convert_to_cache_statements
2141 # func_cache_lookup_module module
2143 # looks up a module, like 'func_lookup_file modules/$module', and stores all
2144 # of its relevant data in a cache in the memory of the processing shell. If
2145 # already cached, it does not look it up again, thus saving file access time.
2147 # - module non-empty string
2148 # Output if $have_associative:
2149 # - modcache_cached[$module] set to yes
2150 # - modcache_description[$module] ==
2151 # - modcache_status[$module] \ set to the field's value, minus the
2152 # - ... / final newline,
2153 # - modcache_maintainer[$module] == or unset if the field's value is empty
2154 # Output if ! $have_associative:
2155 # - cachevar a shell variable name
2156 # - ${cachevar}_cached set to $module
2157 # - ${cachevar}_description ==
2158 # - ${cachevar}_status \ set to the field's value, minus the
2159 # - ... / final newline,
2160 # - ${cachevar}_maintainer == or unset if the field's value is empty
2161 # - ${cachevar}_description_set ==
2162 # - ${cachevar}_status_set \ set to non-empty if the field's value
2163 # - ... / is non-empty,
2164 # - ${cachevar}_maintainer_set == or unset if the field's value is empty
2165 func_cache_lookup_module
()
2167 if $have_associative; then
2168 eval 'cached=${modcache_cached[$1]}'
2171 eval "cached=\"\$${cachevar}_cached\""
2173 if test -z "$cached"; then
2174 # Not found in cache. Look it up on the file system.
2175 func_lookup_file
"modules/$1"
2176 if $have_associative; then
2177 eval 'modcache_cached[$1]=yes'
2179 eval "${cachevar}_cached=\"\$1\""
2181 if ! $have_associative; then
2182 # sed_convert_to_cache_statements depends on the module.
2183 modcachevar_assignment
="${cachevar}"'_\1_set=set; '"${cachevar}"'_\1='
2184 func_init_sed_convert_to_cache_statements
2186 cache_statements
=`LC_ALL=C sed -n -e "$sed_convert_to_cache_statements" < "$lookedup_file"`
2187 eval "$cache_statements"
2189 if ! $have_associative; then
2190 if test "$1" != "$cached"; then
2191 func_fatal_error
"cache variable collision between $1 and $cached"
2199 # func_get_description module
2201 # - local_gnulib_path from --local-dir
2202 # - modcache true or false, from --cache-modules/--no-cache-modules
2203 func_get_description
()
2205 if ! $modcache; then
2206 func_lookup_file
"modules/$1"
2207 sed -n -e "/^Description$sed_extract_prog" < "$lookedup_file"
2209 func_cache_lookup_module
"$1"
2210 # Output the field's value, including the final newline (if any).
2211 if $have_associative; then
2212 if eval 'test -n "${modcache_description[$1]+set}"'; then
2213 eval 'echo "${modcache_description[$1]}"'
2216 eval "field_set=\"\$${cachevar}_description_set\""
2217 if test -n "$field_set"; then
2218 eval "field_value=\"\$${cachevar}_description\""
2219 echo "${field_value}"
2225 # func_get_comment module
2227 # - local_gnulib_path from --local-dir
2228 # - modcache true or false, from --cache-modules/--no-cache-modules
2231 if ! $modcache; then
2232 func_lookup_file
"modules/$1"
2233 sed -n -e "/^Comment$sed_extract_prog" < "$lookedup_file"
2235 func_cache_lookup_module
"$1"
2236 # Output the field's value, including the final newline (if any).
2237 if $have_associative; then
2238 if eval 'test -n "${modcache_comment[$1]+set}"'; then
2239 eval 'echo "${modcache_comment[$1]}"'
2242 eval "field_set=\"\$${cachevar}_comment_set\""
2243 if test -n "$field_set"; then
2244 eval "field_value=\"\$${cachevar}_comment\""
2245 echo "${field_value}"
2251 # func_get_status module
2253 # - local_gnulib_path from --local-dir
2254 # - modcache true or false, from --cache-modules/--no-cache-modules
2257 if ! $modcache; then
2258 func_lookup_file
"modules/$1"
2259 sed -n -e "/^Status$sed_extract_prog" < "$lookedup_file"
2261 func_cache_lookup_module
"$1"
2262 # Output the field's value, including the final newline (if any).
2263 if $have_associative; then
2264 if eval 'test -n "${modcache_status[$1]+set}"'; then
2265 eval 'echo "${modcache_status[$1]}"'
2268 eval "field_set=\"\$${cachevar}_status_set\""
2269 if test -n "$field_set"; then
2270 eval "field_value=\"\$${cachevar}_status\""
2271 echo "${field_value}"
2277 # func_get_notice module
2279 # - local_gnulib_path from --local-dir
2280 # - modcache true or false, from --cache-modules/--no-cache-modules
2283 if ! $modcache; then
2284 func_lookup_file
"modules/$1"
2285 sed -n -e "/^Notice$sed_extract_prog" < "$lookedup_file"
2287 func_cache_lookup_module
"$1"
2288 # Output the field's value, including the final newline (if any).
2289 if $have_associative; then
2290 if eval 'test -n "${modcache_notice[$1]+set}"'; then
2291 eval 'echo "${modcache_notice[$1]}"'
2294 eval "field_set=\"\$${cachevar}_notice_set\""
2295 if test -n "$field_set"; then
2296 eval "field_value=\"\$${cachevar}_notice\""
2297 echo "${field_value}"
2303 # func_get_applicability module
2305 # - local_gnulib_path from --local-dir
2306 # - modcache true or false, from --cache-modules/--no-cache-modules
2307 # The expected result (on stdout) is either 'main', or 'tests', or 'all'.
2308 func_get_applicability
()
2310 if ! $modcache; then
2311 func_lookup_file
"modules/$1"
2312 my_applicability
=`sed -n -e "/^Applicability$sed_extract_prog" < "$lookedup_file"`
2314 func_cache_lookup_module
"$1"
2315 # Get the field's value, without the final newline.
2316 if $have_associative; then
2317 eval 'my_applicability="${modcache_applicability[$1]}"'
2319 eval "my_applicability=\"\$${cachevar}_applicability\""
2322 if test -n "$my_applicability"; then
2323 echo $my_applicability
2325 # The default is 'main' or 'tests', depending on the module's name.
2327 *-tests) echo "tests";;
2333 # func_get_filelist module
2335 # - local_gnulib_path from --local-dir
2336 # - modcache true or false, from --cache-modules/--no-cache-modules
2337 func_get_filelist
()
2339 if ! $modcache; then
2340 func_lookup_file
"modules/$1"
2341 sed -n -e "/^Files$sed_extract_prog" < "$lookedup_file"
2343 func_cache_lookup_module
"$1"
2344 # Output the field's value, including the final newline (if any).
2345 if $have_associative; then
2346 if eval 'test -n "${modcache_files[$1]+set}"'; then
2347 eval 'echo "${modcache_files[$1]}"'
2350 eval "field_set=\"\$${cachevar}_files_set\""
2351 if test -n "$field_set"; then
2352 eval "field_value=\"\$${cachevar}_files\""
2353 echo "${field_value}"
2359 echo m
4/gnulib-common.
m4
2362 # func_filter_filelist outputvar separator filelist prefix suffix removed_prefix removed_suffix [added_prefix [added_suffix]]
2363 # stores in outputvar the filtered and processed filelist. Filtering: Only the
2364 # elements starting with prefix and ending with suffix are considered.
2365 # Processing: removed_prefix and removed_suffix are removed from each element,
2366 # added_prefix and added_suffix are added to each element.
2367 # prefix, suffix should not contain shell-special characters.
2368 # removed_prefix, removed_suffix should not contain the characters "$`\{}[]^|.
2369 # added_prefix, added_suffix should not contain the characters \|&.
2370 func_filter_filelist
()
2372 if test "$2" != "$nl" \
2373 ||
{ $fast_func_append \
2374 && { test -z "$6" ||
$fast_func_remove_prefix; } \
2375 && { test -z "$7" ||
$fast_func_remove_suffix; }; \
2379 # Do not quote possibly-empty parameters in case patterns,
2380 # AIX and HP-UX ksh won't match them if they are empty.
2383 if test -n "$6"; then
2384 func_remove_prefix fff
"$6"
2386 if test -n "$7"; then
2387 func_remove_suffix fff
"$7"
2390 if test -z "$ffflist"; then
2393 func_append ffflist
"$2${fff}"
2399 sed_fff_filter
="s|^$6\(.*\)$7\$|$8\\1$9|"
2400 ffflist
=`for fff in $3; do
2402 $4*$5) echo "$fff" ;;
2404 done | sed -e "$sed_fff_filter"`
2406 eval "$1=\"\$ffflist\""
2409 # func_get_dependencies module
2411 # - local_gnulib_path from --local-dir
2412 # - modcache true or false, from --cache-modules/--no-cache-modules
2413 func_get_dependencies
()
2415 # ${module}-tests implicitly depends on ${module}, if that module exists.
2419 func_remove_suffix fgd1
'-tests'
2420 if func_exists_module
"$fgd1"; then
2425 # Then the explicit dependencies listed in the module description.
2426 { if ! $modcache; then
2427 func_lookup_file
"modules/$1"
2428 sed -n -e "/^Depends-on$sed_extract_prog" < "$lookedup_file"
2430 func_cache_lookup_module
"$1"
2431 # Output the field's value, including the final newline (if any).
2432 if $have_associative; then
2433 if eval 'test -n "${modcache_dependson[$1]+set}"'; then
2434 eval 'echo "${modcache_dependson[$1]}"'
2437 eval "field_set=\"\$${cachevar}_dependson_set\""
2438 if test -n "$field_set"; then
2439 eval "field_value=\"\$${cachevar}_dependson\""
2440 echo "${field_value}"
2448 sed_dependencies_without_conditions
='s/ *\[.*//'
2450 # func_get_autoconf_early_snippet module
2452 # - local_gnulib_path from --local-dir
2453 # - modcache true or false, from --cache-modules/--no-cache-modules
2454 func_get_autoconf_early_snippet
()
2456 if ! $modcache; then
2457 func_lookup_file
"modules/$1"
2458 sed -n -e "/^configure\.ac-early$sed_extract_prog" < "$lookedup_file"
2460 func_cache_lookup_module
"$1"
2461 # Output the field's value, including the final newline (if any).
2462 if $have_associative; then
2463 if eval 'test -n "${modcache_configureac_early[$1]+set}"'; then
2464 eval 'echo "${modcache_configureac_early[$1]}"'
2467 eval "field_set=\"\$${cachevar}_configureac_early_set\""
2468 if test -n "$field_set"; then
2469 eval "field_value=\"\$${cachevar}_configureac_early\""
2470 echo "${field_value}"
2476 # func_get_autoconf_snippet module
2478 # - local_gnulib_path from --local-dir
2479 # - modcache true or false, from --cache-modules/--no-cache-modules
2480 func_get_autoconf_snippet
()
2482 if ! $modcache; then
2483 func_lookup_file
"modules/$1"
2484 sed -n -e "/^configure\.ac$sed_extract_prog" < "$lookedup_file"
2486 func_cache_lookup_module
"$1"
2487 # Output the field's value, including the final newline (if any).
2488 if $have_associative; then
2489 if eval 'test -n "${modcache_configureac[$1]+set}"'; then
2490 eval 'echo "${modcache_configureac[$1]}"'
2493 eval "field_set=\"\$${cachevar}_configureac_set\""
2494 if test -n "$field_set"; then
2495 eval "field_value=\"\$${cachevar}_configureac\""
2496 echo "${field_value}"
2502 # Concatenate lines with trailing slash.
2503 # $1 is an optional filter to restrict the
2504 # concatenation to groups starting with that expression
2506 sed -e "/$1.*"'\\$/{
2515 # func_get_automake_snippet_conditional module
2516 # returns the part of the Makefile.am snippet that can be put inside Automake
2519 # - local_gnulib_path from --local-dir
2520 # - modcache true or false, from --cache-modules/--no-cache-modules
2521 func_get_automake_snippet_conditional
()
2523 if ! $modcache; then
2524 func_lookup_file
"modules/$1"
2525 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
2527 func_cache_lookup_module
"$1"
2528 # Output the field's value, including the final newline (if any).
2529 if $have_associative; then
2530 if eval 'test -n "${modcache_makefile[$1]+set}"'; then
2531 eval 'echo "${modcache_makefile[$1]}"'
2534 eval "field_set=\"\$${cachevar}_makefile_set\""
2535 if test -n "$field_set"; then
2536 eval "field_value=\"\$${cachevar}_makefile\""
2537 echo "${field_value}"
2543 # func_get_automake_snippet_unconditional module
2544 # returns the part of the Makefile.am snippet that must stay outside of
2545 # Automake conditionals.
2547 # - local_gnulib_path from --local-dir
2548 # - modcache true or false, from --cache-modules/--no-cache-modules
2549 func_get_automake_snippet_unconditional
()
2553 # *-tests module live in tests/, not lib/.
2554 # Synthesize an EXTRA_DIST augmentation.
2555 all_files
=`func_get_filelist $1`
2556 func_filter_filelist tests_files
" " "$all_files" 'tests/' '' 'tests/' ''
2557 extra_files
="$tests_files"
2558 if test -n "$extra_files"; then
2559 echo "EXTRA_DIST +=" $extra_files
2564 # Synthesize an EXTRA_DIST augmentation.
2565 sed_extract_mentioned_files
='s/^lib_SOURCES[ ]*+=[ ]*//p'
2566 already_mentioned_files
=` \
2567 { if ! $modcache; then
2568 func_lookup_file "modules/$1"
2569 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
2571 func_cache_lookup_module "$1"
2572 if $have_associative; then
2573 if eval 'test -n "${modcache_makefile[$1]+set}"'; then
2574 eval 'echo "${modcache_makefile[$1]}"'
2577 eval 'field_set="$'"${cachevar}"'_makefile_set"'
2578 if test -n "$field_set"; then
2579 eval 'field_value="$'"${cachevar}"'_makefile"'
2580 echo "${field_value}"
2586 | sed -n -e "$sed_extract_mentioned_files" | sed -e 's/#.*//'`
2587 all_files
=`func_get_filelist $1`
2588 func_filter_filelist lib_files
"$nl" "$all_files" 'lib/' '' 'lib/' ''
2589 # Remove $already_mentioned_files from $lib_files.
2590 echo "$lib_files" | LC_ALL
=C
sort -u > "$tmp"/lib-files
2591 extra_files
=`for f in $already_mentioned_files; do echo $f; done \
2592 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/lib-files`
2593 if test -n "$extra_files"; then
2594 echo "EXTRA_DIST +=" $extra_files
2597 # Synthesize also an EXTRA_lib_SOURCES augmentation.
2598 # This is necessary so that automake can generate the right list of
2600 # A possible approach would be to use autom4te --trace of the redefined
2601 # AC_LIBOBJ and AC_REPLACE_FUNCS macros when creating the Makefile.am
2602 # (use autom4te --trace, not just grep, so that AC_LIBOBJ invocations
2603 # inside autoconf's built-in macros are not missed).
2604 # But it's simpler and more robust to do it here, based on the file list.
2605 # If some .c file exists and is not used with AC_LIBOBJ - for example,
2606 # a .c file is preprocessed into another .c file for BUILT_SOURCES -,
2607 # automake will generate a useless dependency; this is harmless.
2609 relocatable-prog-wrapper
) ;;
2612 func_filter_filelist extra_files
"$nl" "$extra_files" '' '.c' '' ''
2613 if test -n "$extra_files"; then
2614 echo "EXTRA_lib_SOURCES +=" $extra_files
2619 # Synthesize an EXTRA_DIST augmentation also for the files in build-aux/.
2620 func_filter_filelist buildaux_files
"$nl" "$all_files" 'build-aux/' '' 'build-aux/' ''
2621 if test -n "$buildaux_files"; then
2622 sed_prepend_auxdir
='s,^,$(top_srcdir)/'"$auxdir"'/,'
2623 echo "EXTRA_DIST += "`echo "$buildaux_files" | sed -e "$sed_prepend_auxdir"`
2630 # func_get_automake_snippet module
2632 # - local_gnulib_path from --local-dir
2633 # - modcache true or false, from --cache-modules/--no-cache-modules
2634 func_get_automake_snippet
()
2636 func_get_automake_snippet_conditional
"$1"
2637 func_get_automake_snippet_unconditional
"$1"
2640 # func_get_include_directive module
2642 # - local_gnulib_path from --local-dir
2643 # - modcache true or false, from --cache-modules/--no-cache-modules
2644 func_get_include_directive
()
2647 if ! $modcache; then
2648 func_lookup_file
"modules/$1"
2649 sed -n -e "/^Include$sed_extract_prog" < "$lookedup_file"
2651 func_cache_lookup_module
"$1"
2652 # Output the field's value, including the final newline (if any).
2653 if $have_associative; then
2654 if eval 'test -n "${modcache_include[$1]+set}"'; then
2655 eval 'echo "${modcache_include[$1]}"'
2658 eval "field_set=\"\$${cachevar}_include_set\""
2659 if test -n "$field_set"; then
2660 eval "field_value=\"\$${cachevar}_include\""
2661 echo "${field_value}"
2665 } |
sed -e 's/^\(["<]\)/#include \1/'
2668 # func_get_link_directive module
2670 # - local_gnulib_path from --local-dir
2671 # - modcache true or false, from --cache-modules/--no-cache-modules
2672 func_get_link_directive
()
2674 if ! $modcache; then
2675 func_lookup_file
"modules/$1"
2676 sed -n -e "/^Link$sed_extract_prog" < "$lookedup_file"
2678 func_cache_lookup_module
"$1"
2679 # Output the field's value, including the final newline (if any).
2680 if $have_associative; then
2681 if eval 'test -n "${modcache_link[$1]+set}"'; then
2682 eval 'echo "${modcache_link[$1]}"'
2685 eval "field_set=\"\$${cachevar}_link_set\""
2686 if test -n "$field_set"; then
2687 eval "field_value=\"\$${cachevar}_link\""
2688 echo "${field_value}"
2694 # func_get_license_raw module
2696 # - local_gnulib_path from --local-dir
2697 # - modcache true or false, from --cache-modules/--no-cache-modules
2698 func_get_license_raw
()
2700 if ! $modcache; then
2701 func_lookup_file
"modules/$1"
2702 sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
2704 func_cache_lookup_module
"$1"
2705 # Output the field's value, including the final newline (if any).
2706 if $have_associative; then
2707 if eval 'test -n "${modcache_license[$1]+set}"'; then
2708 eval 'echo "${modcache_license[$1]}"'
2711 eval "field_set=\"\$${cachevar}_license_set\""
2712 if test -n "$field_set"; then
2713 eval "field_value=\"\$${cachevar}_license\""
2714 echo "${field_value}"
2720 # func_get_license module
2722 # - local_gnulib_path from --local-dir
2723 # - modcache true or false, from --cache-modules/--no-cache-modules
2726 # Warn if the License field is missing.
2730 license
=`func_get_license_raw "$1"`
2731 if test -z "$license"; then
2732 func_warning
"module $1 lacks a License"
2738 # These modules are under a weaker license only for the purpose of some
2739 # users who hand-edit it and don't use gnulib-tool. For the regular
2740 # gnulib users they are under a stricter license.
2745 func_get_license_raw
"$1"
2746 # The default is GPL.
2748 } |
sed -e 's,^ *$,,' |
sed -e 1q
2753 # func_get_maintainer module
2755 # - local_gnulib_path from --local-dir
2756 # - modcache true or false, from --cache-modules/--no-cache-modules
2757 func_get_maintainer
()
2759 if ! $modcache; then
2760 func_lookup_file
"modules/$1"
2761 sed -n -e "/^Maintainer$sed_extract_prog" < "$lookedup_file"
2763 func_cache_lookup_module
"$1"
2764 # Output the field's value, including the final newline (if any).
2765 if $have_associative; then
2766 if eval 'test -n "${modcache_maintainer[$1]+set}"'; then
2767 eval 'echo "${modcache_maintainer[$1]}"'
2770 eval "field_set=\"\$${cachevar}_maintainer_set\""
2771 if test -n "$field_set"; then
2772 eval "field_value=\"\$${cachevar}_maintainer\""
2773 echo "${field_value}"
2779 # func_get_tests_module module
2781 # - local_gnulib_path from --local-dir
2782 func_get_tests_module
()
2784 # The naming convention for tests modules is hardwired: ${module}-tests.
2785 if test -f "$gnulib_dir/modules/$1"-tests \
2786 || func_path_foreach
"$local_gnulib_path" func_exists_local_module
%dir
% "$1-tests"; then
2791 # func_verify_tests_module
2792 # verifies a module name, considering only tests modules and modules with
2793 # applicability 'all'.
2795 # - local_gnulib_path from --local-dir
2796 # - modcache true or false, from --cache-modules/--no-cache-modules
2797 # - module module name argument
2798 func_verify_tests_module
()
2801 if test -n "$module"; then
2802 if test `func_get_applicability $module` = main
; then
2808 # func_repeat_module_in_tests
2809 # tests whether, when the tests have their own configure.ac script, a given
2810 # module should be repeated in the tests, although it was already among the main
2813 # - module module name argument
2814 func_repeat_module_in_tests
()
2817 libtextstyle-optional
)
2818 # This module is special because it relies on a gl_LIBTEXTSTYLE_OPTIONAL
2819 # invocation that it does not itself do or require. Therefore if the
2820 # tests contain such an invocation, the module - as part of tests -
2821 # will produce different AC_SUBSTed variable values than the same module
2822 # - as part of the main configure.ac -.
2829 # func_get_dependencies_recursively module
2831 # - local_gnulib_path from --local-dir
2832 # - modcache true or false, from --cache-modules/--no-cache-modules
2833 func_get_dependencies_recursively
()
2835 # In order to process every module only once (for speed), process an "input
2836 # list" of modules, producing an "output list" of modules. During each round,
2837 # more modules can be queued in the input list. Once a module on the input
2838 # list has been processed, it is added to the "handled list", so we can avoid
2839 # to process it again.
2843 while test -n "$inmodules"; do
2844 inmodules_this_round
="$inmodules"
2845 inmodules
= # Accumulator, queue for next round
2846 for module
in $inmodules_this_round; do
2848 if test -n "$module"; then
2849 func_append outmodules
" $module"
2850 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
2851 for dep
in $deps; do
2852 func_append inmodules
" $dep"
2856 handledmodules
=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
2857 # Remove $handledmodules from $inmodules.
2858 for m
in $inmodules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/queued-modules
2859 inmodules
=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
2861 rm -f "$tmp"/queued-modules
2862 for m
in $outmodules; do echo $m; done | LC_ALL
=C
sort -u
2865 # func_get_link_directive_recursively module
2867 # - local_gnulib_path from --local-dir
2868 # - modcache true or false, from --cache-modules/--no-cache-modules
2869 func_get_link_directive_recursively
()
2871 # In order to process every module only once (for speed), process an "input
2872 # list" of modules, producing an "output list" of modules. During each round,
2873 # more modules can be queued in the input list. Once a module on the input
2874 # list has been processed, it is added to the "handled list", so we can avoid
2875 # to process it again.
2879 while test -n "$inmodules"; do
2880 inmodules_this_round
="$inmodules"
2881 inmodules
= # Accumulator, queue for next round
2882 for module
in $inmodules_this_round; do
2884 if test -n "$module"; then
2885 if grep '^Link:[ ]*$' "$lookedup_file" >/dev
/null
; then
2886 # The module description has a 'Link:' field. Ignore the dependencies.
2887 func_append outmodules
" $module"
2889 # The module description has no 'Link:' field. Recurse through the dependencies.
2890 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
2891 for dep
in $deps; do
2892 func_append inmodules
" $dep"
2897 handledmodules
=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
2898 # Remove $handledmodules from $inmodules.
2899 for m
in $inmodules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/queued-modules
2900 inmodules
=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
2902 rm -f "$tmp"/queued-modules
2903 for m
in $outmodules; do func_get_link_directive
"$m"; done | LC_ALL
=C
sort -u |
sed -e '/^$/d'
2906 # func_acceptable module
2907 # tests whether a module is acceptable.
2909 # - avoidlist list of modules to avoid
2912 for avoid
in $avoidlist; do
2913 if test "$avoid" = "$1"; then
2920 # sed expression to keep the first 32 characters of each line.
2921 sed_first_32_chars
='s/^\(................................\).*/\1/'
2923 # func_module_shellfunc_name module
2924 # computes the shell function name that will contain the m4 macros for the module.
2926 # - macro_prefix prefix to use
2928 # - shellfunc shell function name
2929 func_module_shellfunc_name
()
2933 shellfunc
=func_
${macro_prefix}_gnulib_m4code_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2935 shellfunc
=func_
${macro_prefix}_gnulib_m4code_
$1 ;;
2939 # func_module_shellvar_name module
2940 # computes the shell variable name the will be set to true once the m4 macros
2941 # for the module have been executed.
2943 # - shellvar shell variable name
2944 func_module_shellvar_name
()
2948 shellvar
=${macro_prefix}_gnulib_enabled_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2950 shellvar
=${macro_prefix}_gnulib_enabled_
$1 ;;
2954 # func_module_conditional_name module
2955 # computes the automake conditional name for the module.
2957 # - conditional name of automake conditional
2958 func_module_conditional_name
()
2962 conditional
=${macro_prefix}_GNULIB_ENABLED_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2964 conditional
=${macro_prefix}_GNULIB_ENABLED_
$1 ;;
2968 # func_uncond_add_module B
2969 # notes the presence of B as an unconditional module.
2971 # func_conddep_add_module A B cond
2972 # notes the presence of a conditional dependency from module A to module B,
2973 # subject to the condition that A is enabled and cond is true.
2975 # func_cond_module_p B
2976 # tests whether module B is conditional.
2978 # func_cond_module_condition A B
2979 # returns the condition when B should be enabled as a dependency of A, once the
2980 # m4 code for A has been executed.
2981 # Output: - condition
2983 if $have_associative; then
2984 declare -A conddep_isuncond
2985 declare -A conddep_dependers
2986 declare -A conddep_condition
2987 func_uncond_add_module
()
2989 eval 'conddep_isuncond[$1]=true'
2990 eval 'unset conddep_dependers[$1]'
2992 func_conddep_add_module
()
2994 eval 'isuncond="${conddep_isuncond[$2]}"'
2995 if test -z "$isuncond"; then
2996 # No unconditional dependency to B known at this point.
2997 eval 'conddep_dependers[$2]="${conddep_dependers[$2]} $1"'
2998 eval 'conddep_condition[$1---$2]="$3"'
3001 func_cond_module_p
()
3003 eval 'previous_dependers="${conddep_dependers[$1]}"'
3004 test -n "$previous_dependers"
3006 func_cond_module_condition
()
3008 eval 'condition="${conddep_condition[$1---$2]}"'
3011 func_uncond_add_module
()
3015 suffix
=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
3019 eval 'conddep_isuncond_'"$suffix"'=true'
3020 eval 'unset conddep_dependers_'"$suffix"
3022 func_conddep_add_module
()
3026 suffix
=`echo "$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
3030 eval 'isuncond="${conddep_isuncond_'"$suffix"'}"'
3031 if test -z "$isuncond"; then
3032 eval 'conddep_dependers_'"$suffix"'="${conddep_dependers_'"$suffix"'} $1"'
3033 suffix
=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
3034 eval 'conddep_condition_'"$suffix"'="$3"'
3037 func_cond_module_p
()
3041 suffix
=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
3045 eval 'previous_dependers="${conddep_dependers_'"$suffix"'}"'
3046 test -n "$previous_dependers"
3048 func_cond_module_condition
()
3050 suffix
=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
3051 eval 'condition="${conddep_condition_'"$suffix"'}"'
3055 # func_modules_transitive_closure
3057 # - local_gnulib_path from --local-dir
3058 # - gnu_make true if --gnu-make was given, false otherwise
3059 # - modcache true or false, from --cache-modules/--no-cache-modules
3060 # - modules list of specified modules
3061 # - inctests true if tests should be included, false otherwise
3062 # - incobsolete true if obsolete modules among dependencies should be
3063 # included, blank otherwise
3064 # - inc_cxx_tests true if C++ interoperability tests should be included,
3066 # - inc_longrunning_tests true if long-runnings tests should be included,
3068 # - inc_privileged_tests true if tests that require root privileges should be
3069 # included, blank otherwise
3070 # - inc_unportable_tests true if tests that fail on some platforms should be
3071 # included, blank otherwise
3072 # - inc_all_direct_tests true if all kinds of problematic unit tests among
3073 # the unit tests of the specified modules should be
3074 # included, blank otherwise
3075 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
3076 # the unit tests of the dependencies should be
3077 # included, blank otherwise
3078 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
3080 # - excl_longrunning_tests true if long-runnings tests should be excluded,
3082 # - excl_privileged_tests true if tests that require root privileges should be
3083 # excluded, blank otherwise
3084 # - excl_unportable_tests true if tests that fail on some platforms should be
3085 # excluded, blank otherwise
3086 # - avoidlist list of modules to avoid
3087 # - cond_dependencies true if conditional dependencies shall be supported,
3089 # - tmp pathname of a temporary directory
3091 # - modules list of modules, including dependencies
3092 # - conddep_dependers, conddep_condition information about conditionally
3094 func_modules_transitive_closure
()
3096 sed_escape_dependency
='s|\([/.]\)|\\\1|g'
3097 # In order to process every module only once (for speed), process an "input
3098 # list" of modules, producing an "output list" of modules. During each round,
3099 # more modules can be queued in the input list. Once a module on the input
3100 # list has been processed, it is added to the "handled list", so we can avoid
3101 # to process it again.
3103 inmodules
="$modules"
3105 fmtc_inc_all_tests
="$inc_all_direct_tests"
3106 if test "$cond_dependencies" = true
; then
3107 for module
in $inmodules; do
3109 if test -n "$module"; then
3110 if func_acceptable
$module; then
3111 func_uncond_add_module
$module
3116 while test -n "$inmodules"; do
3117 inmodules_this_round
="$inmodules"
3118 inmodules
= # Accumulator, queue for next round
3119 for module
in $inmodules_this_round; do
3121 if test -n "$module"; then
3122 if func_acceptable
$module; then
3123 func_append outmodules
" $module"
3124 if test "$cond_dependencies" = true
; then
3125 if func_cond_module_p
$module; then
3131 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
3132 # Duplicate dependencies are harmless, but Jim wants a warning.
3133 duplicated_deps
=`echo "$deps" | LC_ALL=C sort | LC_ALL=C uniq -d`
3134 if test -n "$duplicated_deps"; then
3135 func_warning
"module $module has duplicated dependencies: "`echo $duplicated_deps`
3138 testsmodule
=`func_get_tests_module $module`
3139 if test -n "$testsmodule"; then
3140 deps
="$deps $testsmodule"
3143 for dep
in $deps; do
3144 # Determine whether to include the dependency or tests module.
3146 for word
in `func_get_status $dep`; do
3149 test -n "$incobsolete" \
3153 test -z "$excl_cxx_tests" \
3155 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_cxx_tests" \
3159 test -z "$excl_longrunning_tests" \
3161 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_longrunning_tests" \
3165 test -z "$excl_privileged_tests" \
3167 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_privileged_tests" \
3171 test -z "$excl_unportable_tests" \
3173 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_unportable_tests" \
3177 test -n "$fmtc_inc_all_tests" \
3182 if $inc && func_acceptable
"$dep"; then
3183 func_append inmodules
" $dep"
3184 if test "$cond_dependencies" = true
; then
3185 escaped_dep
=`echo "$dep" | sed -e "$sed_escape_dependency"`
3186 sed_extract_condition1
='/^ *'"$escaped_dep"' *$/{
3189 sed_extract_condition2
='/^ *'"$escaped_dep"' *\[.*] *$/{
3190 s/^ *'"$escaped_dep"' *\[\(.*\)] *$/\1/p
3192 condition
=`func_get_dependencies $module | sed -n -e "$sed_extract_condition1" -e "$sed_extract_condition2"`
3193 if test "$condition" = true
; then
3196 if test -n "$condition"; then
3197 func_conddep_add_module
"$module" "$dep" "$condition"
3199 if $conditional; then
3200 func_conddep_add_module
"$module" "$dep" true
3202 func_uncond_add_module
"$dep"
3211 handledmodules
=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
3212 # Remove $handledmodules from $inmodules.
3213 for m
in $inmodules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/queued-modules
3214 inmodules
=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
3215 fmtc_inc_all_tests
="$inc_all_indirect_tests"
3217 modules
=`for m in $outmodules; do echo $m; done | LC_ALL=C sort -u`
3218 rm -f "$tmp"/queued-modules
3221 # func_show_module_list
3223 # - specified_modules list of specified modules (one per line, sorted)
3224 # - modules complete list of modules (one per line, sorted)
3225 # - tmp pathname of a temporary directory
3226 func_show_module_list
()
3232 # Assume xterm compatible escape sequences.
3233 bold_on
=`printf '\033[1m'`
3234 bold_off
=`printf '\033[0m'`
3239 echo "Module list with included dependencies (indented):"
3240 echo "$specified_modules" |
sed -e '/^$/d' -e 's/$/| /' > "$tmp"/specified-modules
3241 echo "$modules" |
sed -e '/^$/d' \
3242 | LC_ALL
=C
join -t '|' -a2 "$tmp"/specified-modules
- \
3243 |
sed -e 's/^\(.*\)|.*/|\1/' -e 's/^/ /' -e 's/^ |\(.*\)$/ '"${bold_on}"'\1'"${bold_off}"'/'
3246 # func_modules_transitive_closure_separately
3247 # Determine main module list and tests-related module list separately.
3248 # The main module list is the transitive closure of the specified modules,
3249 # ignoring tests modules. Its lib/* sources go into $sourcebase/. If --lgpl
3250 # is specified, it will consist only of LGPLed source.
3251 # The tests-related module list is the transitive closure of the specified
3252 # modules, including tests modules, minus the main module list excluding
3253 # modules of applicability 'all'. Its lib/* sources (brought in through
3254 # dependencies of *-tests modules) go into $testsbase/. It may contain GPLed
3255 # source, even if --lgpl is specified.
3257 # - local_gnulib_path from --local-dir
3258 # - modcache true or false, from --cache-modules/--no-cache-modules
3259 # - specified_modules list of specified modules
3260 # - inctests true if tests should be included, false otherwise
3261 # - incobsolete true if obsolete modules among dependencies should be
3262 # included, blank otherwise
3263 # - inc_cxx_tests true if C++ interoperability tests should be included,
3265 # - inc_longrunning_tests true if long-runnings tests should be included,
3267 # - inc_privileged_tests true if tests that require root privileges should be
3268 # included, blank otherwise
3269 # - inc_unportable_tests true if tests that fail on some platforms should be
3270 # included, blank otherwise
3271 # - inc_all_direct_tests true if all kinds of problematic unit tests among
3272 # the unit tests of the specified modules should be
3273 # included, blank otherwise
3274 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
3275 # the unit tests of the dependencies should be
3276 # included, blank otherwise
3277 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
3279 # - excl_longrunning_tests true if long-runnings tests should be excluded,
3281 # - excl_privileged_tests true if tests that require root privileges should be
3282 # excluded, blank otherwise
3283 # - excl_unportable_tests true if tests that fail on some platforms should be
3284 # excluded, blank otherwise
3285 # - avoidlist list of modules to avoid
3286 # - cond_dependencies true if conditional dependencies shall be supported,
3288 # - tmp pathname of a temporary directory
3290 # - main_modules list of modules, including dependencies
3291 # - testsrelated_modules list of tests-related modules, including dependencies
3292 # - conddep_dependers, conddep_condition information about conditionally
3294 func_modules_transitive_closure_separately
()
3296 # Determine main module list.
3297 saved_inctests
="$inctests"
3299 modules
="$specified_modules"
3300 func_modules_transitive_closure
3301 main_modules
="$modules"
3302 inctests
="$saved_inctests"
3303 if test $verbose -ge 1; then
3304 echo "Main module list:"
3305 echo "$main_modules" |
sed -e 's/^/ /'
3307 # Determine tests-related module list.
3308 echo "$final_modules" | LC_ALL
=C
sort -u > "$tmp"/final-modules
3309 testsrelated_modules
=`for module in $main_modules; do
3310 if test \`func_get_applicability
$module\
` = main; then
3314 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/final-modules`
3315 # If testsrelated_modules consists only of modules with applicability 'all',
3316 # set it to empty (because such modules are only helper modules for other modules).
3317 have_nontrivial_testsrelated_modules
=
3318 for module
in $testsrelated_modules; do
3319 if test `func_get_applicability $module` != all
; then
3320 have_nontrivial_testsrelated_modules
=yes
3324 if test -z "$have_nontrivial_testsrelated_modules"; then
3325 testsrelated_modules
=
3327 if test $verbose -ge 1; then
3328 echo "Tests-related module list:"
3329 echo "$testsrelated_modules" |
sed -e 's/^/ /'
3333 # func_determine_use_libtests
3334 # Determines whether a $testsbase/libtests.a is needed.
3336 # - local_gnulib_path from --local-dir
3337 # - modcache true or false, from --cache-modules/--no-cache-modules
3338 # - testsrelated_modules list of tests-related modules, including dependencies
3340 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
3341 func_determine_use_libtests
()
3344 for module
in $testsrelated_modules; do
3345 func_verify_nontests_module
3346 if test -n "$module"; then
3347 all_files
=`func_get_filelist $module`
3348 # Test whether some file in $all_files lies in lib/.
3349 for f
in $all_files; do
3361 # func_remove_if_blocks
3362 # removes if...endif blocks from an automake snippet.
3363 func_remove_if_blocks
()
3376 # func_modules_add_dummy
3378 # - local_gnulib_path from --local-dir
3379 # - modcache true or false, from --cache-modules/--no-cache-modules
3380 # - modules list of modules, including dependencies
3382 # - modules list of modules, including 'dummy' if needed
3383 func_modules_add_dummy
()
3385 # Determine whether any module provides a lib_SOURCES augmentation.
3387 for module
in $modules; do
3388 func_verify_nontests_module
3389 if test -n "$module"; then
3390 if test "$cond_dependencies" = true
&& func_cond_module_p
$module; then
3391 # Ignore conditional modules, since they are not guaranteed to
3392 # contribute to lib_SOURCES.
3395 # Extract the value of unconditional "lib_SOURCES += ..." augmentations.
3396 for file in `func_get_automake_snippet "$module" | combine_lines |
3397 func_remove_if_blocks |
3398 sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'`; do
3399 # Ignore .h files since they are not compiled.
3403 have_lib_SOURCES
=yes
3411 # Add the dummy module, to make sure the library will be non-empty.
3412 if test -z "$have_lib_SOURCES"; then
3413 if func_acceptable
"dummy"; then
3414 func_append modules
" dummy"
3419 # func_modules_add_dummy_separately
3421 # - local_gnulib_path from --local-dir
3422 # - modcache true or false, from --cache-modules/--no-cache-modules
3423 # - main_modules list of modules, including dependencies
3424 # - testsrelated_modules list of tests-related modules, including dependencies
3425 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
3427 # - main_modules list of modules, including 'dummy' if needed
3428 # - testsrelated_modules list of tests-related modules, including 'dummy' if
3430 func_modules_add_dummy_separately
()
3432 # Add the dummy module to the main module list if needed.
3433 modules
="$main_modules"
3434 func_modules_add_dummy
3435 main_modules
="$modules"
3437 # Add the dummy module to the tests-related module list if needed.
3438 if $use_libtests; then
3439 modules
="$testsrelated_modules"
3440 func_modules_add_dummy
3441 testsrelated_modules
="$modules"
3445 # func_modules_notice
3447 # - local_gnulib_path from --local-dir
3448 # - modcache true or false, from --cache-modules/--no-cache-modules
3449 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
3450 # - modules list of modules, including dependencies
3451 func_modules_notice
()
3453 if test $verbose -ge -1; then
3454 for module
in $modules; do
3456 if test -n "$module"; then
3457 msg
=`func_get_notice $module`
3458 if test -n "$msg"; then
3459 echo "Notice from module $module:"
3460 echo "$msg" |
sed -e 's/^/ /'
3467 # func_modules_to_filelist
3469 # - local_gnulib_path from --local-dir
3470 # - modcache true or false, from --cache-modules/--no-cache-modules
3471 # - modules list of modules, including dependencies
3473 # - files list of files
3474 func_modules_to_filelist
()
3477 for module
in $modules; do
3479 if test -n "$module"; then
3480 fs
=`func_get_filelist $module`
3481 func_append files
" $fs"
3484 files
=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
3487 # func_modules_to_filelist_separately
3488 # Determine the final file lists.
3489 # They must be computed separately, because files in lib/* go into
3490 # $sourcebase/ if they are in the main file list but into $testsbase/
3491 # if they are in the tests-related file list. Furthermore lib/dummy.c
3494 # - local_gnulib_path from --local-dir
3495 # - modcache true or false, from --cache-modules/--no-cache-modules
3496 # - main_modules list of modules, including dependencies
3497 # - testsrelated_modules list of tests-related modules, including dependencies
3498 func_modules_to_filelist_separately
()
3500 # Determine final main file list.
3501 modules
="$main_modules"
3502 func_modules_to_filelist
3504 # Determine final tests-related file list.
3505 modules
="$testsrelated_modules"
3506 func_modules_to_filelist
3507 testsrelated_files
=`echo "$files" | sed -e 's,^lib/,tests=lib/,'`
3508 # Merge both file lists.
3509 sed_remove_empty_lines
='/^$/d'
3510 files
=`{ echo "$main_files"; echo "$testsrelated_files"; } | sed -e "$sed_remove_empty_lines" | LC_ALL=C sort -u`
3511 if test $verbose -ge 0; then
3513 sed_prettyprint_files
='s,^tests=lib/\(.*\)$,lib/\1 -> tests/\1,'
3514 echo "$files" |
sed -e "$sed_prettyprint_files" -e 's/^/ /'
3518 # func_compute_include_guard_prefix
3519 # Determine include_guard_prefix and module_indicator_prefix.
3521 # - macro_prefix prefix of gl_LIBOBJS macros to use
3523 # - include_guard_prefix replacement for ${gl_include_guard_prefix}
3524 # - sed_replace_include_guard_prefix
3525 # sed expression for resolving ${gl_include_guard_prefix}
3526 # - module_indicator_prefix prefix of GNULIB_<modulename> variables to use
3527 func_compute_include_guard_prefix
()
3529 if test "$macro_prefix" = gl
; then
3530 include_guard_prefix
='GL'
3532 include_guard_prefix
='GL_'`echo "$macro_prefix" | LC_ALL=C tr '[a-z]' '[A-Z]'`
3534 sed_replace_include_guard_prefix
='s/\${gl_include_guard_prefix}/'"${include_guard_prefix}"'/g'
3535 module_indicator_prefix
="${include_guard_prefix}"
3538 # func_execute_command command [args...]
3539 # Executes a command.
3540 # Uses also the variables
3541 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
3542 func_execute_command
()
3544 if test $verbose -ge 0; then
3548 # Commands like automake produce output to stderr even when they succeed.
3549 # Turn this output off if the command succeeds.
3550 "$@" > "$tmp"/cmdout
2>&1
3552 if test $cmdret = 0; then
3556 cat "$tmp"/cmdout
1>&2
3563 # func_dest_tmpfilename file
3564 # determines the name of a temporary file (file is relative to destdir).
3566 # - destdir target directory
3567 # - doit : if actions shall be executed, false if only to be printed
3568 # - tmp pathname of a temporary directory
3570 # - tmpfile absolute filename of the temporary file
3571 func_dest_tmpfilename
()
3574 # Put the new contents of $file in a file in the same directory (needed
3575 # to guarantee that an 'mv' to "$destdir/$file" works).
3576 tmpfile
="$destdir/$1.tmp"
3578 # Put the new contents of $file in a file in a temporary directory
3579 # (because the directory of "$file" might not exist).
3580 tmpfile
="$tmp"/`basename "$1"`.tmp
3584 # func_is_local_file lookedup_file file
3585 # check whether file should be instantiated from local gnulib directory
3586 func_is_local_file
()
3589 func_remove_suffix dname
"/$2"
3590 func_path_foreach
"$local_gnulib_path" test %dir
% = "$dname"
3594 # determines whether the file $f should be copied, symlinked, or hardlinked.
3596 # - copymode copy mode for files in general
3597 # - lcopymode copy mode for files from local_gnulib_path
3598 # - f the original file name
3599 # - lookedup_file name of the merged (combined) file
3601 # - copyaction copy or symlink or hardlink
3604 if test -n "$lcopymode" && func_is_local_file
"$lookedup_file" "$f"; then
3605 copyaction
="$lcopymode"
3607 if test -n "$copymode"; then
3608 copyaction
="$copymode"
3616 # copies a file from gnulib into the destination directory. The destination
3617 # is known to not exist.
3619 # - destdir target directory
3620 # - local_gnulib_path from --local-dir
3621 # - modcache true or false, from --cache-modules/--no-cache-modules
3622 # - f the original file name
3623 # - lookedup_file name of the merged (combined) file
3624 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
3625 # - g the rewritten file name
3626 # - tmpfile absolute filename of the temporary file
3627 # - doit : if actions shall be executed, false if only to be printed
3628 # - copymode copy mode for files in general
3629 # - lcopymode copy mode for files from local_gnulib_path
3633 echo "Copying file $g"
3635 if test "$copyaction" = symlink \
3636 && test -z "$lookedup_tmp" \
3637 && cmp -s "$lookedup_file" "$tmpfile"; then
3638 func_symlink_if_changed
"$lookedup_file" "$destdir/$g"
3640 if test "$copyaction" = hardlink \
3641 && test -z "$lookedup_tmp" \
3642 && cmp -s "$lookedup_file" "$tmpfile"; then
3643 func_hardlink
"$lookedup_file" "$destdir/$g"
3645 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error
"failed"
3654 # copies a file from gnulib into the destination directory. The destination
3655 # is known to exist.
3657 # - destdir target directory
3658 # - local_gnulib_path from --local-dir
3659 # - modcache true or false, from --cache-modules/--no-cache-modules
3660 # - f the original file name
3661 # - lookedup_file name of the merged (combined) file
3662 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
3663 # - g the rewritten file name
3664 # - tmpfile absolute filename of the temporary file
3665 # - doit : if actions shall be executed, false if only to be printed
3666 # - copymode copy mode for files in general
3667 # - lcopymode copy mode for files from local_gnulib_path
3668 # - already_present nonempty if the file should already exist, empty otherwise
3671 if cmp -s "$destdir/$g" "$tmpfile"; then
3672 : # The file has not changed.
3676 if test -n "$already_present"; then
3677 echo "Updating file $g (backup in ${g}~)"
3679 echo "Replacing file $g (non-gnulib code backed up in ${g}~) !!"
3681 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error
"failed"
3683 if test "$copyaction" = symlink \
3684 && test -z "$lookedup_tmp" \
3685 && cmp -s "$lookedup_file" "$tmpfile"; then
3686 func_symlink_if_changed
"$lookedup_file" "$destdir/$g"
3688 if test "$copyaction" = hardlink \
3689 && test -z "$lookedup_tmp" \
3690 && cmp -s "$lookedup_file" "$tmpfile"; then
3691 func_hardlink
"$lookedup_file" "$destdir/$g"
3693 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error
"failed"
3697 if test -n "$already_present"; then
3698 echo "Update file $g (backup in ${g}~)"
3700 echo "Replace file $g (non-gnulib code backed up in ${g}~) !!"
3706 # func_emit_lib_Makefile_am
3707 # emits the contents of library makefile to standard output.
3709 # - local_gnulib_path from --local-dir
3710 # - modcache true or false, from --cache-modules/--no-cache-modules
3711 # - modules list of modules, including dependencies
3712 # - libname library name
3713 # - pobase directory relative to destdir where to place *.po files
3714 # - auxdir directory relative to destdir where to place build aux files
3715 # - gnu_make true if --gnu-make was given, false otherwise
3716 # - makefile_name from --makefile-name
3717 # - automake_subdir true if --automake-subdir was given, false otherwise
3718 # - libtool true if libtool will be used, false or blank otherwise
3719 # - macro_prefix prefix of gl_LIBOBJS macros to use
3720 # - module_indicator_prefix prefix of GNULIB_<modulename> variables to use
3721 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
3722 # - witness_c_macro from --witness-c-macro
3723 # - actioncmd (optional) command that will reproduce this invocation
3724 # - for_test true if creating a package for testing, false otherwise
3725 # - sed_replace_include_guard_prefix
3726 # sed expression for resolving ${gl_include_guard_prefix}
3727 # - destfile filename relative to destdir of makefile being generated
3729 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val,dotfirst}
3730 # list of edits to be done to Makefile.am variables
3732 # - uses_subdirs nonempty if object files in subdirs exist
3733 func_emit_lib_Makefile_am
()
3735 # When using GNU make, or when creating an includable Makefile.am snippet,
3736 # augment variables with += instead of assigning them.
3737 if $gnu_make ||
test -n "$makefile_name"; then
3742 if test "$libtool" = true
; then
3745 sed_eliminate_LDFLAGS
="$sed_noop"
3749 sed_eliminate_LDFLAGS
='/^lib_LDFLAGS[ ]*+=/d'
3751 # Replace NMD, so as to remove redundant "$(MKDIR_P) '.'" invocations.
3752 # The logic is similar to how we define gl_source_base_prefix.
3753 if $automake_subdir; then
3754 sed_eliminate_NMD
='s/@NMD@//;/@!NMD@/d'
3756 sed_eliminate_NMD
='/@NMD@/d;s/@!NMD@//'
3759 # When creating a package for testing: Attempt to provoke failures,
3760 # especially link errors, already during "make" rather than during
3761 # "make check", because "make check" is not possible in a cross-compiling
3762 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
3763 sed_transform_check_PROGRAMS
='s,check_PROGRAMS,noinst_PROGRAMS,g'
3765 sed_transform_check_PROGRAMS
="$sed_noop"
3767 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3768 if ! $gnu_make; then
3769 echo "## Process this file with automake to produce Makefile.in."
3771 func_emit_copyright_notice
3772 if test -n "$actioncmd"; then
3773 printf '# Reproduce by:\n%s\n' "$actioncmd"
3778 for module
in $modules; do
3779 func_verify_nontests_module
3780 if test -n "$module"; then
3782 func_get_automake_snippet_conditional
"$module" |
3784 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
3785 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
3786 -e "$sed_eliminate_LDFLAGS" \
3787 -e "$sed_eliminate_NMD" \
3788 -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' \
3789 -e 's,\$(GNULIB_,$('"${module_indicator_prefix}"'_GNULIB_,' \
3790 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
3791 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
3792 -e "$sed_transform_check_PROGRAMS" \
3793 -e "$sed_replace_include_guard_prefix"
3794 if test "$module" = 'alloca'; then
3795 echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
3796 echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@"
3798 } | combine_lines
"${libname}_${libext}_SOURCES" > "$tmp"/amsnippet1
3800 func_get_automake_snippet_unconditional
"$module" |
3802 sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' \
3803 -e 's,\$(GNULIB_,$('"${module_indicator_prefix}"'_GNULIB_,'
3804 } > "$tmp"/amsnippet2
3805 # Skip the contents if it's entirely empty.
3806 if grep '[^ ]' "$tmp"/amsnippet1
"$tmp"/amsnippet2
> /dev
/null
; then
3807 echo "## begin gnulib module $module"
3809 echo "ifeq (,\$(OMIT_GNULIB_MODULE_$module))"
3810 convert_to_gnu_make_1
='s/^if \(.*\)/ifneq (,$(\1_CONDITION))/'
3811 convert_to_gnu_make_2
='s|%reldir%/||g'
3812 convert_to_gnu_make_3
='s|%reldir%|.|g'
3815 if test "$cond_dependencies" = true
; then
3816 if func_cond_module_p
"$module"; then
3817 func_module_conditional_name
"$module"
3819 echo "ifneq (,\$(${conditional}_CONDITION))"
3821 echo "if $conditional"
3826 sed -e "$convert_to_gnu_make_1" \
3827 -e "$convert_to_gnu_make_2" \
3828 -e "$convert_to_gnu_make_3" \
3831 cat "$tmp"/amsnippet1
3833 if test "$cond_dependencies" = true
; then
3834 if func_cond_module_p
"$module"; then
3839 sed -e "$convert_to_gnu_make_1" \
3840 -e "$convert_to_gnu_make_2" \
3841 -e "$convert_to_gnu_make_3" \
3844 cat "$tmp"/amsnippet2
3849 echo "## end gnulib module $module"
3852 rm -f "$tmp"/amsnippet1
"$tmp"/amsnippet2
3853 # Test whether there are some source files in subdirectories.
3854 for f
in `func_get_filelist "$module"`; do
3864 } > "$tmp"/allsnippets
3865 if test -z "$makefile_name"; then
3866 # If there are source files in subdirectories, prevent collision of the
3867 # object files (example: hash.c and libxml/hash.c).
3869 if test -n "$uses_subdirs"; then
3870 subdir_options
=' subdir-objects'
3872 echo "AUTOMAKE_OPTIONS = 1.14 gnits${subdir_options}"
3875 if test -z "$makefile_name"; then
3877 echo "noinst_HEADERS ="
3878 echo "noinst_LIBRARIES ="
3879 echo "noinst_LTLIBRARIES ="
3880 # Automake versions < 1.11.4 create an empty pkgdatadir at
3881 # installation time if you specify pkgdata_DATA to empty.
3882 # See automake bugs #10997 and #11030:
3883 # * https://debbugs.gnu.org/10997
3884 # * https://debbugs.gnu.org/11030
3885 # So we need this workaround.
3886 if grep '^pkgdata_DATA *+=' "$tmp"/allsnippets
> /dev
/null
; then
3887 echo "pkgdata_DATA ="
3890 echo "BUILT_SOURCES ="
3893 echo "MOSTLYCLEANFILES $assign core *.stackdump"
3894 if test -z "$makefile_name"; then
3895 echo "MOSTLYCLEANDIRS ="
3897 echo "DISTCLEANFILES ="
3898 echo "MAINTAINERCLEANFILES ="
3901 echo "# Start of GNU Make output."
3903 # Put autoconf output into a temporary file, so that its exit status
3904 # can be checked from the shell. Signal any error by putting a
3905 # syntax error into the output makefile.
3906 ${AUTOCONF} -t 'AC_SUBST:$1 = @$1@' "$configure_ac" \
3907 >"$tmp"/makeout
2>"$tmp"/makeout2
&&
3908 LC_ALL
=C
sort -u "$tmp"/makeout ||
{
3909 echo "== gnulib-tool GNU Make output failed as follows =="
3910 sed 's/^/# stderr: /' "$tmp"/makeout2
3912 rm -f "$tmp"/makeout
"$tmp"/makeout2
3914 echo "# End of GNU Make output."
3916 echo "# No GNU Make output."
3918 # Execute edits that apply to the Makefile.am being generated.
3920 while test $edit != $makefile_am_edits; do
3921 edit
=`expr $edit + 1`
3922 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
3923 eval var
=\"\
$makefile_am_edit${edit}_var
\"
3924 eval val
=\"\
$makefile_am_edit${edit}_val
\"
3925 eval dotfirst
=\"\
$makefile_am_edit${edit}_dotfirst
\"
3926 if test -n "$var"; then
3927 if test "${dir}Makefile.am" = "$destfile" ||
test "./${dir}Makefile.am" = "$destfile"; then
3928 if test "${var}" = SUBDIRS
&& test -n "$dotfirst"; then
3929 # The added subdirectory ${val} needs to be mentioned after '.'.
3930 # Since we don't have '.' among SUBDIRS so far, add it now.
3933 echo "${var} += ${val}"
3934 eval "makefile_am_edit${edit}_var="
3938 if test -n "$witness_c_macro"; then
3939 cppflags_part1
=" -D$witness_c_macro=1"
3944 cppflags_part2
=" -DGNULIB_STRICT_CHECKING=1"
3948 if test -z "$makefile_name"; then
3950 echo "AM_CPPFLAGS =$cppflags_part1$cppflags_part2"
3953 if test -n "$cppflags_part1$cppflags_part2"; then
3955 echo "AM_CPPFLAGS +=$cppflags_part1$cppflags_part2"
3959 if LC_ALL
=C
grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$tmp"/allsnippets
> /dev
/null \
3960 ||
{ test -n "$makefile_name" \
3961 && test -f "$sourcebase/Makefile.am" \
3962 && LC_ALL
=C
grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$sourcebase/Makefile.am" > /dev
/null
; \
3964 # One of the snippets or the user's Makefile.am already specifies an
3965 # installation location for the library. Don't confuse automake by saying
3966 # it should not be installed.
3969 # By default, the generated library should not be installed.
3970 echo "noinst_${perhapsLT}LIBRARIES += $libname.$libext"
3973 echo "${libname}_${libext}_SOURCES ="
3974 if ! $for_test; then
3975 echo "${libname}_${libext}_CFLAGS = \$(AM_CFLAGS) \$(GL_CFLAG_GNULIB_WARNINGS)"
3977 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
3978 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
3979 echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
3980 echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
3981 echo "EXTRA_${libname}_${libext}_SOURCES ="
3982 if test "$libtool" = true
; then
3983 echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)"
3984 echo "${libname}_${libext}_LDFLAGS += -no-undefined"
3985 # Synthesize an ${libname}_${libext}_LDFLAGS augmentation by combining
3986 # the link dependencies of all modules.
3987 for module
in $modules; do
3988 func_verify_nontests_module
3989 if test -n "$module"; then
3990 func_get_link_directive
"$module"
3993 | LC_ALL
=C
sed -e '/^$/d' -e 's/ when linking with libtool.*//' \
3994 | LC_ALL
=C
sort -u \
3995 | LC_ALL
=C
sed -e 's/^/'"${libname}_${libext}"'_LDFLAGS += /'
3998 if test -n "$pobase"; then
3999 echo "AM_CPPFLAGS += -DDEFAULT_TEXT_DOMAIN=\\\"${po_domain}-gnulib\\\""
4002 cat "$tmp"/allsnippets \
4003 |
sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
4005 echo "mostlyclean-local: mostlyclean-generic"
4006 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
4007 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
4008 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
4012 # Emit rules to erase .Po and .Plo files for AC_LIBOBJ invocations.
4013 # Extend the 'distclean' rule.
4014 echo "distclean-local: distclean-gnulib-libobjs"
4015 echo "distclean-gnulib-libobjs:"
4016 echo " -rm -f @${macro_prefix}_LIBOBJDEPS@"
4017 # Extend the 'maintainer-clean' rule.
4018 echo "maintainer-clean-local: distclean-gnulib-libobjs"
4019 rm -f "$tmp"/allsnippets
4022 # func_emit_po_Makevars
4023 # emits the contents of po/ makefile parameterization to standard output.
4025 # - local_gnulib_path from --local-dir
4026 # - modcache true or false, from --cache-modules/--no-cache-modules
4027 # - sourcebase directory relative to destdir where to place source code
4028 # - pobase directory relative to destdir where to place *.po files
4029 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
4030 func_emit_po_Makevars
()
4032 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
4033 func_emit_copyright_notice
4035 echo "# Usually the message domain is the same as the package name."
4036 echo "# But here it has a '-gnulib' suffix."
4037 echo "DOMAIN = ${po_domain}-gnulib"
4039 echo "# These two variables depend on the location of this directory."
4040 echo "subdir = ${pobase}"
4041 echo "top_builddir = "`echo "$pobase" | sed -e 's,//*,/,g' -e 's,[^/][^/]*,..,g'`
4044 # These options get passed to xgettext.
4045 XGETTEXT_OPTIONS
= \
4046 --keyword=_
--flag=_
:1:pass-c-format \
4047 --keyword=N_
--flag=N_
:1:pass-c-format \
4048 --keyword='proper_name:1,"This is a proper name. See the gettext manual, section Names."' \
4049 --keyword='proper_name_lite:1,"This is a proper name. See the gettext manual, section Names."' \
4050 --keyword='proper_name_utf8:1,"This is a proper name. See the gettext manual, section Names."' \
4051 --flag=error
:3:c-format
--flag=error_at_line
:5:c-format
4053 # This is the copyright holder that gets inserted into the header of the
4054 # $(DOMAIN).pot file. gnulib is copyrighted by the FSF.
4055 COPYRIGHT_HOLDER
= Free Software Foundation
, Inc.
4057 # This is the email address or URL to which the translators shall report
4058 # bugs in the untranslated strings:
4059 # - Strings which are not entire sentences, see the maintainer guidelines
4060 # in the GNU gettext documentation, section 'Preparing Strings'.
4061 # - Strings which use unclear terms or require additional context to be
4063 # - Strings which make invalid assumptions about notation of date, time or
4065 # - Pluralisation problems.
4066 # - Incorrect English spelling.
4067 # - Incorrect formatting.
4068 # It can be your email address, or a mailing list address where translators
4069 # can write to without being subscribed, or the URL of a web page through
4070 # which the translators can contact you.
4071 MSGID_BUGS_ADDRESS
= bug-gnulib@gnu.org
4073 # This is the list of locale categories, beyond LC_MESSAGES, for which the
4074 # message catalogs shall be used. It is usually empty.
4075 EXTRA_LOCALE_CATEGORIES
=
4077 # This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
4078 # context. Possible values are "yes" and "no". Set this to yes if the
4079 # package uses functions taking also a message context, like pgettext(), or
4080 # if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
4085 # func_emit_po_POTFILES_in
4086 # emits the file list to be passed to xgettext to standard output.
4088 # - local_gnulib_path from --local-dir
4089 # - modcache true or false, from --cache-modules/--no-cache-modules
4090 # - sourcebase directory relative to destdir where to place source code
4091 # - files list of new files
4092 func_emit_po_POTFILES_in
()
4094 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
4095 func_emit_copyright_notice
4097 echo "# List of files which contain translatable strings."
4098 echo "$files" |
sed -n -e "s,^lib/,$sourcebase/,p"
4101 # func_emit_tests_Makefile_am witness_macro
4102 # emits the contents of tests makefile to standard output.
4104 # - local_gnulib_path from --local-dir
4105 # - modcache true or false, from --cache-modules/--no-cache-modules
4106 # - modules list of modules, including dependencies
4107 # - libname library name
4108 # - auxdir directory relative to destdir where to place build aux files
4109 # - gnu_make true if --gnu-make was given, false otherwise
4110 # - makefile_name from --makefile-name
4111 # - tests_makefile_name from --tests-makefile-name
4112 # - libtool true if libtool will be used, false or blank otherwise
4113 # - sourcebase relative directory containing lib source code
4114 # - m4base relative directory containing autoconf macros
4115 # - testsbase relative directory containing unit test code
4116 # - macro_prefix prefix of gl_LIBOBJS macros to use
4117 # - module_indicator_prefix prefix of GNULIB_<modulename> variables to use
4118 # - witness_c_macro from --witness-c-macro
4119 # - for_test true if creating a package for testing, false otherwise
4120 # - single_configure true if a single configure file should be generated,
4121 # false for a separate configure file for the tests
4122 # - use_libtests true if a libtests.a should be built, false otherwise
4123 # - sed_replace_include_guard_prefix
4124 # sed expression for resolving ${gl_include_guard_prefix}
4125 # - destfile filename relative to destdir of makefile being generated
4127 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val,dotfirst}
4128 # list of edits to be done to Makefile.am variables
4130 # - uses_subdirs nonempty if object files in subdirs exist
4131 func_emit_tests_Makefile_am
()
4134 if test "$libtool" = true
; then
4137 sed_eliminate_LDFLAGS
="$sed_noop"
4141 sed_eliminate_LDFLAGS
='/^lib_LDFLAGS[ ]*+=/d'
4143 # Replace NMD, so as to remove redundant "$(MKDIR_P) '.'" invocations.
4144 # The logic is similar to how we define gl_source_base_prefix.
4145 sed_eliminate_NMD
='/@NMD@/d;s/@!NMD@//'
4147 # When creating a package for testing: Attempt to provoke failures,
4148 # especially link errors, already during "make" rather than during
4149 # "make check", because "make check" is not possible in a cross-compiling
4150 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
4151 sed_transform_check_PROGRAMS
='s,check_PROGRAMS,noinst_PROGRAMS,g'
4153 sed_transform_check_PROGRAMS
="$sed_noop"
4155 testsbase_inverse
=`echo "$testsbase" | sed -e 's,/$,,' | sed -e 's,[^/][^/]*,..,g'`
4156 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
4157 echo "## Process this file with automake to produce Makefile.in."
4158 func_emit_copyright_notice
4162 for module
in $modules; do
4163 if $for_test && ! $single_configure; then
4164 if `func_repeat_module_in_tests`; then
4167 func_verify_tests_module
4172 if test -n "$module"; then
4174 func_get_automake_snippet_conditional
"$module" |
4176 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
4177 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
4178 -e "$sed_eliminate_LDFLAGS" \
4179 -e "$sed_eliminate_NMD" \
4180 -e 's,lib_\([A-Z][A-Z]*\),libtests_a_\1,g' \
4181 -e 's,\$(GNULIB_,$('"${module_indicator_prefix}"'_GNULIB_,' \
4182 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
4183 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
4184 -e "$sed_transform_check_PROGRAMS" \
4185 -e "$sed_replace_include_guard_prefix"
4186 if $use_libtests && test "$module" = 'alloca'; then
4187 echo "libtests_a_LIBADD += @ALLOCA@"
4188 echo "libtests_a_DEPENDENCIES += @ALLOCA@"
4190 } | combine_lines
"libtests_a_SOURCES" > "$tmp"/amsnippet1
4192 func_get_automake_snippet_unconditional
"$module" |
4194 sed -e 's,lib_\([A-Z][A-Z]*\),libtests_a_\1,g' \
4195 -e 's,\$(GNULIB_,$('"${module_indicator_prefix}"'_GNULIB_,'
4196 } > "$tmp"/amsnippet2
4197 # Skip the contents if it's entirely empty.
4198 if grep '[^ ]' "$tmp"/amsnippet1
"$tmp"/amsnippet2
> /dev
/null
; then
4199 # Mention long-running tests at the end.
4201 for word
in `func_get_status "$module"`; do
4202 if test "$word" = 'longrunning-test'; then
4207 { echo "## begin gnulib module $module"
4209 echo "ifeq (,\$(OMIT_GNULIB_MODULE_$module))"
4210 convert_to_gnu_make_1
='s/^if \(.*\)/ifneq (,$(\1_CONDITION))/'
4211 convert_to_gnu_make_2
='s|%reldir%/||g'
4212 convert_to_gnu_make_3
='s|%reldir%|.|g'
4215 if test "$cond_dependencies" = true
; then
4216 if func_cond_module_p
"$module"; then
4217 func_module_conditional_name
"$module"
4219 echo "ifneq (,\$(${conditional}_CONDITION))"
4221 echo "if $conditional"
4226 sed -e "$convert_to_gnu_make_1" \
4227 -e "$convert_to_gnu_make_2" \
4228 -e "$convert_to_gnu_make_3" \
4231 cat "$tmp"/amsnippet1
4233 if test "$cond_dependencies" = true
; then
4234 if func_cond_module_p
"$module"; then
4239 sed -e "$convert_to_gnu_make_1" \
4240 -e "$convert_to_gnu_make_2" \
4241 -e "$convert_to_gnu_make_3" \
4244 cat "$tmp"/amsnippet2
4249 echo "## end gnulib module $module"
4253 rm -f "$tmp"/amsnippet1
"$tmp"/amsnippet2
4254 # Test whether there are some source files in subdirectories.
4255 for f
in `func_get_filelist "$module"`; do
4257 lib
/*/*.c |
tests
/*/*.c
)
4265 } 3> "$tmp"/main_snippets
4> "$tmp"/longrunning_snippets
4266 # Generate dependencies here, since it eases the debugging of test failures.
4267 # If there are source files in subdirectories, prevent collision of the
4268 # object files (example: hash.c and libxml/hash.c).
4270 if test -n "$uses_subdirs"; then
4271 subdir_options
=' subdir-objects'
4273 echo "AUTOMAKE_OPTIONS = 1.14 foreign${subdir_options}"
4275 if $for_test && ! $single_configure; then
4276 echo "ACLOCAL_AMFLAGS = -I ${testsbase_inverse}/${m4base}"
4279 # Nothing is being added to SUBDIRS; nevertheless the existence of this
4280 # variable is needed to avoid an error from automake:
4281 # "AM_GNU_GETTEXT used but SUBDIRS not defined"
4284 echo "XFAIL_TESTS ="
4285 echo "TESTS_ENVIRONMENT ="
4286 echo "noinst_PROGRAMS ="
4287 if ! $for_test; then
4288 echo "check_PROGRAMS ="
4290 echo "EXTRA_PROGRAMS ="
4291 echo "noinst_HEADERS ="
4292 echo "noinst_LIBRARIES ="
4293 if $use_libtests; then
4295 echo "noinst_LIBRARIES += libtests.a"
4297 echo "check_LIBRARIES = libtests.a"
4300 # Automake versions < 1.11.4 create an empty pkgdatadir at
4301 # installation time if you specify pkgdata_DATA to empty.
4302 # See automake bugs #10997 and #11030:
4303 # * https://debbugs.gnu.org/10997
4304 # * https://debbugs.gnu.org/11030
4305 # So we need this workaround.
4306 if grep '^pkgdata_DATA *+=' "$tmp"/main_snippets
"$tmp"/longrunning_snippets
> /dev
/null
; then
4307 echo "pkgdata_DATA ="
4310 echo "BUILT_SOURCES ="
4312 echo "MOSTLYCLEANFILES = core *.stackdump"
4313 echo "MOSTLYCLEANDIRS ="
4315 echo "DISTCLEANFILES ="
4316 echo "MAINTAINERCLEANFILES ="
4317 # Execute edits that apply to the Makefile.am being generated.
4319 while test $edit != $makefile_am_edits; do
4320 edit
=`expr $edit + 1`
4321 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
4322 eval var
=\"\
$makefile_am_edit${edit}_var
\"
4323 eval val
=\"\
$makefile_am_edit${edit}_val
\"
4324 eval dotfirst
=\"\
$makefile_am_edit${edit}_dotfirst
\"
4325 if test -n "$var"; then
4326 if test "${dir}Makefile.am" = "$destfile" ||
test "./${dir}Makefile.am" = "$destfile"; then
4327 if test "${var}" = SUBDIRS
&& test -n "$dotfirst"; then
4328 # The added subdirectory ${val} needs to be mentioned after '.'.
4329 # But we have '.' among SUBDIRS already, so do nothing.
4332 echo "${var} += ${val}"
4333 eval "makefile_am_edit${edit}_var="
4338 # Insert a '-Wno-error' option in the compilation commands emitted by
4339 # Automake, between $(AM_CPPFLAGS) and before the reference to @CFLAGS@.
4341 # 1) Because parts of the Gnulib tests exercise corner cases (invalid
4342 # arguments, endless recursions, etc.) that a compiler may warn about,
4343 # even with just the normal '-Wall' option.
4344 # 2) Because every package maintainer has their preferred set of warnings
4345 # that they may want to enforce in the main source code of their package.
4346 # But Gnulib tests are maintained in Gnulib and don't end up in binaries
4347 # that that package installs; therefore it does not make sense for
4348 # package maintainers to enforce the absence of warnings on these tests.
4349 # Why before @CFLAGS@?
4350 # - Because "the user is always right": If a user adds '-Werror' to their
4351 # CFLAGS, they have asked for errors, they will get errors. But they have
4352 # no right to complain about these errors, because Gnulib does not support
4354 cflags_for_gnulib_code
=
4355 if ! $for_test; then
4356 # Enable or disable warnings as suitable for the Gnulib coding style.
4357 cflags_for_gnulib_code
=" \$(GL_CFLAG_GNULIB_WARNINGS)"
4359 echo "CFLAGS = @GL_CFLAG_ALLOW_WARNINGS@${cflags_for_gnulib_code} @CFLAGS@"
4360 echo "CXXFLAGS = @GL_CXXFLAG_ALLOW_WARNINGS@ @CXXFLAGS@"
4362 echo "AM_CPPFLAGS = \\"
4364 echo " -DGNULIB_STRICT_CHECKING=1 \\"
4366 if test -n "$witness_c_macro"; then
4367 echo " -D$witness_c_macro=1 \\"
4369 if test -n "${witness_macro}"; then
4370 echo " -D@${witness_macro}@=1 \\"
4372 echo " -I. -I\$(srcdir) \\"
4373 echo " -I${testsbase_inverse} -I\$(srcdir)/${testsbase_inverse} \\"
4374 echo " -I${testsbase_inverse}/${sourcebase-lib} -I\$(srcdir)/${testsbase_inverse}/${sourcebase-lib}"
4376 if $use_libtests; then
4377 # All test programs need to be linked with libtests.a.
4378 # It needs to be passed to the linker before ${libname}.${libext}, since
4379 # the tests-related modules depend on the main modules.
4380 # It also needs to be passed to the linker after ${libname}.${libext}
4381 # because the latter might contain incomplete modules (such as the
4382 # 'version-etc' module whose dependency to 'version-etc-fsf' is voluntarily
4384 # The LIBTESTS_LIBDEPS can be passed to the linker once or twice, it does
4386 echo "LDADD = libtests.a ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext} libtests.a ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext} libtests.a \$(LIBTESTS_LIBDEPS)"
4388 echo "LDADD = ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext}"
4391 if $use_libtests; then
4392 echo "libtests_a_SOURCES ="
4393 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
4394 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
4395 echo "libtests_a_LIBADD = \$(${macro_prefix}tests_LIBOBJS)"
4396 echo "libtests_a_DEPENDENCIES = \$(${macro_prefix}tests_LIBOBJS)"
4397 echo "EXTRA_libtests_a_SOURCES ="
4398 # The circular dependency in LDADD requires this.
4399 echo "AM_LIBTOOLFLAGS = --preserve-dup-deps"
4402 # Many test scripts use ${EXEEXT} or ${srcdir}.
4403 # EXEEXT is defined by AC_PROG_CC through autoconf.
4404 # srcdir is defined by autoconf and automake.
4405 echo "TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='\$(srcdir)'"
4407 cat "$tmp"/main_snippets
"$tmp"/longrunning_snippets \
4408 |
sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
4409 # Arrange to print a message before compiling the files in this directory.
4410 echo "all: all-notice"
4412 echo " @echo '## ---------------------------------------------------- ##'"
4413 echo " @echo '## ------------------- Gnulib tests ------------------- ##'"
4414 echo " @echo '## You can ignore compiler warnings in this directory. ##'"
4415 echo " @echo '## ---------------------------------------------------- ##'"
4417 # Arrange to print a message before executing the tests in this directory.
4418 echo "check-am: check-notice"
4419 echo "check-notice:"
4420 echo " @echo '## ---------------------------------------------------------------------- ##'"
4421 echo " @echo '## ---------------------------- Gnulib tests ---------------------------- ##'"
4422 echo " @echo '## Please report test failures in this directory to <bug-gnulib@gnu.org>. ##'"
4423 echo " @echo '## ---------------------------------------------------------------------- ##'"
4425 echo "# Clean up after Solaris cc."
4427 echo " rm -rf SunWS_cache"
4429 echo "mostlyclean-local: mostlyclean-generic"
4430 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
4431 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
4432 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
4436 rm -f "$tmp"/main_snippets
"$tmp"/longrunning_snippets
4439 # func_emit_initmacro_start macro_prefix gentests
4440 # emits the first few statements of the gl_INIT macro to standard output.
4441 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4442 # - gentests true if a tests Makefile.am is being generated,
4444 # - module_indicator_prefix prefix of GNULIB_<modulename> variables to use
4445 func_emit_initmacro_start
()
4447 macro_prefix_arg
="$1"
4448 # Overriding AC_LIBOBJ and AC_REPLACE_FUNCS has the effect of storing
4449 # platform-dependent object files in ${macro_prefix_arg}_LIBOBJS instead of
4450 # LIBOBJS. The purpose is to allow several gnulib instantiations under
4451 # a single configure.ac file. (AC_CONFIG_LIBOBJ_DIR does not allow this
4453 # Furthermore it avoids an automake error like this when a Makefile.am
4454 # that uses pieces of gnulib also uses $(LIBOBJ):
4455 # automatically discovered file `error.c' should not be explicitly mentioned
4456 echo " m4_pushdef([AC_LIBOBJ], m4_defn([${macro_prefix_arg}_LIBOBJ]))"
4457 echo " m4_pushdef([AC_REPLACE_FUNCS], m4_defn([${macro_prefix_arg}_REPLACE_FUNCS]))"
4458 # Overriding AC_LIBSOURCES has the same purpose of avoiding the automake
4459 # error when a Makefile.am that uses pieces of gnulib also uses $(LIBOBJ):
4460 # automatically discovered file `error.c' should not be explicitly mentioned
4461 # We let automake know about the files to be distributed through the
4462 # EXTRA_lib_SOURCES variable.
4463 echo " m4_pushdef([AC_LIBSOURCES], m4_defn([${macro_prefix_arg}_LIBSOURCES]))"
4464 # Create data variables for checking the presence of files that are mentioned
4465 # as AC_LIBSOURCES arguments. These are m4 variables, not shell variables,
4466 # because we want the check to happen when the configure file is created,
4467 # not when it is run. ${macro_prefix_arg}_LIBSOURCES_LIST is the list of
4468 # files to check for. ${macro_prefix_arg}_LIBSOURCES_DIR is the subdirectory
4469 # in which to expect them.
4470 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_LIST], [])"
4471 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_DIR], [])"
4472 # Scope for m4 macros.
4473 echo " m4_pushdef([GL_MACRO_PREFIX], [${macro_prefix_arg}])"
4474 # Scope the GNULIB_<modulename> variables.
4475 echo " m4_pushdef([GL_MODULE_INDICATOR_PREFIX], [${module_indicator_prefix}])"
4478 echo " AC_REQUIRE([gl_CC_ALLOW_WARNINGS])"
4479 echo " AC_REQUIRE([gl_CXX_ALLOW_WARNINGS])"
4483 # func_emit_initmacro_end macro_prefix gentests
4484 # emits the last few statements of the gl_INIT macro to standard output.
4485 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4486 # - gentests true if a tests Makefile.am is being generated,
4488 # - automake_subdir true if --automake-subdir was given, false otherwise
4489 # - libtool true if --libtool was given, false if --no-libtool was
4490 # given, blank otherwise
4491 func_emit_initmacro_end
()
4493 macro_prefix_arg
="$1"
4494 # Check the presence of files that are mentioned as AC_LIBSOURCES arguments.
4495 # The check is performed only when autoconf is run from the directory where
4496 # the configure.ac resides; if it is run from a different directory, the
4498 echo " m4_ifval(${macro_prefix_arg}_LIBSOURCES_LIST, ["
4499 echo " m4_syscmd([test ! -d ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[ ||"
4500 echo " for gl_file in ]${macro_prefix_arg}_LIBSOURCES_LIST[ ; do"
4501 echo " if test ! -r ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file ; then"
4502 echo " echo \"missing file ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file\" >&2"
4506 echo " m4_if(m4_sysval, [0], [],"
4507 echo " [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])"
4509 echo " m4_popdef([GL_MODULE_INDICATOR_PREFIX])"
4510 echo " m4_popdef([GL_MACRO_PREFIX])"
4511 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_DIR])"
4512 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_LIST])"
4513 echo " m4_popdef([AC_LIBSOURCES])"
4514 echo " m4_popdef([AC_REPLACE_FUNCS])"
4515 echo " m4_popdef([AC_LIBOBJ])"
4516 echo " AC_CONFIG_COMMANDS_PRE(["
4517 echo " ${macro_prefix_arg}_libobjs="
4518 echo " ${macro_prefix_arg}_ltlibobjs="
4519 echo " ${macro_prefix_arg}_libobjdeps="
4520 echo " if test -n \"\$${macro_prefix_arg}_LIBOBJS\"; then"
4521 echo " # Remove the extension."
4522 echo "changequote(,)dnl"
4523 echo " sed_drop_objext='s/\\.o\$//;s/\\.obj\$//'"
4524 echo " sed_dirname1='s,//*,/,g'"
4525 echo " sed_dirname2='s,\\(.\\)/\$,\\1,'"
4526 echo " sed_dirname3='s,^[^/]*\$,.,'"
4527 echo " sed_dirname4='s,\\(.\\)/[^/]*\$,\\1,'"
4528 echo " sed_basename1='s,.*/,,'"
4529 echo "changequote([, ])dnl"
4530 if $automake_subdir && ! "$2" && test -n "$sourcebase" && test "$sourcebase" != '.'; then
4531 subdir
="$sourcebase/"
4532 elif $automake_subdir_tests && "$2" && test -n "$testsbase" && test "$testsbase" != '.'; then
4533 subdir
="$testsbase/"
4537 echo " for i in \`for i in \$${macro_prefix_arg}_LIBOBJS; do echo \"\$i\"; done | sed -e \"\$sed_drop_objext\" | sort | uniq\`; do"
4538 echo " ${macro_prefix_arg}_libobjs=\"\$${macro_prefix_arg}_libobjs ${subdir}\$i.\$ac_objext\""
4539 echo " ${macro_prefix_arg}_ltlibobjs=\"\$${macro_prefix_arg}_ltlibobjs ${subdir}\$i.lo\""
4540 echo " i_dir=\`echo \"\$i\" | sed -e \"\$sed_dirname1\" -e \"\$sed_dirname2\" -e \"\$sed_dirname3\" -e \"\$sed_dirname4\"\`"
4541 echo " i_base=\`echo \"\$i\" | sed -e \"\$sed_basename1\"\`"
4542 if test "$libtool" = true
; then
4543 echo " ${macro_prefix_arg}_libobjdeps=\"\$${macro_prefix_arg}_libobjdeps ${subdir}\$i_dir/\\\$(DEPDIR)/\$i_base.Plo\""
4545 echo " ${macro_prefix_arg}_libobjdeps=\"\$${macro_prefix_arg}_libobjdeps ${subdir}\$i_dir/\\\$(DEPDIR)/\$i_base.Po\""
4549 echo " AC_SUBST([${macro_prefix_arg}_LIBOBJS], [\$${macro_prefix_arg}_libobjs])"
4550 echo " AC_SUBST([${macro_prefix_arg}_LTLIBOBJS], [\$${macro_prefix_arg}_ltlibobjs])"
4551 echo " AC_SUBST([${macro_prefix_arg}_LIBOBJDEPS], [\$${macro_prefix_arg}_libobjdeps])"
4555 # func_emit_initmacro_done macro_prefix sourcebase
4556 # emits a few statements after the gl_INIT macro to standard output.
4557 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4558 # - sourcebase directory relative to destdir where to place source code
4559 func_emit_initmacro_done
()
4561 macro_prefix_arg
="$1"
4564 echo "# Like AC_LIBOBJ, except that the module name goes"
4565 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
4566 echo "AC_DEFUN([${macro_prefix_arg}_LIBOBJ], ["
4567 echo " AS_LITERAL_IF([\$1], [${macro_prefix_arg}_LIBSOURCES([\$1.c])])dnl"
4568 echo " ${macro_prefix_arg}_LIBOBJS=\"\$${macro_prefix_arg}_LIBOBJS \$1.\$ac_objext\""
4571 echo "# Like AC_REPLACE_FUNCS, except that the module name goes"
4572 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
4573 echo "AC_DEFUN([${macro_prefix_arg}_REPLACE_FUNCS], ["
4574 echo " m4_foreach_w([gl_NAME], [\$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl"
4575 echo " AC_CHECK_FUNCS([\$1], , [${macro_prefix_arg}_LIBOBJ(\$ac_func)])"
4578 echo "# Like AC_LIBSOURCES, except the directory where the source file is"
4579 echo "# expected is derived from the gnulib-tool parameterization,"
4580 echo "# and alloca is special cased (for the alloca-opt module)."
4581 echo "# We could also entirely rely on EXTRA_lib..._SOURCES."
4582 echo "AC_DEFUN([${macro_prefix_arg}_LIBSOURCES], ["
4583 echo " m4_foreach([_gl_NAME], [\$1], ["
4584 echo " m4_if(_gl_NAME, [alloca.c], [], ["
4585 echo " m4_define([${macro_prefix_arg}_LIBSOURCES_DIR], [$sourcebase_arg])"
4586 echo " m4_append([${macro_prefix_arg}_LIBSOURCES_LIST], _gl_NAME, [ ])"
4592 # func_emit_shellvars_init gentests base
4593 # emits some shell variable assignments to standard output.
4594 # - gentests true if a tests Makefile.am is being generated,
4596 # - base base directory, relative to the top-level directory
4597 # - automake_subdir true if --automake-subdir was given, false otherwise
4598 # - automake_subdir_tests true if --automake-subdir-tests was given, false otherwise
4599 func_emit_shellvars_init
()
4601 # Define the base directory, relative to the top-level directory.
4602 echo " gl_source_base='$2'"
4603 # Define the prefix for the file name of generated files.
4604 if $1 && $automake_subdir_tests; then
4605 # When tests share the same Makefile as the whole project, they
4606 # share the same base prefix.
4607 if test "$2" = "$testsbase"; then
4608 echo " gl_source_base_prefix='\$(top_build_prefix)$sourcebase/'"
4610 echo " gl_source_base_prefix='\$(top_build_prefix)$2/'"
4612 elif ! $1 && $automake_subdir; then
4613 echo " gl_source_base_prefix='\$(top_build_prefix)$2/'"
4615 echo " gl_source_base_prefix="
4619 # func_emit_autoconf_snippet indentation
4620 # emits the autoconf snippet of a module.
4622 # - indentation spaces to prepend on each line
4623 # - local_gnulib_path from --local-dir
4624 # - modcache true or false, from --cache-modules/--no-cache-modules
4625 # - sed_replace_build_aux sed expression that replaces reference to build-aux
4626 # - sed_replace_include_guard_prefix
4627 # sed expression for resolving ${gl_include_guard_prefix}
4628 # - module the module name
4629 # - toplevel true or false. 'false' means a subordinate use of
4631 # - disable_libtool true or false. It tells whether to disable libtool
4632 # handling even if it has been specified through the
4633 # command line options.
4634 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
4636 func_emit_autoconf_snippet
()
4639 if { case $module in
4640 gnumakefile | maintainer-makefile
)
4641 # These modules are meant to be used only in the top-level directory.
4647 func_get_autoconf_snippet
"$module" \
4648 |
sed -e '/^$/d;' -e "s/^/$indentation/" \
4649 -e "$sed_replace_build_aux" \
4650 -e "$sed_replace_include_guard_prefix" \
4651 |
{ if $disable_libtool; then
4652 sed -e 's/\$gl_cond_libtool/false/g' \
4653 -e 's/gl_libdeps/gltests_libdeps/g' \
4654 -e 's/gl_ltlibdeps/gltests_ltlibdeps/g'
4659 |
{ if $disable_gettext; then
4660 sed -e 's/AM_GNU_GETTEXT(\[external])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./'
4662 # Don't indent AM_GNU_GETTEXT_VERSION line, as that confuses
4663 # autopoint through at least GNU gettext version 0.18.2.
4664 sed -e 's/^ *AM_GNU_GETTEXT_VERSION/AM_GNU_GETTEXT_VERSION/'
4667 if test "$module" = 'alloca' && test "$libtool" = true
&& ! $disable_libtool; then
4668 echo 'changequote(,)dnl'
4669 echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
4670 echo 'changequote([, ])dnl'
4671 echo 'AC_SUBST([LTALLOCA])'
4676 # func_emit_autoconf_snippets modules referenceable_modules verifier toplevel disable_libtool disable_gettext
4677 # collects and emit the autoconf snippets of a set of modules.
4679 # - local_gnulib_path from --local-dir
4680 # - modcache true or false, from --cache-modules/--no-cache-modules
4681 # - sed_replace_build_aux sed expression that replaces reference to build-aux
4682 # - sed_replace_include_guard_prefix
4683 # sed expression for resolving ${gl_include_guard_prefix}
4684 # - modules the list of modules.
4685 # - referenceable_modules the list of modules which may be referenced as dependencies.
4686 # - verifier one of func_verify_module, func_verify_nontests_module,
4687 # func_verify_tests_module. It selects the subset of
4688 # $modules to consider.
4689 # - toplevel true or false. 'false' means a subordinate use of
4691 # - disable_libtool true or false. It tells whether to disable libtool
4692 # handling even if it has been specified through the
4693 # command line options.
4694 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
4696 func_emit_autoconf_snippets
()
4698 referenceable_modules
="$2"
4701 disable_libtool
="$5"
4702 disable_gettext
="$6"
4703 if test "$cond_dependencies" = true
; then
4704 for m
in $referenceable_modules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/modules
4705 # Emit the autoconf code for the unconditional modules.
4706 for module
in $1; do
4708 if test -n "$module"; then
4709 if func_cond_module_p
"$module"; then
4712 func_emit_autoconf_snippet
" "
4716 # Initialize the shell variables indicating that the modules are enabled.
4717 for module
in $1; do
4719 if test -n "$module"; then
4720 if func_cond_module_p
"$module"; then
4721 func_module_shellvar_name
"$module"
4722 echo " $shellvar=false"
4726 # Emit the autoconf code for the conditional modules, each in a separate
4727 # function. This makes it possible to support cycles among conditional
4729 for module
in $1; do
4731 if test -n "$module"; then
4732 if func_cond_module_p
"$module"; then
4733 func_module_shellfunc_name
"$module"
4734 func_module_shellvar_name
"$module"
4735 echo " $shellfunc ()"
4737 echo " if \$$shellvar; then :; else"
4738 func_emit_autoconf_snippet
" "
4739 echo " $shellvar=true"
4740 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
4741 # Intersect $deps with the modules list $1.
4742 deps
=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
4743 for dep
in $deps; do
4744 if func_cond_module_p
"$dep"; then
4745 func_module_shellfunc_name
"$dep"
4746 func_cond_module_condition
"$module" "$dep"
4747 if test "$condition" != true
; then
4748 echo " if $condition; then"
4755 # The autoconf code for $dep has already been emitted above and
4756 # therefore is already executed when this function is run.
4765 # Emit the dependencies from the unconditional to the conditional modules.
4766 for module
in $1; do
4768 if test -n "$module"; then
4769 if func_cond_module_p
"$module"; then
4772 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
4773 # Intersect $deps with the modules list $1.
4774 deps
=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
4775 for dep
in $deps; do
4776 if func_cond_module_p
"$dep"; then
4777 func_module_shellfunc_name
"$dep"
4778 func_cond_module_condition
"$module" "$dep"
4779 if test "$condition" != true
; then
4780 echo " if $condition; then"
4787 # The autoconf code for $dep has already been emitted above and
4788 # therefore is already executed when this code is run.
4795 # Define the Automake conditionals.
4796 echo " m4_pattern_allow([^${macro_prefix}_GNULIB_ENABLED_])"
4797 for module
in $1; do
4799 if test -n "$module"; then
4800 if func_cond_module_p
"$module"; then
4801 func_module_conditional_name
"$module"
4802 func_module_shellvar_name
"$module"
4803 echo " AM_CONDITIONAL([$conditional], [\$$shellvar])"
4808 # Ignore the conditions, and enable all modules unconditionally.
4809 for module
in $1; do
4811 if test -n "$module"; then
4812 func_emit_autoconf_snippet
" "
4818 # func_emit_pre_early_macros require indentation modules
4819 # The require parameter can be ':' (AC_REQUIRE) or 'false' (direct call).
4820 func_emit_pre_early_macros
()
4823 echo "${2}# Pre-early section."
4825 _pre_early_snippet
="echo \"${2}AC_REQUIRE([\$_pre_early_macro])\""
4827 _pre_early_snippet
="echo \"${2}\$_pre_early_macro\""
4830 # We need to call gl_USE_SYSTEM_EXTENSIONS before gl_PROG_AR_RANLIB. Doing
4831 # AC_REQUIRE in configure-ac.early is not early enough.
4832 _pre_early_macro
="gl_USE_SYSTEM_EXTENSIONS"
4833 case "${nl}${3}${nl}" in
4834 *${nl}extensions
${nl}*) eval "$_pre_early_snippet" ;;
4837 _pre_early_macro
="gl_PROG_AR_RANLIB"
4838 eval "$_pre_early_snippet"
4842 # func_reconstruct_cached_dir
4843 # callback for func_reconstruct_cached_local_gnulib_path
4845 # - destdir from --dir
4847 # - local_gnulib_path restored '--local-dir' path from cache
4848 func_reconstruct_cached_dir
()
4851 if test -n "$cached_dir"; then
4852 case "$cached_dir" in
4854 func_path_append local_gnulib_path
"$cached_dir" ;;
4858 # XXX This doesn't look right.
4859 func_path_append local_gnulib_path
"$destdir/$cached_dir" ;;
4861 func_relconcat
"$destdir" "$cached_dir"
4862 func_path_append local_gnulib_path
"$relconcat" ;;
4868 # func_reconstruct_cached_local_gnulib_path
4869 # reconstruct local_gnulib_path from cached_local_gnulib_path to be set
4870 # relatively to $destdir again.
4872 # - cached_local_gnulib_path local_gnulib_path stored within gnulib-cache.m4
4873 # - destdir from --dir
4875 # - local_gnulib_path restored '--local-dir' path from cache
4876 func_reconstruct_cached_local_gnulib_path
()
4878 func_path_foreach
"$cached_local_gnulib_path" func_reconstruct_cached_dir
%dir
%
4881 # func_import modules
4882 # Uses also the variables
4883 # - mode import or add-import or remove-import or update
4884 # - destdir target directory
4885 # - local_gnulib_path from --local-dir
4886 # - modcache true or false, from --cache-modules/--no-cache-modules
4887 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
4888 # - libname library name
4889 # - supplied_libname true if --lib was given, blank otherwise
4890 # - sourcebase directory relative to destdir where to place source code
4891 # - m4base directory relative to destdir where to place *.m4 macros
4892 # - pobase directory relative to destdir where to place *.po files
4893 # - docbase directory relative to destdir where to place doc files
4894 # - testsbase directory relative to destdir where to place unit test code
4895 # - auxdir directory relative to destdir where to place build aux files
4896 # - inctests true if --with-tests was given, false otherwise
4897 # - incobsolete true if --with-obsolete was given, blank otherwise
4898 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
4899 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
4901 # - inc_privileged_tests true if --with-privileged-tests was given, blank
4903 # - inc_unportable_tests true if --with-unportable-tests was given, blank
4905 # - inc_all_tests true if --with-all-tests was given, blank otherwise
4906 # - avoidlist list of modules to avoid, from --avoid
4907 # - cond_dependencies true if --conditional-dependencies was given, false if
4908 # --no-conditional-dependencies was given, blank otherwise
4909 # - lgpl yes or a number if library's license shall be LGPL,
4911 # - makefile_name from --makefile-name
4912 # - tests_makefile_name from --tests-makefile-name
4913 # - libtool true if --libtool was given, false if --no-libtool was
4914 # given, blank otherwise
4915 # - guessed_libtool true if the configure.ac file uses libtool, false otherwise
4916 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4917 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
4918 # - witness_c_macro from --witness-c-macro
4919 # - vc_files true if --vc-files was given, false if --no-vc-files was
4920 # given, blank otherwise
4921 # - autoconf_minversion minimum supported autoconf version
4922 # - doit : if actions shall be executed, false if only to be printed
4923 # - copymode copy mode for files in general
4924 # - lcopymode copy mode for files from local_gnulib_path
4927 # Get the cached settings.
4928 # In 'import' mode, we read them only for the purpose of knowing the old
4929 # installed file list, and don't use them as defaults.
4930 cached_local_gnulib_path
=
4931 cached_specified_modules
=
4933 cached_inc_cxx_tests
=
4934 cached_inc_longrunning_tests
=
4935 cached_inc_privileged_tests
=
4936 cached_inc_unportable_tests
=
4937 cached_inc_all_tests
=
4947 cached_makefile_name
=
4948 cached_tests_makefile_name
=
4949 cached_automake_subdir
=
4950 cached_cond_dependencies
=
4952 cached_macro_prefix
=
4954 cached_witness_c_macro
=
4957 if test -f "$destdir"/$m4base/gnulib-cache.
m4; then
4958 cached_libtool
=false
4964 s,^.*gl_LOCAL_DIR([[ ]*\([^]"$`\\)]*\).*$,cached_local_gnulib_path="\1",p
4974 s,^.*gl_MODULES([[ ]*\([^]"$`\\)]*\).*$,cached_specified_modules="\1",p
4976 /gl_WITH_OBSOLETE/ {
4977 s,^.*$,cached_incobsolete=true,p
4979 /gl_WITH_CXX_TESTS/ {
4980 s,^.*$,cached_inc_cxx_tests=true,p
4982 /gl_WITH_LONGRUNNING_TESTS/ {
4983 s,^.*$,cached_inc_longrunning_tests=true,p
4985 /gl_WITH_PRIVILEGED_TESTS/ {
4986 s,^.*$,cached_inc_privileged_tests=true,p
4988 /gl_WITH_UNPORTABLE_TESTS/ {
4989 s,^.*$,cached_inc_unportable_tests=true,p
4991 /gl_WITH_ALL_TESTS/ {
4992 s,^.*$,cached_inc_all_tests=true,p
4995 s,^.*gl_AVOID([[ ]*\([^]"$`\\)]*\).*$,cached_avoidlist="\1",p
4998 s,^.*gl_SOURCE_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_sourcebase="\1",p
5001 s,^.*gl_M4_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_m4base="\1",p
5004 s,^.*gl_PO_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_pobase="\1",p
5007 s,^.*gl_DOC_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_docbase="\1",p
5010 s,^.*gl_TESTS_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_testsbase="\1",p
5013 s,^.*$,cached_inctests=true,p
5016 s,^.*gl_LIB([[ ]*\([^]"$`\\)]*\).*$,cached_libname="\1",p
5019 s,^.*gl_LGPL([[ ]*\([^]"$`\\)]*\).*$,cached_lgpl="\1",p
5022 s,^.*$,cached_lgpl=yes,p
5024 /gl_MAKEFILE_NAME(/ {
5025 s,^.*gl_MAKEFILE_NAME([[ ]*\([^]"$`\\)]*\).*$,cached_makefile_name="\1",p
5027 /gl_TESTS_MAKEFILE_NAME(/ {
5028 s,^.*gl_TESTS_MAKEFILE_NAME([[ ]*\([^]"$`\\)]*\).*$,cached_tests_makefile_name="\1",p
5030 /gl_AUTOMAKE_SUBDIR/ {
5031 s,^.*$,cached_automake_subdir=true,p
5033 /gl_CONDITIONAL_DEPENDENCIES/ {
5034 s,^.*$,cached_cond_dependencies=true,p
5037 s,^.*$,cached_libtool=true,p
5039 /gl_MACRO_PREFIX(/ {
5040 s,^.*gl_MACRO_PREFIX([[ ]*\([^]"$`\\)]*\).*$,cached_macro_prefix="\1",p
5043 s,^.*gl_PO_DOMAIN([[ ]*\([^]"$`\\)]*\).*$,cached_po_domain="\1",p
5045 /gl_WITNESS_C_MACRO(/ {
5046 s,^.*gl_WITNESS_C_MACRO([[ ]*\([^]"$`\\)]*\).*$,cached_witness_c_macro="\1",p
5049 s,^.*gl_VC_FILES([[ ]*\([^]"$`\\)]*\).*$,cached_vc_files="\1",p
5051 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-cache.m4`
5052 if test -f "$destdir"/$m4base/gnulib-comp.
m4; then
5057 /AC_DEFUN(\['"${cached_macro_prefix}"'_FILE_LIST], \[/ {
5058 s,^.*$,cached_files=",p
5071 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-comp.m4`
5075 if test "$mode" = import
; then
5076 # In 'import' mode, the new set of specified modules overrides the cached
5077 # set of modules. Ignore the cached settings.
5078 specified_modules
="$1"
5080 # Merge the cached settings with the specified ones.
5081 # The m4base must be the same as expected from the pathname.
5082 if test -n "$cached_m4base" && test "$cached_m4base" != "$m4base"; then
5083 func_fatal_error
"$m4base/gnulib-cache.m4 is expected to contain gl_M4_BASE([$m4base])"
5085 # The local_gnulib_path defaults to the cached one. Recall that the cached one
5086 # is relative to $destdir, whereas the one we use is relative to . or absolute.
5087 if test -z "$local_gnulib_path"; then
5088 func_reconstruct_cached_local_gnulib_path
5092 # Append the cached and the specified module names. So that
5093 # "gnulib-tool --add-import foo" means to add the module foo.
5094 specified_modules
="$cached_specified_modules $1"
5097 # Take the cached module names, minus the specified module names.
5099 if $have_associative; then
5100 # Use an associative array, for O(N) worst-case run time.
5101 declare -A to_remove
5103 eval 'to_remove[$m]=yes'
5105 for module
in $cached_specified_modules; do
5106 if eval 'test -z "${to_remove[$module]}"'; then
5107 func_append specified_modules
"$module "
5111 # This loop has O(N**2) worst-case run time.
5112 for module
in $cached_specified_modules; do
5115 if test "$m" = "$module"; then
5120 if test -z "$to_remove"; then
5121 func_append specified_modules
"$module "
5127 # Take the cached module names. There are no specified module names.
5128 specified_modules
="$cached_specified_modules"
5131 # Included obsolete modules among the dependencies if specified either way.
5132 if test -z "$incobsolete"; then
5133 incobsolete
="$cached_incobsolete"
5135 # Included special kinds of tests modules among the dependencies if specified
5137 if test -z "$inc_cxx_tests"; then
5138 inc_cxx_tests
="$cached_inc_cxx_tests"
5140 if test -z "$inc_longrunning_tests"; then
5141 inc_longrunning_tests
="$cached_inc_longrunning_tests"
5143 if test -z "$inc_privileged_tests"; then
5144 inc_privileged_tests
="$cached_inc_privileged_tests"
5146 if test -z "$inc_unportable_tests"; then
5147 inc_unportable_tests
="$cached_inc_unportable_tests"
5149 if test -z "$inc_all_tests"; then
5150 inc_all_tests
="$cached_inc_all_tests"
5152 # Append the cached and the specified avoidlist. This is probably better
5153 # than dropping the cached one when --avoid is specified at least once.
5154 avoidlist
=`for m in $cached_avoidlist $avoidlist; do echo $m; done | LC_ALL=C sort -u`
5155 avoidlist
=`echo $avoidlist`
5157 # The sourcebase defaults to the cached one.
5158 if test -z "$sourcebase"; then
5159 sourcebase
="$cached_sourcebase"
5160 if test -z "$sourcebase"; then
5161 func_fatal_error
"missing --source-base option"
5164 # The pobase defaults to the cached one.
5165 if test -z "$pobase"; then
5166 pobase
="$cached_pobase"
5168 # The docbase defaults to the cached one.
5169 if test -z "$docbase"; then
5170 docbase
="$cached_docbase"
5171 if test -z "$docbase"; then
5172 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."
5175 # The testsbase defaults to the cached one.
5176 if test -z "$testsbase"; then
5177 testsbase
="$cached_testsbase"
5178 if test -z "$testsbase"; then
5179 func_fatal_error
"missing --tests-base option"
5182 # Require the tests if specified either way.
5183 if ! $inctests; then
5184 inctests
="$cached_inctests"
5185 if test -z "$inctests"; then
5189 # The libname defaults to the cached one.
5190 if test -z "$supplied_libname"; then
5191 libname
="$cached_libname"
5192 if test -z "$libname"; then
5193 func_fatal_error
"missing --lib option"
5196 # Require LGPL if specified either way.
5197 if test -z "$lgpl"; then
5200 # The makefile_name defaults to the cached one.
5201 if test -z "$makefile_name"; then
5202 makefile_name
="$cached_makefile_name"
5204 # The tests_makefile_name defaults to the cached one.
5205 if test -z "$tests_makefile_name"; then
5206 tests_makefile_name
="$cached_tests_makefile_name"
5208 # Use automake-subdir mode if specified either way.
5209 if ! $automake_subdir; then
5210 automake_subdir
="$cached_automake_subdir"
5211 if test -z "$automake_subdir"; then
5212 automake_subdir
=false
5215 # Use conditional dependencies if specified either way.
5216 if test -z "$cond_dependencies"; then
5217 cond_dependencies
="$cached_cond_dependencies"
5219 # Use libtool if specified either way, or if guessed.
5220 if test -z "$libtool"; then
5221 if test -n "$cached_m4base"; then
5222 libtool
="$cached_libtool"
5224 libtool
="$guessed_libtool"
5227 # The macro_prefix defaults to the cached one.
5228 if test -z "$macro_prefix"; then
5229 macro_prefix
="$cached_macro_prefix"
5230 if test -z "$macro_prefix"; then
5231 func_fatal_error
"missing --macro-prefix option"
5234 # The po_domain defaults to the cached one.
5235 if test -z "$po_domain"; then
5236 po_domain
="$cached_po_domain"
5238 # The witness_c_macro defaults to the cached one.
5239 if test -z "$witness_c_macro"; then
5240 witness_c_macro
="$cached_witness_c_macro"
5242 # The vc_files defaults to the cached one.
5243 if test -z "$vc_files"; then
5244 vc_files
="$cached_vc_files"
5246 # Ensure constraints.
5247 if test "$cond_dependencies" = true
&& $inctests; then
5248 echo "gnulib-tool: option --conditional-dependencies is not supported with --with-tests" 1>&2
5252 # --without-*-tests options are not supported here.
5254 excl_longrunning_tests
=
5255 excl_privileged_tests
=
5256 excl_unportable_tests
=
5258 # Canonicalize the list of specified modules.
5259 specified_modules
=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
5261 # Include all kinds of tests modules if --with-all-tests was specified.
5262 inc_all_direct_tests
="$inc_all_tests"
5263 inc_all_indirect_tests
="$inc_all_tests"
5265 # Determine final module list.
5266 modules
="$specified_modules"
5267 func_modules_transitive_closure
5268 if test $verbose -ge 0; then
5269 func_show_module_list
5271 final_modules
="$modules"
5273 # Determine main module list and tests-related module list separately.
5274 func_modules_transitive_closure_separately
5276 # Determine whether a $testsbase/libtests.a is needed.
5277 func_determine_use_libtests
5279 # Add the dummy module to the main module list or to the tests-related module
5281 func_modules_add_dummy_separately
5283 # If --lgpl, verify that the licenses of modules are compatible.
5284 if test -n "$lgpl"; then
5285 license_incompatibilities
=
5286 for module
in $main_modules; do
5287 license
=`func_get_license $module`
5289 'GPLv2+ build tool' |
'GPLed build tool') ;;
5290 'public domain' |
'unlimited' |
'unmodifiable license text') ;;
5295 LGPLv2
+ |
'LGPLv3+ or GPLv2+' | LGPLv3
+ | LGPL
) ;;
5296 *) func_append license_incompatibilities
"$module $license$nl" ;;
5301 LGPLv2
+ |
'LGPLv3+ or GPLv2+') ;;
5302 *) func_append license_incompatibilities
"$module $license$nl" ;;
5308 *) func_append license_incompatibilities
"$module $license$nl" ;;
5311 *) func_fatal_error
"invalid value lgpl=$lgpl" ;;
5316 if test -n "$license_incompatibilities"; then
5317 # Format the license incompatibilities as a table.
5318 sed_expand_column1_width50_indent17
='s,^\([^ ]*\) ,\1 ,
5319 s,^\(.................................................[^ ]*\) *, \1 ,'
5320 license_incompatibilities
=`echo "$license_incompatibilities" | sed -e "$sed_expand_column1_width50_indent17"`
5321 func_fatal_error
"incompatible license on modules:$nl$license_incompatibilities"
5325 # Show banner notice of every module.
5326 modules
="$main_modules"
5329 # Determine script to apply to imported library files.
5330 sed_transform_lib_file
=
5331 for module
in $main_modules; do
5332 if test $module = config-h
; then
5333 # Assume config.h exists, and that -DHAVE_CONFIG_H is omitted.
5334 sed_transform_lib_file
=$sed_transform_lib_file'
5335 s/^#ifdef[ ]*HAVE_CONFIG_H[ ]*$/#if 1/
5340 sed_transform_main_lib_file
="$sed_transform_lib_file"
5342 # Determine script to apply to auxiliary files that go into $auxdir/.
5343 sed_transform_build_aux_file
=
5345 # Determine script to apply to library files that go into $testsbase/.
5346 sed_transform_testsrelated_lib_file
="$sed_transform_lib_file"
5348 # Determine the final file lists.
5349 func_modules_to_filelist_separately
5352 || func_fatal_error
"refusing to do nothing"
5354 # Add m4/gnulib-tool.m4 to the file list. It is not part of any module.
5355 new_files
="$files m4/gnulib-tool.m4"
5356 old_files
="$cached_files"
5357 if test -f "$destdir"/$m4base/gnulib-tool.
m4; then
5358 func_append old_files
" m4/gnulib-tool.m4"
5361 rewritten
='%REWRITTEN%'
5362 sed_rewrite_old_files
="\
5363 s,^build-aux/,$rewritten$auxdir/,
5364 s,^doc/,$rewritten$cached_docbase/,
5365 s,^lib/,$rewritten$cached_sourcebase/,
5366 s,^m4/,$rewritten$cached_m4base/,
5367 s,^tests/,$rewritten$cached_testsbase/,
5368 s,^tests=lib/,$rewritten$cached_testsbase/,
5371 sed_rewrite_new_files
="\
5372 s,^build-aux/,$rewritten$auxdir/,
5373 s,^doc/,$rewritten$docbase/,
5374 s,^lib/,$rewritten$sourcebase/,
5375 s,^m4/,$rewritten$m4base/,
5376 s,^tests/,$rewritten$testsbase/,
5377 s,^tests=lib/,$rewritten$testsbase/,
5381 # Determine whether to put anything into $testsbase.
5382 testsfiles
=`echo "$files" | sed -n -e 's,^tests/,,p' -e 's,^tests=lib/,,p'`
5383 if test -n "$testsfiles"; then
5389 # Create directories.
5390 { echo "$sourcebase"
5392 if test -n "$pobase"; then
5395 docfiles
=`echo "$files" | sed -n -e 's,^doc/,,p'`
5396 if test -n "$docfiles"; then
5403 for f
in $files; do echo $f; done \
5404 |
sed -e "$sed_rewrite_new_files" \
5405 |
sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
5408 { # Rearrange file descriptors. Needed because "while ... done < ..."
5409 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5410 exec 5<&0 < "$tmp"/dirs
5412 if test ! -d "$destdir/$d"; then
5414 echo "Creating directory $destdir/$d"
5415 mkdir
-p "$destdir/$d" || func_fatal_error
"failed"
5417 echo "Create directory $destdir/$d"
5424 # Copy files or make symbolic links or hard links. Remove obsolete files.
5428 # Construct a table with 2 columns: rewritten-file-name original-file-name,
5429 # representing the files according to the last gnulib-tool invocation.
5430 for f
in $old_files; do echo $f; done \
5431 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_old_files" \
5434 # Construct a table with 2 columns: rewritten-file-name original-file-name,
5435 # representing the files after this gnulib-tool invocation.
5436 for f
in $new_files; do echo $f; done \
5437 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" \
5440 # First the files that are in old-files, but not in new-files:
5441 sed_take_first_column
='s,'"$delimiter"'.*,,'
5442 for g
in `LC_ALL=C join -t"$delimiter" -v1 "$tmp"/old-files "$tmp"/new-files | sed -e "$sed_take_first_column"`; do
5443 # Remove the file. Do nothing if the user already removed it.
5444 if test -f "$destdir/$g" ||
test -h "$destdir/$g"; then
5446 echo "Removing file $g (backup in ${g}~)"
5447 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error
"failed"
5449 echo "Remove file $g (backup in ${g}~)"
5451 func_append removed_files
"$g$nl"
5454 # func_add_or_update handles a file that ought to be present afterwards.
5456 # - f the original file name
5457 # - g the rewritten file name
5458 # - already_present nonempty if the file should already exist, empty
5460 func_add_or_update
()
5464 tests
=lib
/*) f
=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
5466 func_dest_tmpfilename
"$g"
5467 func_lookup_file
"$f"
5468 cp "$lookedup_file" "$tmpfile" || func_fatal_error
"failed"
5469 func_ensure_writable
"$tmpfile"
5472 # Don't process binary files with sed.
5475 if test -n "$sed_transform_main_lib_file"; then
5478 sed -e "$sed_transform_main_lib_file" \
5479 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
5483 if test -n "$sed_transform_build_aux_file"; then
5486 sed -e "$sed_transform_build_aux_file" \
5487 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
5491 if test -n "$sed_transform_testsrelated_lib_file"; then
5494 sed -e "$sed_transform_testsrelated_lib_file" \
5495 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
5501 if test -f "$destdir/$g"; then
5502 # The file already exists.
5506 # Don't protest if the file should be there but isn't: it happens
5507 # frequently that developers don't put autogenerated files under version control.
5509 func_append added_files
"$g$nl"
5513 # Then the files that are in new-files, but not in old-files:
5514 sed_take_last_column
='s,^.*'"$delimiter"',,'
5516 LC_ALL
=C
join -t"$delimiter" -v2 "$tmp"/old-files
"$tmp"/new-files \
5517 |
sed -e "$sed_take_last_column" \
5518 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/added-files
5519 { # Rearrange file descriptors. Needed because "while ... done < ..."
5520 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5521 exec 5<&0 < "$tmp"/added-files
5527 # Then the files that are in new-files and in old-files:
5528 already_present
=true
5529 LC_ALL
=C
join -t"$delimiter" "$tmp"/old-files
"$tmp"/new-files \
5530 |
sed -e "$sed_take_last_column" \
5531 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/kept-files
5532 { # Rearrange file descriptors. Needed because "while ... done < ..."
5533 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5534 exec 5<&0 < "$tmp"/kept-files
5541 # Command-line invocation printed in a comment in generated gnulib-cache.m4.
5542 actioncmd
="# gnulib-tool --import"
5545 func_append_local_dir
()
5547 func_append
"$1" " --local-dir=$2"
5549 func_path_foreach
"$local_gnulib_path" func_append_local_dir actioncmd
%dir
%
5551 # Break the action command log into multiple lines.
5552 # Emacs puts some gnulib-tool log lines in its source repository, and
5553 # git send-email rejects patch lines longer than 998 characters.
5554 # Also, config.status uses awk, and the HP-UX 11.00 awk fails if a
5555 # line has length >= 3071; similarly, the IRIX 6.5 awk fails if a
5556 # line has length >= 3072.
5557 func_append_actionarg
()
5559 func_append actioncmd
" \\$nl# $1"
5561 func_append_actionarg
"--lib=$libname"
5562 func_append_actionarg
"--source-base=$sourcebase"
5563 func_append_actionarg
"--m4-base=$m4base"
5564 if test -n "$pobase"; then
5565 func_append_actionarg
"--po-base=$pobase"
5567 func_append_actionarg
"--doc-base=$docbase"
5568 func_append_actionarg
"--tests-base=$testsbase"
5569 func_append_actionarg
"--aux-dir=$auxdir"
5571 func_append_actionarg
"--with-tests"
5573 if test -n "$incobsolete"; then
5574 func_append_actionarg
"--with-obsolete"
5576 if test -n "$inc_cxx_tests"; then
5577 func_append_actionarg
"--with-c++-tests"
5579 if test -n "$inc_longrunning_tests"; then
5580 func_append_actionarg
"--with-longrunning-tests"
5582 if test -n "$inc_privileged_tests"; then
5583 func_append_actionarg
"--with-privileged-tests"
5585 if test -n "$inc_unportable_tests"; then
5586 func_append_actionarg
"--with-unportable-tests"
5588 if test -n "$inc_all_tests"; then
5589 func_append_actionarg
"--with-all-tests"
5591 if test -n "$lgpl"; then
5592 if test "$lgpl" = yes; then
5593 func_append_actionarg
"--lgpl"
5595 func_append_actionarg
"--lgpl=$lgpl"
5599 func_append_actionarg
"--gnu-make"
5601 if test -n "$makefile_name"; then
5602 func_append_actionarg
"--makefile-name=$makefile_name"
5604 if test -n "$tests_makefile_name"; then
5605 func_append_actionarg
"--tests-makefile-name=$tests_makefile_name"
5607 if $automake_subdir; then
5608 func_append_actionarg
"--automake-subdir"
5610 if $automake_subdir_tests; then
5611 func_append_actionarg
"--automake-subdir-tests"
5613 if test "$cond_dependencies" = true
; then
5614 func_append_actionarg
"--conditional-dependencies"
5616 func_append_actionarg
"--no-conditional-dependencies"
5618 if test "$libtool" = true
; then
5619 func_append_actionarg
"--libtool"
5621 func_append_actionarg
"--no-libtool"
5623 func_append_actionarg
"--macro-prefix=$macro_prefix"
5624 if test -n "$po_domain"; then
5625 func_append_actionarg
"--po-domain=$po_domain"
5627 if test -n "$witness_c_macro"; then
5628 func_append_actionarg
"--witness-c-macro=$witness_c_macro"
5630 if test -n "$vc_files"; then
5631 if test "$vc_files" = true
; then
5632 func_append_actionarg
"--vc-files"
5634 func_append_actionarg
"--no-vc-files"
5637 for module
in $avoidlist; do
5638 func_append_actionarg
"--avoid=$module"
5640 for module
in $specified_modules; do
5641 func_append_actionarg
"$module"
5644 # Determine include_guard_prefix and module_indicator_prefix.
5645 func_compute_include_guard_prefix
5647 # Default the source makefile name to Makefile.am.
5648 if test -n "$makefile_name"; then
5649 source_makefile_am
="$makefile_name"
5651 source_makefile_am
='Makefile.am'
5653 # Default the tests makefile name to the source makefile name.
5654 if test -n "$tests_makefile_name"; then
5655 tests_makefile_am
="$tests_makefile_name"
5657 tests_makefile_am
="$source_makefile_am"
5660 # Create normal Makefile.ams.
5663 # Setup list of Makefile.am edits that are to be performed afterwards.
5664 # Some of these edits apply to files that we will generate; others are
5665 # under the responsibility of the developer.
5667 # func_note_Makefile_am_edit dir var value [dotfirst]
5668 # remembers that ${dir}Makefile.am needs to be edited to that ${var} mentions
5670 # If ${dotfirst} is non-empty, this mention needs to be present after '.'.
5671 # This is a special hack for the SUBDIRS variable, cf.
5672 # <https://www.gnu.org/software/automake/manual/html_node/Subdirectories.html>.
5673 func_note_Makefile_am_edit
()
5675 makefile_am_edits
=`expr $makefile_am_edits + 1`
5676 eval makefile_am_edit
${makefile_am_edits}_dir
=\"\
$1\"
5677 eval makefile_am_edit
${makefile_am_edits}_var
=\"\
$2\"
5678 eval makefile_am_edit
${makefile_am_edits}_val
=\"\
$3\"
5679 eval makefile_am_edit
${makefile_am_edits}_dotfirst
=\"\
$4\"
5681 if test "$source_makefile_am" = Makefile.am
; then
5682 sourcebase_dir
=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'`
5683 sourcebase_base
=`basename "$sourcebase"`
5684 func_note_Makefile_am_edit
"$sourcebase_dir" SUBDIRS
"$sourcebase_base"
5686 if test -n "$pobase"; then
5687 pobase_dir
=`echo "$pobase" | sed -n -e 's,/[^/]*$,/,p'`
5688 pobase_base
=`basename "$pobase"`
5689 func_note_Makefile_am_edit
"$pobase_dir" SUBDIRS
"$pobase_base"
5692 if test "$tests_makefile_am" = Makefile.am
; then
5693 testsbase_dir
=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'`
5694 testsbase_base
=`basename "$testsbase"`
5695 func_note_Makefile_am_edit
"$testsbase_dir" SUBDIRS
"$testsbase_base" true
5698 func_note_Makefile_am_edit
"" ACLOCAL_AMFLAGS
"${m4base}"
5700 # Find the first parent directory of $m4base that contains or will contain
5702 sed_last
='s,^.*/\([^/][^/]*\)//*$,\1/,
5704 sed_butlast
='s,[^/][^/]*//*$,,'
5705 dir1
="${m4base}/"; dir2
=""
5706 while test -n "$dir1" \
5707 && ! { test -f "${destdir}/${dir1}Makefile.am" \
5708 ||
test "${dir1}Makefile.am" = "$sourcebase/$source_makefile_am" \
5709 ||
test "./${dir1}Makefile.am" = "$sourcebase/$source_makefile_am" \
5711 && { test "${dir1}Makefile.am" = "$testsbase/$tests_makefile_am" \
5712 ||
test "./${dir1}Makefile.am" = "$testsbase/$tests_makefile_am"; }; }; }; do
5713 dir2
=`echo "$dir1" | sed -e "$sed_last"`"$dir2"
5714 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
5716 func_note_Makefile_am_edit
"$dir1" EXTRA_DIST
"${dir2}gnulib-cache.m4"
5719 # Create po/ directory.
5720 if test -n "$pobase"; then
5721 # Create po makefile and auxiliary files.
5722 for file in Makefile.
in.
in remove-potcdate.sin
; do
5723 func_dest_tmpfilename
$pobase/$file
5724 func_lookup_file build-aux
/po
/$file
5725 cat "$lookedup_file" > "$tmpfile"
5726 if test -f "$destdir"/$pobase/$file; then
5727 if cmp -s "$destdir"/$pobase/$file "$tmpfile"; then
5731 echo "Updating $pobase/$file (backup in $pobase/$file~)"
5732 mv -f "$destdir"/$pobase/$file "$destdir"/$pobase/$file~
5733 mv -f "$tmpfile" "$destdir"/$pobase/$file
5735 echo "Update $pobase/$file (backup in $pobase/$file~)"
5741 echo "Creating $pobase/$file"
5742 mv -f "$tmpfile" "$destdir"/$pobase/$file
5744 echo "Create $pobase/$file"
5747 func_append added_files
"$pobase/$file$nl"
5750 # Create po makefile parameterization, part 1.
5751 func_dest_tmpfilename
$pobase/Makevars
5752 func_emit_po_Makevars
> "$tmpfile"
5753 if test -f "$destdir"/$pobase/Makevars
; then
5754 if cmp -s "$destdir"/$pobase/Makevars
"$tmpfile"; then
5758 echo "Updating $pobase/Makevars (backup in $pobase/Makevars~)"
5759 mv -f "$destdir"/$pobase/Makevars
"$destdir"/$pobase/Makevars~
5760 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
5762 echo "Update $pobase/Makevars (backup in $pobase/Makevars~)"
5768 echo "Creating $pobase/Makevars"
5769 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
5771 echo "Create $pobase/Makevars"
5774 func_append added_files
"$pobase/Makevars$nl"
5776 # Create po makefile parameterization, part 2.
5777 func_dest_tmpfilename
$pobase/POTFILES.
in
5778 func_emit_po_POTFILES_in
> "$tmpfile"
5779 if test -f "$destdir"/$pobase/POTFILES.
in; then
5780 if cmp -s "$destdir"/$pobase/POTFILES.
in "$tmpfile"; then
5784 echo "Updating $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
5785 mv -f "$destdir"/$pobase/POTFILES.
in "$destdir"/$pobase/POTFILES.
in~
5786 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.
in
5788 echo "Update $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
5794 echo "Creating $pobase/POTFILES.in"
5795 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.
in
5797 echo "Create $pobase/POTFILES.in"
5800 func_append added_files
"$pobase/POTFILES.in$nl"
5803 TP_URL
="https://translationproject.org/latest/"
5805 echo "Fetching gnulib PO files from $TP_URL"
5806 (cd "$destdir"/$pobase \
5807 && wget
--no-verbose --mirror --level=1 -nd -A.po
-P .
"${TP_URL}gnulib/"
5810 echo "Fetch gnulib PO files from $TP_URL"
5812 # Create po/LINGUAS.
5814 func_dest_tmpfilename
$pobase/LINGUAS
5815 (cd "$destdir"/$pobase \
5816 && { echo '# Set of available languages.'
5817 LC_ALL
=C
ls -1 *.po |
sed -e 's,\.po$,,'
5820 if test -f "$destdir"/$pobase/LINGUAS
; then
5821 if cmp -s "$destdir"/$pobase/LINGUAS
"$tmpfile"; then
5824 echo "Updating $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
5825 mv -f "$destdir"/$pobase/LINGUAS
"$destdir"/$pobase/LINGUAS~
5826 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
5829 echo "Creating $pobase/LINGUAS"
5830 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
5831 func_append added_files
"$pobase/LINGUAS$nl"
5834 if test -f "$destdir"/$pobase/LINGUAS
; then
5835 echo "Update $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
5837 echo "Create $pobase/LINGUAS"
5842 # func_compute_relative_local_gnulib_path
5843 # gl_LOCAL_DIR requires local_gnulib_path to be set relatively to destdir
5845 # - local_gnulib_path from --local-dir
5846 # - destdir from --dir
5848 # - relative_local_dir path to be stored into gl_LOCAL_DIR
5849 func_compute_relative_local_gnulib_path
()
5851 relative_local_gnulib_path
=
5853 IFS
="$PATH_SEPARATOR"
5854 for local_dir
in $local_gnulib_path
5857 # Store the local_dir relative to destdir.
5858 case "$local_dir" in
5860 relative_local_dir
="$local_dir" ;;
5864 # XXX This doesn't look right.
5865 relative_local_dir
="$local_dir" ;;
5867 # destdir, local_dir are both relative.
5868 func_relativize
"$destdir" "$local_dir"
5869 relative_local_dir
="$reldir" ;;
5872 func_path_append relative_local_gnulib_path
"$relative_local_dir"
5877 # Create m4/gnulib-cache.m4.
5878 func_dest_tmpfilename
$m4base/gnulib-cache.
m4
5880 func_emit_copyright_notice
5882 echo "# This file represents the specification of how gnulib-tool is used."
5883 echo "# It acts as a cache: It is written and read by gnulib-tool."
5884 echo "# In projects that use version control, this file is meant to be put under"
5885 echo "# version control, like the configure.ac and various Makefile.am files."
5888 echo "# Specification in the form of a command-line invocation:"
5889 printf '%s\n' "$actioncmd"
5891 echo "# Specification in the form of a few gnulib-tool.m4 macro invocations:"
5892 func_compute_relative_local_gnulib_path
5893 echo "gl_LOCAL_DIR([$relative_local_gnulib_path])"
5895 echo "$specified_modules" |
sed -e 's/^/ /g'
5897 test -z "$incobsolete" ||
echo "gl_WITH_OBSOLETE"
5898 test -z "$inc_cxx_tests" ||
echo "gl_WITH_CXX_TESTS"
5899 test -z "$inc_longrunning_tests" ||
echo "gl_WITH_LONGRUNNING_TESTS"
5900 test -z "$inc_privileged_tests" ||
echo "gl_WITH_PRIVILEGED_TESTS"
5901 test -z "$inc_unportable_tests" ||
echo "gl_WITH_UNPORTABLE_TESTS"
5902 test -z "$inc_all_tests" ||
echo "gl_WITH_ALL_TESTS"
5903 echo "gl_AVOID([$avoidlist])"
5904 echo "gl_SOURCE_BASE([$sourcebase])"
5905 echo "gl_M4_BASE([$m4base])"
5906 echo "gl_PO_BASE([$pobase])"
5907 echo "gl_DOC_BASE([$docbase])"
5908 echo "gl_TESTS_BASE([$testsbase])"
5910 echo "gl_WITH_TESTS"
5912 echo "gl_LIB([$libname])"
5913 if test -n "$lgpl"; then
5914 if test "$lgpl" = yes; then
5917 echo "gl_LGPL([$lgpl])"
5920 echo "gl_MAKEFILE_NAME([$makefile_name])"
5921 if test -n "$tests_makefile_name"; then
5922 echo "gl_TESTS_MAKEFILE_NAME([$tests_makefile_name])"
5924 if test "$automake_subdir" = true
; then
5925 echo "gl_AUTOMAKE_SUBDIR"
5927 if test "$cond_dependencies" = true
; then
5928 echo "gl_CONDITIONAL_DEPENDENCIES"
5930 if test "$libtool" = true
; then
5933 echo "gl_MACRO_PREFIX([$macro_prefix])"
5934 echo "gl_PO_DOMAIN([$po_domain])"
5935 echo "gl_WITNESS_C_MACRO([$witness_c_macro])"
5936 if test -n "$vc_files"; then
5937 echo "gl_VC_FILES([$vc_files])"
5940 if test -f "$destdir"/$m4base/gnulib-cache.
m4; then
5941 if cmp -s "$destdir"/$m4base/gnulib-cache.
m4 "$tmpfile"; then
5945 echo "Updating $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
5946 mv -f "$destdir"/$m4base/gnulib-cache.
m4 "$destdir"/$m4base/gnulib-cache.
m4~
5947 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.
m4
5949 echo "Update $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
5953 echo "# gnulib-cache.m4 ends here"
5960 echo "Creating $m4base/gnulib-cache.m4"
5961 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.
m4
5963 echo "Create $m4base/gnulib-cache.m4"
5969 # Create m4/gnulib-comp.m4.
5970 func_dest_tmpfilename
$m4base/gnulib-comp.
m4
5972 echo "# DO NOT EDIT! GENERATED AUTOMATICALLY!"
5973 func_emit_copyright_notice
5975 echo "# This file represents the compiled summary of the specification in"
5976 echo "# gnulib-cache.m4. It lists the computed macro invocations that need"
5977 echo "# to be invoked from configure.ac."
5978 echo "# In projects that use version control, this file can be treated like"
5979 echo "# other built files."
5982 echo "# This macro should be invoked from $configure_ac, in the section"
5983 echo "# \"Checks for programs\", right after AC_PROG_CC, and certainly before"
5984 echo "# any checks for libraries, header files, types and library functions."
5985 echo "AC_DEFUN([${macro_prefix}_EARLY],"
5987 echo " m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
5988 echo " m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
5989 echo " m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
5990 echo " m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
5992 func_emit_pre_early_macros
: ' ' "$final_modules"
5994 if ! $gnu_make && test -n "$uses_subdirs"; then
5995 echo " AC_REQUIRE([AM_PROG_CC_C_O])"
5997 for module
in $final_modules; do
5999 if test -n "$module"; then
6000 echo "# Code from module $module:"
6001 func_get_autoconf_early_snippet
"$module"
6004 |
sed -e '/^$/d;' -e 's/^/ /'
6007 echo "# This macro should be invoked from $configure_ac, in the section"
6008 echo "# \"Check for header files, types and library functions\"."
6009 echo "AC_DEFUN([${macro_prefix}_INIT],"
6011 # This AC_CONFIG_LIBOBJ_DIR invocation silences an error from the automake
6013 # error: required file './alloca.c' not found
6014 # It is needed because of the last remaining use of AC_LIBSOURCES in
6015 # _AC_LIBOBJ_ALLOCA, invoked from AC_FUNC_ALLOCA.
6016 # All the m4_pushdef/m4_popdef logic in func_emit_initmacro_start/_end
6017 # does not help to avoid this error.
6018 if grep ' lib/alloca\.c$' "$tmp"/new-files
>/dev
/null
; then
6019 # alloca.c will be present in $sourcebase.
6020 echo " AC_CONFIG_LIBOBJ_DIR([$sourcebase])"
6022 if grep ' tests=lib/alloca\.c$' "$tmp"/new-files
>/dev
/null
; then
6023 # alloca.c will be present in $testsbase.
6024 echo " AC_CONFIG_LIBOBJ_DIR([$testsbase])"
6027 if test "$libtool" = true
; then
6028 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
6029 echo " gl_cond_libtool=true"
6031 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
6032 echo " gl_cond_libtool=false"
6034 echo " gl_ltlibdeps="
6036 if test "$auxdir" != "build-aux"; then
6037 sed_replace_build_aux
='
6039 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
6040 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
6044 sed_replace_build_aux
="$sed_noop"
6046 echo " gl_m4_base='$m4base'"
6047 func_emit_initmacro_start
$macro_prefix false
6048 func_emit_shellvars_init false
"$sourcebase"
6049 if test -n "$witness_c_macro"; then
6050 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$witness_c_macro])"
6052 func_emit_autoconf_snippets
"$main_modules" "$main_modules" func_verify_module true false true
6053 if test -n "$witness_c_macro"; then
6054 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
6056 echo " # End of code from modules"
6057 func_emit_initmacro_end
$macro_prefix false
6058 echo " gltests_libdeps="
6059 echo " gltests_ltlibdeps="
6060 func_emit_initmacro_start
${macro_prefix}tests
$gentests
6061 func_emit_shellvars_init true
"$testsbase"
6062 # Define a tests witness macro that depends on the package.
6063 # PACKAGE is defined by AM_INIT_AUTOMAKE, PACKAGE_TARNAME is defined by AC_INIT.
6064 # See <https://lists.gnu.org/r/automake/2009-05/msg00145.html>.
6065 echo "changequote(,)dnl"
6066 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"
6067 echo "changequote([, ])dnl"
6068 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
6069 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
6070 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
6071 func_emit_autoconf_snippets
"$testsrelated_modules" "$main_modules $testsrelated_modules" func_verify_module true true true
6072 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
6073 func_emit_initmacro_end
${macro_prefix}tests
$gentests
6074 echo " AC_REQUIRE([gl_CC_GNULIB_WARNINGS])"
6075 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
6076 # created using libtool, because libtool already handles the dependencies.
6077 if test "$libtool" != true
; then
6078 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
6079 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
6080 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
6081 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
6082 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
6084 if $use_libtests; then
6085 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
6086 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
6089 func_emit_initmacro_done
$macro_prefix $sourcebase
6090 func_emit_initmacro_done
${macro_prefix}tests
$testsbase
6092 echo "# This macro records the list of files which have been installed by"
6093 echo "# gnulib-tool and may be removed by future gnulib-tool invocations."
6094 echo "AC_DEFUN([${macro_prefix}_FILE_LIST], ["
6095 echo "$files" |
sed -e 's,^, ,'
6098 if test -f "$destdir"/$m4base/gnulib-comp.
m4; then
6099 if cmp -s "$destdir"/$m4base/gnulib-comp.
m4 "$tmpfile"; then
6103 echo "Updating $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
6104 mv -f "$destdir"/$m4base/gnulib-comp.
m4 "$destdir"/$m4base/gnulib-comp.
m4~
6105 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.
m4
6107 echo "Update $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
6111 echo "# gnulib-comp.m4 ends here"
6118 echo "Creating $m4base/gnulib-comp.m4"
6119 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.
m4
6121 echo "Create $m4base/gnulib-comp.m4"
6127 # Create library makefile.
6128 # Do this after creating gnulib-comp.m4, because func_emit_lib_Makefile_am
6129 # can run 'autoconf -t', which reads gnulib-comp.m4.
6130 func_dest_tmpfilename
$sourcebase/$source_makefile_am
6131 destfile
="$sourcebase/$source_makefile_am"
6132 modules
="$main_modules"
6133 if $automake_subdir; then
6134 func_emit_lib_Makefile_am |
"$gnulib_dir"/build-aux
/prefix-gnulib-mk
--from-gnulib-tool --lib-name="$libname" --prefix="$sourcebase/" > "$tmpfile"
6136 func_emit_lib_Makefile_am
> "$tmpfile"
6138 if test -f "$destdir"/$sourcebase/$source_makefile_am; then
6139 if cmp -s "$destdir"/$sourcebase/$source_makefile_am "$tmpfile"; then
6143 echo "Updating $sourcebase/$source_makefile_am (backup in $sourcebase/$source_makefile_am~)"
6144 mv -f "$destdir"/$sourcebase/$source_makefile_am "$destdir"/$sourcebase/$source_makefile_am~
6145 mv -f "$tmpfile" "$destdir"/$sourcebase/$source_makefile_am
6147 echo "Update $sourcebase/$source_makefile_am (backup in $sourcebase/$source_makefile_am~)"
6153 echo "Creating $sourcebase/$source_makefile_am"
6154 mv -f "$tmpfile" "$destdir"/$sourcebase/$source_makefile_am
6156 echo "Create $sourcebase/$source_makefile_am"
6159 func_append added_files
"$sourcebase/$source_makefile_am$nl"
6163 # Create tests makefile.
6164 func_dest_tmpfilename
$testsbase/$tests_makefile_am
6165 destfile
="$testsbase/$tests_makefile_am"
6166 modules
="$testsrelated_modules"
6167 func_emit_tests_Makefile_am
"${macro_prefix}tests_WITNESS" > "$tmpfile"
6168 if test -f "$destdir"/$testsbase/$tests_makefile_am; then
6169 if cmp -s "$destdir"/$testsbase/$tests_makefile_am "$tmpfile"; then
6173 echo "Updating $testsbase/$tests_makefile_am (backup in $testsbase/$tests_makefile_am~)"
6174 mv -f "$destdir"/$testsbase/$tests_makefile_am "$destdir"/$testsbase/$tests_makefile_am~
6175 mv -f "$tmpfile" "$destdir"/$testsbase/$tests_makefile_am
6177 echo "Update $testsbase/$tests_makefile_am (backup in $testsbase/$tests_makefile_am~)"
6183 echo "Creating $testsbase/$tests_makefile_am"
6184 mv -f "$tmpfile" "$destdir"/$testsbase/$tests_makefile_am
6186 echo "Create $testsbase/$tests_makefile_am"
6189 func_append added_files
"$testsbase/$tests_makefile_am$nl"
6193 if test "$vc_files" != false
; then
6194 # Update the .cvsignore and .gitignore files.
6195 { echo "$added_files" |
sed -e '/^$/d' -e 's,\([^/]*\)$,|A|\1,'
6196 echo "$removed_files" |
sed -e '/^$/d' -e 's,\([^/]*\)$,|R|\1,'
6197 # Treat gnulib-comp.m4 like an added file, even if it already existed.
6198 echo "$m4base/|A|gnulib-comp.m4"
6199 } | LC_ALL
=C
sort -t'|' -k1,1 > "$tmp"/fileset-changes
6200 { # Rearrange file descriptors. Needed because "while ... done < ..."
6201 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
6202 exec 5<&0 < "$tmp"/fileset-changes
6203 func_update_ignorelist
()
6206 if test "$ignore" = .gitignore
; then
6207 # In a .gitignore file, "foo" applies to the current directory and all
6208 # subdirectories, whereas "/foo" applies to the current directory only.
6211 doubly_escaped_anchor
='\\/'
6215 doubly_escaped_anchor
=''
6217 if test -f "$destdir/$dir$ignore"; then
6218 if test -n "$dir_added" ||
test -n "$dir_removed"; then
6219 sed -e "s|^$anchor||" < "$destdir/$dir$ignore" | LC_ALL
=C
sort > "$tmp"/ignore
6220 (echo "$dir_added" |
sed -e '/^$/d' | LC_ALL
=C
sort -u \
6221 | LC_ALL
=C
join -v 1 - "$tmp"/ignore
> "$tmp"/ignore-added
6222 echo "$dir_removed" |
sed -e '/^$/d' | LC_ALL
=C
sort -u \
6223 > "$tmp"/ignore-removed
6225 if test -s "$tmp"/ignore-added ||
test -s "$tmp"/ignore-removed
; then
6227 echo "Updating $dir$ignore (backup in $dir${ignore}~)"
6228 mv -f "$destdir/$dir$ignore" "$destdir/$dir$ignore"~
6229 { sed -e 's,/,\\/,g' -e 's,^,/^,' -e 's,$,\$/d,' < "$tmp"/ignore-removed
6230 if test -n "$anchor"; then sed -e 's,/,\\/,g' -e "s,^,/^${doubly_escaped_anchor}," -e 's,$,$/d,' < "$tmp"/ignore-removed
; fi
6231 } > "$tmp"/sed-ignore-removed
6232 { cat "$destdir/$dir$ignore"~
6233 sed -e "s|^|$anchor|" < "$tmp"/ignore-added
6234 } |
sed -f "$tmp"/sed-ignore-removed \
6235 > "$destdir/$dir$ignore"
6237 echo "Update $dir$ignore (backup in $dir${ignore}~)"
6242 if test -n "$dir_added"; then
6244 echo "Creating $dir$ignore"
6246 if test "$ignore" = .cvsignore
; then
6248 # Automake generates Makefile rules that create .dirstamp files.
6251 echo "$dir_added" |
sed -e '/^$/d' -e "s|^|$anchor|" | LC_ALL
=C
sort -u
6252 } > "$destdir/$dir$ignore"
6254 echo "Create $dir$ignore"
6264 if test -d "$destdir/CVS" ||
test -d "$destdir/${dir}CVS" ||
test -f "$destdir/${dir}.cvsignore"; then
6265 func_update_ignorelist .cvsignore
6267 if test -d "$destdir/.git" ||
test -f "$destdir/${dir}.gitignore"; then
6268 func_update_ignorelist .gitignore
6275 # Why not ''read next_dir op file'' ? Because the dir column can be empty.
6276 next_dir
=`echo "$line" | sed -e 's,|.*,,'`
6277 op
=`echo "$line" | sed -e 's,^[^|]*|\([^|]*\)|.*$,\1,'`
6278 file=`echo "$line" | sed -e 's,^[^|]*|[^|]*|,,'`
6279 if test "$next_dir" != "$last_dir"; then
6280 func_done_dir
"$last_dir" "$last_dir_added" "$last_dir_removed"
6281 last_dir
="$next_dir"
6286 A
) func_append last_dir_added
"$file$nl";;
6287 R
) func_append last_dir_removed
"$file$nl";;
6290 func_done_dir
"$last_dir" "$last_dir_added" "$last_dir_removed"
6297 echo "You may need to add #include directives for the following .h files."
6298 # Intersect $specified_modules and $main_modules
6299 # (since $specified_modules is not necessarily of subset of $main_modules
6300 # - some may have been skipped through --avoid, and since the elements of
6301 # $main_modules but not in $specified_modules can go away without explicit
6302 # notice - through changes in the module dependencies).
6303 echo "$specified_modules" > "$tmp"/modules1
# a sorted list, one module per line
6304 echo "$main_modules" > "$tmp"/modules2
# also a sorted list, one module per line
6305 # First the #include <...> directives without #ifs, sorted for convenience,
6306 # then the #include "..." directives without #ifs, sorted for convenience,
6307 # then the #include directives that are surrounded by #ifs. Not sorted.
6308 for module
in `LC_ALL=C join "$tmp"/modules1 "$tmp"/modules2`; do
6309 include_directive
=`func_get_include_directive "$module"`
6310 case "$nl$include_directive" in
6312 echo "$include_directive" 1>&5
6315 echo "$include_directive" |
grep -v 'include "' 1>&6
6316 echo "$include_directive" |
grep 'include "' 1>&7
6319 done 5> "$tmp"/include-if
6> "$tmp"/include-angles
7> "$tmp"/include-quotes
6321 LC_ALL
=C
sort -u "$tmp"/include-angles
6322 LC_ALL
=C
sort -u "$tmp"/include-quotes
6323 cat "$tmp"/include-if
6324 ) |
sed -e '/^$/d' -e 's/^/ /'
6325 rm -f "$tmp"/include-angles
"$tmp"/include-quotes
"$tmp"/include-if
6327 for module
in $main_modules; do
6328 func_get_link_directive
"$module"
6330 | LC_ALL
=C
sort -u |
sed -e '/^$/d' -e 's/^/ /' > "$tmp"/link
6331 if test `wc -l < "$tmp"/link` != 0; then
6333 echo "You may need to use the following Makefile variables when linking."
6334 echo "Use them in <program>_LDADD when linking a program, or"
6335 echo "in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library."
6341 echo "Don't forget to"
6342 if test "$source_makefile_am" = Makefile.am
; then
6343 echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
6345 echo " - \"include $source_makefile_am\" from within \"$sourcebase/Makefile.am\","
6347 if test -n "$pobase"; then
6348 echo " - add \"$pobase/Makefile.in\" to AC_CONFIG_FILES in $configure_ac,"
6351 if test "$tests_makefile_am" = Makefile.am
; then
6352 echo " - add \"$testsbase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
6354 echo " - \"include $tests_makefile_am\" from within \"$testsbase/Makefile.am\","
6358 while test $edit != $makefile_am_edits; do
6359 edit
=`expr $edit + 1`
6360 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
6361 eval var
=\"\
$makefile_am_edit${edit}_var
\"
6362 eval val
=\"\
$makefile_am_edit${edit}_val
\"
6363 if test -n "$var"; then
6364 if test "$var" = ACLOCAL_AMFLAGS
; then
6365 echo " - mention \"-I ${val}\" in ${var} in ${dir}Makefile.am"
6366 echo " or add an AC_CONFIG_MACRO_DIRS([${val}]) invocation in $configure_ac,"
6368 echo " - mention \"${val}\" in ${var} in ${dir}Makefile.am,"
6372 if grep '^ *AC_PROG_CC_STDC' "$configure_ac" > /dev
/null
; then
6373 echo " - replace AC_PROG_CC_STDC with AC_PROG_CC in $configure_ac,"
6374 position_early_after
=AC_PROG_CC_STDC
6376 if grep '^ *AC_PROG_CC_C99' "$configure_ac" > /dev
/null
; then
6377 echo " - replace AC_PROG_CC_C99 with AC_PROG_CC in $configure_ac,"
6378 position_early_after
=AC_PROG_CC_C99
6380 position_early_after
=AC_PROG_CC
6383 echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after $position_early_after,"
6384 echo " - invoke ${macro_prefix}_INIT in $configure_ac."
6387 # func_create_testdir testdir modules
6389 # - local_gnulib_path from --local-dir
6390 # - modcache true or false, from --cache-modules/--no-cache-modules
6391 # - auxdir directory relative to destdir where to place build aux files
6392 # - inctests true if tests should be included, false otherwise
6393 # - incobsolete true if obsolete modules among dependencies should be
6394 # included, blank otherwise
6395 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
6397 # - excl_longrunning_tests true if long-runnings tests should be excluded,
6399 # - excl_privileged_tests true if tests that require root privileges should be
6400 # excluded, blank otherwise
6401 # - excl_unportable_tests true if tests that fail on some platforms should be
6402 # excluded, blank otherwise
6403 # - single_configure true if a single configure file should be generated,
6404 # false for a separate configure file for the tests
6405 # - avoidlist list of modules to avoid
6406 # - cond_dependencies true if --conditional-dependencies was given, false if
6407 # --no-conditional-dependencies was given, blank otherwise
6408 # - libtool true if --libtool was given, false if --no-libtool was
6409 # given, blank otherwise
6410 # - copymode copy mode for files in general
6411 # - lcopymode copy mode for files from local_gnulib_path
6412 func_create_testdir
()
6416 if test -z "$modules"; then
6417 # All modules together.
6418 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
6419 # Except non-recursive-gnulib-prefix-hack, which represents a nonstandard
6420 # way of using Automake.
6421 # Except timevar, which lacks the required file timevar.def.
6422 # Except mountlist, which aborts the configuration on mingw. FIXME.
6423 # Except lib-ignore, which leads to link errors when Sun C++ is used. FIXME.
6424 modules
=`func_all_modules`
6425 modules
=`for m in $modules; do case $m in config-h | non-recursive-gnulib-prefix-hack | timevar | mountlist | lib-ignore) ;; *) echo $m;; esac; done`
6427 specified_modules
="$modules"
6429 # Canonicalize the list of specified modules.
6430 specified_modules
=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
6432 # Test modules which invoke AC_CONFIG_FILES cannot be used with
6433 # --with-tests --single-configure. Avoid them.
6434 if $inctests && $single_configure; then
6435 avoidlist
="$avoidlist havelib-tests"
6438 # Unlike in func_import, here we want to include all kinds of tests for the
6439 # directly specified modules, but not for dependencies.
6440 inc_all_direct_tests
=true
6441 inc_all_indirect_tests
="$inc_all_tests"
6443 # Check that the license of every module is consistent with the license of
6445 saved_inctests
="$inctests"
6446 # When computing transitive closures, don't consider $module to depend on
6447 # $module-tests. Need this because tests are implicitly GPL and may depend
6448 # on GPL modules - therefore we don't want a warning in this case.
6450 for requested_module
in $specified_modules; do
6451 requested_license
=`func_get_license "$requested_module"`
6452 if test "$requested_license" != GPL
; then
6453 # Here we use func_modules_transitive_closure, not just
6454 # func_get_dependencies, so that we also detect weird situations like
6455 # an LGPL module which depends on a GPLed build tool module which depends
6457 modules
="$requested_module"
6458 func_modules_transitive_closure
6459 for module
in $modules; do
6460 license
=`func_get_license "$module"`
6462 'GPLv2+ build tool' |
'GPLed build tool') ;;
6463 'public domain' |
'unlimited' |
'unmodifiable license text') ;;
6465 case "$requested_license" in
6468 LGPLv2
+ |
'LGPLv3+ or GPLv2+' | LGPLv3
+ | LGPL | GPLv2
+ | GPLv3
+ | GPL
) ;;
6469 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6474 LGPLv2
+ |
'LGPLv3+ or GPLv2+' | GPLv2
+) ;;
6475 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6480 LGPLv2
+ |
'LGPLv3+ or GPLv2+' | LGPLv3
+ | LGPL
) ;;
6481 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6484 'LGPLv3+ or GPLv2+')
6486 LGPLv2
+ |
'LGPLv3+ or GPLv2+') ;;
6487 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6493 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6502 inctests
="$saved_inctests"
6504 # Subdirectory names.
6515 # Determine final module list.
6516 modules
="$specified_modules"
6517 func_modules_transitive_closure
6518 if test $verbose -ge 0; then
6519 func_show_module_list
6521 final_modules
="$modules"
6523 if $single_configure; then
6524 # Determine main module list and tests-related module list separately.
6525 func_modules_transitive_closure_separately
6528 if $single_configure; then
6529 # Determine whether a $testsbase/libtests.a is needed.
6530 func_determine_use_libtests
6533 # Add the dummy module if needed.
6534 if $single_configure; then
6535 func_modules_add_dummy_separately
6537 func_modules_add_dummy
6541 # If $single_configure, we use the module lists $main_modules and
6542 # $testsrelated_modules; $modules is merely a temporary variable.
6543 # Whereas if ! $single_configure, the module list is $modules.
6545 # Show banner notice of every module.
6546 if $single_configure; then
6547 modules
="$main_modules"
6553 # Determine final file list.
6554 if $single_configure; then
6555 func_modules_to_filelist_separately
6557 main_modules
="$modules"
6558 testsrelated_modules
=`for module in $modules; do
6559 if \`func_repeat_module_in_tests\
`; then
6563 saved_modules
="$modules"
6564 func_modules_to_filelist_separately
6565 modules
="$saved_modules"
6567 # Add files for which the copy in gnulib is newer than the one that
6568 # "automake --add-missing --copy" would provide.
6569 files
="$files build-aux/config.guess"
6570 files
="$files build-aux/config.sub"
6571 files
=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
6573 rewritten
='%REWRITTEN%'
6574 sed_rewrite_files
="\
6575 s,^build-aux/,$rewritten$auxdir/,
6576 s,^doc/,$rewritten$docbase/,
6577 s,^lib/,$rewritten$sourcebase/,
6578 s,^m4/,$rewritten$m4base/,
6579 s,^tests/,$rewritten$testsbase/,
6580 s,^tests=lib/,$rewritten$testsbase/,
6584 # Create directories.
6585 for f
in $files; do echo $f; done \
6586 |
sed -e "$sed_rewrite_files" \
6587 |
sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
6588 | LC_ALL
=C
sort -u \
6590 { # Rearrange file descriptors. Needed because "while ... done < ..."
6591 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
6592 exec 5<&0 < "$tmp"/dirs
6594 mkdir
-p "$testdir/$d"
6599 # Copy files or make symbolic links or hard links.
6601 for f
in $files; do echo $f; done \
6602 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_files" \
6605 { # Rearrange file descriptors. Needed because "while ... done < ..."
6606 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
6607 exec 5<&0 < "$tmp"/files
6610 tests
=lib
/*) f
=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
6612 func_lookup_file
"$f"
6613 if test -n "$lookedup_tmp"; then
6614 cp -p "$lookedup_file" "$testdir/$g"
6615 func_ensure_writable
"$testdir/$g"
6618 if test "$copyaction" = symlink
; then
6619 func_symlink
"$lookedup_file" "$testdir/$g"
6621 if test "$copyaction" = hardlink
; then
6622 func_hardlink
"$lookedup_file" "$testdir/$g"
6624 cp -p "$lookedup_file" "$testdir/$g"
6625 func_ensure_writable
"$testdir/$g"
6633 # Determine include_guard_prefix and module_indicator_prefix.
6634 func_compute_include_guard_prefix
6636 # Create Makefile.ams that are for testing.
6639 # No special edits are needed.
6642 # Create $sourcebase/Makefile.am.
6643 mkdir
-p "$testdir/$sourcebase"
6644 destfile
="$sourcebase/Makefile.am"
6645 if $single_configure; then
6646 modules
="$main_modules"
6648 func_emit_lib_Makefile_am
> "$testdir/$sourcebase/Makefile.am"
6649 any_uses_subdirs
="$uses_subdirs"
6651 # Create $m4base/Makefile.am.
6652 mkdir
-p "$testdir/$m4base"
6653 (echo "## Process this file with automake to produce Makefile.in."
6659 echo "EXTRA_DIST += "`echo "$f" | sed -e 's,^m4/,,'` ;;
6662 ) > "$testdir/$m4base/Makefile.am"
6664 subdirs
="$sourcebase $m4base"
6665 subdirs_with_configure_ac
=""
6667 if false
&& test -f "$testdir"/$m4base/gettext.
m4; then
6668 # Avoid stupid error message from automake:
6669 # "AM_GNU_GETTEXT used but `po' not in SUBDIRS"
6670 mkdir
-p "$testdir/po"
6671 (echo "## Process this file with automake to produce Makefile.in."
6672 ) > "$testdir/po/Makefile.am"
6673 func_append subdirs
" po"
6677 test -d "$testdir/$testsbase" || mkdir
"$testdir/$testsbase"
6678 if $single_configure; then
6679 # Create $testsbase/Makefile.am.
6680 destfile
="$testsbase/Makefile.am"
6681 modules
="$testsrelated_modules"
6682 func_emit_tests_Makefile_am
"${macro_prefix}tests_WITNESS" > "$testdir/$testsbase/Makefile.am"
6684 # Viewed from the $testsbase subdirectory, $auxdir is different.
6685 saved_auxdir
="$auxdir"
6686 auxdir
=`echo "$testsbase/" | sed -e 's%[^/][^/]*//*%../%g'`"$auxdir"
6687 # Create $testsbase/Makefile.am.
6689 destfile
="$testsbase/Makefile.am"
6690 func_emit_tests_Makefile_am
"" > "$testdir/$testsbase/Makefile.am"
6691 any_uses_subdirs
="$any_uses_subdirs$uses_subdirs"
6692 # Create $testsbase/configure.ac.
6693 (echo "# Process this file with autoconf to produce a configure script."
6694 echo "AC_INIT([dummy], [0])"
6695 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6696 echo "AM_INIT_AUTOMAKE"
6698 echo "AC_CONFIG_HEADERS([config.h])"
6701 echo "AC_PROG_INSTALL"
6702 echo "AC_PROG_MAKE_SET"
6704 func_emit_pre_early_macros false
'' "$modules"
6706 if test -n "$uses_subdirs"; then
6707 echo "AM_PROG_CC_C_O"
6710 for module
in $modules; do
6712 if test -n "$module"; then
6714 gnumakefile | maintainer-makefile
)
6715 # These modules are meant to be used only in the top-level directory.
6718 func_get_autoconf_early_snippet
"$module"
6723 |
sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)])/\1/'
6724 if test "$libtool" = true
; then
6725 echo "LT_INIT([win32-dll])"
6726 echo "LT_LANG([C++])"
6727 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
6728 echo "gl_cond_libtool=true"
6730 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
6731 echo "gl_cond_libtool=false"
6733 echo "gl_ltlibdeps="
6735 # Wrap the set of autoconf snippets into an autoconf macro that is then
6736 # invoked. This is needed because autoconf does not support AC_REQUIRE
6738 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
6739 # but we want the AC_REQUIRE to have its normal meaning (provide one
6740 # expansion of the required macro before the current point, and only one
6742 echo "AC_DEFUN([gl_INIT], ["
6743 sed_replace_build_aux
='
6745 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
6746 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
6749 echo "gl_m4_base='../$m4base'"
6750 func_emit_initmacro_start
$macro_prefix true
6751 # We don't have explicit ordering constraints between the various
6752 # autoconf snippets. It's cleanest to put those of the library before
6753 # those of the tests.
6754 func_emit_shellvars_init true
"../$sourcebase"
6755 func_emit_autoconf_snippets
"$modules" "$modules" func_verify_nontests_module false false false
6756 func_emit_shellvars_init true
'.'
6757 func_emit_autoconf_snippets
"$modules" "$modules" func_verify_tests_module false false false
6758 func_emit_initmacro_end
$macro_prefix true
6759 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
6760 # created using libtool, because libtool already handles the dependencies.
6761 if test "$libtool" != true
; then
6762 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
6763 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
6764 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
6765 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
6766 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
6769 func_emit_initmacro_done
$macro_prefix $sourcebase # FIXME use $sourcebase or $testsbase?
6773 # Usually $testsbase/config.h will be a superset of config.h. Verify this
6774 # by "merging" config.h into $testsbase/config.h; look out for gcc warnings.
6775 echo "AH_TOP([#include \"../config.h\"])"
6777 echo "AC_CONFIG_FILES([Makefile])"
6779 ) > "$testdir/$testsbase/configure.ac"
6780 auxdir
="$saved_auxdir"
6781 subdirs_with_configure_ac
="$subdirs_with_configure_ac $testsbase"
6783 func_append subdirs
" $testsbase"
6786 # Create Makefile.am.
6787 (echo "## Process this file with automake to produce Makefile.in."
6789 echo "AUTOMAKE_OPTIONS = 1.11 foreign"
6791 echo "SUBDIRS = $subdirs"
6793 echo "ACLOCAL_AMFLAGS = -I $m4base"
6794 ) > "$testdir/Makefile.am"
6796 # Create configure.ac.
6797 (echo "# Process this file with autoconf to produce a configure script."
6798 echo "AC_INIT([dummy], [0])"
6799 if test "$auxdir" != "."; then
6800 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6802 echo "AM_INIT_AUTOMAKE"
6804 echo "AC_CONFIG_HEADERS([config.h])"
6807 echo "AC_PROG_INSTALL"
6808 echo "AC_PROG_MAKE_SET"
6810 echo "# For autobuild."
6811 echo "AC_CANONICAL_BUILD"
6812 echo "AC_CANONICAL_HOST"
6814 echo "m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
6815 echo "m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
6816 echo "m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
6817 echo "m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
6819 func_emit_pre_early_macros false
'' "$final_modules"
6821 if test -n "$any_uses_subdirs"; then
6822 echo "AM_PROG_CC_C_O"
6825 for module
in $final_modules; do
6826 if $single_configure; then
6829 func_verify_nontests_module
6831 if test -n "$module"; then
6832 func_get_autoconf_early_snippet
"$module"
6835 |
sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)])/\1/'
6836 if test "$libtool" = true
; then
6837 echo "LT_INIT([win32-dll])"
6838 echo "LT_LANG([C++])"
6839 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
6840 echo "gl_cond_libtool=true"
6842 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
6843 echo "gl_cond_libtool=false"
6845 echo "gl_ltlibdeps="
6847 # Wrap the set of autoconf snippets into an autoconf macro that is then
6848 # invoked. This is needed because autoconf does not support AC_REQUIRE
6850 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
6851 # but we want the AC_REQUIRE to have its normal meaning (provide one
6852 # expansion of the required macro before the current point, and only one
6854 echo "AC_DEFUN([gl_INIT], ["
6855 if test "$auxdir" != "build-aux"; then
6856 sed_replace_build_aux
='
6858 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
6859 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
6863 sed_replace_build_aux
="$sed_noop"
6865 echo "gl_m4_base='$m4base'"
6866 func_emit_initmacro_start
$macro_prefix false
6867 func_emit_shellvars_init false
"$sourcebase"
6868 if $single_configure; then
6869 func_emit_autoconf_snippets
"$main_modules" "$main_modules" func_verify_module true false false
6871 func_emit_autoconf_snippets
"$modules" "$modules" func_verify_nontests_module true false false
6873 func_emit_initmacro_end
$macro_prefix false
6874 if $single_configure; then
6875 echo " gltests_libdeps="
6876 echo " gltests_ltlibdeps="
6877 func_emit_initmacro_start
${macro_prefix}tests true
6878 func_emit_shellvars_init true
"$testsbase"
6879 # Define a tests witness macro.
6880 echo " ${macro_prefix}tests_WITNESS=IN_GNULIB_TESTS"
6881 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
6882 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
6883 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
6884 func_emit_autoconf_snippets
"$testsrelated_modules" "$main_modules $testsrelated_modules" func_verify_module true false false
6885 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
6886 func_emit_initmacro_end
${macro_prefix}tests true
6888 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
6889 # created using libtool, because libtool already handles the dependencies.
6890 if test "$libtool" != true
; then
6891 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
6892 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
6893 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
6894 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
6895 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
6897 if $single_configure; then
6898 if $use_libtests; then
6899 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
6900 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
6904 func_emit_initmacro_done
$macro_prefix $sourcebase
6905 if $single_configure; then
6906 func_emit_initmacro_done
${macro_prefix}tests
$testsbase
6911 if test -n "$subdirs_with_configure_ac"; then
6912 echo "AC_CONFIG_SUBDIRS(["`echo $subdirs_with_configure_ac`"])"
6914 makefiles
="Makefile"
6915 for d
in $subdirs; do
6916 # For subdirs that have a configure.ac by their own, it's the subdir's
6917 # configure.ac which creates the subdir's Makefile.am, not this one.
6918 case " $subdirs_with_configure_ac " in
6920 *) func_append makefiles
" $d/Makefile" ;;
6923 echo "AC_CONFIG_FILES([$makefiles])"
6925 ) > "$testdir/configure.ac"
6927 # Create autogenerated files.
6929 # Do not use "${AUTORECONF} --force --install", because it may invoke
6930 # autopoint, which brings in older versions of some of our .m4 files.
6931 if test -f $m4base/gettext.
m4; then
6932 func_execute_command
${AUTOPOINT} --force || func_exit
1
6933 for f
in $m4base/*.
m4~
; do
6935 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit
1
6939 if test "$libtool" = true
; then
6940 func_execute_command
${LIBTOOLIZE} --copy || func_exit
1
6942 func_execute_command
${ACLOCAL} -I $m4base || func_exit
1
6943 if ! test -d build-aux
; then
6944 func_execute_command mkdir build-aux || func_exit
1
6946 func_execute_command
${AUTOCONF} || func_exit
1
6947 # Explicit 'touch config.h.in': see <https://savannah.gnu.org/support/index.php?109406>.
6948 func_execute_command
${AUTOHEADER} &&
6949 func_execute_command
touch config.h.
in ||
6951 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6952 rm -rf autom4te.cache
6954 if $inctests && ! $single_configure; then
6955 # Create autogenerated files.
6956 (cd "$testdir/$testsbase" || func_exit
1
6957 # Do not use "${AUTORECONF} --force --install", because it may invoke
6958 # autopoint, which brings in older versions of some of our .m4 files.
6959 if test -f ..
/$m4base/gettext.
m4; then
6960 func_execute_command
${AUTOPOINT} --force || func_exit
1
6961 for f
in ..
/$m4base/*.
m4~
; do
6963 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit
1
6967 func_execute_command
${ACLOCAL} -I ..
/$m4base || func_exit
1
6968 if ! test -d ..
/build-aux
; then
6969 func_execute_command mkdir ..
/build-aux
6971 func_execute_command
${AUTOCONF} || func_exit
1
6972 # Explicit 'touch config.h.in': see <https://savannah.gnu.org/support/index.php?109406>.
6973 func_execute_command
${AUTOHEADER} &&
6974 func_execute_command
touch config.h.
in ||
6976 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6977 rm -rf autom4te.cache
6980 # Need to run configure and make once, to create built files that are to be
6981 # distributed (such as parse-datetime.c).
6982 sed_remove_make_variables
='s,[$]([A-Za-z0-9_]*),,g'
6983 # Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...".
6984 cleaned_files
=`combine_lines < "$testdir/$sourcebase/Makefile.am" \
6985 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
6986 cleaned_files
=`for file in $cleaned_files; do echo " $file "; done`
6987 # Extract the value of "BUILT_SOURCES += ...". Remove variable references
6988 # such $(FOO_H) because they don't refer to distributed files.
6989 built_sources
=`combine_lines < "$testdir/$sourcebase/Makefile.am" \
6990 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
6991 | sed -e "$sed_remove_make_variables"`
6992 distributed_built_sources
=`for file in $built_sources; do
6993 case "$cleaned_files" in
6998 tests_distributed_built_sources
=
7000 # Likewise for built files in the $testsbase directory.
7001 tests_cleaned_files
=`combine_lines < "$testdir/$testsbase/Makefile.am" \
7002 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
7003 tests_cleaned_files
=`for file in $tests_cleaned_files; do echo " $file "; done`
7004 tests_built_sources
=`combine_lines < "$testdir/$testsbase/Makefile.am" \
7005 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
7006 | sed -e "$sed_remove_make_variables"`
7007 tests_distributed_built_sources
=`for file in $tests_built_sources; do
7008 case "$tests_cleaned_files" in
7014 if test -n "$distributed_built_sources" ||
test -n "$tests_distributed_built_sources"; then
7016 .
/configure || func_exit
1
7017 if test -n "$distributed_built_sources"; then
7019 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
7020 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
7025 if test -n "$tests_distributed_built_sources"; then
7027 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
7028 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
7033 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
7039 if test -f build-aux
/test-driver
; then
7040 patch build-aux
/test-driver
< "$gnulib_dir"/build-aux
/test-driver.
diff \
7041 ||
patch build-aux
/test-driver
< "$gnulib_dir"/build-aux
/test-driver-1.16
.3.
diff \
7047 # func_create_megatestdir megatestdir allmodules
7049 # - local_gnulib_path from --local-dir
7050 # - modcache true or false, from --cache-modules/--no-cache-modules
7051 # - auxdir directory relative to destdir where to place build aux files
7052 func_create_megatestdir
()
7056 if test -z "$allmodules"; then
7057 allmodules
=`func_all_modules`
7061 # First, all modules one by one.
7062 for onemodule
in $allmodules; do
7063 func_create_testdir
"$megatestdir/$onemodule" $onemodule
7064 func_append megasubdirs
"$onemodule "
7066 # Then, all modules all together.
7067 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
7068 allmodules
=`for m in $allmodules; do if test $m != config-h; then echo $m; fi; done`
7069 func_create_testdir
"$megatestdir/ALL" "$allmodules"
7070 func_append megasubdirs
"ALL"
7073 cvsdate
=`vc_witness="$gnulib_dir/.git/refs/heads/master"; \
7074 sh "$gnulib_dir/build-aux/mdate-sh" "$vc_witness" \
7075 | sed -e 's,January,01,' -e 's,Jan,01,' \
7076 -e 's,February,02,' -e 's,Feb,02,' \
7077 -e 's,March,03,' -e 's,Mar,03,' \
7078 -e 's,April,04,' -e 's,Apr,04,' \
7080 -e 's,June,06,' -e 's,Jun,06,' \
7081 -e 's,July,07,' -e 's,Jul,07,' \
7082 -e 's,August,08,' -e 's,Aug,08,' \
7083 -e 's,September,09,' -e 's,Sep,09,' \
7084 -e 's,October,10,' -e 's,Oct,10,' \
7085 -e 's,November,11,' -e 's,Nov,11,' \
7086 -e 's,December,12,' -e 's,Dec,12,' \
7087 -e 's,^,00,' -e 's,^[0-9]*\([0-9][0-9] \),\1,' \
7088 -e 's,^\([0-9]*\) \([0-9]*\) \([0-9]*\),\3\2\1,'`
7090 echo "CVSDATE=$cvsdate"
7091 echo ": \${MAKE=make}"
7092 echo "test -d logs || mkdir logs"
7093 echo "for module in $megasubdirs; do"
7094 echo " echo \"Working on module \$module...\""
7095 echo " safemodule=\`echo \$module | sed -e 's|/|-|g'\`"
7096 echo " (echo \"To: gnulib@autobuild.josefsson.org\""
7099 echo " : autobuild project... \$module"
7100 echo " : autobuild revision... cvs-\$CVSDATE-000000"
7101 echo " : autobuild timestamp... \`date \"+%Y%m%d-%H%M%S\"\`"
7102 echo " : autobuild hostname... \`hostname\`"
7103 echo " cd \$module && ./configure \$CONFIGURE_OPTIONS && \$MAKE && \$MAKE check && \$MAKE distclean"
7105 echo " ) 2>&1 | { if test -n \"\$AUTOBUILD_SUBST\"; then sed -e \"\$AUTOBUILD_SUBST\"; else cat; fi; } > logs/\$safemodule"
7107 ) > "$megatestdir/do-autobuild"
7108 chmod a
+x
"$megatestdir/do-autobuild"
7110 # Create Makefile.am.
7111 (echo "## Process this file with automake to produce Makefile.in."
7113 echo "AUTOMAKE_OPTIONS = 1.11 foreign"
7115 echo "SUBDIRS = $megasubdirs"
7117 echo "EXTRA_DIST = do-autobuild"
7118 ) > "$megatestdir/Makefile.am"
7120 # Create configure.ac.
7121 (echo "# Process this file with autoconf to produce a configure script."
7122 echo "AC_INIT([dummy], [0])"
7123 if test "$auxdir" != "."; then
7124 echo "AC_CONFIG_AUX_DIR([$auxdir])"
7126 echo "AM_INIT_AUTOMAKE"
7128 echo "AC_PROG_MAKE_SET"
7130 echo "AC_CONFIG_SUBDIRS([$megasubdirs])"
7131 echo "AC_CONFIG_FILES([Makefile])"
7133 ) > "$megatestdir/configure.ac"
7135 # Create autogenerated files.
7137 # Do not use "${AUTORECONF} --install", because autoreconf operates
7138 # recursively, but the subdirectories are already finished, therefore
7139 # calling autoreconf here would only waste lots of CPU time.
7140 func_execute_command
${ACLOCAL} || func_exit
1
7141 func_execute_command mkdir build-aux
7142 func_execute_command
${AUTOCONF} || func_exit
1
7143 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
7144 rm -rf autom4te.cache
7145 if test -f build-aux
/test-driver
; then
7146 patch build-aux
/test-driver
< "$gnulib_dir"/build-aux
/test-driver.
diff \
7147 ||
patch build-aux
/test-driver
< "$gnulib_dir"/build-aux
/test-driver-1.16
.3.
diff \
7155 func_fatal_error
"no mode specified" ;;
7162 # sed expression that converts a literal to a basic regular expression.
7163 # Needs to handle . [ \ * ^ $.
7164 sed_literal_to_basic_regex
='s/\\/\\\\/g
7168 # func_prefixed_modules_in_dir dir
7169 # outputs all module files in dir to standard output, with dir as prefix.
7170 func_prefixed_modules_in_dir
()
7172 (test -d "$1" && cd "$1" && find modules
-type f
-print |
sed -e "s|^|$1/|")
7176 if test -f "$gnulib_dir/$filename" \
7177 || func_lookup_local_file
"$filename"; then
7178 filename_anywhere_regex
=`echo "$filename" | sed -e "$sed_literal_to_basic_regex"`
7179 filename_line_regex
='^'"$filename_anywhere_regex"'$'
7182 (cd "$gnulib_dir" && find modules -type f -print | xargs -n 100 grep -l "$filename_line_regex" /dev/null | sed -e 's,^modules/,,')
7183 func_path_foreach "$local_gnulib_path" func_prefixed_modules_in_dir %dir% | xargs -n 100 grep -l "$filename_anywhere_regex" /dev/null | sed -e 's,^.*/modules/,,' -e 's,\.diff$,,'
7185 | func_sanitize_modulelist \
7188 for module
in $module_candidates; do
7189 if func_get_filelist
$module |
grep "$filename_line_regex" > /dev
/null
; then
7194 func_warning
"file $filename does not exist"
7199 import | add-import | remove-import | update
)
7202 if test -z "$destdir"; then
7205 test -d "$destdir" \
7206 || func_fatal_error
"destination directory does not exist: $destdir"
7208 # Prefer configure.ac to configure.in.
7209 if test -f "$destdir"/configure.ac
; then
7210 configure_ac
="$destdir/configure.ac"
7212 if test -f "$destdir"/configure.
in; then
7213 configure_ac
="$destdir/configure.in"
7215 func_fatal_error
"cannot find $destdir/configure.ac - make sure you run gnulib-tool from within your package's directory"
7219 # Analyze configure.ac.
7221 guessed_libtool
=false
7227 /AC_CONFIG_AUX_DIR/ {
7228 s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^]"$`\\)]*\).*$,guessed_auxdir="\1",p
7230 /A[CM]_PROG_LIBTOOL/ {
7231 s,^.*$,guessed_libtool=true,p
7233 /AC_CONFIG_MACRO_DIR/ {
7234 s,^.*AC_CONFIG_MACRO_DIR([[ ]*\([^]"$`\\)]*\).*$,guessed_m4dirs="${guessed_m4dirs} \1",p
7236 /AC_CONFIG_MACRO_DIRS/ {
7237 s,^.*AC_CONFIG_MACRO_DIRS([[ ]*\([^]"$`\\)]*\).*$,guessed_m4dirs="${guessed_m4dirs} \1",p
7239 eval `sed -n -e "$my_sed_traces" < "$configure_ac"`
7241 if test -z "$auxdir"; then
7242 auxdir
="$guessed_auxdir"
7245 # Determine where to apply func_import.
7246 if test "$mode" = import
; then
7247 # Apply func_import to a particular gnulib directory.
7248 # The command line contains the complete specification; don't look at
7249 # the contents of gnulib-cache.m4.
7250 test -n "$supplied_libname" || supplied_libname
=true
7251 test -n "$sourcebase" || sourcebase
="lib"
7252 test -n "$m4base" || m4base
="m4"
7253 test -n "$docbase" || docbase
="doc"
7254 test -n "$testsbase" || testsbase
="tests"
7255 test -n "$macro_prefix" || macro_prefix
="gl"
7258 if test -n "$m4base"; then
7259 # Apply func_import to a particular gnulib directory.
7260 # Any number of additional modules can be given.
7261 if test ! -f "$destdir/$m4base"/gnulib-cache.
m4; then
7262 # First use of gnulib in the given m4base.
7263 test -n "$supplied_libname" || supplied_libname
=true
7264 test -n "$sourcebase" || sourcebase
="lib"
7265 test -n "$docbase" || docbase
="doc"
7266 test -n "$testsbase" || testsbase
="tests"
7267 test -n "$macro_prefix" || macro_prefix
="gl"
7271 # Apply func_import to all gnulib directories.
7272 # To get this list of directories, look at Makefile.am. (Not at
7273 # configure, because it may be omitted from version control. Also,
7274 # don't run "find $destdir -name gnulib-cache.m4", as it might be
7278 if test -f "$destdir"/Makefile.am
; then
7279 aclocal_amflags
=`sed -n -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/p' "$destdir"/Makefile.am`
7281 for arg
in $aclocal_amflags; do
7282 if test -n "$m4dir_is_next"; then
7283 # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
7287 if test -f "$destdir/$arg"/gnulib-cache.
m4; then
7288 func_append m4dirs
" $arg"
7289 m4dirs_count
=`expr $m4dirs_count + 1`
7295 if test "X$arg" = "X-I"; then
7302 for arg
in $guessed_m4dirs; do
7303 # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
7307 if test -f "$destdir/$arg"/gnulib-cache.
m4; then
7308 func_append m4dirs
" $arg"
7309 m4dirs_count
=`expr $m4dirs_count + 1`
7315 # No Makefile.am! Oh well. Look at the last generated aclocal.m4.
7316 if test -f "$destdir"/aclocal.
m4; then
7317 sedexpr1
='s,^m4_include(\[\(.*\)])$,\1,p'
7318 sedexpr2
='s,^[^/]*$,.,'
7319 sedexpr3
='s,/[^/]*$,,'
7320 m4dirs
=`sed -n -e "$sedexpr1" aclocal.m4 | sed -e "$sedexpr2" -e "$sedexpr3" | LC_ALL=C sort -u`
7321 m4dirs
=`for arg in $m4dirs; do if test -f "$destdir/$arg"/gnulib-cache.m4; then echo $arg; fi; done`
7322 m4dirs_count
=`for arg in $m4dirs; do echo "$arg"; done | wc -l`
7325 if test $m4dirs_count = 0; then
7326 # First use of gnulib in a package.
7327 # Any number of additional modules can be given.
7328 test -n "$supplied_libname" || supplied_libname
=true
7329 test -n "$sourcebase" || sourcebase
="lib"
7331 test -n "$docbase" || docbase
="doc"
7332 test -n "$testsbase" || testsbase
="tests"
7333 test -n "$macro_prefix" || macro_prefix
="gl"
7336 if test $m4dirs_count = 1; then
7337 # There's only one use of gnulib here. Assume the user means it.
7338 # Any number of additional modules can be given.
7339 for m4base
in $m4dirs; do
7343 # Ambiguous - guess what the user meant.
7344 if test $# = 0; then
7345 # No further arguments. Guess the user wants to update all of them.
7346 for m4base
in $m4dirs; do
7347 # Perform func_import in a subshell, so that variable values
7349 # local_gnulib_path, incobsolete, inc_cxx_tests,
7350 # inc_longrunning_tests, inc_privileged_tests,
7351 # inc_unportable_tests, inc_all_tests, avoidlist, sourcebase,
7352 # m4base, pobase, docbase, testsbase, inctests, libname, lgpl,
7353 # makefile_name, tests_makefile_name, automake_subdir, libtool,
7354 # macro_prefix, po_domain, witness_c_macro, vc_files
7355 # don't propagate from one directory to another.
7356 (func_import
) || func_exit
1
7360 func_fatal_error
"Ambiguity: to which directory should the modules be added? Please specify at least --m4-base=..."
7369 if test -z "$destdir"; then
7370 func_fatal_error
"please specify --dir option"
7373 test -d "$destdir" \
7374 || func_fatal_error
"could not create destination directory"
7375 test -n "$auxdir" || auxdir
="build-aux"
7376 func_create_testdir
"$destdir" "$*"
7379 create-megatestdir
)
7380 if test -z "$destdir"; then
7381 func_fatal_error
"please specify --dir option"
7383 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
7384 test -n "$auxdir" || auxdir
="build-aux"
7385 func_create_megatestdir
"$destdir" "$*"
7389 test -n "$destdir" || destdir
=testdir$$
7390 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
7391 test -n "$auxdir" || auxdir
="build-aux"
7392 func_create_testdir
"$destdir" "$*"
7396 ..
/configure || func_exit
1
7397 $MAKE || func_exit
1
7398 $MAKE check || func_exit
1
7399 $MAKE distclean || func_exit
1
7400 remaining
=`find . -type f -print`
7401 if test -n "$remaining"; then
7402 echo "Remaining files:" $remaining 1>&2
7403 echo "gnulib-tool: *** Stop." 1>&2
7412 test -n "$destdir" || destdir
=testdir$$
7413 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
7414 test -n "$auxdir" || auxdir
="build-aux"
7415 func_create_megatestdir
"$destdir" "$*"
7423 remaining
=`find . -type f -print`
7424 if test -n "$remaining"; then
7425 echo "Remaining files:" $remaining 1>&2
7426 echo "gnulib-tool: *** Stop." 1>&2
7434 extract-description
)
7438 if test -n "$module"; then
7439 func_get_description
"$module"
7448 if test -n "$module"; then
7449 func_get_comment
"$module"
7458 if test -n "$module"; then
7459 func_get_status
"$module"
7468 if test -n "$module"; then
7469 func_get_notice
"$module"
7474 extract-applicability
)
7478 if test -n "$module"; then
7479 func_get_applicability
"$module"
7488 if test -n "$module"; then
7489 func_get_filelist
"$module"
7494 extract-dependencies
)
7495 if test -n "$avoidlist"; then
7496 func_fatal_error
"cannot combine --avoid and --extract-dependencies"
7501 if test -n "$module"; then
7502 func_get_dependencies
"$module"
7507 extract-recursive-dependencies
)
7508 if test -n "$avoidlist"; then
7509 func_fatal_error
"cannot combine --avoid and --extract-recursive-dependencies"
7514 if test -n "$module"; then
7515 func_get_dependencies_recursively
"$module"
7520 extract-autoconf-snippet
)
7524 if test -n "$module"; then
7525 func_get_autoconf_snippet
"$module"
7530 extract-automake-snippet
)
7534 if test -n "$module"; then
7535 func_get_automake_snippet
"$module"
7540 extract-include-directive
)
7544 if test -n "$module"; then
7545 func_get_include_directive
"$module"
7550 extract-link-directive
)
7554 if test -n "$module"; then
7555 func_get_link_directive
"$module"
7560 extract-recursive-link-directive
)
7561 if test -n "$avoidlist"; then
7562 func_fatal_error
"cannot combine --avoid and --extract-recursive-link-directive"
7567 if test -n "$module"; then
7568 func_get_link_directive_recursively
"$module"
7577 if test -n "$module"; then
7578 func_get_license
"$module"
7583 extract-maintainer
)
7587 if test -n "$module"; then
7588 func_get_maintainer
"$module"
7593 extract-tests-module
)
7597 if test -n "$module"; then
7598 func_get_tests_module
"$module"
7604 # Verify the number of arguments.
7605 if test $# -lt 1 ||
test $# -gt 2; then
7606 func_fatal_error
"invalid number of arguments for --$mode"
7609 # The first argument is the file to be copied.
7611 # Verify the file exists.
7612 func_lookup_file
"$f"
7614 # The second argument is the destination; either a directory ot a file.
7615 # It defaults to the current directory.
7617 test -n "$dest" || dest
='.'
7618 test -n "$sourcebase" || sourcebase
="lib"
7619 test -n "$m4base" || m4base
="m4"
7620 test -n "$docbase" || docbase
="doc"
7621 test -n "$testsbase" || testsbase
="tests"
7622 test -n "$auxdir" || auxdir
="build-aux"
7623 rewritten
='%REWRITTEN%'
7624 sed_rewrite_files
="\
7625 s,^build-aux/,$rewritten$auxdir/,
7626 s,^doc/,$rewritten$docbase/,
7627 s,^lib/,$rewritten$sourcebase/,
7628 s,^m4/,$rewritten$m4base/,
7629 s,^tests/,$rewritten$testsbase/,
7632 if test -d "$dest"; then
7634 g
=`echo "$f" | sed -e "$sed_rewrite_files"`
7636 destdir
=`dirname "$dest"`
7637 g
=`basename "$dest"`
7640 # Create the directory for destfile.
7641 d
=`dirname "$destdir/$g"`
7643 if test -n "$d" && test ! -d "$d"; then
7644 mkdir
-p "$d" || func_fatal_error
"failed"
7648 func_dest_tmpfilename
"$g"
7649 cp "$lookedup_file" "$tmpfile" || func_fatal_error
"failed"
7650 func_ensure_writable
"$tmpfile"
7651 already_present
=true
7652 if test -f "$destdir/$g"; then
7653 # The file already exists.
7657 # Don't protest if the file should be there but isn't: it happens
7658 # frequently that developers don't put autogenerated files under version
7666 func_fatal_error
"unknown operation mode --$mode" ;;
7669 if test "$copymode" = hardlink
-o "$lcopymode" = hardlink
; then
7670 # Setting hard links modifies the ctime of files in the gnulib checkout.
7671 # This disturbs the result of the next "gitk" invocation.
7672 # Workaround: Let git scan the files. This can be done through
7673 # "git update-index --refresh" or "git status" or "git diff".
7674 if test -d "$gnulib_dir"/.git \
7675 && (git
--version) >/dev
/null
2>/dev
/null
; then
7676 (cd "$gnulib_dir" && git update-index
--refresh >/dev
/null
)
7681 # Undo the effect of the previous 'trap' command. Some shellology:
7682 # We cannot use "trap - EXIT HUP INT QUIT PIPE TERM", because Solaris sh would
7683 # attempt to execute the command "-". "trap '' ..." is fine only for signal EXIT
7684 # (= normal exit); for the others we need to call 'exit' explicitly. The value
7685 # of $? is 128 + signal number and is set before the trap-registered command is
7688 trap 'func_exit $?' HUP INT QUIT PIPE TERM
7693 # indent-tabs-mode: nil
7694 # whitespace-check-buffer-indent: nil