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.
22 # CODING STYLE for this file:
23 # * Indentation: Indent by 2 spaces. Indent case clauses by 2 spaces as well.
24 # * Shell variable references: Use double-quote around shell variable
25 # references always (except when word splitting is explicitly desired),
26 # even when you know the double-quote are not needed. This style tends to
27 # avoid undesired word splitting caused by omitted double-quotes (the
28 # number one mistake in shell scripts).
29 # When the referenced variable can only have a finite number of possible
30 # values and these values are all simple words (e.g. true and false), it's
31 # OK to omit the double-quotes.
33 # - Use backquotes like in `command`, not $(command).
34 # - Don't use `command` inside double-quotes. Instead assign the result of
35 # `command` to a variable, and use the value of the variable afterwards.
37 # - All functions that don't emulate a program or shell built-in have a name
38 # that starts with 'func_'.
39 # - Document the implicit and explicit arguments of all functions, as well
40 # as their output variables and side effects.
41 # * Use test condition instead of [ condition ].
42 # * Minimize the use of eval; when you need it, make sure the string to be
43 # evaluated has a very simple syntactic structure.
51 # You can set AUTOCONFPATH to empty if autoconf 2.63 is already in your PATH.
55 # AUTOCONFBINDIR=/arch/x86-linux/gnu-inst-autoconf/2.63/bin
56 # AUTOCONFPATH="eval env PATH=${AUTOCONFBINDIR}:\$PATH "
60 # You can set AUTOMAKEPATH to empty if automake 1.11 is already in your PATH.
63 # You can set GETTEXTPATH to empty if autopoint 0.15 is already in your PATH.
66 # You can set LIBTOOLPATH to empty if libtoolize 2.x is already in your PATH.
69 # If you didn't set AUTOCONFPATH and AUTOMAKEPATH, you can also set the
70 # variables AUTOCONF, AUTOHEADER, ACLOCAL, AUTOMAKE, AUTORECONF individually.
71 if test -z "${AUTOCONF}" ||
test -n "${AUTOCONFPATH}"; then
72 AUTOCONF
="${AUTOCONFPATH}autoconf"
74 if test -z "${AUTOHEADER}" ||
test -n "${AUTOCONFPATH}"; then
75 AUTOHEADER
="${AUTOCONFPATH}autoheader"
77 if test -z "${ACLOCAL}" ||
test -n "${AUTOMAKEPATH}"; then
78 ACLOCAL
="${AUTOMAKEPATH}aclocal"
80 if test -z "${AUTOMAKE}" ||
test -n "${AUTOMAKEPATH}"; then
81 AUTOMAKE
="${AUTOMAKEPATH}automake"
83 if test -z "${AUTORECONF}" ||
test -n "${AUTOCONFPATH}"; then
84 AUTORECONF
="${AUTOCONFPATH}autoreconf"
87 # If you didn't set GETTEXTPATH, you can also set the variable AUTOPOINT.
88 if test -z "${AUTOPOINT}" ||
test -n "${GETTEXTPATH}"; then
89 AUTOPOINT
="${GETTEXTPATH}autopoint"
92 # If you didn't set LIBTOOLPATH, you can also set the variable LIBTOOLIZE.
93 if test -z "${LIBTOOLIZE}" ||
test -n "${LIBTOOLPATH}"; then
94 LIBTOOLIZE
="${LIBTOOLPATH}libtoolize"
98 if test -z "${MAKE}"; then
102 # When using GNU sed, turn off as many GNU extensions as possible,
103 # to minimize the risk of accidentally using non-portable features.
104 # However, do this only for gnulib-tool itself, not for the code that
105 # gnulib-tool generates, since we don't want "sed --posix" to leak
106 # into makefiles. And do it only for sed versions 4.2 or newer,
107 # because "sed --posix" is buggy in GNU sed 4.1.5, see
108 # <https://lists.gnu.org/r/bug-gnulib/2009-02/msg00225.html>.
109 if (alias) > /dev
/null
2>&1 \
110 && echo |
sed --posix -e d
>/dev
/null
2>&1 \
111 && case `sed --version | sed -e 's/^[^0-9]*//' -e 1q` in \
112 [1-3]* |
4.
[01]*) false
;; \
116 # Define sed as an alias.
117 # It is not always possible to use aliases. Aliases are guaranteed to work
118 # if the executing shell is bash and either it is invoked as /bin/sh or
119 # is a version >= 2.0, supporting shopt. This is the common case.
120 # Two other approaches (use of a variable $sed or of a function func_sed
121 # instead of an alias) require massive, fragile code changes.
122 # An other approach (use of function sed) requires `which sed` - but
123 # 'which' is hard to emulate, due to missing "test -x" on some platforms.
124 if test -n "$BASH_VERSION"; then
125 shopt -s expand_aliases
>/dev
/null
2>&1
127 alias sed='sed --posix'
130 # sed_noop is a sed expression that does nothing.
131 # An empty expression does not work with the native 'sed' on AIX 6.1.
134 # sed_comments is true or false, depending whether 'sed' supports comments.
135 # AIX 5.3 sed barfs over indented comments.
136 if echo fo |
sed -e 's/f/g/
139 s/o/e/' 2>/dev
/null |
grep ge
> /dev
/null
; then
146 # outputs to stdout the --help usage message.
150 Usage: gnulib-tool --list
151 gnulib-tool --find filename
152 gnulib-tool --import [module1 ... moduleN]
153 gnulib-tool --add-import [module1 ... moduleN]
154 gnulib-tool --remove-import [module1 ... moduleN]
156 gnulib-tool --create-testdir --dir=directory [module1 ... moduleN]
157 gnulib-tool --create-megatestdir --dir=directory [module1 ... moduleN]
158 gnulib-tool --test --dir=directory module1 ... moduleN
159 gnulib-tool --megatest --dir=directory [module1 ... moduleN]
160 gnulib-tool --extract-description module
161 gnulib-tool --extract-comment module
162 gnulib-tool --extract-status module
163 gnulib-tool --extract-notice module
164 gnulib-tool --extract-applicability module
165 gnulib-tool --extract-filelist module
166 gnulib-tool --extract-dependencies module
167 gnulib-tool --extract-recursive-dependencies module
168 gnulib-tool --extract-autoconf-snippet module
169 gnulib-tool --extract-automake-snippet module
170 gnulib-tool --extract-include-directive module
171 gnulib-tool --extract-link-directive module
172 gnulib-tool --extract-recursive-link-directive module
173 gnulib-tool --extract-license module
174 gnulib-tool --extract-maintainer module
175 gnulib-tool --extract-tests-module module
176 gnulib-tool --copy-file file [destination]
180 --list print the available module names
181 --find find the modules which contain the specified file
182 --import import the given modules into the current package
183 --add-import augment the list of imports from gnulib into the
184 current package, by adding the given modules;
185 if no modules are specified, update the current
186 package from the current gnulib
187 --remove-import reduce the list of imports from gnulib into the
188 current package, by removing the given modules
189 --update update the current package, restore files omitted
191 --create-testdir create a scratch package with the given modules
192 --create-megatestdir create a mega scratch package with the given modules
193 one by one and all together
194 --test test the combination of the given modules
195 (recommended to use CC=\"gcc -Wall\" here)
196 --megatest test the given modules one by one and all together
197 (recommended to use CC=\"gcc -Wall\" here)
198 --extract-description extract the description
199 --extract-comment extract the comment
200 --extract-status extract the status (obsolete etc.)
201 --extract-notice extract the notice or banner
202 --extract-applicability extract the applicability
203 --extract-filelist extract the list of files
204 --extract-dependencies extract the dependencies
205 --extract-recursive-dependencies extract the dependencies of the module
206 and its dependencies, recursively, all
207 together, but without the conditions
208 --extract-autoconf-snippet extract the snippet for configure.ac
209 --extract-automake-snippet extract the snippet for library makefile
210 --extract-include-directive extract the #include directive
211 --extract-link-directive extract the linker directive
212 --extract-recursive-link-directive extract the linker directive of the
213 module and its dependencies,
214 recursively, all together
215 --extract-license report the license terms of the source files
217 --extract-maintainer report the maintainer(s) inside gnulib
218 --extract-tests-module report the unit test module, if it exists
219 --copy-file copy a file that is not part of any module
220 --help Show this help text.
221 --version Show version and authorship information.
225 --dir=DIRECTORY Specify the target directory.
226 For --import, this specifies where your
227 configure.ac can be found. Defaults to current
229 --local-dir=DIRECTORY Specify a local override directory where to look
230 up files before looking in gnulib's directory.
231 --cache-modules Enable module caching optimization.
232 --no-cache-modules Disable module caching optimization.
233 --verbose Increase verbosity. May be repeated.
234 --quiet Decrease verbosity. May be repeated.
236 Options for --import, --add/remove-import, --update:
238 --dry-run Only print what would have been done.
240 Options for --import, --add/remove-import:
242 --with-tests Include unit tests for the included modules.
244 Options for --create-[mega]testdir, --[mega]test:
246 --without-tests Don't include unit tests for the included modules.
248 Options for --import, --add/remove-import,
249 --create-[mega]testdir, --[mega]test:
251 --with-obsolete Include obsolete modules when they occur among the
252 dependencies. By default, dependencies to obsolete
254 --with-c++-tests Include even unit tests for C++ interoperability.
255 --without-c++-tests Exclude unit tests for C++ interoperability.
256 --with-longrunning-tests
257 Include even unit tests that are long-runners.
258 --without-longrunning-tests
259 Exclude unit tests that are long-runners.
260 --with-privileged-tests
261 Include even unit tests that require root
263 --without-privileged-tests
264 Exclude unit tests that require root privileges.
265 --with-unportable-tests
266 Include even unit tests that fail on some platforms.
267 --without-unportable-tests
268 Exclude unit tests that fail on some platforms.
269 --with-all-tests Include all kinds of problematic unit tests.
270 --avoid=MODULE Avoid including the given MODULE. Useful if you
271 have code that provides equivalent functionality.
272 This option can be repeated.
273 --conditional-dependencies
274 Support conditional dependencies (may save configure
275 time and object code).
276 --no-conditional-dependencies
277 Don't use conditional dependencies.
278 --libtool Use libtool rules.
279 --no-libtool Don't use libtool rules.
281 Options for --import, --add/remove-import:
283 --lib=LIBRARY Specify the library name. Defaults to 'libgnu'.
284 --source-base=DIRECTORY
285 Directory relative to --dir where source code is
286 placed (default \"lib\").
287 --m4-base=DIRECTORY Directory relative to --dir where *.m4 macros are
288 placed (default \"m4\").
289 --po-base=DIRECTORY Directory relative to --dir where *.po files are
290 placed (default \"po\").
291 --doc-base=DIRECTORY Directory relative to --dir where doc files are
292 placed (default \"doc\").
293 --tests-base=DIRECTORY
294 Directory relative to --dir where unit tests are
295 placed (default \"tests\").
296 --aux-dir=DIRECTORY Directory relative to --dir where auxiliary build
297 tools are placed (default comes from configure.ac).
298 --gnu-make Output for GNU Make instead of for the default
300 --lgpl[=2|=3orGPLv2|=3]
301 Abort if modules aren't available under the LGPL.
302 Also modify license template from GPL to LGPL.
303 The version number of the LGPL can be specified;
304 the default is currently LGPLv3.
305 --makefile-name=NAME Name of makefile in the source-base and tests-base
306 directories (default \"Makefile.am\", or
307 \"Makefile.in\" if --gnu-make).
308 --macro-prefix=PREFIX Specify the prefix of the macros 'gl_EARLY' and
309 'gl_INIT'. Default is 'gl'.
310 --po-domain=NAME Specify the prefix of the i18n domain. Usually use
311 the package name. A suffix '-gnulib' is appended.
312 --witness-c-macro=NAME Specify the C macro that is defined when the
313 sources in this directory are compiled or used.
314 --vc-files Update version control related files.
315 --no-vc-files Don't update version control related files
316 (.gitignore and/or .cvsignore).
318 Options for --create-[mega]testdir, --[mega]test:
320 --single-configure Generate a single configure file, not a separate
321 configure file for the tests directory.
323 Options for --import, --add/remove-import, --update,
324 --create-[mega]testdir, --[mega]test:
326 -s, --symbolic, --symlink Make symbolic links instead of copying files.
327 --local-symlink Make symbolic links instead of copying files, only
328 for files from the local override directory.
329 -h, --hardlink Make hard links instead of copying files.
330 --local-hardlink Make hard links instead of copying files, only
331 for files from the local override directory.
333 Options for --import, --add/remove-import, --update:
335 -S, --more-symlinks Make symbolic links instead of copying files, and
336 don't replace copyright notices.
337 -H, --more-hardlinks Make hard links instead of copying files, and
338 don't replace copyright notices.
340 Report bugs to <bug-gnulib@gnu.org>."
344 # outputs to stdout the --version message.
348 if test -d "$gnulib_dir"/.git \
349 && (git
--version) >/dev
/null
2>/dev
/null \
350 && (date --version) >/dev
/null
2>/dev
/null
; then
351 # gnulib checked out from git.
352 sed_extract_first_date
='/^Date/{
356 date=`cd "$gnulib_dir" && git log ChangeLog | sed -n -e "$sed_extract_first_date"`
357 # Turn "Fri Mar 21 07:16:51 2008 -0600" into "Mar 21 2008 07:16:51 -0600".
358 sed_year_before_time
='s/^[^ ]* \([^ ]*\) \([0-9]*\) \([0-9:]*\) \([0-9]*\) /\1 \2 \4 \3 /'
359 date=`echo "$date" | sed -e "$sed_year_before_time"`
360 # Use GNU date to compute the time in GMT.
361 date=`date -d "$date" -u +"%Y-%m-%d %H:%M:%S"`
362 version
=' '`cd "$gnulib_dir" && ./build-aux/git-version-gen /dev/null | sed -e 's/-dirty/-modified/'`
364 # gnulib copy without versioning information.
365 date=`sed -e 's/ .*//;q' "$gnulib_dir"/ChangeLog`
368 year
=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed -e 's,^.* ,,'`
370 gnulib-tool (GNU $package $date)$version
371 Copyright (C) $year Free Software Foundation, Inc.
372 License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
373 This is free software: you are free to change and redistribute it.
374 There is NO WARRANTY, to the extent permitted by law.
376 printf "Written by %s, %s, and %s.\n" "Bruno Haible" "Paul Eggert" "Simon Josefsson"
379 # func_emit_copyright_notice
380 # outputs to stdout a header for a generated file.
381 func_emit_copyright_notice
()
383 sed -n -e '/Copyright/ {
386 }' < "$self_abspathname"
388 echo "# This file is free software; you can redistribute it and/or modify"
389 echo "# it under the terms of the GNU General Public License as published by"
390 echo "# the Free Software Foundation; either version 3 of the License, or"
391 echo "# (at your option) any later version."
393 echo "# This file is distributed in the hope that it will be useful,"
394 echo "# but WITHOUT ANY WARRANTY; without even the implied warranty of"
395 echo "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
396 echo "# GNU General Public License for more details."
398 echo "# You should have received a copy of the GNU General Public License"
399 echo "# along with this file. If not, see <https://www.gnu.org/licenses/>."
401 echo "# As a special exception to the GNU General Public License,"
402 echo "# this file may be distributed as part of a program that"
403 echo "# contains a configuration script generated by Autoconf, under"
404 echo "# the same distribution terms as the rest of that program."
406 echo "# Generated by gnulib-tool."
410 # exits with a given status.
411 # This function needs to be used, rather than 'exit', when a 'trap' handler is
412 # in effect that refers to $?.
419 # locates the directory where the gnulib repository lives
421 # - progname name of this program
423 # - self_abspathname absolute pathname of gnulib-tool
424 # - gnulib_dir absolute pathname of gnulib repository
428 /* | ?
:*) self_abspathname
="$progname" ;;
429 */*) self_abspathname
=`pwd`/"$progname" ;;
432 # Iterate through the elements of $PATH.
433 # We use IFS=: instead of
434 # for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'`
435 # because the latter does not work when some PATH element contains spaces.
436 # We use a canonicalized $pathx instead of $PATH, because empty PATH
437 # elements are by definition equivalent to '.', however field splitting
438 # according to IFS=: loses empty fields in many shells:
439 # - /bin/sh on OSF/1 and Solaris loses all empty fields (at the
440 # beginning, at the end, and in the middle),
441 # - /bin/sh on IRIX and /bin/ksh on IRIX and OSF/1 lose empty fields
442 # at the beginning and at the end,
443 # - GNU bash, /bin/sh on AIX and HP-UX, and /bin/ksh on AIX, HP-UX,
444 # Solaris lose empty fields at the end.
445 # The 'case' statement is an optimization, to avoid evaluating the
446 # explicit canonicalization command when $PATH contains no empty fields.
448 if test "$PATH_SEPARATOR" = ";"; then
449 # On Windows, programs are searched in "." before $PATH.
452 # On Unix, we have to convert empty PATH elements to ".".
456 pathx
=`echo ":$PATH:" | sed -e 's/:::*/:.:/g' -e 's/^://' -e 's/:\$//'`
461 IFS
="$PATH_SEPARATOR"
465 if test -x "$d/$progname" && test ! -d "$d/$progname"; then
466 self_abspathname
="$d/$progname"
471 if test -z "$self_abspathname"; then
472 func_fatal_error
"could not locate the gnulib-tool program - how did you invoke it?"
476 while test -h "$self_abspathname"; do
477 # Resolve symbolic link.
478 linkval
=`func_readlink "$self_abspathname"`
479 test -n "$linkval" ||
break
481 /* | ?
:* ) self_abspathname
="$linkval" ;;
482 * ) self_abspathname
=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;;
485 gnulib_dir
=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
489 # creates a temporary directory.
491 # - progname name of this program
493 # - tmp pathname of freshly created temporary directory
496 # Use the environment variable TMPDIR, falling back to /tmp. This allows
497 # users to specify a different temporary directory, for example, if their
498 # /tmp is filled up or too small.
501 # Use the mktemp program if available. If not available, hide the error
503 tmp
=`(umask 077 && mktemp -d "$TMPDIR/glXXXXXX") 2>/dev/null` &&
504 test -n "$tmp" && test -d "$tmp"
507 # Use a simple mkdir command. It is guaranteed to fail if the directory
508 # already exists. $RANDOM is bash specific and expands to empty in shells
509 # other than bash, ksh and zsh. Its use does not increase security;
510 # rather, it minimizes the probability of failure in a very cluttered /tmp
512 tmp
=$TMPDIR/gl$$
-$RANDOM
513 (umask 077 && mkdir
"$tmp")
516 echo "$progname: cannot create a temporary directory in $TMPDIR" >&2
521 # func_append var value
522 # appends the given value to the shell variable var.
523 if ( foo
=bar
; foo
+=baz
&& test "$foo" = barbaz
) >/dev
/null
2>&1; then
524 # Use bash's += operator. It reduces complexity of appending repeatedly to
525 # a single variable from O(n^2) to O(n).
530 fast_func_append
=true
534 eval "$1=\"\$$1\$2\""
536 fast_func_append
=false
539 # func_remove_prefix var prefix
540 # removes the given prefix from the value of the shell variable var.
541 # var should be the name of a shell variable.
542 # Its value should not contain a newline and not start or end with whitespace.
543 # prefix should not contain the characters "$`\{}[]^|.
544 if ( foo
=bar
; eval 'test "${foo#b}" = ar' ) >/dev
/null
2>&1; then
545 func_remove_prefix
()
549 fast_func_remove_prefix
=true
551 func_remove_prefix
()
553 eval "value=\"\$$1\""
557 sed_escape_dots
='s/\([.]\)/\\\1/g'
558 prefix
=`echo "$prefix" | sed -e "$sed_escape_dots"`
561 value
=`echo "$value" | sed -e "s|^${prefix}||"`
562 eval "$1=\"\$value\""
564 fast_func_remove_prefix
=false
567 # Determine whether we should use ':' or ';' as PATH_SEPARATOR.
568 func_determine_path_separator
()
570 if test "${PATH_SEPARATOR+set}" != set; then
571 # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
572 # contains only /bin. Note that ksh looks also at the FPATH variable,
573 # so we have to set that as well for the test.
575 (PATH
='/bin;/bin'; FPATH
=$PATH; sh
-c :) >/dev
/null
2>&1 \
576 && { (PATH
='/bin:/bin'; FPATH
=$PATH; sh
-c :) >/dev
/null
2>&1 \
577 || PATH_SEPARATOR
=';'
582 # func_path_append pathvar directory
583 # appends directory to pathvar, delimiting directories by PATH_SEPARATOR.
586 if eval "test -n \"\$$1\""; then
587 func_append
"$1" "$PATH_SEPARATOR$2"
593 # func_path_foreach_inner
594 # helper for func_path_foreach because we need new 'args' array
596 # - fpf_dir directory from local_gnulib_path
597 # - fpf_cb callback to be run for fpf_dir
598 func_path_foreach_inner
()
620 # func_path_foreach path method args
621 # Execute method for each directory in path. The method will be called
622 # like `method args` while any argument '%dir%' within args will be replaced
623 # with processed directory from path.
631 IFS
="$PATH_SEPARATOR"
632 for fpf_dir
in $fpf_dirs
635 func_path_foreach_inner
"$@" && fpf_rc
=:
641 # func_remove_suffix var suffix
642 # removes the given suffix from the value of the shell variable var.
643 # var should be the name of a shell variable.
644 # Its value should not contain a newline and not start or end with whitespace.
645 # suffix should not contain the characters "$`\{}[]^|.
646 if ( foo
=bar
; eval 'test "${foo%r}" = ba' ) >/dev
/null
2>&1; then
647 func_remove_suffix
()
651 fast_func_remove_suffix
=true
653 func_remove_suffix
()
655 eval "value=\"\$$1\""
659 sed_escape_dots
='s/\([.]\)/\\\1/g'
660 suffix
=`echo "$suffix" | sed -e "$sed_escape_dots"`
663 value
=`echo "$value" | sed -e "s|${suffix}\$||"`
664 eval "$1=\"\$value\""
666 fast_func_remove_suffix
=false
669 # func_fatal_error message
670 # outputs to stderr a fatal error message, and terminates the program.
672 # - progname name of this program
675 echo "$progname: *** $1" 1>&2
676 echo "$progname: *** Stop." 1>&2
680 # func_warning message
681 # Outputs to stderr a warning message,
684 echo "gnulib-tool: warning: $1" 1>&2
687 # func_readlink SYMLINK
688 # outputs the target of the given symlink.
689 if (type readlink
) > /dev
/null
2>&1; then
692 # Use the readlink program from GNU coreutils.
698 # Use two sed invocations. A single sed -n -e 's,^.* -> \(.*\)$,\1,p'
699 # would do the wrong thing if the link target contains " -> ".
700 LC_ALL
=C
ls -l "$1" |
sed -e 's, -> ,#%%#,' |
sed -n -e 's,^.*#%%#\(.*\)$,\1,p'
704 # func_relativize DIR1 DIR2
705 # computes a relative pathname RELDIR such that DIR1/RELDIR = DIR2.
707 # - DIR1 relative pathname, relative to the current directory
708 # - DIR2 relative pathname, relative to the current directory
710 # - reldir relative pathname of DIR2, relative to DIR1
716 sed_first
='s,^\([^/]*\)/.*$,\1,'
717 sed_rest
='s,^[^/]*/*,,'
718 sed_last
='s,^.*/\([^/]*\)$,\1,'
719 sed_butlast
='s,/*[^/]*$,,'
720 while test -n "$dir1"; do
721 first
=`echo "$dir1" | sed -e "$sed_first"`
722 if test "$first" != "."; then
723 if test "$first" = ".."; then
724 dir2
=`echo "$dir0" | sed -e "$sed_last"`/"$dir2"
725 dir0
=`echo "$dir0" | sed -e "$sed_butlast"`
727 first2
=`echo "$dir2" | sed -e "$sed_first"`
728 if test "$first2" = "$first"; then
729 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
733 dir0
="$dir0"/"$first"
736 dir1
=`echo "$dir1" | sed -e "$sed_rest"`
741 # func_relconcat DIR1 DIR2
742 # computes a relative pathname DIR1/DIR2, with obvious simplifications.
744 # - DIR1 relative pathname, relative to the current directory
745 # - DIR2 relative pathname, relative to DIR1
747 # - relconcat DIR1/DIR2, relative to the current directory
752 sed_first
='s,^\([^/]*\)/.*$,\1,'
753 sed_rest
='s,^[^/]*/*,,'
754 sed_last
='s,^.*/\([^/]*\)$,\1,'
755 sed_butlast
='s,/*[^/]*$,,'
757 first
=`echo "$dir2" | sed -e "$sed_first"`
758 if test "$first" = "."; then
759 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
760 if test -z "$dir2"; then
765 last
=`echo "$dir1" | sed -e "$sed_last"`
766 while test "$last" = "."; do
767 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
768 last
=`echo "$dir1" | sed -e "$sed_last"`
770 if test -z "$dir1"; then
774 if test "$first" = ".."; then
775 if test "$last" = ".."; then
776 relconcat
="$dir1/$dir2"
779 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
780 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
781 if test -z "$dir1"; then
785 if test -z "$dir2"; then
790 relconcat
="$dir1/$dir2"
798 # Like ln -s, except use cp -p if ln -s fails.
802 echo "$progname: ln -s failed; falling back on cp -p" >&2
805 /* | ?
:*) # SRC is absolute.
807 *) # SRC is relative to the directory of DEST.
809 */*) cp_src
="${2%/*}/$1" ;;
819 # func_symlink_target SRC DEST
820 # Determines LINK_TARGET such that "ln -s LINK_TARGET DEST" will create a
821 # symbolic link DEST that points to SRC.
823 # - link_target link target, relative to the directory of DEST
824 func_symlink_target
()
829 *) # SRC is relative.
832 link_target
="`pwd`/$1" ;;
833 *) # DEST is relative too.
834 ln_destdir
=`echo "$2" | sed -e 's,[^/]*$,,'`
835 test -n "$ln_destdir" || ln_destdir
="."
836 func_relativize
"$ln_destdir" "$1"
837 link_target
="$reldir"
844 # func_symlink SRC DEST
845 # Like func_ln_s, except that SRC is given relative to the current directory (or
846 # absolute), not given relative to the directory of DEST.
849 func_symlink_target
"$1" "$2"
850 func_ln_s
"$link_target" "$2"
853 # func_symlink_if_changed SRC DEST
854 # Like func_symlink, but avoids munging timestamps if the link is correct.
855 # SRC is given relative to the current directory (or absolute).
856 func_symlink_if_changed
()
858 if test $# -ne 2; then
859 echo "usage: func_symlink_if_changed SRC DEST" >&2
861 func_symlink_target
"$1" "$2"
862 ln_target
=`func_readlink "$2"`
863 if test -h "$2" && test "$link_target" = "$ln_target"; then
867 func_ln_s
"$link_target" "$2"
871 # func_hardlink SRC DEST
872 # Like ln, except use cp -p if ln fails.
873 # SRC is given relative to the current directory (or absolute).
877 echo "$progname: ln failed; falling back on cp -p" >&2
882 # Ensure an 'echo' command that
883 # 1. does not interpret backslashes and
884 # 2. does not print an error message "broken pipe" when writing into a pipe
887 # Test cases for problem 1:
888 # echo '\n' | wc -l prints 1 when OK, 2 when KO
889 # echo '\t' | grep t > /dev/null has return code 0 when OK, 1 when KO
890 # Test cases for problem 2:
891 # echo hi | true frequently prints
892 # "bash: echo: write error: Broken pipe"
893 # to standard error in bash 3.2.
895 # Problem 1 is a weird heritage from SVR4. BSD got it right (except that
896 # BSD echo interprets '-n' as an option, which is also not desirable).
897 # Nowadays the problem occurs in 4 situations:
898 # - in bash, when the shell option xpg_echo is set (bash >= 2.04)
899 # or when it was built with --enable-usg-echo-default (bash >= 2.0)
900 # or when it was built with DEFAULT_ECHO_TO_USG (bash < 2.0),
901 # - in zsh, when sh-emulation is not set,
902 # - in ksh (e.g. AIX /bin/sh and Solaris /usr/xpg4/bin/sh are ksh instances,
903 # and HP-UX /bin/sh and IRIX /bin/sh behave similarly),
904 # - in Solaris /bin/sh and OSF/1 /bin/sh.
905 # We try the following workarounds:
906 # - for all: respawn using $CONFIG_SHELL if that is set and works.
907 # - for bash >= 2.04: unset the shell option xpg_echo.
908 # - for bash >= 2.0: define echo to a function that uses the printf built-in.
909 # - for bash < 2.0: define echo to a function that uses cat of a here document.
910 # - for zsh: turn sh-emulation on.
911 # - for ksh: alias echo to 'print -r'.
912 # - for ksh: alias echo to a function that uses cat of a here document.
913 # - for Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh and rely on
914 # the ksh workaround.
915 # - otherwise: respawn using /bin/sh and rely on the workarounds.
916 # When respawning, we pass --no-reexec as first argument, so as to avoid
917 # turning this script into a fork bomb in unlucky situations.
919 # Problem 2 is specific to bash 3.2 and affects the 'echo' built-in, but not
920 # the 'printf' built-in. See
921 # <https://lists.gnu.org/r/bug-bash/2008-12/msg00050.html>
922 # <https://lists.gnu.org/r/bug-gnulib/2010-02/msg00154.html>
923 # The workaround is: define echo to a function that uses the printf built-in.
925 if echo '\t' |
grep t
> /dev
/null
; then
926 have_echo
=yes # Lucky!
928 # Try the workarounds.
929 # Respawn using $CONFIG_SHELL if that is set and works.
930 if test -z "$have_echo" \
931 && test "X$1" != "X--no-reexec" \
932 && test -n "$CONFIG_SHELL" \
933 && test -f "$CONFIG_SHELL" \
934 && $CONFIG_SHELL -c "echo '\\t' | grep t > /dev/null"; then
935 exec $CONFIG_SHELL "$0" --no-reexec "$@"
938 # For bash >= 2.04: unset the shell option xpg_echo.
939 if test -z "$have_echo" \
940 && test -n "$BASH_VERSION" \
941 && (shopt -o xpg_echo
; echo '\t' |
grep t
> /dev
/null
) 2>/dev
/null
; then
945 # For bash >= 2.0: define echo to a function that uses the printf built-in.
946 # For bash < 2.0: define echo to a function that uses cat of a here document.
947 # (There is no win in using 'printf' over 'cat' if it is not a shell built-in.)
948 # Also handle problem 2, specific to bash 3.2, here.
949 if { test -z "$have_echo" \
950 ||
case "$BASH_VERSION" in 3.2*) true
;; *) false
;; esac; \
952 && test -n "$BASH_VERSION"; then \
953 if type printf 2>/dev
/null |
grep / > /dev
/null
; then
954 # 'printf' is not a shell built-in.
962 # 'printf' is a shell built-in.
968 if echo '\t' |
grep t
> /dev
/null
; then
972 # For zsh: turn sh-emulation on.
973 if test -z "$have_echo" \
974 && test -n "$ZSH_VERSION" \
975 && (emulate sh
) >/dev
/null
2>&1; then
978 # For ksh: alias echo to 'print -r'.
979 if test -z "$have_echo" \
980 && (type print
) >/dev
/null
2>&1; then
981 # A 'print' command exists.
982 if type print
2>/dev
/null |
grep / > /dev
/null
; then
985 # 'print' is a shell built-in.
986 if (print
-r '\told' |
grep told
> /dev
/null
) 2>/dev
/null
; then
987 # 'print' is the ksh shell built-in.
988 alias echo='print -r'
992 if test -z "$have_echo" \
993 && echo '\t' |
grep t
> /dev
/null
; then
996 # For ksh: alias echo to a function that uses cat of a here document.
997 # The ksh manual page says:
998 # "Aliasing is performed when scripts are read, not while they are executed.
999 # Therefore, for an alias to take effect, the alias definition command has
1000 # to be executed before the command which references the alias is read."
1001 # Because of this, we have to play strange tricks with have_echo, to ensure
1002 # that the top-level statement containing the test starts after the 'alias'
1004 if test -z "$have_echo"; then
1011 if (alias echo=bsd_echo
) 2>/dev
/null
; then
1012 alias echo=bsd_echo
2>/dev
/null
1015 if test -z "$have_echo" \
1016 && echo '\t' |
grep t
> /dev
/null
; then
1019 if test -z "$have_echo"; then
1020 if (alias echo=bsd_echo
) 2>/dev
/null
; then
1021 unalias echo 2>/dev
/null
1024 # For Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh.
1025 if test -z "$have_echo" \
1026 && test "X$1" != "X--no-reexec" \
1027 && test -f /bin
/ksh
; then
1028 exec /bin
/ksh
"$0" --no-reexec "$@"
1031 # Otherwise: respawn using /bin/sh.
1032 if test -z "$have_echo" \
1033 && test "X$1" != "X--no-reexec" \
1034 && test -f /bin
/sh
; then
1035 exec /bin
/sh
"$0" --no-reexec "$@"
1038 if test -z "$have_echo"; then
1039 func_fatal_error
"Shell does not support 'echo' correctly. Please install GNU bash and set the environment variable CONFIG_SHELL to point to it."
1041 if echo '\t' |
grep t
> /dev
/null
; then
1044 func_fatal_error
"Shell does not support 'echo' correctly. Workaround does not work. Please report this as a bug to bug-gnulib@gnu.org."
1046 if test "X$1" = "X--no-reexec"; then
1050 # Unset CDPATH. Otherwise, output from 'cd dir' can surprise callers.
1051 (unset CDPATH
) >/dev
/null
2>&1 && unset CDPATH
1053 # Determine the path separator early because the following option parsing code
1055 func_determine_path_separator
1057 # Command-line option processing.
1058 # Removes the OPTIONS from the arguments. Sets the variables:
1059 # - mode one of: list, find, import, add-import, remove-import,
1060 # update, create-testdir, create-megatestdir, test, megatest,
1062 # - destdir from --dir
1063 # - local_gnulib_path from --local-dir, highest priority dir comes first
1064 # - modcache true or false, from --cache-modules/--no-cache-modules
1065 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
1066 # - libname, supplied_libname from --lib
1067 # - sourcebase from --source-base
1068 # - m4base from --m4-base
1069 # - pobase from --po-base
1070 # - docbase from --doc-base
1071 # - testsbase from --tests-base
1072 # - auxdir from --aux-dir
1073 # - inctests true if --with-tests was given, false if --without-tests
1074 # was given, blank otherwise
1075 # - incobsolete true if --with-obsolete was given, blank otherwise
1076 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
1077 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
1079 # - inc_privileged_tests true if --with-privileged-tests was given, blank
1081 # - inc_unportable_tests true if --with-unportable-tests was given, blank
1083 # - inc_all_tests true if --with-all-tests was given, blank otherwise
1084 # - excl_cxx_tests true if --without-c++-tests was given, blank otherwise
1085 # - excl_longrunning_tests true if --without-longrunning-tests was given,
1087 # - excl_privileged_tests true if --without-privileged-tests was given, blank
1089 # - excl_unportable_tests true if --without-unportable-tests was given, blank
1091 # - single_configure true if --single-configure was given, false otherwise
1092 # - avoidlist list of modules to avoid, from --avoid
1093 # - cond_dependencies true if --conditional-dependencies was given, false if
1094 # --no-conditional-dependencies was given, blank otherwise
1095 # - lgpl yes or a number if --lgpl was given, blank otherwise
1096 # - gnu_make true if --gnu-make was given, false otherwise
1097 # - makefile_name from --makefile-name
1098 # - libtool true if --libtool was given, false if --no-libtool was
1099 # given, blank otherwise
1100 # - macro_prefix from --macro-prefix
1101 # - po_domain from --po-domain
1102 # - witness_c_macro from --witness-c-macro
1103 # - vc_files true if --vc-files was given, false if --no-vc-files was
1104 # given, blank otherwise
1105 # - autoconf_minversion minimum supported autoconf version
1106 # - doit : if actions shall be executed, false if only to be printed
1107 # - copymode symlink if --symlink or --more-symlinks was given,
1108 # hardlink if --hardlink or --more-hardlinks was given,
1110 # - lcopymode symlink if --local-symlink was given,
1111 # hardlink if --local-hardlink was given,
1113 # - do_copyrights blank if --more-symlinks or --more-hardlinks was given,
1132 inc_longrunning_tests
=
1133 inc_privileged_tests
=
1134 inc_unportable_tests
=
1137 excl_longrunning_tests
=
1138 excl_privileged_tests
=
1139 excl_unportable_tests
=
1140 single_configure
=false
1158 while test $# -gt 0; do
1163 --find |
--fin |
--fi |
--f )
1166 --import |
--impor |
--impo |
--imp |
--im |
--i )
1169 --add-import |
--add-impor |
--add-impo |
--add-imp |
--add-im |
--add-i |
--add- |
--add |
--ad )
1172 --remove-import |
--remove-impor |
--remove-impo |
--remove-imp |
--remove-im |
--remove-i |
--remove- |
--remove |
--remov |
--remo |
--rem |
--re |
--r )
1175 --update |
--updat |
--upda |
--upd |
--up |
--u )
1178 --create-testdir |
--create-testdi |
--create-testd |
--create-test |
--create-tes |
--create-te |
--create-t )
1181 --create-megatestdir |
--create-megatestdi |
--create-megatestd |
--create-megatest |
--create-megates |
--create-megate |
--create-megat |
--create-mega |
--create-meg |
--create-me |
--create-m )
1182 mode
=create-megatestdir
1184 --test |
--tes |
--te |
--t )
1187 --megatest |
--megates |
--megate |
--megat |
--mega |
--meg |
--me |
--m )
1191 mode
=`echo "X$1" | sed -e 's/^X--//'`
1193 --copy-file |
--copy-fil |
--copy-fi |
--copy-f |
--copy- |
--copy |
--cop )
1198 if test $# = 0; then
1199 func_fatal_error
"missing argument for --dir"
1204 destdir
=`echo "X$1" | sed -e 's/^X--dir=//'`
1208 if test $# = 0; then
1209 func_fatal_error
"missing argument for --local-dir"
1211 func_path_append local_gnulib_path
"$1"
1214 local_dir
=`echo "X$1" | sed -e 's/^X--local-dir=//'`
1215 func_path_append local_gnulib_path
"$local_dir"
1217 --cache-modules |
--cache-module |
--cache-modul |
--cache-modu |
--cache-mod |
--cache-mo |
--cache-m |
--cache- |
--cache |
--cach |
--cac |
--ca )
1220 --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 )
1223 --verbose |
--verbos |
--verbo |
--verb )
1224 verbose
=`expr $verbose + 1`
1226 --quiet |
--quie |
--qui |
--qu |
--q )
1227 verbose
=`expr $verbose - 1`
1231 if test $# = 0; then
1232 func_fatal_error
"missing argument for --lib"
1235 supplied_libname
=true
1238 libname
=`echo "X$1" | sed -e 's/^X--lib=//'`
1239 supplied_libname
=true
1243 if test $# = 0; then
1244 func_fatal_error
"missing argument for --source-base"
1249 sourcebase
=`echo "X$1" | sed -e 's/^X--source-base=//'`
1253 if test $# = 0; then
1254 func_fatal_error
"missing argument for --m4-base"
1259 m4base
=`echo "X$1" | sed -e 's/^X--m4-base=//'`
1263 if test $# = 0; then
1264 func_fatal_error
"missing argument for --po-base"
1269 pobase
=`echo "X$1" | sed -e 's/^X--po-base=//'`
1273 if test $# = 0; then
1274 func_fatal_error
"missing argument for --doc-base"
1279 docbase
=`echo "X$1" | sed -e 's/^X--doc-base=//'`
1283 if test $# = 0; then
1284 func_fatal_error
"missing argument for --tests-base"
1289 testsbase
=`echo "X$1" | sed -e 's/^X--tests-base=//'`
1293 if test $# = 0; then
1294 func_fatal_error
"missing argument for --aux-dir"
1299 auxdir
=`echo "X$1" | sed -e 's/^X--aux-dir=//'`
1301 --with-tests |
--with-test |
--with-tes |
--with-te |
--with-t)
1304 --with-obsolete |
--with-obsolet |
--with-obsole |
--with-obsol |
--with-obso |
--with-obs |
--with-ob |
--with-o)
1307 --with-c++-tests |
--with-c++-test |
--with-c++-tes |
--with-c++-te |
--with-c++-t |
--with-c++- |
--with-c++ |
--with-c+ |
--with-c)
1310 --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)
1311 inc_longrunning_tests
=true
1313 --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)
1314 inc_privileged_tests
=true
1316 --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)
1317 inc_unportable_tests
=true
1319 --with-all-tests |
--with-all-test |
--with-all-tes |
--with-all-te |
--with-all-t |
--with-all- |
--with-all |
--with-al |
--with-a)
1322 --without-tests |
--without-test |
--without-tes |
--without-te |
--without-t)
1325 --without-c++-tests |
--without-c++-test |
--without-c++-tes |
--without-c++-te |
--without-c++-t |
--without-c++- |
--without-c++ |
--without-c+ |
--without-c)
1328 --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)
1329 excl_longrunning_tests
=true
1331 --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)
1332 excl_privileged_tests
=true
1334 --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)
1335 excl_unportable_tests
=true
1337 --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)
1338 single_configure
=true
1342 if test $# = 0; then
1343 func_fatal_error
"missing argument for --avoid"
1345 func_append avoidlist
" $1"
1348 arg
=`echo "X$1" | sed -e 's/^X--avoid=//'`
1349 func_append avoidlist
" $arg"
1351 --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)
1352 cond_dependencies
=true
1354 --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)
1355 cond_dependencies
=false
1361 arg
=`echo "X$1" | sed -e 's/^X--lgpl=//'`
1363 2 |
3orGPLv2 |
3) ;;
1364 *) func_fatal_error
"invalid LGPL version number for --lgpl" ;;
1373 if test $# = 0; then
1374 func_fatal_error
"missing argument for --makefile-name"
1379 makefile_name
=`echo "X$1" | sed -e 's/^X--makefile-name=//'`
1389 if test $# = 0; then
1390 func_fatal_error
"missing argument for --macro-prefix"
1395 macro_prefix
=`echo "X$1" | sed -e 's/^X--macro-prefix=//'`
1399 if test $# = 0; then
1400 func_fatal_error
"missing argument for --po-domain"
1405 po_domain
=`echo "X$1" | sed -e 's/^X--po-domain=//'`
1409 if test $# = 0; then
1410 func_fatal_error
"missing argument for --witness-c-macro"
1412 witness_c_macro
="$1"
1414 --witness-c-macro=* )
1415 witness_c_macro
=`echo "X$1" | sed -e 's/^X--witness-c-macro=//'`
1423 --no-changelog |
--no-changelo |
--no-changel |
--no-change |
--no-chang |
--no-chan |
--no-cha |
--no-ch )
1424 # A no-op for backward compatibility.
1429 -s |
--symbolic |
--symboli |
--symbol |
--symbo |
--symb |
--symlink |
--symlin |
--symli |
--syml |
--sym |
--sy )
1432 --local-symlink |
--local-symlin |
--local-symli |
--local-syml |
--local-sym |
--local-sy |
--local-s )
1435 -h |
--hardlink |
--hardlin |
--hardli |
--hardl |
--hard |
--har |
--ha )
1438 --local-hardlink |
--local-hardlin |
--local-hardli |
--local-hardl |
--local-hard |
--local-har |
--local-ha |
--local-h )
1441 -S |
--more-symlinks |
--more-symlink |
--more-symlin |
--more-symli |
--more-syml |
--more-sym |
--more-sy |
--more-s )
1445 -H |
--more-hardlinks |
--more-hardlink |
--more-hardlin |
--more-hardli |
--more-hardl |
--more-hard |
--more-har |
--more-ha |
--more-h )
1449 --help |
--hel |
--he )
1452 --version |
--versio |
--versi |
--vers )
1456 # Stop option processing
1460 echo "gnulib-tool: unknown option $1" 1>&2
1461 echo "Try 'gnulib-tool --help' for more information." 1>&2
1468 if case "$mode" in import | add-import | remove-import
) true
;; *) false
;; esac; then
1469 if test -n "$excl_cxx_tests" ||
test -n "$excl_longrunning_tests" \
1470 ||
test -n "$excl_privileged_tests" ||
test -n "$excl_unportable_tests" \
1471 ||
test "$single_configure" != false
; then
1472 echo "gnulib-tool: invalid options for '$mode' mode" 1>&2
1473 echo "Try 'gnulib-tool --help' for more information." 1>&2
1477 if test "$mode" = update
; then
1478 if test $# != 0; then
1479 echo "gnulib-tool: too many arguments in 'update' mode" 1>&2
1480 echo "Try 'gnulib-tool --help' for more information." 1>&2
1481 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1482 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1485 if test -n "$local_gnulib_path" ||
test -n "$supplied_libname" \
1486 ||
test -n "$sourcebase" ||
test -n "$m4base" ||
test -n "$pobase" \
1487 ||
test -n "$docbase" ||
test -n "$testsbase" ||
test -n "$auxdir" \
1488 ||
test -n "$inctests" ||
test -n "$incobsolete" \
1489 ||
test -n "$inc_cxx_tests" ||
test -n "$inc_longrunning_tests" \
1490 ||
test -n "$inc_privileged_tests" ||
test -n "$inc_unportable_tests" \
1491 ||
test -n "$inc_all_tests" \
1492 ||
test -n "$excl_cxx_tests" ||
test -n "$excl_longrunning_tests" \
1493 ||
test -n "$excl_privileged_tests" ||
test -n "$excl_unportable_tests" \
1494 ||
test -n "$avoidlist" ||
test -n "$lgpl" ||
test -n "$makefile_name" \
1495 ||
test -n "$macro_prefix" ||
test -n "$po_domain" \
1496 ||
test -n "$witness_c_macro" ||
test -n "$vc_files"; then
1497 echo "gnulib-tool: invalid options for 'update' mode" 1>&2
1498 echo "Try 'gnulib-tool --help' for more information." 1>&2
1499 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1500 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1504 if test -n "$pobase" && test -z "$po_domain"; then
1505 echo "gnulib-tool: together with --po-base, you need to specify --po-domain" 1>&2
1506 echo "Try 'gnulib-tool --help' for more information." 1>&2
1509 if test -z "$pobase" && test -n "$po_domain"; then
1510 func_warning
"--po-domain has no effect without a --po-base option"
1512 case $mode,$gnu_make in
1514 echo "gnulib-tool: --gnu-make not supported when including tests"
1517 # Canonicalize the inctests variable.
1519 import | add-import | remove-import | update
)
1520 if test -z "$inctests"; then
1524 create-testdir | create-megatestdir |
test | megatest
)
1525 if test -z "$inctests"; then
1530 # Now the only possible values of "$inctests" are true and false
1531 # (or blank but then it is irrelevant).
1533 # Determine the minimum supported autoconf version from the project's
1535 DEFAULT_AUTOCONF_MINVERSION
="2.63"
1536 autoconf_minversion
=
1538 if case "$mode" in import | add-import | remove-import | update
) true
;; *) false
;; esac \
1539 && test -n "$destdir"; then
1540 if test -f "$destdir"/configure.ac
; then
1541 configure_ac
="$destdir/configure.ac"
1543 if test -f "$destdir"/configure.
in; then
1544 configure_ac
="$destdir/configure.in"
1548 if test -f configure.ac
; then
1549 configure_ac
="configure.ac"
1551 if test -f configure.
in; then
1552 configure_ac
="configure.in"
1556 if test -n "$configure_ac"; then
1557 # Use sed, not autoconf --trace, to look for the AC_PREREQ invocation,
1558 # because when some m4 files are omitted from a version control repository,
1559 # "autoconf --trace=AC_PREREQ" fails with an error message like this:
1560 # m4: aclocal.m4:851: Cannot open m4/absolute-header.m4: No such file or directory
1561 # autom4te: m4 failed with exit status: 1
1568 s,^.*AC_PREREQ([[ ]*\([^])]*\).*$,\1,p
1570 prereqs
=`sed -n -e "$my_sed_traces" < "$configure_ac"`
1571 if test -n "$prereqs"; then
1572 autoconf_minversion
=`
1573 for version in $prereqs; do echo $version; done |
1574 LC_ALL=C sort -nru | sed -e 1q
1578 if test -z "$autoconf_minversion"; then
1579 autoconf_minversion
=$DEFAULT_AUTOCONF_MINVERSION
1581 case "$autoconf_minversion" in
1582 1.
* |
2.
[0-5]* |
2.6[0-2]*)
1583 func_fatal_error
"minimum supported autoconf version is 2.63. Try adding AC_PREREQ([$DEFAULT_AUTOCONF_MINVERSION]) to your configure.ac." ;;
1586 # Remove trailing slashes from the directory names. This is necessary for
1587 # m4base (to avoid an error in func_import) and optional for the others.
1588 sed_trimtrailingslashes
='s,\([^/]\)//*$,\1,'
1589 old_local_gnulib_path
="$local_gnulib_path"
1593 for dir
in $old_local_gnulib_path
1597 */ ) dir
=`echo "$dir" | sed -e "$sed_trimtrailingslashes"` ;;
1599 func_path_append local_gnulib_path
"$dir"
1602 case "$sourcebase" in
1603 */ ) sourcebase
=`echo "$sourcebase" | sed -e "$sed_trimtrailingslashes"` ;;
1606 */ ) m4base
=`echo "$m4base" | sed -e "$sed_trimtrailingslashes"` ;;
1609 */ ) pobase
=`echo "$pobase" | sed -e "$sed_trimtrailingslashes"` ;;
1612 */ ) docbase
=`echo "$docbase" | sed -e "$sed_trimtrailingslashes"` ;;
1614 case "$testsbase" in
1615 */ ) testsbase
=`echo "$testsbase" | sed -e "$sed_trimtrailingslashes"` ;;
1618 */ ) auxdir
=`echo "$auxdir" | sed -e "$sed_trimtrailingslashes"` ;;
1624 trap 'exit_status=$?
1625 if test "$signal" != 0; then
1626 echo "caught signal $signal" >&2
1629 exit $exit_status' 0
1630 for signal
in 1 2 3 13 15; do
1631 trap '{ signal='$signal'; func_exit 1; }' $signal
1635 # Note: The 'eval' silences stderr output in dash.
1636 if (declare -A x
&& { x
[f
/2]='foo'; x
[f
/3]='bar'; eval test '${x[f/2]}' = foo
; }) 2>/dev
/null
; then
1637 # Zsh 4 and Bash 4 have associative arrays.
1638 have_associative
=true
1640 # For other shells, use 'eval' with computed shell variable names.
1641 have_associative
=false
1644 # func_lookup_local_file_cb dir file
1645 # returns true and sets func_lookup_local_file_result if the file $dir/$file
1647 func_lookup_local_file_cb
()
1649 test -n "$func_lookup_local_file_result" && return 1 # already found?
1650 test -f "$1/$2" ||
return 1
1651 func_lookup_local_file_result
=$1/$2
1655 # func_lookup_local_file file
1656 # looks up a file in $local_gnulib_path.
1658 # - local_gnulib_path from --local-dir
1660 # - func_lookup_local_file_result name of the file, valid only when the
1661 # function succeeded.
1662 func_lookup_local_file
()
1664 func_lookup_local_file_result
=
1665 func_path_foreach
"$local_gnulib_path" func_lookup_local_file_cb
%dir
% "$1"
1668 # func_lookup_file_cb dir
1669 # does one step in processing the $local_gnulib_path, looking for $dir/$lkfile
1670 # and $dir/$lkfile.diff.
1671 func_lookup_file_cb
()
1673 # If we found the file already in a --local-dir of higher priority, nothing
1675 if test -z "$lookedup_file"; then
1676 # Otherwise, look for $dir/$lkfile and $dir/$lkfile.diff.
1677 if test -f "$1/$lkfile"; then
1678 lookedup_file
="$1/$lkfile"
1680 if test -f "$1/$lkfile.diff"; then
1681 lkpatches
="$1/$lkfile.diff${lkpatches:+$PATH_SEPARATOR$lkpatches}"
1687 # func_lookup_file file
1688 # looks up a file in $local_gnulib_path or $gnulib_dir, or combines it through
1691 # - local_gnulib_path from --local-dir
1693 # - lookedup_file name of the merged (combined) file
1694 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
1698 # Each element in $local_gnulib_path is a directory whose contents overrides
1699 # or amends the result of the lookup in the rest of $local_gnulib_path and
1700 # $gnulib_dir. So, the first element of $local_gnulib_path is the highest
1704 func_path_foreach
"$local_gnulib_path" func_lookup_file_cb
%dir
%
1705 # Treat $gnulib_dir like a lowest-priority --local-dir, except that here we
1706 # don't look for .diff files.
1707 if test -z "$lookedup_file"; then
1708 if test -f "$gnulib_dir/$lkfile"; then
1709 lookedup_file
="$gnulib_dir/$lkfile"
1711 func_fatal_error
"file $gnulib_dir/$lkfile not found"
1714 # Now apply the patches, from lowest-priority to highest-priority.
1716 if test -n "$lkpatches"; then
1717 lkbase
=`echo "$lkfile" | sed -e 's,^.*/,,'`
1718 rm -f "$tmp/$lkbase"
1719 cp "$lookedup_file" "$tmp/$lkbase"
1721 IFS
="$PATH_SEPARATOR"
1722 for patchfile
in $lkpatches; do
1724 patch -s "$tmp/$lkbase" < "$patchfile" >&2 \
1725 || func_fatal_error
"patch file $patchfile didn't apply cleanly"
1728 lookedup_file
="$tmp/$lkbase"
1733 # func_sanitize_modulelist
1734 # receives a list of possible module names on standard input, one per line.
1735 # It removes those which are just file names unrelated to modules, and outputs
1736 # the resulting list to standard output, one per line.
1737 func_sanitize_modulelist
()
1739 sed -e '/^ChangeLog$/d' -e '/\/ChangeLog$/d' \
1740 -e '/^COPYING$/d' -e '/\/COPYING$/d' \
1741 -e '/^README$/d' -e '/\/README$/d' \
1742 -e '/^TEMPLATE$/d' \
1743 -e '/^TEMPLATE-EXTENDED$/d' \
1744 -e '/^TEMPLATE-TESTS$/d' \
1750 # func_modules_in_dir dir
1751 # outputs all module files in dir to standard output.
1752 func_modules_in_dir
()
1754 (test -d "$1" && cd "$1" && find modules
-type f
-print)
1759 # - local_gnulib_path from --local-dir
1762 # Filter out metainformation files like README, which are not modules.
1763 # Filter out unit test modules; they can be retrieved through
1764 # --extract-tests-module if desired.
1766 (cd "$gnulib_dir" && find modules
-type f
-print |
sed -e 's,^modules/,,')
1767 func_path_foreach
"$local_gnulib_path" func_modules_in_dir
%dir
% |
sed -e 's,^modules/,,' -e 's,\.diff$,,'
1769 | func_sanitize_modulelist \
1770 |
sed -e '/-tests$/d' \
1774 # func_exists_local_module dir module
1775 # returns true if module exists in dir
1776 func_exists_local_module
()
1778 test -d "$1/modules" && test -f "$1/modules/$2";
1781 # func_exists_module module
1782 # tests whether a module, given by name, exists
1784 # - local_gnulib_path from --local-dir
1785 func_exists_module
()
1787 { test -f "$gnulib_dir/modules/$1" \
1788 || func_path_foreach
"$local_gnulib_path" func_exists_local_module
%dir
% "$1" ; } \
1789 && test "ChangeLog" != "$1" \
1790 && test "COPYING" != "$1" \
1791 && test "README" != "$1" \
1792 && test "TEMPLATE" != "$1" \
1793 && test "TEMPLATE-EXTENDED" != "$1" \
1794 && test "TEMPLATE-TESTS" != "$1"
1797 # func_verify_module
1798 # verifies a module name
1800 # - local_gnulib_path from --local-dir
1801 # - module module name argument
1803 # - module unchanged if OK, empty if not OK
1804 # - lookedup_file if OK: name of the merged (combined) module description file
1805 # - lookedup_tmp if OK: true if it is located in the tmp directory, blank otherwise
1806 func_verify_module
()
1808 if func_exists_module
"$module"; then
1809 # OK, $module is a correct module name.
1810 # Verify that building the module description with 'patch' succeeds.
1811 func_lookup_file
"modules/$module"
1813 func_warning
"module $module doesn't exist"
1818 # func_verify_nontests_module
1819 # verifies a module name, excluding tests modules
1821 # - local_gnulib_path from --local-dir
1822 # - module module name argument
1823 func_verify_nontests_module
()
1826 *-tests ) module
= ;;
1827 * ) func_verify_module
;;
1831 # func_verify_tests_module
1832 # verifies a module name, considering only tests modules
1834 # - local_gnulib_path from --local-dir
1835 # - module module name argument
1836 func_verify_tests_module
()
1839 *-tests ) func_verify_module
;;
1844 # Suffix of a sed expression that extracts a particular field from a
1845 # module description.
1846 # A field starts with a line that contains a keyword, such as 'Description',
1847 # followed by a colon and optional whitespace. All following lines, up to
1848 # the next field (or end of file if there is none) form the contents of the
1850 # An absent field is equivalent to a field with empty contents.
1851 # NOTE: Keep this in sync with sed_extract_cache_prog below!
1852 sed_extract_prog
=':[ ]*$/ {
1855 s/^Description:[ ]*$//
1859 s/^Applicability:[ ]*$//
1861 s/^Depends-on:[ ]*$//
1862 s/^configure\.ac-early:[ ]*$//
1863 s/^configure\.ac:[ ]*$//
1864 s/^Makefile\.am:[ ]*$//
1868 s/^Maintainer:[ ]*$//
1875 # Piece of a sed expression that converts a field header line to a shell
1877 # NOTE: Keep this in sync with sed_extract_prog above!
1878 sed_extract_field_header
='
1879 s/^Description:[ ]*$/description/
1880 s/^Comment:[ ]*$/comment/
1881 s/^Status:[ ]*$/status/
1882 s/^Notice:[ ]*$/notice/
1883 s/^Applicability:[ ]*$/applicability/
1884 s/^Files:[ ]*$/files/
1885 s/^Depends-on:[ ]*$/dependson/
1886 s/^configure\.ac-early:[ ]*$/configureac_early/
1887 s/^configure\.ac:[ ]*$/configureac/
1888 s/^Makefile\.am:[ ]*$/makefile/
1889 s/^Include:[ ]*$/include/
1891 s/^License:[ ]*$/license/
1892 s/^Maintainer:[ ]*$/maintainer/'
1896 if $have_associative; then
1898 # Declare the associative arrays.
1899 declare -A modcache_cached
1900 sed_to_declare_statement
='s|^.*/\([a-zA-Z0-9_]*\)/$|declare -A modcache_\1|p'
1901 declare_script
=`echo "$sed_extract_field_header" | sed -n -e "$sed_to_declare_statement"`
1902 eval "$declare_script"
1906 # func_cache_var module
1907 # computes the cache variable name corresponding to $module.
1908 # Note: This computation can map different module names to the same
1909 # cachevar (such as 'foo-bar', 'foo_bar', or 'foo/bar'); the caller has
1910 # to protect against this case.
1912 # - cachevar a shell variable name
1913 if (f
=foo
; eval echo '${f//o/e}') < /dev
/null
2>/dev
/null |
grep fee
>/dev
/null
; then
1914 # Bash 2.0 and newer, ksh, and zsh support the syntax
1915 # ${param//pattern/replacement}
1916 # as a shorthand for
1917 # `echo "$param" | sed -e "s/pattern/replacement/g"`.
1918 # Note: The 'eval' is necessary for dash and NetBSD /bin/sh.
1919 eval 'func_cache_var ()
1921 cachevar=c_${1//[!a-zA-Z0-9_]/_}
1928 cachevar
=c_
`echo "$1" | LC_ALL=C sed -e 's/[^a-zA-Z0-9_]/_/g'` ;;
1937 # func_init_sed_convert_to_cache_statements
1939 # - modcachevar_assignment
1941 # - sed_convert_to_cache_statements
1942 func_init_sed_convert_to_cache_statements
()
1944 # 'sed' script that turns a module description into shell script
1945 # assignments, suitable to be eval'ed. All active characters are escaped.
1948 # Some module's description
1953 # modcache_description[$1]=\
1954 # 'Some module'"'"'s description
1956 # modcache_files[$1]=\
1959 # c_MODULE_description_set=set; c_MODULE_description=\
1960 # 'Some module'"'"'s description
1962 # c_MODULE_files_set=set; c_MODULE_files=\
1964 # The script consists of two parts:
1965 # 1) Ignore the lines before the first field header.
1966 # 2) A loop, treating non-field-header lines by escaping single quotes
1967 # and adding a closing quote in the last line,
1968 sed_convert_to_cache_statements
="
1970 # Here we have not yet seen a field header.
1972 # See if the current line contains a field header.
1975 ${sed_extract_field_header}
1978 # No field header. Ignore the line.
1980 # Read the next line. Upon EOF, just exit.
1985 # The current line contains a field header.
1987 # Turn it into the beginning of an assignment.
1988 s/^\\(.*\\)\$/${modcachevar_assignment}\\\\/
1990 # Move it to the hold space. Don't print it yet,
1991 # because we want no assignment if the field is empty.
1994 # Read the next line.
1995 # Upon EOF, the field was empty. Print no assignment. Just exit.
1998 # See if the current line contains a field header.
2001 ${sed_extract_field_header}
2002 # If it is, the previous field was empty. Print no assignment.
2005 # Not a field header.
2007 # Print the previous line, held in the hold space.
2012 # Transform single quotes.
2015 # Prepend a single quote.
2020 # Move it to the hold space.
2023 # Read the next line.
2030 # See if the current line contains a field header.
2033 ${sed_extract_field_header}
2036 # Print the previous line, held in the hold space.
2041 # Transform single quotes.
2048 # Print the previous line, held in the hold space, with a single quote
2049 # to end the assignment.
2059 # Print the previous line, held in the hold space, with a single quote
2060 # to end the assignment.
2067 if ! $sed_comments; then
2069 sed_convert_to_cache_statements
=`echo "$sed_convert_to_cache_statements" \
2070 | sed -e 's/^ *//' -e 's/^#.*//'`
2074 if $have_associative; then
2075 # sed_convert_to_cache_statements does not depend on the module.
2076 modcachevar_assignment
='modcache_\1[$1]='
2077 func_init_sed_convert_to_cache_statements
2080 # func_cache_lookup_module module
2082 # looks up a module, like 'func_lookup_file modules/$module', and stores all
2083 # of its relevant data in a cache in the memory of the processing shell. If
2084 # already cached, it does not look it up again, thus saving file access time.
2086 # - module non-empty string
2087 # Output if $have_associative:
2088 # - modcache_cached[$module] set to yes
2089 # - modcache_description[$module] ==
2090 # - modcache_status[$module] \ set to the field's value, minus the
2091 # - ... / final newline,
2092 # - modcache_maintainer[$module] == or unset if the field's value is empty
2093 # Output if ! $have_associative:
2094 # - cachevar a shell variable name
2095 # - ${cachevar}_cached set to $module
2096 # - ${cachevar}_description ==
2097 # - ${cachevar}_status \ set to the field's value, minus the
2098 # - ... / final newline,
2099 # - ${cachevar}_maintainer == or unset if the field's value is empty
2100 # - ${cachevar}_description_set ==
2101 # - ${cachevar}_status_set \ set to non-empty if the field's value
2102 # - ... / is non-empty,
2103 # - ${cachevar}_maintainer_set == or unset if the field's value is empty
2104 func_cache_lookup_module
()
2106 if $have_associative; then
2107 eval 'cached=${modcache_cached[$1]}'
2110 eval "cached=\"\$${cachevar}_cached\""
2112 if test -z "$cached"; then
2113 # Not found in cache. Look it up on the file system.
2114 func_lookup_file
"modules/$1"
2115 if $have_associative; then
2116 eval 'modcache_cached[$1]=yes'
2118 eval "${cachevar}_cached=\"\$1\""
2120 if ! $have_associative; then
2121 # sed_convert_to_cache_statements depends on the module.
2122 modcachevar_assignment
="${cachevar}"'_\1_set=set; '"${cachevar}"'_\1='
2123 func_init_sed_convert_to_cache_statements
2125 cache_statements
=`LC_ALL=C sed -n -e "$sed_convert_to_cache_statements" < "$lookedup_file"`
2126 eval "$cache_statements"
2128 if ! $have_associative; then
2129 if test "$1" != "$cached"; then
2130 func_fatal_error
"cache variable collision between $1 and $cached"
2138 # func_get_description module
2140 # - local_gnulib_path from --local-dir
2141 # - modcache true or false, from --cache-modules/--no-cache-modules
2142 func_get_description
()
2144 if ! $modcache; then
2145 func_lookup_file
"modules/$1"
2146 sed -n -e "/^Description$sed_extract_prog" < "$lookedup_file"
2148 func_cache_lookup_module
"$1"
2149 # Output the field's value, including the final newline (if any).
2150 if $have_associative; then
2151 if eval 'test -n "${modcache_description[$1]+set}"'; then
2152 eval 'echo "${modcache_description[$1]}"'
2155 eval "field_set=\"\$${cachevar}_description_set\""
2156 if test -n "$field_set"; then
2157 eval "field_value=\"\$${cachevar}_description\""
2158 echo "${field_value}"
2164 # func_get_comment module
2166 # - local_gnulib_path from --local-dir
2167 # - modcache true or false, from --cache-modules/--no-cache-modules
2170 if ! $modcache; then
2171 func_lookup_file
"modules/$1"
2172 sed -n -e "/^Comment$sed_extract_prog" < "$lookedup_file"
2174 func_cache_lookup_module
"$1"
2175 # Output the field's value, including the final newline (if any).
2176 if $have_associative; then
2177 if eval 'test -n "${modcache_comment[$1]+set}"'; then
2178 eval 'echo "${modcache_comment[$1]}"'
2181 eval "field_set=\"\$${cachevar}_comment_set\""
2182 if test -n "$field_set"; then
2183 eval "field_value=\"\$${cachevar}_comment\""
2184 echo "${field_value}"
2190 # func_get_status module
2192 # - local_gnulib_path from --local-dir
2193 # - modcache true or false, from --cache-modules/--no-cache-modules
2196 if ! $modcache; then
2197 func_lookup_file
"modules/$1"
2198 sed -n -e "/^Status$sed_extract_prog" < "$lookedup_file"
2200 func_cache_lookup_module
"$1"
2201 # Output the field's value, including the final newline (if any).
2202 if $have_associative; then
2203 if eval 'test -n "${modcache_status[$1]+set}"'; then
2204 eval 'echo "${modcache_status[$1]}"'
2207 eval "field_set=\"\$${cachevar}_status_set\""
2208 if test -n "$field_set"; then
2209 eval "field_value=\"\$${cachevar}_status\""
2210 echo "${field_value}"
2216 # func_get_notice module
2218 # - local_gnulib_path from --local-dir
2219 # - modcache true or false, from --cache-modules/--no-cache-modules
2222 if ! $modcache; then
2223 func_lookup_file
"modules/$1"
2224 sed -n -e "/^Notice$sed_extract_prog" < "$lookedup_file"
2226 func_cache_lookup_module
"$1"
2227 # Output the field's value, including the final newline (if any).
2228 if $have_associative; then
2229 if eval 'test -n "${modcache_notice[$1]+set}"'; then
2230 eval 'echo "${modcache_notice[$1]}"'
2233 eval "field_set=\"\$${cachevar}_notice_set\""
2234 if test -n "$field_set"; then
2235 eval "field_value=\"\$${cachevar}_notice\""
2236 echo "${field_value}"
2242 # func_get_applicability module
2244 # - local_gnulib_path from --local-dir
2245 # - modcache true or false, from --cache-modules/--no-cache-modules
2246 # The expected result (on stdout) is either 'main', or 'tests', or 'all'.
2247 func_get_applicability
()
2249 if ! $modcache; then
2250 func_lookup_file
"modules/$1"
2251 my_applicability
=`sed -n -e "/^Applicability$sed_extract_prog" < "$lookedup_file"`
2253 func_cache_lookup_module
"$1"
2254 # Get the field's value, without the final newline.
2255 if $have_associative; then
2256 eval 'my_applicability="${modcache_applicability[$1]}"'
2258 eval "my_applicability=\"\$${cachevar}_applicability\""
2261 if test -n "$my_applicability"; then
2262 echo $my_applicability
2264 # The default is 'main' or 'tests', depending on the module's name.
2266 *-tests) echo "tests";;
2272 # func_get_filelist module
2274 # - local_gnulib_path from --local-dir
2275 # - modcache true or false, from --cache-modules/--no-cache-modules
2276 func_get_filelist
()
2278 if ! $modcache; then
2279 func_lookup_file
"modules/$1"
2280 sed -n -e "/^Files$sed_extract_prog" < "$lookedup_file"
2282 func_cache_lookup_module
"$1"
2283 # Output the field's value, including the final newline (if any).
2284 if $have_associative; then
2285 if eval 'test -n "${modcache_files[$1]+set}"'; then
2286 eval 'echo "${modcache_files[$1]}"'
2289 eval "field_set=\"\$${cachevar}_files_set\""
2290 if test -n "$field_set"; then
2291 eval "field_value=\"\$${cachevar}_files\""
2292 echo "${field_value}"
2297 echo m
4/gnulib-common.
m4
2300 # func_filter_filelist outputvar separator filelist prefix suffix removed_prefix removed_suffix [added_prefix [added_suffix]]
2301 # stores in outputvar the filtered and processed filelist. Filtering: Only the
2302 # elements starting with prefix and ending with suffix are considered.
2303 # Processing: removed_prefix and removed_suffix are removed from each element,
2304 # added_prefix and added_suffix are added to each element.
2305 # prefix, suffix should not contain shell-special characters.
2306 # removed_prefix, removed_suffix should not contain the characters "$`\{}[]^|.
2307 # added_prefix, added_suffix should not contain the characters \|&.
2308 func_filter_filelist
()
2310 if test "$2" != "$nl" \
2311 ||
{ $fast_func_append \
2312 && { test -z "$6" ||
$fast_func_remove_prefix; } \
2313 && { test -z "$7" ||
$fast_func_remove_suffix; }; \
2317 # Do not quote possibly-empty parameters in case patterns,
2318 # AIX and HP-UX ksh won't match them if they are empty.
2321 if test -n "$6"; then
2322 func_remove_prefix fff
"$6"
2324 if test -n "$7"; then
2325 func_remove_suffix fff
"$7"
2328 if test -z "$ffflist"; then
2331 func_append ffflist
"$2${fff}"
2337 sed_fff_filter
="s|^$6\(.*\)$7\$|$8\\1$9|"
2338 ffflist
=`for fff in $3; do
2340 $4*$5) echo "$fff" ;;
2342 done | sed -e "$sed_fff_filter"`
2344 eval "$1=\"\$ffflist\""
2347 # func_get_dependencies module
2349 # - local_gnulib_path from --local-dir
2350 # - modcache true or false, from --cache-modules/--no-cache-modules
2351 func_get_dependencies
()
2353 # ${module}-tests implicitly depends on ${module}, if that module exists.
2357 func_remove_suffix fgd1
'-tests'
2358 if func_exists_module
"$fgd1"; then
2363 # Then the explicit dependencies listed in the module description.
2364 { if ! $modcache; then
2365 func_lookup_file
"modules/$1"
2366 sed -n -e "/^Depends-on$sed_extract_prog" < "$lookedup_file"
2368 func_cache_lookup_module
"$1"
2369 # Output the field's value, including the final newline (if any).
2370 if $have_associative; then
2371 if eval 'test -n "${modcache_dependson[$1]+set}"'; then
2372 eval 'echo "${modcache_dependson[$1]}"'
2375 eval "field_set=\"\$${cachevar}_dependson_set\""
2376 if test -n "$field_set"; then
2377 eval "field_value=\"\$${cachevar}_dependson\""
2378 echo "${field_value}"
2386 sed_dependencies_without_conditions
='s/ *\[.*//'
2388 # func_get_autoconf_early_snippet module
2390 # - local_gnulib_path from --local-dir
2391 # - modcache true or false, from --cache-modules/--no-cache-modules
2392 func_get_autoconf_early_snippet
()
2394 if ! $modcache; then
2395 func_lookup_file
"modules/$1"
2396 sed -n -e "/^configure\.ac-early$sed_extract_prog" < "$lookedup_file"
2398 func_cache_lookup_module
"$1"
2399 # Output the field's value, including the final newline (if any).
2400 if $have_associative; then
2401 if eval 'test -n "${modcache_configureac_early[$1]+set}"'; then
2402 eval 'echo "${modcache_configureac_early[$1]}"'
2405 eval "field_set=\"\$${cachevar}_configureac_early_set\""
2406 if test -n "$field_set"; then
2407 eval "field_value=\"\$${cachevar}_configureac_early\""
2408 echo "${field_value}"
2414 # func_get_autoconf_snippet module
2416 # - local_gnulib_path from --local-dir
2417 # - modcache true or false, from --cache-modules/--no-cache-modules
2418 func_get_autoconf_snippet
()
2420 if ! $modcache; then
2421 func_lookup_file
"modules/$1"
2422 sed -n -e "/^configure\.ac$sed_extract_prog" < "$lookedup_file"
2424 func_cache_lookup_module
"$1"
2425 # Output the field's value, including the final newline (if any).
2426 if $have_associative; then
2427 if eval 'test -n "${modcache_configureac[$1]+set}"'; then
2428 eval 'echo "${modcache_configureac[$1]}"'
2431 eval "field_set=\"\$${cachevar}_configureac_set\""
2432 if test -n "$field_set"; then
2433 eval "field_value=\"\$${cachevar}_configureac\""
2434 echo "${field_value}"
2440 # Concatenate lines with trailing slash.
2441 # $1 is an optional filter to restrict the
2442 # concatenation to groups starting with that expression
2444 sed -e "/$1.*"'\\$/{
2453 # func_get_automake_snippet_conditional module
2454 # returns the part of the Makefile.am snippet that can be put inside Automake
2457 # - local_gnulib_path from --local-dir
2458 # - modcache true or false, from --cache-modules/--no-cache-modules
2459 func_get_automake_snippet_conditional
()
2461 if ! $modcache; then
2462 func_lookup_file
"modules/$1"
2463 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
2465 func_cache_lookup_module
"$1"
2466 # Output the field's value, including the final newline (if any).
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 # func_get_automake_snippet_unconditional module
2482 # returns the part of the Makefile.am snippet that must stay outside of
2483 # Automake conditionals.
2485 # - local_gnulib_path from --local-dir
2486 # - modcache true or false, from --cache-modules/--no-cache-modules
2487 func_get_automake_snippet_unconditional
()
2491 # *-tests module live in tests/, not lib/.
2492 # Synthesize an EXTRA_DIST augmentation.
2493 all_files
=`func_get_filelist $1`
2494 func_filter_filelist tests_files
" " "$all_files" 'tests/' '' 'tests/' ''
2495 extra_files
="$tests_files"
2496 if test -n "$extra_files"; then
2497 echo "EXTRA_DIST +=" $extra_files
2502 # Synthesize an EXTRA_DIST augmentation.
2503 sed_extract_mentioned_files
='s/^lib_SOURCES[ ]*+=[ ]*//p'
2504 already_mentioned_files
=` \
2505 { if ! $modcache; then
2506 func_lookup_file "modules/$1"
2507 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
2509 func_cache_lookup_module "$1"
2510 if $have_associative; then
2511 if eval 'test -n "${modcache_makefile[$1]+set}"'; then
2512 eval 'echo "${modcache_makefile[$1]}"'
2515 eval 'field_set="$'"${cachevar}"'_makefile_set"'
2516 if test -n "$field_set"; then
2517 eval 'field_value="$'"${cachevar}"'_makefile"'
2518 echo "${field_value}"
2524 | sed -n -e "$sed_extract_mentioned_files" | sed -e 's/#.*//'`
2525 all_files
=`func_get_filelist $1`
2526 func_filter_filelist lib_files
"$nl" "$all_files" 'lib/' '' 'lib/' ''
2527 # Remove $already_mentioned_files from $lib_files.
2528 echo "$lib_files" | LC_ALL
=C
sort -u > "$tmp"/lib-files
2529 extra_files
=`for f in $already_mentioned_files; do echo $f; done \
2530 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/lib-files`
2531 if test -n "$extra_files"; then
2532 echo "EXTRA_DIST +=" $extra_files
2535 # Synthesize also an EXTRA_lib_SOURCES augmentation.
2536 # This is necessary so that automake can generate the right list of
2538 # A possible approach would be to use autom4te --trace of the redefined
2539 # AC_LIBOBJ and AC_REPLACE_FUNCS macros when creating the Makefile.am
2540 # (use autom4te --trace, not just grep, so that AC_LIBOBJ invocations
2541 # inside autoconf's built-in macros are not missed).
2542 # But it's simpler and more robust to do it here, based on the file list.
2543 # If some .c file exists and is not used with AC_LIBOBJ - for example,
2544 # a .c file is preprocessed into another .c file for BUILT_SOURCES -,
2545 # automake will generate a useless dependency; this is harmless.
2547 relocatable-prog-wrapper
) ;;
2550 func_filter_filelist extra_files
"$nl" "$extra_files" '' '.c' '' ''
2551 if test -n "$extra_files"; then
2552 echo "EXTRA_lib_SOURCES +=" $extra_files
2557 # Synthesize an EXTRA_DIST augmentation also for the files in build-aux/.
2558 func_filter_filelist buildaux_files
"$nl" "$all_files" 'build-aux/' '' 'build-aux/' ''
2559 if test -n "$buildaux_files"; then
2560 sed_prepend_auxdir
='s,^,$(top_srcdir)/'"$auxdir"'/,'
2561 echo "EXTRA_DIST += "`echo "$buildaux_files" | sed -e "$sed_prepend_auxdir"`
2568 # func_get_automake_snippet module
2570 # - local_gnulib_path from --local-dir
2571 # - modcache true or false, from --cache-modules/--no-cache-modules
2572 func_get_automake_snippet
()
2574 func_get_automake_snippet_conditional
"$1"
2575 func_get_automake_snippet_unconditional
"$1"
2578 # func_get_include_directive module
2580 # - local_gnulib_path from --local-dir
2581 # - modcache true or false, from --cache-modules/--no-cache-modules
2582 func_get_include_directive
()
2585 if ! $modcache; then
2586 func_lookup_file
"modules/$1"
2587 sed -n -e "/^Include$sed_extract_prog" < "$lookedup_file"
2589 func_cache_lookup_module
"$1"
2590 # Output the field's value, including the final newline (if any).
2591 if $have_associative; then
2592 if eval 'test -n "${modcache_include[$1]+set}"'; then
2593 eval 'echo "${modcache_include[$1]}"'
2596 eval "field_set=\"\$${cachevar}_include_set\""
2597 if test -n "$field_set"; then
2598 eval "field_value=\"\$${cachevar}_include\""
2599 echo "${field_value}"
2603 } |
sed -e 's/^\(["<]\)/#include \1/'
2606 # func_get_link_directive module
2608 # - local_gnulib_path from --local-dir
2609 # - modcache true or false, from --cache-modules/--no-cache-modules
2610 func_get_link_directive
()
2612 if ! $modcache; then
2613 func_lookup_file
"modules/$1"
2614 sed -n -e "/^Link$sed_extract_prog" < "$lookedup_file"
2616 func_cache_lookup_module
"$1"
2617 # Output the field's value, including the final newline (if any).
2618 if $have_associative; then
2619 if eval 'test -n "${modcache_link[$1]+set}"'; then
2620 eval 'echo "${modcache_link[$1]}"'
2623 eval "field_set=\"\$${cachevar}_link_set\""
2624 if test -n "$field_set"; then
2625 eval "field_value=\"\$${cachevar}_link\""
2626 echo "${field_value}"
2632 # func_get_license_raw module
2634 # - local_gnulib_path from --local-dir
2635 # - modcache true or false, from --cache-modules/--no-cache-modules
2636 func_get_license_raw
()
2638 if ! $modcache; then
2639 func_lookup_file
"modules/$1"
2640 sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
2642 func_cache_lookup_module
"$1"
2643 # Output the field's value, including the final newline (if any).
2644 if $have_associative; then
2645 if eval 'test -n "${modcache_license[$1]+set}"'; then
2646 eval 'echo "${modcache_license[$1]}"'
2649 eval "field_set=\"\$${cachevar}_license_set\""
2650 if test -n "$field_set"; then
2651 eval "field_value=\"\$${cachevar}_license\""
2652 echo "${field_value}"
2658 # func_get_license module
2660 # - local_gnulib_path from --local-dir
2661 # - modcache true or false, from --cache-modules/--no-cache-modules
2664 # Warn if the License field is missing.
2668 license
=`func_get_license_raw "$1"`
2669 if test -z "$license"; then
2670 func_warning
"module $1 lacks a License"
2676 # These modules are under a weaker license only for the purpose of some
2677 # users who hand-edit it and don't use gnulib-tool. For the regular
2678 # gnulib users they are under a stricter license.
2683 func_get_license_raw
"$1"
2684 # The default is GPL.
2686 } |
sed -e 's,^ *$,,' |
sed -e 1q
2691 # func_get_maintainer module
2693 # - local_gnulib_path from --local-dir
2694 # - modcache true or false, from --cache-modules/--no-cache-modules
2695 func_get_maintainer
()
2697 if ! $modcache; then
2698 func_lookup_file
"modules/$1"
2699 sed -n -e "/^Maintainer$sed_extract_prog" < "$lookedup_file"
2701 func_cache_lookup_module
"$1"
2702 # Output the field's value, including the final newline (if any).
2703 if $have_associative; then
2704 if eval 'test -n "${modcache_maintainer[$1]+set}"'; then
2705 eval 'echo "${modcache_maintainer[$1]}"'
2708 eval "field_set=\"\$${cachevar}_maintainer_set\""
2709 if test -n "$field_set"; then
2710 eval "field_value=\"\$${cachevar}_maintainer\""
2711 echo "${field_value}"
2717 # func_get_tests_module module
2719 # - local_gnulib_path from --local-dir
2720 func_get_tests_module
()
2722 # The naming convention for tests modules is hardwired: ${module}-tests.
2723 if test -f "$gnulib_dir/modules/$1"-tests \
2724 || func_path_foreach
"$local_gnulib_path" func_exists_local_module
%dir
% "$1-tests"; then
2729 # func_get_dependencies_recursively module
2731 # - local_gnulib_path from --local-dir
2732 # - modcache true or false, from --cache-modules/--no-cache-modules
2733 func_get_dependencies_recursively
()
2735 # In order to process every module only once (for speed), process an "input
2736 # list" of modules, producing an "output list" of modules. During each round,
2737 # more modules can be queued in the input list. Once a module on the input
2738 # list has been processed, it is added to the "handled list", so we can avoid
2739 # to process it again.
2743 while test -n "$inmodules"; do
2744 inmodules_this_round
="$inmodules"
2745 inmodules
= # Accumulator, queue for next round
2746 for module
in $inmodules_this_round; do
2748 if test -n "$module"; then
2749 func_append outmodules
" $module"
2750 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
2751 for dep
in $deps; do
2752 func_append inmodules
" $dep"
2756 handledmodules
=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
2757 # Remove $handledmodules from $inmodules.
2758 for m
in $inmodules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/queued-modules
2759 inmodules
=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
2761 rm -f "$tmp"/queued-modules
2762 for m
in $outmodules; do echo $m; done | LC_ALL
=C
sort -u
2765 # func_get_link_directive_recursively module
2767 # - local_gnulib_path from --local-dir
2768 # - modcache true or false, from --cache-modules/--no-cache-modules
2769 func_get_link_directive_recursively
()
2771 # In order to process every module only once (for speed), process an "input
2772 # list" of modules, producing an "output list" of modules. During each round,
2773 # more modules can be queued in the input list. Once a module on the input
2774 # list has been processed, it is added to the "handled list", so we can avoid
2775 # to process it again.
2779 while test -n "$inmodules"; do
2780 inmodules_this_round
="$inmodules"
2781 inmodules
= # Accumulator, queue for next round
2782 for module
in $inmodules_this_round; do
2784 if test -n "$module"; then
2785 if grep '^Link:[ ]*$' "$lookedup_file" >/dev
/null
; then
2786 # The module description has a 'Link:' field. Ignore the dependencies.
2787 func_append outmodules
" $module"
2789 # The module description has no 'Link:' field. Recurse through the dependencies.
2790 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
2791 for dep
in $deps; do
2792 func_append inmodules
" $dep"
2797 handledmodules
=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
2798 # Remove $handledmodules from $inmodules.
2799 for m
in $inmodules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/queued-modules
2800 inmodules
=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
2802 rm -f "$tmp"/queued-modules
2803 for m
in $outmodules; do func_get_link_directive
"$m"; done | LC_ALL
=C
sort -u |
sed -e '/^$/d'
2806 # func_acceptable module
2807 # tests whether a module is acceptable.
2809 # - avoidlist list of modules to avoid
2812 for avoid
in $avoidlist; do
2813 if test "$avoid" = "$1"; then
2820 # sed expression to keep the first 32 characters of each line.
2821 sed_first_32_chars
='s/^\(................................\).*/\1/'
2823 # func_module_shellfunc_name module
2824 # computes the shell function name that will contain the m4 macros for the module.
2826 # - macro_prefix prefix to use
2828 # - shellfunc shell function name
2829 func_module_shellfunc_name
()
2833 shellfunc
=func_
${macro_prefix}_gnulib_m4code_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2835 shellfunc
=func_
${macro_prefix}_gnulib_m4code_
$1 ;;
2839 # func_module_shellvar_name module
2840 # computes the shell variable name the will be set to true once the m4 macros
2841 # for the module have been executed.
2843 # - shellvar shell variable name
2844 func_module_shellvar_name
()
2848 shellvar
=${macro_prefix}_gnulib_enabled_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2850 shellvar
=${macro_prefix}_gnulib_enabled_
$1 ;;
2854 # func_module_conditional_name module
2855 # computes the automake conditional name for the module.
2857 # - conditional name of automake conditional
2858 func_module_conditional_name
()
2862 conditional
=${macro_prefix}_GNULIB_ENABLED_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2864 conditional
=${macro_prefix}_GNULIB_ENABLED_
$1 ;;
2868 # func_uncond_add_module B
2869 # notes the presence of B as an unconditional module.
2871 # func_conddep_add_module A B cond
2872 # notes the presence of a conditional dependency from module A to module B,
2873 # subject to the condition that A is enabled and cond is true.
2875 # func_cond_module_p B
2876 # tests whether module B is conditional.
2878 # func_cond_module_condition A B
2879 # returns the condition when B should be enabled as a dependency of A, once the
2880 # m4 code for A has been executed.
2881 # Output: - condition
2883 if $have_associative; then
2884 declare -A conddep_isuncond
2885 declare -A conddep_dependers
2886 declare -A conddep_condition
2887 func_uncond_add_module
()
2889 eval 'conddep_isuncond[$1]=true'
2890 eval 'unset conddep_dependers[$1]'
2892 func_conddep_add_module
()
2894 eval 'isuncond="${conddep_isuncond[$2]}"'
2895 if test -z "$isuncond"; then
2896 # No unconditional dependency to B known at this point.
2897 eval 'conddep_dependers[$2]="${conddep_dependers[$2]} $1"'
2898 eval 'conddep_condition[$1---$2]="$3"'
2901 func_cond_module_p
()
2903 eval 'previous_dependers="${conddep_dependers[$1]}"'
2904 test -n "$previous_dependers"
2906 func_cond_module_condition
()
2908 eval 'condition="${conddep_condition[$1---$2]}"'
2911 func_uncond_add_module
()
2915 suffix
=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2919 eval 'conddep_isuncond_'"$suffix"'=true'
2920 eval 'unset conddep_dependers_'"$suffix"
2922 func_conddep_add_module
()
2926 suffix
=`echo "$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2930 eval 'isuncond="${conddep_isuncond_'"$suffix"'}"'
2931 if test -z "$isuncond"; then
2932 eval 'conddep_dependers_'"$suffix"'="${conddep_dependers_'"$suffix"'} $1"'
2933 suffix
=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
2934 eval 'conddep_condition_'"$suffix"'="$3"'
2937 func_cond_module_p
()
2941 suffix
=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2945 eval 'previous_dependers="${conddep_dependers_'"$suffix"'}"'
2946 test -n "$previous_dependers"
2948 func_cond_module_condition
()
2950 suffix
=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
2951 eval 'condition="${conddep_condition_'"$suffix"'}"'
2955 # func_modules_transitive_closure
2957 # - local_gnulib_path from --local-dir
2958 # - gnu_make true if --gnu-make was given, false otherwise
2959 # - modcache true or false, from --cache-modules/--no-cache-modules
2960 # - modules list of specified modules
2961 # - inctests true if tests should be included, false otherwise
2962 # - incobsolete true if obsolete modules among dependencies should be
2963 # included, blank otherwise
2964 # - inc_cxx_tests true if C++ interoperability tests should be included,
2966 # - inc_longrunning_tests true if long-runnings tests should be included,
2968 # - inc_privileged_tests true if tests that require root privileges should be
2969 # included, blank otherwise
2970 # - inc_unportable_tests true if tests that fail on some platforms should be
2971 # included, blank otherwise
2972 # - inc_all_direct_tests true if all kinds of problematic unit tests among
2973 # the unit tests of the specified modules should be
2974 # included, blank otherwise
2975 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
2976 # the unit tests of the dependencies should be
2977 # included, blank otherwise
2978 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
2980 # - excl_longrunning_tests true if long-runnings tests should be excluded,
2982 # - excl_privileged_tests true if tests that require root privileges should be
2983 # excluded, blank otherwise
2984 # - excl_unportable_tests true if tests that fail on some platforms should be
2985 # excluded, blank otherwise
2986 # - avoidlist list of modules to avoid
2987 # - cond_dependencies true if conditional dependencies shall be supported,
2989 # - tmp pathname of a temporary directory
2991 # - modules list of modules, including dependencies
2992 # - conddep_dependers, conddep_condition information about conditionally
2994 func_modules_transitive_closure
()
2996 sed_escape_dependency
='s|\([/.]\)|\\\1|g'
2997 # In order to process every module only once (for speed), process an "input
2998 # list" of modules, producing an "output list" of modules. During each round,
2999 # more modules can be queued in the input list. Once a module on the input
3000 # list has been processed, it is added to the "handled list", so we can avoid
3001 # to process it again.
3003 inmodules
="$modules"
3005 fmtc_inc_all_tests
="$inc_all_direct_tests"
3006 if test "$cond_dependencies" = true
; then
3007 for module
in $inmodules; do
3009 if test -n "$module"; then
3010 if func_acceptable
$module; then
3011 func_uncond_add_module
$module
3016 while test -n "$inmodules"; do
3017 inmodules_this_round
="$inmodules"
3018 inmodules
= # Accumulator, queue for next round
3019 for module
in $inmodules_this_round; do
3021 if test -n "$module"; then
3022 if func_acceptable
$module; then
3023 func_append outmodules
" $module"
3024 if test "$cond_dependencies" = true
; then
3026 && func_get_automake_snippet_conditional
$module \
3027 |
grep '^if ' > /dev
/null
; then
3028 # A module whose Makefile.am snippet contains a reference to an
3029 # automake conditional. If we were to use it conditionally, we
3030 # would get an error
3031 # configure: error: conditional "..." was never defined.
3032 # because automake 1.11.1 does not handle nested conditionals
3033 # correctly. As a workaround, make the module unconditional.
3034 func_uncond_add_module
$module
3036 if func_cond_module_p
$module; then
3042 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
3043 # Duplicate dependencies are harmless, but Jim wants a warning.
3044 duplicated_deps
=`echo "$deps" | LC_ALL=C sort | LC_ALL=C uniq -d`
3045 if test -n "$duplicated_deps"; then
3046 func_warning
"module $module has duplicated dependencies: "`echo $duplicated_deps`
3049 testsmodule
=`func_get_tests_module $module`
3050 if test -n "$testsmodule"; then
3051 deps
="$deps $testsmodule"
3054 for dep
in $deps; do
3055 # Determine whether to include the dependency or tests module.
3057 for word
in `func_get_status $dep`; do
3060 test -n "$incobsolete" \
3064 test -z "$excl_cxx_tests" \
3066 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_cxx_tests" \
3070 test -z "$excl_longrunning_tests" \
3072 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_longrunning_tests" \
3076 test -z "$excl_privileged_tests" \
3078 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_privileged_tests" \
3082 test -z "$excl_unportable_tests" \
3084 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_unportable_tests" \
3088 test -n "$fmtc_inc_all_tests" \
3093 if $inc && func_acceptable
"$dep"; then
3094 func_append inmodules
" $dep"
3095 if test "$cond_dependencies" = true
; then
3096 escaped_dep
=`echo "$dep" | sed -e "$sed_escape_dependency"`
3097 sed_extract_condition1
='/^ *'"$escaped_dep"' *$/{
3100 sed_extract_condition2
='/^ *'"$escaped_dep"' *\[.*\] *$/{
3101 s/^ *'"$escaped_dep"' *\[\(.*\)\] *$/\1/p
3103 condition
=`func_get_dependencies $module | sed -n -e "$sed_extract_condition1" -e "$sed_extract_condition2"`
3104 if test "$condition" = true
; then
3107 if test -n "$condition"; then
3108 func_conddep_add_module
"$module" "$dep" "$condition"
3110 if $conditional; then
3111 func_conddep_add_module
"$module" "$dep" true
3113 func_uncond_add_module
"$dep"
3122 handledmodules
=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
3123 # Remove $handledmodules from $inmodules.
3124 for m
in $inmodules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/queued-modules
3125 inmodules
=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
3126 fmtc_inc_all_tests
="$inc_all_indirect_tests"
3128 modules
=`for m in $outmodules; do echo $m; done | LC_ALL=C sort -u`
3129 rm -f "$tmp"/queued-modules
3132 # func_show_module_list
3134 # - specified_modules list of specified modules (one per line, sorted)
3135 # - modules complete list of modules (one per line, sorted)
3136 # - tmp pathname of a temporary directory
3137 func_show_module_list
()
3143 # Assume xterm compatible escape sequences.
3144 bold_on
=`printf '\033[1m'`
3145 bold_off
=`printf '\033[0m'`
3150 echo "Module list with included dependencies (indented):"
3151 echo "$specified_modules" |
sed -e '/^$/d' -e 's/$/| /' > "$tmp"/specified-modules
3152 echo "$modules" |
sed -e '/^$/d' \
3153 | LC_ALL
=C
join -t '|' -a2 "$tmp"/specified-modules
- \
3154 |
sed -e 's/^\(.*\)|.*/|\1/' -e 's/^/ /' -e 's/^ |\(.*\)$/ '"${bold_on}"'\1'"${bold_off}"'/'
3157 # func_modules_transitive_closure_separately
3158 # Determine main module list and tests-related module list separately.
3159 # The main module list is the transitive closure of the specified modules,
3160 # ignoring tests modules. Its lib/* sources go into $sourcebase/. If --lgpl
3161 # is specified, it will consist only of LGPLed source.
3162 # The tests-related module list is the transitive closure of the specified
3163 # modules, including tests modules, minus the main module list excluding
3164 # modules of applicability 'all'. Its lib/* sources (brought in through
3165 # dependencies of *-tests modules) go into $testsbase/. It may contain GPLed
3166 # source, even if --lgpl is specified.
3168 # - local_gnulib_path from --local-dir
3169 # - modcache true or false, from --cache-modules/--no-cache-modules
3170 # - specified_modules list of specified modules
3171 # - inctests true if tests should be included, false otherwise
3172 # - incobsolete true if obsolete modules among dependencies should be
3173 # included, blank otherwise
3174 # - inc_cxx_tests true if C++ interoperability tests should be included,
3176 # - inc_longrunning_tests true if long-runnings tests should be included,
3178 # - inc_privileged_tests true if tests that require root privileges should be
3179 # included, blank otherwise
3180 # - inc_unportable_tests true if tests that fail on some platforms should be
3181 # included, blank otherwise
3182 # - inc_all_direct_tests true if all kinds of problematic unit tests among
3183 # the unit tests of the specified modules should be
3184 # included, blank otherwise
3185 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
3186 # the unit tests of the dependencies should be
3187 # included, blank otherwise
3188 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
3190 # - excl_longrunning_tests true if long-runnings tests should be excluded,
3192 # - excl_privileged_tests true if tests that require root privileges should be
3193 # excluded, blank otherwise
3194 # - excl_unportable_tests true if tests that fail on some platforms should be
3195 # excluded, blank otherwise
3196 # - avoidlist list of modules to avoid
3197 # - cond_dependencies true if conditional dependencies shall be supported,
3199 # - tmp pathname of a temporary directory
3201 # - main_modules list of modules, including dependencies
3202 # - testsrelated_modules list of tests-related modules, including dependencies
3203 # - conddep_dependers, conddep_condition information about conditionally
3205 func_modules_transitive_closure_separately
()
3207 # Determine main module list.
3208 saved_inctests
="$inctests"
3210 modules
="$specified_modules"
3211 func_modules_transitive_closure
3212 main_modules
="$modules"
3213 inctests
="$saved_inctests"
3214 if test $verbose -ge 1; then
3215 echo "Main module list:"
3216 echo "$main_modules" |
sed -e 's/^/ /'
3218 # Determine tests-related module list.
3219 echo "$final_modules" | LC_ALL
=C
sort -u > "$tmp"/final-modules
3220 testsrelated_modules
=`for module in $main_modules; do
3221 if test \`func_get_applicability
$module\
` = main; then
3225 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/final-modules`
3226 # If testsrelated_modules consists only of modules with applicability 'all',
3227 # set it to empty (because such modules are only helper modules for other modules).
3228 have_nontrivial_testsrelated_modules
=
3229 for module
in $testsrelated_modules; do
3230 if test `func_get_applicability $module` != all
; then
3231 have_nontrivial_testsrelated_modules
=yes
3235 if test -z "$have_nontrivial_testsrelated_modules"; then
3236 testsrelated_modules
=
3238 if test $verbose -ge 1; then
3239 echo "Tests-related module list:"
3240 echo "$testsrelated_modules" |
sed -e 's/^/ /'
3244 # func_determine_use_libtests
3245 # Determines whether a $testsbase/libtests.a is needed.
3247 # - local_gnulib_path from --local-dir
3248 # - modcache true or false, from --cache-modules/--no-cache-modules
3249 # - testsrelated_modules list of tests-related modules, including dependencies
3251 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
3252 func_determine_use_libtests
()
3255 for module
in $testsrelated_modules; do
3256 func_verify_nontests_module
3257 if test -n "$module"; then
3258 all_files
=`func_get_filelist $module`
3259 # Test whether some file in $all_files lies in lib/.
3260 for f
in $all_files; do
3272 # func_modules_add_dummy
3274 # - local_gnulib_path from --local-dir
3275 # - modcache true or false, from --cache-modules/--no-cache-modules
3276 # - modules list of modules, including dependencies
3278 # - modules list of modules, including 'dummy' if needed
3279 func_modules_add_dummy
()
3281 # Determine whether any module provides a lib_SOURCES augmentation.
3283 for module
in $modules; do
3284 func_verify_nontests_module
3285 if test -n "$module"; then
3286 if test "$cond_dependencies" = true
&& func_cond_module_p
$module; then
3287 # Ignore conditional modules, since they are not guaranteed to
3288 # contribute to lib_SOURCES.
3291 # Extract the value of "lib_SOURCES += ...".
3292 for file in `func_get_automake_snippet "$module" | combine_lines |
3293 sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'`; do
3294 # Ignore .h files since they are not compiled.
3298 have_lib_SOURCES
=yes
3306 # Add the dummy module, to make sure the library will be non-empty.
3307 if test -z "$have_lib_SOURCES"; then
3308 if func_acceptable
"dummy"; then
3309 func_append modules
" dummy"
3314 # func_modules_add_dummy_separately
3316 # - local_gnulib_path from --local-dir
3317 # - modcache true or false, from --cache-modules/--no-cache-modules
3318 # - main_modules list of modules, including dependencies
3319 # - testsrelated_modules list of tests-related modules, including dependencies
3320 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
3322 # - main_modules list of modules, including 'dummy' if needed
3323 # - testsrelated_modules list of tests-related modules, including 'dummy' if
3325 func_modules_add_dummy_separately
()
3327 # Add the dummy module to the main module list if needed.
3328 modules
="$main_modules"
3329 func_modules_add_dummy
3330 main_modules
="$modules"
3332 # Add the dummy module to the tests-related module list if needed.
3333 if $use_libtests; then
3334 modules
="$testsrelated_modules"
3335 func_modules_add_dummy
3336 testsrelated_modules
="$modules"
3340 # func_modules_notice
3342 # - local_gnulib_path from --local-dir
3343 # - modcache true or false, from --cache-modules/--no-cache-modules
3344 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
3345 # - modules list of modules, including dependencies
3346 func_modules_notice
()
3348 if test $verbose -ge -1; then
3349 for module
in $modules; do
3351 if test -n "$module"; then
3352 msg
=`func_get_notice $module`
3353 if test -n "$msg"; then
3354 echo "Notice from module $module:"
3355 echo "$msg" |
sed -e 's/^/ /'
3362 # func_modules_to_filelist
3364 # - local_gnulib_path from --local-dir
3365 # - modcache true or false, from --cache-modules/--no-cache-modules
3366 # - modules list of modules, including dependencies
3368 # - files list of files
3369 func_modules_to_filelist
()
3372 for module
in $modules; do
3374 if test -n "$module"; then
3375 fs
=`func_get_filelist $module`
3376 func_append files
" $fs"
3379 files
=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
3382 # func_modules_to_filelist_separately
3383 # Determine the final file lists.
3384 # They must be computed separately, because files in lib/* go into
3385 # $sourcebase/ if they are in the main file list but into $testsbase/
3386 # if they are in the tests-related file list. Furthermore lib/dummy.c
3389 # - local_gnulib_path from --local-dir
3390 # - modcache true or false, from --cache-modules/--no-cache-modules
3391 # - main_modules list of modules, including dependencies
3392 # - testsrelated_modules list of tests-related modules, including dependencies
3393 func_modules_to_filelist_separately
()
3395 # Determine final main file list.
3396 modules
="$main_modules"
3397 func_modules_to_filelist
3399 # Determine final tests-related file list.
3400 modules
="$testsrelated_modules"
3401 func_modules_to_filelist
3402 testsrelated_files
=`echo "$files" | sed -e 's,^lib/,tests=lib/,'`
3403 # Merge both file lists.
3404 sed_remove_empty_lines
='/^$/d'
3405 files
=`{ echo "$main_files"; echo "$testsrelated_files"; } | sed -e "$sed_remove_empty_lines" | LC_ALL=C sort -u`
3406 if test $verbose -ge 0; then
3408 sed_prettyprint_files
='s,^tests=lib/\(.*\)$,lib/\1 -> tests/\1,'
3409 echo "$files" |
sed -e "$sed_prettyprint_files" -e 's/^/ /'
3413 # func_compute_include_guard_prefix
3414 # Determine include_guard_prefix.
3416 # - macro_prefix prefix of gl_LIBOBJS macros to use
3418 # - include_guard_prefix replacement for ${gl_include_guard_prefix}
3419 # - sed_replace_include_guard_prefix
3420 # sed expression for resolving ${gl_include_guard_prefix}
3421 func_compute_include_guard_prefix
()
3423 if test "$macro_prefix" = gl
; then
3424 include_guard_prefix
='GL'
3426 include_guard_prefix
='GL_'`echo "$macro_prefix" | LC_ALL=C tr '[a-z]' '[A-Z]'`
3428 sed_replace_include_guard_prefix
='s/\${gl_include_guard_prefix}/'"${include_guard_prefix}"'/g'
3431 # func_execute_command command [args...]
3432 # Executes a command.
3433 # Uses also the variables
3434 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
3435 func_execute_command
()
3437 if test $verbose -ge 0; then
3441 # Commands like automake produce output to stderr even when they succeed.
3442 # Turn this output off if the command succeeds.
3443 "$@" > "$tmp"/cmdout
2>&1
3445 if test $cmdret = 0; then
3449 cat "$tmp"/cmdout
1>&2
3456 # func_dest_tmpfilename file
3457 # determines the name of a temporary file (file is relative to destdir).
3459 # - destdir target directory
3460 # - doit : if actions shall be executed, false if only to be printed
3461 # - tmp pathname of a temporary directory
3463 # - tmpfile absolute filename of the temporary file
3464 func_dest_tmpfilename
()
3467 # Put the new contents of $file in a file in the same directory (needed
3468 # to guarantee that an 'mv' to "$destdir/$file" works).
3469 tmpfile
="$destdir/$1.tmp"
3471 # Put the new contents of $file in a file in a temporary directory
3472 # (because the directory of "$file" might not exist).
3473 tmpfile
="$tmp"/`basename "$1"`.tmp
3477 # func_is_local_file lookedup_file file
3478 # check whether file should be instantiated from local gnulib directory
3479 func_is_local_file
()
3482 func_remove_suffix dname
"/$2"
3483 func_path_foreach
"$local_gnulib_path" test %dir
% = "$dname"
3487 # determines whether the file $f should be copied, symlinked, or hardlinked.
3489 # - copymode copy mode for files in general
3490 # - lcopymode copy mode for files from local_gnulib_path
3491 # - f the original file name
3492 # - lookedup_file name of the merged (combined) file
3494 # - copyaction copy or symlink or hardlink
3497 if test -n "$lcopymode" && func_is_local_file
"$lookedup_file" "$f"; then
3498 copyaction
="$lcopymode"
3500 if test -n "$copymode"; then
3501 copyaction
="$copymode"
3509 # copies a file from gnulib into the destination directory. The destination
3510 # is known to not exist.
3512 # - destdir target directory
3513 # - local_gnulib_path from --local-dir
3514 # - modcache true or false, from --cache-modules/--no-cache-modules
3515 # - f the original file name
3516 # - lookedup_file name of the merged (combined) file
3517 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
3518 # - g the rewritten file name
3519 # - tmpfile absolute filename of the temporary file
3520 # - doit : if actions shall be executed, false if only to be printed
3521 # - copymode copy mode for files in general
3522 # - lcopymode copy mode for files from local_gnulib_path
3526 echo "Copying file $g"
3528 if test "$copyaction" = symlink \
3529 && test -z "$lookedup_tmp" \
3530 && cmp -s "$lookedup_file" "$tmpfile"; then
3531 func_symlink_if_changed
"$lookedup_file" "$destdir/$g"
3533 if test "$copyaction" = hardlink \
3534 && test -z "$lookedup_tmp" \
3535 && cmp -s "$lookedup_file" "$tmpfile"; then
3536 func_hardlink
"$lookedup_file" "$destdir/$g"
3538 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error
"failed"
3547 # copies a file from gnulib into the destination directory. The destination
3548 # is known to exist.
3550 # - destdir target directory
3551 # - local_gnulib_path from --local-dir
3552 # - modcache true or false, from --cache-modules/--no-cache-modules
3553 # - f the original file name
3554 # - lookedup_file name of the merged (combined) file
3555 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
3556 # - g the rewritten file name
3557 # - tmpfile absolute filename of the temporary file
3558 # - doit : if actions shall be executed, false if only to be printed
3559 # - copymode copy mode for files in general
3560 # - lcopymode copy mode for files from local_gnulib_path
3561 # - already_present nonempty if the file should already exist, empty otherwise
3564 if cmp -s "$destdir/$g" "$tmpfile"; then
3565 : # The file has not changed.
3569 if test -n "$already_present"; then
3570 echo "Updating file $g (backup in ${g}~)"
3572 echo "Replacing file $g (non-gnulib code backed up in ${g}~) !!"
3574 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error
"failed"
3576 if test "$copyaction" = symlink \
3577 && test -z "$lookedup_tmp" \
3578 && cmp -s "$lookedup_file" "$tmpfile"; then
3579 func_symlink_if_changed
"$lookedup_file" "$destdir/$g"
3581 if test "$copyaction" = hardlink \
3582 && test -z "$lookedup_tmp" \
3583 && cmp -s "$lookedup_file" "$tmpfile"; then
3584 func_hardlink
"$lookedup_file" "$destdir/$g"
3586 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error
"failed"
3590 if test -n "$already_present"; then
3591 echo "Update file $g (backup in ${g}~)"
3593 echo "Replace file $g (non-gnulib code backed up in ${g}~) !!"
3599 # func_emit_lib_Makefile_am
3600 # emits the contents of library makefile to standard output.
3602 # - local_gnulib_path from --local-dir
3603 # - modcache true or false, from --cache-modules/--no-cache-modules
3604 # - modules list of modules, including dependencies
3605 # - libname library name
3606 # - pobase directory relative to destdir where to place *.po files
3607 # - auxdir directory relative to destdir where to place build aux files
3608 # - gnu_make true if --gnu-make was given, false otherwise
3609 # - makefile_name from --makefile-name
3610 # - libtool true if libtool will be used, false or blank otherwise
3611 # - macro_prefix prefix of gl_LIBOBJS macros to use
3612 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
3613 # - witness_c_macro from --witness-c-macro
3614 # - actioncmd (optional) command that will reproduce this invocation
3615 # - for_test true if creating a package for testing, false otherwise
3616 # - sed_replace_include_guard_prefix
3617 # sed expression for resolving ${gl_include_guard_prefix}
3618 # - destfile filename relative to destdir of makefile being generated
3620 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val,dotfirst}
3621 # list of edits to be done to Makefile.am variables
3623 # - uses_subdirs nonempty if object files in subdirs exist
3624 func_emit_lib_Makefile_am
()
3627 # When using GNU make, or when creating an includable Makefile.am snippet,
3628 # augment variables with += instead of assigning them.
3629 if $gnu_make ||
test -n "$makefile_name"; then
3634 if test "$libtool" = true
; then
3637 sed_eliminate_LDFLAGS
="$sed_noop"
3641 sed_eliminate_LDFLAGS
='/^lib_LDFLAGS[ ]*+=/d'
3644 # When creating a package for testing: Attempt to provoke failures,
3645 # especially link errors, already during "make" rather than during
3646 # "make check", because "make check" is not possible in a cross-compiling
3647 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
3648 sed_transform_check_PROGRAMS
='s,check_PROGRAMS,noinst_PROGRAMS,g'
3650 sed_transform_check_PROGRAMS
="$sed_noop"
3652 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3654 echo "## Process this file with automake to produce Makefile.in."
3655 func_emit_copyright_notice
3656 if test -n "$actioncmd"; then
3657 printf '# Reproduce by:\n%s\n' "$actioncmd"
3662 for module
in $modules; do
3663 func_verify_nontests_module
3664 if test -n "$module"; then
3666 func_get_automake_snippet_conditional
"$module" |
3668 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
3669 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
3670 -e "$sed_eliminate_LDFLAGS" \
3671 -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' \
3672 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
3673 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
3674 -e "$sed_transform_check_PROGRAMS" \
3675 -e "$sed_replace_include_guard_prefix"
3676 if test "$module" = 'alloca'; then
3677 echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
3678 echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@"
3680 } | combine_lines
"${libname}_${libext}_SOURCES" > "$tmp"/amsnippet1
3682 func_get_automake_snippet_unconditional
"$module" |
3683 LC_ALL
=C
sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g'
3684 } > "$tmp"/amsnippet2
3685 # Skip the contents if it's entirely empty.
3686 if grep '[^ ]' "$tmp"/amsnippet1
"$tmp"/amsnippet2
> /dev
/null
; then
3687 echo "## begin gnulib module $module"
3689 echo "ifeq (,\$(OMIT_GNULIB_MODULE_$module))"
3690 convert_to_gnu_make
='s/^if \(.*\)/ifneq (,$(\1))/'
3692 convert_to_gnu_make
=
3695 if test "$cond_dependencies" = true
; then
3696 if func_cond_module_p
"$module"; then
3697 func_module_conditional_name
"$module"
3699 echo "ifneq (,\$($conditional))"
3701 echo "if $conditional"
3705 sed "$convert_to_gnu_make" "$tmp"/amsnippet1
3706 if test "$cond_dependencies" = true
; then
3707 if func_cond_module_p
"$module"; then
3711 sed "$convert_to_gnu_make" "$tmp"/amsnippet2
3715 echo "## end gnulib module $module"
3718 rm -f "$tmp"/amsnippet1
"$tmp"/amsnippet2
3719 # Test whether there are some source files in subdirectories.
3720 for f
in `func_get_filelist "$module"`; do
3730 } > "$tmp"/allsnippets
3731 if test -z "$makefile_name"; then
3732 # If there are source files in subdirectories, prevent collision of the
3733 # object files (example: hash.c and libxml/hash.c).
3735 if test -n "$uses_subdirs"; then
3736 subdir_options
=' subdir-objects'
3738 echo "AUTOMAKE_OPTIONS = 1.11 gnits${subdir_options}"
3741 if test -z "$makefile_name"; then
3743 echo "noinst_HEADERS ="
3744 echo "noinst_LIBRARIES ="
3745 echo "noinst_LTLIBRARIES ="
3746 # Automake versions < 1.11.4 create an empty pkgdatadir at
3747 # installation time if you specify pkgdata_DATA to empty.
3748 # See automake bugs #10997 and #11030:
3749 # * https://debbugs.gnu.org/10997
3750 # * https://debbugs.gnu.org/11030
3751 # So we need this workaround.
3752 if grep '^pkgdata_DATA *+=' "$tmp"/allsnippets
> /dev
/null
; then
3753 echo "pkgdata_DATA ="
3756 echo "BUILT_SOURCES ="
3759 echo "MOSTLYCLEANFILES $assign core *.stackdump"
3760 if test -z "$makefile_name"; then
3761 echo "MOSTLYCLEANDIRS ="
3763 echo "DISTCLEANFILES ="
3764 echo "MAINTAINERCLEANFILES ="
3767 echo "# Start of GNU Make output."
3769 # Put autoconf output into a temporary file, so that its exit status
3770 # can be checked from the shell. Signal any error by putting a
3771 # syntax error into the output makefile.
3772 ${AUTOCONF} -t 'AC_SUBST:$1 = @$1@' "$configure_ac" \
3773 >"$tmp"/makeout
2>"$tmp"/makeout2
&&
3774 LC_ALL
=C
sort -u "$tmp"/makeout ||
{
3775 echo "== gnulib-tool GNU Make output failed as follows =="
3776 sed 's/^/# stderr: /' "$tmp"/makeout2
3778 rm -f "$tmp"/makeout
"$tmp"/makeout2
3780 echo "# End of GNU Make output."
3782 echo "# No GNU Make output."
3784 # Execute edits that apply to the Makefile.am being generated.
3786 while test $edit != $makefile_am_edits; do
3787 edit
=`expr $edit + 1`
3788 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
3789 eval var
=\"\
$makefile_am_edit${edit}_var
\"
3790 eval val
=\"\
$makefile_am_edit${edit}_val
\"
3791 eval dotfirst
=\"\
$makefile_am_edit${edit}_dotfirst
\"
3792 if test -n "$var"; then
3793 if test "${dir}Makefile.am" = "$destfile" ||
test "./${dir}Makefile.am" = "$destfile"; then
3794 if test "${var}" = SUBDIRS
&& test -n "$dotfirst"; then
3795 # The added subdirectory ${val} needs to be mentioned after '.'.
3796 # Since we don't have '.' among SUBDIRS so far, add it now.
3799 echo "${var} += ${val}"
3800 eval "makefile_am_edit${edit}_var="
3804 if test -n "$witness_c_macro"; then
3805 cppflags_part1
=" -D$witness_c_macro=1"
3810 cppflags_part2
=" -DGNULIB_STRICT_CHECKING=1"
3814 if test -z "$makefile_name"; then
3816 echo "AM_CPPFLAGS =$cppflags_part1$cppflags_part2"
3819 if test -n "$cppflags_part1$cppflags_part2"; then
3821 echo "AM_CPPFLAGS +=$cppflags_part1$cppflags_part2"
3825 if LC_ALL
=C
grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$tmp"/allsnippets
> /dev
/null \
3826 ||
{ test -n "$makefile_name" \
3827 && test -f "$sourcebase/Makefile.am" \
3828 && LC_ALL
=C
grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$sourcebase/Makefile.am" > /dev
/null
; \
3830 # One of the snippets or the user's Makefile.am already specifies an
3831 # installation location for the library. Don't confuse automake by saying
3832 # it should not be installed.
3835 # By default, the generated library should not be installed.
3836 echo "noinst_${perhapsLT}LIBRARIES += $libname.$libext"
3839 echo "${libname}_${libext}_SOURCES ="
3840 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
3841 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
3842 echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
3843 echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
3844 echo "EXTRA_${libname}_${libext}_SOURCES ="
3845 if test "$libtool" = true
; then
3846 echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)"
3847 echo "${libname}_${libext}_LDFLAGS += -no-undefined"
3848 # Synthesize an ${libname}_${libext}_LDFLAGS augmentation by combining
3849 # the link dependencies of all modules.
3850 for module
in $modules; do
3851 func_verify_nontests_module
3852 if test -n "$module"; then
3853 func_get_link_directive
"$module"
3856 | LC_ALL
=C
sed -e '/^$/d' -e 's/ when linking with libtool.*//' \
3857 | LC_ALL
=C
sort -u \
3858 | LC_ALL
=C
sed -e 's/^/'"${libname}_${libext}"'_LDFLAGS += /'
3861 if test -n "$pobase"; then
3862 echo "AM_CPPFLAGS += -DDEFAULT_TEXT_DOMAIN=\\\"${po_domain}-gnulib\\\""
3865 cat "$tmp"/allsnippets \
3866 |
sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
3868 echo "mostlyclean-local: mostlyclean-generic"
3869 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
3870 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
3871 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
3875 rm -f "$tmp"/allsnippets
3878 # func_emit_po_Makevars
3879 # emits the contents of po/ makefile parameterization to standard output.
3881 # - local_gnulib_path from --local-dir
3882 # - modcache true or false, from --cache-modules/--no-cache-modules
3883 # - sourcebase directory relative to destdir where to place source code
3884 # - pobase directory relative to destdir where to place *.po files
3885 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
3886 func_emit_po_Makevars
()
3888 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3889 func_emit_copyright_notice
3891 echo "# Usually the message domain is the same as the package name."
3892 echo "# But here it has a '-gnulib' suffix."
3893 echo "DOMAIN = ${po_domain}-gnulib"
3895 echo "# These two variables depend on the location of this directory."
3896 echo "subdir = ${pobase}"
3897 echo "top_builddir = "`echo "$pobase" | sed -e 's,//*,/,g' -e 's,[^/][^/]*,..,g'`
3900 # These options get passed to xgettext.
3901 XGETTEXT_OPTIONS
= \
3902 --keyword=_
--flag=_
:1:pass-c-format \
3903 --keyword=N_
--flag=N_
:1:pass-c-format \
3904 --keyword='proper_name:1,"This is a proper name. See the gettext manual, section Names."' \
3905 --keyword='proper_name_utf8:1,"This is a proper name. See the gettext manual, section Names."' \
3906 --flag=error
:3:c-format
--flag=error_at_line
:5:c-format
3908 # This is the copyright holder that gets inserted into the header of the
3909 # $(DOMAIN).pot file. gnulib is copyrighted by the FSF.
3910 COPYRIGHT_HOLDER
= Free Software Foundation
, Inc.
3912 # This is the email address or URL to which the translators shall report
3913 # bugs in the untranslated strings:
3914 # - Strings which are not entire sentences, see the maintainer guidelines
3915 # in the GNU gettext documentation, section 'Preparing Strings'.
3916 # - Strings which use unclear terms or require additional context to be
3918 # - Strings which make invalid assumptions about notation of date, time or
3920 # - Pluralisation problems.
3921 # - Incorrect English spelling.
3922 # - Incorrect formatting.
3923 # It can be your email address, or a mailing list address where translators
3924 # can write to without being subscribed, or the URL of a web page through
3925 # which the translators can contact you.
3926 MSGID_BUGS_ADDRESS
= bug-gnulib@gnu.org
3928 # This is the list of locale categories, beyond LC_MESSAGES, for which the
3929 # message catalogs shall be used. It is usually empty.
3930 EXTRA_LOCALE_CATEGORIES
=
3932 # This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
3933 # context. Possible values are "yes" and "no". Set this to yes if the
3934 # package uses functions taking also a message context, like pgettext(), or
3935 # if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
3940 # func_emit_po_POTFILES_in
3941 # emits the file list to be passed to xgettext to standard output.
3943 # - local_gnulib_path from --local-dir
3944 # - modcache true or false, from --cache-modules/--no-cache-modules
3945 # - sourcebase directory relative to destdir where to place source code
3946 # - files list of new files
3947 func_emit_po_POTFILES_in
()
3949 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3950 func_emit_copyright_notice
3952 echo "# List of files which contain translatable strings."
3953 echo "$files" |
sed -n -e "s,^lib/,$sourcebase/,p"
3956 # func_emit_tests_Makefile_am witness_macro
3957 # emits the contents of tests makefile to standard output.
3959 # - local_gnulib_path from --local-dir
3960 # - modcache true or false, from --cache-modules/--no-cache-modules
3961 # - modules list of modules, including dependencies
3962 # - libname library name
3963 # - auxdir directory relative to destdir where to place build aux files
3964 # - gnu_make true if --gnu-make was given, false otherwise
3965 # - makefile_name from --makefile-name
3966 # - libtool true if libtool will be used, false or blank otherwise
3967 # - sourcebase relative directory containing lib source code
3968 # - m4base relative directory containing autoconf macros
3969 # - testsbase relative directory containing unit test code
3970 # - macro_prefix prefix of gl_LIBOBJS macros to use
3971 # - witness_c_macro from --witness-c-macro
3972 # - for_test true if creating a package for testing, false otherwise
3973 # - single_configure true if a single configure file should be generated,
3974 # false for a separate configure file for the tests
3975 # - use_libtests true if a libtests.a should be built, false otherwise
3976 # - sed_replace_include_guard_prefix
3977 # sed expression for resolving ${gl_include_guard_prefix}
3978 # - destfile filename relative to destdir of makefile being generated
3980 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val,dotfirst}
3981 # list of edits to be done to Makefile.am variables
3983 # - uses_subdirs nonempty if object files in subdirs exist
3984 func_emit_tests_Makefile_am
()
3987 if test "$libtool" = true
; then
3990 sed_eliminate_LDFLAGS
="$sed_noop"
3994 sed_eliminate_LDFLAGS
='/^lib_LDFLAGS[ ]*+=/d'
3997 # When creating a package for testing: Attempt to provoke failures,
3998 # especially link errors, already during "make" rather than during
3999 # "make check", because "make check" is not possible in a cross-compiling
4000 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
4001 sed_transform_check_PROGRAMS
='s,check_PROGRAMS,noinst_PROGRAMS,g'
4003 sed_transform_check_PROGRAMS
="$sed_noop"
4005 testsbase_inverse
=`echo "$testsbase" | sed -e 's,/$,,' | sed -e 's,[^/][^/]*,..,g'`
4006 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
4007 echo "## Process this file with automake to produce Makefile.in."
4008 func_emit_copyright_notice
4012 for module
in $modules; do
4013 if $for_test && ! $single_configure; then
4014 func_verify_tests_module
4018 if test -n "$module"; then
4020 func_get_automake_snippet
"$module" |
4022 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
4023 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
4024 -e "$sed_eliminate_LDFLAGS" \
4025 -e 's,lib_\([A-Z][A-Z]*\),libtests_a_\1,g' \
4026 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
4027 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
4028 -e "$sed_transform_check_PROGRAMS" \
4029 -e "$sed_replace_include_guard_prefix"
4030 if $use_libtests && test "$module" = 'alloca'; then
4031 echo "libtests_a_LIBADD += @ALLOCA@"
4032 echo "libtests_a_DEPENDENCIES += @ALLOCA@"
4034 } > "$tmp"/amsnippet
4035 # Skip the contents if it's entirely empty.
4036 if grep '[^ ]' "$tmp"/amsnippet
> /dev
/null
; then
4037 # Mention long-running tests at the end.
4039 for word
in `func_get_status "$module"`; do
4040 if test "$word" = 'longrunning-test'; then
4045 { echo "## begin gnulib module $module"
4047 echo "ifeq (,\$(OMIT_GNULIB_MODULE_$module))"
4050 cat "$tmp"/amsnippet
4054 echo "## end gnulib module $module"
4058 rm -f "$tmp"/amsnippet
4059 # Test whether there are some source files in subdirectories.
4060 for f
in `func_get_filelist "$module"`; do
4062 lib
/*/*.c |
tests
/*/*.c
)
4070 } 3> "$tmp"/main_snippets
4> "$tmp"/longrunning_snippets
4071 # Generate dependencies here, since it eases the debugging of test failures.
4072 # If there are source files in subdirectories, prevent collision of the
4073 # object files (example: hash.c and libxml/hash.c).
4075 if test -n "$uses_subdirs"; then
4076 subdir_options
=' subdir-objects'
4078 echo "AUTOMAKE_OPTIONS = 1.11 foreign${subdir_options}"
4080 if $for_test && ! $single_configure; then
4081 echo "ACLOCAL_AMFLAGS = -I ${testsbase_inverse}/${m4base}"
4084 # Nothing is being added to SUBDIRS; nevertheless the existence of this
4085 # variable is needed to avoid an error from automake:
4086 # "AM_GNU_GETTEXT used but SUBDIRS not defined"
4089 echo "XFAIL_TESTS ="
4090 echo "TESTS_ENVIRONMENT ="
4091 echo "noinst_PROGRAMS ="
4092 if ! $for_test; then
4093 echo "check_PROGRAMS ="
4095 echo "EXTRA_PROGRAMS ="
4096 echo "noinst_HEADERS ="
4097 echo "noinst_LIBRARIES ="
4098 if $use_libtests; then
4100 echo "noinst_LIBRARIES += libtests.a"
4102 echo "check_LIBRARIES = libtests.a"
4105 # Automake versions < 1.11.4 create an empty pkgdatadir at
4106 # installation time if you specify pkgdata_DATA to empty.
4107 # See automake bugs #10997 and #11030:
4108 # * https://debbugs.gnu.org/10997
4109 # * https://debbugs.gnu.org/11030
4110 # So we need this workaround.
4111 if grep '^pkgdata_DATA *+=' "$tmp"/main_snippets
"$tmp"/longrunning_snippets
> /dev
/null
; then
4112 echo "pkgdata_DATA ="
4115 echo "BUILT_SOURCES ="
4117 echo "MOSTLYCLEANFILES = core *.stackdump"
4118 echo "MOSTLYCLEANDIRS ="
4120 echo "DISTCLEANFILES ="
4121 echo "MAINTAINERCLEANFILES ="
4122 # Execute edits that apply to the Makefile.am being generated.
4124 while test $edit != $makefile_am_edits; do
4125 edit
=`expr $edit + 1`
4126 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
4127 eval var
=\"\
$makefile_am_edit${edit}_var
\"
4128 eval val
=\"\
$makefile_am_edit${edit}_val
\"
4129 eval dotfirst
=\"\
$makefile_am_edit${edit}_dotfirst
\"
4130 if test -n "$var"; then
4131 if test "${dir}Makefile.am" = "$destfile" ||
test "./${dir}Makefile.am" = "$destfile"; then
4132 if test "${var}" = SUBDIRS
&& test -n "$dotfirst"; then
4133 # The added subdirectory ${val} needs to be mentioned after '.'.
4134 # But we have '.' among SUBDIRS already, so do nothing.
4137 echo "${var} += ${val}"
4138 eval "makefile_am_edit${edit}_var="
4143 echo "AM_CPPFLAGS = \\"
4145 echo " -DGNULIB_STRICT_CHECKING=1 \\"
4147 if test -n "$witness_c_macro"; then
4148 echo " -D$witness_c_macro=1 \\"
4150 if test -n "${witness_macro}"; then
4151 echo " -D@${witness_macro}@=1 \\"
4153 echo " -I. -I\$(srcdir) \\"
4154 echo " -I${testsbase_inverse} -I\$(srcdir)/${testsbase_inverse} \\"
4155 echo " -I${testsbase_inverse}/${sourcebase-lib} -I\$(srcdir)/${testsbase_inverse}/${sourcebase-lib}"
4157 local_ldadd_before
=''
4158 local_ldadd_after
=''
4159 if $use_libtests; then
4160 # All test programs need to be linked with libtests.a.
4161 # It needs to be passed to the linker before ${libname}.${libext}, since
4162 # the tests-related modules depend on the main modules.
4163 # It also needs to be passed to the linker after ${libname}.${libext}
4164 # because the latter might contain incomplete modules (such as the 'error'
4165 # module whose dependency to 'progname' is voluntarily omitted).
4166 # The LIBTESTS_LIBDEPS can be passed to the linker once or twice, it does
4168 local_ldadd_before
=' libtests.a'
4169 local_ldadd_after
=' libtests.a $(LIBTESTS_LIBDEPS)'
4171 echo "LDADD =${local_ldadd_before} ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext}${local_ldadd_after}"
4173 if $use_libtests; then
4174 echo "libtests_a_SOURCES ="
4175 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
4176 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
4177 echo "libtests_a_LIBADD = \$(${macro_prefix}tests_LIBOBJS)"
4178 echo "libtests_a_DEPENDENCIES = \$(${macro_prefix}tests_LIBOBJS)"
4179 echo "EXTRA_libtests_a_SOURCES ="
4180 # The circular dependency in LDADD requires this.
4181 echo "AM_LIBTOOLFLAGS = --preserve-dup-deps"
4184 # Many test scripts use ${EXEEXT} or ${srcdir}.
4185 # EXEEXT is defined by AC_PROG_CC through autoconf.
4186 # srcdir is defined by autoconf and automake.
4187 echo "TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='\$(srcdir)'"
4189 cat "$tmp"/main_snippets
"$tmp"/longrunning_snippets \
4190 |
sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
4191 echo "# Clean up after Solaris cc."
4193 echo " rm -rf SunWS_cache"
4195 echo "mostlyclean-local: mostlyclean-generic"
4196 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
4197 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
4198 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
4202 rm -f "$tmp"/main_snippets
"$tmp"/longrunning_snippets
4205 # func_emit_initmacro_start macro_prefix
4206 # emits the first few statements of the gl_INIT macro to standard output.
4207 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4208 func_emit_initmacro_start
()
4210 macro_prefix_arg
="$1"
4211 # Overriding AC_LIBOBJ and AC_REPLACE_FUNCS has the effect of storing
4212 # platform-dependent object files in ${macro_prefix_arg}_LIBOBJS instead of
4213 # LIBOBJS. The purpose is to allow several gnulib instantiations under
4214 # a single configure.ac file. (AC_CONFIG_LIBOBJ_DIR does not allow this
4216 # Furthermore it avoids an automake error like this when a Makefile.am
4217 # that uses pieces of gnulib also uses $(LIBOBJ):
4218 # automatically discovered file `error.c' should not be explicitly mentioned
4219 echo " m4_pushdef([AC_LIBOBJ], m4_defn([${macro_prefix_arg}_LIBOBJ]))"
4220 echo " m4_pushdef([AC_REPLACE_FUNCS], m4_defn([${macro_prefix_arg}_REPLACE_FUNCS]))"
4221 # Overriding AC_LIBSOURCES has the same purpose of avoiding the automake
4222 # error when a Makefile.am that uses pieces of gnulib also uses $(LIBOBJ):
4223 # automatically discovered file `error.c' should not be explicitly mentioned
4224 # We let automake know about the files to be distributed through the
4225 # EXTRA_lib_SOURCES variable.
4226 echo " m4_pushdef([AC_LIBSOURCES], m4_defn([${macro_prefix_arg}_LIBSOURCES]))"
4227 # Create data variables for checking the presence of files that are mentioned
4228 # as AC_LIBSOURCES arguments. These are m4 variables, not shell variables,
4229 # because we want the check to happen when the configure file is created,
4230 # not when it is run. ${macro_prefix_arg}_LIBSOURCES_LIST is the list of
4231 # files to check for. ${macro_prefix_arg}_LIBSOURCES_DIR is the subdirectory
4232 # in which to expect them.
4233 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_LIST], [])"
4234 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_DIR], [])"
4238 # func_emit_initmacro_end macro_prefix
4239 # emits the last few statements of the gl_INIT macro to standard output.
4240 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4241 func_emit_initmacro_end
()
4243 macro_prefix_arg
="$1"
4244 # Check the presence of files that are mentioned as AC_LIBSOURCES arguments.
4245 # The check is performed only when autoconf is run from the directory where
4246 # the configure.ac resides; if it is run from a different directory, the
4248 echo " m4_ifval(${macro_prefix_arg}_LIBSOURCES_LIST, ["
4249 echo " m4_syscmd([test ! -d ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[ ||"
4250 echo " for gl_file in ]${macro_prefix_arg}_LIBSOURCES_LIST[ ; do"
4251 echo " if test ! -r ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file ; then"
4252 echo " echo \"missing file ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file\" >&2"
4256 echo " m4_if(m4_sysval, [0], [],"
4257 echo " [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])"
4259 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_DIR])"
4260 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_LIST])"
4261 echo " m4_popdef([AC_LIBSOURCES])"
4262 echo " m4_popdef([AC_REPLACE_FUNCS])"
4263 echo " m4_popdef([AC_LIBOBJ])"
4264 echo " AC_CONFIG_COMMANDS_PRE(["
4265 echo " ${macro_prefix_arg}_libobjs="
4266 echo " ${macro_prefix_arg}_ltlibobjs="
4267 echo " if test -n \"\$${macro_prefix_arg}_LIBOBJS\"; then"
4268 echo " # Remove the extension."
4269 echo " sed_drop_objext='s/\\.o\$//;s/\\.obj\$//'"
4270 echo " for i in \`for i in \$${macro_prefix_arg}_LIBOBJS; do echo \"\$i\"; done | sed -e \"\$sed_drop_objext\" | sort | uniq\`; do"
4271 echo " ${macro_prefix_arg}_libobjs=\"\$${macro_prefix_arg}_libobjs \$i.\$ac_objext\""
4272 echo " ${macro_prefix_arg}_ltlibobjs=\"\$${macro_prefix_arg}_ltlibobjs \$i.lo\""
4275 echo " AC_SUBST([${macro_prefix_arg}_LIBOBJS], [\$${macro_prefix_arg}_libobjs])"
4276 echo " AC_SUBST([${macro_prefix_arg}_LTLIBOBJS], [\$${macro_prefix_arg}_ltlibobjs])"
4280 # func_emit_initmacro_done macro_prefix sourcebase
4281 # emits a few statements after the gl_INIT macro to standard output.
4282 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4283 # - sourcebase directory relative to destdir where to place source code
4284 func_emit_initmacro_done
()
4286 macro_prefix_arg
="$1"
4289 echo "# Like AC_LIBOBJ, except that the module name goes"
4290 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
4291 echo "AC_DEFUN([${macro_prefix_arg}_LIBOBJ], ["
4292 echo " AS_LITERAL_IF([\$1], [${macro_prefix_arg}_LIBSOURCES([\$1.c])])dnl"
4293 echo " ${macro_prefix_arg}_LIBOBJS=\"\$${macro_prefix_arg}_LIBOBJS \$1.\$ac_objext\""
4296 echo "# Like AC_REPLACE_FUNCS, except that the module name goes"
4297 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
4298 echo "AC_DEFUN([${macro_prefix_arg}_REPLACE_FUNCS], ["
4299 echo " m4_foreach_w([gl_NAME], [\$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl"
4300 echo " AC_CHECK_FUNCS([\$1], , [${macro_prefix_arg}_LIBOBJ(\$ac_func)])"
4303 echo "# Like AC_LIBSOURCES, except the directory where the source file is"
4304 echo "# expected is derived from the gnulib-tool parameterization,"
4305 echo "# and alloca is special cased (for the alloca-opt module)."
4306 echo "# We could also entirely rely on EXTRA_lib..._SOURCES."
4307 echo "AC_DEFUN([${macro_prefix_arg}_LIBSOURCES], ["
4308 echo " m4_foreach([_gl_NAME], [\$1], ["
4309 echo " m4_if(_gl_NAME, [alloca.c], [], ["
4310 echo " m4_define([${macro_prefix_arg}_LIBSOURCES_DIR], [$sourcebase_arg])"
4311 echo " m4_append([${macro_prefix_arg}_LIBSOURCES_LIST], _gl_NAME, [ ])"
4317 # func_emit_autoconf_snippet indentation
4318 # emits the autoconf snippet of a module.
4320 # - indentation spaces to prepend on each line
4321 # - local_gnulib_path from --local-dir
4322 # - modcache true or false, from --cache-modules/--no-cache-modules
4323 # - sed_replace_build_aux sed expression that replaces reference to build-aux
4324 # - sed_replace_include_guard_prefix
4325 # sed expression for resolving ${gl_include_guard_prefix}
4326 # - module the module name
4327 # - toplevel true or false. 'false' means a subordinate use of
4329 # - disable_libtool true or false. It tells whether to disable libtool
4330 # handling even if it has been specified through the
4331 # command line options.
4332 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
4334 func_emit_autoconf_snippet
()
4337 if { case $module in
4338 gnumakefile | maintainer-makefile
)
4339 # These modules are meant to be used only in the top-level directory.
4345 func_get_autoconf_snippet
"$module" \
4346 |
sed -e '/^$/d;' -e "s/^/$indentation/" \
4347 -e "$sed_replace_build_aux" \
4348 -e "$sed_replace_include_guard_prefix" \
4349 |
{ if $disable_libtool; then
4350 sed -e 's/\$gl_cond_libtool/false/g' \
4351 -e 's/gl_libdeps/gltests_libdeps/g' \
4352 -e 's/gl_ltlibdeps/gltests_ltlibdeps/g'
4357 |
{ if $disable_gettext; then
4358 sed -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./'
4360 # Don't indent AM_GNU_GETTEXT_VERSION line, as that confuses
4361 # autopoint through at least GNU gettext version 0.18.2.
4362 sed -e 's/^ *AM_GNU_GETTEXT_VERSION/AM_GNU_GETTEXT_VERSION/'
4365 if test "$module" = 'alloca' && test "$libtool" = true
&& ! $disable_libtool; then
4366 echo 'changequote(,)dnl'
4367 echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
4368 echo 'changequote([, ])dnl'
4369 echo 'AC_SUBST([LTALLOCA])'
4374 # func_emit_autoconf_snippets modules referenceable_modules verifier toplevel disable_libtool disable_gettext
4375 # collects and emit the autoconf snippets of a set of modules.
4377 # - local_gnulib_path from --local-dir
4378 # - modcache true or false, from --cache-modules/--no-cache-modules
4379 # - sed_replace_build_aux sed expression that replaces reference to build-aux
4380 # - sed_replace_include_guard_prefix
4381 # sed expression for resolving ${gl_include_guard_prefix}
4382 # - modules the list of modules.
4383 # - referenceable_modules the list of modules which may be referenced as dependencies.
4384 # - verifier one of func_verify_module, func_verify_nontests_module,
4385 # func_verify_tests_module. It selects the subset of
4386 # $modules to consider.
4387 # - toplevel true or false. 'false' means a subordinate use of
4389 # - disable_libtool true or false. It tells whether to disable libtool
4390 # handling even if it has been specified through the
4391 # command line options.
4392 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
4394 func_emit_autoconf_snippets
()
4396 referenceable_modules
="$2"
4399 disable_libtool
="$5"
4400 disable_gettext
="$6"
4401 if test "$cond_dependencies" = true
; then
4402 for m
in $referenceable_modules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/modules
4403 # Emit the autoconf code for the unconditional modules.
4404 for module
in $1; do
4406 if test -n "$module"; then
4407 if func_cond_module_p
"$module"; then
4410 func_emit_autoconf_snippet
" "
4414 # Initialize the shell variables indicating that the modules are enabled.
4415 for module
in $1; do
4417 if test -n "$module"; then
4418 if func_cond_module_p
"$module"; then
4419 func_module_shellvar_name
"$module"
4420 echo " $shellvar=false"
4424 # Emit the autoconf code for the conditional modules, each in a separate
4425 # function. This makes it possible to support cycles among conditional
4427 for module
in $1; do
4429 if test -n "$module"; then
4430 if func_cond_module_p
"$module"; then
4431 func_module_shellfunc_name
"$module"
4432 func_module_shellvar_name
"$module"
4433 echo " $shellfunc ()"
4435 echo " if ! \$$shellvar; then"
4436 func_emit_autoconf_snippet
" "
4437 echo " $shellvar=true"
4438 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
4439 # Intersect $deps with the modules list $1.
4440 deps
=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
4441 for dep
in $deps; do
4442 if func_cond_module_p
"$dep"; then
4443 func_module_shellfunc_name
"$dep"
4444 func_cond_module_condition
"$module" "$dep"
4445 if test "$condition" != true
; then
4446 echo " if $condition; then"
4453 # The autoconf code for $dep has already been emitted above and
4454 # therefore is already executed when this function is run.
4463 # Emit the dependencies from the unconditional to the conditional modules.
4464 for module
in $1; do
4466 if test -n "$module"; then
4467 if func_cond_module_p
"$module"; then
4470 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
4471 # Intersect $deps with the modules list $1.
4472 deps
=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
4473 for dep
in $deps; do
4474 if func_cond_module_p
"$dep"; then
4475 func_module_shellfunc_name
"$dep"
4476 func_cond_module_condition
"$module" "$dep"
4477 if test "$condition" != true
; then
4478 echo " if $condition; then"
4485 # The autoconf code for $dep has already been emitted above and
4486 # therefore is already executed when this code is run.
4493 # Define the Automake conditionals.
4494 echo " m4_pattern_allow([^${macro_prefix}_GNULIB_ENABLED_])"
4495 for module
in $1; do
4497 if test -n "$module"; then
4498 if func_cond_module_p
"$module"; then
4499 func_module_conditional_name
"$module"
4500 func_module_shellvar_name
"$module"
4501 echo " AM_CONDITIONAL([$conditional], [\$$shellvar])"
4506 # Ignore the conditions, and enable all modules unconditionally.
4507 for module
in $1; do
4509 if test -n "$module"; then
4510 func_emit_autoconf_snippet
" "
4516 # func_emit_pre_early_macros require indentation modules
4517 # The require parameter can be ':' (AC_REQUIRE) or 'false' (direct call).
4518 func_emit_pre_early_macros
()
4521 echo "${2}# Pre-early section."
4523 _pre_early_snippet
="echo \"${2}AC_REQUIRE([\$_pre_early_macro])\""
4525 _pre_early_snippet
="echo \"${2}\$_pre_early_macro\""
4528 # We need to call gl_USE_SYSTEM_EXTENSIONS before gl_PROG_AR_RANLIB. Doing
4529 # AC_REQUIRE in configure-ac.early is not early enough.
4530 _pre_early_macro
="gl_USE_SYSTEM_EXTENSIONS"
4531 case "${nl}${3}${nl}" in
4532 *${nl}extensions
${nl}*) eval "$_pre_early_snippet" ;;
4535 _pre_early_macro
="gl_PROG_AR_RANLIB"
4536 eval "$_pre_early_snippet"
4540 # func_reconstruct_cached_dir
4541 # callback for func_reconstruct_cached_local_gnulib_path
4543 # - destdir from --dir
4545 # - local_gnulib_path restored '--local-dir' path from cache
4546 func_reconstruct_cached_dir
()
4549 if test -n "$cached_dir"; then
4552 func_path_append local_gnulib_path
"$destdir/$cached_dir" ;;
4554 case "$cached_dir" in
4556 func_path_append local_gnulib_path
"$destdir/$cached_dir" ;;
4558 func_relconcat
"$destdir" "$cached_dir"
4559 func_path_append local_gnulib_path
"$relconcat" ;;
4565 # func_reconstruct_cached_local_gnulib_path
4566 # reconstruct local_gnulib_path from cached_local_gnulib_path to be set
4567 # relatively to $destdir again.
4569 # - cached_local_gnulib_path local_gnulib_path stored within gnulib-cache.m4
4570 # - destdir from --dir
4572 # - local_gnulib_path restored '--local-dir' path from cache
4573 func_reconstruct_cached_local_gnulib_path
()
4575 func_path_foreach
"$cached_local_gnulib_path" func_reconstruct_cached_dir
%dir
%
4578 # func_import modules
4579 # Uses also the variables
4580 # - mode import or add-import or remove-import or update
4581 # - destdir target directory
4582 # - local_gnulib_path from --local-dir
4583 # - modcache true or false, from --cache-modules/--no-cache-modules
4584 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
4585 # - libname library name
4586 # - supplied_libname true if --lib was given, blank otherwise
4587 # - sourcebase directory relative to destdir where to place source code
4588 # - m4base directory relative to destdir where to place *.m4 macros
4589 # - pobase directory relative to destdir where to place *.po files
4590 # - docbase directory relative to destdir where to place doc files
4591 # - testsbase directory relative to destdir where to place unit test code
4592 # - auxdir directory relative to destdir where to place build aux files
4593 # - inctests true if --with-tests was given, false otherwise
4594 # - incobsolete true if --with-obsolete was given, blank otherwise
4595 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
4596 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
4598 # - inc_privileged_tests true if --with-privileged-tests was given, blank
4600 # - inc_unportable_tests true if --with-unportable-tests was given, blank
4602 # - inc_all_tests true if --with-all-tests was given, blank otherwise
4603 # - avoidlist list of modules to avoid, from --avoid
4604 # - cond_dependencies true if --conditional-dependencies was given, false if
4605 # --no-conditional-dependencies was given, blank otherwise
4606 # - lgpl yes or a number if library's license shall be LGPL,
4608 # - makefile_name from --makefile-name
4609 # - libtool true if --libtool was given, false if --no-libtool was
4610 # given, blank otherwise
4611 # - guessed_libtool true if the configure.ac file uses libtool, false otherwise
4612 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4613 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
4614 # - witness_c_macro from --witness-c-macro
4615 # - vc_files true if --vc-files was given, false if --no-vc-files was
4616 # given, blank otherwise
4617 # - autoconf_minversion minimum supported autoconf version
4618 # - doit : if actions shall be executed, false if only to be printed
4619 # - copymode copy mode for files in general
4620 # - lcopymode copy mode for files from local_gnulib_path
4621 # - do_copyrights true if copyright notices in files should be replaced,
4625 # Get the cached settings.
4626 # In 'import' mode, we read them only for the purpose of knowing the old
4627 # installed file list, and don't use them as defaults.
4628 cached_local_gnulib_path
=
4629 cached_specified_modules
=
4631 cached_inc_cxx_tests
=
4632 cached_inc_longrunning_tests
=
4633 cached_inc_privileged_tests
=
4634 cached_inc_unportable_tests
=
4635 cached_inc_all_tests
=
4645 cached_makefile_name
=
4646 cached_cond_dependencies
=
4648 cached_macro_prefix
=
4650 cached_witness_c_macro
=
4653 if test -f "$destdir"/$m4base/gnulib-cache.
m4; then
4654 cached_libtool
=false
4660 s,^.*gl_LOCAL_DIR([[ ]*\([^]"$`\\)]*\).*$,cached_local_gnulib_path="\1",p
4670 s,^.*gl_MODULES([[ ]*\([^]"$`\\)]*\).*$,cached_specified_modules="\1",p
4672 /gl_WITH_OBSOLETE/ {
4673 s,^.*$,cached_incobsolete=true,p
4675 /gl_WITH_CXX_TESTS/ {
4676 s,^.*$,cached_inc_cxx_tests=true,p
4678 /gl_WITH_LONGRUNNING_TESTS/ {
4679 s,^.*$,cached_inc_longrunning_tests=true,p
4681 /gl_WITH_PRIVILEGED_TESTS/ {
4682 s,^.*$,cached_inc_privileged_tests=true,p
4684 /gl_WITH_UNPORTABLE_TESTS/ {
4685 s,^.*$,cached_inc_unportable_tests=true,p
4687 /gl_WITH_ALL_TESTS/ {
4688 s,^.*$,cached_inc_all_tests=true,p
4691 s,^.*gl_AVOID([[ ]*\([^]"$`\\)]*\).*$,cached_avoidlist="\1",p
4694 s,^.*gl_SOURCE_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_sourcebase="\1",p
4697 s,^.*gl_M4_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_m4base="\1",p
4700 s,^.*gl_PO_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_pobase="\1",p
4703 s,^.*gl_DOC_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_docbase="\1",p
4706 s,^.*gl_TESTS_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_testsbase="\1",p
4709 s,^.*$,cached_inctests=true,p
4712 s,^.*gl_LIB([[ ]*\([^]"$`\\)]*\).*$,cached_libname="\1",p
4715 s,^.*gl_LGPL([[ ]*\([^]"$`\\)]*\).*$,cached_lgpl="\1",p
4718 s,^.*$,cached_lgpl=yes,p
4720 /gl_MAKEFILE_NAME(/ {
4721 s,^.*gl_MAKEFILE_NAME([[ ]*\([^]"$`\\)]*\).*$,cached_makefile_name="\1",p
4723 /gl_CONDITIONAL_DEPENDENCIES/ {
4724 s,^.*$,cached_cond_dependencies=true,p
4727 s,^.*$,cached_libtool=true,p
4729 /gl_MACRO_PREFIX(/ {
4730 s,^.*gl_MACRO_PREFIX([[ ]*\([^]"$`\\)]*\).*$,cached_macro_prefix="\1",p
4733 s,^.*gl_PO_DOMAIN([[ ]*\([^]"$`\\)]*\).*$,cached_po_domain="\1",p
4735 /gl_WITNESS_C_MACRO(/ {
4736 s,^.*gl_WITNESS_C_MACRO([[ ]*\([^]"$`\\)]*\).*$,cached_witness_c_macro="\1",p
4739 s,^.*gl_VC_FILES([[ ]*\([^]"$`\\)]*\).*$,cached_vc_files="\1",p
4741 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-cache.m4`
4742 if test -f "$destdir"/$m4base/gnulib-comp.
m4; then
4747 /AC_DEFUN(\['"${cached_macro_prefix}"'_FILE_LIST\], \[/ {
4748 s,^.*$,cached_files=",p
4761 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-comp.m4`
4765 if test "$mode" = import
; then
4766 # In 'import' mode, the new set of specified modules overrides the cached
4767 # set of modules. Ignore the cached settings.
4768 specified_modules
="$1"
4770 # Merge the cached settings with the specified ones.
4771 # The m4base must be the same as expected from the pathname.
4772 if test -n "$cached_m4base" && test "$cached_m4base" != "$m4base"; then
4773 func_fatal_error
"$m4base/gnulib-cache.m4 is expected to contain gl_M4_BASE([$m4base])"
4775 # The local_gnulib_path defaults to the cached one. Recall that the cached one
4776 # is relative to $destdir, whereas the one we use is relative to . or absolute.
4777 if test -z "$local_gnulib_path"; then
4778 func_reconstruct_cached_local_gnulib_path
4782 # Append the cached and the specified module names. So that
4783 # "gnulib-tool --add-import foo" means to add the module foo.
4784 specified_modules
="$cached_specified_modules $1"
4787 # Take the cached module names, minus the specified module names.
4789 if $have_associative; then
4790 # Use an associative array, for O(N) worst-case run time.
4791 declare -A to_remove
4793 eval 'to_remove[$m]=yes'
4795 for module
in $cached_specified_modules; do
4796 if eval 'test -z "${to_remove[$module]}"'; then
4797 func_append specified_modules
"$module "
4801 # This loop has O(N**2) worst-case run time.
4802 for module
in $cached_specified_modules; do
4805 if test "$m" = "$module"; then
4810 if test -z "$to_remove"; then
4811 func_append specified_modules
"$module "
4817 # Take the cached module names. There are no specified module names.
4818 specified_modules
="$cached_specified_modules"
4821 # Included obsolete modules among the dependencies if specified either way.
4822 if test -z "$incobsolete"; then
4823 incobsolete
="$cached_incobsolete"
4825 # Included special kinds of tests modules among the dependencies if specified
4827 if test -z "$inc_cxx_tests"; then
4828 inc_cxx_tests
="$cached_inc_cxx_tests"
4830 if test -z "$inc_longrunning_tests"; then
4831 inc_longrunning_tests
="$cached_inc_longrunning_tests"
4833 if test -z "$inc_privileged_tests"; then
4834 inc_privileged_tests
="$cached_inc_privileged_tests"
4836 if test -z "$inc_unportable_tests"; then
4837 inc_unportable_tests
="$cached_inc_unportable_tests"
4839 if test -z "$inc_all_tests"; then
4840 inc_all_tests
="$cached_inc_all_tests"
4842 # Append the cached and the specified avoidlist. This is probably better
4843 # than dropping the cached one when --avoid is specified at least once.
4844 avoidlist
=`for m in $cached_avoidlist $avoidlist; do echo $m; done | LC_ALL=C sort -u`
4845 avoidlist
=`echo $avoidlist`
4847 # The sourcebase defaults to the cached one.
4848 if test -z "$sourcebase"; then
4849 sourcebase
="$cached_sourcebase"
4850 if test -z "$sourcebase"; then
4851 func_fatal_error
"missing --source-base option"
4854 # The pobase defaults to the cached one.
4855 if test -z "$pobase"; then
4856 pobase
="$cached_pobase"
4858 # The docbase defaults to the cached one.
4859 if test -z "$docbase"; then
4860 docbase
="$cached_docbase"
4861 if test -z "$docbase"; then
4862 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."
4865 # The testsbase defaults to the cached one.
4866 if test -z "$testsbase"; then
4867 testsbase
="$cached_testsbase"
4868 if test -z "$testsbase"; then
4869 func_fatal_error
"missing --tests-base option"
4872 # Require the tests if specified either way.
4873 if ! $inctests; then
4874 inctests
="$cached_inctests"
4875 if test -z "$inctests"; then
4879 # The libname defaults to the cached one.
4880 if test -z "$supplied_libname"; then
4881 libname
="$cached_libname"
4882 if test -z "$libname"; then
4883 func_fatal_error
"missing --lib option"
4886 # Require LGPL if specified either way.
4887 if test -z "$lgpl"; then
4890 # The makefile_name defaults to the cached one.
4891 if test -z "$makefile_name"; then
4892 makefile_name
="$cached_makefile_name"
4894 # Use conditional dependencies if specified either way.
4895 if test -z "$cond_dependencies"; then
4896 cond_dependencies
="$cached_cond_dependencies"
4898 # Use libtool if specified either way, or if guessed.
4899 if test -z "$libtool"; then
4900 if test -n "$cached_m4base"; then
4901 libtool
="$cached_libtool"
4903 libtool
="$guessed_libtool"
4906 # The macro_prefix defaults to the cached one.
4907 if test -z "$macro_prefix"; then
4908 macro_prefix
="$cached_macro_prefix"
4909 if test -z "$macro_prefix"; then
4910 func_fatal_error
"missing --macro-prefix option"
4913 # The po_domain defaults to the cached one.
4914 if test -z "$po_domain"; then
4915 po_domain
="$cached_po_domain"
4917 # The witness_c_macro defaults to the cached one.
4918 if test -z "$witness_c_macro"; then
4919 witness_c_macro
="$cached_witness_c_macro"
4921 # The vc_files defaults to the cached one.
4922 if test -z "$vc_files"; then
4923 vc_files
="$cached_vc_files"
4925 # Ensure constraints.
4926 if test "$cond_dependencies" = true
&& $inctests; then
4927 echo "gnulib-tool: option --conditional-dependencies is not supported with --with-tests" 1>&2
4931 # --without-*-tests options are not supported here.
4933 excl_longrunning_tests
=
4934 excl_privileged_tests
=
4935 excl_unportable_tests
=
4937 # Canonicalize the list of specified modules.
4938 specified_modules
=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
4940 # Include all kinds of tests modules if --with-all-tests was specified.
4941 inc_all_direct_tests
="$inc_all_tests"
4942 inc_all_indirect_tests
="$inc_all_tests"
4944 # Determine final module list.
4945 modules
="$specified_modules"
4946 func_modules_transitive_closure
4947 if test $verbose -ge 0; then
4948 func_show_module_list
4950 final_modules
="$modules"
4952 # Determine main module list and tests-related module list separately.
4953 func_modules_transitive_closure_separately
4955 # Determine whether a $testsbase/libtests.a is needed.
4956 func_determine_use_libtests
4958 # Add the dummy module to the main module list or to the tests-related module
4960 func_modules_add_dummy_separately
4962 # If --lgpl, verify that the licenses of modules are compatible.
4963 if test -n "$lgpl"; then
4964 license_incompatibilities
=
4965 for module
in $main_modules; do
4966 license
=`func_get_license $module`
4968 'GPLed build tool') ;;
4969 'public domain' |
'unlimited' |
'unmodifiable license text') ;;
4974 LGPLv2
+ |
'LGPLv3+ or GPLv2' | LGPLv3
+ | LGPL
) ;;
4975 *) func_append license_incompatibilities
"$module $license$nl" ;;
4980 LGPLv2
+ |
'LGPLv3+ or GPLv2') ;;
4981 *) func_append license_incompatibilities
"$module $license$nl" ;;
4987 *) func_append license_incompatibilities
"$module $license$nl" ;;
4990 *) func_fatal_error
"invalid value lgpl=$lgpl" ;;
4995 if test -n "$license_incompatibilities"; then
4996 # Format the license incompatibilities as a table.
4997 sed_expand_column1_width50_indent17
='s,^\([^ ]*\) ,\1 ,
4998 s,^\(.................................................[^ ]*\) *, \1 ,'
4999 license_incompatibilities
=`echo "$license_incompatibilities" | sed -e "$sed_expand_column1_width50_indent17"`
5000 func_fatal_error
"incompatible license on modules:$nl$license_incompatibilities"
5004 # Show banner notice of every module.
5005 modules
="$main_modules"
5008 # Determine script to apply to imported library files.
5009 sed_transform_lib_file
=
5010 for module
in $main_modules; do
5011 if test $module = config-h
; then
5012 # Assume config.h exists, and that -DHAVE_CONFIG_H is omitted.
5013 sed_transform_lib_file
=$sed_transform_lib_file'
5014 s/^#ifdef[ ]*HAVE_CONFIG_H[ ]*$/#if 1/
5019 sed_transform_main_lib_file
="$sed_transform_lib_file"
5020 if test -n "$do_copyrights"; then
5021 if test -n "$lgpl"; then
5025 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
5026 s/GNU General/GNU Lesser General/g
5027 s/General Public License/Lesser General Public License/g
5028 s/Lesser Lesser General Public License/Lesser General Public License/g
5032 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
5033 /^ *This program is free software/i\
5034 This program is free software: you can redistribute it and\/or\
5035 modify it under the terms of either:\
5037 * the GNU Lesser General Public License as published by the Free\
5038 Software Foundation; either version 3 of the License, or (at your\
5039 option) any later version.\
5043 * the GNU General Public License as published by the Free\
5044 Software Foundation; either version 2 of the License, or (at your\
5045 option) any later version.\
5047 or both in parallel, as here.
5048 /^ *This program is free software/,/^$/d
5052 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
5053 s/GNU General/GNU Lesser General/g
5054 s/General Public License/Lesser General Public License/g
5055 s/Lesser Lesser General Public License/Lesser General Public License/g
5057 s/version [23]\([ ,]\)/version 2.1\1/g
5060 *) func_fatal_error
"invalid value lgpl=$lgpl" ;;
5064 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
5065 s/GNU Lesser General/GNU General/g
5066 s/Lesser General Public License/General Public License/g
5068 s/GNU Library General/GNU General/g
5069 s/Library General Public License/General Public License/g
5071 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
5076 # Determine script to apply to auxiliary files that go into $auxdir/.
5077 sed_transform_build_aux_file
=
5078 if test -n "$do_copyrights"; then
5080 sed_transform_build_aux_file
=$sed_transform_build_aux_file'
5081 s/GNU Lesser General/GNU General/g
5082 s/Lesser General Public License/General Public License/g
5084 s/GNU Library General/GNU General/g
5085 s/Library General Public License/General Public License/g
5087 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
5091 # Determine script to apply to library files that go into $testsbase/.
5092 sed_transform_testsrelated_lib_file
="$sed_transform_lib_file"
5093 if test -n "$do_copyrights"; then
5095 sed_transform_testsrelated_lib_file
=$sed_transform_testsrelated_lib_file'
5096 s/GNU Lesser General/GNU General/g
5097 s/Lesser General Public License/General Public License/g
5099 s/GNU Library General/GNU General/g
5100 s/Library General Public License/General Public License/g
5102 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
5106 # Determine the final file lists.
5107 func_modules_to_filelist_separately
5110 || func_fatal_error
"refusing to do nothing"
5112 # Add m4/gnulib-tool.m4 to the file list. It is not part of any module.
5113 new_files
="$files m4/gnulib-tool.m4"
5114 old_files
="$cached_files"
5115 if test -f "$destdir"/$m4base/gnulib-tool.
m4; then
5116 func_append old_files
" m4/gnulib-tool.m4"
5119 rewritten
='%REWRITTEN%'
5120 sed_rewrite_old_files
="\
5121 s,^build-aux/,$rewritten$auxdir/,
5122 s,^doc/,$rewritten$cached_docbase/,
5123 s,^lib/,$rewritten$cached_sourcebase/,
5124 s,^m4/,$rewritten$cached_m4base/,
5125 s,^tests/,$rewritten$cached_testsbase/,
5126 s,^tests=lib/,$rewritten$cached_testsbase/,
5129 sed_rewrite_new_files
="\
5130 s,^build-aux/,$rewritten$auxdir/,
5131 s,^doc/,$rewritten$docbase/,
5132 s,^lib/,$rewritten$sourcebase/,
5133 s,^m4/,$rewritten$m4base/,
5134 s,^tests/,$rewritten$testsbase/,
5135 s,^tests=lib/,$rewritten$testsbase/,
5139 # Determine whether to put anything into $testsbase.
5140 testsfiles
=`echo "$files" | sed -n -e 's,^tests/,,p' -e 's,^tests=lib/,,p'`
5141 if test -n "$testsfiles"; then
5147 # Create directories.
5148 { echo "$sourcebase"
5150 if test -n "$pobase"; then
5153 docfiles
=`echo "$files" | sed -n -e 's,^doc/,,p'`
5154 if test -n "$docfiles"; then
5161 for f
in $files; do echo $f; done \
5162 |
sed -e "$sed_rewrite_new_files" \
5163 |
sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
5166 { # Rearrange file descriptors. Needed because "while ... done < ..."
5167 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5168 exec 5<&0 < "$tmp"/dirs
5170 if test ! -d "$destdir/$d"; then
5172 echo "Creating directory $destdir/$d"
5173 mkdir
-p "$destdir/$d" || func_fatal_error
"failed"
5175 echo "Create directory $destdir/$d"
5182 # Copy files or make symbolic links or hard links. Remove obsolete files.
5186 # Construct a table with 2 columns: rewritten-file-name original-file-name,
5187 # representing the files according to the last gnulib-tool invocation.
5188 for f
in $old_files; do echo $f; done \
5189 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_old_files" \
5192 # Construct a table with 2 columns: rewritten-file-name original-file-name,
5193 # representing the files after this gnulib-tool invocation.
5194 for f
in $new_files; do echo $f; done \
5195 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" \
5198 # First the files that are in old-files, but not in new-files:
5199 sed_take_first_column
='s,'"$delimiter"'.*,,'
5200 for g
in `LC_ALL=C join -t"$delimiter" -v1 "$tmp"/old-files "$tmp"/new-files | sed -e "$sed_take_first_column"`; do
5201 # Remove the file. Do nothing if the user already removed it.
5202 if test -f "$destdir/$g" ||
test -h "$destdir/$g"; then
5204 echo "Removing file $g (backup in ${g}~)"
5205 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error
"failed"
5207 echo "Remove file $g (backup in ${g}~)"
5209 func_append removed_files
"$g$nl"
5212 # func_add_or_update handles a file that ought to be present afterwards.
5214 # - f the original file name
5215 # - g the rewritten file name
5216 # - already_present nonempty if the file should already exist, empty
5218 func_add_or_update
()
5222 tests
=lib
/*) f
=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
5224 func_dest_tmpfilename
"$g"
5225 func_lookup_file
"$f"
5226 cp "$lookedup_file" "$tmpfile" || func_fatal_error
"failed"
5229 # Don't process binary files with sed.
5232 if test -n "$sed_transform_main_lib_file"; then
5235 sed -e "$sed_transform_main_lib_file" \
5236 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
5240 if test -n "$sed_transform_build_aux_file"; then
5243 sed -e "$sed_transform_build_aux_file" \
5244 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
5248 if test -n "$sed_transform_testsrelated_lib_file"; then
5251 sed -e "$sed_transform_testsrelated_lib_file" \
5252 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
5258 if test -f "$destdir/$g"; then
5259 # The file already exists.
5263 # Don't protest if the file should be there but isn't: it happens
5264 # frequently that developers don't put autogenerated files under version control.
5266 func_append added_files
"$g$nl"
5270 # Then the files that are in new-files, but not in old-files:
5271 sed_take_last_column
='s,^.*'"$delimiter"',,'
5273 LC_ALL
=C
join -t"$delimiter" -v2 "$tmp"/old-files
"$tmp"/new-files \
5274 |
sed -e "$sed_take_last_column" \
5275 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/added-files
5276 { # Rearrange file descriptors. Needed because "while ... done < ..."
5277 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5278 exec 5<&0 < "$tmp"/added-files
5284 # Then the files that are in new-files and in old-files:
5285 already_present
=true
5286 LC_ALL
=C
join -t"$delimiter" "$tmp"/old-files
"$tmp"/new-files \
5287 |
sed -e "$sed_take_last_column" \
5288 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/kept-files
5289 { # Rearrange file descriptors. Needed because "while ... done < ..."
5290 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5291 exec 5<&0 < "$tmp"/kept-files
5298 # Command-line invocation printed in a comment in generated gnulib-cache.m4.
5299 actioncmd
="# gnulib-tool --import"
5302 func_append_local_dir
()
5304 func_append
"$1" " --local-dir=$2"
5306 func_path_foreach
"$local_gnulib_path" func_append_local_dir actioncmd
%dir
%
5308 # Break the action command log into multiple lines.
5309 # Emacs puts some gnulib-tool log lines in its source repository, and
5310 # git send-email rejects patch lines longer than 998 characters.
5311 # Also, config.status uses awk, and the HP-UX 11.00 awk fails if a
5312 # line has length >= 3071; similarly, the IRIX 6.5 awk fails if a
5313 # line has length >= 3072.
5314 func_append_actionarg
()
5316 func_append actioncmd
" \\$nl# $1"
5318 func_append_actionarg
"--lib=$libname"
5319 func_append_actionarg
"--source-base=$sourcebase"
5320 func_append_actionarg
"--m4-base=$m4base"
5321 if test -n "$pobase"; then
5322 func_append_actionarg
"--po-base=$pobase"
5324 func_append_actionarg
"--doc-base=$docbase"
5325 func_append_actionarg
"--tests-base=$testsbase"
5326 func_append_actionarg
"--aux-dir=$auxdir"
5328 func_append_actionarg
"--with-tests"
5330 if test -n "$incobsolete"; then
5331 func_append_actionarg
"--with-obsolete"
5333 if test -n "$inc_cxx_tests"; then
5334 func_append_actionarg
"--with-c++-tests"
5336 if test -n "$inc_longrunning_tests"; then
5337 func_append_actionarg
"--with-longrunning-tests"
5339 if test -n "$inc_privileged_tests"; then
5340 func_append_actionarg
"--with-privileged-tests"
5342 if test -n "$inc_unportable_tests"; then
5343 func_append_actionarg
"--with-unportable-tests"
5345 if test -n "$inc_all_tests"; then
5346 func_append_actionarg
"--with-all-tests"
5348 if test -n "$lgpl"; then
5349 if test "$lgpl" = yes; then
5350 func_append_actionarg
"--lgpl"
5352 func_append_actionarg
"--lgpl=$lgpl"
5356 func_append_actionarg
"--gnu-make"
5358 if test -n "$makefile_name"; then
5359 func_append_actionarg
"--makefile-name=$makefile_name"
5361 if test "$cond_dependencies" = true
; then
5362 func_append_actionarg
"--conditional-dependencies"
5364 func_append_actionarg
"--no-conditional-dependencies"
5366 if test "$libtool" = true
; then
5367 func_append_actionarg
"--libtool"
5369 func_append_actionarg
"--no-libtool"
5371 func_append_actionarg
"--macro-prefix=$macro_prefix"
5372 if test -n "$po_domain"; then
5373 func_append_actionarg
"--po-domain=$po_domain"
5375 if test -n "$witness_c_macro"; then
5376 func_append_actionarg
"--witness-c-macro=$witness_c_macro"
5378 if test -n "$vc_files"; then
5379 if test "$vc_files" = true
; then
5380 func_append_actionarg
"--vc-files"
5382 func_append_actionarg
"--no-vc-files"
5385 for module
in $avoidlist; do
5386 func_append_actionarg
"--avoid=$module"
5388 for module
in $specified_modules; do
5389 func_append_actionarg
"$module"
5392 # Determine include_guard_prefix.
5393 func_compute_include_guard_prefix
5395 # Default the makefile name to Makefile.am.
5396 if test -n "$makefile_name"; then
5397 makefile_am
=$makefile_name
5399 makefile_am
=Makefile.am
5402 # Create normal Makefile.ams.
5405 # Setup list of Makefile.am edits that are to be performed afterwards.
5406 # Some of these edits apply to files that we will generate; others are
5407 # under the responsibility of the developer.
5409 # func_note_Makefile_am_edit dir var value [dotfirst]
5410 # remembers that ${dir}Makefile.am needs to be edited to that ${var} mentions
5412 # If ${dotfirst} is non-empty, this mention needs to be present after '.'.
5413 # This is a special hack for the SUBDIRS variable, cf.
5414 # <https://www.gnu.org/software/automake/manual/html_node/Subdirectories.html>.
5415 func_note_Makefile_am_edit
()
5417 makefile_am_edits
=`expr $makefile_am_edits + 1`
5418 eval makefile_am_edit
${makefile_am_edits}_dir
=\"\
$1\"
5419 eval makefile_am_edit
${makefile_am_edits}_var
=\"\
$2\"
5420 eval makefile_am_edit
${makefile_am_edits}_val
=\"\
$3\"
5421 eval makefile_am_edit
${makefile_am_edits}_dotfirst
=\"\
$4\"
5423 if test "$makefile_am" = Makefile.am
; then
5424 sourcebase_dir
=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'`
5425 sourcebase_base
=`basename "$sourcebase"`
5426 func_note_Makefile_am_edit
"$sourcebase_dir" SUBDIRS
"$sourcebase_base"
5428 if test -n "$pobase"; then
5429 pobase_dir
=`echo "$pobase" | sed -n -e 's,/[^/]*$,/,p'`
5430 pobase_base
=`basename "$pobase"`
5431 func_note_Makefile_am_edit
"$pobase_dir" SUBDIRS
"$pobase_base"
5434 if test "$makefile_am" = Makefile.am
; then
5435 testsbase_dir
=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'`
5436 testsbase_base
=`basename "$testsbase"`
5437 func_note_Makefile_am_edit
"$testsbase_dir" SUBDIRS
"$testsbase_base" true
5440 func_note_Makefile_am_edit
"" ACLOCAL_AMFLAGS
"-I ${m4base}"
5442 # Find the first parent directory of $m4base that contains or will contain
5444 sed_last
='s,^.*/\([^/][^/]*\)//*$,\1/,
5446 sed_butlast
='s,[^/][^/]*//*$,,'
5447 dir1
="${m4base}/"; dir2
=""
5448 while test -n "$dir1" \
5449 && ! { test -f "${destdir}/${dir1}Makefile.am" \
5450 ||
test "${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
5451 ||
test "./${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
5453 && { test "${dir1}Makefile.am" = "$testsbase/$makefile_am" \
5454 ||
test "./${dir1}Makefile.am" = "$testsbase/$makefile_am"; }; }; }; do
5455 dir2
=`echo "$dir1" | sed -e "$sed_last"`"$dir2"
5456 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
5458 func_note_Makefile_am_edit
"$dir1" EXTRA_DIST
"${dir2}gnulib-cache.m4"
5461 # Create library makefile.
5462 func_dest_tmpfilename
$sourcebase/$makefile_am
5463 destfile
="$sourcebase/$makefile_am"
5464 modules
="$main_modules"
5465 func_emit_lib_Makefile_am
> "$tmpfile"
5466 if test -f "$destdir"/$sourcebase/$makefile_am; then
5467 if cmp -s "$destdir"/$sourcebase/$makefile_am "$tmpfile"; then
5471 echo "Updating $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
5472 mv -f "$destdir"/$sourcebase/$makefile_am "$destdir"/$sourcebase/$makefile_am~
5473 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
5475 echo "Update $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
5481 echo "Creating $sourcebase/$makefile_am"
5482 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
5484 echo "Create $sourcebase/$makefile_am"
5487 func_append added_files
"$sourcebase/$makefile_am$nl"
5490 # Create po/ directory.
5491 if test -n "$pobase"; then
5492 # Create po makefile and auxiliary files.
5493 for file in Makefile.
in.
in remove-potcdate.sin
; do
5494 func_dest_tmpfilename
$pobase/$file
5495 func_lookup_file build-aux
/po
/$file
5496 cat "$lookedup_file" > "$tmpfile"
5497 if test -f "$destdir"/$pobase/$file; then
5498 if cmp -s "$destdir"/$pobase/$file "$tmpfile"; then
5502 echo "Updating $pobase/$file (backup in $pobase/$file~)"
5503 mv -f "$destdir"/$pobase/$file "$destdir"/$pobase/$file~
5504 mv -f "$tmpfile" "$destdir"/$pobase/$file
5506 echo "Update $pobase/$file (backup in $pobase/$file~)"
5512 echo "Creating $pobase/$file"
5513 mv -f "$tmpfile" "$destdir"/$pobase/$file
5515 echo "Create $pobase/$file"
5518 func_append added_files
"$pobase/$file$nl"
5521 # Create po makefile parameterization, part 1.
5522 func_dest_tmpfilename
$pobase/Makevars
5523 func_emit_po_Makevars
> "$tmpfile"
5524 if test -f "$destdir"/$pobase/Makevars
; then
5525 if cmp -s "$destdir"/$pobase/Makevars
"$tmpfile"; then
5529 echo "Updating $pobase/Makevars (backup in $pobase/Makevars~)"
5530 mv -f "$destdir"/$pobase/Makevars
"$destdir"/$pobase/Makevars~
5531 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
5533 echo "Update $pobase/Makevars (backup in $pobase/Makevars~)"
5539 echo "Creating $pobase/Makevars"
5540 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
5542 echo "Create $pobase/Makevars"
5545 func_append added_files
"$pobase/Makevars$nl"
5547 # Create po makefile parameterization, part 2.
5548 func_dest_tmpfilename
$pobase/POTFILES.
in
5549 func_emit_po_POTFILES_in
> "$tmpfile"
5550 if test -f "$destdir"/$pobase/POTFILES.
in; then
5551 if cmp -s "$destdir"/$pobase/POTFILES.
in "$tmpfile"; then
5555 echo "Updating $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
5556 mv -f "$destdir"/$pobase/POTFILES.
in "$destdir"/$pobase/POTFILES.
in~
5557 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.
in
5559 echo "Update $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
5565 echo "Creating $pobase/POTFILES.in"
5566 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.
in
5568 echo "Create $pobase/POTFILES.in"
5571 func_append added_files
"$pobase/POTFILES.in$nl"
5574 TP_URL
="https://translationproject.org/latest/"
5576 echo "Fetching gnulib PO files from $TP_URL"
5577 (cd "$destdir"/$pobase \
5578 && wget
--no-verbose --mirror --level=1 -nd -A.po
-P .
"${TP_URL}gnulib/"
5581 echo "Fetch gnulib PO files from $TP_URL"
5583 # Create po/LINGUAS.
5585 func_dest_tmpfilename
$pobase/LINGUAS
5586 (cd "$destdir"/$pobase \
5587 && { echo '# Set of available languages.'
5588 LC_ALL
=C
ls -1 *.po |
sed -e 's,\.po$,,'
5591 if test -f "$destdir"/$pobase/LINGUAS
; then
5592 if cmp -s "$destdir"/$pobase/LINGUAS
"$tmpfile"; then
5595 echo "Updating $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
5596 mv -f "$destdir"/$pobase/LINGUAS
"$destdir"/$pobase/LINGUAS~
5597 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
5600 echo "Creating $pobase/LINGUAS"
5601 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
5602 func_append added_files
"$pobase/LINGUAS$nl"
5605 if test -f "$destdir"/$pobase/LINGUAS
; then
5606 echo "Update $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
5608 echo "Create $pobase/LINGUAS"
5613 # func_count_relative_local_gnulib_path
5614 # gl_LOCAL_DIR requires local_gnulib_path to be set relatively to destdir
5616 # - local_gnulib_path from --local-dir
5617 # - destdir from --dir
5619 # - relative_local_dir path to be stored into gl_LOCAL_DIR
5620 func_count_relative_local_gnulib_path
()
5622 relative_local_gnulib_path
=
5624 IFS
="$PATH_SEPARATOR"
5625 for local_dir
in $local_gnulib_path
5628 # Store the local_dir relative to destdir.
5629 case "$local_dir" in
5631 relative_local_dir
="$local_dir" ;;
5634 /*) relative_local_dir
="$local_dir" ;;
5636 # destdir, local_dir are both relative.
5637 func_relativize
"$destdir" "$local_dir"
5638 relative_local_dir
="$reldir" ;;
5641 func_path_append relative_local_gnulib_path
"$relative_local_dir"
5646 # Create m4/gnulib-cache.m4.
5647 func_dest_tmpfilename
$m4base/gnulib-cache.
m4
5649 func_emit_copyright_notice
5651 echo "# This file represents the specification of how gnulib-tool is used."
5652 echo "# It acts as a cache: It is written and read by gnulib-tool."
5653 echo "# In projects that use version control, this file is meant to be put under"
5654 echo "# version control, like the configure.ac and various Makefile.am files."
5657 echo "# Specification in the form of a command-line invocation:"
5658 printf '%s\n' "$actioncmd"
5660 echo "# Specification in the form of a few gnulib-tool.m4 macro invocations:"
5661 func_count_relative_local_gnulib_path
5662 echo "gl_LOCAL_DIR([$relative_local_gnulib_path])"
5664 echo "$specified_modules" |
sed -e 's/^/ /g'
5666 test -z "$incobsolete" ||
echo "gl_WITH_OBSOLETE"
5667 test -z "$inc_cxx_tests" ||
echo "gl_WITH_CXX_TESTS"
5668 test -z "$inc_longrunning_tests" ||
echo "gl_WITH_LONGRUNNING_TESTS"
5669 test -z "$inc_privileged_tests" ||
echo "gl_WITH_PRIVILEGED_TESTS"
5670 test -z "$inc_unportable_tests" ||
echo "gl_WITH_UNPORTABLE_TESTS"
5671 test -z "$inc_all_tests" ||
echo "gl_WITH_ALL_TESTS"
5672 echo "gl_AVOID([$avoidlist])"
5673 echo "gl_SOURCE_BASE([$sourcebase])"
5674 echo "gl_M4_BASE([$m4base])"
5675 echo "gl_PO_BASE([$pobase])"
5676 echo "gl_DOC_BASE([$docbase])"
5677 echo "gl_TESTS_BASE([$testsbase])"
5679 echo "gl_WITH_TESTS"
5681 echo "gl_LIB([$libname])"
5682 if test -n "$lgpl"; then
5683 if test "$lgpl" = yes; then
5686 echo "gl_LGPL([$lgpl])"
5689 echo "gl_MAKEFILE_NAME([$makefile_name])"
5690 if test "$cond_dependencies" = true
; then
5691 echo "gl_CONDITIONAL_DEPENDENCIES"
5693 if test "$libtool" = true
; then
5696 echo "gl_MACRO_PREFIX([$macro_prefix])"
5697 echo "gl_PO_DOMAIN([$po_domain])"
5698 echo "gl_WITNESS_C_MACRO([$witness_c_macro])"
5699 if test -n "$vc_files"; then
5700 echo "gl_VC_FILES([$vc_files])"
5703 if test -f "$destdir"/$m4base/gnulib-cache.
m4; then
5704 if cmp -s "$destdir"/$m4base/gnulib-cache.
m4 "$tmpfile"; then
5708 echo "Updating $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
5709 mv -f "$destdir"/$m4base/gnulib-cache.
m4 "$destdir"/$m4base/gnulib-cache.
m4~
5710 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.
m4
5712 echo "Update $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
5716 echo "# gnulib-cache.m4 ends here"
5723 echo "Creating $m4base/gnulib-cache.m4"
5724 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.
m4
5726 echo "Create $m4base/gnulib-cache.m4"
5732 # Create m4/gnulib-comp.m4.
5733 func_dest_tmpfilename
$m4base/gnulib-comp.
m4
5735 echo "# DO NOT EDIT! GENERATED AUTOMATICALLY!"
5736 func_emit_copyright_notice
5738 echo "# This file represents the compiled summary of the specification in"
5739 echo "# gnulib-cache.m4. It lists the computed macro invocations that need"
5740 echo "# to be invoked from configure.ac."
5741 echo "# In projects that use version control, this file can be treated like"
5742 echo "# other built files."
5745 echo "# This macro should be invoked from $configure_ac, in the section"
5746 echo "# \"Checks for programs\", right after AC_PROG_CC, and certainly before"
5747 echo "# any checks for libraries, header files, types and library functions."
5748 echo "AC_DEFUN([${macro_prefix}_EARLY],"
5750 echo " m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
5751 echo " m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
5752 echo " m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
5753 echo " m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
5755 func_emit_pre_early_macros
: ' ' "$final_modules"
5757 if ! $gnu_make && test -n "$uses_subdirs"; then
5758 echo " AC_REQUIRE([AM_PROG_CC_C_O])"
5760 for module
in $final_modules; do
5762 if test -n "$module"; then
5763 echo "# Code from module $module:"
5764 func_get_autoconf_early_snippet
"$module"
5767 |
sed -e '/^$/d;' -e 's/^/ /'
5770 echo "# This macro should be invoked from $configure_ac, in the section"
5771 echo "# \"Check for header files, types and library functions\"."
5772 echo "AC_DEFUN([${macro_prefix}_INIT],"
5774 if test "$libtool" = true
; then
5775 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
5776 echo " gl_cond_libtool=true"
5778 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
5779 echo " gl_cond_libtool=false"
5781 echo " gl_ltlibdeps="
5783 if test "$auxdir" != "build-aux"; then
5784 sed_replace_build_aux
='
5786 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
5787 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
5791 sed_replace_build_aux
="$sed_noop"
5793 echo " gl_m4_base='$m4base'"
5794 func_emit_initmacro_start
$macro_prefix
5795 echo " gl_source_base='$sourcebase'"
5796 if test -n "$witness_c_macro"; then
5797 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$witness_c_macro])"
5799 func_emit_autoconf_snippets
"$main_modules" "$main_modules" func_verify_module true false true
5800 if test -n "$witness_c_macro"; then
5801 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
5803 echo " # End of code from modules"
5804 func_emit_initmacro_end
$macro_prefix
5805 echo " gltests_libdeps="
5806 echo " gltests_ltlibdeps="
5807 func_emit_initmacro_start
${macro_prefix}tests
5808 echo " gl_source_base='$testsbase'"
5809 # Define a tests witness macro that depends on the package.
5810 # PACKAGE is defined by AM_INIT_AUTOMAKE, PACKAGE_TARNAME is defined by AC_INIT.
5811 # See <https://lists.gnu.org/r/automake/2009-05/msg00145.html>.
5812 echo "changequote(,)dnl"
5813 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"
5814 echo "changequote([, ])dnl"
5815 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
5816 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
5817 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
5818 func_emit_autoconf_snippets
"$testsrelated_modules" "$main_modules $testsrelated_modules" func_verify_module true true true
5819 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
5820 func_emit_initmacro_end
${macro_prefix}tests
5821 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
5822 # created using libtool, because libtool already handles the dependencies.
5823 if test "$libtool" != true
; then
5824 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
5825 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
5826 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
5827 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
5828 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
5830 if $use_libtests; then
5831 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
5832 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
5835 func_emit_initmacro_done
$macro_prefix $sourcebase
5836 func_emit_initmacro_done
${macro_prefix}tests
$testsbase
5838 echo "# This macro records the list of files which have been installed by"
5839 echo "# gnulib-tool and may be removed by future gnulib-tool invocations."
5840 echo "AC_DEFUN([${macro_prefix}_FILE_LIST], ["
5841 echo "$files" |
sed -e 's,^, ,'
5844 if test -f "$destdir"/$m4base/gnulib-comp.
m4; then
5845 if cmp -s "$destdir"/$m4base/gnulib-comp.
m4 "$tmpfile"; then
5849 echo "Updating $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
5850 mv -f "$destdir"/$m4base/gnulib-comp.
m4 "$destdir"/$m4base/gnulib-comp.
m4~
5851 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.
m4
5853 echo "Update $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
5857 echo "# gnulib-comp.m4 ends here"
5864 echo "Creating $m4base/gnulib-comp.m4"
5865 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.
m4
5867 echo "Create $m4base/gnulib-comp.m4"
5874 # Create tests makefile.
5875 func_dest_tmpfilename
$testsbase/$makefile_am
5876 destfile
="$testsbase/$makefile_am"
5877 modules
="$testsrelated_modules"
5878 func_emit_tests_Makefile_am
"${macro_prefix}tests_WITNESS" > "$tmpfile"
5879 if test -f "$destdir"/$testsbase/$makefile_am; then
5880 if cmp -s "$destdir"/$testsbase/$makefile_am "$tmpfile"; then
5884 echo "Updating $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
5885 mv -f "$destdir"/$testsbase/$makefile_am "$destdir"/$testsbase/$makefile_am~
5886 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
5888 echo "Update $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
5894 echo "Creating $testsbase/$makefile_am"
5895 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
5897 echo "Create $testsbase/$makefile_am"
5900 func_append added_files
"$testsbase/$makefile_am$nl"
5904 if test "$vc_files" != false
; then
5905 # Update the .cvsignore and .gitignore files.
5906 { echo "$added_files" |
sed -e '/^$/d' -e 's,\([^/]*\)$,|A|\1,'
5907 echo "$removed_files" |
sed -e '/^$/d' -e 's,\([^/]*\)$,|R|\1,'
5908 # Treat gnulib-comp.m4 like an added file, even if it already existed.
5909 echo "$m4base/|A|gnulib-comp.m4"
5910 } | LC_ALL
=C
sort -t'|' -k1,1 > "$tmp"/fileset-changes
5911 { # Rearrange file descriptors. Needed because "while ... done < ..."
5912 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5913 exec 5<&0 < "$tmp"/fileset-changes
5914 func_update_ignorelist
()
5917 if test "$ignore" = .gitignore
; then
5918 # In a .gitignore file, "foo" applies to the current directory and all
5919 # subdirectories, whereas "/foo" applies to the current directory only.
5922 doubly_escaped_anchor
='\\/'
5926 doubly_escaped_anchor
=''
5928 if test -f "$destdir/$dir$ignore"; then
5929 if test -n "$dir_added" ||
test -n "$dir_removed"; then
5930 sed -e "s|^$anchor||" < "$destdir/$dir$ignore" | LC_ALL
=C
sort > "$tmp"/ignore
5931 (echo "$dir_added" |
sed -e '/^$/d' | LC_ALL
=C
sort -u \
5932 | LC_ALL
=C
join -v 1 - "$tmp"/ignore
> "$tmp"/ignore-added
5933 echo "$dir_removed" |
sed -e '/^$/d' | LC_ALL
=C
sort -u \
5934 > "$tmp"/ignore-removed
5936 if test -s "$tmp"/ignore-added ||
test -s "$tmp"/ignore-removed
; then
5938 echo "Updating $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
5939 mv -f "$destdir/$dir$ignore" "$destdir/$dir$ignore"~
5940 { sed -e 's,/,\\/,g' -e 's,^,/^,' -e 's,$,\$/d,' < "$tmp"/ignore-removed
5941 if test -n "$anchor"; then sed -e 's,/,\\/,g' -e "s,^,/^${doubly_escaped_anchor}," -e 's,$,$/d,' < "$tmp"/ignore-removed
; fi
5942 } > "$tmp"/sed-ignore-removed
5943 { cat "$destdir/$dir$ignore"~
5944 sed -e "s|^|$anchor|" < "$tmp"/ignore-added
5945 } |
sed -f "$tmp"/sed-ignore-removed \
5946 > "$destdir/$dir$ignore"
5948 echo "Update $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
5953 if test -n "$dir_added"; then
5955 echo "Creating $destdir/$dir$ignore"
5957 if test "$ignore" = .cvsignore
; then
5959 # Automake generates Makefile rules that create .dirstamp files.
5962 echo "$dir_added" |
sed -e '/^$/d' -e "s|^|$anchor|" | LC_ALL
=C
sort -u
5963 } > "$destdir/$dir$ignore"
5965 echo "Create $destdir/$dir$ignore"
5975 if test -d "$destdir/CVS" ||
test -d "$destdir/${dir}CVS" ||
test -f "$destdir/${dir}.cvsignore"; then
5976 func_update_ignorelist .cvsignore
5978 if test -d "$destdir/.git" ||
test -f "$destdir/${dir}.gitignore"; then
5979 func_update_ignorelist .gitignore
5986 # Why not ''read next_dir op file'' ? Because the dir column can be empty.
5987 next_dir
=`echo "$line" | sed -e 's,|.*,,'`
5988 op
=`echo "$line" | sed -e 's,^[^|]*|\([^|]*\)|.*$,\1,'`
5989 file=`echo "$line" | sed -e 's,^[^|]*|[^|]*|,,'`
5990 if test "$next_dir" != "$last_dir"; then
5991 func_done_dir
"$last_dir" "$last_dir_added" "$last_dir_removed"
5992 last_dir
="$next_dir"
5997 A
) func_append last_dir_added
"$file$nl";;
5998 R
) func_append last_dir_removed
"$file$nl";;
6001 func_done_dir
"$last_dir" "$last_dir_added" "$last_dir_removed"
6008 echo "You may need to add #include directives for the following .h files."
6009 # Intersect $specified_modules and $main_modules
6010 # (since $specified_modules is not necessarily of subset of $main_modules
6011 # - some may have been skipped through --avoid, and since the elements of
6012 # $main_modules but not in $specified_modules can go away without explicit
6013 # notice - through changes in the module dependencies).
6014 echo "$specified_modules" > "$tmp"/modules1
# a sorted list, one module per line
6015 echo "$main_modules" > "$tmp"/modules2
# also a sorted list, one module per line
6016 # First the #include <...> directives without #ifs, sorted for convenience,
6017 # then the #include "..." directives without #ifs, sorted for convenience,
6018 # then the #include directives that are surrounded by #ifs. Not sorted.
6019 for module
in `LC_ALL=C join "$tmp"/modules1 "$tmp"/modules2`; do
6020 include_directive
=`func_get_include_directive "$module"`
6021 case "$nl$include_directive" in
6023 echo "$include_directive" 1>&5
6026 echo "$include_directive" |
grep -v 'include "' 1>&6
6027 echo "$include_directive" |
grep 'include "' 1>&7
6030 done 5> "$tmp"/include-if
6> "$tmp"/include-angles
7> "$tmp"/include-quotes
6032 LC_ALL
=C
sort -u "$tmp"/include-angles
6033 LC_ALL
=C
sort -u "$tmp"/include-quotes
6034 cat "$tmp"/include-if
6035 ) |
sed -e '/^$/d' -e 's/^/ /'
6036 rm -f "$tmp"/include-angles
"$tmp"/include-quotes
"$tmp"/include-if
6038 for module
in $main_modules; do
6039 func_get_link_directive
"$module"
6041 | LC_ALL
=C
sort -u |
sed -e '/^$/d' -e 's/^/ /' > "$tmp"/link
6042 if test `wc -l < "$tmp"/link` != 0; then
6044 echo "You may need to use the following Makefile variables when linking."
6045 echo "Use them in <program>_LDADD when linking a program, or"
6046 echo "in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library."
6052 echo "Don't forget to"
6053 if test "$makefile_am" = Makefile.am
; then
6054 echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
6056 echo " - \"include $makefile_name\" from within \"$sourcebase/Makefile.am\","
6058 if test -n "$pobase"; then
6059 echo " - add \"$pobase/Makefile.in\" to AC_CONFIG_FILES in $configure_ac,"
6062 if test "$makefile_am" = Makefile.am
; then
6063 echo " - add \"$testsbase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
6065 echo " - \"include $makefile_name\" from within \"$testsbase/Makefile.am\","
6069 while test $edit != $makefile_am_edits; do
6070 edit
=`expr $edit + 1`
6071 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
6072 eval var
=\"\
$makefile_am_edit${edit}_var
\"
6073 eval val
=\"\
$makefile_am_edit${edit}_val
\"
6074 if test -n "$var"; then
6075 echo " - mention \"${val}\" in ${var} in ${dir}Makefile.am,"
6078 if grep '^ *AC_PROG_CC_STDC' "$configure_ac" > /dev
/null
; then
6079 position_early_after
=AC_PROG_CC_STDC
6081 if grep '^ *AC_PROG_CC_C99' "$configure_ac" > /dev
/null
; then
6082 position_early_after
=AC_PROG_CC_C99
6084 position_early_after
=AC_PROG_CC
6087 echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after $position_early_after,"
6088 echo " - invoke ${macro_prefix}_INIT in $configure_ac."
6091 # func_create_testdir testdir modules
6093 # - local_gnulib_path from --local-dir
6094 # - modcache true or false, from --cache-modules/--no-cache-modules
6095 # - auxdir directory relative to destdir where to place build aux files
6096 # - inctests true if tests should be included, false otherwise
6097 # - incobsolete true if obsolete modules among dependencies should be
6098 # included, blank otherwise
6099 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
6101 # - excl_longrunning_tests true if long-runnings tests should be excluded,
6103 # - excl_privileged_tests true if tests that require root privileges should be
6104 # excluded, blank otherwise
6105 # - excl_unportable_tests true if tests that fail on some platforms should be
6106 # excluded, blank otherwise
6107 # - single_configure true if a single configure file should be generated,
6108 # false for a separate configure file for the tests
6109 # - avoidlist list of modules to avoid
6110 # - cond_dependencies true if --conditional-dependencies was given, false if
6111 # --no-conditional-dependencies was given, blank otherwise
6112 # - libtool true if --libtool was given, false if --no-libtool was
6113 # given, blank otherwise
6114 # - copymode copy mode for files in general
6115 # - lcopymode copy mode for files from local_gnulib_path
6116 func_create_testdir
()
6120 if test -z "$modules"; then
6121 # All modules together.
6122 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
6123 # Except non-recursive-gnulib-prefix-hack, which represents a nonstandard
6124 # way of using Automake.
6125 # Except timevar, which lacks the required file timevar.def.
6126 # Except ftruncate, mountlist, which abort the configuration on mingw. FIXME.
6127 # Except lib-ignore, which leads to link errors when Sun C++ is used. FIXME.
6128 modules
=`func_all_modules`
6129 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`
6131 specified_modules
="$modules"
6133 # Canonicalize the list of specified modules.
6134 specified_modules
=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
6136 # Test modules which invoke AC_CONFIG_FILES cannot be used with
6137 # --with-tests --single-configure. Avoid them.
6138 if $inctests && $single_configure; then
6139 avoidlist
="$avoidlist havelib-tests"
6142 # Unlike in func_import, here we want to include all kinds of tests for the
6143 # directly specified modules, but not for dependencies.
6144 inc_all_direct_tests
=true
6145 inc_all_indirect_tests
="$inc_all_tests"
6147 # Check that the license of every module is consistent with the license of
6149 saved_inctests
="$inctests"
6150 # When computing transitive closures, don't consider $module to depend on
6151 # $module-tests. Need this because tests are implicitly GPL and may depend
6152 # on GPL modules - therefore we don't want a warning in this case.
6154 for requested_module
in $specified_modules; do
6155 requested_license
=`func_get_license "$requested_module"`
6156 if test "$requested_license" != GPL
; then
6157 # Here we use func_modules_transitive_closure, not just
6158 # func_get_dependencies, so that we also detect weird situations like
6159 # an LGPL module which depends on a GPLed build tool module which depends
6161 modules
="$requested_module"
6162 func_modules_transitive_closure
6163 for module
in $modules; do
6164 license
=`func_get_license "$module"`
6166 'GPLed build tool') ;;
6167 'public domain' |
'unlimited' |
'unmodifiable license text') ;;
6169 case "$requested_license" in
6172 LGPLv2
+ |
'LGPLv3+ or GPLv2' | LGPLv3
+ | LGPL | GPLv2
+ | GPLv3
+ | GPL
) ;;
6173 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6178 LGPLv2
+ |
'LGPLv3+ or GPLv2' | GPLv2
+) ;;
6179 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6184 LGPLv2
+ |
'LGPLv3+ or GPLv2' | LGPLv3
+ | LGPL
) ;;
6185 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6190 LGPLv2
+ |
'LGPLv3+ or GPLv2') ;;
6191 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6197 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6206 inctests
="$saved_inctests"
6208 # Subdirectory names.
6219 # Determine final module list.
6220 modules
="$specified_modules"
6221 func_modules_transitive_closure
6222 if test $verbose -ge 0; then
6223 func_show_module_list
6225 final_modules
="$modules"
6227 if $single_configure; then
6228 # Determine main module list and tests-related module list separately.
6229 func_modules_transitive_closure_separately
6232 if $single_configure; then
6233 # Determine whether a $testsbase/libtests.a is needed.
6234 func_determine_use_libtests
6237 # Add the dummy module if needed.
6238 if $single_configure; then
6239 func_modules_add_dummy_separately
6241 func_modules_add_dummy
6245 # If $single_configure, we use the module lists $main_modules and
6246 # $testsrelated_modules; $modules is merely a temporary variable.
6247 # Whereas if ! $configure, the module list is $modules.
6249 # Show banner notice of every module.
6250 if $single_configure; then
6251 modules
="$main_modules"
6257 # Determine final file list.
6258 if $single_configure; then
6259 func_modules_to_filelist_separately
6261 func_modules_to_filelist
6262 if test $verbose -ge 0; then
6264 echo "$files" |
sed -e 's/^/ /'
6267 # Add files for which the copy in gnulib is newer than the one that
6268 # "automake --add-missing --copy" would provide.
6269 files
="$files build-aux/config.guess"
6270 files
="$files build-aux/config.sub"
6271 files
=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
6273 rewritten
='%REWRITTEN%'
6274 sed_rewrite_files
="\
6275 s,^build-aux/,$rewritten$auxdir/,
6276 s,^doc/,$rewritten$docbase/,
6277 s,^lib/,$rewritten$sourcebase/,
6278 s,^m4/,$rewritten$m4base/,
6279 s,^tests/,$rewritten$testsbase/,
6280 s,^tests=lib/,$rewritten$testsbase/,
6284 # Create directories.
6285 for f
in $files; do echo $f; done \
6286 |
sed -e "$sed_rewrite_files" \
6287 |
sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
6288 | LC_ALL
=C
sort -u \
6290 { # Rearrange file descriptors. Needed because "while ... done < ..."
6291 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
6292 exec 5<&0 < "$tmp"/dirs
6294 mkdir
-p "$testdir/$d"
6299 # Copy files or make symbolic links or hard links.
6301 for f
in $files; do echo $f; done \
6302 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_files" \
6305 { # Rearrange file descriptors. Needed because "while ... done < ..."
6306 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
6307 exec 5<&0 < "$tmp"/files
6310 tests
=lib
/*) f
=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
6312 func_lookup_file
"$f"
6313 if test -n "$lookedup_tmp"; then
6314 cp -p "$lookedup_file" "$testdir/$g"
6317 if test "$copyaction" = symlink
; then
6318 func_symlink
"$lookedup_file" "$testdir/$g"
6320 if test "$copyaction" = hardlink
; then
6321 func_hardlink
"$lookedup_file" "$testdir/$g"
6323 cp -p "$lookedup_file" "$testdir/$g"
6331 # Determine include_guard_prefix.
6332 func_compute_include_guard_prefix
6334 # Create Makefile.ams that are for testing.
6337 # No special edits are needed.
6340 # Create $sourcebase/Makefile.am.
6341 mkdir
-p "$testdir/$sourcebase"
6342 destfile
="$sourcebase/Makefile.am"
6343 if $single_configure; then
6344 modules
="$main_modules"
6346 func_emit_lib_Makefile_am
> "$testdir/$sourcebase/Makefile.am"
6347 any_uses_subdirs
="$uses_subdirs"
6349 # Create $m4base/Makefile.am.
6350 mkdir
-p "$testdir/$m4base"
6351 (echo "## Process this file with automake to produce Makefile.in."
6357 echo "EXTRA_DIST += "`echo "$f" | sed -e 's,^m4/,,'` ;;
6360 ) > "$testdir/$m4base/Makefile.am"
6362 subdirs
="$sourcebase $m4base"
6363 subdirs_with_configure_ac
=""
6365 if false
&& test -f "$testdir"/$m4base/gettext.
m4; then
6366 # Avoid stupid error message from automake:
6367 # "AM_GNU_GETTEXT used but `po' not in SUBDIRS"
6368 mkdir
-p "$testdir/po"
6369 (echo "## Process this file with automake to produce Makefile.in."
6370 ) > "$testdir/po/Makefile.am"
6371 func_append subdirs
" po"
6375 test -d "$testdir/$testsbase" || mkdir
"$testdir/$testsbase"
6376 if $single_configure; then
6377 # Create $testsbase/Makefile.am.
6378 destfile
="$testsbase/Makefile.am"
6379 modules
="$testsrelated_modules"
6380 func_emit_tests_Makefile_am
"${macro_prefix}tests_WITNESS" > "$testdir/$testsbase/Makefile.am"
6382 # Viewed from the $testsbase subdirectory, $auxdir is different.
6383 saved_auxdir
="$auxdir"
6384 auxdir
=`echo "$testsbase/" | sed -e 's%[^/][^/]*//*%../%g'`"$auxdir"
6385 # Create $testsbase/Makefile.am.
6387 destfile
="$testsbase/Makefile.am"
6388 func_emit_tests_Makefile_am
"" > "$testdir/$testsbase/Makefile.am"
6389 any_uses_subdirs
="$any_uses_subdirs$uses_subdirs"
6390 # Create $testsbase/configure.ac.
6391 (echo "# Process this file with autoconf to produce a configure script."
6392 echo "AC_INIT([dummy], [0])"
6393 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6394 echo "AM_INIT_AUTOMAKE"
6396 echo "AC_CONFIG_HEADERS([config.h])"
6399 echo "AC_PROG_INSTALL"
6400 echo "AC_PROG_MAKE_SET"
6402 func_emit_pre_early_macros false
'' "$modules"
6404 if test -n "$uses_subdirs"; then
6405 echo "AM_PROG_CC_C_O"
6408 for module
in $modules; do
6410 if test -n "$module"; then
6412 gnumakefile | maintainer-makefile
)
6413 # These modules are meant to be used only in the top-level directory.
6416 func_get_autoconf_early_snippet
"$module"
6421 |
sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
6422 if test "$libtool" = true
; then
6423 echo "LT_INIT([win32-dll])"
6424 echo "LT_LANG([C++])"
6425 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
6426 echo "gl_cond_libtool=true"
6428 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
6429 echo "gl_cond_libtool=false"
6431 echo "gl_ltlibdeps="
6433 # Wrap the set of autoconf snippets into an autoconf macro that is then
6434 # invoked. This is needed because autoconf does not support AC_REQUIRE
6436 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
6437 # but we want the AC_REQUIRE to have its normal meaning (provide one
6438 # expansion of the required macro before the current point, and only one
6440 echo "AC_DEFUN([gl_INIT], ["
6441 sed_replace_build_aux
='
6443 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
6444 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
6447 echo "gl_m4_base='../$m4base'"
6448 func_emit_initmacro_start
$macro_prefix
6449 # We don't have explicit ordering constraints between the various
6450 # autoconf snippets. It's cleanest to put those of the library before
6451 # those of the tests.
6452 echo "gl_source_base='../$sourcebase'"
6453 func_emit_autoconf_snippets
"$modules" "$modules" func_verify_nontests_module false false false
6454 echo "gl_source_base='.'"
6455 func_emit_autoconf_snippets
"$modules" "$modules" func_verify_tests_module false false false
6456 func_emit_initmacro_end
$macro_prefix
6457 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
6458 # created using libtool, because libtool already handles the dependencies.
6459 if test "$libtool" != true
; then
6460 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
6461 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
6462 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
6463 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
6464 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
6467 func_emit_initmacro_done
$macro_prefix $sourcebase # FIXME use $sourcebase or $testsbase?
6471 # Usually $testsbase/config.h will be a superset of config.h. Verify this
6472 # by "merging" config.h into $testsbase/config.h; look out for gcc warnings.
6473 echo "AH_TOP([#include \"../config.h\"])"
6475 echo "AC_CONFIG_FILES([Makefile])"
6477 ) > "$testdir/$testsbase/configure.ac"
6478 auxdir
="$saved_auxdir"
6479 subdirs_with_configure_ac
="$subdirs_with_configure_ac $testsbase"
6481 func_append subdirs
" $testsbase"
6484 # Create Makefile.am.
6485 (echo "## Process this file with automake to produce Makefile.in."
6487 echo "AUTOMAKE_OPTIONS = 1.11 foreign"
6489 echo "SUBDIRS = $subdirs"
6491 echo "ACLOCAL_AMFLAGS = -I $m4base"
6492 ) > "$testdir/Makefile.am"
6494 # Create configure.ac.
6495 (echo "# Process this file with autoconf to produce a configure script."
6496 echo "AC_INIT([dummy], [0])"
6497 if test "$auxdir" != "."; then
6498 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6500 echo "AM_INIT_AUTOMAKE"
6502 echo "AC_CONFIG_HEADERS([config.h])"
6505 echo "AC_PROG_INSTALL"
6506 echo "AC_PROG_MAKE_SET"
6508 echo "# For autobuild."
6509 echo "AC_CANONICAL_BUILD"
6510 echo "AC_CANONICAL_HOST"
6512 echo "m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
6513 echo "m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
6514 echo "m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
6515 echo "m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
6517 func_emit_pre_early_macros false
'' "$final_modules"
6519 if test -n "$any_uses_subdirs"; then
6520 echo "AM_PROG_CC_C_O"
6523 for module
in $final_modules; do
6524 if $single_configure; then
6527 func_verify_nontests_module
6529 if test -n "$module"; then
6530 func_get_autoconf_early_snippet
"$module"
6533 |
sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
6534 if test "$libtool" = true
; then
6535 echo "LT_INIT([win32-dll])"
6536 echo "LT_LANG([C++])"
6537 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
6538 echo "gl_cond_libtool=true"
6540 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
6541 echo "gl_cond_libtool=false"
6543 echo "gl_ltlibdeps="
6545 # Wrap the set of autoconf snippets into an autoconf macro that is then
6546 # invoked. This is needed because autoconf does not support AC_REQUIRE
6548 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
6549 # but we want the AC_REQUIRE to have its normal meaning (provide one
6550 # expansion of the required macro before the current point, and only one
6552 echo "AC_DEFUN([gl_INIT], ["
6553 if test "$auxdir" != "build-aux"; then
6554 sed_replace_build_aux
='
6556 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
6557 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
6561 sed_replace_build_aux
="$sed_noop"
6563 echo "gl_m4_base='$m4base'"
6564 func_emit_initmacro_start
$macro_prefix
6565 echo "gl_source_base='$sourcebase'"
6566 if $single_configure; then
6567 func_emit_autoconf_snippets
"$main_modules" "$main_modules" func_verify_module true false false
6569 func_emit_autoconf_snippets
"$modules" "$modules" func_verify_nontests_module true false false
6571 func_emit_initmacro_end
$macro_prefix
6572 if $single_configure; then
6573 echo " gltests_libdeps="
6574 echo " gltests_ltlibdeps="
6575 func_emit_initmacro_start
${macro_prefix}tests
6576 echo " gl_source_base='$testsbase'"
6577 # Define a tests witness macro.
6578 echo " ${macro_prefix}tests_WITNESS=IN_GNULIB_TESTS"
6579 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
6580 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
6581 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
6582 func_emit_autoconf_snippets
"$testsrelated_modules" "$main_modules $testsrelated_modules" func_verify_module true false false
6583 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
6584 func_emit_initmacro_end
${macro_prefix}tests
6586 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
6587 # created using libtool, because libtool already handles the dependencies.
6588 if test "$libtool" != true
; then
6589 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
6590 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
6591 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
6592 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
6593 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
6595 if $single_configure; then
6596 if $use_libtests; then
6597 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
6598 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
6602 func_emit_initmacro_done
$macro_prefix $sourcebase
6603 if $single_configure; then
6604 func_emit_initmacro_done
${macro_prefix}tests
$testsbase
6609 if test -n "$subdirs_with_configure_ac"; then
6610 echo "AC_CONFIG_SUBDIRS(["`echo $subdirs_with_configure_ac`"])"
6612 makefiles
="Makefile"
6613 for d
in $subdirs; do
6614 # For subdirs that have a configure.ac by their own, it's the subdir's
6615 # configure.ac which creates the subdir's Makefile.am, not this one.
6616 case " $subdirs_with_configure_ac " in
6618 *) func_append makefiles
" $d/Makefile" ;;
6621 echo "AC_CONFIG_FILES([$makefiles])"
6623 ) > "$testdir/configure.ac"
6625 # Create autogenerated files.
6627 # Do not use "${AUTORECONF} --force --install", because it may invoke
6628 # autopoint, which brings in older versions of some of our .m4 files.
6629 if test -f $m4base/gettext.
m4; then
6630 func_execute_command
${AUTOPOINT} --force || func_exit
1
6631 for f
in $m4base/*.
m4~
; do
6633 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit
1
6637 if test "$libtool" = true
; then
6638 func_execute_command
${LIBTOOLIZE} --copy || func_exit
1
6640 func_execute_command
${ACLOCAL} -I $m4base || func_exit
1
6641 if ! test -d build-aux
; then
6642 func_execute_command mkdir build-aux || func_exit
1
6644 func_execute_command
${AUTOCONF} || func_exit
1
6645 # Explicit 'touch config.h.in': see <https://savannah.gnu.org/support/index.php?109406>.
6646 func_execute_command
${AUTOHEADER} &&
6647 func_execute_command
touch config.h.
in ||
6649 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6650 rm -rf autom4te.cache
6652 if $inctests && ! $single_configure; then
6653 # Create autogenerated files.
6654 (cd "$testdir/$testsbase" || func_exit
1
6655 # Do not use "${AUTORECONF} --force --install", because it may invoke
6656 # autopoint, which brings in older versions of some of our .m4 files.
6657 if test -f ..
/$m4base/gettext.
m4; then
6658 func_execute_command
${AUTOPOINT} --force || func_exit
1
6659 for f
in ..
/$m4base/*.
m4~
; do
6661 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit
1
6665 func_execute_command
${ACLOCAL} -I ..
/$m4base || func_exit
1
6666 if ! test -d ..
/build-aux
; then
6667 func_execute_command mkdir ..
/build-aux
6669 func_execute_command
${AUTOCONF} || func_exit
1
6670 # Explicit 'touch config.h.in': see <https://savannah.gnu.org/support/index.php?109406>.
6671 func_execute_command
${AUTOHEADER} &&
6672 func_execute_command
touch config.h.
in ||
6674 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6675 rm -rf autom4te.cache
6678 # Need to run configure and make once, to create built files that are to be
6679 # distributed (such as parse-datetime.c).
6680 sed_remove_make_variables
='s,[$]([A-Za-z0-9_]*),,g'
6681 # Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...".
6682 cleaned_files
=`combine_lines < "$testdir/$sourcebase/Makefile.am" \
6683 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
6684 cleaned_files
=`for file in $cleaned_files; do echo " $file "; done`
6685 # Extract the value of "BUILT_SOURCES += ...". Remove variable references
6686 # such $(FOO_H) because they don't refer to distributed files.
6687 built_sources
=`combine_lines < "$testdir/$sourcebase/Makefile.am" \
6688 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
6689 | sed -e "$sed_remove_make_variables"`
6690 distributed_built_sources
=`for file in $built_sources; do
6691 case "$cleaned_files" in
6696 tests_distributed_built_sources
=
6698 # Likewise for built files in the $testsbase directory.
6699 tests_cleaned_files
=`combine_lines < "$testdir/$testsbase/Makefile.am" \
6700 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
6701 tests_cleaned_files
=`for file in $tests_cleaned_files; do echo " $file "; done`
6702 tests_built_sources
=`combine_lines < "$testdir/$testsbase/Makefile.am" \
6703 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
6704 | sed -e "$sed_remove_make_variables"`
6705 tests_distributed_built_sources
=`for file in $tests_built_sources; do
6706 case "$tests_cleaned_files" in
6712 if test -n "$distributed_built_sources" ||
test -n "$tests_distributed_built_sources"; then
6714 .
/configure || func_exit
1
6715 if test -n "$distributed_built_sources"; then
6717 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
6718 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6723 if test -n "$tests_distributed_built_sources"; then
6725 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
6726 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6731 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6737 if test -f build-aux
/test-driver
; then
6738 patch build-aux
/test-driver
< "$gnulib_dir"/build-aux
/test-driver.
diff || func_exit
1
6743 # func_create_megatestdir megatestdir allmodules
6745 # - local_gnulib_path from --local-dir
6746 # - modcache true or false, from --cache-modules/--no-cache-modules
6747 # - auxdir directory relative to destdir where to place build aux files
6748 func_create_megatestdir
()
6752 if test -z "$allmodules"; then
6753 allmodules
=`func_all_modules`
6757 # First, all modules one by one.
6758 for onemodule
in $allmodules; do
6759 func_create_testdir
"$megatestdir/$onemodule" $onemodule
6760 func_append megasubdirs
"$onemodule "
6762 # Then, all modules all together.
6763 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
6764 allmodules
=`for m in $allmodules; do if test $m != config-h; then echo $m; fi; done`
6765 func_create_testdir
"$megatestdir/ALL" "$allmodules"
6766 func_append megasubdirs
"ALL"
6769 cvsdate
=`vc_witness="$gnulib_dir/.git/refs/heads/master"; \
6770 sh "$gnulib_dir/build-aux/mdate-sh" "$vc_witness" \
6771 | sed -e 's,January,01,' -e 's,Jan,01,' \
6772 -e 's,February,02,' -e 's,Feb,02,' \
6773 -e 's,March,03,' -e 's,Mar,03,' \
6774 -e 's,April,04,' -e 's,Apr,04,' \
6776 -e 's,June,06,' -e 's,Jun,06,' \
6777 -e 's,July,07,' -e 's,Jul,07,' \
6778 -e 's,August,08,' -e 's,Aug,08,' \
6779 -e 's,September,09,' -e 's,Sep,09,' \
6780 -e 's,October,10,' -e 's,Oct,10,' \
6781 -e 's,November,11,' -e 's,Nov,11,' \
6782 -e 's,December,12,' -e 's,Dec,12,' \
6783 -e 's,^,00,' -e 's,^[0-9]*\([0-9][0-9] \),\1,' \
6784 -e 's,^\([0-9]*\) \([0-9]*\) \([0-9]*\),\3\2\1,'`
6786 echo "CVSDATE=$cvsdate"
6787 echo ": \${MAKE=make}"
6788 echo "test -d logs || mkdir logs"
6789 echo "for module in $megasubdirs; do"
6790 echo " echo \"Working on module \$module...\""
6791 echo " safemodule=\`echo \$module | sed -e 's|/|-|g'\`"
6792 echo " (echo \"To: gnulib@autobuild.josefsson.org\""
6795 echo " : autobuild project... \$module"
6796 echo " : autobuild revision... cvs-\$CVSDATE-000000"
6797 echo " : autobuild timestamp... \`date \"+%Y%m%d-%H%M%S\"\`"
6798 echo " : autobuild hostname... \`hostname\`"
6799 echo " cd \$module && ./configure \$CONFIGURE_OPTIONS && \$MAKE && \$MAKE check && \$MAKE distclean"
6801 echo " ) 2>&1 | { if test -n \"\$AUTOBUILD_SUBST\"; then sed -e \"\$AUTOBUILD_SUBST\"; else cat; fi; } > logs/\$safemodule"
6803 ) > "$megatestdir/do-autobuild"
6804 chmod a
+x
"$megatestdir/do-autobuild"
6806 # Create Makefile.am.
6807 (echo "## Process this file with automake to produce Makefile.in."
6809 echo "AUTOMAKE_OPTIONS = 1.11 foreign"
6811 echo "SUBDIRS = $megasubdirs"
6813 echo "EXTRA_DIST = do-autobuild"
6814 ) > "$megatestdir/Makefile.am"
6816 # Create configure.ac.
6817 (echo "# Process this file with autoconf to produce a configure script."
6818 echo "AC_INIT([dummy], [0])"
6819 if test "$auxdir" != "."; then
6820 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6822 echo "AM_INIT_AUTOMAKE"
6824 echo "AC_PROG_MAKE_SET"
6826 echo "AC_CONFIG_SUBDIRS([$megasubdirs])"
6827 echo "AC_CONFIG_FILES([Makefile])"
6829 ) > "$megatestdir/configure.ac"
6831 # Create autogenerated files.
6833 # Do not use "${AUTORECONF} --install", because autoreconf operates
6834 # recursively, but the subdirectories are already finished, therefore
6835 # calling autoreconf here would only waste lots of CPU time.
6836 func_execute_command
${ACLOCAL} || func_exit
1
6837 func_execute_command mkdir build-aux
6838 func_execute_command
${AUTOCONF} || func_exit
1
6839 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6840 rm -rf autom4te.cache
6841 if test -f build-aux
/test-driver
; then
6842 patch build-aux
/test-driver
< "$gnulib_dir"/build-aux
/test-driver.
diff || func_exit
1
6849 func_fatal_error
"no mode specified" ;;
6856 # sed expression that converts a literal to a basic regular expression.
6857 # Needs to handle . [ \ * ^ $.
6858 sed_literal_to_basic_regex
='s/\\/\\\\/g
6864 if test -f "$gnulib_dir/$filename" \
6865 || func_lookup_local_file
"$filename"; then
6866 filename_anywhere_regex
=`echo "$filename" | sed -e "$sed_literal_to_basic_regex"`
6867 filename_line_regex
='^'"$filename_anywhere_regex"'$'
6870 (cd "$gnulib_dir" && find modules -type f -print | xargs -n 100 grep -l "$filename_line_regex" /dev/null | sed -e 's,^modules/,,')
6871 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$,,'
6873 | func_sanitize_modulelist \
6876 for module
in $module_candidates; do
6877 if func_get_filelist
$module |
grep "$filename_line_regex" > /dev
/null
; then
6882 func_warning
"file $filename does not exist"
6887 import | add-import | remove-import | update
)
6890 if test -z "$destdir"; then
6893 test -d "$destdir" \
6894 || func_fatal_error
"destination directory does not exist: $destdir"
6896 # Prefer configure.ac to configure.in.
6897 if test -f "$destdir"/configure.ac
; then
6898 configure_ac
="$destdir/configure.ac"
6900 if test -f "$destdir"/configure.
in; then
6901 configure_ac
="$destdir/configure.in"
6903 func_fatal_error
"cannot find $destdir/configure.ac - make sure you run gnulib-tool from within your package's directory"
6907 # Analyze configure.ac.
6909 guessed_libtool
=false
6914 /AC_CONFIG_AUX_DIR/ {
6915 s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^]"$`\\)]*\).*$,guessed_auxdir="\1",p
6917 /A[CM]_PROG_LIBTOOL/ {
6918 s,^.*$,guessed_libtool=true,p
6920 eval `sed -n -e "$my_sed_traces" < "$configure_ac"`
6922 if test -z "$auxdir"; then
6923 auxdir
="$guessed_auxdir"
6926 # Determine where to apply func_import.
6927 if test "$mode" = import
; then
6928 # Apply func_import to a particular gnulib directory.
6929 # The command line contains the complete specification; don't look at
6930 # the contents of gnulib-cache.m4.
6931 test -n "$supplied_libname" || supplied_libname
=true
6932 test -n "$sourcebase" || sourcebase
="lib"
6933 test -n "$m4base" || m4base
="m4"
6934 test -n "$docbase" || docbase
="doc"
6935 test -n "$testsbase" || testsbase
="tests"
6936 test -n "$macro_prefix" || macro_prefix
="gl"
6939 if test -n "$m4base"; then
6940 # Apply func_import to a particular gnulib directory.
6941 # Any number of additional modules can be given.
6942 if test ! -f "$destdir/$m4base"/gnulib-cache.
m4; then
6943 # First use of gnulib in the given m4base.
6944 test -n "$supplied_libname" || supplied_libname
=true
6945 test -n "$sourcebase" || sourcebase
="lib"
6946 test -n "$docbase" || docbase
="doc"
6947 test -n "$testsbase" || testsbase
="tests"
6948 test -n "$macro_prefix" || macro_prefix
="gl"
6952 # Apply func_import to all gnulib directories.
6953 # To get this list of directories, look at Makefile.am. (Not at
6954 # configure, because it may be omitted from version control. Also,
6955 # don't run "find $destdir -name gnulib-cache.m4", as it might be
6959 if test -f "$destdir"/Makefile.am
; then
6960 aclocal_amflags
=`sed -n -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/p' "$destdir"/Makefile.am`
6962 for arg
in $aclocal_amflags; do
6963 if test -n "$m4dir_is_next"; then
6964 # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
6968 if test -f "$destdir/$arg"/gnulib-cache.
m4; then
6969 func_append m4dirs
" $arg"
6970 m4dirs_count
=`expr $m4dirs_count + 1`
6976 if test "X$arg" = "X-I"; then
6984 # No Makefile.am! Oh well. Look at the last generated aclocal.m4.
6985 if test -f "$destdir"/aclocal.
m4; then
6986 sedexpr1
='s,^m4_include(\[\(.*\)])$,\1,p'
6987 sedexpr2
='s,^[^/]*$,.,'
6988 sedexpr3
='s,/[^/]*$,,'
6989 m4dirs
=`sed -n -e "$sedexpr1" aclocal.m4 | sed -e "$sedexpr2" -e "$sedexpr3" | LC_ALL=C sort -u`
6990 m4dirs
=`for arg in $m4dirs; do if test -f "$destdir/$arg"/gnulib-cache.m4; then echo $arg; fi; done`
6991 m4dirs_count
=`for arg in $m4dirs; do echo "$arg"; done | wc -l`
6994 if test $m4dirs_count = 0; then
6995 # First use of gnulib in a package.
6996 # Any number of additional modules can be given.
6997 test -n "$supplied_libname" || supplied_libname
=true
6998 test -n "$sourcebase" || sourcebase
="lib"
7000 test -n "$docbase" || docbase
="doc"
7001 test -n "$testsbase" || testsbase
="tests"
7002 test -n "$macro_prefix" || macro_prefix
="gl"
7005 if test $m4dirs_count = 1; then
7006 # There's only one use of gnulib here. Assume the user means it.
7007 # Any number of additional modules can be given.
7008 for m4base
in $m4dirs; do
7012 # Ambiguous - guess what the user meant.
7013 if test $# = 0; then
7014 # No further arguments. Guess the user wants to update all of them.
7015 for m4base
in $m4dirs; do
7016 # Perform func_import in a subshell, so that variable values
7018 # local_gnulib_path, incobsolete, inc_cxx_tests,
7019 # inc_longrunning_tests, inc_privileged_tests,
7020 # inc_unportable_tests, inc_all_tests, avoidlist, sourcebase,
7021 # m4base, pobase, docbase, testsbase, inctests, libname, lgpl,
7022 # makefile_name, libtool, macro_prefix, po_domain,
7023 # witness_c_macro, vc_files
7024 # don't propagate from one directory to another.
7025 (func_import
) || func_exit
1
7029 func_fatal_error
"Ambiguity: to which directory should the modules be added? Please specify at least --m4-base=..."
7038 if test -z "$destdir"; then
7039 func_fatal_error
"please specify --dir option"
7042 test -d "$destdir" \
7043 || func_fatal_error
"could not create destination directory"
7044 test -n "$auxdir" || auxdir
="build-aux"
7045 func_create_testdir
"$destdir" "$*"
7048 create-megatestdir
)
7049 if test -z "$destdir"; then
7050 func_fatal_error
"please specify --dir option"
7052 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
7053 test -n "$auxdir" || auxdir
="build-aux"
7054 func_create_megatestdir
"$destdir" "$*"
7058 test -n "$destdir" || destdir
=testdir$$
7059 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
7060 test -n "$auxdir" || auxdir
="build-aux"
7061 func_create_testdir
"$destdir" "$*"
7065 ..
/configure || func_exit
1
7066 $MAKE || func_exit
1
7067 $MAKE check || func_exit
1
7068 $MAKE distclean || func_exit
1
7069 remaining
=`find . -type f -print`
7070 if test -n "$remaining"; then
7071 echo "Remaining files:" $remaining 1>&2
7072 echo "gnulib-tool: *** Stop." 1>&2
7081 test -n "$destdir" || destdir
=testdir$$
7082 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
7083 test -n "$auxdir" || auxdir
="build-aux"
7084 func_create_megatestdir
"$destdir" "$*"
7092 remaining
=`find . -type f -print`
7093 if test -n "$remaining"; then
7094 echo "Remaining files:" $remaining 1>&2
7095 echo "gnulib-tool: *** Stop." 1>&2
7103 extract-description
)
7107 if test -n "$module"; then
7108 func_get_description
"$module"
7117 if test -n "$module"; then
7118 func_get_comment
"$module"
7127 if test -n "$module"; then
7128 func_get_status
"$module"
7137 if test -n "$module"; then
7138 func_get_notice
"$module"
7143 extract-applicability
)
7147 if test -n "$module"; then
7148 func_get_applicability
"$module"
7157 if test -n "$module"; then
7158 func_get_filelist
"$module"
7163 extract-dependencies
)
7164 if test -n "$avoidlist"; then
7165 func_fatal_error
"cannot combine --avoid and --extract-dependencies"
7170 if test -n "$module"; then
7171 func_get_dependencies
"$module"
7176 extract-recursive-dependencies
)
7177 if test -n "$avoidlist"; then
7178 func_fatal_error
"cannot combine --avoid and --extract-recursive-dependencies"
7183 if test -n "$module"; then
7184 func_get_dependencies_recursively
"$module"
7189 extract-autoconf-snippet
)
7193 if test -n "$module"; then
7194 func_get_autoconf_snippet
"$module"
7199 extract-automake-snippet
)
7203 if test -n "$module"; then
7204 func_get_automake_snippet
"$module"
7209 extract-include-directive
)
7213 if test -n "$module"; then
7214 func_get_include_directive
"$module"
7219 extract-link-directive
)
7223 if test -n "$module"; then
7224 func_get_link_directive
"$module"
7229 extract-recursive-link-directive
)
7230 if test -n "$avoidlist"; then
7231 func_fatal_error
"cannot combine --avoid and --extract-recursive-link-directive"
7236 if test -n "$module"; then
7237 func_get_link_directive_recursively
"$module"
7246 if test -n "$module"; then
7247 func_get_license
"$module"
7252 extract-maintainer
)
7256 if test -n "$module"; then
7257 func_get_maintainer
"$module"
7262 extract-tests-module
)
7266 if test -n "$module"; then
7267 func_get_tests_module
"$module"
7273 # Verify the number of arguments.
7274 if test $# -lt 1 ||
test $# -gt 2; then
7275 func_fatal_error
"invalid number of arguments for --$mode"
7278 # The first argument is the file to be copied.
7280 # Verify the file exists.
7281 func_lookup_file
"$f"
7283 # The second argument is the destination; either a directory ot a file.
7284 # It defaults to the current directory.
7286 test -n "$dest" || dest
='.'
7287 test -n "$sourcebase" || sourcebase
="lib"
7288 test -n "$m4base" || m4base
="m4"
7289 test -n "$docbase" || docbase
="doc"
7290 test -n "$testsbase" || testsbase
="tests"
7291 test -n "$auxdir" || auxdir
="build-aux"
7292 rewritten
='%REWRITTEN%'
7293 sed_rewrite_files
="\
7294 s,^build-aux/,$rewritten$auxdir/,
7295 s,^doc/,$rewritten$docbase/,
7296 s,^lib/,$rewritten$sourcebase/,
7297 s,^m4/,$rewritten$m4base/,
7298 s,^tests/,$rewritten$testsbase/,
7301 if test -d "$dest"; then
7303 g
=`echo "$f" | sed -e "$sed_rewrite_files"`
7305 destdir
=`dirname "$dest"`
7306 g
=`basename "$dest"`
7309 # Create the directory for destfile.
7310 d
=`dirname "$destdir/$g"`
7312 if test -n "$d" && test ! -d "$d"; then
7313 mkdir
-p "$d" || func_fatal_error
"failed"
7317 func_dest_tmpfilename
"$g"
7318 cp "$lookedup_file" "$tmpfile" || func_fatal_error
"failed"
7319 already_present
=true
7320 if test -f "$destdir/$g"; then
7321 # The file already exists.
7325 # Don't protest if the file should be there but isn't: it happens
7326 # frequently that developers don't put autogenerated files under version
7334 func_fatal_error
"unknown operation mode --$mode" ;;
7337 if test "$copymode" = hardlink
-o "$lcopymode" = hardlink
; then
7338 # Setting hard links modifies the ctime of files in the gnulib checkout.
7339 # This disturbs the result of the next "gitk" invocation.
7340 # Workaround: Let git scan the files. This can be done through
7341 # "git update-index --refresh" or "git status" or "git diff".
7342 if test -d "$gnulib_dir"/.git \
7343 && (git
--version) >/dev
/null
2>/dev
/null
; then
7344 (cd "$gnulib_dir" && git update-index
--refresh >/dev
/null
)
7349 # Undo the effect of the previous 'trap' command. Some shellology:
7350 # We cannot use "trap - 0 1 2 3 13 15", because Solaris sh would attempt to
7351 # execute the command "-". "trap '' ..." is fine only for signal 0 (= normal
7352 # exit); for the others we need to call 'exit' explicitly. The value of $? is
7353 # 128 + signal number and is set before the trap-registered command is run.
7355 trap 'func_exit $?' 1 2 3 13 15
7360 # indent-tabs-mode: nil
7361 # whitespace-check-buffer-indent: nil