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_prepend pathvar directory
560 # puts directory before pathvar, delimiting directories by PATH_SEPARATOR.
561 # Newly added directory into pathvar has the highest priority.
564 if eval "test -n \"\$$1\""; then
565 eval "$1=\$2\$PATH_SEPARATOR\$$1"
571 # func_path_append pathvar directory
572 # Similar to func_path_prepend except that the newest directory has the lowest
576 if eval "test -n \"\$$1\""; then
577 func_append
"$1" "$PATH_SEPARATOR$2"
583 # func_path_foreach_inner
584 # helper for func_path_foreach because we need new 'args' array
586 # - fpf_dir directory from local_gnulib_path
587 # - fpf_cb callback to be run for fpf_dir
588 func_path_foreach_inner
()
610 # func_path_foreach path method args
611 # Execute method for each directory in path. The method will be called
612 # like `method args` while any argument '%dir%' within args will be replaced
613 # with processed directory from path.
622 for fpf_dir
in $fpf_dirs
624 func_path_foreach_inner
"$@" && fpf_rc
=:
630 # func_remove_suffix var suffix
631 # removes the given suffix from the value of the shell variable var.
632 # var should be the name of a shell variable.
633 # Its value should not contain a newline and not start or end with whitespace.
634 # suffix should not contain the characters "$`\{}[]^|.
635 if ( foo
=bar
; eval 'test "${foo%r}" = ba' ) >/dev
/null
2>&1; then
636 func_remove_suffix
()
640 fast_func_remove_suffix
=true
642 func_remove_suffix
()
644 eval "value=\"\$$1\""
648 sed_escape_dots
='s/\([.]\)/\\\1/g'
649 suffix
=`echo "$suffix" | sed -e "$sed_escape_dots"`
652 value
=`echo "$value" | sed -e "s|${suffix}\$||"`
653 eval "$1=\"\$value\""
655 fast_func_remove_suffix
=false
658 # func_fatal_error message
659 # outputs to stderr a fatal error message, and terminates the program.
661 # - progname name of this program
664 echo "$progname: *** $1" 1>&2
665 echo "$progname: *** Stop." 1>&2
669 # func_warning message
670 # Outputs to stderr a warning message,
673 echo "gnulib-tool: warning: $1" 1>&2
676 # func_readlink SYMLINK
677 # outputs the target of the given symlink.
678 if (type readlink
) > /dev
/null
2>&1; then
681 # Use the readlink program from GNU coreutils.
687 # Use two sed invocations. A single sed -n -e 's,^.* -> \(.*\)$,\1,p'
688 # would do the wrong thing if the link target contains " -> ".
689 LC_ALL
=C
ls -l "$1" |
sed -e 's, -> ,#%%#,' |
sed -n -e 's,^.*#%%#\(.*\)$,\1,p'
693 # func_relativize DIR1 DIR2
694 # computes a relative pathname RELDIR such that DIR1/RELDIR = DIR2.
696 # - DIR1 relative pathname, relative to the current directory
697 # - DIR2 relative pathname, relative to the current directory
699 # - reldir relative pathname of DIR2, relative to DIR1
705 sed_first
='s,^\([^/]*\)/.*$,\1,'
706 sed_rest
='s,^[^/]*/*,,'
707 sed_last
='s,^.*/\([^/]*\)$,\1,'
708 sed_butlast
='s,/*[^/]*$,,'
709 while test -n "$dir1"; do
710 first
=`echo "$dir1" | sed -e "$sed_first"`
711 if test "$first" != "."; then
712 if test "$first" = ".."; then
713 dir2
=`echo "$dir0" | sed -e "$sed_last"`/"$dir2"
714 dir0
=`echo "$dir0" | sed -e "$sed_butlast"`
716 first2
=`echo "$dir2" | sed -e "$sed_first"`
717 if test "$first2" = "$first"; then
718 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
722 dir0
="$dir0"/"$first"
725 dir1
=`echo "$dir1" | sed -e "$sed_rest"`
730 # func_relconcat DIR1 DIR2
731 # computes a relative pathname DIR1/DIR2, with obvious simplifications.
733 # - DIR1 relative pathname, relative to the current directory
734 # - DIR2 relative pathname, relative to DIR1
736 # - relconcat DIR1/DIR2, relative to the current directory
741 sed_first
='s,^\([^/]*\)/.*$,\1,'
742 sed_rest
='s,^[^/]*/*,,'
743 sed_last
='s,^.*/\([^/]*\)$,\1,'
744 sed_butlast
='s,/*[^/]*$,,'
746 first
=`echo "$dir2" | sed -e "$sed_first"`
747 if test "$first" = "."; then
748 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
749 if test -z "$dir2"; then
754 last
=`echo "$dir1" | sed -e "$sed_last"`
755 while test "$last" = "."; do
756 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
757 last
=`echo "$dir1" | sed -e "$sed_last"`
759 if test -z "$dir1"; then
763 if test "$first" = ".."; then
764 if test "$last" = ".."; then
765 relconcat
="$dir1/$dir2"
768 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
769 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
770 if test -z "$dir1"; then
774 if test -z "$dir2"; then
779 relconcat
="$dir1/$dir2"
787 # Like ln -s, except use cp -p if ln -s fails.
791 echo "$progname: ln -s failed; falling back on cp -p" >&2
794 /* | ?
:*) # SRC is absolute.
796 *) # SRC is relative to the directory of DEST.
798 */*) cp_src
="${2%/*}/$1" ;;
808 # func_symlink_target SRC DEST
809 # Determines LINK_TARGET such that "ln -s LINK_TARGET DEST" will create a
810 # symbolic link DEST that points to SRC.
812 # - link_target link target, relative to the directory of DEST
813 func_symlink_target
()
818 *) # SRC is relative.
821 link_target
="`pwd`/$1" ;;
822 *) # DEST is relative too.
823 ln_destdir
=`echo "$2" | sed -e 's,[^/]*$,,'`
824 test -n "$ln_destdir" || ln_destdir
="."
825 func_relativize
"$ln_destdir" "$1"
826 link_target
="$reldir"
833 # func_symlink SRC DEST
834 # Like func_ln_s, except that SRC is given relative to the current directory (or
835 # absolute), not given relative to the directory of DEST.
838 func_symlink_target
"$1" "$2"
839 func_ln_s
"$link_target" "$2"
842 # func_symlink_if_changed SRC DEST
843 # Like func_symlink, but avoids munging timestamps if the link is correct.
844 # SRC is given relative to the current directory (or absolute).
845 func_symlink_if_changed
()
847 if test $# -ne 2; then
848 echo "usage: func_symlink_if_changed SRC DEST" >&2
850 func_symlink_target
"$1" "$2"
851 ln_target
=`func_readlink "$2"`
852 if test -h "$2" && test "$link_target" = "$ln_target"; then
856 func_ln_s
"$link_target" "$2"
860 # func_hardlink SRC DEST
861 # Like ln, except use cp -p if ln fails.
862 # SRC is given relative to the current directory (or absolute).
866 echo "$progname: ln failed; falling back on cp -p" >&2
871 # Ensure an 'echo' command that
872 # 1. does not interpret backslashes and
873 # 2. does not print an error message "broken pipe" when writing into a pipe
876 # Test cases for problem 1:
877 # echo '\n' | wc -l prints 1 when OK, 2 when KO
878 # echo '\t' | grep t > /dev/null has return code 0 when OK, 1 when KO
879 # Test cases for problem 2:
880 # echo hi | true frequently prints
881 # "bash: echo: write error: Broken pipe"
882 # to standard error in bash 3.2.
884 # Problem 1 is a weird heritage from SVR4. BSD got it right (except that
885 # BSD echo interprets '-n' as an option, which is also not desirable).
886 # Nowadays the problem occurs in 4 situations:
887 # - in bash, when the shell option xpg_echo is set (bash >= 2.04)
888 # or when it was built with --enable-usg-echo-default (bash >= 2.0)
889 # or when it was built with DEFAULT_ECHO_TO_USG (bash < 2.0),
890 # - in zsh, when sh-emulation is not set,
891 # - in ksh (e.g. AIX /bin/sh and Solaris /usr/xpg4/bin/sh are ksh instances,
892 # and HP-UX /bin/sh and IRIX /bin/sh behave similarly),
893 # - in Solaris /bin/sh and OSF/1 /bin/sh.
894 # We try the following workarounds:
895 # - for all: respawn using $CONFIG_SHELL if that is set and works.
896 # - for bash >= 2.04: unset the shell option xpg_echo.
897 # - for bash >= 2.0: define echo to a function that uses the printf built-in.
898 # - for bash < 2.0: define echo to a function that uses cat of a here document.
899 # - for zsh: turn sh-emulation on.
900 # - for ksh: alias echo to 'print -r'.
901 # - for ksh: alias echo to a function that uses cat of a here document.
902 # - for Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh and rely on
903 # the ksh workaround.
904 # - otherwise: respawn using /bin/sh and rely on the workarounds.
905 # When respawning, we pass --no-reexec as first argument, so as to avoid
906 # turning this script into a fork bomb in unlucky situations.
908 # Problem 2 is specific to bash 3.2 and affects the 'echo' built-in, but not
909 # the 'printf' built-in. See
910 # <https://lists.gnu.org/r/bug-bash/2008-12/msg00050.html>
911 # <https://lists.gnu.org/r/bug-gnulib/2010-02/msg00154.html>
912 # The workaround is: define echo to a function that uses the printf built-in.
914 if echo '\t' |
grep t
> /dev
/null
; then
915 have_echo
=yes # Lucky!
917 # Try the workarounds.
918 # Respawn using $CONFIG_SHELL if that is set and works.
919 if test -z "$have_echo" \
920 && test "X$1" != "X--no-reexec" \
921 && test -n "$CONFIG_SHELL" \
922 && test -f "$CONFIG_SHELL" \
923 && $CONFIG_SHELL -c "echo '\\t' | grep t > /dev/null"; then
924 exec $CONFIG_SHELL "$0" --no-reexec "$@"
927 # For bash >= 2.04: unset the shell option xpg_echo.
928 if test -z "$have_echo" \
929 && test -n "$BASH_VERSION" \
930 && (shopt -o xpg_echo
; echo '\t' |
grep t
> /dev
/null
) 2>/dev
/null
; then
934 # For bash >= 2.0: define echo to a function that uses the printf built-in.
935 # For bash < 2.0: define echo to a function that uses cat of a here document.
936 # (There is no win in using 'printf' over 'cat' if it is not a shell built-in.)
937 # Also handle problem 2, specific to bash 3.2, here.
938 if { test -z "$have_echo" \
939 ||
case "$BASH_VERSION" in 3.2*) true
;; *) false
;; esac; \
941 && test -n "$BASH_VERSION"; then \
942 if type printf 2>/dev
/null |
grep / > /dev
/null
; then
943 # 'printf' is not a shell built-in.
951 # 'printf' is a shell built-in.
957 if echo '\t' |
grep t
> /dev
/null
; then
961 # For zsh: turn sh-emulation on.
962 if test -z "$have_echo" \
963 && test -n "$ZSH_VERSION" \
964 && (emulate sh
) >/dev
/null
2>&1; then
967 # For ksh: alias echo to 'print -r'.
968 if test -z "$have_echo" \
969 && (type print
) >/dev
/null
2>&1; then
970 # A 'print' command exists.
971 if type print
2>/dev
/null |
grep / > /dev
/null
; then
974 # 'print' is a shell built-in.
975 if (print
-r '\told' |
grep told
> /dev
/null
) 2>/dev
/null
; then
976 # 'print' is the ksh shell built-in.
977 alias echo='print -r'
981 if test -z "$have_echo" \
982 && echo '\t' |
grep t
> /dev
/null
; then
985 # For ksh: alias echo to a function that uses cat of a here document.
986 # The ksh manual page says:
987 # "Aliasing is performed when scripts are read, not while they are executed.
988 # Therefore, for an alias to take effect, the alias definition command has
989 # to be executed before the command which references the alias is read."
990 # Because of this, we have to play strange tricks with have_echo, to ensure
991 # that the top-level statement containing the test starts after the 'alias'
993 if test -z "$have_echo"; then
1000 if (alias echo=bsd_echo
) 2>/dev
/null
; then
1001 alias echo=bsd_echo
2>/dev
/null
1004 if test -z "$have_echo" \
1005 && echo '\t' |
grep t
> /dev
/null
; then
1008 if test -z "$have_echo"; then
1009 if (alias echo=bsd_echo
) 2>/dev
/null
; then
1010 unalias echo 2>/dev
/null
1013 # For Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh.
1014 if test -z "$have_echo" \
1015 && test "X$1" != "X--no-reexec" \
1016 && test -f /bin
/ksh
; then
1017 exec /bin
/ksh
"$0" --no-reexec "$@"
1020 # Otherwise: respawn using /bin/sh.
1021 if test -z "$have_echo" \
1022 && test "X$1" != "X--no-reexec" \
1023 && test -f /bin
/sh
; then
1024 exec /bin
/sh
"$0" --no-reexec "$@"
1027 if test -z "$have_echo"; then
1028 func_fatal_error
"Shell does not support 'echo' correctly. Please install GNU bash and set the environment variable CONFIG_SHELL to point to it."
1030 if echo '\t' |
grep t
> /dev
/null
; then
1033 func_fatal_error
"Shell does not support 'echo' correctly. Workaround does not work. Please report this as a bug to bug-gnulib@gnu.org."
1035 if test "X$1" = "X--no-reexec"; then
1039 # Unset CDPATH. Otherwise, output from 'cd dir' can surprise callers.
1040 (unset CDPATH
) >/dev
/null
2>&1 && unset CDPATH
1042 # Determine the path separator early because the following option parsing code
1044 func_determine_path_separator
1046 # Command-line option processing.
1047 # Removes the OPTIONS from the arguments. Sets the variables:
1048 # - mode one of: list, find, import, add-import, remove-import,
1049 # update, create-testdir, create-megatestdir, test, megatest,
1051 # - destdir from --dir
1052 # - local_gnulib_path from --local-dir
1053 # - modcache true or false, from --cache-modules/--no-cache-modules
1054 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
1055 # - libname, supplied_libname from --lib
1056 # - sourcebase from --source-base
1057 # - m4base from --m4-base
1058 # - pobase from --po-base
1059 # - docbase from --doc-base
1060 # - testsbase from --tests-base
1061 # - auxdir from --aux-dir
1062 # - inctests true if --with-tests was given, false if --without-tests
1063 # was given, blank otherwise
1064 # - incobsolete true if --with-obsolete was given, blank otherwise
1065 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
1066 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
1068 # - inc_privileged_tests true if --with-privileged-tests was given, blank
1070 # - inc_unportable_tests true if --with-unportable-tests was given, blank
1072 # - inc_all_tests true if --with-all-tests was given, blank otherwise
1073 # - excl_cxx_tests true if --without-c++-tests was given, blank otherwise
1074 # - excl_longrunning_tests true if --without-longrunning-tests was given,
1076 # - excl_privileged_tests true if --without-privileged-tests was given, blank
1078 # - excl_unportable_tests true if --without-unportable-tests was given, blank
1080 # - single_configure true if --single-configure was given, false otherwise
1081 # - avoidlist list of modules to avoid, from --avoid
1082 # - cond_dependencies true if --conditional-dependencies was given, false if
1083 # --no-conditional-dependencies was given, blank otherwise
1084 # - lgpl yes or a number if --lgpl was given, blank otherwise
1085 # - gnu_make true if --gnu-make was given, false otherwise
1086 # - makefile_name from --makefile-name
1087 # - libtool true if --libtool was given, false if --no-libtool was
1088 # given, blank otherwise
1089 # - macro_prefix from --macro-prefix
1090 # - po_domain from --po-domain
1091 # - witness_c_macro from --witness-c-macro
1092 # - vc_files true if --vc-files was given, false if --no-vc-files was
1093 # given, blank otherwise
1094 # - autoconf_minversion minimum supported autoconf version
1095 # - doit : if actions shall be executed, false if only to be printed
1096 # - copymode symlink if --symlink or --more-symlinks was given,
1097 # hardlink if --hardlink or --more-hardlinks was given,
1099 # - lcopymode symlink if --local-symlink was given,
1100 # hardlink if --local-hardlink was given,
1102 # - do_copyrights blank if --more-symlinks or --more-hardlinks was given,
1121 inc_longrunning_tests
=
1122 inc_privileged_tests
=
1123 inc_unportable_tests
=
1126 excl_longrunning_tests
=
1127 excl_privileged_tests
=
1128 excl_unportable_tests
=
1129 single_configure
=false
1147 while test $# -gt 0; do
1152 --find |
--fin |
--fi |
--f )
1155 --import |
--impor |
--impo |
--imp |
--im |
--i )
1158 --add-import |
--add-impor |
--add-impo |
--add-imp |
--add-im |
--add-i |
--add- |
--add |
--ad )
1161 --remove-import |
--remove-impor |
--remove-impo |
--remove-imp |
--remove-im |
--remove-i |
--remove- |
--remove |
--remov |
--remo |
--rem |
--re |
--r )
1164 --update |
--updat |
--upda |
--upd |
--up |
--u )
1167 --create-testdir |
--create-testdi |
--create-testd |
--create-test |
--create-tes |
--create-te |
--create-t )
1170 --create-megatestdir |
--create-megatestdi |
--create-megatestd |
--create-megatest |
--create-megates |
--create-megate |
--create-megat |
--create-mega |
--create-meg |
--create-me |
--create-m )
1171 mode
=create-megatestdir
1173 --test |
--tes |
--te |
--t )
1176 --megatest |
--megates |
--megate |
--megat |
--mega |
--meg |
--me |
--m )
1180 mode
=`echo "X$1" | sed -e 's/^X--//'`
1182 --copy-file |
--copy-fil |
--copy-fi |
--copy-f |
--copy- |
--copy |
--cop )
1187 if test $# = 0; then
1188 func_fatal_error
"missing argument for --dir"
1193 destdir
=`echo "X$1" | sed -e 's/^X--dir=//'`
1197 if test $# = 0; then
1198 func_fatal_error
"missing argument for --local-dir"
1200 func_path_prepend local_gnulib_path
"$1"
1203 local_dir
=`echo "X$1" | sed -e 's/^X--local-dir=//'`
1204 func_path_prepend local_gnulib_path
"$local_dir"
1206 --cache-modules |
--cache-module |
--cache-modul |
--cache-modu |
--cache-mod |
--cache-mo |
--cache-m |
--cache- |
--cache |
--cach |
--cac |
--ca )
1209 --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 )
1212 --verbose |
--verbos |
--verbo |
--verb )
1213 verbose
=`expr $verbose + 1`
1215 --quiet |
--quie |
--qui |
--qu |
--q )
1216 verbose
=`expr $verbose - 1`
1220 if test $# = 0; then
1221 func_fatal_error
"missing argument for --lib"
1224 supplied_libname
=true
1227 libname
=`echo "X$1" | sed -e 's/^X--lib=//'`
1228 supplied_libname
=true
1232 if test $# = 0; then
1233 func_fatal_error
"missing argument for --source-base"
1238 sourcebase
=`echo "X$1" | sed -e 's/^X--source-base=//'`
1242 if test $# = 0; then
1243 func_fatal_error
"missing argument for --m4-base"
1248 m4base
=`echo "X$1" | sed -e 's/^X--m4-base=//'`
1252 if test $# = 0; then
1253 func_fatal_error
"missing argument for --po-base"
1258 pobase
=`echo "X$1" | sed -e 's/^X--po-base=//'`
1262 if test $# = 0; then
1263 func_fatal_error
"missing argument for --doc-base"
1268 docbase
=`echo "X$1" | sed -e 's/^X--doc-base=//'`
1272 if test $# = 0; then
1273 func_fatal_error
"missing argument for --tests-base"
1278 testsbase
=`echo "X$1" | sed -e 's/^X--tests-base=//'`
1282 if test $# = 0; then
1283 func_fatal_error
"missing argument for --aux-dir"
1288 auxdir
=`echo "X$1" | sed -e 's/^X--aux-dir=//'`
1290 --with-tests |
--with-test |
--with-tes |
--with-te |
--with-t)
1293 --with-obsolete |
--with-obsolet |
--with-obsole |
--with-obsol |
--with-obso |
--with-obs |
--with-ob |
--with-o)
1296 --with-c++-tests |
--with-c++-test |
--with-c++-tes |
--with-c++-te |
--with-c++-t |
--with-c++- |
--with-c++ |
--with-c+ |
--with-c)
1299 --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)
1300 inc_longrunning_tests
=true
1302 --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)
1303 inc_privileged_tests
=true
1305 --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)
1306 inc_unportable_tests
=true
1308 --with-all-tests |
--with-all-test |
--with-all-tes |
--with-all-te |
--with-all-t |
--with-all- |
--with-all |
--with-al |
--with-a)
1311 --without-tests |
--without-test |
--without-tes |
--without-te |
--without-t)
1314 --without-c++-tests |
--without-c++-test |
--without-c++-tes |
--without-c++-te |
--without-c++-t |
--without-c++- |
--without-c++ |
--without-c+ |
--without-c)
1317 --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)
1318 excl_longrunning_tests
=true
1320 --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)
1321 excl_privileged_tests
=true
1323 --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)
1324 excl_unportable_tests
=true
1326 --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)
1327 single_configure
=true
1331 if test $# = 0; then
1332 func_fatal_error
"missing argument for --avoid"
1334 func_append avoidlist
" $1"
1337 arg
=`echo "X$1" | sed -e 's/^X--avoid=//'`
1338 func_append avoidlist
" $arg"
1340 --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)
1341 cond_dependencies
=true
1343 --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)
1344 cond_dependencies
=false
1350 arg
=`echo "X$1" | sed -e 's/^X--lgpl=//'`
1352 2 |
3orGPLv2 |
3) ;;
1353 *) func_fatal_error
"invalid LGPL version number for --lgpl" ;;
1362 if test $# = 0; then
1363 func_fatal_error
"missing argument for --makefile-name"
1368 makefile_name
=`echo "X$1" | sed -e 's/^X--makefile-name=//'`
1378 if test $# = 0; then
1379 func_fatal_error
"missing argument for --macro-prefix"
1384 macro_prefix
=`echo "X$1" | sed -e 's/^X--macro-prefix=//'`
1388 if test $# = 0; then
1389 func_fatal_error
"missing argument for --po-domain"
1394 po_domain
=`echo "X$1" | sed -e 's/^X--po-domain=//'`
1398 if test $# = 0; then
1399 func_fatal_error
"missing argument for --witness-c-macro"
1401 witness_c_macro
="$1"
1403 --witness-c-macro=* )
1404 witness_c_macro
=`echo "X$1" | sed -e 's/^X--witness-c-macro=//'`
1412 --no-changelog |
--no-changelo |
--no-changel |
--no-change |
--no-chang |
--no-chan |
--no-cha |
--no-ch )
1413 # A no-op for backward compatibility.
1418 -s |
--symbolic |
--symboli |
--symbol |
--symbo |
--symb |
--symlink |
--symlin |
--symli |
--syml |
--sym |
--sy )
1421 --local-symlink |
--local-symlin |
--local-symli |
--local-syml |
--local-sym |
--local-sy |
--local-s )
1424 -h |
--hardlink |
--hardlin |
--hardli |
--hardl |
--hard |
--har |
--ha )
1427 --local-hardlink |
--local-hardlin |
--local-hardli |
--local-hardl |
--local-hard |
--local-har |
--local-ha |
--local-h )
1430 -S |
--more-symlinks |
--more-symlink |
--more-symlin |
--more-symli |
--more-syml |
--more-sym |
--more-sy |
--more-s )
1434 -H |
--more-hardlinks |
--more-hardlink |
--more-hardlin |
--more-hardli |
--more-hardl |
--more-hard |
--more-har |
--more-ha |
--more-h )
1438 --help |
--hel |
--he )
1441 --version |
--versio |
--versi |
--vers )
1445 # Stop option processing
1449 echo "gnulib-tool: unknown option $1" 1>&2
1450 echo "Try 'gnulib-tool --help' for more information." 1>&2
1457 if case "$mode" in import | add-import | remove-import
) true
;; *) false
;; esac; then
1458 if test -n "$excl_cxx_tests" ||
test -n "$excl_longrunning_tests" \
1459 ||
test -n "$excl_privileged_tests" ||
test -n "$excl_unportable_tests" \
1460 ||
test "$single_configure" != false
; then
1461 echo "gnulib-tool: invalid options for '$mode' mode" 1>&2
1462 echo "Try 'gnulib-tool --help' for more information." 1>&2
1466 if test "$mode" = update
; then
1467 if test $# != 0; then
1468 echo "gnulib-tool: too many arguments in 'update' mode" 1>&2
1469 echo "Try 'gnulib-tool --help' for more information." 1>&2
1470 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1471 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1474 if test -n "$local_gnulib_path" ||
test -n "$supplied_libname" \
1475 ||
test -n "$sourcebase" ||
test -n "$m4base" ||
test -n "$pobase" \
1476 ||
test -n "$docbase" ||
test -n "$testsbase" ||
test -n "$auxdir" \
1477 ||
test -n "$inctests" ||
test -n "$incobsolete" \
1478 ||
test -n "$inc_cxx_tests" ||
test -n "$inc_longrunning_tests" \
1479 ||
test -n "$inc_privileged_tests" ||
test -n "$inc_unportable_tests" \
1480 ||
test -n "$inc_all_tests" \
1481 ||
test -n "$excl_cxx_tests" ||
test -n "$excl_longrunning_tests" \
1482 ||
test -n "$excl_privileged_tests" ||
test -n "$excl_unportable_tests" \
1483 ||
test -n "$avoidlist" ||
test -n "$lgpl" ||
test -n "$makefile_name" \
1484 ||
test -n "$macro_prefix" ||
test -n "$po_domain" \
1485 ||
test -n "$witness_c_macro" ||
test -n "$vc_files"; then
1486 echo "gnulib-tool: invalid options for 'update' mode" 1>&2
1487 echo "Try 'gnulib-tool --help' for more information." 1>&2
1488 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1489 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1493 if test -n "$pobase" && test -z "$po_domain"; then
1494 echo "gnulib-tool: together with --po-base, you need to specify --po-domain" 1>&2
1495 echo "Try 'gnulib-tool --help' for more information." 1>&2
1498 if test -z "$pobase" && test -n "$po_domain"; then
1499 func_warning
"--po-domain has no effect without a --po-base option"
1501 case $mode,$gnu_make in
1503 echo "gnulib-tool: --gnu-make not supported when including tests"
1506 # Canonicalize the inctests variable.
1508 import | add-import | remove-import | update
)
1509 if test -z "$inctests"; then
1513 create-testdir | create-megatestdir |
test | megatest
)
1514 if test -z "$inctests"; then
1519 # Now the only possible values of "$inctests" are true and false
1520 # (or blank but then it is irrelevant).
1522 # Determine the minimum supported autoconf version from the project's
1524 DEFAULT_AUTOCONF_MINVERSION
="2.63"
1525 autoconf_minversion
=
1527 if case "$mode" in import | add-import | remove-import | update
) true
;; *) false
;; esac \
1528 && test -n "$destdir"; then
1529 if test -f "$destdir"/configure.ac
; then
1530 configure_ac
="$destdir/configure.ac"
1532 if test -f "$destdir"/configure.
in; then
1533 configure_ac
="$destdir/configure.in"
1537 if test -f configure.ac
; then
1538 configure_ac
="configure.ac"
1540 if test -f configure.
in; then
1541 configure_ac
="configure.in"
1545 if test -n "$configure_ac"; then
1546 # Use sed, not autoconf --trace, to look for the AC_PREREQ invocation,
1547 # because when some m4 files are omitted from a version control repository,
1548 # "autoconf --trace=AC_PREREQ" fails with an error message like this:
1549 # m4: aclocal.m4:851: Cannot open m4/absolute-header.m4: No such file or directory
1550 # autom4te: m4 failed with exit status: 1
1557 s,^.*AC_PREREQ([[ ]*\([^])]*\).*$,\1,p
1559 prereqs
=`sed -n -e "$my_sed_traces" < "$configure_ac"`
1560 if test -n "$prereqs"; then
1561 autoconf_minversion
=`
1562 for version in $prereqs; do echo $version; done |
1563 LC_ALL=C sort -nru | sed -e 1q
1567 if test -z "$autoconf_minversion"; then
1568 autoconf_minversion
=$DEFAULT_AUTOCONF_MINVERSION
1570 case "$autoconf_minversion" in
1571 1.
* |
2.
[0-5]* |
2.6[0-2]*)
1572 func_fatal_error
"minimum supported autoconf version is 2.63. Try adding AC_PREREQ([$DEFAULT_AUTOCONF_MINVERSION]) to your configure.ac." ;;
1575 # Remove trailing slashes from the directory names. This is necessary for
1576 # m4base (to avoid an error in func_import) and optional for the others.
1577 sed_trimtrailingslashes
='s,\([^/]\)//*$,\1,'
1578 old_local_gnulib_path
=$local_gnulib_path
1582 for dir
in $old_local_gnulib_path
1585 */ ) dir
=`echo "$dir" | sed -e "$sed_trimtrailingslashes"` ;;
1587 func_path_append local_gnulib_path
"$dir"
1590 case "$sourcebase" in
1591 */ ) sourcebase
=`echo "$sourcebase" | sed -e "$sed_trimtrailingslashes"` ;;
1594 */ ) m4base
=`echo "$m4base" | sed -e "$sed_trimtrailingslashes"` ;;
1597 */ ) pobase
=`echo "$pobase" | sed -e "$sed_trimtrailingslashes"` ;;
1600 */ ) docbase
=`echo "$docbase" | sed -e "$sed_trimtrailingslashes"` ;;
1602 case "$testsbase" in
1603 */ ) testsbase
=`echo "$testsbase" | sed -e "$sed_trimtrailingslashes"` ;;
1606 */ ) auxdir
=`echo "$auxdir" | sed -e "$sed_trimtrailingslashes"` ;;
1612 trap 'exit_status=$?
1613 if test "$signal" != 0; then
1614 echo "caught signal $signal" >&2
1617 exit $exit_status' 0
1618 for signal
in 1 2 3 13 15; do
1619 trap '{ signal='$signal'; func_exit 1; }' $signal
1623 # Note: The 'eval' silences stderr output in dash.
1624 if (declare -A x
&& { x
[f
/2]='foo'; x
[f
/3]='bar'; eval test '${x[f/2]}' = foo
; }) 2>/dev
/null
; then
1625 # Zsh 4 and Bash 4 have associative arrays.
1626 have_associative
=true
1628 # For other shells, use 'eval' with computed shell variable names.
1629 have_associative
=false
1632 # func_lookup_local_file_cb dir file
1633 # return true and set func_lookup_local_file_result if the file 'dir/file'
1635 func_lookup_local_file_cb
()
1637 test -n "$func_lookup_local_file_result" && return 1 # already found?
1638 test -f "$1/$2" ||
return 1
1639 func_lookup_local_file_result
=$1/$2
1643 # func_lookup_local_file file
1644 # looks up a file in $local_gnulib_path.
1646 # - local_gnulib_path from --local-dir
1648 # - func_lookup_local_file_result name of the file, valid only when the
1649 # function succeeded.
1650 func_lookup_local_file
()
1652 func_lookup_local_file_result
=
1653 func_path_foreach
"$local_gnulib_path" func_lookup_local_file_cb
%dir
% "$1"
1656 # func_lookup_file file
1657 # looks up a file in $local_gnulib_path or $gnulib_dir, or combines it through
1660 # - local_gnulib_path from --local-dir
1662 # - lookedup_file name of the merged (combined) file
1663 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
1667 if func_lookup_local_file
"$lkfile"; then
1668 lookedup_file
=$func_lookup_local_file_result
1671 if test -f "$gnulib_dir/$lkfile"; then
1672 if func_lookup_local_file
"$lkfile.diff"; then
1673 lkbase
=`echo "$lkfile" | sed -e 's,^.*/,,'`
1674 rm -f "$tmp/$lkbase"
1675 cp "$gnulib_dir/$lkfile" "$tmp/$lkbase"
1676 patch -s "$tmp/$lkbase" < "$func_lookup_local_file_result" >&2 \
1677 || func_fatal_error
"patch file $func_lookup_local_file_result didn't apply cleanly"
1678 lookedup_file
="$tmp/$lkbase"
1681 lookedup_file
="$gnulib_dir/$lkfile"
1685 func_fatal_error
"file $gnulib_dir/$lkfile not found"
1690 # func_sanitize_modulelist
1691 # receives a list of possible module names on standard input, one per line.
1692 # It removes those which are just file names unrelated to modules, and outputs
1693 # the resulting list to standard output, one per line.
1694 func_sanitize_modulelist
()
1696 sed -e '/^ChangeLog$/d' -e '/\/ChangeLog$/d' \
1697 -e '/^COPYING$/d' -e '/\/COPYING$/d' \
1698 -e '/^README$/d' -e '/\/README$/d' \
1699 -e '/^TEMPLATE$/d' \
1700 -e '/^TEMPLATE-EXTENDED$/d' \
1701 -e '/^TEMPLATE-TESTS$/d' \
1707 # func_modules_in_dir dir
1708 # outputs all module files in dir to standard output.
1709 func_modules_in_dir
()
1711 (test -d "$1" && cd "$1" && find modules
-type f
-print)
1716 # - local_gnulib_path from --local-dir
1719 # Filter out metainformation files like README, which are not modules.
1720 # Filter out unit test modules; they can be retrieved through
1721 # --extract-tests-module if desired.
1723 (cd "$gnulib_dir" && find modules
-type f
-print |
sed -e 's,^modules/,,')
1724 func_path_foreach
"$local_gnulib_path" func_modules_in_dir
%dir
% |
sed -e 's,^modules/,,' -e 's,\.diff$,,'
1726 | func_sanitize_modulelist \
1727 |
sed -e '/-tests$/d' \
1731 # func_exists_local_module dir module
1732 # returns true if module exists in dir
1733 func_exists_local_module
()
1735 test -d "$1/modules" && test -f "$1/modules/$2";
1738 # func_exists_module module
1739 # tests whether a module, given by name, exists
1741 # - local_gnulib_path from --local-dir
1742 func_exists_module
()
1744 { test -f "$gnulib_dir/modules/$1" \
1745 || func_path_foreach
"$local_gnulib_path" func_exists_local_module
%dir
% "$1" ; } \
1746 && test "ChangeLog" != "$1" \
1747 && test "COPYING" != "$1" \
1748 && test "README" != "$1" \
1749 && test "TEMPLATE" != "$1" \
1750 && test "TEMPLATE-EXTENDED" != "$1" \
1751 && test "TEMPLATE-TESTS" != "$1"
1754 # func_verify_module
1755 # verifies a module name
1757 # - local_gnulib_path from --local-dir
1758 # - module module name argument
1760 # - module unchanged if OK, empty if not OK
1761 # - lookedup_file if OK: name of the merged (combined) module description file
1762 # - lookedup_tmp if OK: true if it is located in the tmp directory, blank otherwise
1763 func_verify_module
()
1765 if func_exists_module
"$module"; then
1766 # OK, $module is a correct module name.
1767 # Verify that building the module description with 'patch' succeeds.
1768 func_lookup_file
"modules/$module"
1770 func_warning
"module $module doesn't exist"
1775 # func_verify_nontests_module
1776 # verifies a module name, excluding tests modules
1778 # - local_gnulib_path from --local-dir
1779 # - module module name argument
1780 func_verify_nontests_module
()
1783 *-tests ) module
= ;;
1784 * ) func_verify_module
;;
1788 # func_verify_tests_module
1789 # verifies a module name, considering only tests modules
1791 # - local_gnulib_path from --local-dir
1792 # - module module name argument
1793 func_verify_tests_module
()
1796 *-tests ) func_verify_module
;;
1801 # Suffix of a sed expression that extracts a particular field from a
1802 # module description.
1803 # A field starts with a line that contains a keyword, such as 'Description',
1804 # followed by a colon and optional whitespace. All following lines, up to
1805 # the next field (or end of file if there is none) form the contents of the
1807 # An absent field is equivalent to a field with empty contents.
1808 # NOTE: Keep this in sync with sed_extract_cache_prog below!
1809 sed_extract_prog
=':[ ]*$/ {
1812 s/^Description:[ ]*$//
1816 s/^Applicability:[ ]*$//
1818 s/^Depends-on:[ ]*$//
1819 s/^configure\.ac-early:[ ]*$//
1820 s/^configure\.ac:[ ]*$//
1821 s/^Makefile\.am:[ ]*$//
1825 s/^Maintainer:[ ]*$//
1832 # Piece of a sed expression that converts a field header line to a shell
1834 # NOTE: Keep this in sync with sed_extract_prog above!
1835 sed_extract_field_header
='
1836 s/^Description:[ ]*$/description/
1837 s/^Comment:[ ]*$/comment/
1838 s/^Status:[ ]*$/status/
1839 s/^Notice:[ ]*$/notice/
1840 s/^Applicability:[ ]*$/applicability/
1841 s/^Files:[ ]*$/files/
1842 s/^Depends-on:[ ]*$/dependson/
1843 s/^configure\.ac-early:[ ]*$/configureac_early/
1844 s/^configure\.ac:[ ]*$/configureac/
1845 s/^Makefile\.am:[ ]*$/makefile/
1846 s/^Include:[ ]*$/include/
1848 s/^License:[ ]*$/license/
1849 s/^Maintainer:[ ]*$/maintainer/'
1853 if $have_associative; then
1855 # Declare the associative arrays.
1856 declare -A modcache_cached
1857 sed_to_declare_statement
='s|^.*/\([a-zA-Z0-9_]*\)/$|declare -A modcache_\1|p'
1858 declare_script
=`echo "$sed_extract_field_header" | sed -n -e "$sed_to_declare_statement"`
1859 eval "$declare_script"
1863 # func_cache_var module
1864 # computes the cache variable name corresponding to $module.
1865 # Note: This computation can map different module names to the same
1866 # cachevar (such as 'foo-bar', 'foo_bar', or 'foo/bar'); the caller has
1867 # to protect against this case.
1869 # - cachevar a shell variable name
1870 if (f
=foo
; eval echo '${f//o/e}') < /dev
/null
2>/dev
/null |
grep fee
>/dev
/null
; then
1871 # Bash 2.0 and newer, ksh, and zsh support the syntax
1872 # ${param//pattern/replacement}
1873 # as a shorthand for
1874 # `echo "$param" | sed -e "s/pattern/replacement/g"`.
1875 # Note: The 'eval' is necessary for dash and NetBSD /bin/sh.
1876 eval 'func_cache_var ()
1878 cachevar=c_${1//[!a-zA-Z0-9_]/_}
1885 cachevar
=c_
`echo "$1" | LC_ALL=C sed -e 's/[^a-zA-Z0-9_]/_/g'` ;;
1894 # func_init_sed_convert_to_cache_statements
1896 # - modcachevar_assignment
1898 # - sed_convert_to_cache_statements
1899 func_init_sed_convert_to_cache_statements
()
1901 # 'sed' script that turns a module description into shell script
1902 # assignments, suitable to be eval'ed. All active characters are escaped.
1905 # Some module's description
1910 # modcache_description[$1]=\
1911 # 'Some module'"'"'s description
1913 # modcache_files[$1]=\
1916 # c_MODULE_description_set=set; c_MODULE_description=\
1917 # 'Some module'"'"'s description
1919 # c_MODULE_files_set=set; c_MODULE_files=\
1921 # The script consists of two parts:
1922 # 1) Ignore the lines before the first field header.
1923 # 2) A loop, treating non-field-header lines by escaping single quotes
1924 # and adding a closing quote in the last line,
1925 sed_convert_to_cache_statements
="
1927 # Here we have not yet seen a field header.
1929 # See if the current line contains a field header.
1932 ${sed_extract_field_header}
1935 # No field header. Ignore the line.
1937 # Read the next line. Upon EOF, just exit.
1942 # The current line contains a field header.
1944 # Turn it into the beginning of an assignment.
1945 s/^\\(.*\\)\$/${modcachevar_assignment}\\\\/
1947 # Move it to the hold space. Don't print it yet,
1948 # because we want no assignment if the field is empty.
1951 # Read the next line.
1952 # Upon EOF, the field was empty. Print no assignment. Just exit.
1955 # See if the current line contains a field header.
1958 ${sed_extract_field_header}
1959 # If it is, the previous field was empty. Print no assignment.
1962 # Not a field header.
1964 # Print the previous line, held in the hold space.
1969 # Transform single quotes.
1972 # Prepend a single quote.
1977 # Move it to the hold space.
1980 # Read the next line.
1987 # See if the current line contains a field header.
1990 ${sed_extract_field_header}
1993 # Print the previous line, held in the hold space.
1998 # Transform single quotes.
2005 # Print the previous line, held in the hold space, with a single quote
2006 # to end the assignment.
2016 # Print the previous line, held in the hold space, with a single quote
2017 # to end the assignment.
2024 if ! $sed_comments; then
2026 sed_convert_to_cache_statements
=`echo "$sed_convert_to_cache_statements" \
2027 | sed -e 's/^ *//' -e 's/^#.*//'`
2031 if $have_associative; then
2032 # sed_convert_to_cache_statements does not depend on the module.
2033 modcachevar_assignment
='modcache_\1[$1]='
2034 func_init_sed_convert_to_cache_statements
2037 # func_cache_lookup_module module
2039 # looks up a module, like 'func_lookup_file modules/$module', and stores all
2040 # of its relevant data in a cache in the memory of the processing shell. If
2041 # already cached, it does not look it up again, thus saving file access time.
2043 # - module non-empty string
2044 # Output if $have_associative:
2045 # - modcache_cached[$module] set to yes
2046 # - modcache_description[$module] ==
2047 # - modcache_status[$module] \ set to the field's value, minus the
2048 # - ... / final newline,
2049 # - modcache_maintainer[$module] == or unset if the field's value is empty
2050 # Output if ! $have_associative:
2051 # - cachevar a shell variable name
2052 # - ${cachevar}_cached set to $module
2053 # - ${cachevar}_description ==
2054 # - ${cachevar}_status \ set to the field's value, minus the
2055 # - ... / final newline,
2056 # - ${cachevar}_maintainer == or unset if the field's value is empty
2057 # - ${cachevar}_description_set ==
2058 # - ${cachevar}_status_set \ set to non-empty if the field's value
2059 # - ... / is non-empty,
2060 # - ${cachevar}_maintainer_set == or unset if the field's value is empty
2061 func_cache_lookup_module
()
2063 if $have_associative; then
2064 eval 'cached=${modcache_cached[$1]}'
2067 eval "cached=\"\$${cachevar}_cached\""
2069 if test -z "$cached"; then
2070 # Not found in cache. Look it up on the file system.
2071 func_lookup_file
"modules/$1"
2072 if $have_associative; then
2073 eval 'modcache_cached[$1]=yes'
2075 eval "${cachevar}_cached=\"\$1\""
2077 if ! $have_associative; then
2078 # sed_convert_to_cache_statements depends on the module.
2079 modcachevar_assignment
="${cachevar}"'_\1_set=set; '"${cachevar}"'_\1='
2080 func_init_sed_convert_to_cache_statements
2082 cache_statements
=`LC_ALL=C sed -n -e "$sed_convert_to_cache_statements" < "$lookedup_file"`
2083 eval "$cache_statements"
2085 if ! $have_associative; then
2086 if test "$1" != "$cached"; then
2087 func_fatal_error
"cache variable collision between $1 and $cached"
2095 # func_get_description module
2097 # - local_gnulib_path from --local-dir
2098 # - modcache true or false, from --cache-modules/--no-cache-modules
2099 func_get_description
()
2101 if ! $modcache; then
2102 func_lookup_file
"modules/$1"
2103 sed -n -e "/^Description$sed_extract_prog" < "$lookedup_file"
2105 func_cache_lookup_module
"$1"
2106 # Output the field's value, including the final newline (if any).
2107 if $have_associative; then
2108 if eval 'test -n "${modcache_description[$1]+set}"'; then
2109 eval 'echo "${modcache_description[$1]}"'
2112 eval "field_set=\"\$${cachevar}_description_set\""
2113 if test -n "$field_set"; then
2114 eval "field_value=\"\$${cachevar}_description\""
2115 echo "${field_value}"
2121 # func_get_comment module
2123 # - local_gnulib_path from --local-dir
2124 # - modcache true or false, from --cache-modules/--no-cache-modules
2127 if ! $modcache; then
2128 func_lookup_file
"modules/$1"
2129 sed -n -e "/^Comment$sed_extract_prog" < "$lookedup_file"
2131 func_cache_lookup_module
"$1"
2132 # Output the field's value, including the final newline (if any).
2133 if $have_associative; then
2134 if eval 'test -n "${modcache_comment[$1]+set}"'; then
2135 eval 'echo "${modcache_comment[$1]}"'
2138 eval "field_set=\"\$${cachevar}_comment_set\""
2139 if test -n "$field_set"; then
2140 eval "field_value=\"\$${cachevar}_comment\""
2141 echo "${field_value}"
2147 # func_get_status module
2149 # - local_gnulib_path from --local-dir
2150 # - modcache true or false, from --cache-modules/--no-cache-modules
2153 if ! $modcache; then
2154 func_lookup_file
"modules/$1"
2155 sed -n -e "/^Status$sed_extract_prog" < "$lookedup_file"
2157 func_cache_lookup_module
"$1"
2158 # Output the field's value, including the final newline (if any).
2159 if $have_associative; then
2160 if eval 'test -n "${modcache_status[$1]+set}"'; then
2161 eval 'echo "${modcache_status[$1]}"'
2164 eval "field_set=\"\$${cachevar}_status_set\""
2165 if test -n "$field_set"; then
2166 eval "field_value=\"\$${cachevar}_status\""
2167 echo "${field_value}"
2173 # func_get_notice module
2175 # - local_gnulib_path from --local-dir
2176 # - modcache true or false, from --cache-modules/--no-cache-modules
2179 if ! $modcache; then
2180 func_lookup_file
"modules/$1"
2181 sed -n -e "/^Notice$sed_extract_prog" < "$lookedup_file"
2183 func_cache_lookup_module
"$1"
2184 # Output the field's value, including the final newline (if any).
2185 if $have_associative; then
2186 if eval 'test -n "${modcache_notice[$1]+set}"'; then
2187 eval 'echo "${modcache_notice[$1]}"'
2190 eval "field_set=\"\$${cachevar}_notice_set\""
2191 if test -n "$field_set"; then
2192 eval "field_value=\"\$${cachevar}_notice\""
2193 echo "${field_value}"
2199 # func_get_applicability module
2201 # - local_gnulib_path from --local-dir
2202 # - modcache true or false, from --cache-modules/--no-cache-modules
2203 # The expected result (on stdout) is either 'main', or 'tests', or 'all'.
2204 func_get_applicability
()
2206 if ! $modcache; then
2207 func_lookup_file
"modules/$1"
2208 my_applicability
=`sed -n -e "/^Applicability$sed_extract_prog" < "$lookedup_file"`
2210 func_cache_lookup_module
"$1"
2211 # Get the field's value, without the final newline.
2212 if $have_associative; then
2213 eval 'my_applicability="${modcache_applicability[$1]}"'
2215 eval "my_applicability=\"\$${cachevar}_applicability\""
2218 if test -n "$my_applicability"; then
2219 echo $my_applicability
2221 # The default is 'main' or 'tests', depending on the module's name.
2223 *-tests) echo "tests";;
2229 # func_get_filelist module
2231 # - local_gnulib_path from --local-dir
2232 # - modcache true or false, from --cache-modules/--no-cache-modules
2233 func_get_filelist
()
2235 if ! $modcache; then
2236 func_lookup_file
"modules/$1"
2237 sed -n -e "/^Files$sed_extract_prog" < "$lookedup_file"
2239 func_cache_lookup_module
"$1"
2240 # Output the field's value, including the final newline (if any).
2241 if $have_associative; then
2242 if eval 'test -n "${modcache_files[$1]+set}"'; then
2243 eval 'echo "${modcache_files[$1]}"'
2246 eval "field_set=\"\$${cachevar}_files_set\""
2247 if test -n "$field_set"; then
2248 eval "field_value=\"\$${cachevar}_files\""
2249 echo "${field_value}"
2254 echo m
4/gnulib-common.
m4
2257 # func_filter_filelist outputvar separator filelist prefix suffix removed_prefix removed_suffix [added_prefix [added_suffix]]
2258 # stores in outputvar the filtered and processed filelist. Filtering: Only the
2259 # elements starting with prefix and ending with suffix are considered.
2260 # Processing: removed_prefix and removed_suffix are removed from each element,
2261 # added_prefix and added_suffix are added to each element.
2262 # prefix, suffix should not contain shell-special characters.
2263 # removed_prefix, removed_suffix should not contain the characters "$`\{}[]^|.
2264 # added_prefix, added_suffix should not contain the characters \|&.
2265 func_filter_filelist
()
2267 if test "$2" != "$nl" \
2268 ||
{ $fast_func_append \
2269 && { test -z "$6" ||
$fast_func_remove_prefix; } \
2270 && { test -z "$7" ||
$fast_func_remove_suffix; }; \
2274 # Do not quote possibly-empty parameters in case patterns,
2275 # AIX and HP-UX ksh won't match them if they are empty.
2278 if test -n "$6"; then
2279 func_remove_prefix fff
"$6"
2281 if test -n "$7"; then
2282 func_remove_suffix fff
"$7"
2285 if test -z "$ffflist"; then
2288 func_append ffflist
"$2${fff}"
2294 sed_fff_filter
="s|^$6\(.*\)$7\$|$8\\1$9|"
2295 ffflist
=`for fff in $3; do
2297 $4*$5) echo "$fff" ;;
2299 done | sed -e "$sed_fff_filter"`
2301 eval "$1=\"\$ffflist\""
2304 # func_get_dependencies module
2306 # - local_gnulib_path from --local-dir
2307 # - modcache true or false, from --cache-modules/--no-cache-modules
2308 func_get_dependencies
()
2310 # ${module}-tests implicitly depends on ${module}, if that module exists.
2314 func_remove_suffix fgd1
'-tests'
2315 if func_exists_module
"$fgd1"; then
2320 # Then the explicit dependencies listed in the module description.
2321 { if ! $modcache; then
2322 func_lookup_file
"modules/$1"
2323 sed -n -e "/^Depends-on$sed_extract_prog" < "$lookedup_file"
2325 func_cache_lookup_module
"$1"
2326 # Output the field's value, including the final newline (if any).
2327 if $have_associative; then
2328 if eval 'test -n "${modcache_dependson[$1]+set}"'; then
2329 eval 'echo "${modcache_dependson[$1]}"'
2332 eval "field_set=\"\$${cachevar}_dependson_set\""
2333 if test -n "$field_set"; then
2334 eval "field_value=\"\$${cachevar}_dependson\""
2335 echo "${field_value}"
2343 sed_dependencies_without_conditions
='s/ *\[.*//'
2345 # func_get_autoconf_early_snippet module
2347 # - local_gnulib_path from --local-dir
2348 # - modcache true or false, from --cache-modules/--no-cache-modules
2349 func_get_autoconf_early_snippet
()
2351 if ! $modcache; then
2352 func_lookup_file
"modules/$1"
2353 sed -n -e "/^configure\.ac-early$sed_extract_prog" < "$lookedup_file"
2355 func_cache_lookup_module
"$1"
2356 # Output the field's value, including the final newline (if any).
2357 if $have_associative; then
2358 if eval 'test -n "${modcache_configureac_early[$1]+set}"'; then
2359 eval 'echo "${modcache_configureac_early[$1]}"'
2362 eval "field_set=\"\$${cachevar}_configureac_early_set\""
2363 if test -n "$field_set"; then
2364 eval "field_value=\"\$${cachevar}_configureac_early\""
2365 echo "${field_value}"
2371 # func_get_autoconf_snippet module
2373 # - local_gnulib_path from --local-dir
2374 # - modcache true or false, from --cache-modules/--no-cache-modules
2375 func_get_autoconf_snippet
()
2377 if ! $modcache; then
2378 func_lookup_file
"modules/$1"
2379 sed -n -e "/^configure\.ac$sed_extract_prog" < "$lookedup_file"
2381 func_cache_lookup_module
"$1"
2382 # Output the field's value, including the final newline (if any).
2383 if $have_associative; then
2384 if eval 'test -n "${modcache_configureac[$1]+set}"'; then
2385 eval 'echo "${modcache_configureac[$1]}"'
2388 eval "field_set=\"\$${cachevar}_configureac_set\""
2389 if test -n "$field_set"; then
2390 eval "field_value=\"\$${cachevar}_configureac\""
2391 echo "${field_value}"
2397 # Concatenate lines with trailing slash.
2398 # $1 is an optional filter to restrict the
2399 # concatenation to groups starting with that expression
2401 sed -e "/$1.*"'\\$/{
2410 # func_get_automake_snippet_conditional module
2411 # returns the part of the Makefile.am snippet that can be put inside Automake
2414 # - local_gnulib_path from --local-dir
2415 # - modcache true or false, from --cache-modules/--no-cache-modules
2416 func_get_automake_snippet_conditional
()
2418 if ! $modcache; then
2419 func_lookup_file
"modules/$1"
2420 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
2422 func_cache_lookup_module
"$1"
2423 # Output the field's value, including the final newline (if any).
2424 if $have_associative; then
2425 if eval 'test -n "${modcache_makefile[$1]+set}"'; then
2426 eval 'echo "${modcache_makefile[$1]}"'
2429 eval "field_set=\"\$${cachevar}_makefile_set\""
2430 if test -n "$field_set"; then
2431 eval "field_value=\"\$${cachevar}_makefile\""
2432 echo "${field_value}"
2438 # func_get_automake_snippet_unconditional module
2439 # returns the part of the Makefile.am snippet that must stay outside of
2440 # Automake conditionals.
2442 # - local_gnulib_path from --local-dir
2443 # - modcache true or false, from --cache-modules/--no-cache-modules
2444 func_get_automake_snippet_unconditional
()
2448 # *-tests module live in tests/, not lib/.
2449 # Synthesize an EXTRA_DIST augmentation.
2450 all_files
=`func_get_filelist $1`
2451 func_filter_filelist tests_files
" " "$all_files" 'tests/' '' 'tests/' ''
2452 extra_files
="$tests_files"
2453 if test -n "$extra_files"; then
2454 echo "EXTRA_DIST +=" $extra_files
2459 # Synthesize an EXTRA_DIST augmentation.
2460 sed_extract_mentioned_files
='s/^lib_SOURCES[ ]*+=[ ]*//p'
2461 already_mentioned_files
=` \
2462 { if ! $modcache; then
2463 func_lookup_file "modules/$1"
2464 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
2466 func_cache_lookup_module "$1"
2467 if $have_associative; then
2468 if eval 'test -n "${modcache_makefile[$1]+set}"'; then
2469 eval 'echo "${modcache_makefile[$1]}"'
2472 eval 'field_set="$'"${cachevar}"'_makefile_set"'
2473 if test -n "$field_set"; then
2474 eval 'field_value="$'"${cachevar}"'_makefile"'
2475 echo "${field_value}"
2481 | sed -n -e "$sed_extract_mentioned_files" | sed -e 's/#.*//'`
2482 all_files
=`func_get_filelist $1`
2483 func_filter_filelist lib_files
"$nl" "$all_files" 'lib/' '' 'lib/' ''
2484 # Remove $already_mentioned_files from $lib_files.
2485 echo "$lib_files" | LC_ALL
=C
sort -u > "$tmp"/lib-files
2486 extra_files
=`for f in $already_mentioned_files; do echo $f; done \
2487 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/lib-files`
2488 if test -n "$extra_files"; then
2489 echo "EXTRA_DIST +=" $extra_files
2492 # Synthesize also an EXTRA_lib_SOURCES augmentation.
2493 # This is necessary so that automake can generate the right list of
2495 # A possible approach would be to use autom4te --trace of the redefined
2496 # AC_LIBOBJ and AC_REPLACE_FUNCS macros when creating the Makefile.am
2497 # (use autom4te --trace, not just grep, so that AC_LIBOBJ invocations
2498 # inside autoconf's built-in macros are not missed).
2499 # But it's simpler and more robust to do it here, based on the file list.
2500 # If some .c file exists and is not used with AC_LIBOBJ - for example,
2501 # a .c file is preprocessed into another .c file for BUILT_SOURCES -,
2502 # automake will generate a useless dependency; this is harmless.
2504 relocatable-prog-wrapper
) ;;
2507 func_filter_filelist extra_files
"$nl" "$extra_files" '' '.c' '' ''
2508 if test -n "$extra_files"; then
2509 echo "EXTRA_lib_SOURCES +=" $extra_files
2514 # Synthesize an EXTRA_DIST augmentation also for the files in build-aux/.
2515 func_filter_filelist buildaux_files
"$nl" "$all_files" 'build-aux/' '' 'build-aux/' ''
2516 if test -n "$buildaux_files"; then
2517 sed_prepend_auxdir
='s,^,$(top_srcdir)/'"$auxdir"'/,'
2518 echo "EXTRA_DIST += "`echo "$buildaux_files" | sed -e "$sed_prepend_auxdir"`
2525 # func_get_automake_snippet module
2527 # - local_gnulib_path from --local-dir
2528 # - modcache true or false, from --cache-modules/--no-cache-modules
2529 func_get_automake_snippet
()
2531 func_get_automake_snippet_conditional
"$1"
2532 func_get_automake_snippet_unconditional
"$1"
2535 # func_get_include_directive module
2537 # - local_gnulib_path from --local-dir
2538 # - modcache true or false, from --cache-modules/--no-cache-modules
2539 func_get_include_directive
()
2542 if ! $modcache; then
2543 func_lookup_file
"modules/$1"
2544 sed -n -e "/^Include$sed_extract_prog" < "$lookedup_file"
2546 func_cache_lookup_module
"$1"
2547 # Output the field's value, including the final newline (if any).
2548 if $have_associative; then
2549 if eval 'test -n "${modcache_include[$1]+set}"'; then
2550 eval 'echo "${modcache_include[$1]}"'
2553 eval "field_set=\"\$${cachevar}_include_set\""
2554 if test -n "$field_set"; then
2555 eval "field_value=\"\$${cachevar}_include\""
2556 echo "${field_value}"
2560 } |
sed -e 's/^\(["<]\)/#include \1/'
2563 # func_get_link_directive module
2565 # - local_gnulib_path from --local-dir
2566 # - modcache true or false, from --cache-modules/--no-cache-modules
2567 func_get_link_directive
()
2569 if ! $modcache; then
2570 func_lookup_file
"modules/$1"
2571 sed -n -e "/^Link$sed_extract_prog" < "$lookedup_file"
2573 func_cache_lookup_module
"$1"
2574 # Output the field's value, including the final newline (if any).
2575 if $have_associative; then
2576 if eval 'test -n "${modcache_link[$1]+set}"'; then
2577 eval 'echo "${modcache_link[$1]}"'
2580 eval "field_set=\"\$${cachevar}_link_set\""
2581 if test -n "$field_set"; then
2582 eval "field_value=\"\$${cachevar}_link\""
2583 echo "${field_value}"
2589 # func_get_license_raw module
2591 # - local_gnulib_path from --local-dir
2592 # - modcache true or false, from --cache-modules/--no-cache-modules
2593 func_get_license_raw
()
2595 if ! $modcache; then
2596 func_lookup_file
"modules/$1"
2597 sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
2599 func_cache_lookup_module
"$1"
2600 # Output the field's value, including the final newline (if any).
2601 if $have_associative; then
2602 if eval 'test -n "${modcache_license[$1]+set}"'; then
2603 eval 'echo "${modcache_license[$1]}"'
2606 eval "field_set=\"\$${cachevar}_license_set\""
2607 if test -n "$field_set"; then
2608 eval "field_value=\"\$${cachevar}_license\""
2609 echo "${field_value}"
2615 # func_get_license module
2617 # - local_gnulib_path from --local-dir
2618 # - modcache true or false, from --cache-modules/--no-cache-modules
2621 # Warn if the License field is missing.
2625 license
=`func_get_license_raw "$1"`
2626 if test -z "$license"; then
2627 func_warning
"module $1 lacks a License"
2633 # These modules are under a weaker license only for the purpose of some
2634 # users who hand-edit it and don't use gnulib-tool. For the regular
2635 # gnulib users they are under a stricter license.
2640 func_get_license_raw
"$1"
2641 # The default is GPL.
2643 } |
sed -e 's,^ *$,,' |
sed -e 1q
2648 # func_get_maintainer module
2650 # - local_gnulib_path from --local-dir
2651 # - modcache true or false, from --cache-modules/--no-cache-modules
2652 func_get_maintainer
()
2654 if ! $modcache; then
2655 func_lookup_file
"modules/$1"
2656 sed -n -e "/^Maintainer$sed_extract_prog" < "$lookedup_file"
2658 func_cache_lookup_module
"$1"
2659 # Output the field's value, including the final newline (if any).
2660 if $have_associative; then
2661 if eval 'test -n "${modcache_maintainer[$1]+set}"'; then
2662 eval 'echo "${modcache_maintainer[$1]}"'
2665 eval "field_set=\"\$${cachevar}_maintainer_set\""
2666 if test -n "$field_set"; then
2667 eval "field_value=\"\$${cachevar}_maintainer\""
2668 echo "${field_value}"
2674 # func_get_tests_module module
2676 # - local_gnulib_path from --local-dir
2677 func_get_tests_module
()
2679 # The naming convention for tests modules is hardwired: ${module}-tests.
2680 if test -f "$gnulib_dir/modules/$1"-tests \
2681 || func_path_foreach
"$local_gnulib_path" func_exists_local_module
%dir
% "$1-tests"; then
2686 # func_get_dependencies_recursively module
2688 # - local_gnulib_path from --local-dir
2689 # - modcache true or false, from --cache-modules/--no-cache-modules
2690 func_get_dependencies_recursively
()
2692 # In order to process every module only once (for speed), process an "input
2693 # list" of modules, producing an "output list" of modules. During each round,
2694 # more modules can be queued in the input list. Once a module on the input
2695 # list has been processed, it is added to the "handled list", so we can avoid
2696 # to process it again.
2700 while test -n "$inmodules"; do
2701 inmodules_this_round
="$inmodules"
2702 inmodules
= # Accumulator, queue for next round
2703 for module
in $inmodules_this_round; do
2705 if test -n "$module"; then
2706 func_append outmodules
" $module"
2707 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
2708 for dep
in $deps; do
2709 func_append inmodules
" $dep"
2713 handledmodules
=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
2714 # Remove $handledmodules from $inmodules.
2715 for m
in $inmodules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/queued-modules
2716 inmodules
=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
2718 rm -f "$tmp"/queued-modules
2719 for m
in $outmodules; do echo $m; done | LC_ALL
=C
sort -u
2722 # func_get_link_directive_recursively module
2724 # - local_gnulib_path from --local-dir
2725 # - modcache true or false, from --cache-modules/--no-cache-modules
2726 func_get_link_directive_recursively
()
2728 # In order to process every module only once (for speed), process an "input
2729 # list" of modules, producing an "output list" of modules. During each round,
2730 # more modules can be queued in the input list. Once a module on the input
2731 # list has been processed, it is added to the "handled list", so we can avoid
2732 # to process it again.
2736 while test -n "$inmodules"; do
2737 inmodules_this_round
="$inmodules"
2738 inmodules
= # Accumulator, queue for next round
2739 for module
in $inmodules_this_round; do
2741 if test -n "$module"; then
2742 if grep '^Link:[ ]*$' "$lookedup_file" >/dev
/null
; then
2743 # The module description has a 'Link:' field. Ignore the dependencies.
2744 func_append outmodules
" $module"
2746 # The module description has no 'Link:' field. Recurse through the dependencies.
2747 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
2748 for dep
in $deps; do
2749 func_append inmodules
" $dep"
2754 handledmodules
=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
2755 # Remove $handledmodules from $inmodules.
2756 for m
in $inmodules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/queued-modules
2757 inmodules
=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
2759 rm -f "$tmp"/queued-modules
2760 for m
in $outmodules; do func_get_link_directive
"$m"; done | LC_ALL
=C
sort -u |
sed -e '/^$/d'
2763 # func_acceptable module
2764 # tests whether a module is acceptable.
2766 # - avoidlist list of modules to avoid
2769 for avoid
in $avoidlist; do
2770 if test "$avoid" = "$1"; then
2777 # sed expression to keep the first 32 characters of each line.
2778 sed_first_32_chars
='s/^\(................................\).*/\1/'
2780 # func_module_shellfunc_name module
2781 # computes the shell function name that will contain the m4 macros for the module.
2783 # - macro_prefix prefix to use
2785 # - shellfunc shell function name
2786 func_module_shellfunc_name
()
2790 shellfunc
=func_
${macro_prefix}_gnulib_m4code_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2792 shellfunc
=func_
${macro_prefix}_gnulib_m4code_
$1 ;;
2796 # func_module_shellvar_name module
2797 # computes the shell variable name the will be set to true once the m4 macros
2798 # for the module have been executed.
2800 # - shellvar shell variable name
2801 func_module_shellvar_name
()
2805 shellvar
=${macro_prefix}_gnulib_enabled_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2807 shellvar
=${macro_prefix}_gnulib_enabled_
$1 ;;
2811 # func_module_conditional_name module
2812 # computes the automake conditional name for the module.
2814 # - conditional name of automake conditional
2815 func_module_conditional_name
()
2819 conditional
=${macro_prefix}_GNULIB_ENABLED_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2821 conditional
=${macro_prefix}_GNULIB_ENABLED_
$1 ;;
2825 # func_uncond_add_module B
2826 # notes the presence of B as an unconditional module.
2828 # func_conddep_add_module A B cond
2829 # notes the presence of a conditional dependency from module A to module B,
2830 # subject to the condition that A is enabled and cond is true.
2832 # func_cond_module_p B
2833 # tests whether module B is conditional.
2835 # func_cond_module_condition A B
2836 # returns the condition when B should be enabled as a dependency of A, once the
2837 # m4 code for A has been executed.
2838 # Output: - condition
2840 if $have_associative; then
2841 declare -A conddep_isuncond
2842 declare -A conddep_dependers
2843 declare -A conddep_condition
2844 func_uncond_add_module
()
2846 eval 'conddep_isuncond[$1]=true'
2847 eval 'unset conddep_dependers[$1]'
2849 func_conddep_add_module
()
2851 eval 'isuncond="${conddep_isuncond[$2]}"'
2852 if test -z "$isuncond"; then
2853 # No unconditional dependency to B known at this point.
2854 eval 'conddep_dependers[$2]="${conddep_dependers[$2]} $1"'
2855 eval 'conddep_condition[$1---$2]="$3"'
2858 func_cond_module_p
()
2860 eval 'previous_dependers="${conddep_dependers[$1]}"'
2861 test -n "$previous_dependers"
2863 func_cond_module_condition
()
2865 eval 'condition="${conddep_condition[$1---$2]}"'
2868 func_uncond_add_module
()
2872 suffix
=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2876 eval 'conddep_isuncond_'"$suffix"'=true'
2877 eval 'unset conddep_dependers_'"$suffix"
2879 func_conddep_add_module
()
2883 suffix
=`echo "$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2887 eval 'isuncond="${conddep_isuncond_'"$suffix"'}"'
2888 if test -z "$isuncond"; then
2889 eval 'conddep_dependers_'"$suffix"'="${conddep_dependers_'"$suffix"'} $1"'
2890 suffix
=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
2891 eval 'conddep_condition_'"$suffix"'="$3"'
2894 func_cond_module_p
()
2898 suffix
=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2902 eval 'previous_dependers="${conddep_dependers_'"$suffix"'}"'
2903 test -n "$previous_dependers"
2905 func_cond_module_condition
()
2907 suffix
=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
2908 eval 'condition="${conddep_condition_'"$suffix"'}"'
2912 # func_modules_transitive_closure
2914 # - local_gnulib_path from --local-dir
2915 # - gnu_make true if --gnu-make was given, false otherwise
2916 # - modcache true or false, from --cache-modules/--no-cache-modules
2917 # - modules list of specified modules
2918 # - inctests true if tests should be included, false otherwise
2919 # - incobsolete true if obsolete modules among dependencies should be
2920 # included, blank otherwise
2921 # - inc_cxx_tests true if C++ interoperability tests should be included,
2923 # - inc_longrunning_tests true if long-runnings tests should be included,
2925 # - inc_privileged_tests true if tests that require root privileges should be
2926 # included, blank otherwise
2927 # - inc_unportable_tests true if tests that fail on some platforms should be
2928 # included, blank otherwise
2929 # - inc_all_direct_tests true if all kinds of problematic unit tests among
2930 # the unit tests of the specified modules should be
2931 # included, blank otherwise
2932 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
2933 # the unit tests of the dependencies should be
2934 # included, blank otherwise
2935 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
2937 # - excl_longrunning_tests true if long-runnings tests should be excluded,
2939 # - excl_privileged_tests true if tests that require root privileges should be
2940 # excluded, blank otherwise
2941 # - excl_unportable_tests true if tests that fail on some platforms should be
2942 # excluded, blank otherwise
2943 # - avoidlist list of modules to avoid
2944 # - cond_dependencies true if conditional dependencies shall be supported,
2946 # - tmp pathname of a temporary directory
2948 # - modules list of modules, including dependencies
2949 # - conddep_dependers, conddep_condition information about conditionally
2951 func_modules_transitive_closure
()
2953 sed_escape_dependency
='s|\([/.]\)|\\\1|g'
2954 # In order to process every module only once (for speed), process an "input
2955 # list" of modules, producing an "output list" of modules. During each round,
2956 # more modules can be queued in the input list. Once a module on the input
2957 # list has been processed, it is added to the "handled list", so we can avoid
2958 # to process it again.
2960 inmodules
="$modules"
2962 fmtc_inc_all_tests
="$inc_all_direct_tests"
2963 if test "$cond_dependencies" = true
; then
2964 for module
in $inmodules; do
2966 if test -n "$module"; then
2967 if func_acceptable
$module; then
2968 func_uncond_add_module
$module
2973 while test -n "$inmodules"; do
2974 inmodules_this_round
="$inmodules"
2975 inmodules
= # Accumulator, queue for next round
2976 for module
in $inmodules_this_round; do
2978 if test -n "$module"; then
2979 if func_acceptable
$module; then
2980 func_append outmodules
" $module"
2981 if test "$cond_dependencies" = true
; then
2983 && func_get_automake_snippet_conditional
$module \
2984 |
grep '^if ' > /dev
/null
; then
2985 # A module whose Makefile.am snippet contains a reference to an
2986 # automake conditional. If we were to use it conditionally, we
2987 # would get an error
2988 # configure: error: conditional "..." was never defined.
2989 # because automake 1.11.1 does not handle nested conditionals
2990 # correctly. As a workaround, make the module unconditional.
2991 func_uncond_add_module
$module
2993 if func_cond_module_p
$module; then
2999 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
3000 # Duplicate dependencies are harmless, but Jim wants a warning.
3001 duplicated_deps
=`echo "$deps" | LC_ALL=C sort | LC_ALL=C uniq -d`
3002 if test -n "$duplicated_deps"; then
3003 func_warning
"module $module has duplicated dependencies: "`echo $duplicated_deps`
3006 testsmodule
=`func_get_tests_module $module`
3007 if test -n "$testsmodule"; then
3008 deps
="$deps $testsmodule"
3011 for dep
in $deps; do
3012 # Determine whether to include the dependency or tests module.
3014 for word
in `func_get_status $dep`; do
3017 test -n "$incobsolete" \
3021 test -z "$excl_cxx_tests" \
3023 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_cxx_tests" \
3027 test -z "$excl_longrunning_tests" \
3029 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_longrunning_tests" \
3033 test -z "$excl_privileged_tests" \
3035 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_privileged_tests" \
3039 test -z "$excl_unportable_tests" \
3041 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_unportable_tests" \
3045 test -n "$fmtc_inc_all_tests" \
3050 if $inc && func_acceptable
"$dep"; then
3051 func_append inmodules
" $dep"
3052 if test "$cond_dependencies" = true
; then
3053 escaped_dep
=`echo "$dep" | sed -e "$sed_escape_dependency"`
3054 sed_extract_condition1
='/^ *'"$escaped_dep"' *$/{
3057 sed_extract_condition2
='/^ *'"$escaped_dep"' *\[.*\] *$/{
3058 s/^ *'"$escaped_dep"' *\[\(.*\)\] *$/\1/p
3060 condition
=`func_get_dependencies $module | sed -n -e "$sed_extract_condition1" -e "$sed_extract_condition2"`
3061 if test "$condition" = true
; then
3064 if test -n "$condition"; then
3065 func_conddep_add_module
"$module" "$dep" "$condition"
3067 if $conditional; then
3068 func_conddep_add_module
"$module" "$dep" true
3070 func_uncond_add_module
"$dep"
3079 handledmodules
=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
3080 # Remove $handledmodules from $inmodules.
3081 for m
in $inmodules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/queued-modules
3082 inmodules
=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
3083 fmtc_inc_all_tests
="$inc_all_indirect_tests"
3085 modules
=`for m in $outmodules; do echo $m; done | LC_ALL=C sort -u`
3086 rm -f "$tmp"/queued-modules
3089 # func_show_module_list
3091 # - specified_modules list of specified modules (one per line, sorted)
3092 # - modules complete list of modules (one per line, sorted)
3093 # - tmp pathname of a temporary directory
3094 func_show_module_list
()
3100 # Assume xterm compatible escape sequences.
3101 bold_on
=`printf '\033[1m'`
3102 bold_off
=`printf '\033[0m'`
3107 echo "Module list with included dependencies (indented):"
3108 echo "$specified_modules" |
sed -e '/^$/d' -e 's/$/| /' > "$tmp"/specified-modules
3109 echo "$modules" |
sed -e '/^$/d' \
3110 | LC_ALL
=C
join -t '|' -a2 "$tmp"/specified-modules
- \
3111 |
sed -e 's/^\(.*\)|.*/|\1/' -e 's/^/ /' -e 's/^ |\(.*\)$/ '"${bold_on}"'\1'"${bold_off}"'/'
3114 # func_modules_transitive_closure_separately
3115 # Determine main module list and tests-related module list separately.
3116 # The main module list is the transitive closure of the specified modules,
3117 # ignoring tests modules. Its lib/* sources go into $sourcebase/. If --lgpl
3118 # is specified, it will consist only of LGPLed source.
3119 # The tests-related module list is the transitive closure of the specified
3120 # modules, including tests modules, minus the main module list excluding
3121 # modules of applicability 'all'. Its lib/* sources (brought in through
3122 # dependencies of *-tests modules) go into $testsbase/. It may contain GPLed
3123 # source, even if --lgpl is specified.
3125 # - local_gnulib_path from --local-dir
3126 # - modcache true or false, from --cache-modules/--no-cache-modules
3127 # - specified_modules list of specified modules
3128 # - inctests true if tests should be included, false otherwise
3129 # - incobsolete true if obsolete modules among dependencies should be
3130 # included, blank otherwise
3131 # - inc_cxx_tests true if C++ interoperability tests should be included,
3133 # - inc_longrunning_tests true if long-runnings tests should be included,
3135 # - inc_privileged_tests true if tests that require root privileges should be
3136 # included, blank otherwise
3137 # - inc_unportable_tests true if tests that fail on some platforms should be
3138 # included, blank otherwise
3139 # - inc_all_direct_tests true if all kinds of problematic unit tests among
3140 # the unit tests of the specified modules should be
3141 # included, blank otherwise
3142 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
3143 # the unit tests of the dependencies should be
3144 # included, blank otherwise
3145 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
3147 # - excl_longrunning_tests true if long-runnings tests should be excluded,
3149 # - excl_privileged_tests true if tests that require root privileges should be
3150 # excluded, blank otherwise
3151 # - excl_unportable_tests true if tests that fail on some platforms should be
3152 # excluded, blank otherwise
3153 # - avoidlist list of modules to avoid
3154 # - cond_dependencies true if conditional dependencies shall be supported,
3156 # - tmp pathname of a temporary directory
3158 # - main_modules list of modules, including dependencies
3159 # - testsrelated_modules list of tests-related modules, including dependencies
3160 # - conddep_dependers, conddep_condition information about conditionally
3162 func_modules_transitive_closure_separately
()
3164 # Determine main module list.
3165 saved_inctests
="$inctests"
3167 modules
="$specified_modules"
3168 func_modules_transitive_closure
3169 main_modules
="$modules"
3170 inctests
="$saved_inctests"
3171 if test $verbose -ge 1; then
3172 echo "Main module list:"
3173 echo "$main_modules" |
sed -e 's/^/ /'
3175 # Determine tests-related module list.
3176 echo "$final_modules" | LC_ALL
=C
sort -u > "$tmp"/final-modules
3177 testsrelated_modules
=`for module in $main_modules; do
3178 if test \`func_get_applicability
$module\
` = main; then
3182 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/final-modules`
3183 # If testsrelated_modules consists only of modules with applicability 'all',
3184 # set it to empty (because such modules are only helper modules for other modules).
3185 have_nontrivial_testsrelated_modules
=
3186 for module
in $testsrelated_modules; do
3187 if test `func_get_applicability $module` != all
; then
3188 have_nontrivial_testsrelated_modules
=yes
3192 if test -z "$have_nontrivial_testsrelated_modules"; then
3193 testsrelated_modules
=
3195 if test $verbose -ge 1; then
3196 echo "Tests-related module list:"
3197 echo "$testsrelated_modules" |
sed -e 's/^/ /'
3201 # func_determine_use_libtests
3202 # Determines whether a $testsbase/libtests.a is needed.
3204 # - local_gnulib_path from --local-dir
3205 # - modcache true or false, from --cache-modules/--no-cache-modules
3206 # - testsrelated_modules list of tests-related modules, including dependencies
3208 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
3209 func_determine_use_libtests
()
3212 for module
in $testsrelated_modules; do
3213 func_verify_nontests_module
3214 if test -n "$module"; then
3215 all_files
=`func_get_filelist $module`
3216 # Test whether some file in $all_files lies in lib/.
3217 for f
in $all_files; do
3229 # func_modules_add_dummy
3231 # - local_gnulib_path from --local-dir
3232 # - modcache true or false, from --cache-modules/--no-cache-modules
3233 # - modules list of modules, including dependencies
3235 # - modules list of modules, including 'dummy' if needed
3236 func_modules_add_dummy
()
3238 # Determine whether any module provides a lib_SOURCES augmentation.
3240 for module
in $modules; do
3241 func_verify_nontests_module
3242 if test -n "$module"; then
3243 # Extract the value of "lib_SOURCES += ...".
3244 for file in `func_get_automake_snippet "$module" | combine_lines |
3245 sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'`; do
3246 # Ignore .h files since they are not compiled.
3250 have_lib_SOURCES
=yes
3257 # Add the dummy module, to make sure the library will be non-empty.
3258 if test -z "$have_lib_SOURCES"; then
3259 if func_acceptable
"dummy"; then
3260 func_append modules
" dummy"
3265 # func_modules_add_dummy_separately
3267 # - local_gnulib_path from --local-dir
3268 # - modcache true or false, from --cache-modules/--no-cache-modules
3269 # - main_modules list of modules, including dependencies
3270 # - testsrelated_modules list of tests-related modules, including dependencies
3271 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
3273 # - main_modules list of modules, including 'dummy' if needed
3274 # - testsrelated_modules list of tests-related modules, including 'dummy' if
3276 func_modules_add_dummy_separately
()
3278 # Add the dummy module to the main module list if needed.
3279 modules
="$main_modules"
3280 func_modules_add_dummy
3281 main_modules
="$modules"
3283 # Add the dummy module to the tests-related module list if needed.
3284 if $use_libtests; then
3285 modules
="$testsrelated_modules"
3286 func_modules_add_dummy
3287 testsrelated_modules
="$modules"
3291 # func_modules_notice
3293 # - local_gnulib_path from --local-dir
3294 # - modcache true or false, from --cache-modules/--no-cache-modules
3295 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
3296 # - modules list of modules, including dependencies
3297 func_modules_notice
()
3299 if test $verbose -ge -1; then
3300 for module
in $modules; do
3302 if test -n "$module"; then
3303 msg
=`func_get_notice $module`
3304 if test -n "$msg"; then
3305 echo "Notice from module $module:"
3306 echo "$msg" |
sed -e 's/^/ /'
3313 # func_modules_to_filelist
3315 # - local_gnulib_path from --local-dir
3316 # - modcache true or false, from --cache-modules/--no-cache-modules
3317 # - modules list of modules, including dependencies
3319 # - files list of files
3320 func_modules_to_filelist
()
3323 for module
in $modules; do
3325 if test -n "$module"; then
3326 fs
=`func_get_filelist $module`
3327 func_append files
" $fs"
3330 files
=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
3333 # func_modules_to_filelist_separately
3334 # Determine the final file lists.
3335 # They must be computed separately, because files in lib/* go into
3336 # $sourcebase/ if they are in the main file list but into $testsbase/
3337 # if they are in the tests-related file list. Furthermore lib/dummy.c
3340 # - local_gnulib_path from --local-dir
3341 # - modcache true or false, from --cache-modules/--no-cache-modules
3342 # - main_modules list of modules, including dependencies
3343 # - testsrelated_modules list of tests-related modules, including dependencies
3344 func_modules_to_filelist_separately
()
3346 # Determine final main file list.
3347 modules
="$main_modules"
3348 func_modules_to_filelist
3350 # Determine final tests-related file list.
3351 modules
="$testsrelated_modules"
3352 func_modules_to_filelist
3353 testsrelated_files
=`echo "$files" | sed -e 's,^lib/,tests=lib/,'`
3354 # Merge both file lists.
3355 sed_remove_empty_lines
='/^$/d'
3356 files
=`{ echo "$main_files"; echo "$testsrelated_files"; } | sed -e "$sed_remove_empty_lines" | LC_ALL=C sort -u`
3357 if test $verbose -ge 0; then
3359 sed_prettyprint_files
='s,^tests=lib/\(.*\)$,lib/\1 -> tests/\1,'
3360 echo "$files" |
sed -e "$sed_prettyprint_files" -e 's/^/ /'
3364 # func_compute_include_guard_prefix
3365 # Determine include_guard_prefix.
3367 # - macro_prefix prefix of gl_LIBOBJS macros to use
3369 # - include_guard_prefix replacement for ${gl_include_guard_prefix}
3370 # - sed_replace_include_guard_prefix
3371 # sed expression for resolving ${gl_include_guard_prefix}
3372 func_compute_include_guard_prefix
()
3374 if test "$macro_prefix" = gl
; then
3375 include_guard_prefix
='GL'
3377 include_guard_prefix
='GL_'`echo "$macro_prefix" | LC_ALL=C tr '[a-z]' '[A-Z]'`
3379 sed_replace_include_guard_prefix
='s/\${gl_include_guard_prefix}/'"${include_guard_prefix}"'/g'
3382 # func_execute_command command [args...]
3383 # Executes a command.
3384 # Uses also the variables
3385 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
3386 func_execute_command
()
3388 if test $verbose -ge 0; then
3392 # Commands like automake produce output to stderr even when they succeed.
3393 # Turn this output off if the command succeeds.
3394 "$@" > "$tmp"/cmdout
2>&1
3396 if test $cmdret = 0; then
3400 cat "$tmp"/cmdout
1>&2
3407 # func_dest_tmpfilename file
3408 # determines the name of a temporary file (file is relative to destdir).
3410 # - destdir target directory
3411 # - doit : if actions shall be executed, false if only to be printed
3412 # - tmp pathname of a temporary directory
3414 # - tmpfile absolute filename of the temporary file
3415 func_dest_tmpfilename
()
3418 # Put the new contents of $file in a file in the same directory (needed
3419 # to guarantee that an 'mv' to "$destdir/$file" works).
3420 tmpfile
="$destdir/$1.tmp"
3422 # Put the new contents of $file in a file in a temporary directory
3423 # (because the directory of "$file" might not exist).
3424 tmpfile
="$tmp"/`basename "$1"`.tmp
3428 # func_is_local_file lookedup_file file
3429 # check whether file should be instantiated from local gnulib directory
3430 func_is_local_file
()
3433 func_remove_suffix dname
"/$2"
3434 func_path_foreach
"$local_gnulib_path" test %dir
% = "$dname"
3438 # determines whether the file $f should be copied, symlinked, or hardlinked.
3440 # - copymode copy mode for files in general
3441 # - lcopymode copy mode for files from local_gnulib_path
3442 # - f the original file name
3443 # - lookedup_file name of the merged (combined) file
3445 # - copyaction copy or symlink or hardlink
3448 if test -n "$lcopymode" && func_is_local_file
"$lookedup_file" "$f"; then
3449 copyaction
="$lcopymode"
3451 if test -n "$copymode"; then
3452 copyaction
="$copymode"
3460 # copies a file from gnulib into the destination directory. The destination
3461 # is known to not exist.
3463 # - destdir target directory
3464 # - local_gnulib_path from --local-dir
3465 # - modcache true or false, from --cache-modules/--no-cache-modules
3466 # - f the original file name
3467 # - lookedup_file name of the merged (combined) file
3468 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
3469 # - g the rewritten file name
3470 # - tmpfile absolute filename of the temporary file
3471 # - doit : if actions shall be executed, false if only to be printed
3472 # - copymode copy mode for files in general
3473 # - lcopymode copy mode for files from local_gnulib_path
3477 echo "Copying file $g"
3479 if test "$copyaction" = symlink \
3480 && test -z "$lookedup_tmp" \
3481 && cmp -s "$lookedup_file" "$tmpfile"; then
3482 func_symlink_if_changed
"$lookedup_file" "$destdir/$g"
3484 if test "$copyaction" = hardlink \
3485 && test -z "$lookedup_tmp" \
3486 && cmp -s "$lookedup_file" "$tmpfile"; then
3487 func_hardlink
"$lookedup_file" "$destdir/$g"
3489 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error
"failed"
3498 # copies a file from gnulib into the destination directory. The destination
3499 # is known to exist.
3501 # - destdir target directory
3502 # - local_gnulib_path from --local-dir
3503 # - modcache true or false, from --cache-modules/--no-cache-modules
3504 # - f the original file name
3505 # - lookedup_file name of the merged (combined) file
3506 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
3507 # - g the rewritten file name
3508 # - tmpfile absolute filename of the temporary file
3509 # - doit : if actions shall be executed, false if only to be printed
3510 # - copymode copy mode for files in general
3511 # - lcopymode copy mode for files from local_gnulib_path
3512 # - already_present nonempty if the file should already exist, empty otherwise
3515 if cmp -s "$destdir/$g" "$tmpfile"; then
3516 : # The file has not changed.
3520 if test -n "$already_present"; then
3521 echo "Updating file $g (backup in ${g}~)"
3523 echo "Replacing file $g (non-gnulib code backed up in ${g}~) !!"
3525 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error
"failed"
3527 if test "$copyaction" = symlink \
3528 && test -z "$lookedup_tmp" \
3529 && cmp -s "$lookedup_file" "$tmpfile"; then
3530 func_symlink_if_changed
"$lookedup_file" "$destdir/$g"
3532 if test "$copyaction" = hardlink \
3533 && test -z "$lookedup_tmp" \
3534 && cmp -s "$lookedup_file" "$tmpfile"; then
3535 func_hardlink
"$lookedup_file" "$destdir/$g"
3537 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error
"failed"
3541 if test -n "$already_present"; then
3542 echo "Update file $g (backup in ${g}~)"
3544 echo "Replace file $g (non-gnulib code backed up in ${g}~) !!"
3550 # func_emit_lib_Makefile_am
3551 # emits the contents of library makefile to standard output.
3553 # - local_gnulib_path from --local-dir
3554 # - modcache true or false, from --cache-modules/--no-cache-modules
3555 # - modules list of modules, including dependencies
3556 # - libname library name
3557 # - pobase directory relative to destdir where to place *.po files
3558 # - auxdir directory relative to destdir where to place build aux files
3559 # - gnu_make true if --gnu-make was given, false otherwise
3560 # - makefile_name from --makefile-name
3561 # - libtool true if libtool will be used, false or blank otherwise
3562 # - macro_prefix prefix of gl_LIBOBJS macros to use
3563 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
3564 # - witness_c_macro from --witness-c-macro
3565 # - actioncmd (optional) command that will reproduce this invocation
3566 # - for_test true if creating a package for testing, false otherwise
3567 # - sed_replace_include_guard_prefix
3568 # sed expression for resolving ${gl_include_guard_prefix}
3569 # - destfile filename relative to destdir of makefile being generated
3571 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val,dotfirst}
3572 # list of edits to be done to Makefile.am variables
3574 # - uses_subdirs nonempty if object files in subdirs exist
3575 func_emit_lib_Makefile_am
()
3578 # When using GNU make, or when creating an includable Makefile.am snippet,
3579 # augment variables with += instead of assigning them.
3580 if $gnu_make ||
test -n "$makefile_name"; then
3585 if test "$libtool" = true
; then
3588 sed_eliminate_LDFLAGS
="$sed_noop"
3592 sed_eliminate_LDFLAGS
='/^lib_LDFLAGS[ ]*+=/d'
3595 # When creating a package for testing: Attempt to provoke failures,
3596 # especially link errors, already during "make" rather than during
3597 # "make check", because "make check" is not possible in a cross-compiling
3598 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
3599 sed_transform_check_PROGRAMS
='s,check_PROGRAMS,noinst_PROGRAMS,g'
3601 sed_transform_check_PROGRAMS
="$sed_noop"
3603 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3605 echo "## Process this file with automake to produce Makefile.in."
3606 func_emit_copyright_notice
3607 if test -n "$actioncmd"; then
3608 printf '# Reproduce by:\n%s\n' "$actioncmd"
3613 for module
in $modules; do
3614 func_verify_nontests_module
3615 if test -n "$module"; then
3617 func_get_automake_snippet_conditional
"$module" |
3619 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
3620 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
3621 -e "$sed_eliminate_LDFLAGS" \
3622 -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' \
3623 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
3624 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
3625 -e "$sed_transform_check_PROGRAMS" \
3626 -e "$sed_replace_include_guard_prefix"
3627 if test "$module" = 'alloca'; then
3628 echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
3629 echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@"
3631 } | combine_lines
"${libname}_${libext}_SOURCES" > "$tmp"/amsnippet1
3633 func_get_automake_snippet_unconditional
"$module" |
3634 LC_ALL
=C
sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g'
3635 } > "$tmp"/amsnippet2
3636 # Skip the contents if it's entirely empty.
3637 if grep '[^ ]' "$tmp"/amsnippet1
"$tmp"/amsnippet2
> /dev
/null
; then
3638 echo "## begin gnulib module $module"
3640 echo "ifeq (,\$(OMIT_GNULIB_MODULE_$module))"
3641 convert_to_gnu_make
='s/^if \(.*\)/ifneq (,$(\1))/'
3643 convert_to_gnu_make
=
3646 if test "$cond_dependencies" = true
; then
3647 if func_cond_module_p
"$module"; then
3648 func_module_conditional_name
"$module"
3650 echo "ifneq (,\$($conditional))"
3652 echo "if $conditional"
3656 sed "$convert_to_gnu_make" "$tmp"/amsnippet1
3657 if test "$cond_dependencies" = true
; then
3658 if func_cond_module_p
"$module"; then
3662 sed "$convert_to_gnu_make" "$tmp"/amsnippet2
3666 echo "## end gnulib module $module"
3669 rm -f "$tmp"/amsnippet1
"$tmp"/amsnippet2
3670 # Test whether there are some source files in subdirectories.
3671 for f
in `func_get_filelist "$module"`; do
3681 } > "$tmp"/allsnippets
3682 if test -z "$makefile_name"; then
3683 # If there are source files in subdirectories, prevent collision of the
3684 # object files (example: hash.c and libxml/hash.c).
3686 if test -n "$uses_subdirs"; then
3687 subdir_options
=' subdir-objects'
3689 echo "AUTOMAKE_OPTIONS = 1.11 gnits${subdir_options}"
3692 if test -z "$makefile_name"; then
3694 echo "noinst_HEADERS ="
3695 echo "noinst_LIBRARIES ="
3696 echo "noinst_LTLIBRARIES ="
3697 # Automake versions < 1.11.4 create an empty pkgdatadir at
3698 # installation time if you specify pkgdata_DATA to empty.
3699 # See automake bugs #10997 and #11030:
3700 # * https://debbugs.gnu.org/10997
3701 # * https://debbugs.gnu.org/11030
3702 # So we need this workaround.
3703 if grep '^pkgdata_DATA *+=' "$tmp"/allsnippets
> /dev
/null
; then
3704 echo "pkgdata_DATA ="
3707 echo "BUILT_SOURCES ="
3710 echo "MOSTLYCLEANFILES $assign core *.stackdump"
3711 if test -z "$makefile_name"; then
3712 echo "MOSTLYCLEANDIRS ="
3714 echo "DISTCLEANFILES ="
3715 echo "MAINTAINERCLEANFILES ="
3718 echo "# Start of GNU Make output."
3720 # Put autoconf output into a temporary file, so that its exit status
3721 # can be checked from the shell. Signal any error by putting a
3722 # syntax error into the output makefile.
3723 ${AUTOCONF} -t 'AC_SUBST:$1 = @$1@' "$configure_ac" \
3724 >"$tmp"/makeout
2>"$tmp"/makeout2
&&
3725 LC_ALL
=C
sort -u "$tmp"/makeout ||
{
3726 echo "== gnulib-tool GNU Make output failed as follows =="
3727 sed 's/^/# stderr: /' "$tmp"/makeout2
3729 rm -f "$tmp"/makeout
"$tmp"/makeout2
3731 echo "# End of GNU Make output."
3733 echo "# No GNU Make output."
3735 # Execute edits that apply to the Makefile.am being generated.
3737 while test $edit != $makefile_am_edits; do
3738 edit
=`expr $edit + 1`
3739 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
3740 eval var
=\"\
$makefile_am_edit${edit}_var
\"
3741 eval val
=\"\
$makefile_am_edit${edit}_val
\"
3742 eval dotfirst
=\"\
$makefile_am_edit${edit}_dotfirst
\"
3743 if test -n "$var"; then
3744 if test "${dir}Makefile.am" = "$destfile" ||
test "./${dir}Makefile.am" = "$destfile"; then
3745 if test "${var}" = SUBDIRS
&& test -n "$dotfirst"; then
3746 # The added subdirectory ${val} needs to be mentioned after '.'.
3747 # Since we don't have '.' among SUBDIRS so far, add it now.
3750 echo "${var} += ${val}"
3751 eval "makefile_am_edit${edit}_var="
3755 if test -n "$witness_c_macro"; then
3756 cppflags_part1
=" -D$witness_c_macro=1"
3761 cppflags_part2
=" -DGNULIB_STRICT_CHECKING=1"
3765 if test -z "$makefile_name"; then
3767 echo "AM_CPPFLAGS =$cppflags_part1$cppflags_part2"
3770 if test -n "$cppflags_part1$cppflags_part2"; then
3772 echo "AM_CPPFLAGS +=$cppflags_part1$cppflags_part2"
3776 if LC_ALL
=C
grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$tmp"/allsnippets
> /dev
/null \
3777 ||
{ test -n "$makefile_name" \
3778 && test -f "$sourcebase/Makefile.am" \
3779 && LC_ALL
=C
grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$sourcebase/Makefile.am" > /dev
/null
; \
3781 # One of the snippets or the user's Makefile.am already specifies an
3782 # installation location for the library. Don't confuse automake by saying
3783 # it should not be installed.
3786 # By default, the generated library should not be installed.
3787 echo "noinst_${perhapsLT}LIBRARIES += $libname.$libext"
3790 echo "${libname}_${libext}_SOURCES ="
3791 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
3792 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
3793 echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
3794 echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
3795 echo "EXTRA_${libname}_${libext}_SOURCES ="
3796 if test "$libtool" = true
; then
3797 echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)"
3798 echo "${libname}_${libext}_LDFLAGS += -no-undefined"
3799 # Synthesize an ${libname}_${libext}_LDFLAGS augmentation by combining
3800 # the link dependencies of all modules.
3801 for module
in $modules; do
3802 func_verify_nontests_module
3803 if test -n "$module"; then
3804 func_get_link_directive
"$module"
3807 | LC_ALL
=C
sed -e '/^$/d' -e 's/ when linking with libtool.*//' \
3808 | LC_ALL
=C
sort -u \
3809 | LC_ALL
=C
sed -e 's/^/'"${libname}_${libext}"'_LDFLAGS += /'
3812 if test -n "$pobase"; then
3813 echo "AM_CPPFLAGS += -DDEFAULT_TEXT_DOMAIN=\\\"${po_domain}-gnulib\\\""
3816 cat "$tmp"/allsnippets \
3817 |
sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
3819 echo "mostlyclean-local: mostlyclean-generic"
3820 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
3821 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
3822 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
3826 rm -f "$tmp"/allsnippets
3829 # func_emit_po_Makevars
3830 # emits the contents of po/ makefile parameterization to standard output.
3832 # - local_gnulib_path from --local-dir
3833 # - modcache true or false, from --cache-modules/--no-cache-modules
3834 # - sourcebase directory relative to destdir where to place source code
3835 # - pobase directory relative to destdir where to place *.po files
3836 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
3837 func_emit_po_Makevars
()
3839 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3840 func_emit_copyright_notice
3842 echo "# Usually the message domain is the same as the package name."
3843 echo "# But here it has a '-gnulib' suffix."
3844 echo "DOMAIN = ${po_domain}-gnulib"
3846 echo "# These two variables depend on the location of this directory."
3847 echo "subdir = ${pobase}"
3848 echo "top_builddir = "`echo "$pobase" | sed -e 's,//*,/,g' -e 's,[^/][^/]*,..,g'`
3851 # These options get passed to xgettext.
3852 XGETTEXT_OPTIONS
= \
3853 --keyword=_
--flag=_
:1:pass-c-format \
3854 --keyword=N_
--flag=N_
:1:pass-c-format \
3855 --keyword='proper_name:1,"This is a proper name. See the gettext manual, section Names."' \
3856 --keyword='proper_name_utf8:1,"This is a proper name. See the gettext manual, section Names."' \
3857 --flag=error
:3:c-format
--flag=error_at_line
:5:c-format
3859 # This is the copyright holder that gets inserted into the header of the
3860 # $(DOMAIN).pot file. gnulib is copyrighted by the FSF.
3861 COPYRIGHT_HOLDER
= Free Software Foundation
, Inc.
3863 # This is the email address or URL to which the translators shall report
3864 # bugs in the untranslated strings:
3865 # - Strings which are not entire sentences, see the maintainer guidelines
3866 # in the GNU gettext documentation, section 'Preparing Strings'.
3867 # - Strings which use unclear terms or require additional context to be
3869 # - Strings which make invalid assumptions about notation of date, time or
3871 # - Pluralisation problems.
3872 # - Incorrect English spelling.
3873 # - Incorrect formatting.
3874 # It can be your email address, or a mailing list address where translators
3875 # can write to without being subscribed, or the URL of a web page through
3876 # which the translators can contact you.
3877 MSGID_BUGS_ADDRESS
= bug-gnulib@gnu.org
3879 # This is the list of locale categories, beyond LC_MESSAGES, for which the
3880 # message catalogs shall be used. It is usually empty.
3881 EXTRA_LOCALE_CATEGORIES
=
3883 # This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
3884 # context. Possible values are "yes" and "no". Set this to yes if the
3885 # package uses functions taking also a message context, like pgettext(), or
3886 # if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
3891 # func_emit_po_POTFILES_in
3892 # emits the file list to be passed to xgettext to standard output.
3894 # - local_gnulib_path from --local-dir
3895 # - modcache true or false, from --cache-modules/--no-cache-modules
3896 # - sourcebase directory relative to destdir where to place source code
3897 # - files list of new files
3898 func_emit_po_POTFILES_in
()
3900 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3901 func_emit_copyright_notice
3903 echo "# List of files which contain translatable strings."
3904 echo "$files" |
sed -n -e "s,^lib/,$sourcebase/,p"
3907 # func_emit_tests_Makefile_am witness_macro
3908 # emits the contents of tests makefile to standard output.
3910 # - local_gnulib_path from --local-dir
3911 # - modcache true or false, from --cache-modules/--no-cache-modules
3912 # - modules list of modules, including dependencies
3913 # - libname library name
3914 # - auxdir directory relative to destdir where to place build aux files
3915 # - gnu_make true if --gnu-make was given, false otherwise
3916 # - makefile_name from --makefile-name
3917 # - libtool true if libtool will be used, false or blank otherwise
3918 # - sourcebase relative directory containing lib source code
3919 # - m4base relative directory containing autoconf macros
3920 # - testsbase relative directory containing unit test code
3921 # - macro_prefix prefix of gl_LIBOBJS macros to use
3922 # - witness_c_macro from --witness-c-macro
3923 # - for_test true if creating a package for testing, false otherwise
3924 # - single_configure true if a single configure file should be generated,
3925 # false for a separate configure file for the tests
3926 # - use_libtests true if a libtests.a should be built, false otherwise
3927 # - sed_replace_include_guard_prefix
3928 # sed expression for resolving ${gl_include_guard_prefix}
3929 # - destfile filename relative to destdir of makefile being generated
3931 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val,dotfirst}
3932 # list of edits to be done to Makefile.am variables
3934 # - uses_subdirs nonempty if object files in subdirs exist
3935 func_emit_tests_Makefile_am
()
3938 if test "$libtool" = true
; then
3941 sed_eliminate_LDFLAGS
="$sed_noop"
3945 sed_eliminate_LDFLAGS
='/^lib_LDFLAGS[ ]*+=/d'
3948 # When creating a package for testing: Attempt to provoke failures,
3949 # especially link errors, already during "make" rather than during
3950 # "make check", because "make check" is not possible in a cross-compiling
3951 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
3952 sed_transform_check_PROGRAMS
='s,check_PROGRAMS,noinst_PROGRAMS,g'
3954 sed_transform_check_PROGRAMS
="$sed_noop"
3956 testsbase_inverse
=`echo "$testsbase" | sed -e 's,/$,,' | sed -e 's,[^/][^/]*,..,g'`
3957 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3958 echo "## Process this file with automake to produce Makefile.in."
3959 func_emit_copyright_notice
3963 for module
in $modules; do
3964 if $for_test && ! $single_configure; then
3965 func_verify_tests_module
3969 if test -n "$module"; then
3971 func_get_automake_snippet
"$module" |
3973 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
3974 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
3975 -e "$sed_eliminate_LDFLAGS" \
3976 -e 's,lib_\([A-Z][A-Z]*\),libtests_a_\1,g' \
3977 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
3978 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
3979 -e "$sed_transform_check_PROGRAMS" \
3980 -e "$sed_replace_include_guard_prefix"
3981 if $use_libtests && test "$module" = 'alloca'; then
3982 echo "libtests_a_LIBADD += @ALLOCA@"
3983 echo "libtests_a_DEPENDENCIES += @ALLOCA@"
3985 } > "$tmp"/amsnippet
3986 # Skip the contents if it's entirely empty.
3987 if grep '[^ ]' "$tmp"/amsnippet
> /dev
/null
; then
3988 # Mention long-running tests at the end.
3990 for word
in `func_get_status "$module"`; do
3991 if test "$word" = 'longrunning-test'; then
3996 { echo "## begin gnulib module $module"
3998 echo "ifeq (,\$(OMIT_GNULIB_MODULE_$module))"
4001 cat "$tmp"/amsnippet
4005 echo "## end gnulib module $module"
4009 rm -f "$tmp"/amsnippet
4010 # Test whether there are some source files in subdirectories.
4011 for f
in `func_get_filelist "$module"`; do
4013 lib
/*/*.c |
tests
/*/*.c
)
4021 } 3> "$tmp"/main_snippets
4> "$tmp"/longrunning_snippets
4022 # Generate dependencies here, since it eases the debugging of test failures.
4023 # If there are source files in subdirectories, prevent collision of the
4024 # object files (example: hash.c and libxml/hash.c).
4026 if test -n "$uses_subdirs"; then
4027 subdir_options
=' subdir-objects'
4029 echo "AUTOMAKE_OPTIONS = 1.11 foreign${subdir_options}"
4031 if $for_test && ! $single_configure; then
4032 echo "ACLOCAL_AMFLAGS = -I ${testsbase_inverse}/${m4base}"
4035 # Nothing is being added to SUBDIRS; nevertheless the existence of this
4036 # variable is needed to avoid an error from automake:
4037 # "AM_GNU_GETTEXT used but SUBDIRS not defined"
4040 echo "XFAIL_TESTS ="
4041 echo "TESTS_ENVIRONMENT ="
4042 echo "noinst_PROGRAMS ="
4043 if ! $for_test; then
4044 echo "check_PROGRAMS ="
4046 echo "EXTRA_PROGRAMS ="
4047 echo "noinst_HEADERS ="
4048 echo "noinst_LIBRARIES ="
4049 if $use_libtests; then
4051 echo "noinst_LIBRARIES += libtests.a"
4053 echo "check_LIBRARIES = libtests.a"
4056 # Automake versions < 1.11.4 create an empty pkgdatadir at
4057 # installation time if you specify pkgdata_DATA to empty.
4058 # See automake bugs #10997 and #11030:
4059 # * https://debbugs.gnu.org/10997
4060 # * https://debbugs.gnu.org/11030
4061 # So we need this workaround.
4062 if grep '^pkgdata_DATA *+=' "$tmp"/main_snippets
"$tmp"/longrunning_snippets
> /dev
/null
; then
4063 echo "pkgdata_DATA ="
4066 echo "BUILT_SOURCES ="
4068 echo "MOSTLYCLEANFILES = core *.stackdump"
4069 echo "MOSTLYCLEANDIRS ="
4071 echo "DISTCLEANFILES ="
4072 echo "MAINTAINERCLEANFILES ="
4073 # Execute edits that apply to the Makefile.am being generated.
4075 while test $edit != $makefile_am_edits; do
4076 edit
=`expr $edit + 1`
4077 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
4078 eval var
=\"\
$makefile_am_edit${edit}_var
\"
4079 eval val
=\"\
$makefile_am_edit${edit}_val
\"
4080 eval dotfirst
=\"\
$makefile_am_edit${edit}_dotfirst
\"
4081 if test -n "$var"; then
4082 if test "${dir}Makefile.am" = "$destfile" ||
test "./${dir}Makefile.am" = "$destfile"; then
4083 if test "${var}" = SUBDIRS
&& test -n "$dotfirst"; then
4084 # The added subdirectory ${val} needs to be mentioned after '.'.
4085 # But we have '.' among SUBDIRS already, so do nothing.
4088 echo "${var} += ${val}"
4089 eval "makefile_am_edit${edit}_var="
4094 echo "AM_CPPFLAGS = \\"
4096 echo " -DGNULIB_STRICT_CHECKING=1 \\"
4098 if test -n "$witness_c_macro"; then
4099 echo " -D$witness_c_macro=1 \\"
4101 if test -n "${witness_macro}"; then
4102 echo " -D@${witness_macro}@=1 \\"
4104 echo " -I. -I\$(srcdir) \\"
4105 echo " -I${testsbase_inverse} -I\$(srcdir)/${testsbase_inverse} \\"
4106 echo " -I${testsbase_inverse}/${sourcebase-lib} -I\$(srcdir)/${testsbase_inverse}/${sourcebase-lib}"
4108 local_ldadd_before
=''
4109 local_ldadd_after
=''
4110 if $use_libtests; then
4111 # All test programs need to be linked with libtests.a.
4112 # It needs to be passed to the linker before ${libname}.${libext}, since
4113 # the tests-related modules depend on the main modules.
4114 # It also needs to be passed to the linker after ${libname}.${libext}
4115 # because the latter might contain incomplete modules (such as the 'error'
4116 # module whose dependency to 'progname' is voluntarily omitted).
4117 # The LIBTESTS_LIBDEPS can be passed to the linker once or twice, it does
4119 local_ldadd_before
=' libtests.a'
4120 local_ldadd_after
=' libtests.a $(LIBTESTS_LIBDEPS)'
4122 echo "LDADD =${local_ldadd_before} ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext}${local_ldadd_after}"
4124 if $use_libtests; then
4125 echo "libtests_a_SOURCES ="
4126 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
4127 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
4128 echo "libtests_a_LIBADD = \$(${macro_prefix}tests_LIBOBJS)"
4129 echo "libtests_a_DEPENDENCIES = \$(${macro_prefix}tests_LIBOBJS)"
4130 echo "EXTRA_libtests_a_SOURCES ="
4131 # The circular dependency in LDADD requires this.
4132 echo "AM_LIBTOOLFLAGS = --preserve-dup-deps"
4135 # Many test scripts use ${EXEEXT} or ${srcdir}.
4136 # EXEEXT is defined by AC_PROG_CC through autoconf.
4137 # srcdir is defined by autoconf and automake.
4138 echo "TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='\$(srcdir)'"
4140 cat "$tmp"/main_snippets
"$tmp"/longrunning_snippets \
4141 |
sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
4142 echo "# Clean up after Solaris cc."
4144 echo " rm -rf SunWS_cache"
4146 echo "mostlyclean-local: mostlyclean-generic"
4147 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
4148 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
4149 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
4153 rm -f "$tmp"/main_snippets
"$tmp"/longrunning_snippets
4156 # func_emit_initmacro_start macro_prefix
4157 # emits the first few statements of the gl_INIT macro to standard output.
4158 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4159 func_emit_initmacro_start
()
4161 macro_prefix_arg
="$1"
4162 # Overriding AC_LIBOBJ and AC_REPLACE_FUNCS has the effect of storing
4163 # platform-dependent object files in ${macro_prefix_arg}_LIBOBJS instead of
4164 # LIBOBJS. The purpose is to allow several gnulib instantiations under
4165 # a single configure.ac file. (AC_CONFIG_LIBOBJ_DIR does not allow this
4167 # Furthermore it avoids an automake error like this when a Makefile.am
4168 # that uses pieces of gnulib also uses $(LIBOBJ):
4169 # automatically discovered file `error.c' should not be explicitly mentioned
4170 echo " m4_pushdef([AC_LIBOBJ], m4_defn([${macro_prefix_arg}_LIBOBJ]))"
4171 echo " m4_pushdef([AC_REPLACE_FUNCS], m4_defn([${macro_prefix_arg}_REPLACE_FUNCS]))"
4172 # Overriding AC_LIBSOURCES has the same purpose of avoiding the automake
4173 # error when a Makefile.am that uses pieces of gnulib also uses $(LIBOBJ):
4174 # automatically discovered file `error.c' should not be explicitly mentioned
4175 # We let automake know about the files to be distributed through the
4176 # EXTRA_lib_SOURCES variable.
4177 echo " m4_pushdef([AC_LIBSOURCES], m4_defn([${macro_prefix_arg}_LIBSOURCES]))"
4178 # Create data variables for checking the presence of files that are mentioned
4179 # as AC_LIBSOURCES arguments. These are m4 variables, not shell variables,
4180 # because we want the check to happen when the configure file is created,
4181 # not when it is run. ${macro_prefix_arg}_LIBSOURCES_LIST is the list of
4182 # files to check for. ${macro_prefix_arg}_LIBSOURCES_DIR is the subdirectory
4183 # in which to expect them.
4184 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_LIST], [])"
4185 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_DIR], [])"
4189 # func_emit_initmacro_end macro_prefix
4190 # emits the last few statements of the gl_INIT macro to standard output.
4191 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4192 func_emit_initmacro_end
()
4194 macro_prefix_arg
="$1"
4195 # Check the presence of files that are mentioned as AC_LIBSOURCES arguments.
4196 # The check is performed only when autoconf is run from the directory where
4197 # the configure.ac resides; if it is run from a different directory, the
4199 echo " m4_ifval(${macro_prefix_arg}_LIBSOURCES_LIST, ["
4200 echo " m4_syscmd([test ! -d ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[ ||"
4201 echo " for gl_file in ]${macro_prefix_arg}_LIBSOURCES_LIST[ ; do"
4202 echo " if test ! -r ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file ; then"
4203 echo " echo \"missing file ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file\" >&2"
4207 echo " m4_if(m4_sysval, [0], [],"
4208 echo " [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])"
4210 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_DIR])"
4211 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_LIST])"
4212 echo " m4_popdef([AC_LIBSOURCES])"
4213 echo " m4_popdef([AC_REPLACE_FUNCS])"
4214 echo " m4_popdef([AC_LIBOBJ])"
4215 echo " AC_CONFIG_COMMANDS_PRE(["
4216 echo " ${macro_prefix_arg}_libobjs="
4217 echo " ${macro_prefix_arg}_ltlibobjs="
4218 echo " if test -n \"\$${macro_prefix_arg}_LIBOBJS\"; then"
4219 echo " # Remove the extension."
4220 echo " sed_drop_objext='s/\\.o\$//;s/\\.obj\$//'"
4221 echo " for i in \`for i in \$${macro_prefix_arg}_LIBOBJS; do echo \"\$i\"; done | sed -e \"\$sed_drop_objext\" | sort | uniq\`; do"
4222 echo " ${macro_prefix_arg}_libobjs=\"\$${macro_prefix_arg}_libobjs \$i.\$ac_objext\""
4223 echo " ${macro_prefix_arg}_ltlibobjs=\"\$${macro_prefix_arg}_ltlibobjs \$i.lo\""
4226 echo " AC_SUBST([${macro_prefix_arg}_LIBOBJS], [\$${macro_prefix_arg}_libobjs])"
4227 echo " AC_SUBST([${macro_prefix_arg}_LTLIBOBJS], [\$${macro_prefix_arg}_ltlibobjs])"
4231 # func_emit_initmacro_done macro_prefix sourcebase
4232 # emits a few statements after the gl_INIT macro to standard output.
4233 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4234 # - sourcebase directory relative to destdir where to place source code
4235 func_emit_initmacro_done
()
4237 macro_prefix_arg
="$1"
4240 echo "# Like AC_LIBOBJ, except that the module name goes"
4241 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
4242 echo "AC_DEFUN([${macro_prefix_arg}_LIBOBJ], ["
4243 echo " AS_LITERAL_IF([\$1], [${macro_prefix_arg}_LIBSOURCES([\$1.c])])dnl"
4244 echo " ${macro_prefix_arg}_LIBOBJS=\"\$${macro_prefix_arg}_LIBOBJS \$1.\$ac_objext\""
4247 echo "# Like AC_REPLACE_FUNCS, except that the module name goes"
4248 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
4249 echo "AC_DEFUN([${macro_prefix_arg}_REPLACE_FUNCS], ["
4250 echo " m4_foreach_w([gl_NAME], [\$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl"
4251 echo " AC_CHECK_FUNCS([\$1], , [${macro_prefix_arg}_LIBOBJ(\$ac_func)])"
4254 echo "# Like AC_LIBSOURCES, except the directory where the source file is"
4255 echo "# expected is derived from the gnulib-tool parameterization,"
4256 echo "# and alloca is special cased (for the alloca-opt module)."
4257 echo "# We could also entirely rely on EXTRA_lib..._SOURCES."
4258 echo "AC_DEFUN([${macro_prefix_arg}_LIBSOURCES], ["
4259 echo " m4_foreach([_gl_NAME], [\$1], ["
4260 echo " m4_if(_gl_NAME, [alloca.c], [], ["
4261 echo " m4_define([${macro_prefix_arg}_LIBSOURCES_DIR], [$sourcebase_arg])"
4262 echo " m4_append([${macro_prefix_arg}_LIBSOURCES_LIST], _gl_NAME, [ ])"
4268 # func_emit_autoconf_snippet indentation
4269 # emits the autoconf snippet of a module.
4271 # - indentation spaces to prepend on each line
4272 # - local_gnulib_path from --local-dir
4273 # - modcache true or false, from --cache-modules/--no-cache-modules
4274 # - sed_replace_build_aux sed expression that replaces reference to build-aux
4275 # - sed_replace_include_guard_prefix
4276 # sed expression for resolving ${gl_include_guard_prefix}
4277 # - module the module name
4278 # - toplevel true or false. 'false' means a subordinate use of
4280 # - disable_libtool true or false. It tells whether to disable libtool
4281 # handling even if it has been specified through the
4282 # command line options.
4283 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
4285 func_emit_autoconf_snippet
()
4288 if { case $module in
4289 gnumakefile | maintainer-makefile
)
4290 # These modules are meant to be used only in the top-level directory.
4296 func_get_autoconf_snippet
"$module" \
4297 |
sed -e '/^$/d;' -e "s/^/$indentation/" \
4298 -e "$sed_replace_build_aux" \
4299 -e "$sed_replace_include_guard_prefix" \
4300 |
{ if $disable_libtool; then
4301 sed -e 's/\$gl_cond_libtool/false/g' \
4302 -e 's/gl_libdeps/gltests_libdeps/g' \
4303 -e 's/gl_ltlibdeps/gltests_ltlibdeps/g'
4308 |
{ if $disable_gettext; then
4309 sed -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./'
4311 # Don't indent AM_GNU_GETTEXT_VERSION line, as that confuses
4312 # autopoint through at least GNU gettext version 0.18.2.
4313 sed -e 's/^ *AM_GNU_GETTEXT_VERSION/AM_GNU_GETTEXT_VERSION/'
4316 if test "$module" = 'alloca' && test "$libtool" = true
&& ! $disable_libtool; then
4317 echo 'changequote(,)dnl'
4318 echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
4319 echo 'changequote([, ])dnl'
4320 echo 'AC_SUBST([LTALLOCA])'
4325 # func_emit_autoconf_snippets modules referenceable_modules verifier toplevel disable_libtool disable_gettext
4326 # collects and emit the autoconf snippets of a set of modules.
4328 # - local_gnulib_path from --local-dir
4329 # - modcache true or false, from --cache-modules/--no-cache-modules
4330 # - sed_replace_build_aux sed expression that replaces reference to build-aux
4331 # - sed_replace_include_guard_prefix
4332 # sed expression for resolving ${gl_include_guard_prefix}
4333 # - modules the list of modules.
4334 # - referenceable_modules the list of modules which may be referenced as dependencies.
4335 # - verifier one of func_verify_module, func_verify_nontests_module,
4336 # func_verify_tests_module. It selects the subset of
4337 # $modules to consider.
4338 # - toplevel true or false. 'false' means a subordinate use of
4340 # - disable_libtool true or false. It tells whether to disable libtool
4341 # handling even if it has been specified through the
4342 # command line options.
4343 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
4345 func_emit_autoconf_snippets
()
4347 referenceable_modules
="$2"
4350 disable_libtool
="$5"
4351 disable_gettext
="$6"
4352 if test "$cond_dependencies" = true
; then
4353 for m
in $referenceable_modules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/modules
4354 # Emit the autoconf code for the unconditional modules.
4355 for module
in $1; do
4357 if test -n "$module"; then
4358 if func_cond_module_p
"$module"; then
4361 func_emit_autoconf_snippet
" "
4365 # Initialize the shell variables indicating that the modules are enabled.
4366 for module
in $1; do
4368 if test -n "$module"; then
4369 if func_cond_module_p
"$module"; then
4370 func_module_shellvar_name
"$module"
4371 echo " $shellvar=false"
4375 # Emit the autoconf code for the conditional modules, each in a separate
4376 # function. This makes it possible to support cycles among conditional
4378 for module
in $1; do
4380 if test -n "$module"; then
4381 if func_cond_module_p
"$module"; then
4382 func_module_shellfunc_name
"$module"
4383 func_module_shellvar_name
"$module"
4384 echo " $shellfunc ()"
4386 echo " if ! \$$shellvar; then"
4387 func_emit_autoconf_snippet
" "
4388 echo " $shellvar=true"
4389 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
4390 # Intersect $deps with the modules list $1.
4391 deps
=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
4392 for dep
in $deps; do
4393 if func_cond_module_p
"$dep"; then
4394 func_module_shellfunc_name
"$dep"
4395 func_cond_module_condition
"$module" "$dep"
4396 if test "$condition" != true
; then
4397 echo " if $condition; then"
4404 # The autoconf code for $dep has already been emitted above and
4405 # therefore is already executed when this function is run.
4414 # Emit the dependencies from the unconditional to the conditional modules.
4415 for module
in $1; do
4417 if test -n "$module"; then
4418 if func_cond_module_p
"$module"; then
4421 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
4422 # Intersect $deps with the modules list $1.
4423 deps
=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
4424 for dep
in $deps; do
4425 if func_cond_module_p
"$dep"; then
4426 func_module_shellfunc_name
"$dep"
4427 func_cond_module_condition
"$module" "$dep"
4428 if test "$condition" != true
; then
4429 echo " if $condition; then"
4436 # The autoconf code for $dep has already been emitted above and
4437 # therefore is already executed when this code is run.
4444 # Define the Automake conditionals.
4445 echo " m4_pattern_allow([^${macro_prefix}_GNULIB_ENABLED_])"
4446 for module
in $1; do
4448 if test -n "$module"; then
4449 if func_cond_module_p
"$module"; then
4450 func_module_conditional_name
"$module"
4451 func_module_shellvar_name
"$module"
4452 echo " AM_CONDITIONAL([$conditional], [\$$shellvar])"
4457 # Ignore the conditions, and enable all modules unconditionally.
4458 for module
in $1; do
4460 if test -n "$module"; then
4461 func_emit_autoconf_snippet
" "
4467 # func_emit_pre_early_macros require indentation modules
4468 # The require parameter can be ':' (AC_REQUIRE) or 'false' (direct call).
4469 func_emit_pre_early_macros
()
4472 echo "${2}# Pre-early section."
4474 _pre_early_snippet
="echo \"${2}AC_REQUIRE([\$_pre_early_macro])\""
4476 _pre_early_snippet
="echo \"${2}\$_pre_early_macro\""
4479 # We need to call gl_USE_SYSTEM_EXTENSIONS before gl_PROG_AR_RANLIB. Doing
4480 # AC_REQUIRE in configure-ac.early is not early enough.
4481 _pre_early_macro
="gl_USE_SYSTEM_EXTENSIONS"
4482 case "${nl}${3}${nl}" in
4483 *${nl}extensions
${nl}*) eval "$_pre_early_snippet" ;;
4486 _pre_early_macro
="gl_PROG_AR_RANLIB"
4487 eval "$_pre_early_snippet"
4491 # func_reconstruct_cached_dir
4492 # callback for func_reconstruct_cached_local_gnulib_path
4494 # - destdir from --dir
4496 # - local_gnulib_path restored '--local-dir' path from cache
4497 func_reconstruct_cached_dir
()
4500 if test -n "$cached_dir"; then
4503 func_path_append local_gnulib_path
"$destdir/$cached_dir" ;;
4505 case "$cached_dir" in
4507 func_path_append local_gnulib_path
"$destdir/$cached_dir" ;;
4509 func_relconcat
"$destdir" "$cached_dir"
4510 func_path_append local_gnulib_path
"$relconcat" ;;
4516 # func_reconstruct_cached_local_gnulib_path
4517 # reconstruct local_gnulib_path from cached_local_gnulib_path to be set
4518 # relatively to $destdir again.
4520 # - cached_local_gnulib_path local_gnulib_path stored within gnulib-cache.m4
4521 # - destdir from --dir
4523 # - local_gnulib_path restored '--local-dir' path from cache
4524 func_reconstruct_cached_local_gnulib_path
()
4526 func_path_foreach
"$cached_local_gnulib_path" func_reconstruct_cached_dir
%dir
%
4529 # func_import modules
4530 # Uses also the variables
4531 # - mode import or add-import or remove-import or update
4532 # - destdir target directory
4533 # - local_gnulib_path from --local-dir
4534 # - modcache true or false, from --cache-modules/--no-cache-modules
4535 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
4536 # - libname library name
4537 # - supplied_libname true if --lib was given, blank otherwise
4538 # - sourcebase directory relative to destdir where to place source code
4539 # - m4base directory relative to destdir where to place *.m4 macros
4540 # - pobase directory relative to destdir where to place *.po files
4541 # - docbase directory relative to destdir where to place doc files
4542 # - testsbase directory relative to destdir where to place unit test code
4543 # - auxdir directory relative to destdir where to place build aux files
4544 # - inctests true if --with-tests was given, false otherwise
4545 # - incobsolete true if --with-obsolete was given, blank otherwise
4546 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
4547 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
4549 # - inc_privileged_tests true if --with-privileged-tests was given, blank
4551 # - inc_unportable_tests true if --with-unportable-tests was given, blank
4553 # - inc_all_tests true if --with-all-tests was given, blank otherwise
4554 # - avoidlist list of modules to avoid, from --avoid
4555 # - cond_dependencies true if --conditional-dependencies was given, false if
4556 # --no-conditional-dependencies was given, blank otherwise
4557 # - lgpl yes or a number if library's license shall be LGPL,
4559 # - makefile_name from --makefile-name
4560 # - libtool true if --libtool was given, false if --no-libtool was
4561 # given, blank otherwise
4562 # - guessed_libtool true if the configure.ac file uses libtool, false otherwise
4563 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4564 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
4565 # - witness_c_macro from --witness-c-macro
4566 # - vc_files true if --vc-files was given, false if --no-vc-files was
4567 # given, blank otherwise
4568 # - autoconf_minversion minimum supported autoconf version
4569 # - doit : if actions shall be executed, false if only to be printed
4570 # - copymode copy mode for files in general
4571 # - lcopymode copy mode for files from local_gnulib_path
4572 # - do_copyrights true if copyright notices in files should be replaced,
4576 # Get the cached settings.
4577 # In 'import' mode, we read them only for the purpose of knowing the old
4578 # installed file list, and don't use them as defaults.
4579 cached_local_gnulib_path
=
4580 cached_specified_modules
=
4582 cached_inc_cxx_tests
=
4583 cached_inc_longrunning_tests
=
4584 cached_inc_privileged_tests
=
4585 cached_inc_unportable_tests
=
4586 cached_inc_all_tests
=
4596 cached_makefile_name
=
4597 cached_cond_dependencies
=
4599 cached_macro_prefix
=
4601 cached_witness_c_macro
=
4604 if test -f "$destdir"/$m4base/gnulib-cache.
m4; then
4605 cached_libtool
=false
4611 s,^.*gl_LOCAL_DIR([[ ]*\([^]"$`\\)]*\).*$,cached_local_gnulib_path="\1",p
4621 s,^.*gl_MODULES([[ ]*\([^]"$`\\)]*\).*$,cached_specified_modules="\1",p
4623 /gl_WITH_OBSOLETE/ {
4624 s,^.*$,cached_incobsolete=true,p
4626 /gl_WITH_CXX_TESTS/ {
4627 s,^.*$,cached_inc_cxx_tests=true,p
4629 /gl_WITH_LONGRUNNING_TESTS/ {
4630 s,^.*$,cached_inc_longrunning_tests=true,p
4632 /gl_WITH_PRIVILEGED_TESTS/ {
4633 s,^.*$,cached_inc_privileged_tests=true,p
4635 /gl_WITH_UNPORTABLE_TESTS/ {
4636 s,^.*$,cached_inc_unportable_tests=true,p
4638 /gl_WITH_ALL_TESTS/ {
4639 s,^.*$,cached_inc_all_tests=true,p
4642 s,^.*gl_AVOID([[ ]*\([^]"$`\\)]*\).*$,cached_avoidlist="\1",p
4645 s,^.*gl_SOURCE_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_sourcebase="\1",p
4648 s,^.*gl_M4_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_m4base="\1",p
4651 s,^.*gl_PO_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_pobase="\1",p
4654 s,^.*gl_DOC_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_docbase="\1",p
4657 s,^.*gl_TESTS_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_testsbase="\1",p
4660 s,^.*$,cached_inctests=true,p
4663 s,^.*gl_LIB([[ ]*\([^]"$`\\)]*\).*$,cached_libname="\1",p
4666 s,^.*gl_LGPL([[ ]*\([^]"$`\\)]*\).*$,cached_lgpl="\1",p
4669 s,^.*$,cached_lgpl=yes,p
4671 /gl_MAKEFILE_NAME(/ {
4672 s,^.*gl_MAKEFILE_NAME([[ ]*\([^]"$`\\)]*\).*$,cached_makefile_name="\1",p
4674 /gl_CONDITIONAL_DEPENDENCIES/ {
4675 s,^.*$,cached_cond_dependencies=true,p
4678 s,^.*$,cached_libtool=true,p
4680 /gl_MACRO_PREFIX(/ {
4681 s,^.*gl_MACRO_PREFIX([[ ]*\([^]"$`\\)]*\).*$,cached_macro_prefix="\1",p
4684 s,^.*gl_PO_DOMAIN([[ ]*\([^]"$`\\)]*\).*$,cached_po_domain="\1",p
4686 /gl_WITNESS_C_MACRO(/ {
4687 s,^.*gl_WITNESS_C_MACRO([[ ]*\([^]"$`\\)]*\).*$,cached_witness_c_macro="\1",p
4690 s,^.*gl_VC_FILES([[ ]*\([^]"$`\\)]*\).*$,cached_vc_files="\1",p
4692 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-cache.m4`
4693 if test -f "$destdir"/$m4base/gnulib-comp.
m4; then
4698 /AC_DEFUN(\['"${cached_macro_prefix}"'_FILE_LIST\], \[/ {
4699 s,^.*$,cached_files=",p
4712 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-comp.m4`
4716 if test "$mode" = import
; then
4717 # In 'import' mode, the new set of specified modules overrides the cached
4718 # set of modules. Ignore the cached settings.
4719 specified_modules
="$1"
4721 # Merge the cached settings with the specified ones.
4722 # The m4base must be the same as expected from the pathname.
4723 if test -n "$cached_m4base" && test "$cached_m4base" != "$m4base"; then
4724 func_fatal_error
"$m4base/gnulib-cache.m4 is expected to contain gl_M4_BASE([$m4base])"
4726 # The local_gnulib_path defaults to the cached one. Recall that the cached one
4727 # is relative to $destdir, whereas the one we use is relative to . or absolute.
4728 if test -z "$local_gnulib_path"; then
4729 func_reconstruct_cached_local_gnulib_path
4733 # Append the cached and the specified module names. So that
4734 # "gnulib-tool --add-import foo" means to add the module foo.
4735 specified_modules
="$cached_specified_modules $1"
4738 # Take the cached module names, minus the specified module names.
4740 if $have_associative; then
4741 # Use an associative array, for O(N) worst-case run time.
4742 declare -A to_remove
4744 eval 'to_remove[$m]=yes'
4746 for module
in $cached_specified_modules; do
4747 if eval 'test -z "${to_remove[$module]}"'; then
4748 func_append specified_modules
"$module "
4752 # This loop has O(N**2) worst-case run time.
4753 for module
in $cached_specified_modules; do
4756 if test "$m" = "$module"; then
4761 if test -z "$to_remove"; then
4762 func_append specified_modules
"$module "
4768 # Take the cached module names. There are no specified module names.
4769 specified_modules
="$cached_specified_modules"
4772 # Included obsolete modules among the dependencies if specified either way.
4773 if test -z "$incobsolete"; then
4774 incobsolete
="$cached_incobsolete"
4776 # Included special kinds of tests modules among the dependencies if specified
4778 if test -z "$inc_cxx_tests"; then
4779 inc_cxx_tests
="$cached_inc_cxx_tests"
4781 if test -z "$inc_longrunning_tests"; then
4782 inc_longrunning_tests
="$cached_inc_longrunning_tests"
4784 if test -z "$inc_privileged_tests"; then
4785 inc_privileged_tests
="$cached_inc_privileged_tests"
4787 if test -z "$inc_unportable_tests"; then
4788 inc_unportable_tests
="$cached_inc_unportable_tests"
4790 if test -z "$inc_all_tests"; then
4791 inc_all_tests
="$cached_inc_all_tests"
4793 # Append the cached and the specified avoidlist. This is probably better
4794 # than dropping the cached one when --avoid is specified at least once.
4795 avoidlist
=`for m in $cached_avoidlist $avoidlist; do echo $m; done | LC_ALL=C sort -u`
4796 avoidlist
=`echo $avoidlist`
4798 # The sourcebase defaults to the cached one.
4799 if test -z "$sourcebase"; then
4800 sourcebase
="$cached_sourcebase"
4801 if test -z "$sourcebase"; then
4802 func_fatal_error
"missing --source-base option"
4805 # The pobase defaults to the cached one.
4806 if test -z "$pobase"; then
4807 pobase
="$cached_pobase"
4809 # The docbase defaults to the cached one.
4810 if test -z "$docbase"; then
4811 docbase
="$cached_docbase"
4812 if test -z "$docbase"; then
4813 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."
4816 # The testsbase defaults to the cached one.
4817 if test -z "$testsbase"; then
4818 testsbase
="$cached_testsbase"
4819 if test -z "$testsbase"; then
4820 func_fatal_error
"missing --tests-base option"
4823 # Require the tests if specified either way.
4824 if ! $inctests; then
4825 inctests
="$cached_inctests"
4826 if test -z "$inctests"; then
4830 # The libname defaults to the cached one.
4831 if test -z "$supplied_libname"; then
4832 libname
="$cached_libname"
4833 if test -z "$libname"; then
4834 func_fatal_error
"missing --lib option"
4837 # Require LGPL if specified either way.
4838 if test -z "$lgpl"; then
4841 # The makefile_name defaults to the cached one.
4842 if test -z "$makefile_name"; then
4843 makefile_name
="$cached_makefile_name"
4845 # Use conditional dependencies if specified either way.
4846 if test -z "$cond_dependencies"; then
4847 cond_dependencies
="$cached_cond_dependencies"
4849 # Use libtool if specified either way, or if guessed.
4850 if test -z "$libtool"; then
4851 if test -n "$cached_m4base"; then
4852 libtool
="$cached_libtool"
4854 libtool
="$guessed_libtool"
4857 # The macro_prefix defaults to the cached one.
4858 if test -z "$macro_prefix"; then
4859 macro_prefix
="$cached_macro_prefix"
4860 if test -z "$macro_prefix"; then
4861 func_fatal_error
"missing --macro-prefix option"
4864 # The po_domain defaults to the cached one.
4865 if test -z "$po_domain"; then
4866 po_domain
="$cached_po_domain"
4868 # The witness_c_macro defaults to the cached one.
4869 if test -z "$witness_c_macro"; then
4870 witness_c_macro
="$cached_witness_c_macro"
4872 # The vc_files defaults to the cached one.
4873 if test -z "$vc_files"; then
4874 vc_files
="$cached_vc_files"
4876 # Ensure constraints.
4877 if test "$cond_dependencies" = true
&& $inctests; then
4878 echo "gnulib-tool: option --conditional-dependencies is not supported with --with-tests" 1>&2
4882 # --without-*-tests options are not supported here.
4884 excl_longrunning_tests
=
4885 excl_privileged_tests
=
4886 excl_unportable_tests
=
4888 # Canonicalize the list of specified modules.
4889 specified_modules
=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
4891 # Include all kinds of tests modules if --with-all-tests was specified.
4892 inc_all_direct_tests
="$inc_all_tests"
4893 inc_all_indirect_tests
="$inc_all_tests"
4895 # Determine final module list.
4896 modules
="$specified_modules"
4897 func_modules_transitive_closure
4898 if test $verbose -ge 0; then
4899 func_show_module_list
4901 final_modules
="$modules"
4903 # Determine main module list and tests-related module list separately.
4904 func_modules_transitive_closure_separately
4906 # Determine whether a $testsbase/libtests.a is needed.
4907 func_determine_use_libtests
4909 # Add the dummy module to the main module list or to the tests-related module
4911 func_modules_add_dummy_separately
4913 # If --lgpl, verify that the licenses of modules are compatible.
4914 if test -n "$lgpl"; then
4915 license_incompatibilities
=
4916 for module
in $main_modules; do
4917 license
=`func_get_license $module`
4919 'GPLed build tool') ;;
4920 'public domain' |
'unlimited' |
'unmodifiable license text') ;;
4925 LGPLv2
+ |
'LGPLv3+ or GPLv2' | LGPLv3
+ | LGPL
) ;;
4926 *) func_append license_incompatibilities
"$module $license$nl" ;;
4931 LGPLv2
+ |
'LGPLv3+ or GPLv2') ;;
4932 *) func_append license_incompatibilities
"$module $license$nl" ;;
4938 *) func_append license_incompatibilities
"$module $license$nl" ;;
4941 *) func_fatal_error
"invalid value lgpl=$lgpl" ;;
4946 if test -n "$license_incompatibilities"; then
4947 # Format the license incompatibilities as a table.
4948 sed_expand_column1_width50_indent17
='s,^\([^ ]*\) ,\1 ,
4949 s,^\(.................................................[^ ]*\) *, \1 ,'
4950 license_incompatibilities
=`echo "$license_incompatibilities" | sed -e "$sed_expand_column1_width50_indent17"`
4951 func_fatal_error
"incompatible license on modules:$nl$license_incompatibilities"
4955 # Show banner notice of every module.
4956 modules
="$main_modules"
4959 # Determine script to apply to imported library files.
4960 sed_transform_lib_file
=
4961 for module
in $main_modules; do
4962 if test $module = config-h
; then
4963 # Assume config.h exists, and that -DHAVE_CONFIG_H is omitted.
4964 sed_transform_lib_file
=$sed_transform_lib_file'
4965 s/^#ifdef[ ]*HAVE_CONFIG_H[ ]*$/#if 1/
4970 sed_transform_main_lib_file
="$sed_transform_lib_file"
4971 if test -n "$do_copyrights"; then
4972 if test -n "$lgpl"; then
4976 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
4977 s/GNU General/GNU Lesser General/g
4978 s/General Public License/Lesser General Public License/g
4979 s/Lesser Lesser General Public License/Lesser General Public License/g
4983 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
4984 /^ *This program is free software/i\
4985 This program is free software: you can redistribute it and\/or\
4986 modify it under the terms of either:\
4988 * the GNU Lesser General Public License as published by the Free\
4989 Software Foundation; either version 3 of the License, or (at your\
4990 option) any later version.\
4994 * the GNU General Public License as published by the Free\
4995 Software Foundation; either version 2 of the License, or (at your\
4996 option) any later version.\
4998 or both in parallel, as here.
4999 /^ *This program is free software/,/^$/d
5003 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
5004 s/GNU General/GNU Lesser General/g
5005 s/General Public License/Lesser General Public License/g
5006 s/Lesser Lesser General Public License/Lesser General Public License/g
5008 s/version [23]\([ ,]\)/version 2.1\1/g
5011 *) func_fatal_error
"invalid value lgpl=$lgpl" ;;
5015 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
5016 s/GNU Lesser General/GNU General/g
5017 s/Lesser General Public License/General Public License/g
5019 s/GNU Library General/GNU General/g
5020 s/Library General Public License/General Public License/g
5022 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
5027 # Determine script to apply to auxiliary files that go into $auxdir/.
5028 sed_transform_build_aux_file
=
5029 if test -n "$do_copyrights"; then
5031 sed_transform_build_aux_file
=$sed_transform_build_aux_file'
5032 s/GNU Lesser General/GNU General/g
5033 s/Lesser General Public License/General Public License/g
5035 s/GNU Library General/GNU General/g
5036 s/Library General Public License/General Public License/g
5038 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
5042 # Determine script to apply to library files that go into $testsbase/.
5043 sed_transform_testsrelated_lib_file
="$sed_transform_lib_file"
5044 if test -n "$do_copyrights"; then
5046 sed_transform_testsrelated_lib_file
=$sed_transform_testsrelated_lib_file'
5047 s/GNU Lesser General/GNU General/g
5048 s/Lesser General Public License/General Public License/g
5050 s/GNU Library General/GNU General/g
5051 s/Library General Public License/General Public License/g
5053 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
5057 # Determine the final file lists.
5058 func_modules_to_filelist_separately
5061 || func_fatal_error
"refusing to do nothing"
5063 # Add m4/gnulib-tool.m4 to the file list. It is not part of any module.
5064 new_files
="$files m4/gnulib-tool.m4"
5065 old_files
="$cached_files"
5066 if test -f "$destdir"/$m4base/gnulib-tool.
m4; then
5067 func_append old_files
" m4/gnulib-tool.m4"
5070 rewritten
='%REWRITTEN%'
5071 sed_rewrite_old_files
="\
5072 s,^build-aux/,$rewritten$auxdir/,
5073 s,^doc/,$rewritten$cached_docbase/,
5074 s,^lib/,$rewritten$cached_sourcebase/,
5075 s,^m4/,$rewritten$cached_m4base/,
5076 s,^tests/,$rewritten$cached_testsbase/,
5077 s,^tests=lib/,$rewritten$cached_testsbase/,
5080 sed_rewrite_new_files
="\
5081 s,^build-aux/,$rewritten$auxdir/,
5082 s,^doc/,$rewritten$docbase/,
5083 s,^lib/,$rewritten$sourcebase/,
5084 s,^m4/,$rewritten$m4base/,
5085 s,^tests/,$rewritten$testsbase/,
5086 s,^tests=lib/,$rewritten$testsbase/,
5090 # Create directories.
5091 { echo "$sourcebase"
5093 if test -n "$pobase"; then
5096 docfiles
=`echo "$files" | sed -n -e 's,^doc/,,p'`
5097 if test -n "$docfiles"; then
5104 for f
in $files; do echo $f; done \
5105 |
sed -e "$sed_rewrite_new_files" \
5106 |
sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
5109 { # Rearrange file descriptors. Needed because "while ... done < ..."
5110 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5111 exec 5<&0 < "$tmp"/dirs
5113 if test ! -d "$destdir/$d"; then
5115 echo "Creating directory $destdir/$d"
5116 mkdir
-p "$destdir/$d" || func_fatal_error
"failed"
5118 echo "Create directory $destdir/$d"
5125 # Copy files or make symbolic links or hard links. Remove obsolete files.
5129 # Construct a table with 2 columns: rewritten-file-name original-file-name,
5130 # representing the files according to the last gnulib-tool invocation.
5131 for f
in $old_files; do echo $f; done \
5132 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_old_files" \
5135 # Construct a table with 2 columns: rewritten-file-name original-file-name,
5136 # representing the files after this gnulib-tool invocation.
5137 for f
in $new_files; do echo $f; done \
5138 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" \
5141 # First the files that are in old-files, but not in new-files:
5142 sed_take_first_column
='s,'"$delimiter"'.*,,'
5143 for g
in `LC_ALL=C join -t"$delimiter" -v1 "$tmp"/old-files "$tmp"/new-files | sed -e "$sed_take_first_column"`; do
5144 # Remove the file. Do nothing if the user already removed it.
5145 if test -f "$destdir/$g" ||
test -h "$destdir/$g"; then
5147 echo "Removing file $g (backup in ${g}~)"
5148 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error
"failed"
5150 echo "Remove file $g (backup in ${g}~)"
5152 func_append removed_files
"$g$nl"
5155 # func_add_or_update handles a file that ought to be present afterwards.
5157 # - f the original file name
5158 # - g the rewritten file name
5159 # - already_present nonempty if the file should already exist, empty
5161 func_add_or_update
()
5165 tests
=lib
/*) f
=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
5167 func_dest_tmpfilename
"$g"
5168 func_lookup_file
"$f"
5169 cp "$lookedup_file" "$tmpfile" || func_fatal_error
"failed"
5172 # Don't process binary files with sed.
5175 if test -n "$sed_transform_main_lib_file"; then
5178 sed -e "$sed_transform_main_lib_file" \
5179 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
5183 if test -n "$sed_transform_build_aux_file"; then
5186 sed -e "$sed_transform_build_aux_file" \
5187 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
5191 if test -n "$sed_transform_testsrelated_lib_file"; then
5194 sed -e "$sed_transform_testsrelated_lib_file" \
5195 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
5201 if test -f "$destdir/$g"; then
5202 # The file already exists.
5206 # Don't protest if the file should be there but isn't: it happens
5207 # frequently that developers don't put autogenerated files under version control.
5209 func_append added_files
"$g$nl"
5213 # Then the files that are in new-files, but not in old-files:
5214 sed_take_last_column
='s,^.*'"$delimiter"',,'
5216 LC_ALL
=C
join -t"$delimiter" -v2 "$tmp"/old-files
"$tmp"/new-files \
5217 |
sed -e "$sed_take_last_column" \
5218 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/added-files
5219 { # Rearrange file descriptors. Needed because "while ... done < ..."
5220 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5221 exec 5<&0 < "$tmp"/added-files
5227 # Then the files that are in new-files and in old-files:
5228 already_present
=true
5229 LC_ALL
=C
join -t"$delimiter" "$tmp"/old-files
"$tmp"/new-files \
5230 |
sed -e "$sed_take_last_column" \
5231 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/kept-files
5232 { # Rearrange file descriptors. Needed because "while ... done < ..."
5233 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5234 exec 5<&0 < "$tmp"/kept-files
5241 # Command-line invocation printed in a comment in generated gnulib-cache.m4.
5242 actioncmd
="# gnulib-tool --import"
5245 func_append_local_dir
()
5247 func_append
"$1" " --local-dir=$2"
5249 func_path_foreach
"$local_gnulib_path" func_append_local_dir actioncmd
%dir
%
5251 # Break the action command log into multiple lines.
5252 # Emacs puts some gnulib-tool log lines in its source repository, and
5253 # git send-email rejects patch lines longer than 998 characters.
5254 # Also, config.status uses awk, and the HP-UX 11.00 awk fails if a
5255 # line has length >= 3071; similarly, the IRIX 6.5 awk fails if a
5256 # line has length >= 3072.
5257 func_append_actionarg
()
5259 func_append actioncmd
" \\$nl# $1"
5261 func_append_actionarg
"--lib=$libname"
5262 func_append_actionarg
"--source-base=$sourcebase"
5263 func_append_actionarg
"--m4-base=$m4base"
5264 if test -n "$pobase"; then
5265 func_append_actionarg
"--po-base=$pobase"
5267 func_append_actionarg
"--doc-base=$docbase"
5268 func_append_actionarg
"--tests-base=$testsbase"
5269 func_append_actionarg
"--aux-dir=$auxdir"
5271 func_append_actionarg
"--with-tests"
5273 if test -n "$incobsolete"; then
5274 func_append_actionarg
"--with-obsolete"
5276 if test -n "$inc_cxx_tests"; then
5277 func_append_actionarg
"--with-c++-tests"
5279 if test -n "$inc_longrunning_tests"; then
5280 func_append_actionarg
"--with-longrunning-tests"
5282 if test -n "$inc_privileged_tests"; then
5283 func_append_actionarg
"--with-privileged-tests"
5285 if test -n "$inc_unportable_tests"; then
5286 func_append_actionarg
"--with-unportable-tests"
5288 if test -n "$inc_all_tests"; then
5289 func_append_actionarg
"--with-all-tests"
5291 if test -n "$lgpl"; then
5292 if test "$lgpl" = yes; then
5293 func_append_actionarg
"--lgpl"
5295 func_append_actionarg
"--lgpl=$lgpl"
5299 func_append_actionarg
"--gnu-make"
5301 if test -n "$makefile_name"; then
5302 func_append_actionarg
"--makefile-name=$makefile_name"
5304 if test "$cond_dependencies" = true
; then
5305 func_append_actionarg
"--conditional-dependencies"
5307 func_append_actionarg
"--no-conditional-dependencies"
5309 if test "$libtool" = true
; then
5310 func_append_actionarg
"--libtool"
5312 func_append_actionarg
"--no-libtool"
5314 func_append_actionarg
"--macro-prefix=$macro_prefix"
5315 if test -n "$po_domain"; then
5316 func_append_actionarg
"--po-domain=$po_domain"
5318 if test -n "$witness_c_macro"; then
5319 func_append_actionarg
"--witness-c-macro=$witness_c_macro"
5321 if test -n "$vc_files"; then
5322 if test "$vc_files" = true
; then
5323 func_append_actionarg
"--vc-files"
5325 func_append_actionarg
"--no-vc-files"
5328 for module
in $avoidlist; do
5329 func_append_actionarg
"--avoid=$module"
5331 for module
in $specified_modules; do
5332 func_append_actionarg
"$module"
5335 # Determine include_guard_prefix.
5336 func_compute_include_guard_prefix
5338 # Default the makefile name to Makefile.am.
5339 if test -n "$makefile_name"; then
5340 makefile_am
=$makefile_name
5342 makefile_am
=Makefile.am
5345 # Create normal Makefile.ams.
5348 # Setup list of Makefile.am edits that are to be performed afterwards.
5349 # Some of these edits apply to files that we will generate; others are
5350 # under the responsibility of the developer.
5352 # func_note_Makefile_am_edit dir var value [dotfirst]
5353 # remembers that ${dir}Makefile.am needs to be edited to that ${var} mentions
5355 # If ${dotfirst} is non-empty, this mention needs to be present after '.'.
5356 # This is a special hack for the SUBDIRS variable, cf.
5357 # <https://www.gnu.org/software/automake/manual/html_node/Subdirectories.html>.
5358 func_note_Makefile_am_edit
()
5360 makefile_am_edits
=`expr $makefile_am_edits + 1`
5361 eval makefile_am_edit
${makefile_am_edits}_dir
=\"\
$1\"
5362 eval makefile_am_edit
${makefile_am_edits}_var
=\"\
$2\"
5363 eval makefile_am_edit
${makefile_am_edits}_val
=\"\
$3\"
5364 eval makefile_am_edit
${makefile_am_edits}_dotfirst
=\"\
$4\"
5366 if test "$makefile_am" = Makefile.am
; then
5367 sourcebase_dir
=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'`
5368 sourcebase_base
=`basename "$sourcebase"`
5369 func_note_Makefile_am_edit
"$sourcebase_dir" SUBDIRS
"$sourcebase_base"
5371 if test -n "$pobase"; then
5372 pobase_dir
=`echo "$pobase" | sed -n -e 's,/[^/]*$,/,p'`
5373 pobase_base
=`basename "$pobase"`
5374 func_note_Makefile_am_edit
"$pobase_dir" SUBDIRS
"$pobase_base"
5377 if test "$makefile_am" = Makefile.am
; then
5378 testsbase_dir
=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'`
5379 testsbase_base
=`basename "$testsbase"`
5380 func_note_Makefile_am_edit
"$testsbase_dir" SUBDIRS
"$testsbase_base" true
5383 func_note_Makefile_am_edit
"" ACLOCAL_AMFLAGS
"-I ${m4base}"
5385 # Find the first parent directory of $m4base that contains or will contain
5387 sed_last
='s,^.*/\([^/][^/]*\)//*$,\1/,
5389 sed_butlast
='s,[^/][^/]*//*$,,'
5390 dir1
="${m4base}/"; dir2
=""
5391 while test -n "$dir1" \
5392 && ! { test -f "${destdir}/${dir1}Makefile.am" \
5393 ||
test "${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
5394 ||
test "./${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
5396 && { test "${dir1}Makefile.am" = "$testsbase/$makefile_am" \
5397 ||
test "./${dir1}Makefile.am" = "$testsbase/$makefile_am"; }; }; }; do
5398 dir2
=`echo "$dir1" | sed -e "$sed_last"`"$dir2"
5399 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
5401 func_note_Makefile_am_edit
"$dir1" EXTRA_DIST
"${dir2}gnulib-cache.m4"
5404 # Create library makefile.
5405 func_dest_tmpfilename
$sourcebase/$makefile_am
5406 destfile
="$sourcebase/$makefile_am"
5407 modules
="$main_modules"
5408 func_emit_lib_Makefile_am
> "$tmpfile"
5409 if test -f "$destdir"/$sourcebase/$makefile_am; then
5410 if cmp -s "$destdir"/$sourcebase/$makefile_am "$tmpfile"; then
5414 echo "Updating $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
5415 mv -f "$destdir"/$sourcebase/$makefile_am "$destdir"/$sourcebase/$makefile_am~
5416 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
5418 echo "Update $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
5424 echo "Creating $sourcebase/$makefile_am"
5425 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
5427 echo "Create $sourcebase/$makefile_am"
5430 func_append added_files
"$sourcebase/$makefile_am$nl"
5433 # Create po/ directory.
5434 if test -n "$pobase"; then
5435 # Create po makefile and auxiliary files.
5436 for file in Makefile.
in.
in remove-potcdate.sin
; do
5437 func_dest_tmpfilename
$pobase/$file
5438 func_lookup_file build-aux
/po
/$file
5439 cat "$lookedup_file" > "$tmpfile"
5440 if test -f "$destdir"/$pobase/$file; then
5441 if cmp -s "$destdir"/$pobase/$file "$tmpfile"; then
5445 echo "Updating $pobase/$file (backup in $pobase/$file~)"
5446 mv -f "$destdir"/$pobase/$file "$destdir"/$pobase/$file~
5447 mv -f "$tmpfile" "$destdir"/$pobase/$file
5449 echo "Update $pobase/$file (backup in $pobase/$file~)"
5455 echo "Creating $pobase/$file"
5456 mv -f "$tmpfile" "$destdir"/$pobase/$file
5458 echo "Create $pobase/$file"
5461 func_append added_files
"$pobase/$file$nl"
5464 # Create po makefile parameterization, part 1.
5465 func_dest_tmpfilename
$pobase/Makevars
5466 func_emit_po_Makevars
> "$tmpfile"
5467 if test -f "$destdir"/$pobase/Makevars
; then
5468 if cmp -s "$destdir"/$pobase/Makevars
"$tmpfile"; then
5472 echo "Updating $pobase/Makevars (backup in $pobase/Makevars~)"
5473 mv -f "$destdir"/$pobase/Makevars
"$destdir"/$pobase/Makevars~
5474 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
5476 echo "Update $pobase/Makevars (backup in $pobase/Makevars~)"
5482 echo "Creating $pobase/Makevars"
5483 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
5485 echo "Create $pobase/Makevars"
5488 func_append added_files
"$pobase/Makevars$nl"
5490 # Create po makefile parameterization, part 2.
5491 func_dest_tmpfilename
$pobase/POTFILES.
in
5492 func_emit_po_POTFILES_in
> "$tmpfile"
5493 if test -f "$destdir"/$pobase/POTFILES.
in; then
5494 if cmp -s "$destdir"/$pobase/POTFILES.
in "$tmpfile"; then
5498 echo "Updating $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
5499 mv -f "$destdir"/$pobase/POTFILES.
in "$destdir"/$pobase/POTFILES.
in~
5500 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.
in
5502 echo "Update $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
5508 echo "Creating $pobase/POTFILES.in"
5509 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.
in
5511 echo "Create $pobase/POTFILES.in"
5514 func_append added_files
"$pobase/POTFILES.in$nl"
5517 TP_URL
="https://translationproject.org/latest/"
5519 echo "Fetching gnulib PO files from $TP_URL"
5520 (cd "$destdir"/$pobase \
5521 && wget
--no-verbose --mirror --level=1 -nd -A.po
-P .
"${TP_URL}gnulib/"
5524 echo "Fetch gnulib PO files from $TP_URL"
5526 # Create po/LINGUAS.
5528 func_dest_tmpfilename
$pobase/LINGUAS
5529 (cd "$destdir"/$pobase \
5530 && { echo '# Set of available languages.'
5531 LC_ALL
=C
ls -1 *.po |
sed -e 's,\.po$,,'
5534 if test -f "$destdir"/$pobase/LINGUAS
; then
5535 if cmp -s "$destdir"/$pobase/LINGUAS
"$tmpfile"; then
5538 echo "Updating $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
5539 mv -f "$destdir"/$pobase/LINGUAS
"$destdir"/$pobase/LINGUAS~
5540 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
5543 echo "Creating $pobase/LINGUAS"
5544 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
5545 func_append added_files
"$pobase/LINGUAS$nl"
5548 if test -f "$destdir"/$pobase/LINGUAS
; then
5549 echo "Update $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
5551 echo "Create $pobase/LINGUAS"
5556 # func_count_relative_local_gnulib_path
5557 # gl_LOCAL_DIR requires local_gnulib_path to be set relatively to destdir
5559 # - local_gnulib_path from --local-dir
5560 # - destdir from --dir
5562 # - relative_local_dir path to be stored into gl_LOCAL_DIR
5563 func_count_relative_local_gnulib_path
()
5567 relative_local_gnulib_path
=
5568 for local_dir
in $local_gnulib_path
5570 # Store the local_dir relative to destdir.
5571 case "$local_dir" in
5573 relative_local_dir
="$local_dir" ;;
5576 /*) relative_local_dir
="$local_dir" ;;
5578 # destdir, local_dir are both relative.
5579 func_relativize
"$destdir" "$local_dir"
5580 relative_local_dir
="$reldir" ;;
5583 func_path_append relative_local_gnulib_path
"$relative_local_dir"
5588 # Create m4/gnulib-cache.m4.
5589 func_dest_tmpfilename
$m4base/gnulib-cache.
m4
5591 func_emit_copyright_notice
5593 echo "# This file represents the specification of how gnulib-tool is used."
5594 echo "# It acts as a cache: It is written and read by gnulib-tool."
5595 echo "# In projects that use version control, this file is meant to be put under"
5596 echo "# version control, like the configure.ac and various Makefile.am files."
5599 echo "# Specification in the form of a command-line invocation:"
5600 printf '%s\n' "$actioncmd"
5602 echo "# Specification in the form of a few gnulib-tool.m4 macro invocations:"
5603 func_count_relative_local_gnulib_path
5604 echo "gl_LOCAL_DIR([$relative_local_gnulib_path])"
5606 echo "$specified_modules" |
sed -e 's/^/ /g'
5608 test -z "$incobsolete" ||
echo "gl_WITH_OBSOLETE"
5609 test -z "$inc_cxx_tests" ||
echo "gl_WITH_CXX_TESTS"
5610 test -z "$inc_longrunning_tests" ||
echo "gl_WITH_LONGRUNNING_TESTS"
5611 test -z "$inc_privileged_tests" ||
echo "gl_WITH_PRIVILEGED_TESTS"
5612 test -z "$inc_unportable_tests" ||
echo "gl_WITH_UNPORTABLE_TESTS"
5613 test -z "$inc_all_tests" ||
echo "gl_WITH_ALL_TESTS"
5614 echo "gl_AVOID([$avoidlist])"
5615 echo "gl_SOURCE_BASE([$sourcebase])"
5616 echo "gl_M4_BASE([$m4base])"
5617 echo "gl_PO_BASE([$pobase])"
5618 echo "gl_DOC_BASE([$docbase])"
5619 echo "gl_TESTS_BASE([$testsbase])"
5621 echo "gl_WITH_TESTS"
5623 echo "gl_LIB([$libname])"
5624 if test -n "$lgpl"; then
5625 if test "$lgpl" = yes; then
5628 echo "gl_LGPL([$lgpl])"
5631 echo "gl_MAKEFILE_NAME([$makefile_name])"
5632 if test "$cond_dependencies" = true
; then
5633 echo "gl_CONDITIONAL_DEPENDENCIES"
5635 if test "$libtool" = true
; then
5638 echo "gl_MACRO_PREFIX([$macro_prefix])"
5639 echo "gl_PO_DOMAIN([$po_domain])"
5640 echo "gl_WITNESS_C_MACRO([$witness_c_macro])"
5641 if test -n "$vc_files"; then
5642 echo "gl_VC_FILES([$vc_files])"
5645 if test -f "$destdir"/$m4base/gnulib-cache.
m4; then
5646 if cmp -s "$destdir"/$m4base/gnulib-cache.
m4 "$tmpfile"; then
5650 echo "Updating $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
5651 mv -f "$destdir"/$m4base/gnulib-cache.
m4 "$destdir"/$m4base/gnulib-cache.
m4~
5652 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.
m4
5654 echo "Update $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
5658 echo "# gnulib-cache.m4 ends here"
5665 echo "Creating $m4base/gnulib-cache.m4"
5666 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.
m4
5668 echo "Create $m4base/gnulib-cache.m4"
5674 # Create m4/gnulib-comp.m4.
5675 func_dest_tmpfilename
$m4base/gnulib-comp.
m4
5677 echo "# DO NOT EDIT! GENERATED AUTOMATICALLY!"
5678 func_emit_copyright_notice
5680 echo "# This file represents the compiled summary of the specification in"
5681 echo "# gnulib-cache.m4. It lists the computed macro invocations that need"
5682 echo "# to be invoked from configure.ac."
5683 echo "# In projects that use version control, this file can be treated like"
5684 echo "# other built files."
5687 echo "# This macro should be invoked from $configure_ac, in the section"
5688 echo "# \"Checks for programs\", right after AC_PROG_CC, and certainly before"
5689 echo "# any checks for libraries, header files, types and library functions."
5690 echo "AC_DEFUN([${macro_prefix}_EARLY],"
5692 echo " m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
5693 echo " m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
5694 echo " m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
5695 echo " m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
5697 func_emit_pre_early_macros
: ' ' "$final_modules"
5699 if ! $gnu_make && test -n "$uses_subdirs"; then
5700 echo " AC_REQUIRE([AM_PROG_CC_C_O])"
5702 for module
in $final_modules; do
5704 if test -n "$module"; then
5705 echo "# Code from module $module:"
5706 func_get_autoconf_early_snippet
"$module"
5709 |
sed -e '/^$/d;' -e 's/^/ /'
5712 echo "# This macro should be invoked from $configure_ac, in the section"
5713 echo "# \"Check for header files, types and library functions\"."
5714 echo "AC_DEFUN([${macro_prefix}_INIT],"
5716 if test "$libtool" = true
; then
5717 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
5718 echo " gl_cond_libtool=true"
5720 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
5721 echo " gl_cond_libtool=false"
5723 echo " gl_ltlibdeps="
5725 if test "$auxdir" != "build-aux"; then
5726 sed_replace_build_aux
='
5728 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
5729 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
5733 sed_replace_build_aux
="$sed_noop"
5735 echo " gl_m4_base='$m4base'"
5736 func_emit_initmacro_start
$macro_prefix
5737 echo " gl_source_base='$sourcebase'"
5738 if test -n "$witness_c_macro"; then
5739 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$witness_c_macro])"
5741 func_emit_autoconf_snippets
"$main_modules" "$main_modules" func_verify_module true false true
5742 if test -n "$witness_c_macro"; then
5743 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
5745 echo " # End of code from modules"
5746 func_emit_initmacro_end
$macro_prefix
5747 echo " gltests_libdeps="
5748 echo " gltests_ltlibdeps="
5749 func_emit_initmacro_start
${macro_prefix}tests
5750 echo " gl_source_base='$testsbase'"
5751 # Define a tests witness macro that depends on the package.
5752 # PACKAGE is defined by AM_INIT_AUTOMAKE, PACKAGE_TARNAME is defined by AC_INIT.
5753 # See <https://lists.gnu.org/r/automake/2009-05/msg00145.html>.
5754 echo "changequote(,)dnl"
5755 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"
5756 echo "changequote([, ])dnl"
5757 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
5758 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
5759 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
5760 func_emit_autoconf_snippets
"$testsrelated_modules" "$main_modules $testsrelated_modules" func_verify_module true true true
5761 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
5762 func_emit_initmacro_end
${macro_prefix}tests
5763 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
5764 # created using libtool, because libtool already handles the dependencies.
5765 if test "$libtool" != true
; then
5766 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
5767 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
5768 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
5769 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
5770 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
5772 if $use_libtests; then
5773 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
5774 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
5777 func_emit_initmacro_done
$macro_prefix $sourcebase
5778 func_emit_initmacro_done
${macro_prefix}tests
$testsbase
5780 echo "# This macro records the list of files which have been installed by"
5781 echo "# gnulib-tool and may be removed by future gnulib-tool invocations."
5782 echo "AC_DEFUN([${macro_prefix}_FILE_LIST], ["
5783 echo "$files" |
sed -e 's,^, ,'
5786 if test -f "$destdir"/$m4base/gnulib-comp.
m4; then
5787 if cmp -s "$destdir"/$m4base/gnulib-comp.
m4 "$tmpfile"; then
5791 echo "Updating $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
5792 mv -f "$destdir"/$m4base/gnulib-comp.
m4 "$destdir"/$m4base/gnulib-comp.
m4~
5793 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.
m4
5795 echo "Update $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
5799 echo "# gnulib-comp.m4 ends here"
5806 echo "Creating $m4base/gnulib-comp.m4"
5807 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.
m4
5809 echo "Create $m4base/gnulib-comp.m4"
5816 # Create tests makefile.
5817 func_dest_tmpfilename
$testsbase/$makefile_am
5818 destfile
="$testsbase/$makefile_am"
5819 modules
="$testsrelated_modules"
5820 func_emit_tests_Makefile_am
"${macro_prefix}tests_WITNESS" > "$tmpfile"
5821 if test -f "$destdir"/$testsbase/$makefile_am; then
5822 if cmp -s "$destdir"/$testsbase/$makefile_am "$tmpfile"; then
5826 echo "Updating $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
5827 mv -f "$destdir"/$testsbase/$makefile_am "$destdir"/$testsbase/$makefile_am~
5828 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
5830 echo "Update $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
5836 echo "Creating $testsbase/$makefile_am"
5837 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
5839 echo "Create $testsbase/$makefile_am"
5842 func_append added_files
"$testsbase/$makefile_am$nl"
5846 if test "$vc_files" != false
; then
5847 # Update the .cvsignore and .gitignore files.
5848 { echo "$added_files" |
sed -e '/^$/d' -e 's,\([^/]*\)$,|A|\1,'
5849 echo "$removed_files" |
sed -e '/^$/d' -e 's,\([^/]*\)$,|R|\1,'
5850 # Treat gnulib-comp.m4 like an added file, even if it already existed.
5851 echo "$m4base/|A|gnulib-comp.m4"
5852 } | LC_ALL
=C
sort -t'|' -k1,1 > "$tmp"/fileset-changes
5853 { # Rearrange file descriptors. Needed because "while ... done < ..."
5854 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5855 exec 5<&0 < "$tmp"/fileset-changes
5856 func_update_ignorelist
()
5859 if test "$ignore" = .gitignore
; then
5860 # In a .gitignore file, "foo" applies to the current directory and all
5861 # subdirectories, whereas "/foo" applies to the current directory only.
5864 doubly_escaped_anchor
='\\/'
5868 doubly_escaped_anchor
=''
5870 if test -f "$destdir/$dir$ignore"; then
5871 if test -n "$dir_added" ||
test -n "$dir_removed"; then
5872 sed -e "s|^$anchor||" < "$destdir/$dir$ignore" | LC_ALL
=C
sort > "$tmp"/ignore
5873 (echo "$dir_added" |
sed -e '/^$/d' | LC_ALL
=C
sort -u \
5874 | LC_ALL
=C
join -v 1 - "$tmp"/ignore
> "$tmp"/ignore-added
5875 echo "$dir_removed" |
sed -e '/^$/d' | LC_ALL
=C
sort -u \
5876 > "$tmp"/ignore-removed
5878 if test -s "$tmp"/ignore-added ||
test -s "$tmp"/ignore-removed
; then
5880 echo "Updating $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
5881 mv -f "$destdir/$dir$ignore" "$destdir/$dir$ignore"~
5882 { sed -e 's,/,\\/,g' -e 's,^,/^,' -e 's,$,\$/d,' < "$tmp"/ignore-removed
5883 if test -n "$anchor"; then sed -e 's,/,\\/,g' -e "s,^,/^${doubly_escaped_anchor}," -e 's,$,$/d,' < "$tmp"/ignore-removed
; fi
5884 } > "$tmp"/sed-ignore-removed
5885 { cat "$destdir/$dir$ignore"~
5886 sed -e "s|^|$anchor|" < "$tmp"/ignore-added
5887 } |
sed -f "$tmp"/sed-ignore-removed \
5888 > "$destdir/$dir$ignore"
5890 echo "Update $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
5895 if test -n "$dir_added"; then
5897 echo "Creating $destdir/$dir$ignore"
5899 if test "$ignore" = .cvsignore
; then
5901 # Automake generates Makefile rules that create .dirstamp files.
5904 echo "$dir_added" |
sed -e '/^$/d' -e "s|^|$anchor|" | LC_ALL
=C
sort -u
5905 } > "$destdir/$dir$ignore"
5907 echo "Create $destdir/$dir$ignore"
5917 if test -d "$destdir/CVS" ||
test -d "$destdir/${dir}CVS" ||
test -f "$destdir/${dir}.cvsignore"; then
5918 func_update_ignorelist .cvsignore
5920 if test -d "$destdir/.git" ||
test -f "$destdir/${dir}.gitignore"; then
5921 func_update_ignorelist .gitignore
5928 # Why not ''read next_dir op file'' ? Because the dir column can be empty.
5929 next_dir
=`echo "$line" | sed -e 's,|.*,,'`
5930 op
=`echo "$line" | sed -e 's,^[^|]*|\([^|]*\)|.*$,\1,'`
5931 file=`echo "$line" | sed -e 's,^[^|]*|[^|]*|,,'`
5932 if test "$next_dir" != "$last_dir"; then
5933 func_done_dir
"$last_dir" "$last_dir_added" "$last_dir_removed"
5934 last_dir
="$next_dir"
5939 A
) func_append last_dir_added
"$file$nl";;
5940 R
) func_append last_dir_removed
"$file$nl";;
5943 func_done_dir
"$last_dir" "$last_dir_added" "$last_dir_removed"
5950 echo "You may need to add #include directives for the following .h files."
5951 # Intersect $specified_modules and $main_modules
5952 # (since $specified_modules is not necessarily of subset of $main_modules
5953 # - some may have been skipped through --avoid, and since the elements of
5954 # $main_modules but not in $specified_modules can go away without explicit
5955 # notice - through changes in the module dependencies).
5956 echo "$specified_modules" > "$tmp"/modules1
# a sorted list, one module per line
5957 echo "$main_modules" > "$tmp"/modules2
# also a sorted list, one module per line
5958 # First the #include <...> directives without #ifs, sorted for convenience,
5959 # then the #include "..." directives without #ifs, sorted for convenience,
5960 # then the #include directives that are surrounded by #ifs. Not sorted.
5961 for module
in `LC_ALL=C join "$tmp"/modules1 "$tmp"/modules2`; do
5962 include_directive
=`func_get_include_directive "$module"`
5963 case "$nl$include_directive" in
5965 echo "$include_directive" 1>&5
5968 echo "$include_directive" |
grep -v 'include "' 1>&6
5969 echo "$include_directive" |
grep 'include "' 1>&7
5972 done 5> "$tmp"/include-if
6> "$tmp"/include-angles
7> "$tmp"/include-quotes
5974 LC_ALL
=C
sort -u "$tmp"/include-angles
5975 LC_ALL
=C
sort -u "$tmp"/include-quotes
5976 cat "$tmp"/include-if
5977 ) |
sed -e '/^$/d' -e 's/^/ /'
5978 rm -f "$tmp"/include-angles
"$tmp"/include-quotes
"$tmp"/include-if
5980 for module
in $main_modules; do
5981 func_get_link_directive
"$module"
5983 | LC_ALL
=C
sort -u |
sed -e '/^$/d' -e 's/^/ /' > "$tmp"/link
5984 if test `wc -l < "$tmp"/link` != 0; then
5986 echo "You may need to use the following Makefile variables when linking."
5987 echo "Use them in <program>_LDADD when linking a program, or"
5988 echo "in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library."
5994 echo "Don't forget to"
5995 if test "$makefile_am" = Makefile.am
; then
5996 echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
5998 echo " - \"include $makefile_name\" from within \"$sourcebase/Makefile.am\","
6000 if test -n "$pobase"; then
6001 echo " - add \"$pobase/Makefile.in\" to AC_CONFIG_FILES in $configure_ac,"
6004 if test "$makefile_am" = Makefile.am
; then
6005 echo " - add \"$testsbase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
6007 echo " - \"include $makefile_name\" from within \"$testsbase/Makefile.am\","
6011 while test $edit != $makefile_am_edits; do
6012 edit
=`expr $edit + 1`
6013 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
6014 eval var
=\"\
$makefile_am_edit${edit}_var
\"
6015 eval val
=\"\
$makefile_am_edit${edit}_val
\"
6016 if test -n "$var"; then
6017 echo " - mention \"${val}\" in ${var} in ${dir}Makefile.am,"
6020 if grep '^ *AC_PROG_CC_STDC' "$configure_ac" > /dev
/null
; then
6021 position_early_after
=AC_PROG_CC_STDC
6023 if grep '^ *AC_PROG_CC_C99' "$configure_ac" > /dev
/null
; then
6024 position_early_after
=AC_PROG_CC_C99
6026 position_early_after
=AC_PROG_CC
6029 echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after $position_early_after,"
6030 echo " - invoke ${macro_prefix}_INIT in $configure_ac."
6033 # func_create_testdir testdir modules
6035 # - local_gnulib_path from --local-dir
6036 # - modcache true or false, from --cache-modules/--no-cache-modules
6037 # - auxdir directory relative to destdir where to place build aux files
6038 # - inctests true if tests should be included, false otherwise
6039 # - incobsolete true if obsolete modules among dependencies should be
6040 # included, blank otherwise
6041 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
6043 # - excl_longrunning_tests true if long-runnings tests should be excluded,
6045 # - excl_privileged_tests true if tests that require root privileges should be
6046 # excluded, blank otherwise
6047 # - excl_unportable_tests true if tests that fail on some platforms should be
6048 # excluded, blank otherwise
6049 # - single_configure true if a single configure file should be generated,
6050 # false for a separate configure file for the tests
6051 # - avoidlist list of modules to avoid
6052 # - cond_dependencies true if --conditional-dependencies was given, false if
6053 # --no-conditional-dependencies was given, blank otherwise
6054 # - libtool true if --libtool was given, false if --no-libtool was
6055 # given, blank otherwise
6056 # - copymode copy mode for files in general
6057 # - lcopymode copy mode for files from local_gnulib_path
6058 func_create_testdir
()
6062 if test -z "$modules"; then
6063 # All modules together.
6064 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
6065 # Except non-recursive-gnulib-prefix-hack, which represents a nonstandard
6066 # way of using Automake.
6067 # Except timevar, which lacks the required file timevar.def.
6068 # Except ftruncate, mountlist, which abort the configuration on mingw. FIXME.
6069 # Except lib-ignore, which leads to link errors when Sun C++ is used. FIXME.
6070 modules
=`func_all_modules`
6071 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`
6073 specified_modules
="$modules"
6075 # Canonicalize the list of specified modules.
6076 specified_modules
=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
6078 # Test modules which invoke AC_CONFIG_FILES cannot be used with
6079 # --with-tests --single-configure. Avoid them.
6080 if $inctests && $single_configure; then
6081 avoidlist
="$avoidlist havelib-tests"
6084 # Unlike in func_import, here we want to include all kinds of tests for the
6085 # directly specified modules, but not for dependencies.
6086 inc_all_direct_tests
=true
6087 inc_all_indirect_tests
="$inc_all_tests"
6089 # Check that the license of every module is consistent with the license of
6091 saved_inctests
="$inctests"
6092 # When computing transitive closures, don't consider $module to depend on
6093 # $module-tests. Need this because tests are implicitly GPL and may depend
6094 # on GPL modules - therefore we don't want a warning in this case.
6096 for requested_module
in $specified_modules; do
6097 requested_license
=`func_get_license "$requested_module"`
6098 if test "$requested_license" != GPL
; then
6099 # Here we use func_modules_transitive_closure, not just
6100 # func_get_dependencies, so that we also detect weird situations like
6101 # an LGPL module which depends on a GPLed build tool module which depends
6103 modules
="$requested_module"
6104 func_modules_transitive_closure
6105 for module
in $modules; do
6106 license
=`func_get_license "$module"`
6108 'GPLed build tool') ;;
6109 'public domain' |
'unlimited' |
'unmodifiable license text') ;;
6111 case "$requested_license" in
6114 LGPLv2
+ |
'LGPLv3+ or GPLv2' | LGPLv3
+ | LGPL | GPLv2
+ | GPLv3
+ | GPL
) ;;
6115 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6120 LGPLv2
+ |
'LGPLv3+ or GPLv2' | GPLv2
+) ;;
6121 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6126 LGPLv2
+ |
'LGPLv3+ or GPLv2' | LGPLv3
+ | LGPL
) ;;
6127 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6132 LGPLv2
+ |
'LGPLv3+ or GPLv2') ;;
6133 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6139 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6148 inctests
="$saved_inctests"
6150 # Subdirectory names.
6161 # Determine final module list.
6162 modules
="$specified_modules"
6163 func_modules_transitive_closure
6164 if test $verbose -ge 0; then
6165 func_show_module_list
6167 final_modules
="$modules"
6169 if $single_configure; then
6170 # Determine main module list and tests-related module list separately.
6171 func_modules_transitive_closure_separately
6174 if $single_configure; then
6175 # Determine whether a $testsbase/libtests.a is needed.
6176 func_determine_use_libtests
6179 # Add the dummy module if needed.
6180 if $single_configure; then
6181 func_modules_add_dummy_separately
6183 func_modules_add_dummy
6187 # If $single_configure, we use the module lists $main_modules and
6188 # $testsrelated_modules; $modules is merely a temporary variable.
6189 # Whereas if ! $configure, the module list is $modules.
6191 # Show banner notice of every module.
6192 if $single_configure; then
6193 modules
="$main_modules"
6199 # Determine final file list.
6200 if $single_configure; then
6201 func_modules_to_filelist_separately
6203 func_modules_to_filelist
6204 if test $verbose -ge 0; then
6206 echo "$files" |
sed -e 's/^/ /'
6209 # Add files for which the copy in gnulib is newer than the one that
6210 # "automake --add-missing --copy" would provide.
6211 files
="$files build-aux/config.guess"
6212 files
="$files build-aux/config.sub"
6213 files
=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
6215 rewritten
='%REWRITTEN%'
6216 sed_rewrite_files
="\
6217 s,^build-aux/,$rewritten$auxdir/,
6218 s,^doc/,$rewritten$docbase/,
6219 s,^lib/,$rewritten$sourcebase/,
6220 s,^m4/,$rewritten$m4base/,
6221 s,^tests/,$rewritten$testsbase/,
6222 s,^tests=lib/,$rewritten$testsbase/,
6226 # Create directories.
6227 for f
in $files; do echo $f; done \
6228 |
sed -e "$sed_rewrite_files" \
6229 |
sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
6230 | LC_ALL
=C
sort -u \
6232 { # Rearrange file descriptors. Needed because "while ... done < ..."
6233 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
6234 exec 5<&0 < "$tmp"/dirs
6236 mkdir
-p "$testdir/$d"
6241 # Copy files or make symbolic links or hard links.
6243 for f
in $files; do echo $f; done \
6244 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_files" \
6247 { # Rearrange file descriptors. Needed because "while ... done < ..."
6248 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
6249 exec 5<&0 < "$tmp"/files
6252 tests
=lib
/*) f
=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
6254 func_lookup_file
"$f"
6255 if test -n "$lookedup_tmp"; then
6256 cp -p "$lookedup_file" "$testdir/$g"
6259 if test "$copyaction" = symlink
; then
6260 func_symlink
"$lookedup_file" "$testdir/$g"
6262 if test "$copyaction" = hardlink
; then
6263 func_hardlink
"$lookedup_file" "$testdir/$g"
6265 cp -p "$lookedup_file" "$testdir/$g"
6273 # Determine include_guard_prefix.
6274 func_compute_include_guard_prefix
6276 # Create Makefile.ams that are for testing.
6279 # No special edits are needed.
6282 # Create $sourcebase/Makefile.am.
6283 mkdir
-p "$testdir/$sourcebase"
6284 destfile
="$sourcebase/Makefile.am"
6285 if $single_configure; then
6286 modules
="$main_modules"
6288 func_emit_lib_Makefile_am
> "$testdir/$sourcebase/Makefile.am"
6289 any_uses_subdirs
="$uses_subdirs"
6291 # Create $m4base/Makefile.am.
6292 mkdir
-p "$testdir/$m4base"
6293 (echo "## Process this file with automake to produce Makefile.in."
6299 echo "EXTRA_DIST += "`echo "$f" | sed -e 's,^m4/,,'` ;;
6302 ) > "$testdir/$m4base/Makefile.am"
6304 subdirs
="$sourcebase $m4base"
6305 subdirs_with_configure_ac
=""
6307 if false
&& test -f "$testdir"/$m4base/gettext.
m4; then
6308 # Avoid stupid error message from automake:
6309 # "AM_GNU_GETTEXT used but `po' not in SUBDIRS"
6310 mkdir
-p "$testdir/po"
6311 (echo "## Process this file with automake to produce Makefile.in."
6312 ) > "$testdir/po/Makefile.am"
6313 func_append subdirs
" po"
6317 test -d "$testdir/$testsbase" || mkdir
"$testdir/$testsbase"
6318 if $single_configure; then
6319 # Create $testsbase/Makefile.am.
6320 destfile
="$testsbase/Makefile.am"
6321 modules
="$testsrelated_modules"
6322 func_emit_tests_Makefile_am
"${macro_prefix}tests_WITNESS" > "$testdir/$testsbase/Makefile.am"
6324 # Viewed from the $testsbase subdirectory, $auxdir is different.
6325 saved_auxdir
="$auxdir"
6326 auxdir
=`echo "$testsbase/" | sed -e 's%[^/][^/]*//*%../%g'`"$auxdir"
6327 # Create $testsbase/Makefile.am.
6329 destfile
="$testsbase/Makefile.am"
6330 func_emit_tests_Makefile_am
"" > "$testdir/$testsbase/Makefile.am"
6331 any_uses_subdirs
="$any_uses_subdirs$uses_subdirs"
6332 # Create $testsbase/configure.ac.
6333 (echo "# Process this file with autoconf to produce a configure script."
6334 echo "AC_INIT([dummy], [0])"
6335 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6336 echo "AM_INIT_AUTOMAKE"
6338 echo "AC_CONFIG_HEADERS([config.h])"
6341 echo "AC_PROG_INSTALL"
6342 echo "AC_PROG_MAKE_SET"
6344 func_emit_pre_early_macros false
'' "$modules"
6346 if test -n "$uses_subdirs"; then
6347 echo "AM_PROG_CC_C_O"
6350 for module
in $modules; do
6352 if test -n "$module"; then
6354 gnumakefile | maintainer-makefile
)
6355 # These modules are meant to be used only in the top-level directory.
6358 func_get_autoconf_early_snippet
"$module"
6363 |
sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
6364 if test "$libtool" = true
; then
6365 echo "LT_INIT([win32-dll])"
6366 echo "LT_LANG([C++])"
6367 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
6368 echo "gl_cond_libtool=true"
6370 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
6371 echo "gl_cond_libtool=false"
6373 echo "gl_ltlibdeps="
6375 # Wrap the set of autoconf snippets into an autoconf macro that is then
6376 # invoked. This is needed because autoconf does not support AC_REQUIRE
6378 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
6379 # but we want the AC_REQUIRE to have its normal meaning (provide one
6380 # expansion of the required macro before the current point, and only one
6382 echo "AC_DEFUN([gl_INIT], ["
6383 sed_replace_build_aux
='
6385 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
6386 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
6389 echo "gl_m4_base='../$m4base'"
6390 func_emit_initmacro_start
$macro_prefix
6391 # We don't have explicit ordering constraints between the various
6392 # autoconf snippets. It's cleanest to put those of the library before
6393 # those of the tests.
6394 echo "gl_source_base='../$sourcebase'"
6395 func_emit_autoconf_snippets
"$modules" "$modules" func_verify_nontests_module false false false
6396 echo "gl_source_base='.'"
6397 func_emit_autoconf_snippets
"$modules" "$modules" func_verify_tests_module false false false
6398 func_emit_initmacro_end
$macro_prefix
6399 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
6400 # created using libtool, because libtool already handles the dependencies.
6401 if test "$libtool" != true
; then
6402 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
6403 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
6404 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
6405 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
6406 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
6409 func_emit_initmacro_done
$macro_prefix $sourcebase # FIXME use $sourcebase or $testsbase?
6413 # Usually $testsbase/config.h will be a superset of config.h. Verify this
6414 # by "merging" config.h into $testsbase/config.h; look out for gcc warnings.
6415 echo "AH_TOP([#include \"../config.h\"])"
6417 echo "AC_CONFIG_FILES([Makefile])"
6419 ) > "$testdir/$testsbase/configure.ac"
6420 auxdir
="$saved_auxdir"
6421 subdirs_with_configure_ac
="$subdirs_with_configure_ac $testsbase"
6423 func_append subdirs
" $testsbase"
6426 # Create Makefile.am.
6427 (echo "## Process this file with automake to produce Makefile.in."
6429 echo "AUTOMAKE_OPTIONS = 1.11 foreign"
6431 echo "SUBDIRS = $subdirs"
6433 echo "ACLOCAL_AMFLAGS = -I $m4base"
6434 ) > "$testdir/Makefile.am"
6436 # Create configure.ac.
6437 (echo "# Process this file with autoconf to produce a configure script."
6438 echo "AC_INIT([dummy], [0])"
6439 if test "$auxdir" != "."; then
6440 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6442 echo "AM_INIT_AUTOMAKE"
6444 echo "AC_CONFIG_HEADERS([config.h])"
6447 echo "AC_PROG_INSTALL"
6448 echo "AC_PROG_MAKE_SET"
6450 echo "# For autobuild."
6451 echo "AC_CANONICAL_BUILD"
6452 echo "AC_CANONICAL_HOST"
6454 echo "m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
6455 echo "m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
6456 echo "m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
6457 echo "m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
6459 func_emit_pre_early_macros false
'' "$final_modules"
6461 if test -n "$any_uses_subdirs"; then
6462 echo "AM_PROG_CC_C_O"
6465 for module
in $final_modules; do
6466 if $single_configure; then
6469 func_verify_nontests_module
6471 if test -n "$module"; then
6472 func_get_autoconf_early_snippet
"$module"
6475 |
sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
6476 if test "$libtool" = true
; then
6477 echo "LT_INIT([win32-dll])"
6478 echo "LT_LANG([C++])"
6479 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
6480 echo "gl_cond_libtool=true"
6482 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
6483 echo "gl_cond_libtool=false"
6485 echo "gl_ltlibdeps="
6487 # Wrap the set of autoconf snippets into an autoconf macro that is then
6488 # invoked. This is needed because autoconf does not support AC_REQUIRE
6490 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
6491 # but we want the AC_REQUIRE to have its normal meaning (provide one
6492 # expansion of the required macro before the current point, and only one
6494 echo "AC_DEFUN([gl_INIT], ["
6495 if test "$auxdir" != "build-aux"; then
6496 sed_replace_build_aux
='
6498 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
6499 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
6503 sed_replace_build_aux
="$sed_noop"
6505 echo "gl_m4_base='$m4base'"
6506 func_emit_initmacro_start
$macro_prefix
6507 echo "gl_source_base='$sourcebase'"
6508 if $single_configure; then
6509 func_emit_autoconf_snippets
"$main_modules" "$main_modules" func_verify_module true false false
6511 func_emit_autoconf_snippets
"$modules" "$modules" func_verify_nontests_module true false false
6513 func_emit_initmacro_end
$macro_prefix
6514 if $single_configure; then
6515 echo " gltests_libdeps="
6516 echo " gltests_ltlibdeps="
6517 func_emit_initmacro_start
${macro_prefix}tests
6518 echo " gl_source_base='$testsbase'"
6519 # Define a tests witness macro.
6520 echo " ${macro_prefix}tests_WITNESS=IN_GNULIB_TESTS"
6521 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
6522 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
6523 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
6524 func_emit_autoconf_snippets
"$testsrelated_modules" "$main_modules $testsrelated_modules" func_verify_module true false false
6525 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
6526 func_emit_initmacro_end
${macro_prefix}tests
6528 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
6529 # created using libtool, because libtool already handles the dependencies.
6530 if test "$libtool" != true
; then
6531 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
6532 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
6533 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
6534 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
6535 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
6537 if $single_configure; then
6538 if $use_libtests; then
6539 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
6540 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
6544 func_emit_initmacro_done
$macro_prefix $sourcebase
6545 if $single_configure; then
6546 func_emit_initmacro_done
${macro_prefix}tests
$testsbase
6551 if test -n "$subdirs_with_configure_ac"; then
6552 echo "AC_CONFIG_SUBDIRS(["`echo $subdirs_with_configure_ac`"])"
6554 makefiles
="Makefile"
6555 for d
in $subdirs; do
6556 # For subdirs that have a configure.ac by their own, it's the subdir's
6557 # configure.ac which creates the subdir's Makefile.am, not this one.
6558 case " $subdirs_with_configure_ac " in
6560 *) func_append makefiles
" $d/Makefile" ;;
6563 echo "AC_CONFIG_FILES([$makefiles])"
6565 ) > "$testdir/configure.ac"
6567 # Create autogenerated files.
6569 # Do not use "${AUTORECONF} --force --install", because it may invoke
6570 # autopoint, which brings in older versions of some of our .m4 files.
6571 if test -f $m4base/gettext.
m4; then
6572 func_execute_command
${AUTOPOINT} --force || func_exit
1
6573 for f
in $m4base/*.
m4~
; do
6575 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit
1
6579 if test "$libtool" = true
; then
6580 func_execute_command
${LIBTOOLIZE} --copy || func_exit
1
6582 func_execute_command
${ACLOCAL} -I $m4base || func_exit
1
6583 if ! test -d build-aux
; then
6584 func_execute_command mkdir build-aux || func_exit
1
6586 func_execute_command
${AUTOCONF} || func_exit
1
6587 # Explicit 'touch config.h.in': see <https://savannah.gnu.org/support/index.php?109406>.
6588 func_execute_command
${AUTOHEADER} &&
6589 func_execute_command
touch config.h.
in ||
6591 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6592 rm -rf autom4te.cache
6594 if $inctests && ! $single_configure; then
6595 # Create autogenerated files.
6596 (cd "$testdir/$testsbase" || func_exit
1
6597 # Do not use "${AUTORECONF} --force --install", because it may invoke
6598 # autopoint, which brings in older versions of some of our .m4 files.
6599 if test -f ..
/$m4base/gettext.
m4; then
6600 func_execute_command
${AUTOPOINT} --force || func_exit
1
6601 for f
in ..
/$m4base/*.
m4~
; do
6603 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit
1
6607 func_execute_command
${ACLOCAL} -I ..
/$m4base || func_exit
1
6608 if ! test -d ..
/build-aux
; then
6609 func_execute_command mkdir ..
/build-aux
6611 func_execute_command
${AUTOCONF} || func_exit
1
6612 # Explicit 'touch config.h.in': see <https://savannah.gnu.org/support/index.php?109406>.
6613 func_execute_command
${AUTOHEADER} &&
6614 func_execute_command
touch config.h.
in ||
6616 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6617 rm -rf autom4te.cache
6620 # Need to run configure and make once, to create built files that are to be
6621 # distributed (such as parse-datetime.c).
6622 sed_remove_make_variables
='s,[$]([A-Za-z0-9_]*),,g'
6623 # Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...".
6624 cleaned_files
=`combine_lines < "$testdir/$sourcebase/Makefile.am" \
6625 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
6626 cleaned_files
=`for file in $cleaned_files; do echo " $file "; done`
6627 # Extract the value of "BUILT_SOURCES += ...". Remove variable references
6628 # such $(FOO_H) because they don't refer to distributed files.
6629 built_sources
=`combine_lines < "$testdir/$sourcebase/Makefile.am" \
6630 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
6631 | sed -e "$sed_remove_make_variables"`
6632 distributed_built_sources
=`for file in $built_sources; do
6633 case "$cleaned_files" in
6638 tests_distributed_built_sources
=
6640 # Likewise for built files in the $testsbase directory.
6641 tests_cleaned_files
=`combine_lines < "$testdir/$testsbase/Makefile.am" \
6642 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
6643 tests_cleaned_files
=`for file in $tests_cleaned_files; do echo " $file "; done`
6644 tests_built_sources
=`combine_lines < "$testdir/$testsbase/Makefile.am" \
6645 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
6646 | sed -e "$sed_remove_make_variables"`
6647 tests_distributed_built_sources
=`for file in $tests_built_sources; do
6648 case "$tests_cleaned_files" in
6654 if test -n "$distributed_built_sources" ||
test -n "$tests_distributed_built_sources"; then
6656 .
/configure || func_exit
1
6657 if test -n "$distributed_built_sources"; then
6659 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
6660 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6665 if test -n "$tests_distributed_built_sources"; then
6667 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
6668 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6673 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6679 if test -f build-aux
/test-driver
; then
6680 patch build-aux
/test-driver
< "$gnulib_dir"/build-aux
/test-driver.
diff || func_exit
1
6685 # func_create_megatestdir megatestdir allmodules
6687 # - local_gnulib_path from --local-dir
6688 # - modcache true or false, from --cache-modules/--no-cache-modules
6689 # - auxdir directory relative to destdir where to place build aux files
6690 func_create_megatestdir
()
6694 if test -z "$allmodules"; then
6695 allmodules
=`func_all_modules`
6699 # First, all modules one by one.
6700 for onemodule
in $allmodules; do
6701 func_create_testdir
"$megatestdir/$onemodule" $onemodule
6702 func_append megasubdirs
"$onemodule "
6704 # Then, all modules all together.
6705 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
6706 allmodules
=`for m in $allmodules; do if test $m != config-h; then echo $m; fi; done`
6707 func_create_testdir
"$megatestdir/ALL" "$allmodules"
6708 func_append megasubdirs
"ALL"
6711 cvsdate
=`vc_witness="$gnulib_dir/.git/refs/heads/master"; \
6712 sh "$gnulib_dir/build-aux/mdate-sh" "$vc_witness" \
6713 | sed -e 's,January,01,' -e 's,Jan,01,' \
6714 -e 's,February,02,' -e 's,Feb,02,' \
6715 -e 's,March,03,' -e 's,Mar,03,' \
6716 -e 's,April,04,' -e 's,Apr,04,' \
6718 -e 's,June,06,' -e 's,Jun,06,' \
6719 -e 's,July,07,' -e 's,Jul,07,' \
6720 -e 's,August,08,' -e 's,Aug,08,' \
6721 -e 's,September,09,' -e 's,Sep,09,' \
6722 -e 's,October,10,' -e 's,Oct,10,' \
6723 -e 's,November,11,' -e 's,Nov,11,' \
6724 -e 's,December,12,' -e 's,Dec,12,' \
6725 -e 's,^,00,' -e 's,^[0-9]*\([0-9][0-9] \),\1,' \
6726 -e 's,^\([0-9]*\) \([0-9]*\) \([0-9]*\),\3\2\1,'`
6728 echo "CVSDATE=$cvsdate"
6729 echo ": \${MAKE=make}"
6730 echo "test -d logs || mkdir logs"
6731 echo "for module in $megasubdirs; do"
6732 echo " echo \"Working on module \$module...\""
6733 echo " safemodule=\`echo \$module | sed -e 's|/|-|g'\`"
6734 echo " (echo \"To: gnulib@autobuild.josefsson.org\""
6737 echo " : autobuild project... \$module"
6738 echo " : autobuild revision... cvs-\$CVSDATE-000000"
6739 echo " : autobuild timestamp... \`date \"+%Y%m%d-%H%M%S\"\`"
6740 echo " : autobuild hostname... \`hostname\`"
6741 echo " cd \$module && ./configure \$CONFIGURE_OPTIONS && \$MAKE && \$MAKE check && \$MAKE distclean"
6743 echo " ) 2>&1 | { if test -n \"\$AUTOBUILD_SUBST\"; then sed -e \"\$AUTOBUILD_SUBST\"; else cat; fi; } > logs/\$safemodule"
6745 ) > "$megatestdir/do-autobuild"
6746 chmod a
+x
"$megatestdir/do-autobuild"
6748 # Create Makefile.am.
6749 (echo "## Process this file with automake to produce Makefile.in."
6751 echo "AUTOMAKE_OPTIONS = 1.11 foreign"
6753 echo "SUBDIRS = $megasubdirs"
6755 echo "EXTRA_DIST = do-autobuild"
6756 ) > "$megatestdir/Makefile.am"
6758 # Create configure.ac.
6759 (echo "# Process this file with autoconf to produce a configure script."
6760 echo "AC_INIT([dummy], [0])"
6761 if test "$auxdir" != "."; then
6762 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6764 echo "AM_INIT_AUTOMAKE"
6766 echo "AC_PROG_MAKE_SET"
6768 echo "AC_CONFIG_SUBDIRS([$megasubdirs])"
6769 echo "AC_CONFIG_FILES([Makefile])"
6771 ) > "$megatestdir/configure.ac"
6773 # Create autogenerated files.
6775 # Do not use "${AUTORECONF} --install", because autoreconf operates
6776 # recursively, but the subdirectories are already finished, therefore
6777 # calling autoreconf here would only waste lots of CPU time.
6778 func_execute_command
${ACLOCAL} || func_exit
1
6779 func_execute_command mkdir build-aux
6780 func_execute_command
${AUTOCONF} || func_exit
1
6781 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6782 rm -rf autom4te.cache
6783 if test -f build-aux
/test-driver
; then
6784 patch build-aux
/test-driver
< "$gnulib_dir"/build-aux
/test-driver.
diff || func_exit
1
6791 func_fatal_error
"no mode specified" ;;
6798 # sed expression that converts a literal to a basic regular expression.
6799 # Needs to handle . [ \ * ^ $.
6800 sed_literal_to_basic_regex
='s/\\/\\\\/g
6806 if test -f "$gnulib_dir/$filename" \
6807 || func_lookup_local_file
"$filename"; then
6808 filename_anywhere_regex
=`echo "$filename" | sed -e "$sed_literal_to_basic_regex"`
6809 filename_line_regex
='^'"$filename_anywhere_regex"'$'
6812 (cd "$gnulib_dir" && find modules -type f -print | xargs -n 100 grep -l "$filename_line_regex" /dev/null | sed -e 's,^modules/,,')
6813 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$,,'
6815 | func_sanitize_modulelist \
6818 for module
in $module_candidates; do
6819 if func_get_filelist
$module |
grep "$filename_line_regex" > /dev
/null
; then
6824 func_warning
"file $filename does not exist"
6829 import | add-import | remove-import | update
)
6832 if test -z "$destdir"; then
6835 test -d "$destdir" \
6836 || func_fatal_error
"destination directory does not exist: $destdir"
6838 # Prefer configure.ac to configure.in.
6839 if test -f "$destdir"/configure.ac
; then
6840 configure_ac
="$destdir/configure.ac"
6842 if test -f "$destdir"/configure.
in; then
6843 configure_ac
="$destdir/configure.in"
6845 func_fatal_error
"cannot find $destdir/configure.ac - make sure you run gnulib-tool from within your package's directory"
6849 # Analyze configure.ac.
6851 guessed_libtool
=false
6856 /AC_CONFIG_AUX_DIR/ {
6857 s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^]"$`\\)]*\).*$,guessed_auxdir="\1",p
6859 /A[CM]_PROG_LIBTOOL/ {
6860 s,^.*$,guessed_libtool=true,p
6862 eval `sed -n -e "$my_sed_traces" < "$configure_ac"`
6864 if test -z "$auxdir"; then
6865 auxdir
="$guessed_auxdir"
6868 # Determine where to apply func_import.
6869 if test "$mode" = import
; then
6870 # Apply func_import to a particular gnulib directory.
6871 # The command line contains the complete specification; don't look at
6872 # the contents of gnulib-cache.m4.
6873 test -n "$supplied_libname" || supplied_libname
=true
6874 test -n "$sourcebase" || sourcebase
="lib"
6875 test -n "$m4base" || m4base
="m4"
6876 test -n "$docbase" || docbase
="doc"
6877 test -n "$testsbase" || testsbase
="tests"
6878 test -n "$macro_prefix" || macro_prefix
="gl"
6881 if test -n "$m4base"; then
6882 # Apply func_import to a particular gnulib directory.
6883 # Any number of additional modules can be given.
6884 if test ! -f "$destdir/$m4base"/gnulib-cache.
m4; then
6885 # First use of gnulib in the given m4base.
6886 test -n "$supplied_libname" || supplied_libname
=true
6887 test -n "$sourcebase" || sourcebase
="lib"
6888 test -n "$docbase" || docbase
="doc"
6889 test -n "$testsbase" || testsbase
="tests"
6890 test -n "$macro_prefix" || macro_prefix
="gl"
6894 # Apply func_import to all gnulib directories.
6895 # To get this list of directories, look at Makefile.am. (Not at
6896 # configure, because it may be omitted from version control. Also,
6897 # don't run "find $destdir -name gnulib-cache.m4", as it might be
6901 if test -f "$destdir"/Makefile.am
; then
6902 aclocal_amflags
=`sed -n -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/p' "$destdir"/Makefile.am`
6904 for arg
in $aclocal_amflags; do
6905 if test -n "$m4dir_is_next"; then
6906 # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
6910 if test -f "$destdir/$arg"/gnulib-cache.
m4; then
6911 func_append m4dirs
" $arg"
6912 m4dirs_count
=`expr $m4dirs_count + 1`
6918 if test "X$arg" = "X-I"; then
6926 # No Makefile.am! Oh well. Look at the last generated aclocal.m4.
6927 if test -f "$destdir"/aclocal.
m4; then
6928 sedexpr1
='s,^m4_include(\[\(.*\)])$,\1,p'
6929 sedexpr2
='s,^[^/]*$,.,'
6930 sedexpr3
='s,/[^/]*$,,'
6931 m4dirs
=`sed -n -e "$sedexpr1" aclocal.m4 | sed -e "$sedexpr2" -e "$sedexpr3" | LC_ALL=C sort -u`
6932 m4dirs
=`for arg in $m4dirs; do if test -f "$destdir/$arg"/gnulib-cache.m4; then echo $arg; fi; done`
6933 m4dirs_count
=`for arg in $m4dirs; do echo "$arg"; done | wc -l`
6936 if test $m4dirs_count = 0; then
6937 # First use of gnulib in a package.
6938 # Any number of additional modules can be given.
6939 test -n "$supplied_libname" || supplied_libname
=true
6940 test -n "$sourcebase" || sourcebase
="lib"
6942 test -n "$docbase" || docbase
="doc"
6943 test -n "$testsbase" || testsbase
="tests"
6944 test -n "$macro_prefix" || macro_prefix
="gl"
6947 if test $m4dirs_count = 1; then
6948 # There's only one use of gnulib here. Assume the user means it.
6949 # Any number of additional modules can be given.
6950 for m4base
in $m4dirs; do
6954 # Ambiguous - guess what the user meant.
6955 if test $# = 0; then
6956 # No further arguments. Guess the user wants to update all of them.
6957 for m4base
in $m4dirs; do
6958 # Perform func_import in a subshell, so that variable values
6960 # local_gnulib_path, incobsolete, inc_cxx_tests,
6961 # inc_longrunning_tests, inc_privileged_tests,
6962 # inc_unportable_tests, inc_all_tests, avoidlist, sourcebase,
6963 # m4base, pobase, docbase, testsbase, inctests, libname, lgpl,
6964 # makefile_name, libtool, macro_prefix, po_domain,
6965 # witness_c_macro, vc_files
6966 # don't propagate from one directory to another.
6967 (func_import
) || func_exit
1
6971 func_fatal_error
"Ambiguity: to which directory should the modules be added? Please specify at least --m4-base=..."
6980 if test -z "$destdir"; then
6981 func_fatal_error
"please specify --dir option"
6984 test -d "$destdir" \
6985 || func_fatal_error
"could not create destination directory"
6986 test -n "$auxdir" || auxdir
="build-aux"
6987 func_create_testdir
"$destdir" "$*"
6990 create-megatestdir
)
6991 if test -z "$destdir"; then
6992 func_fatal_error
"please specify --dir option"
6994 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
6995 test -n "$auxdir" || auxdir
="build-aux"
6996 func_create_megatestdir
"$destdir" "$*"
7000 test -n "$destdir" || destdir
=testdir$$
7001 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
7002 test -n "$auxdir" || auxdir
="build-aux"
7003 func_create_testdir
"$destdir" "$*"
7007 ..
/configure || func_exit
1
7008 $MAKE || func_exit
1
7009 $MAKE check || func_exit
1
7010 $MAKE distclean || func_exit
1
7011 remaining
=`find . -type f -print`
7012 if test -n "$remaining"; then
7013 echo "Remaining files:" $remaining 1>&2
7014 echo "gnulib-tool: *** Stop." 1>&2
7023 test -n "$destdir" || destdir
=testdir$$
7024 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
7025 test -n "$auxdir" || auxdir
="build-aux"
7026 func_create_megatestdir
"$destdir" "$*"
7034 remaining
=`find . -type f -print`
7035 if test -n "$remaining"; then
7036 echo "Remaining files:" $remaining 1>&2
7037 echo "gnulib-tool: *** Stop." 1>&2
7045 extract-description
)
7049 if test -n "$module"; then
7050 func_get_description
"$module"
7059 if test -n "$module"; then
7060 func_get_comment
"$module"
7069 if test -n "$module"; then
7070 func_get_status
"$module"
7079 if test -n "$module"; then
7080 func_get_notice
"$module"
7085 extract-applicability
)
7089 if test -n "$module"; then
7090 func_get_applicability
"$module"
7099 if test -n "$module"; then
7100 func_get_filelist
"$module"
7105 extract-dependencies
)
7106 if test -n "$avoidlist"; then
7107 func_fatal_error
"cannot combine --avoid and --extract-dependencies"
7112 if test -n "$module"; then
7113 func_get_dependencies
"$module"
7118 extract-recursive-dependencies
)
7119 if test -n "$avoidlist"; then
7120 func_fatal_error
"cannot combine --avoid and --extract-recursive-dependencies"
7125 if test -n "$module"; then
7126 func_get_dependencies_recursively
"$module"
7131 extract-autoconf-snippet
)
7135 if test -n "$module"; then
7136 func_get_autoconf_snippet
"$module"
7141 extract-automake-snippet
)
7145 if test -n "$module"; then
7146 func_get_automake_snippet
"$module"
7151 extract-include-directive
)
7155 if test -n "$module"; then
7156 func_get_include_directive
"$module"
7161 extract-link-directive
)
7165 if test -n "$module"; then
7166 func_get_link_directive
"$module"
7171 extract-recursive-link-directive
)
7172 if test -n "$avoidlist"; then
7173 func_fatal_error
"cannot combine --avoid and --extract-recursive-link-directive"
7178 if test -n "$module"; then
7179 func_get_link_directive_recursively
"$module"
7188 if test -n "$module"; then
7189 func_get_license
"$module"
7194 extract-maintainer
)
7198 if test -n "$module"; then
7199 func_get_maintainer
"$module"
7204 extract-tests-module
)
7208 if test -n "$module"; then
7209 func_get_tests_module
"$module"
7215 # Verify the number of arguments.
7216 if test $# -lt 1 ||
test $# -gt 2; then
7217 func_fatal_error
"invalid number of arguments for --$mode"
7220 # The first argument is the file to be copied.
7222 # Verify the file exists.
7223 func_lookup_file
"$f"
7225 # The second argument is the destination; either a directory ot a file.
7226 # It defaults to the current directory.
7228 test -n "$dest" || dest
='.'
7229 test -n "$sourcebase" || sourcebase
="lib"
7230 test -n "$m4base" || m4base
="m4"
7231 test -n "$docbase" || docbase
="doc"
7232 test -n "$testsbase" || testsbase
="tests"
7233 test -n "$auxdir" || auxdir
="build-aux"
7234 rewritten
='%REWRITTEN%'
7235 sed_rewrite_files
="\
7236 s,^build-aux/,$rewritten$auxdir/,
7237 s,^doc/,$rewritten$docbase/,
7238 s,^lib/,$rewritten$sourcebase/,
7239 s,^m4/,$rewritten$m4base/,
7240 s,^tests/,$rewritten$testsbase/,
7243 if test -d "$dest"; then
7245 g
=`echo "$f" | sed -e "$sed_rewrite_files"`
7247 destdir
=`dirname "$dest"`
7248 g
=`basename "$dest"`
7251 # Create the directory for destfile.
7252 d
=`dirname "$destdir/$g"`
7254 if test -n "$d" && test ! -d "$d"; then
7255 mkdir
-p "$d" || func_fatal_error
"failed"
7259 func_dest_tmpfilename
"$g"
7260 cp "$lookedup_file" "$tmpfile" || func_fatal_error
"failed"
7261 already_present
=true
7262 if test -f "$destdir/$g"; then
7263 # The file already exists.
7267 # Don't protest if the file should be there but isn't: it happens
7268 # frequently that developers don't put autogenerated files under version
7276 func_fatal_error
"unknown operation mode --$mode" ;;
7279 if test "$copymode" = hardlink
-o "$lcopymode" = hardlink
; then
7280 # Setting hard links modifies the ctime of files in the gnulib checkout.
7281 # This disturbs the result of the next "gitk" invocation.
7282 # Workaround: Let git scan the files. This can be done through
7283 # "git update-index --refresh" or "git status" or "git diff".
7284 if test -d "$gnulib_dir"/.git \
7285 && (git
--version) >/dev
/null
2>/dev
/null
; then
7286 (cd "$gnulib_dir" && git update-index
--refresh >/dev
/null
)
7291 # Undo the effect of the previous 'trap' command. Some shellology:
7292 # We cannot use "trap - 0 1 2 3 13 15", because Solaris sh would attempt to
7293 # execute the command "-". "trap '' ..." is fine only for signal 0 (= normal
7294 # exit); for the others we need to call 'exit' explicitly. The value of $? is
7295 # 128 + signal number and is set before the trap-registered command is run.
7297 trap 'func_exit $?' 1 2 3 13 15
7302 # indent-tabs-mode: nil
7303 # whitespace-check-buffer-indent: nil