3 # Copyright (C) 2002-2019 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.
28 # You can set AUTOCONFPATH to empty if autoconf 2.63 is already in your PATH.
32 # AUTOCONFBINDIR=/arch/x86-linux/gnu-inst-autoconf/2.63/bin
33 # AUTOCONFPATH="eval env PATH=${AUTOCONFBINDIR}:\$PATH "
37 # You can set AUTOMAKEPATH to empty if automake 1.11 is already in your PATH.
40 # You can set GETTEXTPATH to empty if autopoint 0.15 is already in your PATH.
43 # You can set LIBTOOLPATH to empty if libtoolize 2.x is already in your PATH.
46 # If you didn't set AUTOCONFPATH and AUTOMAKEPATH, you can also set the
47 # variables AUTOCONF, AUTOHEADER, ACLOCAL, AUTOMAKE, AUTORECONF individually.
48 if test -z "${AUTOCONF}" ||
test -n "${AUTOCONFPATH}"; then
49 AUTOCONF
="${AUTOCONFPATH}autoconf"
51 if test -z "${AUTOHEADER}" ||
test -n "${AUTOCONFPATH}"; then
52 AUTOHEADER
="${AUTOCONFPATH}autoheader"
54 if test -z "${ACLOCAL}" ||
test -n "${AUTOMAKEPATH}"; then
55 ACLOCAL
="${AUTOMAKEPATH}aclocal"
57 if test -z "${AUTOMAKE}" ||
test -n "${AUTOMAKEPATH}"; then
58 AUTOMAKE
="${AUTOMAKEPATH}automake"
60 if test -z "${AUTORECONF}" ||
test -n "${AUTOCONFPATH}"; then
61 AUTORECONF
="${AUTOCONFPATH}autoreconf"
64 # If you didn't set GETTEXTPATH, you can also set the variable AUTOPOINT.
65 if test -z "${AUTOPOINT}" ||
test -n "${GETTEXTPATH}"; then
66 AUTOPOINT
="${GETTEXTPATH}autopoint"
69 # If you didn't set LIBTOOLPATH, you can also set the variable LIBTOOLIZE.
70 if test -z "${LIBTOOLIZE}" ||
test -n "${LIBTOOLPATH}"; then
71 LIBTOOLIZE
="${LIBTOOLPATH}libtoolize"
75 if test -z "${MAKE}"; then
79 # When using GNU sed, turn off as many GNU extensions as possible,
80 # to minimize the risk of accidentally using non-portable features.
81 # However, do this only for gnulib-tool itself, not for the code that
82 # gnulib-tool generates, since we don't want "sed --posix" to leak
83 # into makefiles. And do it only for sed versions 4.2 or newer,
84 # because "sed --posix" is buggy in GNU sed 4.1.5, see
85 # <https://lists.gnu.org/r/bug-gnulib/2009-02/msg00225.html>.
86 if (alias) > /dev
/null
2>&1 \
87 && echo |
sed --posix -e d
>/dev
/null
2>&1 \
88 && case `sed --version | sed -e 's/^[^0-9]*//' -e 1q` in \
89 [1-3]* |
4.
[01]*) false
;; \
93 # Define sed as an alias.
94 # It is not always possible to use aliases. Aliases are guaranteed to work
95 # if the executing shell is bash and either it is invoked as /bin/sh or
96 # is a version >= 2.0, supporting shopt. This is the common case.
97 # Two other approaches (use of a variable $sed or of a function func_sed
98 # instead of an alias) require massive, fragile code changes.
99 # An other approach (use of function sed) requires `which sed` - but
100 # 'which' is hard to emulate, due to missing "test -x" on some platforms.
101 if test -n "$BASH_VERSION"; then
102 shopt -s expand_aliases
>/dev
/null
2>&1
104 alias sed='sed --posix'
107 # sed_noop is a sed expression that does nothing.
108 # An empty expression does not work with the native 'sed' on AIX 6.1.
111 # sed_comments is true or false, depending whether 'sed' supports comments.
112 # AIX 5.3 sed barfs over indented comments.
113 if echo fo |
sed -e 's/f/g/
116 s/o/e/' 2>/dev
/null |
grep ge
> /dev
/null
; then
123 # outputs to stdout the --help usage message.
127 Usage: gnulib-tool --list
128 gnulib-tool --find filename
129 gnulib-tool --import [module1 ... moduleN]
130 gnulib-tool --add-import [module1 ... moduleN]
131 gnulib-tool --remove-import [module1 ... moduleN]
133 gnulib-tool --create-testdir --dir=directory [module1 ... moduleN]
134 gnulib-tool --create-megatestdir --dir=directory [module1 ... moduleN]
135 gnulib-tool --test --dir=directory module1 ... moduleN
136 gnulib-tool --megatest --dir=directory [module1 ... moduleN]
137 gnulib-tool --extract-description module
138 gnulib-tool --extract-comment module
139 gnulib-tool --extract-status module
140 gnulib-tool --extract-notice module
141 gnulib-tool --extract-applicability module
142 gnulib-tool --extract-filelist module
143 gnulib-tool --extract-dependencies module
144 gnulib-tool --extract-recursive-dependencies module
145 gnulib-tool --extract-autoconf-snippet module
146 gnulib-tool --extract-automake-snippet module
147 gnulib-tool --extract-include-directive module
148 gnulib-tool --extract-link-directive module
149 gnulib-tool --extract-recursive-link-directive module
150 gnulib-tool --extract-license module
151 gnulib-tool --extract-maintainer module
152 gnulib-tool --extract-tests-module module
153 gnulib-tool --copy-file file [destination]
157 --list print the available module names
158 --find find the modules which contain the specified file
159 --import import the given modules into the current package
160 --add-import augment the list of imports from gnulib into the
161 current package, by adding the given modules;
162 if no modules are specified, update the current
163 package from the current gnulib
164 --remove-import reduce the list of imports from gnulib into the
165 current package, by removing the given modules
166 --update update the current package, restore files omitted
168 --create-testdir create a scratch package with the given modules
169 --create-megatestdir create a mega scratch package with the given modules
170 one by one and all together
171 --test test the combination of the given modules
172 (recommended to use CC=\"gcc -Wall\" here)
173 --megatest test the given modules one by one and all together
174 (recommended to use CC=\"gcc -Wall\" here)
175 --extract-description extract the description
176 --extract-comment extract the comment
177 --extract-status extract the status (obsolete etc.)
178 --extract-notice extract the notice or banner
179 --extract-applicability extract the applicability
180 --extract-filelist extract the list of files
181 --extract-dependencies extract the dependencies
182 --extract-recursive-dependencies extract the dependencies of the module
183 and its dependencies, recursively, all
184 together, but without the conditions
185 --extract-autoconf-snippet extract the snippet for configure.ac
186 --extract-automake-snippet extract the snippet for library makefile
187 --extract-include-directive extract the #include directive
188 --extract-link-directive extract the linker directive
189 --extract-recursive-link-directive extract the linker directive of the
190 module and its dependencies,
191 recursively, all together
192 --extract-license report the license terms of the source files
194 --extract-maintainer report the maintainer(s) inside gnulib
195 --extract-tests-module report the unit test module, if it exists
196 --copy-file copy a file that is not part of any module
197 --help Show this help text.
198 --version Show version and authorship information.
202 --dir=DIRECTORY Specify the target directory.
203 For --import, this specifies where your
204 configure.ac can be found. Defaults to current
206 --local-dir=DIRECTORY Specify a local override directory where to look
207 up files before looking in gnulib's directory.
208 --cache-modules Enable module caching optimization.
209 --no-cache-modules Disable module caching optimization.
210 --verbose Increase verbosity. May be repeated.
211 --quiet Decrease verbosity. May be repeated.
213 Options for --import, --add/remove-import, --update:
215 --dry-run Only print what would have been done.
217 Options for --import, --add/remove-import:
219 --with-tests Include unit tests for the included modules.
221 Options for --create-[mega]testdir, --[mega]test:
223 --without-tests Don't include unit tests for the included modules.
225 Options for --import, --add/remove-import,
226 --create-[mega]testdir, --[mega]test:
228 --with-obsolete Include obsolete modules when they occur among the
229 dependencies. By default, dependencies to obsolete
231 --with-c++-tests Include even unit tests for C++ interoperability.
232 --without-c++-tests Exclude unit tests for C++ interoperability.
233 --with-longrunning-tests
234 Include even unit tests that are long-runners.
235 --without-longrunning-tests
236 Exclude unit tests that are long-runners.
237 --with-privileged-tests
238 Include even unit tests that require root
240 --without-privileged-tests
241 Exclude unit tests that require root privileges.
242 --with-unportable-tests
243 Include even unit tests that fail on some platforms.
244 --without-unportable-tests
245 Exclude unit tests that fail on some platforms.
246 --with-all-tests Include all kinds of problematic unit tests.
247 --avoid=MODULE Avoid including the given MODULE. Useful if you
248 have code that provides equivalent functionality.
249 This option can be repeated.
250 --conditional-dependencies
251 Support conditional dependencies (may save configure
252 time and object code).
253 --no-conditional-dependencies
254 Don't use conditional dependencies.
255 --libtool Use libtool rules.
256 --no-libtool Don't use libtool rules.
258 Options for --import, --add/remove-import:
260 --lib=LIBRARY Specify the library name. Defaults to 'libgnu'.
261 --source-base=DIRECTORY
262 Directory relative to --dir where source code is
263 placed (default \"lib\").
264 --m4-base=DIRECTORY Directory relative to --dir where *.m4 macros are
265 placed (default \"m4\").
266 --po-base=DIRECTORY Directory relative to --dir where *.po files are
267 placed (default \"po\").
268 --doc-base=DIRECTORY Directory relative to --dir where doc files are
269 placed (default \"doc\").
270 --tests-base=DIRECTORY
271 Directory relative to --dir where unit tests are
272 placed (default \"tests\").
273 --aux-dir=DIRECTORY Directory relative to --dir where auxiliary build
274 tools are placed (default comes from configure.ac).
275 --gnu-make Output for GNU Make instead of for the default
277 --lgpl[=2|=3orGPLv2|=3]
278 Abort if modules aren't available under the LGPL.
279 Also modify license template from GPL to LGPL.
280 The version number of the LGPL can be specified;
281 the default is currently LGPLv3.
282 --makefile-name=NAME Name of makefile in the source-base and tests-base
283 directories (default \"Makefile.am\", or
284 \"Makefile.in\" if --gnu-make).
285 --macro-prefix=PREFIX Specify the prefix of the macros 'gl_EARLY' and
286 'gl_INIT'. Default is 'gl'.
287 --po-domain=NAME Specify the prefix of the i18n domain. Usually use
288 the package name. A suffix '-gnulib' is appended.
289 --witness-c-macro=NAME Specify the C macro that is defined when the
290 sources in this directory are compiled or used.
291 --vc-files Update version control related files.
292 --no-vc-files Don't update version control related files
293 (.gitignore and/or .cvsignore).
295 Options for --create-[mega]testdir, --[mega]test:
297 --single-configure Generate a single configure file, not a separate
298 configure file for the tests directory.
300 Options for --import, --add/remove-import, --update,
301 --create-[mega]testdir, --[mega]test:
303 -s, --symbolic, --symlink Make symbolic links instead of copying files.
304 --local-symlink Make symbolic links instead of copying files, only
305 for files from the local override directory.
306 -h, --hardlink Make hard links instead of copying files.
307 --local-hardlink Make hard links instead of copying files, only
308 for files from the local override directory.
310 Options for --import, --add/remove-import, --update:
312 -S, --more-symlinks Make symbolic links instead of copying files, and
313 don't replace copyright notices.
314 -H, --more-hardlinks Make hard links instead of copying files, and
315 don't replace copyright notices.
317 Report bugs to <bug-gnulib@gnu.org>."
321 # outputs to stdout the --version message.
325 if test -d "$gnulib_dir"/.git \
326 && (git
--version) >/dev
/null
2>/dev
/null \
327 && (date --version) >/dev
/null
2>/dev
/null
; then
328 # gnulib checked out from git.
329 sed_extract_first_date
='/^Date/{
333 date=`cd "$gnulib_dir" && git log ChangeLog | sed -n -e "$sed_extract_first_date"`
334 # Turn "Fri Mar 21 07:16:51 2008 -0600" into "Mar 21 2008 07:16:51 -0600".
335 sed_year_before_time
='s/^[^ ]* \([^ ]*\) \([0-9]*\) \([0-9:]*\) \([0-9]*\) /\1 \2 \4 \3 /'
336 date=`echo "$date" | sed -e "$sed_year_before_time"`
337 # Use GNU date to compute the time in GMT.
338 date=`date -d "$date" -u +"%Y-%m-%d %H:%M:%S"`
339 version
=' '`cd "$gnulib_dir" && ./build-aux/git-version-gen /dev/null | sed -e 's/-dirty/-modified/'`
341 # gnulib copy without versioning information.
342 date=`sed -e 's/ .*//;q' "$gnulib_dir"/ChangeLog`
345 year
=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed -e 's,^.* ,,'`
347 gnulib-tool (GNU $package $date)$version
348 Copyright (C) $year Free Software Foundation, Inc.
349 License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
350 This is free software: you are free to change and redistribute it.
351 There is NO WARRANTY, to the extent permitted by law.
353 printf "Written by %s, %s, and %s.\n" "Bruno Haible" "Paul Eggert" "Simon Josefsson"
356 # func_emit_copyright_notice
357 # outputs to stdout a header for a generated file.
358 func_emit_copyright_notice
()
360 sed -n -e '/Copyright/ {
363 }' < "$self_abspathname"
365 echo "# This file is free software; you can redistribute it and/or modify"
366 echo "# it under the terms of the GNU General Public License as published by"
367 echo "# the Free Software Foundation; either version 3 of the License, or"
368 echo "# (at your option) any later version."
370 echo "# This file is distributed in the hope that it will be useful,"
371 echo "# but WITHOUT ANY WARRANTY; without even the implied warranty of"
372 echo "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
373 echo "# GNU General Public License for more details."
375 echo "# You should have received a copy of the GNU General Public License"
376 echo "# along with this file. If not, see <https://www.gnu.org/licenses/>."
378 echo "# As a special exception to the GNU General Public License,"
379 echo "# this file may be distributed as part of a program that"
380 echo "# contains a configuration script generated by Autoconf, under"
381 echo "# the same distribution terms as the rest of that program."
383 echo "# Generated by gnulib-tool."
387 # exits with a given status.
388 # This function needs to be used, rather than 'exit', when a 'trap' handler is
389 # in effect that refers to $?.
396 # locates the directory where the gnulib repository lives
398 # - progname name of this program
400 # - self_abspathname absolute pathname of gnulib-tool
401 # - gnulib_dir absolute pathname of gnulib repository
405 /* | ?
:*) self_abspathname
="$progname" ;;
406 */*) self_abspathname
=`pwd`/"$progname" ;;
409 # Iterate through the elements of $PATH.
410 # We use IFS=: instead of
411 # for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'`
412 # because the latter does not work when some PATH element contains spaces.
413 # We use a canonicalized $pathx instead of $PATH, because empty PATH
414 # elements are by definition equivalent to '.', however field splitting
415 # according to IFS=: loses empty fields in many shells:
416 # - /bin/sh on OSF/1 and Solaris loses all empty fields (at the
417 # beginning, at the end, and in the middle),
418 # - /bin/sh on IRIX and /bin/ksh on IRIX and OSF/1 lose empty fields
419 # at the beginning and at the end,
420 # - GNU bash, /bin/sh on AIX and HP-UX, and /bin/ksh on AIX, HP-UX,
421 # Solaris lose empty fields at the end.
422 # The 'case' statement is an optimization, to avoid evaluating the
423 # explicit canonicalization command when $PATH contains no empty fields.
425 if test "$PATH_SEPARATOR" = ";"; then
426 # On Windows, programs are searched in "." before $PATH.
429 # On Unix, we have to convert empty PATH elements to ".".
433 pathx
=`echo ":$PATH:" | sed -e 's/:::*/:.:/g' -e 's/^://' -e 's/:\$//'`
438 IFS
="$PATH_SEPARATOR"
442 if test -x "$d/$progname" && test ! -d "$d/$progname"; then
443 self_abspathname
="$d/$progname"
448 if test -z "$self_abspathname"; then
449 func_fatal_error
"could not locate the gnulib-tool program - how did you invoke it?"
453 while test -h "$self_abspathname"; do
454 # Resolve symbolic link.
455 linkval
=`func_readlink "$self_abspathname"`
456 test -n "$linkval" ||
break
458 /* | ?
:* ) self_abspathname
="$linkval" ;;
459 * ) self_abspathname
=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;;
462 gnulib_dir
=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
466 # creates a temporary directory.
468 # - progname name of this program
470 # - tmp pathname of freshly created temporary directory
473 # Use the environment variable TMPDIR, falling back to /tmp. This allows
474 # users to specify a different temporary directory, for example, if their
475 # /tmp is filled up or too small.
478 # Use the mktemp program if available. If not available, hide the error
480 tmp
=`(umask 077 && mktemp -d "$TMPDIR/glXXXXXX") 2>/dev/null` &&
481 test -n "$tmp" && test -d "$tmp"
484 # Use a simple mkdir command. It is guaranteed to fail if the directory
485 # already exists. $RANDOM is bash specific and expands to empty in shells
486 # other than bash, ksh and zsh. Its use does not increase security;
487 # rather, it minimizes the probability of failure in a very cluttered /tmp
489 tmp
=$TMPDIR/gl$$
-$RANDOM
490 (umask 077 && mkdir
"$tmp")
493 echo "$progname: cannot create a temporary directory in $TMPDIR" >&2
498 # func_append var value
499 # appends the given value to the shell variable var.
500 if ( foo
=bar
; foo
+=baz
&& test "$foo" = barbaz
) >/dev
/null
2>&1; then
501 # Use bash's += operator. It reduces complexity of appending repeatedly to
502 # a single variable from O(n^2) to O(n).
507 fast_func_append
=true
511 eval "$1=\"\$$1\$2\""
513 fast_func_append
=false
516 # func_remove_prefix var prefix
517 # removes the given prefix from the value of the shell variable var.
518 # var should be the name of a shell variable.
519 # Its value should not contain a newline and not start or end with whitespace.
520 # prefix should not contain the characters "$`\{}[]^|.
521 if ( foo
=bar
; eval 'test "${foo#b}" = ar' ) >/dev
/null
2>&1; then
522 func_remove_prefix
()
526 fast_func_remove_prefix
=true
528 func_remove_prefix
()
530 eval "value=\"\$$1\""
534 sed_escape_dots
='s/\([.]\)/\\\1/g'
535 prefix
=`echo "$prefix" | sed -e "$sed_escape_dots"`
538 value
=`echo "$value" | sed -e "s|^${prefix}||"`
539 eval "$1=\"\$value\""
541 fast_func_remove_prefix
=false
544 # Determine whether we should use ':' or ';' as PATH_SEPARATOR.
545 func_determine_path_separator
()
547 if test "${PATH_SEPARATOR+set}" != set; then
548 # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
549 # contains only /bin. Note that ksh looks also at the FPATH variable,
550 # so we have to set that as well for the test.
552 (PATH
='/bin;/bin'; FPATH
=$PATH; sh
-c :) >/dev
/null
2>&1 \
553 && { (PATH
='/bin:/bin'; FPATH
=$PATH; sh
-c :) >/dev
/null
2>&1 \
554 || PATH_SEPARATOR
=';'
559 # func_path_append pathvar directory
560 # appends directory to pathvar, delimiting directories by PATH_SEPARATOR.
563 if eval "test -n \"\$$1\""; then
564 func_append
"$1" "$PATH_SEPARATOR$2"
570 # func_path_foreach_inner
571 # helper for func_path_foreach because we need new 'args' array
573 # - fpf_dir directory from local_gnulib_path
574 # - fpf_cb callback to be run for fpf_dir
575 func_path_foreach_inner
()
597 # func_path_foreach path method args
598 # Execute method for each directory in path. The method will be called
599 # like `method args` while any argument '%dir%' within args will be replaced
600 # with processed directory from path.
608 IFS
="$PATH_SEPARATOR"
609 for fpf_dir
in $fpf_dirs
612 func_path_foreach_inner
"$@" && fpf_rc
=:
618 # func_remove_suffix var suffix
619 # removes the given suffix from the value of the shell variable var.
620 # var should be the name of a shell variable.
621 # Its value should not contain a newline and not start or end with whitespace.
622 # suffix should not contain the characters "$`\{}[]^|.
623 if ( foo
=bar
; eval 'test "${foo%r}" = ba' ) >/dev
/null
2>&1; then
624 func_remove_suffix
()
628 fast_func_remove_suffix
=true
630 func_remove_suffix
()
632 eval "value=\"\$$1\""
636 sed_escape_dots
='s/\([.]\)/\\\1/g'
637 suffix
=`echo "$suffix" | sed -e "$sed_escape_dots"`
640 value
=`echo "$value" | sed -e "s|${suffix}\$||"`
641 eval "$1=\"\$value\""
643 fast_func_remove_suffix
=false
646 # func_fatal_error message
647 # outputs to stderr a fatal error message, and terminates the program.
649 # - progname name of this program
652 echo "$progname: *** $1" 1>&2
653 echo "$progname: *** Stop." 1>&2
657 # func_warning message
658 # Outputs to stderr a warning message,
661 echo "gnulib-tool: warning: $1" 1>&2
664 # func_readlink SYMLINK
665 # outputs the target of the given symlink.
666 if (type readlink
) > /dev
/null
2>&1; then
669 # Use the readlink program from GNU coreutils.
675 # Use two sed invocations. A single sed -n -e 's,^.* -> \(.*\)$,\1,p'
676 # would do the wrong thing if the link target contains " -> ".
677 LC_ALL
=C
ls -l "$1" |
sed -e 's, -> ,#%%#,' |
sed -n -e 's,^.*#%%#\(.*\)$,\1,p'
681 # func_relativize DIR1 DIR2
682 # computes a relative pathname RELDIR such that DIR1/RELDIR = DIR2.
684 # - DIR1 relative pathname, relative to the current directory
685 # - DIR2 relative pathname, relative to the current directory
687 # - reldir relative pathname of DIR2, relative to DIR1
693 sed_first
='s,^\([^/]*\)/.*$,\1,'
694 sed_rest
='s,^[^/]*/*,,'
695 sed_last
='s,^.*/\([^/]*\)$,\1,'
696 sed_butlast
='s,/*[^/]*$,,'
697 while test -n "$dir1"; do
698 first
=`echo "$dir1" | sed -e "$sed_first"`
699 if test "$first" != "."; then
700 if test "$first" = ".."; then
701 dir2
=`echo "$dir0" | sed -e "$sed_last"`/"$dir2"
702 dir0
=`echo "$dir0" | sed -e "$sed_butlast"`
704 first2
=`echo "$dir2" | sed -e "$sed_first"`
705 if test "$first2" = "$first"; then
706 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
710 dir0
="$dir0"/"$first"
713 dir1
=`echo "$dir1" | sed -e "$sed_rest"`
718 # func_relconcat DIR1 DIR2
719 # computes a relative pathname DIR1/DIR2, with obvious simplifications.
721 # - DIR1 relative pathname, relative to the current directory
722 # - DIR2 relative pathname, relative to DIR1
724 # - relconcat DIR1/DIR2, relative to the current directory
729 sed_first
='s,^\([^/]*\)/.*$,\1,'
730 sed_rest
='s,^[^/]*/*,,'
731 sed_last
='s,^.*/\([^/]*\)$,\1,'
732 sed_butlast
='s,/*[^/]*$,,'
734 first
=`echo "$dir2" | sed -e "$sed_first"`
735 if test "$first" = "."; then
736 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
737 if test -z "$dir2"; then
742 last
=`echo "$dir1" | sed -e "$sed_last"`
743 while test "$last" = "."; do
744 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
745 last
=`echo "$dir1" | sed -e "$sed_last"`
747 if test -z "$dir1"; then
751 if test "$first" = ".."; then
752 if test "$last" = ".."; then
753 relconcat
="$dir1/$dir2"
756 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
757 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
758 if test -z "$dir1"; then
762 if test -z "$dir2"; then
767 relconcat
="$dir1/$dir2"
775 # Like ln -s, except use cp -p if ln -s fails.
779 echo "$progname: ln -s failed; falling back on cp -p" >&2
782 /* | ?
:*) # SRC is absolute.
784 *) # SRC is relative to the directory of DEST.
786 */*) cp_src
="${2%/*}/$1" ;;
796 # func_symlink_target SRC DEST
797 # Determines LINK_TARGET such that "ln -s LINK_TARGET DEST" will create a
798 # symbolic link DEST that points to SRC.
800 # - link_target link target, relative to the directory of DEST
801 func_symlink_target
()
806 *) # SRC is relative.
809 link_target
="`pwd`/$1" ;;
810 *) # DEST is relative too.
811 ln_destdir
=`echo "$2" | sed -e 's,[^/]*$,,'`
812 test -n "$ln_destdir" || ln_destdir
="."
813 func_relativize
"$ln_destdir" "$1"
814 link_target
="$reldir"
821 # func_symlink SRC DEST
822 # Like func_ln_s, except that SRC is given relative to the current directory (or
823 # absolute), not given relative to the directory of DEST.
826 func_symlink_target
"$1" "$2"
827 func_ln_s
"$link_target" "$2"
830 # func_symlink_if_changed SRC DEST
831 # Like func_symlink, but avoids munging timestamps if the link is correct.
832 # SRC is given relative to the current directory (or absolute).
833 func_symlink_if_changed
()
835 if test $# -ne 2; then
836 echo "usage: func_symlink_if_changed SRC DEST" >&2
838 func_symlink_target
"$1" "$2"
839 ln_target
=`func_readlink "$2"`
840 if test -h "$2" && test "$link_target" = "$ln_target"; then
844 func_ln_s
"$link_target" "$2"
848 # func_hardlink SRC DEST
849 # Like ln, except use cp -p if ln fails.
850 # SRC is given relative to the current directory (or absolute).
854 echo "$progname: ln failed; falling back on cp -p" >&2
859 # Ensure an 'echo' command that
860 # 1. does not interpret backslashes and
861 # 2. does not print an error message "broken pipe" when writing into a pipe
864 # Test cases for problem 1:
865 # echo '\n' | wc -l prints 1 when OK, 2 when KO
866 # echo '\t' | grep t > /dev/null has return code 0 when OK, 1 when KO
867 # Test cases for problem 2:
868 # echo hi | true frequently prints
869 # "bash: echo: write error: Broken pipe"
870 # to standard error in bash 3.2.
872 # Problem 1 is a weird heritage from SVR4. BSD got it right (except that
873 # BSD echo interprets '-n' as an option, which is also not desirable).
874 # Nowadays the problem occurs in 4 situations:
875 # - in bash, when the shell option xpg_echo is set (bash >= 2.04)
876 # or when it was built with --enable-usg-echo-default (bash >= 2.0)
877 # or when it was built with DEFAULT_ECHO_TO_USG (bash < 2.0),
878 # - in zsh, when sh-emulation is not set,
879 # - in ksh (e.g. AIX /bin/sh and Solaris /usr/xpg4/bin/sh are ksh instances,
880 # and HP-UX /bin/sh and IRIX /bin/sh behave similarly),
881 # - in Solaris /bin/sh and OSF/1 /bin/sh.
882 # We try the following workarounds:
883 # - for all: respawn using $CONFIG_SHELL if that is set and works.
884 # - for bash >= 2.04: unset the shell option xpg_echo.
885 # - for bash >= 2.0: define echo to a function that uses the printf built-in.
886 # - for bash < 2.0: define echo to a function that uses cat of a here document.
887 # - for zsh: turn sh-emulation on.
888 # - for ksh: alias echo to 'print -r'.
889 # - for ksh: alias echo to a function that uses cat of a here document.
890 # - for Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh and rely on
891 # the ksh workaround.
892 # - otherwise: respawn using /bin/sh and rely on the workarounds.
893 # When respawning, we pass --no-reexec as first argument, so as to avoid
894 # turning this script into a fork bomb in unlucky situations.
896 # Problem 2 is specific to bash 3.2 and affects the 'echo' built-in, but not
897 # the 'printf' built-in. See
898 # <https://lists.gnu.org/r/bug-bash/2008-12/msg00050.html>
899 # <https://lists.gnu.org/r/bug-gnulib/2010-02/msg00154.html>
900 # The workaround is: define echo to a function that uses the printf built-in.
902 if echo '\t' |
grep t
> /dev
/null
; then
903 have_echo
=yes # Lucky!
905 # Try the workarounds.
906 # Respawn using $CONFIG_SHELL if that is set and works.
907 if test -z "$have_echo" \
908 && test "X$1" != "X--no-reexec" \
909 && test -n "$CONFIG_SHELL" \
910 && test -f "$CONFIG_SHELL" \
911 && $CONFIG_SHELL -c "echo '\\t' | grep t > /dev/null"; then
912 exec $CONFIG_SHELL "$0" --no-reexec "$@"
915 # For bash >= 2.04: unset the shell option xpg_echo.
916 if test -z "$have_echo" \
917 && test -n "$BASH_VERSION" \
918 && (shopt -o xpg_echo
; echo '\t' |
grep t
> /dev
/null
) 2>/dev
/null
; then
922 # For bash >= 2.0: define echo to a function that uses the printf built-in.
923 # For bash < 2.0: define echo to a function that uses cat of a here document.
924 # (There is no win in using 'printf' over 'cat' if it is not a shell built-in.)
925 # Also handle problem 2, specific to bash 3.2, here.
926 if { test -z "$have_echo" \
927 ||
case "$BASH_VERSION" in 3.2*) true
;; *) false
;; esac; \
929 && test -n "$BASH_VERSION"; then \
930 if type printf 2>/dev
/null |
grep / > /dev
/null
; then
931 # 'printf' is not a shell built-in.
939 # 'printf' is a shell built-in.
945 if echo '\t' |
grep t
> /dev
/null
; then
949 # For zsh: turn sh-emulation on.
950 if test -z "$have_echo" \
951 && test -n "$ZSH_VERSION" \
952 && (emulate sh
) >/dev
/null
2>&1; then
955 # For ksh: alias echo to 'print -r'.
956 if test -z "$have_echo" \
957 && (type print
) >/dev
/null
2>&1; then
958 # A 'print' command exists.
959 if type print
2>/dev
/null |
grep / > /dev
/null
; then
962 # 'print' is a shell built-in.
963 if (print
-r '\told' |
grep told
> /dev
/null
) 2>/dev
/null
; then
964 # 'print' is the ksh shell built-in.
965 alias echo='print -r'
969 if test -z "$have_echo" \
970 && echo '\t' |
grep t
> /dev
/null
; then
973 # For ksh: alias echo to a function that uses cat of a here document.
974 # The ksh manual page says:
975 # "Aliasing is performed when scripts are read, not while they are executed.
976 # Therefore, for an alias to take effect, the alias definition command has
977 # to be executed before the command which references the alias is read."
978 # Because of this, we have to play strange tricks with have_echo, to ensure
979 # that the top-level statement containing the test starts after the 'alias'
981 if test -z "$have_echo"; then
988 if (alias echo=bsd_echo
) 2>/dev
/null
; then
989 alias echo=bsd_echo
2>/dev
/null
992 if test -z "$have_echo" \
993 && echo '\t' |
grep t
> /dev
/null
; then
996 if test -z "$have_echo"; then
997 if (alias echo=bsd_echo
) 2>/dev
/null
; then
998 unalias echo 2>/dev
/null
1001 # For Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh.
1002 if test -z "$have_echo" \
1003 && test "X$1" != "X--no-reexec" \
1004 && test -f /bin
/ksh
; then
1005 exec /bin
/ksh
"$0" --no-reexec "$@"
1008 # Otherwise: respawn using /bin/sh.
1009 if test -z "$have_echo" \
1010 && test "X$1" != "X--no-reexec" \
1011 && test -f /bin
/sh
; then
1012 exec /bin
/sh
"$0" --no-reexec "$@"
1015 if test -z "$have_echo"; then
1016 func_fatal_error
"Shell does not support 'echo' correctly. Please install GNU bash and set the environment variable CONFIG_SHELL to point to it."
1018 if echo '\t' |
grep t
> /dev
/null
; then
1021 func_fatal_error
"Shell does not support 'echo' correctly. Workaround does not work. Please report this as a bug to bug-gnulib@gnu.org."
1023 if test "X$1" = "X--no-reexec"; then
1027 # Unset CDPATH. Otherwise, output from 'cd dir' can surprise callers.
1028 (unset CDPATH
) >/dev
/null
2>&1 && unset CDPATH
1030 # Determine the path separator early because the following option parsing code
1032 func_determine_path_separator
1034 # Command-line option processing.
1035 # Removes the OPTIONS from the arguments. Sets the variables:
1036 # - mode one of: list, find, import, add-import, remove-import,
1037 # update, create-testdir, create-megatestdir, test, megatest,
1039 # - destdir from --dir
1040 # - local_gnulib_path from --local-dir, highest priority dir comes first
1041 # - modcache true or false, from --cache-modules/--no-cache-modules
1042 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
1043 # - libname, supplied_libname from --lib
1044 # - sourcebase from --source-base
1045 # - m4base from --m4-base
1046 # - pobase from --po-base
1047 # - docbase from --doc-base
1048 # - testsbase from --tests-base
1049 # - auxdir from --aux-dir
1050 # - inctests true if --with-tests was given, false if --without-tests
1051 # was given, blank otherwise
1052 # - incobsolete true if --with-obsolete was given, blank otherwise
1053 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
1054 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
1056 # - inc_privileged_tests true if --with-privileged-tests was given, blank
1058 # - inc_unportable_tests true if --with-unportable-tests was given, blank
1060 # - inc_all_tests true if --with-all-tests was given, blank otherwise
1061 # - excl_cxx_tests true if --without-c++-tests was given, blank otherwise
1062 # - excl_longrunning_tests true if --without-longrunning-tests was given,
1064 # - excl_privileged_tests true if --without-privileged-tests was given, blank
1066 # - excl_unportable_tests true if --without-unportable-tests was given, blank
1068 # - single_configure true if --single-configure was given, false otherwise
1069 # - avoidlist list of modules to avoid, from --avoid
1070 # - cond_dependencies true if --conditional-dependencies was given, false if
1071 # --no-conditional-dependencies was given, blank otherwise
1072 # - lgpl yes or a number if --lgpl was given, blank otherwise
1073 # - gnu_make true if --gnu-make was given, false otherwise
1074 # - makefile_name from --makefile-name
1075 # - libtool true if --libtool was given, false if --no-libtool was
1076 # given, blank otherwise
1077 # - macro_prefix from --macro-prefix
1078 # - po_domain from --po-domain
1079 # - witness_c_macro from --witness-c-macro
1080 # - vc_files true if --vc-files was given, false if --no-vc-files was
1081 # given, blank otherwise
1082 # - autoconf_minversion minimum supported autoconf version
1083 # - doit : if actions shall be executed, false if only to be printed
1084 # - copymode symlink if --symlink or --more-symlinks was given,
1085 # hardlink if --hardlink or --more-hardlinks was given,
1087 # - lcopymode symlink if --local-symlink was given,
1088 # hardlink if --local-hardlink was given,
1090 # - do_copyrights blank if --more-symlinks or --more-hardlinks was given,
1109 inc_longrunning_tests
=
1110 inc_privileged_tests
=
1111 inc_unportable_tests
=
1114 excl_longrunning_tests
=
1115 excl_privileged_tests
=
1116 excl_unportable_tests
=
1117 single_configure
=false
1135 while test $# -gt 0; do
1140 --find |
--fin |
--fi |
--f )
1143 --import |
--impor |
--impo |
--imp |
--im |
--i )
1146 --add-import |
--add-impor |
--add-impo |
--add-imp |
--add-im |
--add-i |
--add- |
--add |
--ad )
1149 --remove-import |
--remove-impor |
--remove-impo |
--remove-imp |
--remove-im |
--remove-i |
--remove- |
--remove |
--remov |
--remo |
--rem |
--re |
--r )
1152 --update |
--updat |
--upda |
--upd |
--up |
--u )
1155 --create-testdir |
--create-testdi |
--create-testd |
--create-test |
--create-tes |
--create-te |
--create-t )
1158 --create-megatestdir |
--create-megatestdi |
--create-megatestd |
--create-megatest |
--create-megates |
--create-megate |
--create-megat |
--create-mega |
--create-meg |
--create-me |
--create-m )
1159 mode
=create-megatestdir
1161 --test |
--tes |
--te |
--t )
1164 --megatest |
--megates |
--megate |
--megat |
--mega |
--meg |
--me |
--m )
1168 mode
=`echo "X$1" | sed -e 's/^X--//'`
1170 --copy-file |
--copy-fil |
--copy-fi |
--copy-f |
--copy- |
--copy |
--cop )
1175 if test $# = 0; then
1176 func_fatal_error
"missing argument for --dir"
1181 destdir
=`echo "X$1" | sed -e 's/^X--dir=//'`
1185 if test $# = 0; then
1186 func_fatal_error
"missing argument for --local-dir"
1188 func_path_append local_gnulib_path
"$1"
1191 local_dir
=`echo "X$1" | sed -e 's/^X--local-dir=//'`
1192 func_path_append local_gnulib_path
"$local_dir"
1194 --cache-modules |
--cache-module |
--cache-modul |
--cache-modu |
--cache-mod |
--cache-mo |
--cache-m |
--cache- |
--cache |
--cach |
--cac |
--ca )
1197 --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 )
1200 --verbose |
--verbos |
--verbo |
--verb )
1201 verbose
=`expr $verbose + 1`
1203 --quiet |
--quie |
--qui |
--qu |
--q )
1204 verbose
=`expr $verbose - 1`
1208 if test $# = 0; then
1209 func_fatal_error
"missing argument for --lib"
1212 supplied_libname
=true
1215 libname
=`echo "X$1" | sed -e 's/^X--lib=//'`
1216 supplied_libname
=true
1220 if test $# = 0; then
1221 func_fatal_error
"missing argument for --source-base"
1226 sourcebase
=`echo "X$1" | sed -e 's/^X--source-base=//'`
1230 if test $# = 0; then
1231 func_fatal_error
"missing argument for --m4-base"
1236 m4base
=`echo "X$1" | sed -e 's/^X--m4-base=//'`
1240 if test $# = 0; then
1241 func_fatal_error
"missing argument for --po-base"
1246 pobase
=`echo "X$1" | sed -e 's/^X--po-base=//'`
1250 if test $# = 0; then
1251 func_fatal_error
"missing argument for --doc-base"
1256 docbase
=`echo "X$1" | sed -e 's/^X--doc-base=//'`
1260 if test $# = 0; then
1261 func_fatal_error
"missing argument for --tests-base"
1266 testsbase
=`echo "X$1" | sed -e 's/^X--tests-base=//'`
1270 if test $# = 0; then
1271 func_fatal_error
"missing argument for --aux-dir"
1276 auxdir
=`echo "X$1" | sed -e 's/^X--aux-dir=//'`
1278 --with-tests |
--with-test |
--with-tes |
--with-te |
--with-t)
1281 --with-obsolete |
--with-obsolet |
--with-obsole |
--with-obsol |
--with-obso |
--with-obs |
--with-ob |
--with-o)
1284 --with-c++-tests |
--with-c++-test |
--with-c++-tes |
--with-c++-te |
--with-c++-t |
--with-c++- |
--with-c++ |
--with-c+ |
--with-c)
1287 --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)
1288 inc_longrunning_tests
=true
1290 --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)
1291 inc_privileged_tests
=true
1293 --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)
1294 inc_unportable_tests
=true
1296 --with-all-tests |
--with-all-test |
--with-all-tes |
--with-all-te |
--with-all-t |
--with-all- |
--with-all |
--with-al |
--with-a)
1299 --without-tests |
--without-test |
--without-tes |
--without-te |
--without-t)
1302 --without-c++-tests |
--without-c++-test |
--without-c++-tes |
--without-c++-te |
--without-c++-t |
--without-c++- |
--without-c++ |
--without-c+ |
--without-c)
1305 --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)
1306 excl_longrunning_tests
=true
1308 --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)
1309 excl_privileged_tests
=true
1311 --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)
1312 excl_unportable_tests
=true
1314 --single-configure |
--single-configur |
--single-configu |
--single-config |
--single-confi |
--single-conf |
--single-con |
--single-con |
--single-co |
--single-c |
--single- |
--single |
--singl |
--sing |
--sin |
--si)
1315 single_configure
=true
1319 if test $# = 0; then
1320 func_fatal_error
"missing argument for --avoid"
1322 func_append avoidlist
" $1"
1325 arg
=`echo "X$1" | sed -e 's/^X--avoid=//'`
1326 func_append avoidlist
" $arg"
1328 --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)
1329 cond_dependencies
=true
1331 --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)
1332 cond_dependencies
=false
1338 arg
=`echo "X$1" | sed -e 's/^X--lgpl=//'`
1340 2 |
3orGPLv2 |
3) ;;
1341 *) func_fatal_error
"invalid LGPL version number for --lgpl" ;;
1350 if test $# = 0; then
1351 func_fatal_error
"missing argument for --makefile-name"
1356 makefile_name
=`echo "X$1" | sed -e 's/^X--makefile-name=//'`
1366 if test $# = 0; then
1367 func_fatal_error
"missing argument for --macro-prefix"
1372 macro_prefix
=`echo "X$1" | sed -e 's/^X--macro-prefix=//'`
1376 if test $# = 0; then
1377 func_fatal_error
"missing argument for --po-domain"
1382 po_domain
=`echo "X$1" | sed -e 's/^X--po-domain=//'`
1386 if test $# = 0; then
1387 func_fatal_error
"missing argument for --witness-c-macro"
1389 witness_c_macro
="$1"
1391 --witness-c-macro=* )
1392 witness_c_macro
=`echo "X$1" | sed -e 's/^X--witness-c-macro=//'`
1400 --no-changelog |
--no-changelo |
--no-changel |
--no-change |
--no-chang |
--no-chan |
--no-cha |
--no-ch )
1401 # A no-op for backward compatibility.
1406 -s |
--symbolic |
--symboli |
--symbol |
--symbo |
--symb |
--symlink |
--symlin |
--symli |
--syml |
--sym |
--sy )
1409 --local-symlink |
--local-symlin |
--local-symli |
--local-syml |
--local-sym |
--local-sy |
--local-s )
1412 -h |
--hardlink |
--hardlin |
--hardli |
--hardl |
--hard |
--har |
--ha )
1415 --local-hardlink |
--local-hardlin |
--local-hardli |
--local-hardl |
--local-hard |
--local-har |
--local-ha |
--local-h )
1418 -S |
--more-symlinks |
--more-symlink |
--more-symlin |
--more-symli |
--more-syml |
--more-sym |
--more-sy |
--more-s )
1422 -H |
--more-hardlinks |
--more-hardlink |
--more-hardlin |
--more-hardli |
--more-hardl |
--more-hard |
--more-har |
--more-ha |
--more-h )
1426 --help |
--hel |
--he )
1429 --version |
--versio |
--versi |
--vers )
1433 # Stop option processing
1437 echo "gnulib-tool: unknown option $1" 1>&2
1438 echo "Try 'gnulib-tool --help' for more information." 1>&2
1445 if case "$mode" in import | add-import | remove-import
) true
;; *) false
;; esac; then
1446 if test -n "$excl_cxx_tests" ||
test -n "$excl_longrunning_tests" \
1447 ||
test -n "$excl_privileged_tests" ||
test -n "$excl_unportable_tests" \
1448 ||
test "$single_configure" != false
; then
1449 echo "gnulib-tool: invalid options for '$mode' mode" 1>&2
1450 echo "Try 'gnulib-tool --help' for more information." 1>&2
1454 if test "$mode" = update
; then
1455 if test $# != 0; then
1456 echo "gnulib-tool: too many arguments in 'update' mode" 1>&2
1457 echo "Try 'gnulib-tool --help' for more information." 1>&2
1458 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1459 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1462 if test -n "$local_gnulib_path" ||
test -n "$supplied_libname" \
1463 ||
test -n "$sourcebase" ||
test -n "$m4base" ||
test -n "$pobase" \
1464 ||
test -n "$docbase" ||
test -n "$testsbase" ||
test -n "$auxdir" \
1465 ||
test -n "$inctests" ||
test -n "$incobsolete" \
1466 ||
test -n "$inc_cxx_tests" ||
test -n "$inc_longrunning_tests" \
1467 ||
test -n "$inc_privileged_tests" ||
test -n "$inc_unportable_tests" \
1468 ||
test -n "$inc_all_tests" \
1469 ||
test -n "$excl_cxx_tests" ||
test -n "$excl_longrunning_tests" \
1470 ||
test -n "$excl_privileged_tests" ||
test -n "$excl_unportable_tests" \
1471 ||
test -n "$avoidlist" ||
test -n "$lgpl" ||
test -n "$makefile_name" \
1472 ||
test -n "$macro_prefix" ||
test -n "$po_domain" \
1473 ||
test -n "$witness_c_macro" ||
test -n "$vc_files"; then
1474 echo "gnulib-tool: invalid options for 'update' mode" 1>&2
1475 echo "Try 'gnulib-tool --help' for more information." 1>&2
1476 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1477 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1481 if test -n "$pobase" && test -z "$po_domain"; then
1482 echo "gnulib-tool: together with --po-base, you need to specify --po-domain" 1>&2
1483 echo "Try 'gnulib-tool --help' for more information." 1>&2
1486 if test -z "$pobase" && test -n "$po_domain"; then
1487 func_warning
"--po-domain has no effect without a --po-base option"
1489 case $mode,$gnu_make in
1491 echo "gnulib-tool: --gnu-make not supported when including tests"
1494 # Canonicalize the inctests variable.
1496 import | add-import | remove-import | update
)
1497 if test -z "$inctests"; then
1501 create-testdir | create-megatestdir |
test | megatest
)
1502 if test -z "$inctests"; then
1507 # Now the only possible values of "$inctests" are true and false
1508 # (or blank but then it is irrelevant).
1510 # Determine the minimum supported autoconf version from the project's
1512 DEFAULT_AUTOCONF_MINVERSION
="2.63"
1513 autoconf_minversion
=
1515 if case "$mode" in import | add-import | remove-import | update
) true
;; *) false
;; esac \
1516 && test -n "$destdir"; then
1517 if test -f "$destdir"/configure.ac
; then
1518 configure_ac
="$destdir/configure.ac"
1520 if test -f "$destdir"/configure.
in; then
1521 configure_ac
="$destdir/configure.in"
1525 if test -f configure.ac
; then
1526 configure_ac
="configure.ac"
1528 if test -f configure.
in; then
1529 configure_ac
="configure.in"
1533 if test -n "$configure_ac"; then
1534 # Use sed, not autoconf --trace, to look for the AC_PREREQ invocation,
1535 # because when some m4 files are omitted from a version control repository,
1536 # "autoconf --trace=AC_PREREQ" fails with an error message like this:
1537 # m4: aclocal.m4:851: Cannot open m4/absolute-header.m4: No such file or directory
1538 # autom4te: m4 failed with exit status: 1
1545 s,^.*AC_PREREQ([[ ]*\([^])]*\).*$,\1,p
1547 prereqs
=`sed -n -e "$my_sed_traces" < "$configure_ac"`
1548 if test -n "$prereqs"; then
1549 autoconf_minversion
=`
1550 for version in $prereqs; do echo $version; done |
1551 LC_ALL=C sort -nru | sed -e 1q
1555 if test -z "$autoconf_minversion"; then
1556 autoconf_minversion
=$DEFAULT_AUTOCONF_MINVERSION
1558 case "$autoconf_minversion" in
1559 1.
* |
2.
[0-5]* |
2.6[0-2]*)
1560 func_fatal_error
"minimum supported autoconf version is 2.63. Try adding AC_PREREQ([$DEFAULT_AUTOCONF_MINVERSION]) to your configure.ac." ;;
1563 # Remove trailing slashes from the directory names. This is necessary for
1564 # m4base (to avoid an error in func_import) and optional for the others.
1565 sed_trimtrailingslashes
='s,\([^/]\)//*$,\1,'
1566 old_local_gnulib_path
="$local_gnulib_path"
1570 for dir
in $old_local_gnulib_path
1574 */ ) dir
=`echo "$dir" | sed -e "$sed_trimtrailingslashes"` ;;
1576 func_path_append local_gnulib_path
"$dir"
1579 case "$sourcebase" in
1580 */ ) sourcebase
=`echo "$sourcebase" | sed -e "$sed_trimtrailingslashes"` ;;
1583 */ ) m4base
=`echo "$m4base" | sed -e "$sed_trimtrailingslashes"` ;;
1586 */ ) pobase
=`echo "$pobase" | sed -e "$sed_trimtrailingslashes"` ;;
1589 */ ) docbase
=`echo "$docbase" | sed -e "$sed_trimtrailingslashes"` ;;
1591 case "$testsbase" in
1592 */ ) testsbase
=`echo "$testsbase" | sed -e "$sed_trimtrailingslashes"` ;;
1595 */ ) auxdir
=`echo "$auxdir" | sed -e "$sed_trimtrailingslashes"` ;;
1601 trap 'exit_status=$?
1602 if test "$signal" != 0; then
1603 echo "caught signal $signal" >&2
1606 exit $exit_status' 0
1607 for signal
in 1 2 3 13 15; do
1608 trap '{ signal='$signal'; func_exit 1; }' $signal
1612 # Note: The 'eval' silences stderr output in dash.
1613 if (declare -A x
&& { x
[f
/2]='foo'; x
[f
/3]='bar'; eval test '${x[f/2]}' = foo
; }) 2>/dev
/null
; then
1614 # Zsh 4 and Bash 4 have associative arrays.
1615 have_associative
=true
1617 # For other shells, use 'eval' with computed shell variable names.
1618 have_associative
=false
1621 # func_lookup_local_file_cb dir file
1622 # returns true and sets func_lookup_local_file_result if the file $dir/$file
1624 func_lookup_local_file_cb
()
1626 test -n "$func_lookup_local_file_result" && return 1 # already found?
1627 test -f "$1/$2" ||
return 1
1628 func_lookup_local_file_result
=$1/$2
1632 # func_lookup_local_file file
1633 # looks up a file in $local_gnulib_path.
1635 # - local_gnulib_path from --local-dir
1637 # - func_lookup_local_file_result name of the file, valid only when the
1638 # function succeeded.
1639 func_lookup_local_file
()
1641 func_lookup_local_file_result
=
1642 func_path_foreach
"$local_gnulib_path" func_lookup_local_file_cb
%dir
% "$1"
1645 # func_lookup_file_cb dir
1646 # does one step in processing the $local_gnulib_path, looking for $dir/$lkfile
1647 # and $dir/$lkfile.diff.
1648 func_lookup_file_cb
()
1650 # If we found the file already in a --local-dir of higher priority, nothing
1652 if test -z "$lookedup_file"; then
1653 # Otherwise, look for $dir/$lkfile and $dir/$lkfile.diff.
1654 if test -f "$1/$lkfile"; then
1655 lookedup_file
="$1/$lkfile"
1657 if test -f "$1/$lkfile.diff"; then
1658 lkpatches
="$1/$lkfile.diff${lkpatches:+$PATH_SEPARATOR$lkpatches}"
1664 # func_lookup_file file
1665 # looks up a file in $local_gnulib_path or $gnulib_dir, or combines it through
1668 # - local_gnulib_path from --local-dir
1670 # - lookedup_file name of the merged (combined) file
1671 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
1675 # Each element in $local_gnulib_path is a directory whose contents overrides
1676 # or amends the result of the lookup in the rest of $local_gnulib_path and
1677 # $gnulib_dir. So, the first element of $local_gnulib_path is the highest
1681 func_path_foreach
"$local_gnulib_path" func_lookup_file_cb
%dir
%
1682 # Treat $gnulib_dir like a lowest-priority --local-dir, except that here we
1683 # don't look for .diff files.
1684 if test -z "$lookedup_file"; then
1685 if test -f "$gnulib_dir/$lkfile"; then
1686 lookedup_file
="$gnulib_dir/$lkfile"
1688 func_fatal_error
"file $gnulib_dir/$lkfile not found"
1691 # Now apply the patches, from lowest-priority to highest-priority.
1693 if test -n "$lkpatches"; then
1694 lkbase
=`echo "$lkfile" | sed -e 's,^.*/,,'`
1695 rm -f "$tmp/$lkbase"
1696 cp "$lookedup_file" "$tmp/$lkbase"
1698 IFS
="$PATH_SEPARATOR"
1699 for patchfile
in $lkpatches; do
1701 patch -s "$tmp/$lkbase" < "$patchfile" >&2 \
1702 || func_fatal_error
"patch file $patchfile didn't apply cleanly"
1705 lookedup_file
="$tmp/$lkbase"
1710 # func_sanitize_modulelist
1711 # receives a list of possible module names on standard input, one per line.
1712 # It removes those which are just file names unrelated to modules, and outputs
1713 # the resulting list to standard output, one per line.
1714 func_sanitize_modulelist
()
1716 sed -e '/^ChangeLog$/d' -e '/\/ChangeLog$/d' \
1717 -e '/^COPYING$/d' -e '/\/COPYING$/d' \
1718 -e '/^README$/d' -e '/\/README$/d' \
1719 -e '/^TEMPLATE$/d' \
1720 -e '/^TEMPLATE-EXTENDED$/d' \
1721 -e '/^TEMPLATE-TESTS$/d' \
1727 # func_modules_in_dir dir
1728 # outputs all module files in dir to standard output.
1729 func_modules_in_dir
()
1731 (test -d "$1" && cd "$1" && find modules
-type f
-print)
1736 # - local_gnulib_path from --local-dir
1739 # Filter out metainformation files like README, which are not modules.
1740 # Filter out unit test modules; they can be retrieved through
1741 # --extract-tests-module if desired.
1743 (cd "$gnulib_dir" && find modules
-type f
-print |
sed -e 's,^modules/,,')
1744 func_path_foreach
"$local_gnulib_path" func_modules_in_dir
%dir
% |
sed -e 's,^modules/,,' -e 's,\.diff$,,'
1746 | func_sanitize_modulelist \
1747 |
sed -e '/-tests$/d' \
1751 # func_exists_local_module dir module
1752 # returns true if module exists in dir
1753 func_exists_local_module
()
1755 test -d "$1/modules" && test -f "$1/modules/$2";
1758 # func_exists_module module
1759 # tests whether a module, given by name, exists
1761 # - local_gnulib_path from --local-dir
1762 func_exists_module
()
1764 { test -f "$gnulib_dir/modules/$1" \
1765 || func_path_foreach
"$local_gnulib_path" func_exists_local_module
%dir
% "$1" ; } \
1766 && test "ChangeLog" != "$1" \
1767 && test "COPYING" != "$1" \
1768 && test "README" != "$1" \
1769 && test "TEMPLATE" != "$1" \
1770 && test "TEMPLATE-EXTENDED" != "$1" \
1771 && test "TEMPLATE-TESTS" != "$1"
1774 # func_verify_module
1775 # verifies a module name
1777 # - local_gnulib_path from --local-dir
1778 # - module module name argument
1780 # - module unchanged if OK, empty if not OK
1781 # - lookedup_file if OK: name of the merged (combined) module description file
1782 # - lookedup_tmp if OK: true if it is located in the tmp directory, blank otherwise
1783 func_verify_module
()
1785 if func_exists_module
"$module"; then
1786 # OK, $module is a correct module name.
1787 # Verify that building the module description with 'patch' succeeds.
1788 func_lookup_file
"modules/$module"
1790 func_warning
"module $module doesn't exist"
1795 # func_verify_nontests_module
1796 # verifies a module name, excluding tests modules
1798 # - local_gnulib_path from --local-dir
1799 # - module module name argument
1800 func_verify_nontests_module
()
1803 *-tests ) module
= ;;
1804 * ) func_verify_module
;;
1808 # func_verify_tests_module
1809 # verifies a module name, considering only tests modules
1811 # - local_gnulib_path from --local-dir
1812 # - module module name argument
1813 func_verify_tests_module
()
1816 *-tests ) func_verify_module
;;
1821 # Suffix of a sed expression that extracts a particular field from a
1822 # module description.
1823 # A field starts with a line that contains a keyword, such as 'Description',
1824 # followed by a colon and optional whitespace. All following lines, up to
1825 # the next field (or end of file if there is none) form the contents of the
1827 # An absent field is equivalent to a field with empty contents.
1828 # NOTE: Keep this in sync with sed_extract_cache_prog below!
1829 sed_extract_prog
=':[ ]*$/ {
1832 s/^Description:[ ]*$//
1836 s/^Applicability:[ ]*$//
1838 s/^Depends-on:[ ]*$//
1839 s/^configure\.ac-early:[ ]*$//
1840 s/^configure\.ac:[ ]*$//
1841 s/^Makefile\.am:[ ]*$//
1845 s/^Maintainer:[ ]*$//
1852 # Piece of a sed expression that converts a field header line to a shell
1854 # NOTE: Keep this in sync with sed_extract_prog above!
1855 sed_extract_field_header
='
1856 s/^Description:[ ]*$/description/
1857 s/^Comment:[ ]*$/comment/
1858 s/^Status:[ ]*$/status/
1859 s/^Notice:[ ]*$/notice/
1860 s/^Applicability:[ ]*$/applicability/
1861 s/^Files:[ ]*$/files/
1862 s/^Depends-on:[ ]*$/dependson/
1863 s/^configure\.ac-early:[ ]*$/configureac_early/
1864 s/^configure\.ac:[ ]*$/configureac/
1865 s/^Makefile\.am:[ ]*$/makefile/
1866 s/^Include:[ ]*$/include/
1868 s/^License:[ ]*$/license/
1869 s/^Maintainer:[ ]*$/maintainer/'
1873 if $have_associative; then
1875 # Declare the associative arrays.
1876 declare -A modcache_cached
1877 sed_to_declare_statement
='s|^.*/\([a-zA-Z0-9_]*\)/$|declare -A modcache_\1|p'
1878 declare_script
=`echo "$sed_extract_field_header" | sed -n -e "$sed_to_declare_statement"`
1879 eval "$declare_script"
1883 # func_cache_var module
1884 # computes the cache variable name corresponding to $module.
1885 # Note: This computation can map different module names to the same
1886 # cachevar (such as 'foo-bar', 'foo_bar', or 'foo/bar'); the caller has
1887 # to protect against this case.
1889 # - cachevar a shell variable name
1890 if (f
=foo
; eval echo '${f//o/e}') < /dev
/null
2>/dev
/null |
grep fee
>/dev
/null
; then
1891 # Bash 2.0 and newer, ksh, and zsh support the syntax
1892 # ${param//pattern/replacement}
1893 # as a shorthand for
1894 # `echo "$param" | sed -e "s/pattern/replacement/g"`.
1895 # Note: The 'eval' is necessary for dash and NetBSD /bin/sh.
1896 eval 'func_cache_var ()
1898 cachevar=c_${1//[!a-zA-Z0-9_]/_}
1905 cachevar
=c_
`echo "$1" | LC_ALL=C sed -e 's/[^a-zA-Z0-9_]/_/g'` ;;
1914 # func_init_sed_convert_to_cache_statements
1916 # - modcachevar_assignment
1918 # - sed_convert_to_cache_statements
1919 func_init_sed_convert_to_cache_statements
()
1921 # 'sed' script that turns a module description into shell script
1922 # assignments, suitable to be eval'ed. All active characters are escaped.
1925 # Some module's description
1930 # modcache_description[$1]=\
1931 # 'Some module'"'"'s description
1933 # modcache_files[$1]=\
1936 # c_MODULE_description_set=set; c_MODULE_description=\
1937 # 'Some module'"'"'s description
1939 # c_MODULE_files_set=set; c_MODULE_files=\
1941 # The script consists of two parts:
1942 # 1) Ignore the lines before the first field header.
1943 # 2) A loop, treating non-field-header lines by escaping single quotes
1944 # and adding a closing quote in the last line,
1945 sed_convert_to_cache_statements
="
1947 # Here we have not yet seen a field header.
1949 # See if the current line contains a field header.
1952 ${sed_extract_field_header}
1955 # No field header. Ignore the line.
1957 # Read the next line. Upon EOF, just exit.
1962 # The current line contains a field header.
1964 # Turn it into the beginning of an assignment.
1965 s/^\\(.*\\)\$/${modcachevar_assignment}\\\\/
1967 # Move it to the hold space. Don't print it yet,
1968 # because we want no assignment if the field is empty.
1971 # Read the next line.
1972 # Upon EOF, the field was empty. Print no assignment. Just exit.
1975 # See if the current line contains a field header.
1978 ${sed_extract_field_header}
1979 # If it is, the previous field was empty. Print no assignment.
1982 # Not a field header.
1984 # Print the previous line, held in the hold space.
1989 # Transform single quotes.
1992 # Prepend a single quote.
1997 # Move it to the hold space.
2000 # Read the next line.
2007 # See if the current line contains a field header.
2010 ${sed_extract_field_header}
2013 # Print the previous line, held in the hold space.
2018 # Transform single quotes.
2025 # Print the previous line, held in the hold space, with a single quote
2026 # to end the assignment.
2036 # Print the previous line, held in the hold space, with a single quote
2037 # to end the assignment.
2044 if ! $sed_comments; then
2046 sed_convert_to_cache_statements
=`echo "$sed_convert_to_cache_statements" \
2047 | sed -e 's/^ *//' -e 's/^#.*//'`
2051 if $have_associative; then
2052 # sed_convert_to_cache_statements does not depend on the module.
2053 modcachevar_assignment
='modcache_\1[$1]='
2054 func_init_sed_convert_to_cache_statements
2057 # func_cache_lookup_module module
2059 # looks up a module, like 'func_lookup_file modules/$module', and stores all
2060 # of its relevant data in a cache in the memory of the processing shell. If
2061 # already cached, it does not look it up again, thus saving file access time.
2063 # - module non-empty string
2064 # Output if $have_associative:
2065 # - modcache_cached[$module] set to yes
2066 # - modcache_description[$module] ==
2067 # - modcache_status[$module] \ set to the field's value, minus the
2068 # - ... / final newline,
2069 # - modcache_maintainer[$module] == or unset if the field's value is empty
2070 # Output if ! $have_associative:
2071 # - cachevar a shell variable name
2072 # - ${cachevar}_cached set to $module
2073 # - ${cachevar}_description ==
2074 # - ${cachevar}_status \ set to the field's value, minus the
2075 # - ... / final newline,
2076 # - ${cachevar}_maintainer == or unset if the field's value is empty
2077 # - ${cachevar}_description_set ==
2078 # - ${cachevar}_status_set \ set to non-empty if the field's value
2079 # - ... / is non-empty,
2080 # - ${cachevar}_maintainer_set == or unset if the field's value is empty
2081 func_cache_lookup_module
()
2083 if $have_associative; then
2084 eval 'cached=${modcache_cached[$1]}'
2087 eval "cached=\"\$${cachevar}_cached\""
2089 if test -z "$cached"; then
2090 # Not found in cache. Look it up on the file system.
2091 func_lookup_file
"modules/$1"
2092 if $have_associative; then
2093 eval 'modcache_cached[$1]=yes'
2095 eval "${cachevar}_cached=\"\$1\""
2097 if ! $have_associative; then
2098 # sed_convert_to_cache_statements depends on the module.
2099 modcachevar_assignment
="${cachevar}"'_\1_set=set; '"${cachevar}"'_\1='
2100 func_init_sed_convert_to_cache_statements
2102 cache_statements
=`LC_ALL=C sed -n -e "$sed_convert_to_cache_statements" < "$lookedup_file"`
2103 eval "$cache_statements"
2105 if ! $have_associative; then
2106 if test "$1" != "$cached"; then
2107 func_fatal_error
"cache variable collision between $1 and $cached"
2115 # func_get_description module
2117 # - local_gnulib_path from --local-dir
2118 # - modcache true or false, from --cache-modules/--no-cache-modules
2119 func_get_description
()
2121 if ! $modcache; then
2122 func_lookup_file
"modules/$1"
2123 sed -n -e "/^Description$sed_extract_prog" < "$lookedup_file"
2125 func_cache_lookup_module
"$1"
2126 # Output the field's value, including the final newline (if any).
2127 if $have_associative; then
2128 if eval 'test -n "${modcache_description[$1]+set}"'; then
2129 eval 'echo "${modcache_description[$1]}"'
2132 eval "field_set=\"\$${cachevar}_description_set\""
2133 if test -n "$field_set"; then
2134 eval "field_value=\"\$${cachevar}_description\""
2135 echo "${field_value}"
2141 # func_get_comment module
2143 # - local_gnulib_path from --local-dir
2144 # - modcache true or false, from --cache-modules/--no-cache-modules
2147 if ! $modcache; then
2148 func_lookup_file
"modules/$1"
2149 sed -n -e "/^Comment$sed_extract_prog" < "$lookedup_file"
2151 func_cache_lookup_module
"$1"
2152 # Output the field's value, including the final newline (if any).
2153 if $have_associative; then
2154 if eval 'test -n "${modcache_comment[$1]+set}"'; then
2155 eval 'echo "${modcache_comment[$1]}"'
2158 eval "field_set=\"\$${cachevar}_comment_set\""
2159 if test -n "$field_set"; then
2160 eval "field_value=\"\$${cachevar}_comment\""
2161 echo "${field_value}"
2167 # func_get_status module
2169 # - local_gnulib_path from --local-dir
2170 # - modcache true or false, from --cache-modules/--no-cache-modules
2173 if ! $modcache; then
2174 func_lookup_file
"modules/$1"
2175 sed -n -e "/^Status$sed_extract_prog" < "$lookedup_file"
2177 func_cache_lookup_module
"$1"
2178 # Output the field's value, including the final newline (if any).
2179 if $have_associative; then
2180 if eval 'test -n "${modcache_status[$1]+set}"'; then
2181 eval 'echo "${modcache_status[$1]}"'
2184 eval "field_set=\"\$${cachevar}_status_set\""
2185 if test -n "$field_set"; then
2186 eval "field_value=\"\$${cachevar}_status\""
2187 echo "${field_value}"
2193 # func_get_notice module
2195 # - local_gnulib_path from --local-dir
2196 # - modcache true or false, from --cache-modules/--no-cache-modules
2199 if ! $modcache; then
2200 func_lookup_file
"modules/$1"
2201 sed -n -e "/^Notice$sed_extract_prog" < "$lookedup_file"
2203 func_cache_lookup_module
"$1"
2204 # Output the field's value, including the final newline (if any).
2205 if $have_associative; then
2206 if eval 'test -n "${modcache_notice[$1]+set}"'; then
2207 eval 'echo "${modcache_notice[$1]}"'
2210 eval "field_set=\"\$${cachevar}_notice_set\""
2211 if test -n "$field_set"; then
2212 eval "field_value=\"\$${cachevar}_notice\""
2213 echo "${field_value}"
2219 # func_get_applicability module
2221 # - local_gnulib_path from --local-dir
2222 # - modcache true or false, from --cache-modules/--no-cache-modules
2223 # The expected result (on stdout) is either 'main', or 'tests', or 'all'.
2224 func_get_applicability
()
2226 if ! $modcache; then
2227 func_lookup_file
"modules/$1"
2228 my_applicability
=`sed -n -e "/^Applicability$sed_extract_prog" < "$lookedup_file"`
2230 func_cache_lookup_module
"$1"
2231 # Get the field's value, without the final newline.
2232 if $have_associative; then
2233 eval 'my_applicability="${modcache_applicability[$1]}"'
2235 eval "my_applicability=\"\$${cachevar}_applicability\""
2238 if test -n "$my_applicability"; then
2239 echo $my_applicability
2241 # The default is 'main' or 'tests', depending on the module's name.
2243 *-tests) echo "tests";;
2249 # func_get_filelist module
2251 # - local_gnulib_path from --local-dir
2252 # - modcache true or false, from --cache-modules/--no-cache-modules
2253 func_get_filelist
()
2255 if ! $modcache; then
2256 func_lookup_file
"modules/$1"
2257 sed -n -e "/^Files$sed_extract_prog" < "$lookedup_file"
2259 func_cache_lookup_module
"$1"
2260 # Output the field's value, including the final newline (if any).
2261 if $have_associative; then
2262 if eval 'test -n "${modcache_files[$1]+set}"'; then
2263 eval 'echo "${modcache_files[$1]}"'
2266 eval "field_set=\"\$${cachevar}_files_set\""
2267 if test -n "$field_set"; then
2268 eval "field_value=\"\$${cachevar}_files\""
2269 echo "${field_value}"
2274 echo m
4/gnulib-common.
m4
2277 # func_filter_filelist outputvar separator filelist prefix suffix removed_prefix removed_suffix [added_prefix [added_suffix]]
2278 # stores in outputvar the filtered and processed filelist. Filtering: Only the
2279 # elements starting with prefix and ending with suffix are considered.
2280 # Processing: removed_prefix and removed_suffix are removed from each element,
2281 # added_prefix and added_suffix are added to each element.
2282 # prefix, suffix should not contain shell-special characters.
2283 # removed_prefix, removed_suffix should not contain the characters "$`\{}[]^|.
2284 # added_prefix, added_suffix should not contain the characters \|&.
2285 func_filter_filelist
()
2287 if test "$2" != "$nl" \
2288 ||
{ $fast_func_append \
2289 && { test -z "$6" ||
$fast_func_remove_prefix; } \
2290 && { test -z "$7" ||
$fast_func_remove_suffix; }; \
2294 # Do not quote possibly-empty parameters in case patterns,
2295 # AIX and HP-UX ksh won't match them if they are empty.
2298 if test -n "$6"; then
2299 func_remove_prefix fff
"$6"
2301 if test -n "$7"; then
2302 func_remove_suffix fff
"$7"
2305 if test -z "$ffflist"; then
2308 func_append ffflist
"$2${fff}"
2314 sed_fff_filter
="s|^$6\(.*\)$7\$|$8\\1$9|"
2315 ffflist
=`for fff in $3; do
2317 $4*$5) echo "$fff" ;;
2319 done | sed -e "$sed_fff_filter"`
2321 eval "$1=\"\$ffflist\""
2324 # func_get_dependencies module
2326 # - local_gnulib_path from --local-dir
2327 # - modcache true or false, from --cache-modules/--no-cache-modules
2328 func_get_dependencies
()
2330 # ${module}-tests implicitly depends on ${module}, if that module exists.
2334 func_remove_suffix fgd1
'-tests'
2335 if func_exists_module
"$fgd1"; then
2340 # Then the explicit dependencies listed in the module description.
2341 { if ! $modcache; then
2342 func_lookup_file
"modules/$1"
2343 sed -n -e "/^Depends-on$sed_extract_prog" < "$lookedup_file"
2345 func_cache_lookup_module
"$1"
2346 # Output the field's value, including the final newline (if any).
2347 if $have_associative; then
2348 if eval 'test -n "${modcache_dependson[$1]+set}"'; then
2349 eval 'echo "${modcache_dependson[$1]}"'
2352 eval "field_set=\"\$${cachevar}_dependson_set\""
2353 if test -n "$field_set"; then
2354 eval "field_value=\"\$${cachevar}_dependson\""
2355 echo "${field_value}"
2363 sed_dependencies_without_conditions
='s/ *\[.*//'
2365 # func_get_autoconf_early_snippet module
2367 # - local_gnulib_path from --local-dir
2368 # - modcache true or false, from --cache-modules/--no-cache-modules
2369 func_get_autoconf_early_snippet
()
2371 if ! $modcache; then
2372 func_lookup_file
"modules/$1"
2373 sed -n -e "/^configure\.ac-early$sed_extract_prog" < "$lookedup_file"
2375 func_cache_lookup_module
"$1"
2376 # Output the field's value, including the final newline (if any).
2377 if $have_associative; then
2378 if eval 'test -n "${modcache_configureac_early[$1]+set}"'; then
2379 eval 'echo "${modcache_configureac_early[$1]}"'
2382 eval "field_set=\"\$${cachevar}_configureac_early_set\""
2383 if test -n "$field_set"; then
2384 eval "field_value=\"\$${cachevar}_configureac_early\""
2385 echo "${field_value}"
2391 # func_get_autoconf_snippet module
2393 # - local_gnulib_path from --local-dir
2394 # - modcache true or false, from --cache-modules/--no-cache-modules
2395 func_get_autoconf_snippet
()
2397 if ! $modcache; then
2398 func_lookup_file
"modules/$1"
2399 sed -n -e "/^configure\.ac$sed_extract_prog" < "$lookedup_file"
2401 func_cache_lookup_module
"$1"
2402 # Output the field's value, including the final newline (if any).
2403 if $have_associative; then
2404 if eval 'test -n "${modcache_configureac[$1]+set}"'; then
2405 eval 'echo "${modcache_configureac[$1]}"'
2408 eval "field_set=\"\$${cachevar}_configureac_set\""
2409 if test -n "$field_set"; then
2410 eval "field_value=\"\$${cachevar}_configureac\""
2411 echo "${field_value}"
2417 # Concatenate lines with trailing slash.
2418 # $1 is an optional filter to restrict the
2419 # concatenation to groups starting with that expression
2421 sed -e "/$1.*"'\\$/{
2430 # func_get_automake_snippet_conditional module
2431 # returns the part of the Makefile.am snippet that can be put inside Automake
2434 # - local_gnulib_path from --local-dir
2435 # - modcache true or false, from --cache-modules/--no-cache-modules
2436 func_get_automake_snippet_conditional
()
2438 if ! $modcache; then
2439 func_lookup_file
"modules/$1"
2440 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
2442 func_cache_lookup_module
"$1"
2443 # Output the field's value, including the final newline (if any).
2444 if $have_associative; then
2445 if eval 'test -n "${modcache_makefile[$1]+set}"'; then
2446 eval 'echo "${modcache_makefile[$1]}"'
2449 eval "field_set=\"\$${cachevar}_makefile_set\""
2450 if test -n "$field_set"; then
2451 eval "field_value=\"\$${cachevar}_makefile\""
2452 echo "${field_value}"
2458 # func_get_automake_snippet_unconditional module
2459 # returns the part of the Makefile.am snippet that must stay outside of
2460 # Automake conditionals.
2462 # - local_gnulib_path from --local-dir
2463 # - modcache true or false, from --cache-modules/--no-cache-modules
2464 func_get_automake_snippet_unconditional
()
2468 # *-tests module live in tests/, not lib/.
2469 # Synthesize an EXTRA_DIST augmentation.
2470 all_files
=`func_get_filelist $1`
2471 func_filter_filelist tests_files
" " "$all_files" 'tests/' '' 'tests/' ''
2472 extra_files
="$tests_files"
2473 if test -n "$extra_files"; then
2474 echo "EXTRA_DIST +=" $extra_files
2479 # Synthesize an EXTRA_DIST augmentation.
2480 sed_extract_mentioned_files
='s/^lib_SOURCES[ ]*+=[ ]*//p'
2481 already_mentioned_files
=` \
2482 { if ! $modcache; then
2483 func_lookup_file "modules/$1"
2484 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
2486 func_cache_lookup_module "$1"
2487 if $have_associative; then
2488 if eval 'test -n "${modcache_makefile[$1]+set}"'; then
2489 eval 'echo "${modcache_makefile[$1]}"'
2492 eval 'field_set="$'"${cachevar}"'_makefile_set"'
2493 if test -n "$field_set"; then
2494 eval 'field_value="$'"${cachevar}"'_makefile"'
2495 echo "${field_value}"
2501 | sed -n -e "$sed_extract_mentioned_files" | sed -e 's/#.*//'`
2502 all_files
=`func_get_filelist $1`
2503 func_filter_filelist lib_files
"$nl" "$all_files" 'lib/' '' 'lib/' ''
2504 # Remove $already_mentioned_files from $lib_files.
2505 echo "$lib_files" | LC_ALL
=C
sort -u > "$tmp"/lib-files
2506 extra_files
=`for f in $already_mentioned_files; do echo $f; done \
2507 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/lib-files`
2508 if test -n "$extra_files"; then
2509 echo "EXTRA_DIST +=" $extra_files
2512 # Synthesize also an EXTRA_lib_SOURCES augmentation.
2513 # This is necessary so that automake can generate the right list of
2515 # A possible approach would be to use autom4te --trace of the redefined
2516 # AC_LIBOBJ and AC_REPLACE_FUNCS macros when creating the Makefile.am
2517 # (use autom4te --trace, not just grep, so that AC_LIBOBJ invocations
2518 # inside autoconf's built-in macros are not missed).
2519 # But it's simpler and more robust to do it here, based on the file list.
2520 # If some .c file exists and is not used with AC_LIBOBJ - for example,
2521 # a .c file is preprocessed into another .c file for BUILT_SOURCES -,
2522 # automake will generate a useless dependency; this is harmless.
2524 relocatable-prog-wrapper
) ;;
2527 func_filter_filelist extra_files
"$nl" "$extra_files" '' '.c' '' ''
2528 if test -n "$extra_files"; then
2529 echo "EXTRA_lib_SOURCES +=" $extra_files
2534 # Synthesize an EXTRA_DIST augmentation also for the files in build-aux/.
2535 func_filter_filelist buildaux_files
"$nl" "$all_files" 'build-aux/' '' 'build-aux/' ''
2536 if test -n "$buildaux_files"; then
2537 sed_prepend_auxdir
='s,^,$(top_srcdir)/'"$auxdir"'/,'
2538 echo "EXTRA_DIST += "`echo "$buildaux_files" | sed -e "$sed_prepend_auxdir"`
2545 # func_get_automake_snippet module
2547 # - local_gnulib_path from --local-dir
2548 # - modcache true or false, from --cache-modules/--no-cache-modules
2549 func_get_automake_snippet
()
2551 func_get_automake_snippet_conditional
"$1"
2552 func_get_automake_snippet_unconditional
"$1"
2555 # func_get_include_directive module
2557 # - local_gnulib_path from --local-dir
2558 # - modcache true or false, from --cache-modules/--no-cache-modules
2559 func_get_include_directive
()
2562 if ! $modcache; then
2563 func_lookup_file
"modules/$1"
2564 sed -n -e "/^Include$sed_extract_prog" < "$lookedup_file"
2566 func_cache_lookup_module
"$1"
2567 # Output the field's value, including the final newline (if any).
2568 if $have_associative; then
2569 if eval 'test -n "${modcache_include[$1]+set}"'; then
2570 eval 'echo "${modcache_include[$1]}"'
2573 eval "field_set=\"\$${cachevar}_include_set\""
2574 if test -n "$field_set"; then
2575 eval "field_value=\"\$${cachevar}_include\""
2576 echo "${field_value}"
2580 } |
sed -e 's/^\(["<]\)/#include \1/'
2583 # func_get_link_directive module
2585 # - local_gnulib_path from --local-dir
2586 # - modcache true or false, from --cache-modules/--no-cache-modules
2587 func_get_link_directive
()
2589 if ! $modcache; then
2590 func_lookup_file
"modules/$1"
2591 sed -n -e "/^Link$sed_extract_prog" < "$lookedup_file"
2593 func_cache_lookup_module
"$1"
2594 # Output the field's value, including the final newline (if any).
2595 if $have_associative; then
2596 if eval 'test -n "${modcache_link[$1]+set}"'; then
2597 eval 'echo "${modcache_link[$1]}"'
2600 eval "field_set=\"\$${cachevar}_link_set\""
2601 if test -n "$field_set"; then
2602 eval "field_value=\"\$${cachevar}_link\""
2603 echo "${field_value}"
2609 # func_get_license_raw module
2611 # - local_gnulib_path from --local-dir
2612 # - modcache true or false, from --cache-modules/--no-cache-modules
2613 func_get_license_raw
()
2615 if ! $modcache; then
2616 func_lookup_file
"modules/$1"
2617 sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
2619 func_cache_lookup_module
"$1"
2620 # Output the field's value, including the final newline (if any).
2621 if $have_associative; then
2622 if eval 'test -n "${modcache_license[$1]+set}"'; then
2623 eval 'echo "${modcache_license[$1]}"'
2626 eval "field_set=\"\$${cachevar}_license_set\""
2627 if test -n "$field_set"; then
2628 eval "field_value=\"\$${cachevar}_license\""
2629 echo "${field_value}"
2635 # func_get_license module
2637 # - local_gnulib_path from --local-dir
2638 # - modcache true or false, from --cache-modules/--no-cache-modules
2641 # Warn if the License field is missing.
2645 license
=`func_get_license_raw "$1"`
2646 if test -z "$license"; then
2647 func_warning
"module $1 lacks a License"
2653 # These modules are under a weaker license only for the purpose of some
2654 # users who hand-edit it and don't use gnulib-tool. For the regular
2655 # gnulib users they are under a stricter license.
2660 func_get_license_raw
"$1"
2661 # The default is GPL.
2663 } |
sed -e 's,^ *$,,' |
sed -e 1q
2668 # func_get_maintainer module
2670 # - local_gnulib_path from --local-dir
2671 # - modcache true or false, from --cache-modules/--no-cache-modules
2672 func_get_maintainer
()
2674 if ! $modcache; then
2675 func_lookup_file
"modules/$1"
2676 sed -n -e "/^Maintainer$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_maintainer[$1]+set}"'; then
2682 eval 'echo "${modcache_maintainer[$1]}"'
2685 eval "field_set=\"\$${cachevar}_maintainer_set\""
2686 if test -n "$field_set"; then
2687 eval "field_value=\"\$${cachevar}_maintainer\""
2688 echo "${field_value}"
2694 # func_get_tests_module module
2696 # - local_gnulib_path from --local-dir
2697 func_get_tests_module
()
2699 # The naming convention for tests modules is hardwired: ${module}-tests.
2700 if test -f "$gnulib_dir/modules/$1"-tests \
2701 || func_path_foreach
"$local_gnulib_path" func_exists_local_module
%dir
% "$1-tests"; then
2706 # func_get_dependencies_recursively module
2708 # - local_gnulib_path from --local-dir
2709 # - modcache true or false, from --cache-modules/--no-cache-modules
2710 func_get_dependencies_recursively
()
2712 # In order to process every module only once (for speed), process an "input
2713 # list" of modules, producing an "output list" of modules. During each round,
2714 # more modules can be queued in the input list. Once a module on the input
2715 # list has been processed, it is added to the "handled list", so we can avoid
2716 # to process it again.
2720 while test -n "$inmodules"; do
2721 inmodules_this_round
="$inmodules"
2722 inmodules
= # Accumulator, queue for next round
2723 for module
in $inmodules_this_round; do
2725 if test -n "$module"; then
2726 func_append outmodules
" $module"
2727 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
2728 for dep
in $deps; do
2729 func_append inmodules
" $dep"
2733 handledmodules
=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
2734 # Remove $handledmodules from $inmodules.
2735 for m
in $inmodules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/queued-modules
2736 inmodules
=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
2738 rm -f "$tmp"/queued-modules
2739 for m
in $outmodules; do echo $m; done | LC_ALL
=C
sort -u
2742 # func_get_link_directive_recursively module
2744 # - local_gnulib_path from --local-dir
2745 # - modcache true or false, from --cache-modules/--no-cache-modules
2746 func_get_link_directive_recursively
()
2748 # In order to process every module only once (for speed), process an "input
2749 # list" of modules, producing an "output list" of modules. During each round,
2750 # more modules can be queued in the input list. Once a module on the input
2751 # list has been processed, it is added to the "handled list", so we can avoid
2752 # to process it again.
2756 while test -n "$inmodules"; do
2757 inmodules_this_round
="$inmodules"
2758 inmodules
= # Accumulator, queue for next round
2759 for module
in $inmodules_this_round; do
2761 if test -n "$module"; then
2762 if grep '^Link:[ ]*$' "$lookedup_file" >/dev
/null
; then
2763 # The module description has a 'Link:' field. Ignore the dependencies.
2764 func_append outmodules
" $module"
2766 # The module description has no 'Link:' field. Recurse through the dependencies.
2767 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
2768 for dep
in $deps; do
2769 func_append inmodules
" $dep"
2774 handledmodules
=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
2775 # Remove $handledmodules from $inmodules.
2776 for m
in $inmodules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/queued-modules
2777 inmodules
=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
2779 rm -f "$tmp"/queued-modules
2780 for m
in $outmodules; do func_get_link_directive
"$m"; done | LC_ALL
=C
sort -u |
sed -e '/^$/d'
2783 # func_acceptable module
2784 # tests whether a module is acceptable.
2786 # - avoidlist list of modules to avoid
2789 for avoid
in $avoidlist; do
2790 if test "$avoid" = "$1"; then
2797 # sed expression to keep the first 32 characters of each line.
2798 sed_first_32_chars
='s/^\(................................\).*/\1/'
2800 # func_module_shellfunc_name module
2801 # computes the shell function name that will contain the m4 macros for the module.
2803 # - macro_prefix prefix to use
2805 # - shellfunc shell function name
2806 func_module_shellfunc_name
()
2810 shellfunc
=func_
${macro_prefix}_gnulib_m4code_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2812 shellfunc
=func_
${macro_prefix}_gnulib_m4code_
$1 ;;
2816 # func_module_shellvar_name module
2817 # computes the shell variable name the will be set to true once the m4 macros
2818 # for the module have been executed.
2820 # - shellvar shell variable name
2821 func_module_shellvar_name
()
2825 shellvar
=${macro_prefix}_gnulib_enabled_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2827 shellvar
=${macro_prefix}_gnulib_enabled_
$1 ;;
2831 # func_module_conditional_name module
2832 # computes the automake conditional name for the module.
2834 # - conditional name of automake conditional
2835 func_module_conditional_name
()
2839 conditional
=${macro_prefix}_GNULIB_ENABLED_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2841 conditional
=${macro_prefix}_GNULIB_ENABLED_
$1 ;;
2845 # func_uncond_add_module B
2846 # notes the presence of B as an unconditional module.
2848 # func_conddep_add_module A B cond
2849 # notes the presence of a conditional dependency from module A to module B,
2850 # subject to the condition that A is enabled and cond is true.
2852 # func_cond_module_p B
2853 # tests whether module B is conditional.
2855 # func_cond_module_condition A B
2856 # returns the condition when B should be enabled as a dependency of A, once the
2857 # m4 code for A has been executed.
2858 # Output: - condition
2860 if $have_associative; then
2861 declare -A conddep_isuncond
2862 declare -A conddep_dependers
2863 declare -A conddep_condition
2864 func_uncond_add_module
()
2866 eval 'conddep_isuncond[$1]=true'
2867 eval 'unset conddep_dependers[$1]'
2869 func_conddep_add_module
()
2871 eval 'isuncond="${conddep_isuncond[$2]}"'
2872 if test -z "$isuncond"; then
2873 # No unconditional dependency to B known at this point.
2874 eval 'conddep_dependers[$2]="${conddep_dependers[$2]} $1"'
2875 eval 'conddep_condition[$1---$2]="$3"'
2878 func_cond_module_p
()
2880 eval 'previous_dependers="${conddep_dependers[$1]}"'
2881 test -n "$previous_dependers"
2883 func_cond_module_condition
()
2885 eval 'condition="${conddep_condition[$1---$2]}"'
2888 func_uncond_add_module
()
2892 suffix
=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2896 eval 'conddep_isuncond_'"$suffix"'=true'
2897 eval 'unset conddep_dependers_'"$suffix"
2899 func_conddep_add_module
()
2903 suffix
=`echo "$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2907 eval 'isuncond="${conddep_isuncond_'"$suffix"'}"'
2908 if test -z "$isuncond"; then
2909 eval 'conddep_dependers_'"$suffix"'="${conddep_dependers_'"$suffix"'} $1"'
2910 suffix
=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
2911 eval 'conddep_condition_'"$suffix"'="$3"'
2914 func_cond_module_p
()
2918 suffix
=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2922 eval 'previous_dependers="${conddep_dependers_'"$suffix"'}"'
2923 test -n "$previous_dependers"
2925 func_cond_module_condition
()
2927 suffix
=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
2928 eval 'condition="${conddep_condition_'"$suffix"'}"'
2932 # func_modules_transitive_closure
2934 # - local_gnulib_path from --local-dir
2935 # - gnu_make true if --gnu-make was given, false otherwise
2936 # - modcache true or false, from --cache-modules/--no-cache-modules
2937 # - modules list of specified modules
2938 # - inctests true if tests should be included, false otherwise
2939 # - incobsolete true if obsolete modules among dependencies should be
2940 # included, blank otherwise
2941 # - inc_cxx_tests true if C++ interoperability tests should be included,
2943 # - inc_longrunning_tests true if long-runnings tests should be included,
2945 # - inc_privileged_tests true if tests that require root privileges should be
2946 # included, blank otherwise
2947 # - inc_unportable_tests true if tests that fail on some platforms should be
2948 # included, blank otherwise
2949 # - inc_all_direct_tests true if all kinds of problematic unit tests among
2950 # the unit tests of the specified modules should be
2951 # included, blank otherwise
2952 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
2953 # the unit tests of the dependencies should be
2954 # included, blank otherwise
2955 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
2957 # - excl_longrunning_tests true if long-runnings tests should be excluded,
2959 # - excl_privileged_tests true if tests that require root privileges should be
2960 # excluded, blank otherwise
2961 # - excl_unportable_tests true if tests that fail on some platforms should be
2962 # excluded, blank otherwise
2963 # - avoidlist list of modules to avoid
2964 # - cond_dependencies true if conditional dependencies shall be supported,
2966 # - tmp pathname of a temporary directory
2968 # - modules list of modules, including dependencies
2969 # - conddep_dependers, conddep_condition information about conditionally
2971 func_modules_transitive_closure
()
2973 sed_escape_dependency
='s|\([/.]\)|\\\1|g'
2974 # In order to process every module only once (for speed), process an "input
2975 # list" of modules, producing an "output list" of modules. During each round,
2976 # more modules can be queued in the input list. Once a module on the input
2977 # list has been processed, it is added to the "handled list", so we can avoid
2978 # to process it again.
2980 inmodules
="$modules"
2982 fmtc_inc_all_tests
="$inc_all_direct_tests"
2983 if test "$cond_dependencies" = true
; then
2984 for module
in $inmodules; do
2986 if test -n "$module"; then
2987 if func_acceptable
$module; then
2988 func_uncond_add_module
$module
2993 while test -n "$inmodules"; do
2994 inmodules_this_round
="$inmodules"
2995 inmodules
= # Accumulator, queue for next round
2996 for module
in $inmodules_this_round; do
2998 if test -n "$module"; then
2999 if func_acceptable
$module; then
3000 func_append outmodules
" $module"
3001 if test "$cond_dependencies" = true
; then
3003 && func_get_automake_snippet_conditional
$module \
3004 |
grep '^if ' > /dev
/null
; then
3005 # A module whose Makefile.am snippet contains a reference to an
3006 # automake conditional. If we were to use it conditionally, we
3007 # would get an error
3008 # configure: error: conditional "..." was never defined.
3009 # because automake 1.11.1 does not handle nested conditionals
3010 # correctly. As a workaround, make the module unconditional.
3011 func_uncond_add_module
$module
3013 if func_cond_module_p
$module; then
3019 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
3020 # Duplicate dependencies are harmless, but Jim wants a warning.
3021 duplicated_deps
=`echo "$deps" | LC_ALL=C sort | LC_ALL=C uniq -d`
3022 if test -n "$duplicated_deps"; then
3023 func_warning
"module $module has duplicated dependencies: "`echo $duplicated_deps`
3026 testsmodule
=`func_get_tests_module $module`
3027 if test -n "$testsmodule"; then
3028 deps
="$deps $testsmodule"
3031 for dep
in $deps; do
3032 # Determine whether to include the dependency or tests module.
3034 for word
in `func_get_status $dep`; do
3037 test -n "$incobsolete" \
3041 test -z "$excl_cxx_tests" \
3043 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_cxx_tests" \
3047 test -z "$excl_longrunning_tests" \
3049 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_longrunning_tests" \
3053 test -z "$excl_privileged_tests" \
3055 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_privileged_tests" \
3059 test -z "$excl_unportable_tests" \
3061 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_unportable_tests" \
3065 test -n "$fmtc_inc_all_tests" \
3070 if $inc && func_acceptable
"$dep"; then
3071 func_append inmodules
" $dep"
3072 if test "$cond_dependencies" = true
; then
3073 escaped_dep
=`echo "$dep" | sed -e "$sed_escape_dependency"`
3074 sed_extract_condition1
='/^ *'"$escaped_dep"' *$/{
3077 sed_extract_condition2
='/^ *'"$escaped_dep"' *\[.*\] *$/{
3078 s/^ *'"$escaped_dep"' *\[\(.*\)\] *$/\1/p
3080 condition
=`func_get_dependencies $module | sed -n -e "$sed_extract_condition1" -e "$sed_extract_condition2"`
3081 if test "$condition" = true
; then
3084 if test -n "$condition"; then
3085 func_conddep_add_module
"$module" "$dep" "$condition"
3087 if $conditional; then
3088 func_conddep_add_module
"$module" "$dep" true
3090 func_uncond_add_module
"$dep"
3099 handledmodules
=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
3100 # Remove $handledmodules from $inmodules.
3101 for m
in $inmodules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/queued-modules
3102 inmodules
=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
3103 fmtc_inc_all_tests
="$inc_all_indirect_tests"
3105 modules
=`for m in $outmodules; do echo $m; done | LC_ALL=C sort -u`
3106 rm -f "$tmp"/queued-modules
3109 # func_show_module_list
3111 # - specified_modules list of specified modules (one per line, sorted)
3112 # - modules complete list of modules (one per line, sorted)
3113 # - tmp pathname of a temporary directory
3114 func_show_module_list
()
3120 # Assume xterm compatible escape sequences.
3121 bold_on
=`printf '\033[1m'`
3122 bold_off
=`printf '\033[0m'`
3127 echo "Module list with included dependencies (indented):"
3128 echo "$specified_modules" |
sed -e '/^$/d' -e 's/$/| /' > "$tmp"/specified-modules
3129 echo "$modules" |
sed -e '/^$/d' \
3130 | LC_ALL
=C
join -t '|' -a2 "$tmp"/specified-modules
- \
3131 |
sed -e 's/^\(.*\)|.*/|\1/' -e 's/^/ /' -e 's/^ |\(.*\)$/ '"${bold_on}"'\1'"${bold_off}"'/'
3134 # func_modules_transitive_closure_separately
3135 # Determine main module list and tests-related module list separately.
3136 # The main module list is the transitive closure of the specified modules,
3137 # ignoring tests modules. Its lib/* sources go into $sourcebase/. If --lgpl
3138 # is specified, it will consist only of LGPLed source.
3139 # The tests-related module list is the transitive closure of the specified
3140 # modules, including tests modules, minus the main module list excluding
3141 # modules of applicability 'all'. Its lib/* sources (brought in through
3142 # dependencies of *-tests modules) go into $testsbase/. It may contain GPLed
3143 # source, even if --lgpl is specified.
3145 # - local_gnulib_path from --local-dir
3146 # - modcache true or false, from --cache-modules/--no-cache-modules
3147 # - specified_modules list of specified modules
3148 # - inctests true if tests should be included, false otherwise
3149 # - incobsolete true if obsolete modules among dependencies should be
3150 # included, blank otherwise
3151 # - inc_cxx_tests true if C++ interoperability tests should be included,
3153 # - inc_longrunning_tests true if long-runnings tests should be included,
3155 # - inc_privileged_tests true if tests that require root privileges should be
3156 # included, blank otherwise
3157 # - inc_unportable_tests true if tests that fail on some platforms should be
3158 # included, blank otherwise
3159 # - inc_all_direct_tests true if all kinds of problematic unit tests among
3160 # the unit tests of the specified modules should be
3161 # included, blank otherwise
3162 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
3163 # the unit tests of the dependencies should be
3164 # included, blank otherwise
3165 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
3167 # - excl_longrunning_tests true if long-runnings tests should be excluded,
3169 # - excl_privileged_tests true if tests that require root privileges should be
3170 # excluded, blank otherwise
3171 # - excl_unportable_tests true if tests that fail on some platforms should be
3172 # excluded, blank otherwise
3173 # - avoidlist list of modules to avoid
3174 # - cond_dependencies true if conditional dependencies shall be supported,
3176 # - tmp pathname of a temporary directory
3178 # - main_modules list of modules, including dependencies
3179 # - testsrelated_modules list of tests-related modules, including dependencies
3180 # - conddep_dependers, conddep_condition information about conditionally
3182 func_modules_transitive_closure_separately
()
3184 # Determine main module list.
3185 saved_inctests
="$inctests"
3187 modules
="$specified_modules"
3188 func_modules_transitive_closure
3189 main_modules
="$modules"
3190 inctests
="$saved_inctests"
3191 if test $verbose -ge 1; then
3192 echo "Main module list:"
3193 echo "$main_modules" |
sed -e 's/^/ /'
3195 # Determine tests-related module list.
3196 echo "$final_modules" | LC_ALL
=C
sort -u > "$tmp"/final-modules
3197 testsrelated_modules
=`for module in $main_modules; do
3198 if test \`func_get_applicability
$module\
` = main; then
3202 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/final-modules`
3203 # If testsrelated_modules consists only of modules with applicability 'all',
3204 # set it to empty (because such modules are only helper modules for other modules).
3205 have_nontrivial_testsrelated_modules
=
3206 for module
in $testsrelated_modules; do
3207 if test `func_get_applicability $module` != all
; then
3208 have_nontrivial_testsrelated_modules
=yes
3212 if test -z "$have_nontrivial_testsrelated_modules"; then
3213 testsrelated_modules
=
3215 if test $verbose -ge 1; then
3216 echo "Tests-related module list:"
3217 echo "$testsrelated_modules" |
sed -e 's/^/ /'
3221 # func_determine_use_libtests
3222 # Determines whether a $testsbase/libtests.a is needed.
3224 # - local_gnulib_path from --local-dir
3225 # - modcache true or false, from --cache-modules/--no-cache-modules
3226 # - testsrelated_modules list of tests-related modules, including dependencies
3228 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
3229 func_determine_use_libtests
()
3232 for module
in $testsrelated_modules; do
3233 func_verify_nontests_module
3234 if test -n "$module"; then
3235 all_files
=`func_get_filelist $module`
3236 # Test whether some file in $all_files lies in lib/.
3237 for f
in $all_files; do
3249 # func_modules_add_dummy
3251 # - local_gnulib_path from --local-dir
3252 # - modcache true or false, from --cache-modules/--no-cache-modules
3253 # - modules list of modules, including dependencies
3255 # - modules list of modules, including 'dummy' if needed
3256 func_modules_add_dummy
()
3258 # Determine whether any module provides a lib_SOURCES augmentation.
3260 for module
in $modules; do
3261 func_verify_nontests_module
3262 if test -n "$module"; then
3263 # Extract the value of "lib_SOURCES += ...".
3264 for file in `func_get_automake_snippet "$module" | combine_lines |
3265 sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'`; do
3266 # Ignore .h files since they are not compiled.
3270 have_lib_SOURCES
=yes
3277 # Add the dummy module, to make sure the library will be non-empty.
3278 if test -z "$have_lib_SOURCES"; then
3279 if func_acceptable
"dummy"; then
3280 func_append modules
" dummy"
3285 # func_modules_add_dummy_separately
3287 # - local_gnulib_path from --local-dir
3288 # - modcache true or false, from --cache-modules/--no-cache-modules
3289 # - main_modules list of modules, including dependencies
3290 # - testsrelated_modules list of tests-related modules, including dependencies
3291 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
3293 # - main_modules list of modules, including 'dummy' if needed
3294 # - testsrelated_modules list of tests-related modules, including 'dummy' if
3296 func_modules_add_dummy_separately
()
3298 # Add the dummy module to the main module list if needed.
3299 modules
="$main_modules"
3300 func_modules_add_dummy
3301 main_modules
="$modules"
3303 # Add the dummy module to the tests-related module list if needed.
3304 if $use_libtests; then
3305 modules
="$testsrelated_modules"
3306 func_modules_add_dummy
3307 testsrelated_modules
="$modules"
3311 # func_modules_notice
3313 # - local_gnulib_path from --local-dir
3314 # - modcache true or false, from --cache-modules/--no-cache-modules
3315 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
3316 # - modules list of modules, including dependencies
3317 func_modules_notice
()
3319 if test $verbose -ge -1; then
3320 for module
in $modules; do
3322 if test -n "$module"; then
3323 msg
=`func_get_notice $module`
3324 if test -n "$msg"; then
3325 echo "Notice from module $module:"
3326 echo "$msg" |
sed -e 's/^/ /'
3333 # func_modules_to_filelist
3335 # - local_gnulib_path from --local-dir
3336 # - modcache true or false, from --cache-modules/--no-cache-modules
3337 # - modules list of modules, including dependencies
3339 # - files list of files
3340 func_modules_to_filelist
()
3343 for module
in $modules; do
3345 if test -n "$module"; then
3346 fs
=`func_get_filelist $module`
3347 func_append files
" $fs"
3350 files
=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
3353 # func_modules_to_filelist_separately
3354 # Determine the final file lists.
3355 # They must be computed separately, because files in lib/* go into
3356 # $sourcebase/ if they are in the main file list but into $testsbase/
3357 # if they are in the tests-related file list. Furthermore lib/dummy.c
3360 # - local_gnulib_path from --local-dir
3361 # - modcache true or false, from --cache-modules/--no-cache-modules
3362 # - main_modules list of modules, including dependencies
3363 # - testsrelated_modules list of tests-related modules, including dependencies
3364 func_modules_to_filelist_separately
()
3366 # Determine final main file list.
3367 modules
="$main_modules"
3368 func_modules_to_filelist
3370 # Determine final tests-related file list.
3371 modules
="$testsrelated_modules"
3372 func_modules_to_filelist
3373 testsrelated_files
=`echo "$files" | sed -e 's,^lib/,tests=lib/,'`
3374 # Merge both file lists.
3375 sed_remove_empty_lines
='/^$/d'
3376 files
=`{ echo "$main_files"; echo "$testsrelated_files"; } | sed -e "$sed_remove_empty_lines" | LC_ALL=C sort -u`
3377 if test $verbose -ge 0; then
3379 sed_prettyprint_files
='s,^tests=lib/\(.*\)$,lib/\1 -> tests/\1,'
3380 echo "$files" |
sed -e "$sed_prettyprint_files" -e 's/^/ /'
3384 # func_compute_include_guard_prefix
3385 # Determine include_guard_prefix.
3387 # - macro_prefix prefix of gl_LIBOBJS macros to use
3389 # - include_guard_prefix replacement for ${gl_include_guard_prefix}
3390 # - sed_replace_include_guard_prefix
3391 # sed expression for resolving ${gl_include_guard_prefix}
3392 func_compute_include_guard_prefix
()
3394 if test "$macro_prefix" = gl
; then
3395 include_guard_prefix
='GL'
3397 include_guard_prefix
='GL_'`echo "$macro_prefix" | LC_ALL=C tr '[a-z]' '[A-Z]'`
3399 sed_replace_include_guard_prefix
='s/\${gl_include_guard_prefix}/'"${include_guard_prefix}"'/g'
3402 # func_execute_command command [args...]
3403 # Executes a command.
3404 # Uses also the variables
3405 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
3406 func_execute_command
()
3408 if test $verbose -ge 0; then
3412 # Commands like automake produce output to stderr even when they succeed.
3413 # Turn this output off if the command succeeds.
3414 "$@" > "$tmp"/cmdout
2>&1
3416 if test $cmdret = 0; then
3420 cat "$tmp"/cmdout
1>&2
3427 # func_dest_tmpfilename file
3428 # determines the name of a temporary file (file is relative to destdir).
3430 # - destdir target directory
3431 # - doit : if actions shall be executed, false if only to be printed
3432 # - tmp pathname of a temporary directory
3434 # - tmpfile absolute filename of the temporary file
3435 func_dest_tmpfilename
()
3438 # Put the new contents of $file in a file in the same directory (needed
3439 # to guarantee that an 'mv' to "$destdir/$file" works).
3440 tmpfile
="$destdir/$1.tmp"
3442 # Put the new contents of $file in a file in a temporary directory
3443 # (because the directory of "$file" might not exist).
3444 tmpfile
="$tmp"/`basename "$1"`.tmp
3448 # func_is_local_file lookedup_file file
3449 # check whether file should be instantiated from local gnulib directory
3450 func_is_local_file
()
3453 func_remove_suffix dname
"/$2"
3454 func_path_foreach
"$local_gnulib_path" test %dir
% = "$dname"
3458 # determines whether the file $f should be copied, symlinked, or hardlinked.
3460 # - copymode copy mode for files in general
3461 # - lcopymode copy mode for files from local_gnulib_path
3462 # - f the original file name
3463 # - lookedup_file name of the merged (combined) file
3465 # - copyaction copy or symlink or hardlink
3468 if test -n "$lcopymode" && func_is_local_file
"$lookedup_file" "$f"; then
3469 copyaction
="$lcopymode"
3471 if test -n "$copymode"; then
3472 copyaction
="$copymode"
3480 # copies a file from gnulib into the destination directory. The destination
3481 # is known to not exist.
3483 # - destdir target directory
3484 # - local_gnulib_path from --local-dir
3485 # - modcache true or false, from --cache-modules/--no-cache-modules
3486 # - f the original file name
3487 # - lookedup_file name of the merged (combined) file
3488 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
3489 # - g the rewritten file name
3490 # - tmpfile absolute filename of the temporary file
3491 # - doit : if actions shall be executed, false if only to be printed
3492 # - copymode copy mode for files in general
3493 # - lcopymode copy mode for files from local_gnulib_path
3497 echo "Copying file $g"
3499 if test "$copyaction" = symlink \
3500 && test -z "$lookedup_tmp" \
3501 && cmp -s "$lookedup_file" "$tmpfile"; then
3502 func_symlink_if_changed
"$lookedup_file" "$destdir/$g"
3504 if test "$copyaction" = hardlink \
3505 && test -z "$lookedup_tmp" \
3506 && cmp -s "$lookedup_file" "$tmpfile"; then
3507 func_hardlink
"$lookedup_file" "$destdir/$g"
3509 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error
"failed"
3518 # copies a file from gnulib into the destination directory. The destination
3519 # is known to exist.
3521 # - destdir target directory
3522 # - local_gnulib_path from --local-dir
3523 # - modcache true or false, from --cache-modules/--no-cache-modules
3524 # - f the original file name
3525 # - lookedup_file name of the merged (combined) file
3526 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
3527 # - g the rewritten file name
3528 # - tmpfile absolute filename of the temporary file
3529 # - doit : if actions shall be executed, false if only to be printed
3530 # - copymode copy mode for files in general
3531 # - lcopymode copy mode for files from local_gnulib_path
3532 # - already_present nonempty if the file should already exist, empty otherwise
3535 if cmp -s "$destdir/$g" "$tmpfile"; then
3536 : # The file has not changed.
3540 if test -n "$already_present"; then
3541 echo "Updating file $g (backup in ${g}~)"
3543 echo "Replacing file $g (non-gnulib code backed up in ${g}~) !!"
3545 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error
"failed"
3547 if test "$copyaction" = symlink \
3548 && test -z "$lookedup_tmp" \
3549 && cmp -s "$lookedup_file" "$tmpfile"; then
3550 func_symlink_if_changed
"$lookedup_file" "$destdir/$g"
3552 if test "$copyaction" = hardlink \
3553 && test -z "$lookedup_tmp" \
3554 && cmp -s "$lookedup_file" "$tmpfile"; then
3555 func_hardlink
"$lookedup_file" "$destdir/$g"
3557 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error
"failed"
3561 if test -n "$already_present"; then
3562 echo "Update file $g (backup in ${g}~)"
3564 echo "Replace file $g (non-gnulib code backed up in ${g}~) !!"
3570 # func_emit_lib_Makefile_am
3571 # emits the contents of library makefile to standard output.
3573 # - local_gnulib_path from --local-dir
3574 # - modcache true or false, from --cache-modules/--no-cache-modules
3575 # - modules list of modules, including dependencies
3576 # - libname library name
3577 # - pobase directory relative to destdir where to place *.po files
3578 # - auxdir directory relative to destdir where to place build aux files
3579 # - gnu_make true if --gnu-make was given, false otherwise
3580 # - makefile_name from --makefile-name
3581 # - libtool true if libtool will be used, false or blank otherwise
3582 # - macro_prefix prefix of gl_LIBOBJS macros to use
3583 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
3584 # - witness_c_macro from --witness-c-macro
3585 # - actioncmd (optional) command that will reproduce this invocation
3586 # - for_test true if creating a package for testing, false otherwise
3587 # - sed_replace_include_guard_prefix
3588 # sed expression for resolving ${gl_include_guard_prefix}
3589 # - destfile filename relative to destdir of makefile being generated
3591 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val,dotfirst}
3592 # list of edits to be done to Makefile.am variables
3594 # - uses_subdirs nonempty if object files in subdirs exist
3595 func_emit_lib_Makefile_am
()
3598 # When using GNU make, or when creating an includable Makefile.am snippet,
3599 # augment variables with += instead of assigning them.
3600 if $gnu_make ||
test -n "$makefile_name"; then
3605 if test "$libtool" = true
; then
3608 sed_eliminate_LDFLAGS
="$sed_noop"
3612 sed_eliminate_LDFLAGS
='/^lib_LDFLAGS[ ]*+=/d'
3615 # When creating a package for testing: Attempt to provoke failures,
3616 # especially link errors, already during "make" rather than during
3617 # "make check", because "make check" is not possible in a cross-compiling
3618 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
3619 sed_transform_check_PROGRAMS
='s,check_PROGRAMS,noinst_PROGRAMS,g'
3621 sed_transform_check_PROGRAMS
="$sed_noop"
3623 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3625 echo "## Process this file with automake to produce Makefile.in."
3626 func_emit_copyright_notice
3627 if test -n "$actioncmd"; then
3628 printf '# Reproduce by:\n%s\n' "$actioncmd"
3633 for module
in $modules; do
3634 func_verify_nontests_module
3635 if test -n "$module"; then
3637 func_get_automake_snippet_conditional
"$module" |
3639 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
3640 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
3641 -e "$sed_eliminate_LDFLAGS" \
3642 -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' \
3643 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
3644 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
3645 -e "$sed_transform_check_PROGRAMS" \
3646 -e "$sed_replace_include_guard_prefix"
3647 if test "$module" = 'alloca'; then
3648 echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
3649 echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@"
3651 } | combine_lines
"${libname}_${libext}_SOURCES" > "$tmp"/amsnippet1
3653 func_get_automake_snippet_unconditional
"$module" |
3654 LC_ALL
=C
sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g'
3655 } > "$tmp"/amsnippet2
3656 # Skip the contents if it's entirely empty.
3657 if grep '[^ ]' "$tmp"/amsnippet1
"$tmp"/amsnippet2
> /dev
/null
; then
3658 echo "## begin gnulib module $module"
3660 echo "ifeq (,\$(OMIT_GNULIB_MODULE_$module))"
3661 convert_to_gnu_make
='s/^if \(.*\)/ifneq (,$(\1))/'
3663 convert_to_gnu_make
=
3666 if test "$cond_dependencies" = true
; then
3667 if func_cond_module_p
"$module"; then
3668 func_module_conditional_name
"$module"
3670 echo "ifneq (,\$($conditional))"
3672 echo "if $conditional"
3676 sed "$convert_to_gnu_make" "$tmp"/amsnippet1
3677 if test "$cond_dependencies" = true
; then
3678 if func_cond_module_p
"$module"; then
3682 sed "$convert_to_gnu_make" "$tmp"/amsnippet2
3686 echo "## end gnulib module $module"
3689 rm -f "$tmp"/amsnippet1
"$tmp"/amsnippet2
3690 # Test whether there are some source files in subdirectories.
3691 for f
in `func_get_filelist "$module"`; do
3701 } > "$tmp"/allsnippets
3702 if test -z "$makefile_name"; then
3703 # If there are source files in subdirectories, prevent collision of the
3704 # object files (example: hash.c and libxml/hash.c).
3706 if test -n "$uses_subdirs"; then
3707 subdir_options
=' subdir-objects'
3709 echo "AUTOMAKE_OPTIONS = 1.11 gnits${subdir_options}"
3712 if test -z "$makefile_name"; then
3714 echo "noinst_HEADERS ="
3715 echo "noinst_LIBRARIES ="
3716 echo "noinst_LTLIBRARIES ="
3717 # Automake versions < 1.11.4 create an empty pkgdatadir at
3718 # installation time if you specify pkgdata_DATA to empty.
3719 # See automake bugs #10997 and #11030:
3720 # * https://debbugs.gnu.org/10997
3721 # * https://debbugs.gnu.org/11030
3722 # So we need this workaround.
3723 if grep '^pkgdata_DATA *+=' "$tmp"/allsnippets
> /dev
/null
; then
3724 echo "pkgdata_DATA ="
3727 echo "BUILT_SOURCES ="
3730 echo "MOSTLYCLEANFILES $assign core *.stackdump"
3731 if test -z "$makefile_name"; then
3732 echo "MOSTLYCLEANDIRS ="
3734 echo "DISTCLEANFILES ="
3735 echo "MAINTAINERCLEANFILES ="
3738 echo "# Start of GNU Make output."
3740 # Put autoconf output into a temporary file, so that its exit status
3741 # can be checked from the shell. Signal any error by putting a
3742 # syntax error into the output makefile.
3743 ${AUTOCONF} -t 'AC_SUBST:$1 = @$1@' "$configure_ac" \
3744 >"$tmp"/makeout
2>"$tmp"/makeout2
&&
3745 LC_ALL
=C
sort -u "$tmp"/makeout ||
{
3746 echo "== gnulib-tool GNU Make output failed as follows =="
3747 sed 's/^/# stderr: /' "$tmp"/makeout2
3749 rm -f "$tmp"/makeout
"$tmp"/makeout2
3751 echo "# End of GNU Make output."
3753 echo "# No GNU Make output."
3755 # Execute edits that apply to the Makefile.am being generated.
3757 while test $edit != $makefile_am_edits; do
3758 edit
=`expr $edit + 1`
3759 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
3760 eval var
=\"\
$makefile_am_edit${edit}_var
\"
3761 eval val
=\"\
$makefile_am_edit${edit}_val
\"
3762 eval dotfirst
=\"\
$makefile_am_edit${edit}_dotfirst
\"
3763 if test -n "$var"; then
3764 if test "${dir}Makefile.am" = "$destfile" ||
test "./${dir}Makefile.am" = "$destfile"; then
3765 if test "${var}" = SUBDIRS
&& test -n "$dotfirst"; then
3766 # The added subdirectory ${val} needs to be mentioned after '.'.
3767 # Since we don't have '.' among SUBDIRS so far, add it now.
3770 echo "${var} += ${val}"
3771 eval "makefile_am_edit${edit}_var="
3775 if test -n "$witness_c_macro"; then
3776 cppflags_part1
=" -D$witness_c_macro=1"
3781 cppflags_part2
=" -DGNULIB_STRICT_CHECKING=1"
3785 if test -z "$makefile_name"; then
3787 echo "AM_CPPFLAGS =$cppflags_part1$cppflags_part2"
3790 if test -n "$cppflags_part1$cppflags_part2"; then
3792 echo "AM_CPPFLAGS +=$cppflags_part1$cppflags_part2"
3796 if LC_ALL
=C
grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$tmp"/allsnippets
> /dev
/null \
3797 ||
{ test -n "$makefile_name" \
3798 && test -f "$sourcebase/Makefile.am" \
3799 && LC_ALL
=C
grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$sourcebase/Makefile.am" > /dev
/null
; \
3801 # One of the snippets or the user's Makefile.am already specifies an
3802 # installation location for the library. Don't confuse automake by saying
3803 # it should not be installed.
3806 # By default, the generated library should not be installed.
3807 echo "noinst_${perhapsLT}LIBRARIES += $libname.$libext"
3810 echo "${libname}_${libext}_SOURCES ="
3811 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
3812 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
3813 echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
3814 echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
3815 echo "EXTRA_${libname}_${libext}_SOURCES ="
3816 if test "$libtool" = true
; then
3817 echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)"
3818 echo "${libname}_${libext}_LDFLAGS += -no-undefined"
3819 # Synthesize an ${libname}_${libext}_LDFLAGS augmentation by combining
3820 # the link dependencies of all modules.
3821 for module
in $modules; do
3822 func_verify_nontests_module
3823 if test -n "$module"; then
3824 func_get_link_directive
"$module"
3827 | LC_ALL
=C
sed -e '/^$/d' -e 's/ when linking with libtool.*//' \
3828 | LC_ALL
=C
sort -u \
3829 | LC_ALL
=C
sed -e 's/^/'"${libname}_${libext}"'_LDFLAGS += /'
3832 if test -n "$pobase"; then
3833 echo "AM_CPPFLAGS += -DDEFAULT_TEXT_DOMAIN=\\\"${po_domain}-gnulib\\\""
3836 cat "$tmp"/allsnippets \
3837 |
sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
3839 echo "mostlyclean-local: mostlyclean-generic"
3840 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
3841 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
3842 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
3846 rm -f "$tmp"/allsnippets
3849 # func_emit_po_Makevars
3850 # emits the contents of po/ makefile parameterization to standard output.
3852 # - local_gnulib_path from --local-dir
3853 # - modcache true or false, from --cache-modules/--no-cache-modules
3854 # - sourcebase directory relative to destdir where to place source code
3855 # - pobase directory relative to destdir where to place *.po files
3856 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
3857 func_emit_po_Makevars
()
3859 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3860 func_emit_copyright_notice
3862 echo "# Usually the message domain is the same as the package name."
3863 echo "# But here it has a '-gnulib' suffix."
3864 echo "DOMAIN = ${po_domain}-gnulib"
3866 echo "# These two variables depend on the location of this directory."
3867 echo "subdir = ${pobase}"
3868 echo "top_builddir = "`echo "$pobase" | sed -e 's,//*,/,g' -e 's,[^/][^/]*,..,g'`
3871 # These options get passed to xgettext.
3872 XGETTEXT_OPTIONS
= \
3873 --keyword=_
--flag=_
:1:pass-c-format \
3874 --keyword=N_
--flag=N_
:1:pass-c-format \
3875 --keyword='proper_name:1,"This is a proper name. See the gettext manual, section Names."' \
3876 --keyword='proper_name_utf8:1,"This is a proper name. See the gettext manual, section Names."' \
3877 --flag=error
:3:c-format
--flag=error_at_line
:5:c-format
3879 # This is the copyright holder that gets inserted into the header of the
3880 # $(DOMAIN).pot file. gnulib is copyrighted by the FSF.
3881 COPYRIGHT_HOLDER
= Free Software Foundation
, Inc.
3883 # This is the email address or URL to which the translators shall report
3884 # bugs in the untranslated strings:
3885 # - Strings which are not entire sentences, see the maintainer guidelines
3886 # in the GNU gettext documentation, section 'Preparing Strings'.
3887 # - Strings which use unclear terms or require additional context to be
3889 # - Strings which make invalid assumptions about notation of date, time or
3891 # - Pluralisation problems.
3892 # - Incorrect English spelling.
3893 # - Incorrect formatting.
3894 # It can be your email address, or a mailing list address where translators
3895 # can write to without being subscribed, or the URL of a web page through
3896 # which the translators can contact you.
3897 MSGID_BUGS_ADDRESS
= bug-gnulib@gnu.org
3899 # This is the list of locale categories, beyond LC_MESSAGES, for which the
3900 # message catalogs shall be used. It is usually empty.
3901 EXTRA_LOCALE_CATEGORIES
=
3903 # This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
3904 # context. Possible values are "yes" and "no". Set this to yes if the
3905 # package uses functions taking also a message context, like pgettext(), or
3906 # if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
3911 # func_emit_po_POTFILES_in
3912 # emits the file list to be passed to xgettext to standard output.
3914 # - local_gnulib_path from --local-dir
3915 # - modcache true or false, from --cache-modules/--no-cache-modules
3916 # - sourcebase directory relative to destdir where to place source code
3917 # - files list of new files
3918 func_emit_po_POTFILES_in
()
3920 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3921 func_emit_copyright_notice
3923 echo "# List of files which contain translatable strings."
3924 echo "$files" |
sed -n -e "s,^lib/,$sourcebase/,p"
3927 # func_emit_tests_Makefile_am witness_macro
3928 # emits the contents of tests makefile to standard output.
3930 # - local_gnulib_path from --local-dir
3931 # - modcache true or false, from --cache-modules/--no-cache-modules
3932 # - modules list of modules, including dependencies
3933 # - libname library name
3934 # - auxdir directory relative to destdir where to place build aux files
3935 # - gnu_make true if --gnu-make was given, false otherwise
3936 # - makefile_name from --makefile-name
3937 # - libtool true if libtool will be used, false or blank otherwise
3938 # - sourcebase relative directory containing lib source code
3939 # - m4base relative directory containing autoconf macros
3940 # - testsbase relative directory containing unit test code
3941 # - macro_prefix prefix of gl_LIBOBJS macros to use
3942 # - witness_c_macro from --witness-c-macro
3943 # - for_test true if creating a package for testing, false otherwise
3944 # - single_configure true if a single configure file should be generated,
3945 # false for a separate configure file for the tests
3946 # - use_libtests true if a libtests.a should be built, false otherwise
3947 # - sed_replace_include_guard_prefix
3948 # sed expression for resolving ${gl_include_guard_prefix}
3949 # - destfile filename relative to destdir of makefile being generated
3951 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val,dotfirst}
3952 # list of edits to be done to Makefile.am variables
3954 # - uses_subdirs nonempty if object files in subdirs exist
3955 func_emit_tests_Makefile_am
()
3958 if test "$libtool" = true
; then
3961 sed_eliminate_LDFLAGS
="$sed_noop"
3965 sed_eliminate_LDFLAGS
='/^lib_LDFLAGS[ ]*+=/d'
3968 # When creating a package for testing: Attempt to provoke failures,
3969 # especially link errors, already during "make" rather than during
3970 # "make check", because "make check" is not possible in a cross-compiling
3971 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
3972 sed_transform_check_PROGRAMS
='s,check_PROGRAMS,noinst_PROGRAMS,g'
3974 sed_transform_check_PROGRAMS
="$sed_noop"
3976 testsbase_inverse
=`echo "$testsbase" | sed -e 's,/$,,' | sed -e 's,[^/][^/]*,..,g'`
3977 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3978 echo "## Process this file with automake to produce Makefile.in."
3979 func_emit_copyright_notice
3983 for module
in $modules; do
3984 if $for_test && ! $single_configure; then
3985 func_verify_tests_module
3989 if test -n "$module"; then
3991 func_get_automake_snippet
"$module" |
3993 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
3994 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
3995 -e "$sed_eliminate_LDFLAGS" \
3996 -e 's,lib_\([A-Z][A-Z]*\),libtests_a_\1,g' \
3997 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
3998 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
3999 -e "$sed_transform_check_PROGRAMS" \
4000 -e "$sed_replace_include_guard_prefix"
4001 if $use_libtests && test "$module" = 'alloca'; then
4002 echo "libtests_a_LIBADD += @ALLOCA@"
4003 echo "libtests_a_DEPENDENCIES += @ALLOCA@"
4005 } > "$tmp"/amsnippet
4006 # Skip the contents if it's entirely empty.
4007 if grep '[^ ]' "$tmp"/amsnippet
> /dev
/null
; then
4008 # Mention long-running tests at the end.
4010 for word
in `func_get_status "$module"`; do
4011 if test "$word" = 'longrunning-test'; then
4016 { echo "## begin gnulib module $module"
4018 echo "ifeq (,\$(OMIT_GNULIB_MODULE_$module))"
4021 cat "$tmp"/amsnippet
4025 echo "## end gnulib module $module"
4029 rm -f "$tmp"/amsnippet
4030 # Test whether there are some source files in subdirectories.
4031 for f
in `func_get_filelist "$module"`; do
4033 lib
/*/*.c |
tests
/*/*.c
)
4041 } 3> "$tmp"/main_snippets
4> "$tmp"/longrunning_snippets
4042 # Generate dependencies here, since it eases the debugging of test failures.
4043 # If there are source files in subdirectories, prevent collision of the
4044 # object files (example: hash.c and libxml/hash.c).
4046 if test -n "$uses_subdirs"; then
4047 subdir_options
=' subdir-objects'
4049 echo "AUTOMAKE_OPTIONS = 1.11 foreign${subdir_options}"
4051 if $for_test && ! $single_configure; then
4052 echo "ACLOCAL_AMFLAGS = -I ${testsbase_inverse}/${m4base}"
4055 # Nothing is being added to SUBDIRS; nevertheless the existence of this
4056 # variable is needed to avoid an error from automake:
4057 # "AM_GNU_GETTEXT used but SUBDIRS not defined"
4060 echo "XFAIL_TESTS ="
4061 echo "TESTS_ENVIRONMENT ="
4062 echo "noinst_PROGRAMS ="
4063 if ! $for_test; then
4064 echo "check_PROGRAMS ="
4066 echo "EXTRA_PROGRAMS ="
4067 echo "noinst_HEADERS ="
4068 echo "noinst_LIBRARIES ="
4069 if $use_libtests; then
4071 echo "noinst_LIBRARIES += libtests.a"
4073 echo "check_LIBRARIES = libtests.a"
4076 # Automake versions < 1.11.4 create an empty pkgdatadir at
4077 # installation time if you specify pkgdata_DATA to empty.
4078 # See automake bugs #10997 and #11030:
4079 # * https://debbugs.gnu.org/10997
4080 # * https://debbugs.gnu.org/11030
4081 # So we need this workaround.
4082 if grep '^pkgdata_DATA *+=' "$tmp"/main_snippets
"$tmp"/longrunning_snippets
> /dev
/null
; then
4083 echo "pkgdata_DATA ="
4086 echo "BUILT_SOURCES ="
4088 echo "MOSTLYCLEANFILES = core *.stackdump"
4089 echo "MOSTLYCLEANDIRS ="
4091 echo "DISTCLEANFILES ="
4092 echo "MAINTAINERCLEANFILES ="
4093 # Execute edits that apply to the Makefile.am being generated.
4095 while test $edit != $makefile_am_edits; do
4096 edit
=`expr $edit + 1`
4097 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
4098 eval var
=\"\
$makefile_am_edit${edit}_var
\"
4099 eval val
=\"\
$makefile_am_edit${edit}_val
\"
4100 eval dotfirst
=\"\
$makefile_am_edit${edit}_dotfirst
\"
4101 if test -n "$var"; then
4102 if test "${dir}Makefile.am" = "$destfile" ||
test "./${dir}Makefile.am" = "$destfile"; then
4103 if test "${var}" = SUBDIRS
&& test -n "$dotfirst"; then
4104 # The added subdirectory ${val} needs to be mentioned after '.'.
4105 # But we have '.' among SUBDIRS already, so do nothing.
4108 echo "${var} += ${val}"
4109 eval "makefile_am_edit${edit}_var="
4114 echo "AM_CPPFLAGS = \\"
4116 echo " -DGNULIB_STRICT_CHECKING=1 \\"
4118 if test -n "$witness_c_macro"; then
4119 echo " -D$witness_c_macro=1 \\"
4121 if test -n "${witness_macro}"; then
4122 echo " -D@${witness_macro}@=1 \\"
4124 echo " -I. -I\$(srcdir) \\"
4125 echo " -I${testsbase_inverse} -I\$(srcdir)/${testsbase_inverse} \\"
4126 echo " -I${testsbase_inverse}/${sourcebase-lib} -I\$(srcdir)/${testsbase_inverse}/${sourcebase-lib}"
4128 local_ldadd_before
=''
4129 local_ldadd_after
=''
4130 if $use_libtests; then
4131 # All test programs need to be linked with libtests.a.
4132 # It needs to be passed to the linker before ${libname}.${libext}, since
4133 # the tests-related modules depend on the main modules.
4134 # It also needs to be passed to the linker after ${libname}.${libext}
4135 # because the latter might contain incomplete modules (such as the 'error'
4136 # module whose dependency to 'progname' is voluntarily omitted).
4137 # The LIBTESTS_LIBDEPS can be passed to the linker once or twice, it does
4139 local_ldadd_before
=' libtests.a'
4140 local_ldadd_after
=' libtests.a $(LIBTESTS_LIBDEPS)'
4142 echo "LDADD =${local_ldadd_before} ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext}${local_ldadd_after}"
4144 if $use_libtests; then
4145 echo "libtests_a_SOURCES ="
4146 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
4147 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
4148 echo "libtests_a_LIBADD = \$(${macro_prefix}tests_LIBOBJS)"
4149 echo "libtests_a_DEPENDENCIES = \$(${macro_prefix}tests_LIBOBJS)"
4150 echo "EXTRA_libtests_a_SOURCES ="
4151 # The circular dependency in LDADD requires this.
4152 echo "AM_LIBTOOLFLAGS = --preserve-dup-deps"
4155 # Many test scripts use ${EXEEXT} or ${srcdir}.
4156 # EXEEXT is defined by AC_PROG_CC through autoconf.
4157 # srcdir is defined by autoconf and automake.
4158 echo "TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='\$(srcdir)'"
4160 cat "$tmp"/main_snippets
"$tmp"/longrunning_snippets \
4161 |
sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
4162 echo "# Clean up after Solaris cc."
4164 echo " rm -rf SunWS_cache"
4166 echo "mostlyclean-local: mostlyclean-generic"
4167 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
4168 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
4169 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
4173 rm -f "$tmp"/main_snippets
"$tmp"/longrunning_snippets
4176 # func_emit_initmacro_start macro_prefix
4177 # emits the first few statements of the gl_INIT macro to standard output.
4178 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4179 func_emit_initmacro_start
()
4181 macro_prefix_arg
="$1"
4182 # Overriding AC_LIBOBJ and AC_REPLACE_FUNCS has the effect of storing
4183 # platform-dependent object files in ${macro_prefix_arg}_LIBOBJS instead of
4184 # LIBOBJS. The purpose is to allow several gnulib instantiations under
4185 # a single configure.ac file. (AC_CONFIG_LIBOBJ_DIR does not allow this
4187 # Furthermore it avoids an automake error like this when a Makefile.am
4188 # that uses pieces of gnulib also uses $(LIBOBJ):
4189 # automatically discovered file `error.c' should not be explicitly mentioned
4190 echo " m4_pushdef([AC_LIBOBJ], m4_defn([${macro_prefix_arg}_LIBOBJ]))"
4191 echo " m4_pushdef([AC_REPLACE_FUNCS], m4_defn([${macro_prefix_arg}_REPLACE_FUNCS]))"
4192 # Overriding AC_LIBSOURCES has the same purpose of avoiding the automake
4193 # error when a Makefile.am that uses pieces of gnulib also uses $(LIBOBJ):
4194 # automatically discovered file `error.c' should not be explicitly mentioned
4195 # We let automake know about the files to be distributed through the
4196 # EXTRA_lib_SOURCES variable.
4197 echo " m4_pushdef([AC_LIBSOURCES], m4_defn([${macro_prefix_arg}_LIBSOURCES]))"
4198 # Create data variables for checking the presence of files that are mentioned
4199 # as AC_LIBSOURCES arguments. These are m4 variables, not shell variables,
4200 # because we want the check to happen when the configure file is created,
4201 # not when it is run. ${macro_prefix_arg}_LIBSOURCES_LIST is the list of
4202 # files to check for. ${macro_prefix_arg}_LIBSOURCES_DIR is the subdirectory
4203 # in which to expect them.
4204 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_LIST], [])"
4205 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_DIR], [])"
4209 # func_emit_initmacro_end macro_prefix
4210 # emits the last few statements of the gl_INIT macro to standard output.
4211 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4212 func_emit_initmacro_end
()
4214 macro_prefix_arg
="$1"
4215 # Check the presence of files that are mentioned as AC_LIBSOURCES arguments.
4216 # The check is performed only when autoconf is run from the directory where
4217 # the configure.ac resides; if it is run from a different directory, the
4219 echo " m4_ifval(${macro_prefix_arg}_LIBSOURCES_LIST, ["
4220 echo " m4_syscmd([test ! -d ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[ ||"
4221 echo " for gl_file in ]${macro_prefix_arg}_LIBSOURCES_LIST[ ; do"
4222 echo " if test ! -r ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file ; then"
4223 echo " echo \"missing file ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file\" >&2"
4227 echo " m4_if(m4_sysval, [0], [],"
4228 echo " [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])"
4230 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_DIR])"
4231 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_LIST])"
4232 echo " m4_popdef([AC_LIBSOURCES])"
4233 echo " m4_popdef([AC_REPLACE_FUNCS])"
4234 echo " m4_popdef([AC_LIBOBJ])"
4235 echo " AC_CONFIG_COMMANDS_PRE(["
4236 echo " ${macro_prefix_arg}_libobjs="
4237 echo " ${macro_prefix_arg}_ltlibobjs="
4238 echo " if test -n \"\$${macro_prefix_arg}_LIBOBJS\"; then"
4239 echo " # Remove the extension."
4240 echo " sed_drop_objext='s/\\.o\$//;s/\\.obj\$//'"
4241 echo " for i in \`for i in \$${macro_prefix_arg}_LIBOBJS; do echo \"\$i\"; done | sed -e \"\$sed_drop_objext\" | sort | uniq\`; do"
4242 echo " ${macro_prefix_arg}_libobjs=\"\$${macro_prefix_arg}_libobjs \$i.\$ac_objext\""
4243 echo " ${macro_prefix_arg}_ltlibobjs=\"\$${macro_prefix_arg}_ltlibobjs \$i.lo\""
4246 echo " AC_SUBST([${macro_prefix_arg}_LIBOBJS], [\$${macro_prefix_arg}_libobjs])"
4247 echo " AC_SUBST([${macro_prefix_arg}_LTLIBOBJS], [\$${macro_prefix_arg}_ltlibobjs])"
4251 # func_emit_initmacro_done macro_prefix sourcebase
4252 # emits a few statements after the gl_INIT macro to standard output.
4253 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4254 # - sourcebase directory relative to destdir where to place source code
4255 func_emit_initmacro_done
()
4257 macro_prefix_arg
="$1"
4260 echo "# Like AC_LIBOBJ, except that the module name goes"
4261 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
4262 echo "AC_DEFUN([${macro_prefix_arg}_LIBOBJ], ["
4263 echo " AS_LITERAL_IF([\$1], [${macro_prefix_arg}_LIBSOURCES([\$1.c])])dnl"
4264 echo " ${macro_prefix_arg}_LIBOBJS=\"\$${macro_prefix_arg}_LIBOBJS \$1.\$ac_objext\""
4267 echo "# Like AC_REPLACE_FUNCS, except that the module name goes"
4268 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
4269 echo "AC_DEFUN([${macro_prefix_arg}_REPLACE_FUNCS], ["
4270 echo " m4_foreach_w([gl_NAME], [\$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl"
4271 echo " AC_CHECK_FUNCS([\$1], , [${macro_prefix_arg}_LIBOBJ(\$ac_func)])"
4274 echo "# Like AC_LIBSOURCES, except the directory where the source file is"
4275 echo "# expected is derived from the gnulib-tool parameterization,"
4276 echo "# and alloca is special cased (for the alloca-opt module)."
4277 echo "# We could also entirely rely on EXTRA_lib..._SOURCES."
4278 echo "AC_DEFUN([${macro_prefix_arg}_LIBSOURCES], ["
4279 echo " m4_foreach([_gl_NAME], [\$1], ["
4280 echo " m4_if(_gl_NAME, [alloca.c], [], ["
4281 echo " m4_define([${macro_prefix_arg}_LIBSOURCES_DIR], [$sourcebase_arg])"
4282 echo " m4_append([${macro_prefix_arg}_LIBSOURCES_LIST], _gl_NAME, [ ])"
4288 # func_emit_autoconf_snippet indentation
4289 # emits the autoconf snippet of a module.
4291 # - indentation spaces to prepend on each line
4292 # - local_gnulib_path from --local-dir
4293 # - modcache true or false, from --cache-modules/--no-cache-modules
4294 # - sed_replace_build_aux sed expression that replaces reference to build-aux
4295 # - sed_replace_include_guard_prefix
4296 # sed expression for resolving ${gl_include_guard_prefix}
4297 # - module the module name
4298 # - toplevel true or false. 'false' means a subordinate use of
4300 # - disable_libtool true or false. It tells whether to disable libtool
4301 # handling even if it has been specified through the
4302 # command line options.
4303 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
4305 func_emit_autoconf_snippet
()
4308 if { case $module in
4309 gnumakefile | maintainer-makefile
)
4310 # These modules are meant to be used only in the top-level directory.
4316 func_get_autoconf_snippet
"$module" \
4317 |
sed -e '/^$/d;' -e "s/^/$indentation/" \
4318 -e "$sed_replace_build_aux" \
4319 -e "$sed_replace_include_guard_prefix" \
4320 |
{ if $disable_libtool; then
4321 sed -e 's/\$gl_cond_libtool/false/g' \
4322 -e 's/gl_libdeps/gltests_libdeps/g' \
4323 -e 's/gl_ltlibdeps/gltests_ltlibdeps/g'
4328 |
{ if $disable_gettext; then
4329 sed -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./'
4331 # Don't indent AM_GNU_GETTEXT_VERSION line, as that confuses
4332 # autopoint through at least GNU gettext version 0.18.2.
4333 sed -e 's/^ *AM_GNU_GETTEXT_VERSION/AM_GNU_GETTEXT_VERSION/'
4336 if test "$module" = 'alloca' && test "$libtool" = true
&& ! $disable_libtool; then
4337 echo 'changequote(,)dnl'
4338 echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
4339 echo 'changequote([, ])dnl'
4340 echo 'AC_SUBST([LTALLOCA])'
4345 # func_emit_autoconf_snippets modules referenceable_modules verifier toplevel disable_libtool disable_gettext
4346 # collects and emit the autoconf snippets of a set of modules.
4348 # - local_gnulib_path from --local-dir
4349 # - modcache true or false, from --cache-modules/--no-cache-modules
4350 # - sed_replace_build_aux sed expression that replaces reference to build-aux
4351 # - sed_replace_include_guard_prefix
4352 # sed expression for resolving ${gl_include_guard_prefix}
4353 # - modules the list of modules.
4354 # - referenceable_modules the list of modules which may be referenced as dependencies.
4355 # - verifier one of func_verify_module, func_verify_nontests_module,
4356 # func_verify_tests_module. It selects the subset of
4357 # $modules to consider.
4358 # - toplevel true or false. 'false' means a subordinate use of
4360 # - disable_libtool true or false. It tells whether to disable libtool
4361 # handling even if it has been specified through the
4362 # command line options.
4363 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
4365 func_emit_autoconf_snippets
()
4367 referenceable_modules
="$2"
4370 disable_libtool
="$5"
4371 disable_gettext
="$6"
4372 if test "$cond_dependencies" = true
; then
4373 for m
in $referenceable_modules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/modules
4374 # Emit the autoconf code for the unconditional modules.
4375 for module
in $1; do
4377 if test -n "$module"; then
4378 if func_cond_module_p
"$module"; then
4381 func_emit_autoconf_snippet
" "
4385 # Initialize the shell variables indicating that the modules are enabled.
4386 for module
in $1; do
4388 if test -n "$module"; then
4389 if func_cond_module_p
"$module"; then
4390 func_module_shellvar_name
"$module"
4391 echo " $shellvar=false"
4395 # Emit the autoconf code for the conditional modules, each in a separate
4396 # function. This makes it possible to support cycles among conditional
4398 for module
in $1; do
4400 if test -n "$module"; then
4401 if func_cond_module_p
"$module"; then
4402 func_module_shellfunc_name
"$module"
4403 func_module_shellvar_name
"$module"
4404 echo " $shellfunc ()"
4406 echo " if ! \$$shellvar; then"
4407 func_emit_autoconf_snippet
" "
4408 echo " $shellvar=true"
4409 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
4410 # Intersect $deps with the modules list $1.
4411 deps
=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
4412 for dep
in $deps; do
4413 if func_cond_module_p
"$dep"; then
4414 func_module_shellfunc_name
"$dep"
4415 func_cond_module_condition
"$module" "$dep"
4416 if test "$condition" != true
; then
4417 echo " if $condition; then"
4424 # The autoconf code for $dep has already been emitted above and
4425 # therefore is already executed when this function is run.
4434 # Emit the dependencies from the unconditional to the conditional modules.
4435 for module
in $1; do
4437 if test -n "$module"; then
4438 if func_cond_module_p
"$module"; then
4441 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
4442 # Intersect $deps with the modules list $1.
4443 deps
=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
4444 for dep
in $deps; do
4445 if func_cond_module_p
"$dep"; then
4446 func_module_shellfunc_name
"$dep"
4447 func_cond_module_condition
"$module" "$dep"
4448 if test "$condition" != true
; then
4449 echo " if $condition; then"
4456 # The autoconf code for $dep has already been emitted above and
4457 # therefore is already executed when this code is run.
4464 # Define the Automake conditionals.
4465 echo " m4_pattern_allow([^${macro_prefix}_GNULIB_ENABLED_])"
4466 for module
in $1; do
4468 if test -n "$module"; then
4469 if func_cond_module_p
"$module"; then
4470 func_module_conditional_name
"$module"
4471 func_module_shellvar_name
"$module"
4472 echo " AM_CONDITIONAL([$conditional], [\$$shellvar])"
4477 # Ignore the conditions, and enable all modules unconditionally.
4478 for module
in $1; do
4480 if test -n "$module"; then
4481 func_emit_autoconf_snippet
" "
4487 # func_emit_pre_early_macros require indentation modules
4488 # The require parameter can be ':' (AC_REQUIRE) or 'false' (direct call).
4489 func_emit_pre_early_macros
()
4492 echo "${2}# Pre-early section."
4494 _pre_early_snippet
="echo \"${2}AC_REQUIRE([\$_pre_early_macro])\""
4496 _pre_early_snippet
="echo \"${2}\$_pre_early_macro\""
4499 # We need to call gl_USE_SYSTEM_EXTENSIONS before gl_PROG_AR_RANLIB. Doing
4500 # AC_REQUIRE in configure-ac.early is not early enough.
4501 _pre_early_macro
="gl_USE_SYSTEM_EXTENSIONS"
4502 case "${nl}${3}${nl}" in
4503 *${nl}extensions
${nl}*) eval "$_pre_early_snippet" ;;
4506 _pre_early_macro
="gl_PROG_AR_RANLIB"
4507 eval "$_pre_early_snippet"
4511 # func_reconstruct_cached_dir
4512 # callback for func_reconstruct_cached_local_gnulib_path
4514 # - destdir from --dir
4516 # - local_gnulib_path restored '--local-dir' path from cache
4517 func_reconstruct_cached_dir
()
4520 if test -n "$cached_dir"; then
4523 func_path_append local_gnulib_path
"$destdir/$cached_dir" ;;
4525 case "$cached_dir" in
4527 func_path_append local_gnulib_path
"$destdir/$cached_dir" ;;
4529 func_relconcat
"$destdir" "$cached_dir"
4530 func_path_append local_gnulib_path
"$relconcat" ;;
4536 # func_reconstruct_cached_local_gnulib_path
4537 # reconstruct local_gnulib_path from cached_local_gnulib_path to be set
4538 # relatively to $destdir again.
4540 # - cached_local_gnulib_path local_gnulib_path stored within gnulib-cache.m4
4541 # - destdir from --dir
4543 # - local_gnulib_path restored '--local-dir' path from cache
4544 func_reconstruct_cached_local_gnulib_path
()
4546 func_path_foreach
"$cached_local_gnulib_path" func_reconstruct_cached_dir
%dir
%
4549 # func_import modules
4550 # Uses also the variables
4551 # - mode import or add-import or remove-import or update
4552 # - destdir target directory
4553 # - local_gnulib_path from --local-dir
4554 # - modcache true or false, from --cache-modules/--no-cache-modules
4555 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
4556 # - libname library name
4557 # - supplied_libname true if --lib was given, blank otherwise
4558 # - sourcebase directory relative to destdir where to place source code
4559 # - m4base directory relative to destdir where to place *.m4 macros
4560 # - pobase directory relative to destdir where to place *.po files
4561 # - docbase directory relative to destdir where to place doc files
4562 # - testsbase directory relative to destdir where to place unit test code
4563 # - auxdir directory relative to destdir where to place build aux files
4564 # - inctests true if --with-tests was given, false otherwise
4565 # - incobsolete true if --with-obsolete was given, blank otherwise
4566 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
4567 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
4569 # - inc_privileged_tests true if --with-privileged-tests was given, blank
4571 # - inc_unportable_tests true if --with-unportable-tests was given, blank
4573 # - inc_all_tests true if --with-all-tests was given, blank otherwise
4574 # - avoidlist list of modules to avoid, from --avoid
4575 # - cond_dependencies true if --conditional-dependencies was given, false if
4576 # --no-conditional-dependencies was given, blank otherwise
4577 # - lgpl yes or a number if library's license shall be LGPL,
4579 # - makefile_name from --makefile-name
4580 # - libtool true if --libtool was given, false if --no-libtool was
4581 # given, blank otherwise
4582 # - guessed_libtool true if the configure.ac file uses libtool, false otherwise
4583 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4584 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
4585 # - witness_c_macro from --witness-c-macro
4586 # - vc_files true if --vc-files was given, false if --no-vc-files was
4587 # given, blank otherwise
4588 # - autoconf_minversion minimum supported autoconf version
4589 # - doit : if actions shall be executed, false if only to be printed
4590 # - copymode copy mode for files in general
4591 # - lcopymode copy mode for files from local_gnulib_path
4592 # - do_copyrights true if copyright notices in files should be replaced,
4596 # Get the cached settings.
4597 # In 'import' mode, we read them only for the purpose of knowing the old
4598 # installed file list, and don't use them as defaults.
4599 cached_local_gnulib_path
=
4600 cached_specified_modules
=
4602 cached_inc_cxx_tests
=
4603 cached_inc_longrunning_tests
=
4604 cached_inc_privileged_tests
=
4605 cached_inc_unportable_tests
=
4606 cached_inc_all_tests
=
4616 cached_makefile_name
=
4617 cached_cond_dependencies
=
4619 cached_macro_prefix
=
4621 cached_witness_c_macro
=
4624 if test -f "$destdir"/$m4base/gnulib-cache.
m4; then
4625 cached_libtool
=false
4631 s,^.*gl_LOCAL_DIR([[ ]*\([^]"$`\\)]*\).*$,cached_local_gnulib_path="\1",p
4641 s,^.*gl_MODULES([[ ]*\([^]"$`\\)]*\).*$,cached_specified_modules="\1",p
4643 /gl_WITH_OBSOLETE/ {
4644 s,^.*$,cached_incobsolete=true,p
4646 /gl_WITH_CXX_TESTS/ {
4647 s,^.*$,cached_inc_cxx_tests=true,p
4649 /gl_WITH_LONGRUNNING_TESTS/ {
4650 s,^.*$,cached_inc_longrunning_tests=true,p
4652 /gl_WITH_PRIVILEGED_TESTS/ {
4653 s,^.*$,cached_inc_privileged_tests=true,p
4655 /gl_WITH_UNPORTABLE_TESTS/ {
4656 s,^.*$,cached_inc_unportable_tests=true,p
4658 /gl_WITH_ALL_TESTS/ {
4659 s,^.*$,cached_inc_all_tests=true,p
4662 s,^.*gl_AVOID([[ ]*\([^]"$`\\)]*\).*$,cached_avoidlist="\1",p
4665 s,^.*gl_SOURCE_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_sourcebase="\1",p
4668 s,^.*gl_M4_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_m4base="\1",p
4671 s,^.*gl_PO_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_pobase="\1",p
4674 s,^.*gl_DOC_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_docbase="\1",p
4677 s,^.*gl_TESTS_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_testsbase="\1",p
4680 s,^.*$,cached_inctests=true,p
4683 s,^.*gl_LIB([[ ]*\([^]"$`\\)]*\).*$,cached_libname="\1",p
4686 s,^.*gl_LGPL([[ ]*\([^]"$`\\)]*\).*$,cached_lgpl="\1",p
4689 s,^.*$,cached_lgpl=yes,p
4691 /gl_MAKEFILE_NAME(/ {
4692 s,^.*gl_MAKEFILE_NAME([[ ]*\([^]"$`\\)]*\).*$,cached_makefile_name="\1",p
4694 /gl_CONDITIONAL_DEPENDENCIES/ {
4695 s,^.*$,cached_cond_dependencies=true,p
4698 s,^.*$,cached_libtool=true,p
4700 /gl_MACRO_PREFIX(/ {
4701 s,^.*gl_MACRO_PREFIX([[ ]*\([^]"$`\\)]*\).*$,cached_macro_prefix="\1",p
4704 s,^.*gl_PO_DOMAIN([[ ]*\([^]"$`\\)]*\).*$,cached_po_domain="\1",p
4706 /gl_WITNESS_C_MACRO(/ {
4707 s,^.*gl_WITNESS_C_MACRO([[ ]*\([^]"$`\\)]*\).*$,cached_witness_c_macro="\1",p
4710 s,^.*gl_VC_FILES([[ ]*\([^]"$`\\)]*\).*$,cached_vc_files="\1",p
4712 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-cache.m4`
4713 if test -f "$destdir"/$m4base/gnulib-comp.
m4; then
4718 /AC_DEFUN(\['"${cached_macro_prefix}"'_FILE_LIST\], \[/ {
4719 s,^.*$,cached_files=",p
4732 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-comp.m4`
4736 if test "$mode" = import
; then
4737 # In 'import' mode, the new set of specified modules overrides the cached
4738 # set of modules. Ignore the cached settings.
4739 specified_modules
="$1"
4741 # Merge the cached settings with the specified ones.
4742 # The m4base must be the same as expected from the pathname.
4743 if test -n "$cached_m4base" && test "$cached_m4base" != "$m4base"; then
4744 func_fatal_error
"$m4base/gnulib-cache.m4 is expected to contain gl_M4_BASE([$m4base])"
4746 # The local_gnulib_path defaults to the cached one. Recall that the cached one
4747 # is relative to $destdir, whereas the one we use is relative to . or absolute.
4748 if test -z "$local_gnulib_path"; then
4749 func_reconstruct_cached_local_gnulib_path
4753 # Append the cached and the specified module names. So that
4754 # "gnulib-tool --add-import foo" means to add the module foo.
4755 specified_modules
="$cached_specified_modules $1"
4758 # Take the cached module names, minus the specified module names.
4760 if $have_associative; then
4761 # Use an associative array, for O(N) worst-case run time.
4762 declare -A to_remove
4764 eval 'to_remove[$m]=yes'
4766 for module
in $cached_specified_modules; do
4767 if eval 'test -z "${to_remove[$module]}"'; then
4768 func_append specified_modules
"$module "
4772 # This loop has O(N**2) worst-case run time.
4773 for module
in $cached_specified_modules; do
4776 if test "$m" = "$module"; then
4781 if test -z "$to_remove"; then
4782 func_append specified_modules
"$module "
4788 # Take the cached module names. There are no specified module names.
4789 specified_modules
="$cached_specified_modules"
4792 # Included obsolete modules among the dependencies if specified either way.
4793 if test -z "$incobsolete"; then
4794 incobsolete
="$cached_incobsolete"
4796 # Included special kinds of tests modules among the dependencies if specified
4798 if test -z "$inc_cxx_tests"; then
4799 inc_cxx_tests
="$cached_inc_cxx_tests"
4801 if test -z "$inc_longrunning_tests"; then
4802 inc_longrunning_tests
="$cached_inc_longrunning_tests"
4804 if test -z "$inc_privileged_tests"; then
4805 inc_privileged_tests
="$cached_inc_privileged_tests"
4807 if test -z "$inc_unportable_tests"; then
4808 inc_unportable_tests
="$cached_inc_unportable_tests"
4810 if test -z "$inc_all_tests"; then
4811 inc_all_tests
="$cached_inc_all_tests"
4813 # Append the cached and the specified avoidlist. This is probably better
4814 # than dropping the cached one when --avoid is specified at least once.
4815 avoidlist
=`for m in $cached_avoidlist $avoidlist; do echo $m; done | LC_ALL=C sort -u`
4816 avoidlist
=`echo $avoidlist`
4818 # The sourcebase defaults to the cached one.
4819 if test -z "$sourcebase"; then
4820 sourcebase
="$cached_sourcebase"
4821 if test -z "$sourcebase"; then
4822 func_fatal_error
"missing --source-base option"
4825 # The pobase defaults to the cached one.
4826 if test -z "$pobase"; then
4827 pobase
="$cached_pobase"
4829 # The docbase defaults to the cached one.
4830 if test -z "$docbase"; then
4831 docbase
="$cached_docbase"
4832 if test -z "$docbase"; then
4833 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."
4836 # The testsbase defaults to the cached one.
4837 if test -z "$testsbase"; then
4838 testsbase
="$cached_testsbase"
4839 if test -z "$testsbase"; then
4840 func_fatal_error
"missing --tests-base option"
4843 # Require the tests if specified either way.
4844 if ! $inctests; then
4845 inctests
="$cached_inctests"
4846 if test -z "$inctests"; then
4850 # The libname defaults to the cached one.
4851 if test -z "$supplied_libname"; then
4852 libname
="$cached_libname"
4853 if test -z "$libname"; then
4854 func_fatal_error
"missing --lib option"
4857 # Require LGPL if specified either way.
4858 if test -z "$lgpl"; then
4861 # The makefile_name defaults to the cached one.
4862 if test -z "$makefile_name"; then
4863 makefile_name
="$cached_makefile_name"
4865 # Use conditional dependencies if specified either way.
4866 if test -z "$cond_dependencies"; then
4867 cond_dependencies
="$cached_cond_dependencies"
4869 # Use libtool if specified either way, or if guessed.
4870 if test -z "$libtool"; then
4871 if test -n "$cached_m4base"; then
4872 libtool
="$cached_libtool"
4874 libtool
="$guessed_libtool"
4877 # The macro_prefix defaults to the cached one.
4878 if test -z "$macro_prefix"; then
4879 macro_prefix
="$cached_macro_prefix"
4880 if test -z "$macro_prefix"; then
4881 func_fatal_error
"missing --macro-prefix option"
4884 # The po_domain defaults to the cached one.
4885 if test -z "$po_domain"; then
4886 po_domain
="$cached_po_domain"
4888 # The witness_c_macro defaults to the cached one.
4889 if test -z "$witness_c_macro"; then
4890 witness_c_macro
="$cached_witness_c_macro"
4892 # The vc_files defaults to the cached one.
4893 if test -z "$vc_files"; then
4894 vc_files
="$cached_vc_files"
4896 # Ensure constraints.
4897 if test "$cond_dependencies" = true
&& $inctests; then
4898 echo "gnulib-tool: option --conditional-dependencies is not supported with --with-tests" 1>&2
4902 # --without-*-tests options are not supported here.
4904 excl_longrunning_tests
=
4905 excl_privileged_tests
=
4906 excl_unportable_tests
=
4908 # Canonicalize the list of specified modules.
4909 specified_modules
=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
4911 # Include all kinds of tests modules if --with-all-tests was specified.
4912 inc_all_direct_tests
="$inc_all_tests"
4913 inc_all_indirect_tests
="$inc_all_tests"
4915 # Determine final module list.
4916 modules
="$specified_modules"
4917 func_modules_transitive_closure
4918 if test $verbose -ge 0; then
4919 func_show_module_list
4921 final_modules
="$modules"
4923 # Determine main module list and tests-related module list separately.
4924 func_modules_transitive_closure_separately
4926 # Determine whether a $testsbase/libtests.a is needed.
4927 func_determine_use_libtests
4929 # Add the dummy module to the main module list or to the tests-related module
4931 func_modules_add_dummy_separately
4933 # If --lgpl, verify that the licenses of modules are compatible.
4934 if test -n "$lgpl"; then
4935 license_incompatibilities
=
4936 for module
in $main_modules; do
4937 license
=`func_get_license $module`
4939 'GPLed build tool') ;;
4940 'public domain' |
'unlimited' |
'unmodifiable license text') ;;
4945 LGPLv2
+ |
'LGPLv3+ or GPLv2' | LGPLv3
+ | LGPL
) ;;
4946 *) func_append license_incompatibilities
"$module $license$nl" ;;
4951 LGPLv2
+ |
'LGPLv3+ or GPLv2') ;;
4952 *) func_append license_incompatibilities
"$module $license$nl" ;;
4958 *) func_append license_incompatibilities
"$module $license$nl" ;;
4961 *) func_fatal_error
"invalid value lgpl=$lgpl" ;;
4966 if test -n "$license_incompatibilities"; then
4967 # Format the license incompatibilities as a table.
4968 sed_expand_column1_width50_indent17
='s,^\([^ ]*\) ,\1 ,
4969 s,^\(.................................................[^ ]*\) *, \1 ,'
4970 license_incompatibilities
=`echo "$license_incompatibilities" | sed -e "$sed_expand_column1_width50_indent17"`
4971 func_fatal_error
"incompatible license on modules:$nl$license_incompatibilities"
4975 # Show banner notice of every module.
4976 modules
="$main_modules"
4979 # Determine script to apply to imported library files.
4980 sed_transform_lib_file
=
4981 for module
in $main_modules; do
4982 if test $module = config-h
; then
4983 # Assume config.h exists, and that -DHAVE_CONFIG_H is omitted.
4984 sed_transform_lib_file
=$sed_transform_lib_file'
4985 s/^#ifdef[ ]*HAVE_CONFIG_H[ ]*$/#if 1/
4990 sed_transform_main_lib_file
="$sed_transform_lib_file"
4991 if test -n "$do_copyrights"; then
4992 if test -n "$lgpl"; then
4996 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
4997 s/GNU General/GNU Lesser General/g
4998 s/General Public License/Lesser General Public License/g
4999 s/Lesser Lesser General Public License/Lesser General Public License/g
5003 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
5004 /^ *This program is free software/i\
5005 This program is free software: you can redistribute it and\/or\
5006 modify it under the terms of either:\
5008 * the GNU Lesser General Public License as published by the Free\
5009 Software Foundation; either version 3 of the License, or (at your\
5010 option) any later version.\
5014 * the GNU General Public License as published by the Free\
5015 Software Foundation; either version 2 of the License, or (at your\
5016 option) any later version.\
5018 or both in parallel, as here.
5019 /^ *This program is free software/,/^$/d
5023 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
5024 s/GNU General/GNU Lesser General/g
5025 s/General Public License/Lesser General Public License/g
5026 s/Lesser Lesser General Public License/Lesser General Public License/g
5028 s/version [23]\([ ,]\)/version 2.1\1/g
5031 *) func_fatal_error
"invalid value lgpl=$lgpl" ;;
5035 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
5036 s/GNU Lesser General/GNU General/g
5037 s/Lesser General Public License/General Public License/g
5039 s/GNU Library General/GNU General/g
5040 s/Library General Public License/General Public License/g
5042 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
5047 # Determine script to apply to auxiliary files that go into $auxdir/.
5048 sed_transform_build_aux_file
=
5049 if test -n "$do_copyrights"; then
5051 sed_transform_build_aux_file
=$sed_transform_build_aux_file'
5052 s/GNU Lesser General/GNU General/g
5053 s/Lesser General Public License/General Public License/g
5055 s/GNU Library General/GNU General/g
5056 s/Library General Public License/General Public License/g
5058 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
5062 # Determine script to apply to library files that go into $testsbase/.
5063 sed_transform_testsrelated_lib_file
="$sed_transform_lib_file"
5064 if test -n "$do_copyrights"; then
5066 sed_transform_testsrelated_lib_file
=$sed_transform_testsrelated_lib_file'
5067 s/GNU Lesser General/GNU General/g
5068 s/Lesser General Public License/General Public License/g
5070 s/GNU Library General/GNU General/g
5071 s/Library General Public License/General Public License/g
5073 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
5077 # Determine the final file lists.
5078 func_modules_to_filelist_separately
5081 || func_fatal_error
"refusing to do nothing"
5083 # Add m4/gnulib-tool.m4 to the file list. It is not part of any module.
5084 new_files
="$files m4/gnulib-tool.m4"
5085 old_files
="$cached_files"
5086 if test -f "$destdir"/$m4base/gnulib-tool.
m4; then
5087 func_append old_files
" m4/gnulib-tool.m4"
5090 rewritten
='%REWRITTEN%'
5091 sed_rewrite_old_files
="\
5092 s,^build-aux/,$rewritten$auxdir/,
5093 s,^doc/,$rewritten$cached_docbase/,
5094 s,^lib/,$rewritten$cached_sourcebase/,
5095 s,^m4/,$rewritten$cached_m4base/,
5096 s,^tests/,$rewritten$cached_testsbase/,
5097 s,^tests=lib/,$rewritten$cached_testsbase/,
5100 sed_rewrite_new_files
="\
5101 s,^build-aux/,$rewritten$auxdir/,
5102 s,^doc/,$rewritten$docbase/,
5103 s,^lib/,$rewritten$sourcebase/,
5104 s,^m4/,$rewritten$m4base/,
5105 s,^tests/,$rewritten$testsbase/,
5106 s,^tests=lib/,$rewritten$testsbase/,
5110 # Determine whether to put anything into $testsbase.
5111 testsfiles
=`echo "$files" | sed -n -e 's,^tests/,,p' -e 's,^tests=lib/,,p'`
5112 if test -n "$testsfiles"; then
5118 # Create directories.
5119 { echo "$sourcebase"
5121 if test -n "$pobase"; then
5124 docfiles
=`echo "$files" | sed -n -e 's,^doc/,,p'`
5125 if test -n "$docfiles"; then
5132 for f
in $files; do echo $f; done \
5133 |
sed -e "$sed_rewrite_new_files" \
5134 |
sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
5137 { # Rearrange file descriptors. Needed because "while ... done < ..."
5138 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5139 exec 5<&0 < "$tmp"/dirs
5141 if test ! -d "$destdir/$d"; then
5143 echo "Creating directory $destdir/$d"
5144 mkdir
-p "$destdir/$d" || func_fatal_error
"failed"
5146 echo "Create directory $destdir/$d"
5153 # Copy files or make symbolic links or hard links. Remove obsolete files.
5157 # Construct a table with 2 columns: rewritten-file-name original-file-name,
5158 # representing the files according to the last gnulib-tool invocation.
5159 for f
in $old_files; do echo $f; done \
5160 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_old_files" \
5163 # Construct a table with 2 columns: rewritten-file-name original-file-name,
5164 # representing the files after this gnulib-tool invocation.
5165 for f
in $new_files; do echo $f; done \
5166 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" \
5169 # First the files that are in old-files, but not in new-files:
5170 sed_take_first_column
='s,'"$delimiter"'.*,,'
5171 for g
in `LC_ALL=C join -t"$delimiter" -v1 "$tmp"/old-files "$tmp"/new-files | sed -e "$sed_take_first_column"`; do
5172 # Remove the file. Do nothing if the user already removed it.
5173 if test -f "$destdir/$g" ||
test -h "$destdir/$g"; then
5175 echo "Removing file $g (backup in ${g}~)"
5176 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error
"failed"
5178 echo "Remove file $g (backup in ${g}~)"
5180 func_append removed_files
"$g$nl"
5183 # func_add_or_update handles a file that ought to be present afterwards.
5185 # - f the original file name
5186 # - g the rewritten file name
5187 # - already_present nonempty if the file should already exist, empty
5189 func_add_or_update
()
5193 tests
=lib
/*) f
=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
5195 func_dest_tmpfilename
"$g"
5196 func_lookup_file
"$f"
5197 cp "$lookedup_file" "$tmpfile" || func_fatal_error
"failed"
5200 # Don't process binary files with sed.
5203 if test -n "$sed_transform_main_lib_file"; then
5206 sed -e "$sed_transform_main_lib_file" \
5207 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
5211 if test -n "$sed_transform_build_aux_file"; then
5214 sed -e "$sed_transform_build_aux_file" \
5215 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
5219 if test -n "$sed_transform_testsrelated_lib_file"; then
5222 sed -e "$sed_transform_testsrelated_lib_file" \
5223 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
5229 if test -f "$destdir/$g"; then
5230 # The file already exists.
5234 # Don't protest if the file should be there but isn't: it happens
5235 # frequently that developers don't put autogenerated files under version control.
5237 func_append added_files
"$g$nl"
5241 # Then the files that are in new-files, but not in old-files:
5242 sed_take_last_column
='s,^.*'"$delimiter"',,'
5244 LC_ALL
=C
join -t"$delimiter" -v2 "$tmp"/old-files
"$tmp"/new-files \
5245 |
sed -e "$sed_take_last_column" \
5246 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/added-files
5247 { # Rearrange file descriptors. Needed because "while ... done < ..."
5248 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5249 exec 5<&0 < "$tmp"/added-files
5255 # Then the files that are in new-files and in old-files:
5256 already_present
=true
5257 LC_ALL
=C
join -t"$delimiter" "$tmp"/old-files
"$tmp"/new-files \
5258 |
sed -e "$sed_take_last_column" \
5259 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/kept-files
5260 { # Rearrange file descriptors. Needed because "while ... done < ..."
5261 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5262 exec 5<&0 < "$tmp"/kept-files
5269 # Command-line invocation printed in a comment in generated gnulib-cache.m4.
5270 actioncmd
="# gnulib-tool --import"
5273 func_append_local_dir
()
5275 func_append
"$1" " --local-dir=$2"
5277 func_path_foreach
"$local_gnulib_path" func_append_local_dir actioncmd
%dir
%
5279 # Break the action command log into multiple lines.
5280 # Emacs puts some gnulib-tool log lines in its source repository, and
5281 # git send-email rejects patch lines longer than 998 characters.
5282 # Also, config.status uses awk, and the HP-UX 11.00 awk fails if a
5283 # line has length >= 3071; similarly, the IRIX 6.5 awk fails if a
5284 # line has length >= 3072.
5285 func_append_actionarg
()
5287 func_append actioncmd
" \\$nl# $1"
5289 func_append_actionarg
"--lib=$libname"
5290 func_append_actionarg
"--source-base=$sourcebase"
5291 func_append_actionarg
"--m4-base=$m4base"
5292 if test -n "$pobase"; then
5293 func_append_actionarg
"--po-base=$pobase"
5295 func_append_actionarg
"--doc-base=$docbase"
5296 func_append_actionarg
"--tests-base=$testsbase"
5297 func_append_actionarg
"--aux-dir=$auxdir"
5299 func_append_actionarg
"--with-tests"
5301 if test -n "$incobsolete"; then
5302 func_append_actionarg
"--with-obsolete"
5304 if test -n "$inc_cxx_tests"; then
5305 func_append_actionarg
"--with-c++-tests"
5307 if test -n "$inc_longrunning_tests"; then
5308 func_append_actionarg
"--with-longrunning-tests"
5310 if test -n "$inc_privileged_tests"; then
5311 func_append_actionarg
"--with-privileged-tests"
5313 if test -n "$inc_unportable_tests"; then
5314 func_append_actionarg
"--with-unportable-tests"
5316 if test -n "$inc_all_tests"; then
5317 func_append_actionarg
"--with-all-tests"
5319 if test -n "$lgpl"; then
5320 if test "$lgpl" = yes; then
5321 func_append_actionarg
"--lgpl"
5323 func_append_actionarg
"--lgpl=$lgpl"
5327 func_append_actionarg
"--gnu-make"
5329 if test -n "$makefile_name"; then
5330 func_append_actionarg
"--makefile-name=$makefile_name"
5332 if test "$cond_dependencies" = true
; then
5333 func_append_actionarg
"--conditional-dependencies"
5335 func_append_actionarg
"--no-conditional-dependencies"
5337 if test "$libtool" = true
; then
5338 func_append_actionarg
"--libtool"
5340 func_append_actionarg
"--no-libtool"
5342 func_append_actionarg
"--macro-prefix=$macro_prefix"
5343 if test -n "$po_domain"; then
5344 func_append_actionarg
"--po-domain=$po_domain"
5346 if test -n "$witness_c_macro"; then
5347 func_append_actionarg
"--witness-c-macro=$witness_c_macro"
5349 if test -n "$vc_files"; then
5350 if test "$vc_files" = true
; then
5351 func_append_actionarg
"--vc-files"
5353 func_append_actionarg
"--no-vc-files"
5356 for module
in $avoidlist; do
5357 func_append_actionarg
"--avoid=$module"
5359 for module
in $specified_modules; do
5360 func_append_actionarg
"$module"
5363 # Determine include_guard_prefix.
5364 func_compute_include_guard_prefix
5366 # Default the makefile name to Makefile.am.
5367 if test -n "$makefile_name"; then
5368 makefile_am
=$makefile_name
5370 makefile_am
=Makefile.am
5373 # Create normal Makefile.ams.
5376 # Setup list of Makefile.am edits that are to be performed afterwards.
5377 # Some of these edits apply to files that we will generate; others are
5378 # under the responsibility of the developer.
5380 # func_note_Makefile_am_edit dir var value [dotfirst]
5381 # remembers that ${dir}Makefile.am needs to be edited to that ${var} mentions
5383 # If ${dotfirst} is non-empty, this mention needs to be present after '.'.
5384 # This is a special hack for the SUBDIRS variable, cf.
5385 # <https://www.gnu.org/software/automake/manual/html_node/Subdirectories.html>.
5386 func_note_Makefile_am_edit
()
5388 makefile_am_edits
=`expr $makefile_am_edits + 1`
5389 eval makefile_am_edit
${makefile_am_edits}_dir
=\"\
$1\"
5390 eval makefile_am_edit
${makefile_am_edits}_var
=\"\
$2\"
5391 eval makefile_am_edit
${makefile_am_edits}_val
=\"\
$3\"
5392 eval makefile_am_edit
${makefile_am_edits}_dotfirst
=\"\
$4\"
5394 if test "$makefile_am" = Makefile.am
; then
5395 sourcebase_dir
=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'`
5396 sourcebase_base
=`basename "$sourcebase"`
5397 func_note_Makefile_am_edit
"$sourcebase_dir" SUBDIRS
"$sourcebase_base"
5399 if test -n "$pobase"; then
5400 pobase_dir
=`echo "$pobase" | sed -n -e 's,/[^/]*$,/,p'`
5401 pobase_base
=`basename "$pobase"`
5402 func_note_Makefile_am_edit
"$pobase_dir" SUBDIRS
"$pobase_base"
5405 if test "$makefile_am" = Makefile.am
; then
5406 testsbase_dir
=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'`
5407 testsbase_base
=`basename "$testsbase"`
5408 func_note_Makefile_am_edit
"$testsbase_dir" SUBDIRS
"$testsbase_base" true
5411 func_note_Makefile_am_edit
"" ACLOCAL_AMFLAGS
"-I ${m4base}"
5413 # Find the first parent directory of $m4base that contains or will contain
5415 sed_last
='s,^.*/\([^/][^/]*\)//*$,\1/,
5417 sed_butlast
='s,[^/][^/]*//*$,,'
5418 dir1
="${m4base}/"; dir2
=""
5419 while test -n "$dir1" \
5420 && ! { test -f "${destdir}/${dir1}Makefile.am" \
5421 ||
test "${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
5422 ||
test "./${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
5424 && { test "${dir1}Makefile.am" = "$testsbase/$makefile_am" \
5425 ||
test "./${dir1}Makefile.am" = "$testsbase/$makefile_am"; }; }; }; do
5426 dir2
=`echo "$dir1" | sed -e "$sed_last"`"$dir2"
5427 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
5429 func_note_Makefile_am_edit
"$dir1" EXTRA_DIST
"${dir2}gnulib-cache.m4"
5432 # Create library makefile.
5433 func_dest_tmpfilename
$sourcebase/$makefile_am
5434 destfile
="$sourcebase/$makefile_am"
5435 modules
="$main_modules"
5436 func_emit_lib_Makefile_am
> "$tmpfile"
5437 if test -f "$destdir"/$sourcebase/$makefile_am; then
5438 if cmp -s "$destdir"/$sourcebase/$makefile_am "$tmpfile"; then
5442 echo "Updating $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
5443 mv -f "$destdir"/$sourcebase/$makefile_am "$destdir"/$sourcebase/$makefile_am~
5444 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
5446 echo "Update $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
5452 echo "Creating $sourcebase/$makefile_am"
5453 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
5455 echo "Create $sourcebase/$makefile_am"
5458 func_append added_files
"$sourcebase/$makefile_am$nl"
5461 # Create po/ directory.
5462 if test -n "$pobase"; then
5463 # Create po makefile and auxiliary files.
5464 for file in Makefile.
in.
in remove-potcdate.sin
; do
5465 func_dest_tmpfilename
$pobase/$file
5466 func_lookup_file build-aux
/po
/$file
5467 cat "$lookedup_file" > "$tmpfile"
5468 if test -f "$destdir"/$pobase/$file; then
5469 if cmp -s "$destdir"/$pobase/$file "$tmpfile"; then
5473 echo "Updating $pobase/$file (backup in $pobase/$file~)"
5474 mv -f "$destdir"/$pobase/$file "$destdir"/$pobase/$file~
5475 mv -f "$tmpfile" "$destdir"/$pobase/$file
5477 echo "Update $pobase/$file (backup in $pobase/$file~)"
5483 echo "Creating $pobase/$file"
5484 mv -f "$tmpfile" "$destdir"/$pobase/$file
5486 echo "Create $pobase/$file"
5489 func_append added_files
"$pobase/$file$nl"
5492 # Create po makefile parameterization, part 1.
5493 func_dest_tmpfilename
$pobase/Makevars
5494 func_emit_po_Makevars
> "$tmpfile"
5495 if test -f "$destdir"/$pobase/Makevars
; then
5496 if cmp -s "$destdir"/$pobase/Makevars
"$tmpfile"; then
5500 echo "Updating $pobase/Makevars (backup in $pobase/Makevars~)"
5501 mv -f "$destdir"/$pobase/Makevars
"$destdir"/$pobase/Makevars~
5502 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
5504 echo "Update $pobase/Makevars (backup in $pobase/Makevars~)"
5510 echo "Creating $pobase/Makevars"
5511 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
5513 echo "Create $pobase/Makevars"
5516 func_append added_files
"$pobase/Makevars$nl"
5518 # Create po makefile parameterization, part 2.
5519 func_dest_tmpfilename
$pobase/POTFILES.
in
5520 func_emit_po_POTFILES_in
> "$tmpfile"
5521 if test -f "$destdir"/$pobase/POTFILES.
in; then
5522 if cmp -s "$destdir"/$pobase/POTFILES.
in "$tmpfile"; then
5526 echo "Updating $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
5527 mv -f "$destdir"/$pobase/POTFILES.
in "$destdir"/$pobase/POTFILES.
in~
5528 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.
in
5530 echo "Update $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
5536 echo "Creating $pobase/POTFILES.in"
5537 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.
in
5539 echo "Create $pobase/POTFILES.in"
5542 func_append added_files
"$pobase/POTFILES.in$nl"
5545 TP_URL
="https://translationproject.org/latest/"
5547 echo "Fetching gnulib PO files from $TP_URL"
5548 (cd "$destdir"/$pobase \
5549 && wget
--no-verbose --mirror --level=1 -nd -A.po
-P .
"${TP_URL}gnulib/"
5552 echo "Fetch gnulib PO files from $TP_URL"
5554 # Create po/LINGUAS.
5556 func_dest_tmpfilename
$pobase/LINGUAS
5557 (cd "$destdir"/$pobase \
5558 && { echo '# Set of available languages.'
5559 LC_ALL
=C
ls -1 *.po |
sed -e 's,\.po$,,'
5562 if test -f "$destdir"/$pobase/LINGUAS
; then
5563 if cmp -s "$destdir"/$pobase/LINGUAS
"$tmpfile"; then
5566 echo "Updating $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
5567 mv -f "$destdir"/$pobase/LINGUAS
"$destdir"/$pobase/LINGUAS~
5568 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
5571 echo "Creating $pobase/LINGUAS"
5572 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
5573 func_append added_files
"$pobase/LINGUAS$nl"
5576 if test -f "$destdir"/$pobase/LINGUAS
; then
5577 echo "Update $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
5579 echo "Create $pobase/LINGUAS"
5584 # func_count_relative_local_gnulib_path
5585 # gl_LOCAL_DIR requires local_gnulib_path to be set relatively to destdir
5587 # - local_gnulib_path from --local-dir
5588 # - destdir from --dir
5590 # - relative_local_dir path to be stored into gl_LOCAL_DIR
5591 func_count_relative_local_gnulib_path
()
5593 relative_local_gnulib_path
=
5595 IFS
="$PATH_SEPARATOR"
5596 for local_dir
in $local_gnulib_path
5599 # Store the local_dir relative to destdir.
5600 case "$local_dir" in
5602 relative_local_dir
="$local_dir" ;;
5605 /*) relative_local_dir
="$local_dir" ;;
5607 # destdir, local_dir are both relative.
5608 func_relativize
"$destdir" "$local_dir"
5609 relative_local_dir
="$reldir" ;;
5612 func_path_append relative_local_gnulib_path
"$relative_local_dir"
5617 # Create m4/gnulib-cache.m4.
5618 func_dest_tmpfilename
$m4base/gnulib-cache.
m4
5620 func_emit_copyright_notice
5622 echo "# This file represents the specification of how gnulib-tool is used."
5623 echo "# It acts as a cache: It is written and read by gnulib-tool."
5624 echo "# In projects that use version control, this file is meant to be put under"
5625 echo "# version control, like the configure.ac and various Makefile.am files."
5628 echo "# Specification in the form of a command-line invocation:"
5629 printf '%s\n' "$actioncmd"
5631 echo "# Specification in the form of a few gnulib-tool.m4 macro invocations:"
5632 func_count_relative_local_gnulib_path
5633 echo "gl_LOCAL_DIR([$relative_local_gnulib_path])"
5635 echo "$specified_modules" |
sed -e 's/^/ /g'
5637 test -z "$incobsolete" ||
echo "gl_WITH_OBSOLETE"
5638 test -z "$inc_cxx_tests" ||
echo "gl_WITH_CXX_TESTS"
5639 test -z "$inc_longrunning_tests" ||
echo "gl_WITH_LONGRUNNING_TESTS"
5640 test -z "$inc_privileged_tests" ||
echo "gl_WITH_PRIVILEGED_TESTS"
5641 test -z "$inc_unportable_tests" ||
echo "gl_WITH_UNPORTABLE_TESTS"
5642 test -z "$inc_all_tests" ||
echo "gl_WITH_ALL_TESTS"
5643 echo "gl_AVOID([$avoidlist])"
5644 echo "gl_SOURCE_BASE([$sourcebase])"
5645 echo "gl_M4_BASE([$m4base])"
5646 echo "gl_PO_BASE([$pobase])"
5647 echo "gl_DOC_BASE([$docbase])"
5648 echo "gl_TESTS_BASE([$testsbase])"
5650 echo "gl_WITH_TESTS"
5652 echo "gl_LIB([$libname])"
5653 if test -n "$lgpl"; then
5654 if test "$lgpl" = yes; then
5657 echo "gl_LGPL([$lgpl])"
5660 echo "gl_MAKEFILE_NAME([$makefile_name])"
5661 if test "$cond_dependencies" = true
; then
5662 echo "gl_CONDITIONAL_DEPENDENCIES"
5664 if test "$libtool" = true
; then
5667 echo "gl_MACRO_PREFIX([$macro_prefix])"
5668 echo "gl_PO_DOMAIN([$po_domain])"
5669 echo "gl_WITNESS_C_MACRO([$witness_c_macro])"
5670 if test -n "$vc_files"; then
5671 echo "gl_VC_FILES([$vc_files])"
5674 if test -f "$destdir"/$m4base/gnulib-cache.
m4; then
5675 if cmp -s "$destdir"/$m4base/gnulib-cache.
m4 "$tmpfile"; then
5679 echo "Updating $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
5680 mv -f "$destdir"/$m4base/gnulib-cache.
m4 "$destdir"/$m4base/gnulib-cache.
m4~
5681 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.
m4
5683 echo "Update $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
5687 echo "# gnulib-cache.m4 ends here"
5694 echo "Creating $m4base/gnulib-cache.m4"
5695 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.
m4
5697 echo "Create $m4base/gnulib-cache.m4"
5703 # Create m4/gnulib-comp.m4.
5704 func_dest_tmpfilename
$m4base/gnulib-comp.
m4
5706 echo "# DO NOT EDIT! GENERATED AUTOMATICALLY!"
5707 func_emit_copyright_notice
5709 echo "# This file represents the compiled summary of the specification in"
5710 echo "# gnulib-cache.m4. It lists the computed macro invocations that need"
5711 echo "# to be invoked from configure.ac."
5712 echo "# In projects that use version control, this file can be treated like"
5713 echo "# other built files."
5716 echo "# This macro should be invoked from $configure_ac, in the section"
5717 echo "# \"Checks for programs\", right after AC_PROG_CC, and certainly before"
5718 echo "# any checks for libraries, header files, types and library functions."
5719 echo "AC_DEFUN([${macro_prefix}_EARLY],"
5721 echo " m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
5722 echo " m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
5723 echo " m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
5724 echo " m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
5726 func_emit_pre_early_macros
: ' ' "$final_modules"
5728 if ! $gnu_make && test -n "$uses_subdirs"; then
5729 echo " AC_REQUIRE([AM_PROG_CC_C_O])"
5731 for module
in $final_modules; do
5733 if test -n "$module"; then
5734 echo "# Code from module $module:"
5735 func_get_autoconf_early_snippet
"$module"
5738 |
sed -e '/^$/d;' -e 's/^/ /'
5741 echo "# This macro should be invoked from $configure_ac, in the section"
5742 echo "# \"Check for header files, types and library functions\"."
5743 echo "AC_DEFUN([${macro_prefix}_INIT],"
5745 if test "$libtool" = true
; then
5746 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
5747 echo " gl_cond_libtool=true"
5749 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
5750 echo " gl_cond_libtool=false"
5752 echo " gl_ltlibdeps="
5754 if test "$auxdir" != "build-aux"; then
5755 sed_replace_build_aux
='
5757 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
5758 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
5762 sed_replace_build_aux
="$sed_noop"
5764 echo " gl_m4_base='$m4base'"
5765 func_emit_initmacro_start
$macro_prefix
5766 echo " gl_source_base='$sourcebase'"
5767 if test -n "$witness_c_macro"; then
5768 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$witness_c_macro])"
5770 func_emit_autoconf_snippets
"$main_modules" "$main_modules" func_verify_module true false true
5771 if test -n "$witness_c_macro"; then
5772 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
5774 echo " # End of code from modules"
5775 func_emit_initmacro_end
$macro_prefix
5776 echo " gltests_libdeps="
5777 echo " gltests_ltlibdeps="
5778 func_emit_initmacro_start
${macro_prefix}tests
5779 echo " gl_source_base='$testsbase'"
5780 # Define a tests witness macro that depends on the package.
5781 # PACKAGE is defined by AM_INIT_AUTOMAKE, PACKAGE_TARNAME is defined by AC_INIT.
5782 # See <https://lists.gnu.org/r/automake/2009-05/msg00145.html>.
5783 echo "changequote(,)dnl"
5784 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"
5785 echo "changequote([, ])dnl"
5786 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
5787 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
5788 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
5789 func_emit_autoconf_snippets
"$testsrelated_modules" "$main_modules $testsrelated_modules" func_verify_module true true true
5790 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
5791 func_emit_initmacro_end
${macro_prefix}tests
5792 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
5793 # created using libtool, because libtool already handles the dependencies.
5794 if test "$libtool" != true
; then
5795 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
5796 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
5797 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
5798 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
5799 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
5801 if $use_libtests; then
5802 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
5803 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
5806 func_emit_initmacro_done
$macro_prefix $sourcebase
5807 func_emit_initmacro_done
${macro_prefix}tests
$testsbase
5809 echo "# This macro records the list of files which have been installed by"
5810 echo "# gnulib-tool and may be removed by future gnulib-tool invocations."
5811 echo "AC_DEFUN([${macro_prefix}_FILE_LIST], ["
5812 echo "$files" |
sed -e 's,^, ,'
5815 if test -f "$destdir"/$m4base/gnulib-comp.
m4; then
5816 if cmp -s "$destdir"/$m4base/gnulib-comp.
m4 "$tmpfile"; then
5820 echo "Updating $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
5821 mv -f "$destdir"/$m4base/gnulib-comp.
m4 "$destdir"/$m4base/gnulib-comp.
m4~
5822 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.
m4
5824 echo "Update $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
5828 echo "# gnulib-comp.m4 ends here"
5835 echo "Creating $m4base/gnulib-comp.m4"
5836 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.
m4
5838 echo "Create $m4base/gnulib-comp.m4"
5845 # Create tests makefile.
5846 func_dest_tmpfilename
$testsbase/$makefile_am
5847 destfile
="$testsbase/$makefile_am"
5848 modules
="$testsrelated_modules"
5849 func_emit_tests_Makefile_am
"${macro_prefix}tests_WITNESS" > "$tmpfile"
5850 if test -f "$destdir"/$testsbase/$makefile_am; then
5851 if cmp -s "$destdir"/$testsbase/$makefile_am "$tmpfile"; then
5855 echo "Updating $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
5856 mv -f "$destdir"/$testsbase/$makefile_am "$destdir"/$testsbase/$makefile_am~
5857 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
5859 echo "Update $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
5865 echo "Creating $testsbase/$makefile_am"
5866 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
5868 echo "Create $testsbase/$makefile_am"
5871 func_append added_files
"$testsbase/$makefile_am$nl"
5875 if test "$vc_files" != false
; then
5876 # Update the .cvsignore and .gitignore files.
5877 { echo "$added_files" |
sed -e '/^$/d' -e 's,\([^/]*\)$,|A|\1,'
5878 echo "$removed_files" |
sed -e '/^$/d' -e 's,\([^/]*\)$,|R|\1,'
5879 # Treat gnulib-comp.m4 like an added file, even if it already existed.
5880 echo "$m4base/|A|gnulib-comp.m4"
5881 } | LC_ALL
=C
sort -t'|' -k1,1 > "$tmp"/fileset-changes
5882 { # Rearrange file descriptors. Needed because "while ... done < ..."
5883 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5884 exec 5<&0 < "$tmp"/fileset-changes
5885 func_update_ignorelist
()
5888 if test "$ignore" = .gitignore
; then
5889 # In a .gitignore file, "foo" applies to the current directory and all
5890 # subdirectories, whereas "/foo" applies to the current directory only.
5893 doubly_escaped_anchor
='\\/'
5897 doubly_escaped_anchor
=''
5899 if test -f "$destdir/$dir$ignore"; then
5900 if test -n "$dir_added" ||
test -n "$dir_removed"; then
5901 sed -e "s|^$anchor||" < "$destdir/$dir$ignore" | LC_ALL
=C
sort > "$tmp"/ignore
5902 (echo "$dir_added" |
sed -e '/^$/d' | LC_ALL
=C
sort -u \
5903 | LC_ALL
=C
join -v 1 - "$tmp"/ignore
> "$tmp"/ignore-added
5904 echo "$dir_removed" |
sed -e '/^$/d' | LC_ALL
=C
sort -u \
5905 > "$tmp"/ignore-removed
5907 if test -s "$tmp"/ignore-added ||
test -s "$tmp"/ignore-removed
; then
5909 echo "Updating $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
5910 mv -f "$destdir/$dir$ignore" "$destdir/$dir$ignore"~
5911 { sed -e 's,/,\\/,g' -e 's,^,/^,' -e 's,$,\$/d,' < "$tmp"/ignore-removed
5912 if test -n "$anchor"; then sed -e 's,/,\\/,g' -e "s,^,/^${doubly_escaped_anchor}," -e 's,$,$/d,' < "$tmp"/ignore-removed
; fi
5913 } > "$tmp"/sed-ignore-removed
5914 { cat "$destdir/$dir$ignore"~
5915 sed -e "s|^|$anchor|" < "$tmp"/ignore-added
5916 } |
sed -f "$tmp"/sed-ignore-removed \
5917 > "$destdir/$dir$ignore"
5919 echo "Update $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
5924 if test -n "$dir_added"; then
5926 echo "Creating $destdir/$dir$ignore"
5928 if test "$ignore" = .cvsignore
; then
5930 # Automake generates Makefile rules that create .dirstamp files.
5933 echo "$dir_added" |
sed -e '/^$/d' -e "s|^|$anchor|" | LC_ALL
=C
sort -u
5934 } > "$destdir/$dir$ignore"
5936 echo "Create $destdir/$dir$ignore"
5946 if test -d "$destdir/CVS" ||
test -d "$destdir/${dir}CVS" ||
test -f "$destdir/${dir}.cvsignore"; then
5947 func_update_ignorelist .cvsignore
5949 if test -d "$destdir/.git" ||
test -f "$destdir/${dir}.gitignore"; then
5950 func_update_ignorelist .gitignore
5957 # Why not ''read next_dir op file'' ? Because the dir column can be empty.
5958 next_dir
=`echo "$line" | sed -e 's,|.*,,'`
5959 op
=`echo "$line" | sed -e 's,^[^|]*|\([^|]*\)|.*$,\1,'`
5960 file=`echo "$line" | sed -e 's,^[^|]*|[^|]*|,,'`
5961 if test "$next_dir" != "$last_dir"; then
5962 func_done_dir
"$last_dir" "$last_dir_added" "$last_dir_removed"
5963 last_dir
="$next_dir"
5968 A
) func_append last_dir_added
"$file$nl";;
5969 R
) func_append last_dir_removed
"$file$nl";;
5972 func_done_dir
"$last_dir" "$last_dir_added" "$last_dir_removed"
5979 echo "You may need to add #include directives for the following .h files."
5980 # Intersect $specified_modules and $main_modules
5981 # (since $specified_modules is not necessarily of subset of $main_modules
5982 # - some may have been skipped through --avoid, and since the elements of
5983 # $main_modules but not in $specified_modules can go away without explicit
5984 # notice - through changes in the module dependencies).
5985 echo "$specified_modules" > "$tmp"/modules1
# a sorted list, one module per line
5986 echo "$main_modules" > "$tmp"/modules2
# also a sorted list, one module per line
5987 # First the #include <...> directives without #ifs, sorted for convenience,
5988 # then the #include "..." directives without #ifs, sorted for convenience,
5989 # then the #include directives that are surrounded by #ifs. Not sorted.
5990 for module
in `LC_ALL=C join "$tmp"/modules1 "$tmp"/modules2`; do
5991 include_directive
=`func_get_include_directive "$module"`
5992 case "$nl$include_directive" in
5994 echo "$include_directive" 1>&5
5997 echo "$include_directive" |
grep -v 'include "' 1>&6
5998 echo "$include_directive" |
grep 'include "' 1>&7
6001 done 5> "$tmp"/include-if
6> "$tmp"/include-angles
7> "$tmp"/include-quotes
6003 LC_ALL
=C
sort -u "$tmp"/include-angles
6004 LC_ALL
=C
sort -u "$tmp"/include-quotes
6005 cat "$tmp"/include-if
6006 ) |
sed -e '/^$/d' -e 's/^/ /'
6007 rm -f "$tmp"/include-angles
"$tmp"/include-quotes
"$tmp"/include-if
6009 for module
in $main_modules; do
6010 func_get_link_directive
"$module"
6012 | LC_ALL
=C
sort -u |
sed -e '/^$/d' -e 's/^/ /' > "$tmp"/link
6013 if test `wc -l < "$tmp"/link` != 0; then
6015 echo "You may need to use the following Makefile variables when linking."
6016 echo "Use them in <program>_LDADD when linking a program, or"
6017 echo "in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library."
6023 echo "Don't forget to"
6024 if test "$makefile_am" = Makefile.am
; then
6025 echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
6027 echo " - \"include $makefile_name\" from within \"$sourcebase/Makefile.am\","
6029 if test -n "$pobase"; then
6030 echo " - add \"$pobase/Makefile.in\" to AC_CONFIG_FILES in $configure_ac,"
6033 if test "$makefile_am" = Makefile.am
; then
6034 echo " - add \"$testsbase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
6036 echo " - \"include $makefile_name\" from within \"$testsbase/Makefile.am\","
6040 while test $edit != $makefile_am_edits; do
6041 edit
=`expr $edit + 1`
6042 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
6043 eval var
=\"\
$makefile_am_edit${edit}_var
\"
6044 eval val
=\"\
$makefile_am_edit${edit}_val
\"
6045 if test -n "$var"; then
6046 echo " - mention \"${val}\" in ${var} in ${dir}Makefile.am,"
6049 if grep '^ *AC_PROG_CC_STDC' "$configure_ac" > /dev
/null
; then
6050 position_early_after
=AC_PROG_CC_STDC
6052 if grep '^ *AC_PROG_CC_C99' "$configure_ac" > /dev
/null
; then
6053 position_early_after
=AC_PROG_CC_C99
6055 position_early_after
=AC_PROG_CC
6058 echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after $position_early_after,"
6059 echo " - invoke ${macro_prefix}_INIT in $configure_ac."
6062 # func_create_testdir testdir modules
6064 # - local_gnulib_path from --local-dir
6065 # - modcache true or false, from --cache-modules/--no-cache-modules
6066 # - auxdir directory relative to destdir where to place build aux files
6067 # - inctests true if tests should be included, false otherwise
6068 # - incobsolete true if obsolete modules among dependencies should be
6069 # included, blank otherwise
6070 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
6072 # - excl_longrunning_tests true if long-runnings tests should be excluded,
6074 # - excl_privileged_tests true if tests that require root privileges should be
6075 # excluded, blank otherwise
6076 # - excl_unportable_tests true if tests that fail on some platforms should be
6077 # excluded, blank otherwise
6078 # - single_configure true if a single configure file should be generated,
6079 # false for a separate configure file for the tests
6080 # - avoidlist list of modules to avoid
6081 # - cond_dependencies true if --conditional-dependencies was given, false if
6082 # --no-conditional-dependencies was given, blank otherwise
6083 # - libtool true if --libtool was given, false if --no-libtool was
6084 # given, blank otherwise
6085 # - copymode copy mode for files in general
6086 # - lcopymode copy mode for files from local_gnulib_path
6087 func_create_testdir
()
6091 if test -z "$modules"; then
6092 # All modules together.
6093 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
6094 # Except non-recursive-gnulib-prefix-hack, which represents a nonstandard
6095 # way of using Automake.
6096 # Except timevar, which lacks the required file timevar.def.
6097 # Except ftruncate, mountlist, which abort the configuration on mingw. FIXME.
6098 # Except lib-ignore, which leads to link errors when Sun C++ is used. FIXME.
6099 modules
=`func_all_modules`
6100 modules
=`for m in $modules; do case $m in config-h | non-recursive-gnulib-prefix-hack | timevar | ftruncate | mountlist | lib-ignore) ;; *) echo $m;; esac; done`
6102 specified_modules
="$modules"
6104 # Canonicalize the list of specified modules.
6105 specified_modules
=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
6107 # Test modules which invoke AC_CONFIG_FILES cannot be used with
6108 # --with-tests --single-configure. Avoid them.
6109 if $inctests && $single_configure; then
6110 avoidlist
="$avoidlist havelib-tests"
6113 # Unlike in func_import, here we want to include all kinds of tests for the
6114 # directly specified modules, but not for dependencies.
6115 inc_all_direct_tests
=true
6116 inc_all_indirect_tests
="$inc_all_tests"
6118 # Check that the license of every module is consistent with the license of
6120 saved_inctests
="$inctests"
6121 # When computing transitive closures, don't consider $module to depend on
6122 # $module-tests. Need this because tests are implicitly GPL and may depend
6123 # on GPL modules - therefore we don't want a warning in this case.
6125 for requested_module
in $specified_modules; do
6126 requested_license
=`func_get_license "$requested_module"`
6127 if test "$requested_license" != GPL
; then
6128 # Here we use func_modules_transitive_closure, not just
6129 # func_get_dependencies, so that we also detect weird situations like
6130 # an LGPL module which depends on a GPLed build tool module which depends
6132 modules
="$requested_module"
6133 func_modules_transitive_closure
6134 for module
in $modules; do
6135 license
=`func_get_license "$module"`
6137 'GPLed build tool') ;;
6138 'public domain' |
'unlimited' |
'unmodifiable license text') ;;
6140 case "$requested_license" in
6143 LGPLv2
+ |
'LGPLv3+ or GPLv2' | LGPLv3
+ | LGPL | GPLv2
+ | GPLv3
+ | GPL
) ;;
6144 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6149 LGPLv2
+ |
'LGPLv3+ or GPLv2' | GPLv2
+) ;;
6150 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6155 LGPLv2
+ |
'LGPLv3+ or GPLv2' | LGPLv3
+ | LGPL
) ;;
6156 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6161 LGPLv2
+ |
'LGPLv3+ or GPLv2') ;;
6162 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6168 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6177 inctests
="$saved_inctests"
6179 # Subdirectory names.
6190 # Determine final module list.
6191 modules
="$specified_modules"
6192 func_modules_transitive_closure
6193 if test $verbose -ge 0; then
6194 func_show_module_list
6196 final_modules
="$modules"
6198 if $single_configure; then
6199 # Determine main module list and tests-related module list separately.
6200 func_modules_transitive_closure_separately
6203 if $single_configure; then
6204 # Determine whether a $testsbase/libtests.a is needed.
6205 func_determine_use_libtests
6208 # Add the dummy module if needed.
6209 if $single_configure; then
6210 func_modules_add_dummy_separately
6212 func_modules_add_dummy
6216 # If $single_configure, we use the module lists $main_modules and
6217 # $testsrelated_modules; $modules is merely a temporary variable.
6218 # Whereas if ! $configure, the module list is $modules.
6220 # Show banner notice of every module.
6221 if $single_configure; then
6222 modules
="$main_modules"
6228 # Determine final file list.
6229 if $single_configure; then
6230 func_modules_to_filelist_separately
6232 func_modules_to_filelist
6233 if test $verbose -ge 0; then
6235 echo "$files" |
sed -e 's/^/ /'
6238 # Add files for which the copy in gnulib is newer than the one that
6239 # "automake --add-missing --copy" would provide.
6240 files
="$files build-aux/config.guess"
6241 files
="$files build-aux/config.sub"
6242 files
=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
6244 rewritten
='%REWRITTEN%'
6245 sed_rewrite_files
="\
6246 s,^build-aux/,$rewritten$auxdir/,
6247 s,^doc/,$rewritten$docbase/,
6248 s,^lib/,$rewritten$sourcebase/,
6249 s,^m4/,$rewritten$m4base/,
6250 s,^tests/,$rewritten$testsbase/,
6251 s,^tests=lib/,$rewritten$testsbase/,
6255 # Create directories.
6256 for f
in $files; do echo $f; done \
6257 |
sed -e "$sed_rewrite_files" \
6258 |
sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
6259 | LC_ALL
=C
sort -u \
6261 { # Rearrange file descriptors. Needed because "while ... done < ..."
6262 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
6263 exec 5<&0 < "$tmp"/dirs
6265 mkdir
-p "$testdir/$d"
6270 # Copy files or make symbolic links or hard links.
6272 for f
in $files; do echo $f; done \
6273 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_files" \
6276 { # Rearrange file descriptors. Needed because "while ... done < ..."
6277 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
6278 exec 5<&0 < "$tmp"/files
6281 tests
=lib
/*) f
=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
6283 func_lookup_file
"$f"
6284 if test -n "$lookedup_tmp"; then
6285 cp -p "$lookedup_file" "$testdir/$g"
6288 if test "$copyaction" = symlink
; then
6289 func_symlink
"$lookedup_file" "$testdir/$g"
6291 if test "$copyaction" = hardlink
; then
6292 func_hardlink
"$lookedup_file" "$testdir/$g"
6294 cp -p "$lookedup_file" "$testdir/$g"
6302 # Determine include_guard_prefix.
6303 func_compute_include_guard_prefix
6305 # Create Makefile.ams that are for testing.
6308 # No special edits are needed.
6311 # Create $sourcebase/Makefile.am.
6312 mkdir
-p "$testdir/$sourcebase"
6313 destfile
="$sourcebase/Makefile.am"
6314 if $single_configure; then
6315 modules
="$main_modules"
6317 func_emit_lib_Makefile_am
> "$testdir/$sourcebase/Makefile.am"
6318 any_uses_subdirs
="$uses_subdirs"
6320 # Create $m4base/Makefile.am.
6321 mkdir
-p "$testdir/$m4base"
6322 (echo "## Process this file with automake to produce Makefile.in."
6328 echo "EXTRA_DIST += "`echo "$f" | sed -e 's,^m4/,,'` ;;
6331 ) > "$testdir/$m4base/Makefile.am"
6333 subdirs
="$sourcebase $m4base"
6334 subdirs_with_configure_ac
=""
6336 if false
&& test -f "$testdir"/$m4base/gettext.
m4; then
6337 # Avoid stupid error message from automake:
6338 # "AM_GNU_GETTEXT used but `po' not in SUBDIRS"
6339 mkdir
-p "$testdir/po"
6340 (echo "## Process this file with automake to produce Makefile.in."
6341 ) > "$testdir/po/Makefile.am"
6342 func_append subdirs
" po"
6346 test -d "$testdir/$testsbase" || mkdir
"$testdir/$testsbase"
6347 if $single_configure; then
6348 # Create $testsbase/Makefile.am.
6349 destfile
="$testsbase/Makefile.am"
6350 modules
="$testsrelated_modules"
6351 func_emit_tests_Makefile_am
"${macro_prefix}tests_WITNESS" > "$testdir/$testsbase/Makefile.am"
6353 # Viewed from the $testsbase subdirectory, $auxdir is different.
6354 saved_auxdir
="$auxdir"
6355 auxdir
=`echo "$testsbase/" | sed -e 's%[^/][^/]*//*%../%g'`"$auxdir"
6356 # Create $testsbase/Makefile.am.
6358 destfile
="$testsbase/Makefile.am"
6359 func_emit_tests_Makefile_am
"" > "$testdir/$testsbase/Makefile.am"
6360 any_uses_subdirs
="$any_uses_subdirs$uses_subdirs"
6361 # Create $testsbase/configure.ac.
6362 (echo "# Process this file with autoconf to produce a configure script."
6363 echo "AC_INIT([dummy], [0])"
6364 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6365 echo "AM_INIT_AUTOMAKE"
6367 echo "AC_CONFIG_HEADERS([config.h])"
6370 echo "AC_PROG_INSTALL"
6371 echo "AC_PROG_MAKE_SET"
6373 func_emit_pre_early_macros false
'' "$modules"
6375 if test -n "$uses_subdirs"; then
6376 echo "AM_PROG_CC_C_O"
6379 for module
in $modules; do
6381 if test -n "$module"; then
6383 gnumakefile | maintainer-makefile
)
6384 # These modules are meant to be used only in the top-level directory.
6387 func_get_autoconf_early_snippet
"$module"
6392 |
sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
6393 if test "$libtool" = true
; then
6394 echo "LT_INIT([win32-dll])"
6395 echo "LT_LANG([C++])"
6396 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
6397 echo "gl_cond_libtool=true"
6399 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
6400 echo "gl_cond_libtool=false"
6402 echo "gl_ltlibdeps="
6404 # Wrap the set of autoconf snippets into an autoconf macro that is then
6405 # invoked. This is needed because autoconf does not support AC_REQUIRE
6407 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
6408 # but we want the AC_REQUIRE to have its normal meaning (provide one
6409 # expansion of the required macro before the current point, and only one
6411 echo "AC_DEFUN([gl_INIT], ["
6412 sed_replace_build_aux
='
6414 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
6415 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
6418 echo "gl_m4_base='../$m4base'"
6419 func_emit_initmacro_start
$macro_prefix
6420 # We don't have explicit ordering constraints between the various
6421 # autoconf snippets. It's cleanest to put those of the library before
6422 # those of the tests.
6423 echo "gl_source_base='../$sourcebase'"
6424 func_emit_autoconf_snippets
"$modules" "$modules" func_verify_nontests_module false false false
6425 echo "gl_source_base='.'"
6426 func_emit_autoconf_snippets
"$modules" "$modules" func_verify_tests_module false false false
6427 func_emit_initmacro_end
$macro_prefix
6428 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
6429 # created using libtool, because libtool already handles the dependencies.
6430 if test "$libtool" != true
; then
6431 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
6432 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
6433 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
6434 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
6435 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
6438 func_emit_initmacro_done
$macro_prefix $sourcebase # FIXME use $sourcebase or $testsbase?
6442 # Usually $testsbase/config.h will be a superset of config.h. Verify this
6443 # by "merging" config.h into $testsbase/config.h; look out for gcc warnings.
6444 echo "AH_TOP([#include \"../config.h\"])"
6446 echo "AC_CONFIG_FILES([Makefile])"
6448 ) > "$testdir/$testsbase/configure.ac"
6449 auxdir
="$saved_auxdir"
6450 subdirs_with_configure_ac
="$subdirs_with_configure_ac $testsbase"
6452 func_append subdirs
" $testsbase"
6455 # Create Makefile.am.
6456 (echo "## Process this file with automake to produce Makefile.in."
6458 echo "AUTOMAKE_OPTIONS = 1.11 foreign"
6460 echo "SUBDIRS = $subdirs"
6462 echo "ACLOCAL_AMFLAGS = -I $m4base"
6463 ) > "$testdir/Makefile.am"
6465 # Create configure.ac.
6466 (echo "# Process this file with autoconf to produce a configure script."
6467 echo "AC_INIT([dummy], [0])"
6468 if test "$auxdir" != "."; then
6469 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6471 echo "AM_INIT_AUTOMAKE"
6473 echo "AC_CONFIG_HEADERS([config.h])"
6476 echo "AC_PROG_INSTALL"
6477 echo "AC_PROG_MAKE_SET"
6479 echo "# For autobuild."
6480 echo "AC_CANONICAL_BUILD"
6481 echo "AC_CANONICAL_HOST"
6483 echo "m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
6484 echo "m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
6485 echo "m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
6486 echo "m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
6488 func_emit_pre_early_macros false
'' "$final_modules"
6490 if test -n "$any_uses_subdirs"; then
6491 echo "AM_PROG_CC_C_O"
6494 for module
in $final_modules; do
6495 if $single_configure; then
6498 func_verify_nontests_module
6500 if test -n "$module"; then
6501 func_get_autoconf_early_snippet
"$module"
6504 |
sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
6505 if test "$libtool" = true
; then
6506 echo "LT_INIT([win32-dll])"
6507 echo "LT_LANG([C++])"
6508 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
6509 echo "gl_cond_libtool=true"
6511 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
6512 echo "gl_cond_libtool=false"
6514 echo "gl_ltlibdeps="
6516 # Wrap the set of autoconf snippets into an autoconf macro that is then
6517 # invoked. This is needed because autoconf does not support AC_REQUIRE
6519 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
6520 # but we want the AC_REQUIRE to have its normal meaning (provide one
6521 # expansion of the required macro before the current point, and only one
6523 echo "AC_DEFUN([gl_INIT], ["
6524 if test "$auxdir" != "build-aux"; then
6525 sed_replace_build_aux
='
6527 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
6528 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
6532 sed_replace_build_aux
="$sed_noop"
6534 echo "gl_m4_base='$m4base'"
6535 func_emit_initmacro_start
$macro_prefix
6536 echo "gl_source_base='$sourcebase'"
6537 if $single_configure; then
6538 func_emit_autoconf_snippets
"$main_modules" "$main_modules" func_verify_module true false false
6540 func_emit_autoconf_snippets
"$modules" "$modules" func_verify_nontests_module true false false
6542 func_emit_initmacro_end
$macro_prefix
6543 if $single_configure; then
6544 echo " gltests_libdeps="
6545 echo " gltests_ltlibdeps="
6546 func_emit_initmacro_start
${macro_prefix}tests
6547 echo " gl_source_base='$testsbase'"
6548 # Define a tests witness macro.
6549 echo " ${macro_prefix}tests_WITNESS=IN_GNULIB_TESTS"
6550 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
6551 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
6552 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
6553 func_emit_autoconf_snippets
"$testsrelated_modules" "$main_modules $testsrelated_modules" func_verify_module true false false
6554 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
6555 func_emit_initmacro_end
${macro_prefix}tests
6557 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
6558 # created using libtool, because libtool already handles the dependencies.
6559 if test "$libtool" != true
; then
6560 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
6561 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
6562 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
6563 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
6564 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
6566 if $single_configure; then
6567 if $use_libtests; then
6568 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
6569 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
6573 func_emit_initmacro_done
$macro_prefix $sourcebase
6574 if $single_configure; then
6575 func_emit_initmacro_done
${macro_prefix}tests
$testsbase
6580 if test -n "$subdirs_with_configure_ac"; then
6581 echo "AC_CONFIG_SUBDIRS(["`echo $subdirs_with_configure_ac`"])"
6583 makefiles
="Makefile"
6584 for d
in $subdirs; do
6585 # For subdirs that have a configure.ac by their own, it's the subdir's
6586 # configure.ac which creates the subdir's Makefile.am, not this one.
6587 case " $subdirs_with_configure_ac " in
6589 *) func_append makefiles
" $d/Makefile" ;;
6592 echo "AC_CONFIG_FILES([$makefiles])"
6594 ) > "$testdir/configure.ac"
6596 # Create autogenerated files.
6598 # Do not use "${AUTORECONF} --force --install", because it may invoke
6599 # autopoint, which brings in older versions of some of our .m4 files.
6600 if test -f $m4base/gettext.
m4; then
6601 func_execute_command
${AUTOPOINT} --force || func_exit
1
6602 for f
in $m4base/*.
m4~
; do
6604 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit
1
6608 if test "$libtool" = true
; then
6609 func_execute_command
${LIBTOOLIZE} --copy || func_exit
1
6611 func_execute_command
${ACLOCAL} -I $m4base || func_exit
1
6612 if ! test -d build-aux
; then
6613 func_execute_command mkdir build-aux || func_exit
1
6615 func_execute_command
${AUTOCONF} || func_exit
1
6616 # Explicit 'touch config.h.in': see <https://savannah.gnu.org/support/index.php?109406>.
6617 func_execute_command
${AUTOHEADER} &&
6618 func_execute_command
touch config.h.
in ||
6620 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6621 rm -rf autom4te.cache
6623 if $inctests && ! $single_configure; then
6624 # Create autogenerated files.
6625 (cd "$testdir/$testsbase" || func_exit
1
6626 # Do not use "${AUTORECONF} --force --install", because it may invoke
6627 # autopoint, which brings in older versions of some of our .m4 files.
6628 if test -f ..
/$m4base/gettext.
m4; then
6629 func_execute_command
${AUTOPOINT} --force || func_exit
1
6630 for f
in ..
/$m4base/*.
m4~
; do
6632 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit
1
6636 func_execute_command
${ACLOCAL} -I ..
/$m4base || func_exit
1
6637 if ! test -d ..
/build-aux
; then
6638 func_execute_command mkdir ..
/build-aux
6640 func_execute_command
${AUTOCONF} || func_exit
1
6641 # Explicit 'touch config.h.in': see <https://savannah.gnu.org/support/index.php?109406>.
6642 func_execute_command
${AUTOHEADER} &&
6643 func_execute_command
touch config.h.
in ||
6645 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6646 rm -rf autom4te.cache
6649 # Need to run configure and make once, to create built files that are to be
6650 # distributed (such as parse-datetime.c).
6651 sed_remove_make_variables
='s,[$]([A-Za-z0-9_]*),,g'
6652 # Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...".
6653 cleaned_files
=`combine_lines < "$testdir/$sourcebase/Makefile.am" \
6654 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
6655 cleaned_files
=`for file in $cleaned_files; do echo " $file "; done`
6656 # Extract the value of "BUILT_SOURCES += ...". Remove variable references
6657 # such $(FOO_H) because they don't refer to distributed files.
6658 built_sources
=`combine_lines < "$testdir/$sourcebase/Makefile.am" \
6659 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
6660 | sed -e "$sed_remove_make_variables"`
6661 distributed_built_sources
=`for file in $built_sources; do
6662 case "$cleaned_files" in
6667 tests_distributed_built_sources
=
6669 # Likewise for built files in the $testsbase directory.
6670 tests_cleaned_files
=`combine_lines < "$testdir/$testsbase/Makefile.am" \
6671 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
6672 tests_cleaned_files
=`for file in $tests_cleaned_files; do echo " $file "; done`
6673 tests_built_sources
=`combine_lines < "$testdir/$testsbase/Makefile.am" \
6674 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
6675 | sed -e "$sed_remove_make_variables"`
6676 tests_distributed_built_sources
=`for file in $tests_built_sources; do
6677 case "$tests_cleaned_files" in
6683 if test -n "$distributed_built_sources" ||
test -n "$tests_distributed_built_sources"; then
6685 .
/configure || func_exit
1
6686 if test -n "$distributed_built_sources"; then
6688 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
6689 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6694 if test -n "$tests_distributed_built_sources"; then
6696 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
6697 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6702 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6708 if test -f build-aux
/test-driver
; then
6709 patch build-aux
/test-driver
< "$gnulib_dir"/build-aux
/test-driver.
diff || func_exit
1
6714 # func_create_megatestdir megatestdir allmodules
6716 # - local_gnulib_path from --local-dir
6717 # - modcache true or false, from --cache-modules/--no-cache-modules
6718 # - auxdir directory relative to destdir where to place build aux files
6719 func_create_megatestdir
()
6723 if test -z "$allmodules"; then
6724 allmodules
=`func_all_modules`
6728 # First, all modules one by one.
6729 for onemodule
in $allmodules; do
6730 func_create_testdir
"$megatestdir/$onemodule" $onemodule
6731 func_append megasubdirs
"$onemodule "
6733 # Then, all modules all together.
6734 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
6735 allmodules
=`for m in $allmodules; do if test $m != config-h; then echo $m; fi; done`
6736 func_create_testdir
"$megatestdir/ALL" "$allmodules"
6737 func_append megasubdirs
"ALL"
6740 cvsdate
=`vc_witness="$gnulib_dir/.git/refs/heads/master"; \
6741 sh "$gnulib_dir/build-aux/mdate-sh" "$vc_witness" \
6742 | sed -e 's,January,01,' -e 's,Jan,01,' \
6743 -e 's,February,02,' -e 's,Feb,02,' \
6744 -e 's,March,03,' -e 's,Mar,03,' \
6745 -e 's,April,04,' -e 's,Apr,04,' \
6747 -e 's,June,06,' -e 's,Jun,06,' \
6748 -e 's,July,07,' -e 's,Jul,07,' \
6749 -e 's,August,08,' -e 's,Aug,08,' \
6750 -e 's,September,09,' -e 's,Sep,09,' \
6751 -e 's,October,10,' -e 's,Oct,10,' \
6752 -e 's,November,11,' -e 's,Nov,11,' \
6753 -e 's,December,12,' -e 's,Dec,12,' \
6754 -e 's,^,00,' -e 's,^[0-9]*\([0-9][0-9] \),\1,' \
6755 -e 's,^\([0-9]*\) \([0-9]*\) \([0-9]*\),\3\2\1,'`
6757 echo "CVSDATE=$cvsdate"
6758 echo ": \${MAKE=make}"
6759 echo "test -d logs || mkdir logs"
6760 echo "for module in $megasubdirs; do"
6761 echo " echo \"Working on module \$module...\""
6762 echo " safemodule=\`echo \$module | sed -e 's|/|-|g'\`"
6763 echo " (echo \"To: gnulib@autobuild.josefsson.org\""
6766 echo " : autobuild project... \$module"
6767 echo " : autobuild revision... cvs-\$CVSDATE-000000"
6768 echo " : autobuild timestamp... \`date \"+%Y%m%d-%H%M%S\"\`"
6769 echo " : autobuild hostname... \`hostname\`"
6770 echo " cd \$module && ./configure \$CONFIGURE_OPTIONS && \$MAKE && \$MAKE check && \$MAKE distclean"
6772 echo " ) 2>&1 | { if test -n \"\$AUTOBUILD_SUBST\"; then sed -e \"\$AUTOBUILD_SUBST\"; else cat; fi; } > logs/\$safemodule"
6774 ) > "$megatestdir/do-autobuild"
6775 chmod a
+x
"$megatestdir/do-autobuild"
6777 # Create Makefile.am.
6778 (echo "## Process this file with automake to produce Makefile.in."
6780 echo "AUTOMAKE_OPTIONS = 1.11 foreign"
6782 echo "SUBDIRS = $megasubdirs"
6784 echo "EXTRA_DIST = do-autobuild"
6785 ) > "$megatestdir/Makefile.am"
6787 # Create configure.ac.
6788 (echo "# Process this file with autoconf to produce a configure script."
6789 echo "AC_INIT([dummy], [0])"
6790 if test "$auxdir" != "."; then
6791 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6793 echo "AM_INIT_AUTOMAKE"
6795 echo "AC_PROG_MAKE_SET"
6797 echo "AC_CONFIG_SUBDIRS([$megasubdirs])"
6798 echo "AC_CONFIG_FILES([Makefile])"
6800 ) > "$megatestdir/configure.ac"
6802 # Create autogenerated files.
6804 # Do not use "${AUTORECONF} --install", because autoreconf operates
6805 # recursively, but the subdirectories are already finished, therefore
6806 # calling autoreconf here would only waste lots of CPU time.
6807 func_execute_command
${ACLOCAL} || func_exit
1
6808 func_execute_command mkdir build-aux
6809 func_execute_command
${AUTOCONF} || func_exit
1
6810 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6811 rm -rf autom4te.cache
6812 if test -f build-aux
/test-driver
; then
6813 patch build-aux
/test-driver
< "$gnulib_dir"/build-aux
/test-driver.
diff || func_exit
1
6820 func_fatal_error
"no mode specified" ;;
6827 # sed expression that converts a literal to a basic regular expression.
6828 # Needs to handle . [ \ * ^ $.
6829 sed_literal_to_basic_regex
='s/\\/\\\\/g
6835 if test -f "$gnulib_dir/$filename" \
6836 || func_lookup_local_file
"$filename"; then
6837 filename_anywhere_regex
=`echo "$filename" | sed -e "$sed_literal_to_basic_regex"`
6838 filename_line_regex
='^'"$filename_anywhere_regex"'$'
6841 (cd "$gnulib_dir" && find modules -type f -print | xargs -n 100 grep -l "$filename_line_regex" /dev/null | sed -e 's,^modules/,,')
6842 func_path_foreach "$local_gnulib_path" func_modules_in_dir %dir% | xargs -n 100 grep -l "$filename_anywhere_regex" /dev/null | sed -e 's,^modules/,,' -e 's,\.diff$,,'
6844 | func_sanitize_modulelist \
6847 for module
in $module_candidates; do
6848 if func_get_filelist
$module |
grep "$filename_line_regex" > /dev
/null
; then
6853 func_warning
"file $filename does not exist"
6858 import | add-import | remove-import | update
)
6861 if test -z "$destdir"; then
6864 test -d "$destdir" \
6865 || func_fatal_error
"destination directory does not exist: $destdir"
6867 # Prefer configure.ac to configure.in.
6868 if test -f "$destdir"/configure.ac
; then
6869 configure_ac
="$destdir/configure.ac"
6871 if test -f "$destdir"/configure.
in; then
6872 configure_ac
="$destdir/configure.in"
6874 func_fatal_error
"cannot find $destdir/configure.ac - make sure you run gnulib-tool from within your package's directory"
6878 # Analyze configure.ac.
6880 guessed_libtool
=false
6885 /AC_CONFIG_AUX_DIR/ {
6886 s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^]"$`\\)]*\).*$,guessed_auxdir="\1",p
6888 /A[CM]_PROG_LIBTOOL/ {
6889 s,^.*$,guessed_libtool=true,p
6891 eval `sed -n -e "$my_sed_traces" < "$configure_ac"`
6893 if test -z "$auxdir"; then
6894 auxdir
="$guessed_auxdir"
6897 # Determine where to apply func_import.
6898 if test "$mode" = import
; then
6899 # Apply func_import to a particular gnulib directory.
6900 # The command line contains the complete specification; don't look at
6901 # the contents of gnulib-cache.m4.
6902 test -n "$supplied_libname" || supplied_libname
=true
6903 test -n "$sourcebase" || sourcebase
="lib"
6904 test -n "$m4base" || m4base
="m4"
6905 test -n "$docbase" || docbase
="doc"
6906 test -n "$testsbase" || testsbase
="tests"
6907 test -n "$macro_prefix" || macro_prefix
="gl"
6910 if test -n "$m4base"; then
6911 # Apply func_import to a particular gnulib directory.
6912 # Any number of additional modules can be given.
6913 if test ! -f "$destdir/$m4base"/gnulib-cache.
m4; then
6914 # First use of gnulib in the given m4base.
6915 test -n "$supplied_libname" || supplied_libname
=true
6916 test -n "$sourcebase" || sourcebase
="lib"
6917 test -n "$docbase" || docbase
="doc"
6918 test -n "$testsbase" || testsbase
="tests"
6919 test -n "$macro_prefix" || macro_prefix
="gl"
6923 # Apply func_import to all gnulib directories.
6924 # To get this list of directories, look at Makefile.am. (Not at
6925 # configure, because it may be omitted from version control. Also,
6926 # don't run "find $destdir -name gnulib-cache.m4", as it might be
6930 if test -f "$destdir"/Makefile.am
; then
6931 aclocal_amflags
=`sed -n -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/p' "$destdir"/Makefile.am`
6933 for arg
in $aclocal_amflags; do
6934 if test -n "$m4dir_is_next"; then
6935 # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
6939 if test -f "$destdir/$arg"/gnulib-cache.
m4; then
6940 func_append m4dirs
" $arg"
6941 m4dirs_count
=`expr $m4dirs_count + 1`
6947 if test "X$arg" = "X-I"; then
6955 # No Makefile.am! Oh well. Look at the last generated aclocal.m4.
6956 if test -f "$destdir"/aclocal.
m4; then
6957 sedexpr1
='s,^m4_include(\[\(.*\)])$,\1,p'
6958 sedexpr2
='s,^[^/]*$,.,'
6959 sedexpr3
='s,/[^/]*$,,'
6960 m4dirs
=`sed -n -e "$sedexpr1" aclocal.m4 | sed -e "$sedexpr2" -e "$sedexpr3" | LC_ALL=C sort -u`
6961 m4dirs
=`for arg in $m4dirs; do if test -f "$destdir/$arg"/gnulib-cache.m4; then echo $arg; fi; done`
6962 m4dirs_count
=`for arg in $m4dirs; do echo "$arg"; done | wc -l`
6965 if test $m4dirs_count = 0; then
6966 # First use of gnulib in a package.
6967 # Any number of additional modules can be given.
6968 test -n "$supplied_libname" || supplied_libname
=true
6969 test -n "$sourcebase" || sourcebase
="lib"
6971 test -n "$docbase" || docbase
="doc"
6972 test -n "$testsbase" || testsbase
="tests"
6973 test -n "$macro_prefix" || macro_prefix
="gl"
6976 if test $m4dirs_count = 1; then
6977 # There's only one use of gnulib here. Assume the user means it.
6978 # Any number of additional modules can be given.
6979 for m4base
in $m4dirs; do
6983 # Ambiguous - guess what the user meant.
6984 if test $# = 0; then
6985 # No further arguments. Guess the user wants to update all of them.
6986 for m4base
in $m4dirs; do
6987 # Perform func_import in a subshell, so that variable values
6989 # local_gnulib_path, incobsolete, inc_cxx_tests,
6990 # inc_longrunning_tests, inc_privileged_tests,
6991 # inc_unportable_tests, inc_all_tests, avoidlist, sourcebase,
6992 # m4base, pobase, docbase, testsbase, inctests, libname, lgpl,
6993 # makefile_name, libtool, macro_prefix, po_domain,
6994 # witness_c_macro, vc_files
6995 # don't propagate from one directory to another.
6996 (func_import
) || func_exit
1
7000 func_fatal_error
"Ambiguity: to which directory should the modules be added? Please specify at least --m4-base=..."
7009 if test -z "$destdir"; then
7010 func_fatal_error
"please specify --dir option"
7013 test -d "$destdir" \
7014 || func_fatal_error
"could not create destination directory"
7015 test -n "$auxdir" || auxdir
="build-aux"
7016 func_create_testdir
"$destdir" "$*"
7019 create-megatestdir
)
7020 if test -z "$destdir"; then
7021 func_fatal_error
"please specify --dir option"
7023 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
7024 test -n "$auxdir" || auxdir
="build-aux"
7025 func_create_megatestdir
"$destdir" "$*"
7029 test -n "$destdir" || destdir
=testdir$$
7030 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
7031 test -n "$auxdir" || auxdir
="build-aux"
7032 func_create_testdir
"$destdir" "$*"
7036 ..
/configure || func_exit
1
7037 $MAKE || func_exit
1
7038 $MAKE check || func_exit
1
7039 $MAKE distclean || func_exit
1
7040 remaining
=`find . -type f -print`
7041 if test -n "$remaining"; then
7042 echo "Remaining files:" $remaining 1>&2
7043 echo "gnulib-tool: *** Stop." 1>&2
7052 test -n "$destdir" || destdir
=testdir$$
7053 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
7054 test -n "$auxdir" || auxdir
="build-aux"
7055 func_create_megatestdir
"$destdir" "$*"
7063 remaining
=`find . -type f -print`
7064 if test -n "$remaining"; then
7065 echo "Remaining files:" $remaining 1>&2
7066 echo "gnulib-tool: *** Stop." 1>&2
7074 extract-description
)
7078 if test -n "$module"; then
7079 func_get_description
"$module"
7088 if test -n "$module"; then
7089 func_get_comment
"$module"
7098 if test -n "$module"; then
7099 func_get_status
"$module"
7108 if test -n "$module"; then
7109 func_get_notice
"$module"
7114 extract-applicability
)
7118 if test -n "$module"; then
7119 func_get_applicability
"$module"
7128 if test -n "$module"; then
7129 func_get_filelist
"$module"
7134 extract-dependencies
)
7135 if test -n "$avoidlist"; then
7136 func_fatal_error
"cannot combine --avoid and --extract-dependencies"
7141 if test -n "$module"; then
7142 func_get_dependencies
"$module"
7147 extract-recursive-dependencies
)
7148 if test -n "$avoidlist"; then
7149 func_fatal_error
"cannot combine --avoid and --extract-recursive-dependencies"
7154 if test -n "$module"; then
7155 func_get_dependencies_recursively
"$module"
7160 extract-autoconf-snippet
)
7164 if test -n "$module"; then
7165 func_get_autoconf_snippet
"$module"
7170 extract-automake-snippet
)
7174 if test -n "$module"; then
7175 func_get_automake_snippet
"$module"
7180 extract-include-directive
)
7184 if test -n "$module"; then
7185 func_get_include_directive
"$module"
7190 extract-link-directive
)
7194 if test -n "$module"; then
7195 func_get_link_directive
"$module"
7200 extract-recursive-link-directive
)
7201 if test -n "$avoidlist"; then
7202 func_fatal_error
"cannot combine --avoid and --extract-recursive-link-directive"
7207 if test -n "$module"; then
7208 func_get_link_directive_recursively
"$module"
7217 if test -n "$module"; then
7218 func_get_license
"$module"
7223 extract-maintainer
)
7227 if test -n "$module"; then
7228 func_get_maintainer
"$module"
7233 extract-tests-module
)
7237 if test -n "$module"; then
7238 func_get_tests_module
"$module"
7244 # Verify the number of arguments.
7245 if test $# -lt 1 ||
test $# -gt 2; then
7246 func_fatal_error
"invalid number of arguments for --$mode"
7249 # The first argument is the file to be copied.
7251 # Verify the file exists.
7252 func_lookup_file
"$f"
7254 # The second argument is the destination; either a directory ot a file.
7255 # It defaults to the current directory.
7257 test -n "$dest" || dest
='.'
7258 test -n "$sourcebase" || sourcebase
="lib"
7259 test -n "$m4base" || m4base
="m4"
7260 test -n "$docbase" || docbase
="doc"
7261 test -n "$testsbase" || testsbase
="tests"
7262 test -n "$auxdir" || auxdir
="build-aux"
7263 rewritten
='%REWRITTEN%'
7264 sed_rewrite_files
="\
7265 s,^build-aux/,$rewritten$auxdir/,
7266 s,^doc/,$rewritten$docbase/,
7267 s,^lib/,$rewritten$sourcebase/,
7268 s,^m4/,$rewritten$m4base/,
7269 s,^tests/,$rewritten$testsbase/,
7272 if test -d "$dest"; then
7274 g
=`echo "$f" | sed -e "$sed_rewrite_files"`
7276 destdir
=`dirname "$dest"`
7277 g
=`basename "$dest"`
7280 # Create the directory for destfile.
7281 d
=`dirname "$destdir/$g"`
7283 if test -n "$d" && test ! -d "$d"; then
7284 mkdir
-p "$d" || func_fatal_error
"failed"
7288 func_dest_tmpfilename
"$g"
7289 cp "$lookedup_file" "$tmpfile" || func_fatal_error
"failed"
7290 already_present
=true
7291 if test -f "$destdir/$g"; then
7292 # The file already exists.
7296 # Don't protest if the file should be there but isn't: it happens
7297 # frequently that developers don't put autogenerated files under version
7305 func_fatal_error
"unknown operation mode --$mode" ;;
7308 if test "$copymode" = hardlink
-o "$lcopymode" = hardlink
; then
7309 # Setting hard links modifies the ctime of files in the gnulib checkout.
7310 # This disturbs the result of the next "gitk" invocation.
7311 # Workaround: Let git scan the files. This can be done through
7312 # "git update-index --refresh" or "git status" or "git diff".
7313 if test -d "$gnulib_dir"/.git \
7314 && (git
--version) >/dev
/null
2>/dev
/null
; then
7315 (cd "$gnulib_dir" && git update-index
--refresh >/dev
/null
)
7320 # Undo the effect of the previous 'trap' command. Some shellology:
7321 # We cannot use "trap - 0 1 2 3 13 15", because Solaris sh would attempt to
7322 # execute the command "-". "trap '' ..." is fine only for signal 0 (= normal
7323 # exit); for the others we need to call 'exit' explicitly. The value of $? is
7324 # 128 + signal number and is set before the trap-registered command is run.
7326 trap 'func_exit $?' 1 2 3 13 15
7331 # indent-tabs-mode: nil
7332 # whitespace-check-buffer-indent: nil