3 # Copyright (C) 2002-2018 Free Software Foundation, Inc.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 # This program is meant for authors or maintainers which want to import
20 # modules from gnulib into their packages.
28 # You can set AUTOCONFPATH to empty if autoconf 2.57 is already in your PATH.
32 # AUTOCONFBINDIR=/packages/gnu-inst-autoconf/2.57/bin
33 # AUTOCONFPATH="eval env PATH=${AUTOCONFBINDIR}:\$PATH "
37 # You can set AUTOMAKEPATH to empty if automake 1.9.x is already in your PATH.
40 # You can set GETTEXTPATH to empty if autopoint 0.15 is already in your PATH.
43 # You can set LIBTOOLPATH to empty if libtoolize 2.x is already in your PATH.
46 # If you didn't set AUTOCONFPATH and AUTOMAKEPATH, you can also set the
47 # variables AUTOCONF, AUTOHEADER, ACLOCAL, AUTOMAKE, AUTORECONF individually.
48 if test -z "${AUTOCONF}" ||
test -n "${AUTOCONFPATH}"; then
49 AUTOCONF
="${AUTOCONFPATH}autoconf"
51 if test -z "${AUTOHEADER}" ||
test -n "${AUTOCONFPATH}"; then
52 AUTOHEADER
="${AUTOCONFPATH}autoheader"
54 if test -z "${ACLOCAL}" ||
test -n "${AUTOMAKEPATH}"; then
55 ACLOCAL
="${AUTOMAKEPATH}aclocal"
57 if test -z "${AUTOMAKE}" ||
test -n "${AUTOMAKEPATH}"; then
58 AUTOMAKE
="${AUTOMAKEPATH}automake"
60 if test -z "${AUTORECONF}" ||
test -n "${AUTOCONFPATH}"; then
61 AUTORECONF
="${AUTOCONFPATH}autoreconf"
64 # If you didn't set GETTEXTPATH, you can also set the variable AUTOPOINT.
65 if test -z "${AUTOPOINT}" ||
test -n "${GETTEXTPATH}"; then
66 AUTOPOINT
="${GETTEXTPATH}autopoint"
69 # If you didn't set LIBTOOLPATH, you can also set the variable LIBTOOLIZE.
70 if test -z "${LIBTOOLIZE}" ||
test -n "${LIBTOOLPATH}"; then
71 LIBTOOLIZE
="${LIBTOOLPATH}libtoolize"
75 if test -z "${MAKE}"; then
79 # When using GNU sed, turn off as many GNU extensions as possible,
80 # to minimize the risk of accidentally using non-portable features.
81 # However, do this only for gnulib-tool itself, not for the code that
82 # gnulib-tool generates, since we don't want "sed --posix" to leak
83 # into makefiles. And do it only for sed versions 4.2 or newer,
84 # because "sed --posix" is buggy in GNU sed 4.1.5, see
85 # <https://lists.gnu.org/r/bug-gnulib/2009-02/msg00225.html>.
86 if (alias) > /dev
/null
2>&1 \
87 && echo |
sed --posix -e d
>/dev
/null
2>&1 \
88 && case `sed --version | sed -e 's/^[^0-9]*//' -e 1q` in \
89 [1-3]* |
4.
[01]*) false
;; \
93 # Define sed as an alias.
94 # It is not always possible to use aliases. Aliases are guaranteed to work
95 # if the executing shell is bash and either it is invoked as /bin/sh or
96 # is a version >= 2.0, supporting shopt. This is the common case.
97 # Two other approaches (use of a variable $sed or of a function func_sed
98 # instead of an alias) require massive, fragile code changes.
99 # An other approach (use of function sed) requires `which sed` - but
100 # 'which' is hard to emulate, due to missing "test -x" on some platforms.
101 if test -n "$BASH_VERSION"; then
102 shopt -s expand_aliases
>/dev
/null
2>&1
104 alias sed='sed --posix'
107 # sed_noop is a sed expression that does nothing.
108 # An empty expression does not work with the native 'sed' on AIX 6.1.
111 # sed_comments is true or false, depending whether 'sed' supports comments.
112 # AIX 5.3 sed barfs over indented comments.
113 if echo fo |
sed -e 's/f/g/
116 s/o/e/' 2>/dev
/null |
grep ge
> /dev
/null
; then
123 # outputs to stdout the --help usage message.
127 Usage: gnulib-tool --list
128 gnulib-tool --find filename
129 gnulib-tool --import [module1 ... moduleN]
130 gnulib-tool --add-import [module1 ... moduleN]
131 gnulib-tool --remove-import [module1 ... moduleN]
133 gnulib-tool --create-testdir --dir=directory [module1 ... moduleN]
134 gnulib-tool --create-megatestdir --dir=directory [module1 ... moduleN]
135 gnulib-tool --test --dir=directory module1 ... moduleN
136 gnulib-tool --megatest --dir=directory [module1 ... moduleN]
137 gnulib-tool --extract-description module
138 gnulib-tool --extract-comment module
139 gnulib-tool --extract-status module
140 gnulib-tool --extract-notice module
141 gnulib-tool --extract-applicability module
142 gnulib-tool --extract-filelist module
143 gnulib-tool --extract-dependencies module
144 gnulib-tool --extract-autoconf-snippet module
145 gnulib-tool --extract-automake-snippet module
146 gnulib-tool --extract-include-directive module
147 gnulib-tool --extract-link-directive module
148 gnulib-tool --extract-license module
149 gnulib-tool --extract-maintainer module
150 gnulib-tool --extract-tests-module module
151 gnulib-tool --copy-file file [destination]
155 --list print the available module names
156 --find find the modules which contain the specified file
157 --import import the given modules into the current package
158 --add-import augment the list of imports from gnulib into the
159 current package, by adding the given modules;
160 if no modules are specified, update the current
161 package from the current gnulib
162 --remove-import reduce the list of imports from gnulib into the
163 current package, by removing the given modules
164 --update update the current package, restore files omitted
166 --create-testdir create a scratch package with the given modules
167 --create-megatestdir create a mega scratch package with the given modules
168 one by one and all together
169 --test test the combination of the given modules
170 (recommended to use CC=\"gcc -Wall\" here)
171 --megatest test the given modules one by one and all together
172 (recommended to use CC=\"gcc -Wall\" here)
173 --extract-description extract the description
174 --extract-comment extract the comment
175 --extract-status extract the status (obsolete etc.)
176 --extract-notice extract the notice or banner
177 --extract-applicability extract the applicability
178 --extract-filelist extract the list of files
179 --extract-dependencies extract the dependencies
180 --extract-autoconf-snippet extract the snippet for configure.ac
181 --extract-automake-snippet extract the snippet for library makefile
182 --extract-include-directive extract the #include directive
183 --extract-link-directive extract the linker directive
184 --extract-license report the license terms of the source files
186 --extract-maintainer report the maintainer(s) inside gnulib
187 --extract-tests-module report the unit test module, if it exists
188 --copy-file copy a file that is not part of any module
189 --help Show this help text.
190 --version Show version and authorship information.
194 --dir=DIRECTORY Specify the target directory.
195 For --import, this specifies where your
196 configure.ac can be found. Defaults to current
198 --local-dir=DIRECTORY Specify a local override directory where to look
199 up files before looking in gnulib's directory.
200 --cache-modules Enable module caching optimization.
201 --no-cache-modules Disable module caching optimization.
202 --verbose Increase verbosity. May be repeated.
203 --quiet Decrease verbosity. May be repeated.
205 Options for --import, --add/remove-import, --update:
207 --dry-run Only print what would have been done.
209 Options for --import, --add/remove-import:
211 --with-tests Include unit tests for the included modules.
213 Options for --create-[mega]testdir, --[mega]test:
215 --without-tests Don't include unit tests for the included modules.
217 Options for --import, --add/remove-import,
218 --create-[mega]testdir, --[mega]test:
220 --with-obsolete Include obsolete modules when they occur among the
221 dependencies. By default, dependencies to obsolete
223 --with-c++-tests Include even unit tests for C++ interoperability.
224 --without-c++-tests Exclude unit tests for C++ interoperability.
225 --with-longrunning-tests
226 Include even unit tests that are long-runners.
227 --without-longrunning-tests
228 Exclude unit tests that are long-runners.
229 --with-privileged-tests
230 Include even unit tests that require root
232 --without-privileged-tests
233 Exclude unit tests that require root privileges.
234 --with-unportable-tests
235 Include even unit tests that fail on some platforms.
236 --without-unportable-tests
237 Exclude unit tests that fail on some platforms.
238 --with-all-tests Include all kinds of problematic unit tests.
239 --avoid=MODULE Avoid including the given MODULE. Useful if you
240 have code that provides equivalent functionality.
241 This option can be repeated.
242 --conditional-dependencies
243 Support conditional dependencies (may save configure
244 time and object code).
245 --no-conditional-dependencies
246 Don't use conditional dependencies.
247 --libtool Use libtool rules.
248 --no-libtool Don't use libtool rules.
250 Options for --import, --add/remove-import:
252 --lib=LIBRARY Specify the library name. Defaults to 'libgnu'.
253 --source-base=DIRECTORY
254 Directory relative to --dir where source code is
255 placed (default \"lib\").
256 --m4-base=DIRECTORY Directory relative to --dir where *.m4 macros are
257 placed (default \"m4\").
258 --po-base=DIRECTORY Directory relative to --dir where *.po files are
259 placed (default \"po\").
260 --doc-base=DIRECTORY Directory relative to --dir where doc files are
261 placed (default \"doc\").
262 --tests-base=DIRECTORY
263 Directory relative to --dir where unit tests are
264 placed (default \"tests\").
265 --aux-dir=DIRECTORY Directory relative to --dir where auxiliary build
266 tools are placed (default comes from configure.ac).
267 --gnu-make Output for GNU Make instead of for the default
269 --lgpl[=2|=3orGPLv2|=3]
270 Abort if modules aren't available under the LGPL.
271 Also modify license template from GPL to LGPL.
272 The version number of the LGPL can be specified;
273 the default is currently LGPLv3.
274 --makefile-name=NAME Name of makefile in the source-base and tests-base
275 directories (default \"Makefile.am\", or
276 \"Makefile.in\" if --gnu-make).
277 --macro-prefix=PREFIX Specify the prefix of the macros 'gl_EARLY' and
278 'gl_INIT'. Default is 'gl'.
279 --po-domain=NAME Specify the prefix of the i18n domain. Usually use
280 the package name. A suffix '-gnulib' is appended.
281 --witness-c-macro=NAME Specify the C macro that is defined when the
282 sources in this directory are compiled or used.
283 --vc-files Update version control related files.
284 --no-vc-files Don't update version control related files
285 (.gitignore and/or .cvsignore).
287 Options for --create-[mega]testdir, --[mega]test:
289 --single-configure Generate a single configure file, not a separate
290 configure file for the tests directory.
292 Options for --import, --add/remove-import, --update,
293 --create-[mega]testdir, --[mega]test:
295 -s, --symbolic, --symlink Make symbolic links instead of copying files.
296 --local-symlink Make symbolic links instead of copying files, only
297 for files from the local override directory.
298 -h, --hardlink Make hard links instead of copying files.
299 --local-hardlink Make hard links instead of copying files, only
300 for files from the local override directory.
302 Options for --import, --add/remove-import, --update:
304 -S, --more-symlinks Make symbolic links instead of copying files, and
305 don't replace copyright notices.
306 -H, --more-hardlinks Make hard links instead of copying files, and
307 don't replace copyright notices.
309 Report bugs to <bug-gnulib@gnu.org>."
313 # outputs to stdout the --version message.
317 if test -d "$gnulib_dir"/.git \
318 && (git
--version) >/dev
/null
2>/dev
/null \
319 && (date --version) >/dev
/null
2>/dev
/null
; then
320 # gnulib checked out from git.
321 sed_extract_first_date
='/^Date/{
325 date=`cd "$gnulib_dir" && git log ChangeLog | sed -n -e "$sed_extract_first_date"`
326 # Turn "Fri Mar 21 07:16:51 2008 -0600" into "Mar 21 2008 07:16:51 -0600".
327 sed_year_before_time
='s/^[^ ]* \([^ ]*\) \([0-9]*\) \([0-9:]*\) \([0-9]*\) /\1 \2 \4 \3 /'
328 date=`echo "$date" | sed -e "$sed_year_before_time"`
329 # Use GNU date to compute the time in GMT.
330 date=`date -d "$date" -u +"%Y-%m-%d %H:%M:%S"`
331 version
=' '`cd "$gnulib_dir" && ./build-aux/git-version-gen /dev/null | sed -e 's/-dirty/-modified/'`
333 # gnulib copy without versioning information.
334 date=`sed -e 's/ .*//;q' "$gnulib_dir"/ChangeLog`
337 year
=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed -e 's,^.* ,,'`
339 gnulib-tool (GNU $package $date)$version
340 Copyright (C) $year Free Software Foundation, Inc.
341 License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
342 This is free software: you are free to change and redistribute it.
343 There is NO WARRANTY, to the extent permitted by law.
345 printf "Written by %s, %s, and %s.\n" "Bruno Haible" "Paul Eggert" "Simon Josefsson"
348 # func_emit_copyright_notice
349 # outputs to stdout a header for a generated file.
350 func_emit_copyright_notice
()
352 sed -n -e '/Copyright/ {
355 }' < "$self_abspathname"
357 echo "# This file is free software; you can redistribute it and/or modify"
358 echo "# it under the terms of the GNU General Public License as published by"
359 echo "# the Free Software Foundation; either version 3 of the License, or"
360 echo "# (at your option) any later version."
362 echo "# This file is distributed in the hope that it will be useful,"
363 echo "# but WITHOUT ANY WARRANTY; without even the implied warranty of"
364 echo "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
365 echo "# GNU General Public License for more details."
367 echo "# You should have received a copy of the GNU General Public License"
368 echo "# along with this file. If not, see <https://www.gnu.org/licenses/>."
370 echo "# As a special exception to the GNU General Public License,"
371 echo "# this file may be distributed as part of a program that"
372 echo "# contains a configuration script generated by Autoconf, under"
373 echo "# the same distribution terms as the rest of that program."
375 echo "# Generated by gnulib-tool."
379 # exits with a given status.
380 # This function needs to be used, rather than 'exit', when a 'trap' handler is
381 # in effect that refers to $?.
388 # locates the directory where the gnulib repository lives
390 # - progname name of this program
392 # - self_abspathname absolute pathname of gnulib-tool
393 # - gnulib_dir absolute pathname of gnulib repository
397 /* | ?
:*) self_abspathname
="$progname" ;;
398 */*) self_abspathname
=`pwd`/"$progname" ;;
401 # Iterate through the elements of $PATH.
402 # We use IFS=: instead of
403 # for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'`
404 # because the latter does not work when some PATH element contains spaces.
405 # We use a canonicalized $pathx instead of $PATH, because empty PATH
406 # elements are by definition equivalent to '.', however field splitting
407 # according to IFS=: loses empty fields in many shells:
408 # - /bin/sh on OSF/1 and Solaris loses all empty fields (at the
409 # beginning, at the end, and in the middle),
410 # - /bin/sh on IRIX and /bin/ksh on IRIX and OSF/1 lose empty fields
411 # at the beginning and at the end,
412 # - GNU bash, /bin/sh on AIX and HP-UX, and /bin/ksh on AIX, HP-UX,
413 # Solaris lose empty fields at the end.
414 # The 'case' statement is an optimization, to avoid evaluating the
415 # explicit canonicalization command when $PATH contains no empty fields.
417 if test "$PATH_SEPARATOR" = ";"; then
418 # On Windows, programs are searched in "." before $PATH.
421 # On Unix, we have to convert empty PATH elements to ".".
425 pathx
=`echo ":$PATH:" | sed -e 's/:::*/:.:/g' -e 's/^://' -e 's/:\$//'`
430 IFS
="$PATH_SEPARATOR"
434 if test -x "$d/$progname" && test ! -d "$d/$progname"; then
435 self_abspathname
="$d/$progname"
440 if test -z "$self_abspathname"; then
441 func_fatal_error
"could not locate the gnulib-tool program - how did you invoke it?"
445 while test -h "$self_abspathname"; do
446 # Resolve symbolic link.
447 linkval
=`func_readlink "$self_abspathname"`
448 test -n "$linkval" ||
break
450 /* | ?
:* ) self_abspathname
="$linkval" ;;
451 * ) self_abspathname
=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;;
454 gnulib_dir
=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
458 # creates a temporary directory.
460 # - progname name of this program
462 # - tmp pathname of freshly created temporary directory
465 # Use the environment variable TMPDIR, falling back to /tmp. This allows
466 # users to specify a different temporary directory, for example, if their
467 # /tmp is filled up or too small.
470 # Use the mktemp program if available. If not available, hide the error
472 tmp
=`(umask 077 && mktemp -d "$TMPDIR/glXXXXXX") 2>/dev/null` &&
473 test -n "$tmp" && test -d "$tmp"
476 # Use a simple mkdir command. It is guaranteed to fail if the directory
477 # already exists. $RANDOM is bash specific and expands to empty in shells
478 # other than bash, ksh and zsh. Its use does not increase security;
479 # rather, it minimizes the probability of failure in a very cluttered /tmp
481 tmp
=$TMPDIR/gl$$
-$RANDOM
482 (umask 077 && mkdir
"$tmp")
485 echo "$progname: cannot create a temporary directory in $TMPDIR" >&2
490 # func_append var value
491 # appends the given value to the shell variable var.
492 if ( foo
=bar
; foo
+=baz
&& test "$foo" = barbaz
) >/dev
/null
2>&1; then
493 # Use bash's += operator. It reduces complexity of appending repeatedly to
494 # a single variable from O(n^2) to O(n).
499 fast_func_append
=true
503 eval "$1=\"\$$1\$2\""
505 fast_func_append
=false
508 # func_remove_prefix var prefix
509 # removes the given prefix from the value of the shell variable var.
510 # var should be the name of a shell variable.
511 # Its value should not contain a newline and not start or end with whitespace.
512 # prefix should not contain the characters "$`\{}[]^|.
513 if ( foo
=bar
; eval 'test "${foo#b}" = ar' ) >/dev
/null
2>&1; then
514 func_remove_prefix
()
518 fast_func_remove_prefix
=true
520 func_remove_prefix
()
522 eval "value=\"\$$1\""
526 sed_escape_dots
='s/\([.]\)/\\\1/g'
527 prefix
=`echo "$prefix" | sed -e "$sed_escape_dots"`
530 value
=`echo "$value" | sed -e "s|^${prefix}||"`
531 eval "$1=\"\$value\""
533 fast_func_remove_prefix
=false
536 # Determine whether we should use ':' or ';' as PATH_SEPARATOR.
537 func_determine_path_separator
()
539 if test "${PATH_SEPARATOR+set}" != set; then
540 # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
541 # contains only /bin. Note that ksh looks also at the FPATH variable,
542 # so we have to set that as well for the test.
544 (PATH
='/bin;/bin'; FPATH
=$PATH; sh
-c :) >/dev
/null
2>&1 \
545 && { (PATH
='/bin:/bin'; FPATH
=$PATH; sh
-c :) >/dev
/null
2>&1 \
546 || PATH_SEPARATOR
=';'
551 # func_path_prepend pathvar directory
552 # puts directory before pathvar, delimiting directories by PATH_SEPARATOR.
553 # Newly added directory into pathvar has the highest priority.
556 if eval "test -n \"\$$1\""; then
557 eval "$1=\$2\$PATH_SEPARATOR\$$1"
563 # func_path_append pathvar directory
564 # Similar to func_path_prepend except that the newest directory has the lowest
568 if eval "test -n \"\$$1\""; then
569 func_append
"$1" "$PATH_SEPARATOR$2"
575 # func_path_foreach_inner
576 # helper for func_path_foreach because we need new 'args' array
578 # - fpf_dir directory from local_gnulib_path
579 # - fpf_cb callback to be run for fpf_dir
580 func_path_foreach_inner
()
602 # func_path_foreach path method args
603 # Execute method for each directory in path. The method will be called
604 # like `method args` while any argument '%dir%' within args will be replaced
605 # with processed directory from path.
614 for fpf_dir
in $fpf_dirs
616 func_path_foreach_inner
"$@" && fpf_rc
=:
622 # func_remove_suffix var suffix
623 # removes the given suffix from the value of the shell variable var.
624 # var should be the name of a shell variable.
625 # Its value should not contain a newline and not start or end with whitespace.
626 # suffix should not contain the characters "$`\{}[]^|.
627 if ( foo
=bar
; eval 'test "${foo%r}" = ba' ) >/dev
/null
2>&1; then
628 func_remove_suffix
()
632 fast_func_remove_suffix
=true
634 func_remove_suffix
()
636 eval "value=\"\$$1\""
640 sed_escape_dots
='s/\([.]\)/\\\1/g'
641 suffix
=`echo "$suffix" | sed -e "$sed_escape_dots"`
644 value
=`echo "$value" | sed -e "s|${suffix}\$||"`
645 eval "$1=\"\$value\""
647 fast_func_remove_suffix
=false
650 # func_fatal_error message
651 # outputs to stderr a fatal error message, and terminates the program.
653 # - progname name of this program
656 echo "$progname: *** $1" 1>&2
657 echo "$progname: *** Stop." 1>&2
661 # func_warning message
662 # Outputs to stderr a warning message,
665 echo "gnulib-tool: warning: $1" 1>&2
668 # func_readlink SYMLINK
669 # outputs the target of the given symlink.
670 if (type readlink
) > /dev
/null
2>&1; then
673 # Use the readlink program from GNU coreutils.
679 # Use two sed invocations. A single sed -n -e 's,^.* -> \(.*\)$,\1,p'
680 # would do the wrong thing if the link target contains " -> ".
681 LC_ALL
=C
ls -l "$1" |
sed -e 's, -> ,#%%#,' |
sed -n -e 's,^.*#%%#\(.*\)$,\1,p'
685 # func_relativize DIR1 DIR2
686 # computes a relative pathname RELDIR such that DIR1/RELDIR = DIR2.
688 # - DIR1 relative pathname, relative to the current directory
689 # - DIR2 relative pathname, relative to the current directory
691 # - reldir relative pathname of DIR2, relative to DIR1
697 sed_first
='s,^\([^/]*\)/.*$,\1,'
698 sed_rest
='s,^[^/]*/*,,'
699 sed_last
='s,^.*/\([^/]*\)$,\1,'
700 sed_butlast
='s,/*[^/]*$,,'
701 while test -n "$dir1"; do
702 first
=`echo "$dir1" | sed -e "$sed_first"`
703 if test "$first" != "."; then
704 if test "$first" = ".."; then
705 dir2
=`echo "$dir0" | sed -e "$sed_last"`/"$dir2"
706 dir0
=`echo "$dir0" | sed -e "$sed_butlast"`
708 first2
=`echo "$dir2" | sed -e "$sed_first"`
709 if test "$first2" = "$first"; then
710 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
714 dir0
="$dir0"/"$first"
717 dir1
=`echo "$dir1" | sed -e "$sed_rest"`
722 # func_relconcat DIR1 DIR2
723 # computes a relative pathname DIR1/DIR2, with obvious simplifications.
725 # - DIR1 relative pathname, relative to the current directory
726 # - DIR2 relative pathname, relative to DIR1
728 # - relconcat DIR1/DIR2, relative to the current directory
733 sed_first
='s,^\([^/]*\)/.*$,\1,'
734 sed_rest
='s,^[^/]*/*,,'
735 sed_last
='s,^.*/\([^/]*\)$,\1,'
736 sed_butlast
='s,/*[^/]*$,,'
738 first
=`echo "$dir2" | sed -e "$sed_first"`
739 if test "$first" = "."; then
740 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
741 if test -z "$dir2"; then
746 last
=`echo "$dir1" | sed -e "$sed_last"`
747 while test "$last" = "."; do
748 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
749 last
=`echo "$dir1" | sed -e "$sed_last"`
751 if test -z "$dir1"; then
755 if test "$first" = ".."; then
756 if test "$last" = ".."; then
757 relconcat
="$dir1/$dir2"
760 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
761 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
762 if test -z "$dir1"; then
766 if test -z "$dir2"; then
771 relconcat
="$dir1/$dir2"
779 # Like ln -s, except use cp -p if ln -s fails.
783 echo "$progname: ln -s failed; falling back on cp -p" >&2
786 /* | ?
:*) # SRC is absolute.
788 *) # SRC is relative to the directory of DEST.
790 */*) cp_src
="${2%/*}/$1" ;;
800 # func_symlink_target SRC DEST
801 # Determines LINK_TARGET such that "ln -s LINK_TARGET DEST" will create a
802 # symbolic link DEST that points to SRC.
804 # - link_target link target, relative to the directory of DEST
805 func_symlink_target
()
810 *) # SRC is relative.
813 link_target
="`pwd`/$1" ;;
814 *) # DEST is relative too.
815 ln_destdir
=`echo "$2" | sed -e 's,[^/]*$,,'`
816 test -n "$ln_destdir" || ln_destdir
="."
817 func_relativize
"$ln_destdir" "$1"
818 link_target
="$reldir"
825 # func_symlink SRC DEST
826 # Like func_ln_s, except that SRC is given relative to the current directory (or
827 # absolute), not given relative to the directory of DEST.
830 func_symlink_target
"$1" "$2"
831 func_ln_s
"$link_target" "$2"
834 # func_symlink_if_changed SRC DEST
835 # Like func_symlink, but avoids munging timestamps if the link is correct.
836 # SRC is given relative to the current directory (or absolute).
837 func_symlink_if_changed
()
839 if test $# -ne 2; then
840 echo "usage: func_symlink_if_changed SRC DEST" >&2
842 func_symlink_target
"$1" "$2"
843 ln_target
=`func_readlink "$2"`
844 if test -h "$2" && test "$link_target" = "$ln_target"; then
848 func_ln_s
"$link_target" "$2"
852 # func_hardlink SRC DEST
853 # Like ln, except use cp -p if ln fails.
854 # SRC is given relative to the current directory (or absolute).
858 echo "$progname: ln failed; falling back on cp -p" >&2
863 # Ensure an 'echo' command that
864 # 1. does not interpret backslashes and
865 # 2. does not print an error message "broken pipe" when writing into a pipe
868 # Test cases for problem 1:
869 # echo '\n' | wc -l prints 1 when OK, 2 when KO
870 # echo '\t' | grep t > /dev/null has return code 0 when OK, 1 when KO
871 # Test cases for problem 2:
872 # echo hi | true frequently prints
873 # "bash: echo: write error: Broken pipe"
874 # to standard error in bash 3.2.
876 # Problem 1 is a weird heritage from SVR4. BSD got it right (except that
877 # BSD echo interprets '-n' as an option, which is also not desirable).
878 # Nowadays the problem occurs in 4 situations:
879 # - in bash, when the shell option xpg_echo is set (bash >= 2.04)
880 # or when it was built with --enable-usg-echo-default (bash >= 2.0)
881 # or when it was built with DEFAULT_ECHO_TO_USG (bash < 2.0),
882 # - in zsh, when sh-emulation is not set,
883 # - in ksh (e.g. AIX /bin/sh and Solaris /usr/xpg4/bin/sh are ksh instances,
884 # and HP-UX /bin/sh and IRIX /bin/sh behave similarly),
885 # - in Solaris /bin/sh and OSF/1 /bin/sh.
886 # We try the following workarounds:
887 # - for all: respawn using $CONFIG_SHELL if that is set and works.
888 # - for bash >= 2.04: unset the shell option xpg_echo.
889 # - for bash >= 2.0: define echo to a function that uses the printf built-in.
890 # - for bash < 2.0: define echo to a function that uses cat of a here document.
891 # - for zsh: turn sh-emulation on.
892 # - for ksh: alias echo to 'print -r'.
893 # - for ksh: alias echo to a function that uses cat of a here document.
894 # - for Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh and rely on
895 # the ksh workaround.
896 # - otherwise: respawn using /bin/sh and rely on the workarounds.
897 # When respawning, we pass --no-reexec as first argument, so as to avoid
898 # turning this script into a fork bomb in unlucky situations.
900 # Problem 2 is specific to bash 3.2 and affects the 'echo' built-in, but not
901 # the 'printf' built-in. See
902 # <https://lists.gnu.org/r/bug-bash/2008-12/msg00050.html>
903 # <https://lists.gnu.org/r/bug-gnulib/2010-02/msg00154.html>
904 # The workaround is: define echo to a function that uses the printf built-in.
906 if echo '\t' |
grep t
> /dev
/null
; then
907 have_echo
=yes # Lucky!
909 # Try the workarounds.
910 # Respawn using $CONFIG_SHELL if that is set and works.
911 if test -z "$have_echo" \
912 && test "X$1" != "X--no-reexec" \
913 && test -n "$CONFIG_SHELL" \
914 && test -f "$CONFIG_SHELL" \
915 && $CONFIG_SHELL -c "echo '\\t' | grep t > /dev/null"; then
916 exec $CONFIG_SHELL "$0" --no-reexec "$@"
919 # For bash >= 2.04: unset the shell option xpg_echo.
920 if test -z "$have_echo" \
921 && test -n "$BASH_VERSION" \
922 && (shopt -o xpg_echo
; echo '\t' |
grep t
> /dev
/null
) 2>/dev
/null
; then
926 # For bash >= 2.0: define echo to a function that uses the printf built-in.
927 # For bash < 2.0: define echo to a function that uses cat of a here document.
928 # (There is no win in using 'printf' over 'cat' if it is not a shell built-in.)
929 # Also handle problem 2, specific to bash 3.2, here.
930 if { test -z "$have_echo" \
931 ||
case "$BASH_VERSION" in 3.2*) true
;; *) false
;; esac; \
933 && test -n "$BASH_VERSION"; then \
934 if type printf 2>/dev
/null |
grep / > /dev
/null
; then
935 # 'printf' is not a shell built-in.
943 # 'printf' is a shell built-in.
949 if echo '\t' |
grep t
> /dev
/null
; then
953 # For zsh: turn sh-emulation on.
954 if test -z "$have_echo" \
955 && test -n "$ZSH_VERSION" \
956 && (emulate sh
) >/dev
/null
2>&1; then
959 # For ksh: alias echo to 'print -r'.
960 if test -z "$have_echo" \
961 && (type print
) >/dev
/null
2>&1; then
962 # A 'print' command exists.
963 if type print
2>/dev
/null |
grep / > /dev
/null
; then
966 # 'print' is a shell built-in.
967 if (print
-r '\told' |
grep told
> /dev
/null
) 2>/dev
/null
; then
968 # 'print' is the ksh shell built-in.
969 alias echo='print -r'
973 if test -z "$have_echo" \
974 && echo '\t' |
grep t
> /dev
/null
; then
977 # For ksh: alias echo to a function that uses cat of a here document.
978 # The ksh manual page says:
979 # "Aliasing is performed when scripts are read, not while they are executed.
980 # Therefore, for an alias to take effect, the alias definition command has
981 # to be executed before the command which references the alias is read."
982 # Because of this, we have to play strange tricks with have_echo, to ensure
983 # that the top-level statement containing the test starts after the 'alias'
985 if test -z "$have_echo"; then
992 if (alias echo=bsd_echo
) 2>/dev
/null
; then
993 alias echo=bsd_echo
2>/dev
/null
996 if test -z "$have_echo" \
997 && echo '\t' |
grep t
> /dev
/null
; then
1000 if test -z "$have_echo"; then
1001 if (alias echo=bsd_echo
) 2>/dev
/null
; then
1002 unalias echo 2>/dev
/null
1005 # For Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh.
1006 if test -z "$have_echo" \
1007 && test "X$1" != "X--no-reexec" \
1008 && test -f /bin
/ksh
; then
1009 exec /bin
/ksh
"$0" --no-reexec "$@"
1012 # Otherwise: respawn using /bin/sh.
1013 if test -z "$have_echo" \
1014 && test "X$1" != "X--no-reexec" \
1015 && test -f /bin
/sh
; then
1016 exec /bin
/sh
"$0" --no-reexec "$@"
1019 if test -z "$have_echo"; then
1020 func_fatal_error
"Shell does not support 'echo' correctly. Please install GNU bash and set the environment variable CONFIG_SHELL to point to it."
1022 if echo '\t' |
grep t
> /dev
/null
; then
1025 func_fatal_error
"Shell does not support 'echo' correctly. Workaround does not work. Please report this as a bug to bug-gnulib@gnu.org."
1027 if test "X$1" = "X--no-reexec"; then
1031 # Unset CDPATH. Otherwise, output from 'cd dir' can surprise callers.
1032 (unset CDPATH
) >/dev
/null
2>&1 && unset CDPATH
1034 # Determine the path separator early because the following option parsing code
1036 func_determine_path_separator
1038 # Command-line option processing.
1039 # Removes the OPTIONS from the arguments. Sets the variables:
1040 # - mode one of: list, find, import, add-import, remove-import,
1041 # update, create-testdir, create-megatestdir, test, megatest,
1043 # - destdir from --dir
1044 # - local_gnulib_path from --local-dir
1045 # - modcache true or false, from --cache-modules/--no-cache-modules
1046 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
1047 # - libname, supplied_libname from --lib
1048 # - sourcebase from --source-base
1049 # - m4base from --m4-base
1050 # - pobase from --po-base
1051 # - docbase from --doc-base
1052 # - testsbase from --tests-base
1053 # - auxdir from --aux-dir
1054 # - inctests true if --with-tests was given, false if --without-tests
1055 # was given, blank otherwise
1056 # - incobsolete true if --with-obsolete was given, blank otherwise
1057 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
1058 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
1060 # - inc_privileged_tests true if --with-privileged-tests was given, blank
1062 # - inc_unportable_tests true if --with-unportable-tests was given, blank
1064 # - inc_all_tests true if --with-all-tests was given, blank otherwise
1065 # - excl_cxx_tests true if --without-c++-tests was given, blank otherwise
1066 # - excl_longrunning_tests true if --without-longrunning-tests was given,
1068 # - excl_privileged_tests true if --without-privileged-tests was given, blank
1070 # - excl_unportable_tests true if --without-unportable-tests was given, blank
1072 # - single_configure true if --single-configure was given, false otherwise
1073 # - avoidlist list of modules to avoid, from --avoid
1074 # - cond_dependencies true if --conditional-dependencies was given, false if
1075 # --no-conditional-dependencies was given, blank otherwise
1076 # - lgpl yes or a number if --lgpl was given, blank otherwise
1077 # - gnu_make true if --gnu-make was given, false otherwise
1078 # - makefile_name from --makefile-name
1079 # - libtool true if --libtool was given, false if --no-libtool was
1080 # given, blank otherwise
1081 # - macro_prefix from --macro-prefix
1082 # - po_domain from --po-domain
1083 # - witness_c_macro from --witness-c-macro
1084 # - vc_files true if --vc-files was given, false if --no-vc-files was
1085 # given, blank otherwise
1086 # - autoconf_minversion minimum supported autoconf version
1087 # - doit : if actions shall be executed, false if only to be printed
1088 # - copymode symlink if --symlink or --more-symlinks was given,
1089 # hardlink if --hardlink or --more-hardlinks was given,
1091 # - lcopymode symlink if --local-symlink was given,
1092 # hardlink if --local-hardlink was given,
1094 # - do_copyrights blank if --more-symlinks or --more-hardlinks was given,
1113 inc_longrunning_tests
=
1114 inc_privileged_tests
=
1115 inc_unportable_tests
=
1118 excl_longrunning_tests
=
1119 excl_privileged_tests
=
1120 excl_unportable_tests
=
1121 single_configure
=false
1139 while test $# -gt 0; do
1144 --find |
--fin |
--fi |
--f )
1147 --import |
--impor |
--impo |
--imp |
--im |
--i )
1150 --add-import |
--add-impor |
--add-impo |
--add-imp |
--add-im |
--add-i |
--add- |
--add |
--ad )
1153 --remove-import |
--remove-impor |
--remove-impo |
--remove-imp |
--remove-im |
--remove-i |
--remove- |
--remove |
--remov |
--remo |
--rem |
--re |
--r )
1156 --update |
--updat |
--upda |
--upd |
--up |
--u )
1159 --create-testdir |
--create-testdi |
--create-testd |
--create-test |
--create-tes |
--create-te |
--create-t )
1162 --create-megatestdir |
--create-megatestdi |
--create-megatestd |
--create-megatest |
--create-megates |
--create-megate |
--create-megat |
--create-mega |
--create-meg |
--create-me |
--create-m )
1163 mode
=create-megatestdir
1165 --test |
--tes |
--te |
--t )
1168 --megatest |
--megates |
--megate |
--megat |
--mega |
--meg |
--me |
--m )
1172 mode
=`echo "X$1" | sed -e 's/^X--//'`
1174 --copy-file |
--copy-fil |
--copy-fi |
--copy-f |
--copy- |
--copy |
--cop )
1179 if test $# = 0; then
1180 func_fatal_error
"missing argument for --dir"
1185 destdir
=`echo "X$1" | sed -e 's/^X--dir=//'`
1189 if test $# = 0; then
1190 func_fatal_error
"missing argument for --local-dir"
1192 func_path_prepend local_gnulib_path
"$1"
1195 local_dir
=`echo "X$1" | sed -e 's/^X--local-dir=//'`
1196 func_path_prepend local_gnulib_path
"$local_dir"
1198 --cache-modules |
--cache-module |
--cache-modul |
--cache-modu |
--cache-mod |
--cache-mo |
--cache-m |
--cache- |
--cache |
--cach |
--cac |
--ca )
1201 --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 )
1204 --verbose |
--verbos |
--verbo |
--verb )
1205 verbose
=`expr $verbose + 1`
1207 --quiet |
--quie |
--qui |
--qu |
--q )
1208 verbose
=`expr $verbose - 1`
1212 if test $# = 0; then
1213 func_fatal_error
"missing argument for --lib"
1216 supplied_libname
=true
1219 libname
=`echo "X$1" | sed -e 's/^X--lib=//'`
1220 supplied_libname
=true
1224 if test $# = 0; then
1225 func_fatal_error
"missing argument for --source-base"
1230 sourcebase
=`echo "X$1" | sed -e 's/^X--source-base=//'`
1234 if test $# = 0; then
1235 func_fatal_error
"missing argument for --m4-base"
1240 m4base
=`echo "X$1" | sed -e 's/^X--m4-base=//'`
1244 if test $# = 0; then
1245 func_fatal_error
"missing argument for --po-base"
1250 pobase
=`echo "X$1" | sed -e 's/^X--po-base=//'`
1254 if test $# = 0; then
1255 func_fatal_error
"missing argument for --doc-base"
1260 docbase
=`echo "X$1" | sed -e 's/^X--doc-base=//'`
1264 if test $# = 0; then
1265 func_fatal_error
"missing argument for --tests-base"
1270 testsbase
=`echo "X$1" | sed -e 's/^X--tests-base=//'`
1274 if test $# = 0; then
1275 func_fatal_error
"missing argument for --aux-dir"
1280 auxdir
=`echo "X$1" | sed -e 's/^X--aux-dir=//'`
1282 --with-tests |
--with-test |
--with-tes |
--with-te |
--with-t)
1285 --with-obsolete |
--with-obsolet |
--with-obsole |
--with-obsol |
--with-obso |
--with-obs |
--with-ob |
--with-o)
1288 --with-c++-tests |
--with-c++-test |
--with-c++-tes |
--with-c++-te |
--with-c++-t |
--with-c++- |
--with-c++ |
--with-c+ |
--with-c)
1291 --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)
1292 inc_longrunning_tests
=true
1294 --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)
1295 inc_privileged_tests
=true
1297 --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)
1298 inc_unportable_tests
=true
1300 --with-all-tests |
--with-all-test |
--with-all-tes |
--with-all-te |
--with-all-t |
--with-all- |
--with-all |
--with-al |
--with-a)
1303 --without-tests |
--without-test |
--without-tes |
--without-te |
--without-t)
1306 --without-c++-tests |
--without-c++-test |
--without-c++-tes |
--without-c++-te |
--without-c++-t |
--without-c++- |
--without-c++ |
--without-c+ |
--without-c)
1309 --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)
1310 excl_longrunning_tests
=true
1312 --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)
1313 excl_privileged_tests
=true
1315 --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)
1316 excl_unportable_tests
=true
1318 --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)
1319 single_configure
=true
1323 if test $# = 0; then
1324 func_fatal_error
"missing argument for --avoid"
1326 func_append avoidlist
" $1"
1329 arg
=`echo "X$1" | sed -e 's/^X--avoid=//'`
1330 func_append avoidlist
" $arg"
1332 --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)
1333 cond_dependencies
=true
1335 --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)
1336 cond_dependencies
=false
1342 arg
=`echo "X$1" | sed -e 's/^X--lgpl=//'`
1344 2 |
3orGPLv2 |
3) ;;
1345 *) func_fatal_error
"invalid LGPL version number for --lgpl" ;;
1354 if test $# = 0; then
1355 func_fatal_error
"missing argument for --makefile-name"
1360 makefile_name
=`echo "X$1" | sed -e 's/^X--makefile-name=//'`
1370 if test $# = 0; then
1371 func_fatal_error
"missing argument for --macro-prefix"
1376 macro_prefix
=`echo "X$1" | sed -e 's/^X--macro-prefix=//'`
1380 if test $# = 0; then
1381 func_fatal_error
"missing argument for --po-domain"
1386 po_domain
=`echo "X$1" | sed -e 's/^X--po-domain=//'`
1390 if test $# = 0; then
1391 func_fatal_error
"missing argument for --witness-c-macro"
1393 witness_c_macro
="$1"
1395 --witness-c-macro=* )
1396 witness_c_macro
=`echo "X$1" | sed -e 's/^X--witness-c-macro=//'`
1404 --no-changelog |
--no-changelo |
--no-changel |
--no-change |
--no-chang |
--no-chan |
--no-cha |
--no-ch )
1405 # A no-op for backward compatibility.
1410 -s |
--symbolic |
--symboli |
--symbol |
--symbo |
--symb |
--symlink |
--symlin |
--symli |
--syml |
--sym |
--sy )
1413 --local-symlink |
--local-symlin |
--local-symli |
--local-syml |
--local-sym |
--local-sy |
--local-s )
1416 -h |
--hardlink |
--hardlin |
--hardli |
--hardl |
--hard |
--har |
--ha )
1419 --local-hardlink |
--local-hardlin |
--local-hardli |
--local-hardl |
--local-hard |
--local-har |
--local-ha |
--local-h )
1422 -S |
--more-symlinks |
--more-symlink |
--more-symlin |
--more-symli |
--more-syml |
--more-sym |
--more-sy |
--more-s )
1426 -H |
--more-hardlinks |
--more-hardlink |
--more-hardlin |
--more-hardli |
--more-hardl |
--more-hard |
--more-har |
--more-ha |
--more-h )
1430 --help |
--hel |
--he )
1433 --version |
--versio |
--versi |
--vers )
1437 # Stop option processing
1441 echo "gnulib-tool: unknown option $1" 1>&2
1442 echo "Try 'gnulib-tool --help' for more information." 1>&2
1449 if case "$mode" in import | add-import | remove-import
) true
;; *) false
;; esac; then
1450 if test -n "$excl_cxx_tests" ||
test -n "$excl_longrunning_tests" \
1451 ||
test -n "$excl_privileged_tests" ||
test -n "$excl_unportable_tests" \
1452 ||
test "$single_configure" != false
; then
1453 echo "gnulib-tool: invalid options for '$mode' mode" 1>&2
1454 echo "Try 'gnulib-tool --help' for more information." 1>&2
1458 if test "$mode" = update
; then
1459 if test $# != 0; then
1460 echo "gnulib-tool: too many arguments in 'update' mode" 1>&2
1461 echo "Try 'gnulib-tool --help' for more information." 1>&2
1462 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1463 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1466 if test -n "$local_gnulib_path" ||
test -n "$supplied_libname" \
1467 ||
test -n "$sourcebase" ||
test -n "$m4base" ||
test -n "$pobase" \
1468 ||
test -n "$docbase" ||
test -n "$testsbase" ||
test -n "$auxdir" \
1469 ||
test -n "$inctests" ||
test -n "$incobsolete" \
1470 ||
test -n "$inc_cxx_tests" ||
test -n "$inc_longrunning_tests" \
1471 ||
test -n "$inc_privileged_tests" ||
test -n "$inc_unportable_tests" \
1472 ||
test -n "$inc_all_tests" \
1473 ||
test -n "$excl_cxx_tests" ||
test -n "$excl_longrunning_tests" \
1474 ||
test -n "$excl_privileged_tests" ||
test -n "$excl_unportable_tests" \
1475 ||
test -n "$avoidlist" ||
test -n "$lgpl" ||
test -n "$makefile_name" \
1476 ||
test -n "$macro_prefix" ||
test -n "$po_domain" \
1477 ||
test -n "$witness_c_macro" ||
test -n "$vc_files"; then
1478 echo "gnulib-tool: invalid options for 'update' mode" 1>&2
1479 echo "Try 'gnulib-tool --help' for more information." 1>&2
1480 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1481 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1485 if test -n "$pobase" && test -z "$po_domain"; then
1486 echo "gnulib-tool: together with --po-base, you need to specify --po-domain" 1>&2
1487 echo "Try 'gnulib-tool --help' for more information." 1>&2
1490 if test -z "$pobase" && test -n "$po_domain"; then
1491 func_warning
"--po-domain has no effect without a --po-base option"
1493 # Canonicalize the inctests variable.
1495 import | add-import | remove-import | update
)
1496 if test -z "$inctests"; then
1500 create-testdir | create-megatestdir |
test | megatest
)
1501 if test -z "$inctests"; then
1506 # Now the only possible values of "$inctests" are true and false
1507 # (or blank but then it is irrelevant).
1509 # Determine the minimum supported autoconf version from the project's
1511 DEFAULT_AUTOCONF_MINVERSION
="2.59"
1512 autoconf_minversion
=
1514 if case "$mode" in import | add-import | remove-import | update
) true
;; *) false
;; esac \
1515 && test -n "$destdir"; then
1516 if test -f "$destdir"/configure.ac
; then
1517 configure_ac
="$destdir/configure.ac"
1519 if test -f "$destdir"/configure.
in; then
1520 configure_ac
="$destdir/configure.in"
1524 if test -f configure.ac
; then
1525 configure_ac
="configure.ac"
1527 if test -f configure.
in; then
1528 configure_ac
="configure.in"
1532 if test -n "$configure_ac"; then
1533 # Use sed, not autoconf --trace, to look for the AC_PREREQ invocation,
1534 # because when some m4 files are omitted from a version control repository,
1535 # "autoconf --trace=AC_PREREQ" fails with an error message like this:
1536 # m4: aclocal.m4:851: Cannot open m4/absolute-header.m4: No such file or directory
1537 # autom4te: m4 failed with exit status: 1
1544 s,^.*AC_PREREQ([[ ]*\([^])]*\).*$,\1,p
1546 prereqs
=`sed -n -e "$my_sed_traces" < "$configure_ac"`
1547 if test -n "$prereqs"; then
1548 autoconf_minversion
=`
1549 for version in $prereqs; do echo $version; done |
1550 LC_ALL=C sort -nru | sed -e 1q
1554 if test -z "$autoconf_minversion"; then
1555 autoconf_minversion
=$DEFAULT_AUTOCONF_MINVERSION
1557 case "$autoconf_minversion" in
1558 1.
* |
2.
[0-4]* |
2.5[0-8]*)
1559 func_fatal_error
"minimum supported autoconf version is 2.59. Try adding AC_PREREQ([$DEFAULT_AUTOCONF_MINVERSION]) to your configure.ac." ;;
1562 # Remove trailing slashes from the directory names. This is necessary for
1563 # m4base (to avoid an error in func_import) and optional for the others.
1564 sed_trimtrailingslashes
='s,\([^/]\)//*$,\1,'
1565 old_local_gnulib_path
=$local_gnulib_path
1569 for dir
in $old_local_gnulib_path
1572 */ ) dir
=`echo "$dir" | sed -e "$sed_trimtrailingslashes"` ;;
1574 func_path_append local_gnulib_path
"$dir"
1577 case "$sourcebase" in
1578 */ ) sourcebase
=`echo "$sourcebase" | sed -e "$sed_trimtrailingslashes"` ;;
1581 */ ) m4base
=`echo "$m4base" | sed -e "$sed_trimtrailingslashes"` ;;
1584 */ ) pobase
=`echo "$pobase" | sed -e "$sed_trimtrailingslashes"` ;;
1587 */ ) docbase
=`echo "$docbase" | sed -e "$sed_trimtrailingslashes"` ;;
1589 case "$testsbase" in
1590 */ ) testsbase
=`echo "$testsbase" | sed -e "$sed_trimtrailingslashes"` ;;
1593 */ ) auxdir
=`echo "$auxdir" | sed -e "$sed_trimtrailingslashes"` ;;
1599 trap 'exit_status=$?
1600 if test "$signal" != 0; then
1601 echo "caught signal $signal" >&2
1604 exit $exit_status' 0
1605 for signal
in 1 2 3 13 15; do
1606 trap '{ signal='$signal'; func_exit 1; }' $signal
1610 # Note: The 'eval' silences stderr output in dash.
1611 if (declare -A x
&& { x
[f
/2]='foo'; x
[f
/3]='bar'; eval test '${x[f/2]}' = foo
; }) 2>/dev
/null
; then
1612 # Zsh 4 and Bash 4 have associative arrays.
1613 have_associative
=true
1615 # For other shells, use 'eval' with computed shell variable names.
1616 have_associative
=false
1619 # func_lookup_local_file_cb dir file
1620 # return true and set func_lookup_local_file_result if the file 'dir/file'
1622 func_lookup_local_file_cb
()
1624 test -n "$func_lookup_local_file_result" && return 1 # already found?
1625 test -f "$1/$2" ||
return 1
1626 func_lookup_local_file_result
=$1/$2
1630 # func_lookup_local_file file
1631 # looks up a file in $local_gnulib_path.
1633 # - local_gnulib_path from --local-dir
1635 # - func_lookup_local_file_result name of the file, valid only when the
1636 # function succeeded.
1637 func_lookup_local_file
()
1639 func_lookup_local_file_result
=
1640 func_path_foreach
"$local_gnulib_path" func_lookup_local_file_cb
%dir
% "$1"
1643 # func_lookup_file file
1644 # looks up a file in $local_gnulib_path or $gnulib_dir, or combines it through
1647 # - local_gnulib_path from --local-dir
1649 # - lookedup_file name of the merged (combined) file
1650 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
1654 if func_lookup_local_file
"$lkfile"; then
1655 lookedup_file
=$func_lookup_local_file_result
1658 if test -f "$gnulib_dir/$lkfile"; then
1659 if func_lookup_local_file
"$lkfile.diff"; then
1660 lkbase
=`echo "$lkfile" | sed -e 's,^.*/,,'`
1661 rm -f "$tmp/$lkbase"
1662 cp "$gnulib_dir/$lkfile" "$tmp/$lkbase"
1663 patch -s "$tmp/$lkbase" < "$func_lookup_local_file_result" >&2 \
1664 || func_fatal_error
"patch file $func_lookup_local_file_result didn't apply cleanly"
1665 lookedup_file
="$tmp/$lkbase"
1668 lookedup_file
="$gnulib_dir/$lkfile"
1672 func_fatal_error
"file $gnulib_dir/$lkfile not found"
1677 # func_sanitize_modulelist
1678 # receives a list of possible module names on standard input, one per line.
1679 # It removes those which are just file names unrelated to modules, and outputs
1680 # the resulting list to standard output, one per line.
1681 func_sanitize_modulelist
()
1683 sed -e '/^ChangeLog$/d' -e '/\/ChangeLog$/d' \
1684 -e '/^COPYING$/d' -e '/\/COPYING$/d' \
1685 -e '/^README$/d' -e '/\/README$/d' \
1686 -e '/^TEMPLATE$/d' \
1687 -e '/^TEMPLATE-EXTENDED$/d' \
1688 -e '/^TEMPLATE-TESTS$/d' \
1694 # func_modules_in_dir dir
1695 # outputs all module files in dir to standard output.
1696 func_modules_in_dir
()
1698 (test -d "$1" && cd "$1" && find modules
-type f
-print)
1703 # - local_gnulib_path from --local-dir
1706 # Filter out metainformation files like README, which are not modules.
1707 # Filter out unit test modules; they can be retrieved through
1708 # --extract-tests-module if desired.
1710 (cd "$gnulib_dir" && find modules
-type f
-print |
sed -e 's,^modules/,,')
1711 func_path_foreach
"$local_gnulib_path" func_modules_in_dir
%dir
% |
sed -e 's,^modules/,,' -e 's,\.diff$,,'
1713 | func_sanitize_modulelist \
1714 |
sed -e '/-tests$/d' \
1718 # func_exists_local_module dir module
1719 # returns true if module exists in dir
1720 func_exists_local_module
()
1722 test -d "$1/modules" && test -f "$1/modules/$2";
1725 # func_exists_module module
1726 # tests whether a module, given by name, exists
1728 # - local_gnulib_path from --local-dir
1729 func_exists_module
()
1731 { test -f "$gnulib_dir/modules/$1" \
1732 || func_path_foreach
"$local_gnulib_path" func_exists_local_module
%dir
% "$1" ; } \
1733 && test "ChangeLog" != "$1" \
1734 && test "COPYING" != "$1" \
1735 && test "README" != "$1" \
1736 && test "TEMPLATE" != "$1" \
1737 && test "TEMPLATE-EXTENDED" != "$1" \
1738 && test "TEMPLATE-TESTS" != "$1"
1741 # func_verify_module
1742 # verifies a module name
1744 # - local_gnulib_path from --local-dir
1745 # - module module name argument
1746 func_verify_module
()
1748 if func_exists_module
"$module"; then
1749 # OK, $module is a correct module name.
1750 # Verify that building the module description with 'patch' succeeds.
1751 func_lookup_file
"modules/$module"
1753 func_warning
"module $module doesn't exist"
1758 # func_verify_nontests_module
1759 # verifies a module name, excluding tests modules
1761 # - local_gnulib_path from --local-dir
1762 # - module module name argument
1763 func_verify_nontests_module
()
1766 *-tests ) module
= ;;
1767 * ) func_verify_module
;;
1771 # func_verify_tests_module
1772 # verifies a module name, considering only tests modules
1774 # - local_gnulib_path from --local-dir
1775 # - module module name argument
1776 func_verify_tests_module
()
1779 *-tests ) func_verify_module
;;
1784 # Suffix of a sed expression that extracts a particular field from a
1785 # module description.
1786 # A field starts with a line that contains a keyword, such as 'Description',
1787 # followed by a colon and optional whitespace. All following lines, up to
1788 # the next field (or end of file if there is none) form the contents of the
1790 # An absent field is equivalent to a field with empty contents.
1791 # NOTE: Keep this in sync with sed_extract_cache_prog below!
1792 sed_extract_prog
=':[ ]*$/ {
1795 s/^Description:[ ]*$//
1799 s/^Applicability:[ ]*$//
1801 s/^Depends-on:[ ]*$//
1802 s/^configure\.ac-early:[ ]*$//
1803 s/^configure\.ac:[ ]*$//
1804 s/^Makefile\.am:[ ]*$//
1808 s/^Maintainer:[ ]*$//
1815 # Piece of a sed expression that converts a field header line to a shell
1817 # NOTE: Keep this in sync with sed_extract_prog above!
1818 sed_extract_field_header
='
1819 s/^Description:[ ]*$/description/
1820 s/^Comment:[ ]*$/comment/
1821 s/^Status:[ ]*$/status/
1822 s/^Notice:[ ]*$/notice/
1823 s/^Applicability:[ ]*$/applicability/
1824 s/^Files:[ ]*$/files/
1825 s/^Depends-on:[ ]*$/dependson/
1826 s/^configure\.ac-early:[ ]*$/configureac_early/
1827 s/^configure\.ac:[ ]*$/configureac/
1828 s/^Makefile\.am:[ ]*$/makefile/
1829 s/^Include:[ ]*$/include/
1831 s/^License:[ ]*$/license/
1832 s/^Maintainer:[ ]*$/maintainer/'
1836 if $have_associative; then
1838 # Declare the associative arrays.
1839 declare -A modcache_cached
1840 sed_to_declare_statement
='s|^.*/\([a-zA-Z0-9_]*\)/$|declare -A modcache_\1|p'
1841 declare_script
=`echo "$sed_extract_field_header" | sed -n -e "$sed_to_declare_statement"`
1842 eval "$declare_script"
1846 # func_cache_var module
1847 # computes the cache variable name corresponding to $module.
1848 # Note: This computation can map different module names to the same
1849 # cachevar (such as 'foo-bar', 'foo_bar', or 'foo/bar'); the caller has
1850 # to protect against this case.
1852 # - cachevar a shell variable name
1853 if (f
=foo
; eval echo '${f//o/e}') < /dev
/null
2>/dev
/null |
grep fee
>/dev
/null
; then
1854 # Bash 2.0 and newer, ksh, and zsh support the syntax
1855 # ${param//pattern/replacement}
1856 # as a shorthand for
1857 # `echo "$param" | sed -e "s/pattern/replacement/g"`.
1858 # Note: The 'eval' is necessary for dash and NetBSD /bin/sh.
1859 eval 'func_cache_var ()
1861 cachevar=c_${1//[!a-zA-Z0-9_]/_}
1868 cachevar
=c_
`echo "$1" | LC_ALL=C sed -e 's/[^a-zA-Z0-9_]/_/g'` ;;
1877 # func_init_sed_convert_to_cache_statements
1879 # - modcachevar_assignment
1881 # - sed_convert_to_cache_statements
1882 func_init_sed_convert_to_cache_statements
()
1884 # 'sed' script that turns a module description into shell script
1885 # assignments, suitable to be eval'ed. All active characters are escaped.
1888 # Some module's description
1893 # modcache_description[$1]=\
1894 # 'Some module'"'"'s description
1896 # modcache_files[$1]=\
1899 # c_MODULE_description_set=set; c_MODULE_description=\
1900 # 'Some module'"'"'s description
1902 # c_MODULE_files_set=set; c_MODULE_files=\
1904 # The script consists of two parts:
1905 # 1) Ignore the lines before the first field header.
1906 # 2) A loop, treating non-field-header lines by escaping single quotes
1907 # and adding a closing quote in the last line,
1908 sed_convert_to_cache_statements
="
1910 # Here we have not yet seen a field header.
1912 # See if the current line contains a field header.
1915 ${sed_extract_field_header}
1918 # No field header. Ignore the line.
1920 # Read the next line. Upon EOF, just exit.
1925 # The current line contains a field header.
1927 # Turn it into the beginning of an assignment.
1928 s/^\\(.*\\)\$/${modcachevar_assignment}\\\\/
1930 # Move it to the hold space. Don't print it yet,
1931 # because we want no assignment if the field is empty.
1934 # Read the next line.
1935 # Upon EOF, the field was empty. Print no assignment. Just exit.
1938 # See if the current line contains a field header.
1941 ${sed_extract_field_header}
1942 # If it is, the previous field was empty. Print no assignment.
1945 # Not a field header.
1947 # Print the previous line, held in the hold space.
1952 # Transform single quotes.
1955 # Prepend a single quote.
1960 # Move it to the hold space.
1963 # Read the next line.
1970 # See if the current line contains a field header.
1973 ${sed_extract_field_header}
1976 # Print the previous line, held in the hold space.
1981 # Transform single quotes.
1988 # Print the previous line, held in the hold space, with a single quote
1989 # to end the assignment.
1999 # Print the previous line, held in the hold space, with a single quote
2000 # to end the assignment.
2007 if ! $sed_comments; then
2009 sed_convert_to_cache_statements
=`echo "$sed_convert_to_cache_statements" \
2010 | sed -e 's/^ *//' -e 's/^#.*//'`
2014 if $have_associative; then
2015 # sed_convert_to_cache_statements does not depend on the module.
2016 modcachevar_assignment
='modcache_\1[$1]='
2017 func_init_sed_convert_to_cache_statements
2020 # func_cache_lookup_module module
2022 # looks up a module, like 'func_lookup_file modules/$module', and stores all
2023 # of its relevant data in a cache in the memory of the processing shell. If
2024 # already cached, it does not look it up again, thus saving file access time.
2026 # - module non-empty string
2027 # Output if $have_associative:
2028 # - modcache_cached[$module] set to yes
2029 # - modcache_description[$module] ==
2030 # - modcache_status[$module] \ set to the field's value, minus the
2031 # - ... / final newline,
2032 # - modcache_maintainer[$module] == or unset if the field's value is empty
2033 # Output if ! $have_associative:
2034 # - cachevar a shell variable name
2035 # - ${cachevar}_cached set to $module
2036 # - ${cachevar}_description ==
2037 # - ${cachevar}_status \ set to the field's value, minus the
2038 # - ... / final newline,
2039 # - ${cachevar}_maintainer == or unset if the field's value is empty
2040 # - ${cachevar}_description_set ==
2041 # - ${cachevar}_status_set \ set to non-empty if the field's value
2042 # - ... / is non-empty,
2043 # - ${cachevar}_maintainer_set == or unset if the field's value is empty
2044 func_cache_lookup_module
()
2046 if $have_associative; then
2047 eval 'cached=${modcache_cached[$1]}'
2050 eval "cached=\"\$${cachevar}_cached\""
2052 if test -z "$cached"; then
2053 # Not found in cache. Look it up on the file system.
2054 func_lookup_file
"modules/$1"
2055 if $have_associative; then
2056 eval 'modcache_cached[$1]=yes'
2058 eval "${cachevar}_cached=\"\$1\""
2060 if ! $have_associative; then
2061 # sed_convert_to_cache_statements depends on the module.
2062 modcachevar_assignment
="${cachevar}"'_\1_set=set; '"${cachevar}"'_\1='
2063 func_init_sed_convert_to_cache_statements
2065 cache_statements
=`LC_ALL=C sed -n -e "$sed_convert_to_cache_statements" < "$lookedup_file"`
2066 eval "$cache_statements"
2068 if ! $have_associative; then
2069 if test "$1" != "$cached"; then
2070 func_fatal_error
"cache variable collision between $1 and $cached"
2078 # func_get_description module
2080 # - local_gnulib_path from --local-dir
2081 # - modcache true or false, from --cache-modules/--no-cache-modules
2082 func_get_description
()
2084 if ! $modcache; then
2085 func_lookup_file
"modules/$1"
2086 sed -n -e "/^Description$sed_extract_prog" < "$lookedup_file"
2088 func_cache_lookup_module
"$1"
2089 # Output the field's value, including the final newline (if any).
2090 if $have_associative; then
2091 if eval 'test -n "${modcache_description[$1]+set}"'; then
2092 eval 'echo "${modcache_description[$1]}"'
2095 eval "field_set=\"\$${cachevar}_description_set\""
2096 if test -n "$field_set"; then
2097 eval "field_value=\"\$${cachevar}_description\""
2098 echo "${field_value}"
2104 # func_get_comment module
2106 # - local_gnulib_path from --local-dir
2107 # - modcache true or false, from --cache-modules/--no-cache-modules
2110 if ! $modcache; then
2111 func_lookup_file
"modules/$1"
2112 sed -n -e "/^Comment$sed_extract_prog" < "$lookedup_file"
2114 func_cache_lookup_module
"$1"
2115 # Output the field's value, including the final newline (if any).
2116 if $have_associative; then
2117 if eval 'test -n "${modcache_comment[$1]+set}"'; then
2118 eval 'echo "${modcache_comment[$1]}"'
2121 eval "field_set=\"\$${cachevar}_comment_set\""
2122 if test -n "$field_set"; then
2123 eval "field_value=\"\$${cachevar}_comment\""
2124 echo "${field_value}"
2130 # func_get_status module
2132 # - local_gnulib_path from --local-dir
2133 # - modcache true or false, from --cache-modules/--no-cache-modules
2136 if ! $modcache; then
2137 func_lookup_file
"modules/$1"
2138 sed -n -e "/^Status$sed_extract_prog" < "$lookedup_file"
2140 func_cache_lookup_module
"$1"
2141 # Output the field's value, including the final newline (if any).
2142 if $have_associative; then
2143 if eval 'test -n "${modcache_status[$1]+set}"'; then
2144 eval 'echo "${modcache_status[$1]}"'
2147 eval "field_set=\"\$${cachevar}_status_set\""
2148 if test -n "$field_set"; then
2149 eval "field_value=\"\$${cachevar}_status\""
2150 echo "${field_value}"
2156 # func_get_notice module
2158 # - local_gnulib_path from --local-dir
2159 # - modcache true or false, from --cache-modules/--no-cache-modules
2162 if ! $modcache; then
2163 func_lookup_file
"modules/$1"
2164 sed -n -e "/^Notice$sed_extract_prog" < "$lookedup_file"
2166 func_cache_lookup_module
"$1"
2167 # Output the field's value, including the final newline (if any).
2168 if $have_associative; then
2169 if eval 'test -n "${modcache_notice[$1]+set}"'; then
2170 eval 'echo "${modcache_notice[$1]}"'
2173 eval "field_set=\"\$${cachevar}_notice_set\""
2174 if test -n "$field_set"; then
2175 eval "field_value=\"\$${cachevar}_notice\""
2176 echo "${field_value}"
2182 # func_get_applicability module
2184 # - local_gnulib_path from --local-dir
2185 # - modcache true or false, from --cache-modules/--no-cache-modules
2186 # The expected result (on stdout) is either 'main', or 'tests', or 'all'.
2187 func_get_applicability
()
2189 if ! $modcache; then
2190 func_lookup_file
"modules/$1"
2191 my_applicability
=`sed -n -e "/^Applicability$sed_extract_prog" < "$lookedup_file"`
2193 func_cache_lookup_module
"$1"
2194 # Get the field's value, without the final newline.
2195 if $have_associative; then
2196 eval 'my_applicability="${modcache_applicability[$1]}"'
2198 eval "my_applicability=\"\$${cachevar}_applicability\""
2201 if test -n "$my_applicability"; then
2202 echo $my_applicability
2204 # The default is 'main' or 'tests', depending on the module's name.
2206 *-tests) echo "tests";;
2212 # func_get_filelist module
2214 # - local_gnulib_path from --local-dir
2215 # - modcache true or false, from --cache-modules/--no-cache-modules
2216 func_get_filelist
()
2218 if ! $modcache; then
2219 func_lookup_file
"modules/$1"
2220 sed -n -e "/^Files$sed_extract_prog" < "$lookedup_file"
2222 func_cache_lookup_module
"$1"
2223 # Output the field's value, including the final newline (if any).
2224 if $have_associative; then
2225 if eval 'test -n "${modcache_files[$1]+set}"'; then
2226 eval 'echo "${modcache_files[$1]}"'
2229 eval "field_set=\"\$${cachevar}_files_set\""
2230 if test -n "$field_set"; then
2231 eval "field_value=\"\$${cachevar}_files\""
2232 echo "${field_value}"
2237 echo m
4/gnulib-common.
m4
2238 case "$autoconf_minversion" in
2245 # func_filter_filelist outputvar separator filelist prefix suffix removed_prefix removed_suffix [added_prefix [added_suffix]]
2246 # stores in outputvar the filtered and processed filelist. Filtering: Only the
2247 # elements starting with prefix and ending with suffix are considered.
2248 # Processing: removed_prefix and removed_suffix are removed from each element,
2249 # added_prefix and added_suffix are added to each element.
2250 # prefix, suffix should not contain shell-special characters.
2251 # removed_prefix, removed_suffix should not contain the characters "$`\{}[]^|.
2252 # added_prefix, added_suffix should not contain the characters \|&.
2253 func_filter_filelist
()
2255 if test "$2" != "$nl" \
2256 ||
{ $fast_func_append \
2257 && { test -z "$6" ||
$fast_func_remove_prefix; } \
2258 && { test -z "$7" ||
$fast_func_remove_suffix; }; \
2262 # Do not quote possibly-empty parameters in case patterns,
2263 # AIX and HP-UX ksh won't match them if they are empty.
2266 if test -n "$6"; then
2267 func_remove_prefix fff
"$6"
2269 if test -n "$7"; then
2270 func_remove_suffix fff
"$7"
2273 if test -z "$ffflist"; then
2276 func_append ffflist
"$2${fff}"
2282 sed_fff_filter
="s|^$6\(.*\)$7\$|$8\\1$9|"
2283 ffflist
=`for fff in $3; do
2285 $4*$5) echo "$fff" ;;
2287 done | sed -e "$sed_fff_filter"`
2289 eval "$1=\"\$ffflist\""
2292 # func_get_dependencies module
2294 # - local_gnulib_path from --local-dir
2295 # - modcache true or false, from --cache-modules/--no-cache-modules
2296 func_get_dependencies
()
2298 # ${module}-tests implicitly depends on ${module}, if that module exists.
2302 func_remove_suffix fgd1
'-tests'
2303 if func_exists_module
"$fgd1"; then
2308 # Then the explicit dependencies listed in the module description.
2309 { if ! $modcache; then
2310 func_lookup_file
"modules/$1"
2311 sed -n -e "/^Depends-on$sed_extract_prog" < "$lookedup_file"
2313 func_cache_lookup_module
"$1"
2314 # Output the field's value, including the final newline (if any).
2315 if $have_associative; then
2316 if eval 'test -n "${modcache_dependson[$1]+set}"'; then
2317 eval 'echo "${modcache_dependson[$1]}"'
2320 eval "field_set=\"\$${cachevar}_dependson_set\""
2321 if test -n "$field_set"; then
2322 eval "field_value=\"\$${cachevar}_dependson\""
2323 echo "${field_value}"
2331 # func_get_autoconf_early_snippet module
2333 # - local_gnulib_path from --local-dir
2334 # - modcache true or false, from --cache-modules/--no-cache-modules
2335 func_get_autoconf_early_snippet
()
2337 if ! $modcache; then
2338 func_lookup_file
"modules/$1"
2339 sed -n -e "/^configure\.ac-early$sed_extract_prog" < "$lookedup_file"
2341 func_cache_lookup_module
"$1"
2342 # Output the field's value, including the final newline (if any).
2343 if $have_associative; then
2344 if eval 'test -n "${modcache_configureac_early[$1]+set}"'; then
2345 eval 'echo "${modcache_configureac_early[$1]}"'
2348 eval "field_set=\"\$${cachevar}_configureac_early_set\""
2349 if test -n "$field_set"; then
2350 eval "field_value=\"\$${cachevar}_configureac_early\""
2351 echo "${field_value}"
2357 # func_get_autoconf_snippet module
2359 # - local_gnulib_path from --local-dir
2360 # - modcache true or false, from --cache-modules/--no-cache-modules
2361 func_get_autoconf_snippet
()
2363 if ! $modcache; then
2364 func_lookup_file
"modules/$1"
2365 sed -n -e "/^configure\.ac$sed_extract_prog" < "$lookedup_file"
2367 func_cache_lookup_module
"$1"
2368 # Output the field's value, including the final newline (if any).
2369 if $have_associative; then
2370 if eval 'test -n "${modcache_configureac[$1]+set}"'; then
2371 eval 'echo "${modcache_configureac[$1]}"'
2374 eval "field_set=\"\$${cachevar}_configureac_set\""
2375 if test -n "$field_set"; then
2376 eval "field_value=\"\$${cachevar}_configureac\""
2377 echo "${field_value}"
2383 # Concatenate lines with trailing slash.
2384 # $1 is an optional filter to restrict the
2385 # concatenation to groups starting with that expression
2387 sed -e "/$1.*"'\\$/{
2396 # func_get_automake_snippet_conditional module
2397 # returns the part of the Makefile.am snippet that can be put inside Automake
2400 # - local_gnulib_path from --local-dir
2401 # - modcache true or false, from --cache-modules/--no-cache-modules
2402 func_get_automake_snippet_conditional
()
2404 if ! $modcache; then
2405 func_lookup_file
"modules/$1"
2406 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
2408 func_cache_lookup_module
"$1"
2409 # Output the field's value, including the final newline (if any).
2410 if $have_associative; then
2411 if eval 'test -n "${modcache_makefile[$1]+set}"'; then
2412 eval 'echo "${modcache_makefile[$1]}"'
2415 eval "field_set=\"\$${cachevar}_makefile_set\""
2416 if test -n "$field_set"; then
2417 eval "field_value=\"\$${cachevar}_makefile\""
2418 echo "${field_value}"
2424 # func_get_automake_snippet_unconditional module
2425 # returns the part of the Makefile.am snippet that must stay outside of
2426 # Automake conditionals.
2428 # - local_gnulib_path from --local-dir
2429 # - modcache true or false, from --cache-modules/--no-cache-modules
2430 func_get_automake_snippet_unconditional
()
2434 # *-tests module live in tests/, not lib/.
2435 # Synthesize an EXTRA_DIST augmentation.
2436 all_files
=`func_get_filelist $1`
2437 func_filter_filelist tests_files
" " "$all_files" 'tests/' '' 'tests/' ''
2438 extra_files
="$tests_files"
2439 if test -n "$extra_files"; then
2440 echo "EXTRA_DIST +=" $extra_files
2445 # Synthesize an EXTRA_DIST augmentation.
2446 sed_extract_mentioned_files
='s/^lib_SOURCES[ ]*+=[ ]*//p'
2447 already_mentioned_files
=` \
2448 { if ! $modcache; then
2449 func_lookup_file "modules/$1"
2450 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
2452 func_cache_lookup_module "$1"
2453 if $have_associative; then
2454 if eval 'test -n "${modcache_makefile[$1]+set}"'; then
2455 eval 'echo "${modcache_makefile[$1]}"'
2458 eval 'field_set="$'"${cachevar}"'_makefile_set"'
2459 if test -n "$field_set"; then
2460 eval 'field_value="$'"${cachevar}"'_makefile"'
2461 echo "${field_value}"
2467 | sed -n -e "$sed_extract_mentioned_files" | sed -e 's/#.*//'`
2468 all_files
=`func_get_filelist $1`
2469 func_filter_filelist lib_files
"$nl" "$all_files" 'lib/' '' 'lib/' ''
2470 # Remove $already_mentioned_files from $lib_files.
2471 echo "$lib_files" | LC_ALL
=C
sort -u > "$tmp"/lib-files
2472 extra_files
=`for f in $already_mentioned_files; do echo $f; done \
2473 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/lib-files`
2474 if test -n "$extra_files"; then
2475 echo "EXTRA_DIST +=" $extra_files
2478 # Synthesize also an EXTRA_lib_SOURCES augmentation.
2479 # This is necessary so that automake can generate the right list of
2481 # A possible approach would be to use autom4te --trace of the redefined
2482 # AC_LIBOBJ and AC_REPLACE_FUNCS macros when creating the Makefile.am
2483 # (use autom4te --trace, not just grep, so that AC_LIBOBJ invocations
2484 # inside autoconf's built-in macros are not missed).
2485 # But it's simpler and more robust to do it here, based on the file list.
2486 # If some .c file exists and is not used with AC_LIBOBJ - for example,
2487 # a .c file is preprocessed into another .c file for BUILT_SOURCES -,
2488 # automake will generate a useless dependency; this is harmless.
2490 relocatable-prog-wrapper
) ;;
2493 func_filter_filelist extra_files
"$nl" "$extra_files" '' '.c' '' ''
2494 if test -n "$extra_files"; then
2495 echo "EXTRA_lib_SOURCES +=" $extra_files
2500 # Synthesize an EXTRA_DIST augmentation also for the files in build-aux/.
2501 func_filter_filelist buildaux_files
"$nl" "$all_files" 'build-aux/' '' 'build-aux/' ''
2502 if test -n "$buildaux_files"; then
2503 sed_prepend_auxdir
='s,^,$(top_srcdir)/'"$auxdir"'/,'
2504 echo "EXTRA_DIST += "`echo "$buildaux_files" | sed -e "$sed_prepend_auxdir"`
2511 # func_get_automake_snippet module
2513 # - local_gnulib_path from --local-dir
2514 # - modcache true or false, from --cache-modules/--no-cache-modules
2515 func_get_automake_snippet
()
2517 func_get_automake_snippet_conditional
"$1"
2518 func_get_automake_snippet_unconditional
"$1"
2521 # func_get_include_directive module
2523 # - local_gnulib_path from --local-dir
2524 # - modcache true or false, from --cache-modules/--no-cache-modules
2525 func_get_include_directive
()
2528 if ! $modcache; then
2529 func_lookup_file
"modules/$1"
2530 sed -n -e "/^Include$sed_extract_prog" < "$lookedup_file"
2532 func_cache_lookup_module
"$1"
2533 # Output the field's value, including the final newline (if any).
2534 if $have_associative; then
2535 if eval 'test -n "${modcache_include[$1]+set}"'; then
2536 eval 'echo "${modcache_include[$1]}"'
2539 eval "field_set=\"\$${cachevar}_include_set\""
2540 if test -n "$field_set"; then
2541 eval "field_value=\"\$${cachevar}_include\""
2542 echo "${field_value}"
2546 } |
sed -e 's/^\(["<]\)/#include \1/'
2549 # func_get_link_directive module
2551 # - local_gnulib_path from --local-dir
2552 # - modcache true or false, from --cache-modules/--no-cache-modules
2553 func_get_link_directive
()
2555 if ! $modcache; then
2556 func_lookup_file
"modules/$1"
2557 sed -n -e "/^Link$sed_extract_prog" < "$lookedup_file"
2559 func_cache_lookup_module
"$1"
2560 # Output the field's value, including the final newline (if any).
2561 if $have_associative; then
2562 if eval 'test -n "${modcache_link[$1]+set}"'; then
2563 eval 'echo "${modcache_link[$1]}"'
2566 eval "field_set=\"\$${cachevar}_link_set\""
2567 if test -n "$field_set"; then
2568 eval "field_value=\"\$${cachevar}_link\""
2569 echo "${field_value}"
2575 # func_get_license_raw module
2577 # - local_gnulib_path from --local-dir
2578 # - modcache true or false, from --cache-modules/--no-cache-modules
2579 func_get_license_raw
()
2581 if ! $modcache; then
2582 func_lookup_file
"modules/$1"
2583 sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
2585 func_cache_lookup_module
"$1"
2586 # Output the field's value, including the final newline (if any).
2587 if $have_associative; then
2588 if eval 'test -n "${modcache_license[$1]+set}"'; then
2589 eval 'echo "${modcache_license[$1]}"'
2592 eval "field_set=\"\$${cachevar}_license_set\""
2593 if test -n "$field_set"; then
2594 eval "field_value=\"\$${cachevar}_license\""
2595 echo "${field_value}"
2601 # func_get_license module
2603 # - local_gnulib_path from --local-dir
2604 # - modcache true or false, from --cache-modules/--no-cache-modules
2607 # Warn if the License field is missing.
2611 license
=`func_get_license_raw "$1"`
2612 if test -z "$license"; then
2613 func_warning
"module $1 lacks a License"
2619 # These modules are under a weaker license only for the purpose of some
2620 # users who hand-edit it and don't use gnulib-tool. For the regular
2621 # gnulib users they are under a stricter license.
2626 func_get_license_raw
"$1"
2627 # The default is GPL.
2629 } |
sed -e 's,^ *$,,' |
sed -e 1q
2634 # func_get_maintainer module
2636 # - local_gnulib_path from --local-dir
2637 # - modcache true or false, from --cache-modules/--no-cache-modules
2638 func_get_maintainer
()
2640 if ! $modcache; then
2641 func_lookup_file
"modules/$1"
2642 sed -n -e "/^Maintainer$sed_extract_prog" < "$lookedup_file"
2644 func_cache_lookup_module
"$1"
2645 # Output the field's value, including the final newline (if any).
2646 if $have_associative; then
2647 if eval 'test -n "${modcache_maintainer[$1]+set}"'; then
2648 eval 'echo "${modcache_maintainer[$1]}"'
2651 eval "field_set=\"\$${cachevar}_maintainer_set\""
2652 if test -n "$field_set"; then
2653 eval "field_value=\"\$${cachevar}_maintainer\""
2654 echo "${field_value}"
2660 # func_get_tests_module module
2662 # - local_gnulib_path from --local-dir
2663 func_get_tests_module
()
2665 # The naming convention for tests modules is hardwired: ${module}-tests.
2666 if test -f "$gnulib_dir/modules/$1"-tests \
2667 || func_path_foreach
"$local_gnulib_path" func_exists_local_module
%dir
% "$1-tests"; then
2672 # func_acceptable module
2673 # tests whether a module is acceptable.
2675 # - avoidlist list of modules to avoid
2678 for avoid
in $avoidlist; do
2679 if test "$avoid" = "$1"; then
2686 # sed expression to keep the first 32 characters of each line.
2687 sed_first_32_chars
='s/^\(................................\).*/\1/'
2689 # func_module_shellfunc_name module
2690 # computes the shell function name that will contain the m4 macros for the module.
2692 # - macro_prefix prefix to use
2694 # - shellfunc shell function name
2695 func_module_shellfunc_name
()
2699 shellfunc
=func_
${macro_prefix}_gnulib_m4code_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2701 shellfunc
=func_
${macro_prefix}_gnulib_m4code_
$1 ;;
2705 # func_module_shellvar_name module
2706 # computes the shell variable name the will be set to true once the m4 macros
2707 # for the module have been executed.
2709 # - shellvar shell variable name
2710 func_module_shellvar_name
()
2714 shellvar
=${macro_prefix}_gnulib_enabled_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2716 shellvar
=${macro_prefix}_gnulib_enabled_
$1 ;;
2720 # func_module_conditional_name module
2721 # computes the automake conditional name for the module.
2723 # - conditional name of automake conditional
2724 func_module_conditional_name
()
2728 conditional
=${macro_prefix}_GNULIB_ENABLED_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2730 conditional
=${macro_prefix}_GNULIB_ENABLED_
$1 ;;
2734 # func_uncond_add_module B
2735 # notes the presence of B as an unconditional module.
2737 # func_conddep_add_module A B cond
2738 # notes the presence of a conditional dependency from module A to module B,
2739 # subject to the condition that A is enabled and cond is true.
2741 # func_cond_module_p B
2742 # tests whether module B is conditional.
2744 # func_cond_module_condition A B
2745 # returns the condition when B should be enabled as a dependency of A, once the
2746 # m4 code for A has been executed.
2747 # Output: - condition
2749 if $have_associative; then
2750 declare -A conddep_isuncond
2751 declare -A conddep_dependers
2752 declare -A conddep_condition
2753 func_uncond_add_module
()
2755 eval 'conddep_isuncond[$1]=true'
2756 eval 'unset conddep_dependers[$1]'
2758 func_conddep_add_module
()
2760 eval 'isuncond="${conddep_isuncond[$2]}"'
2761 if test -z "$isuncond"; then
2762 # No unconditional dependency to B known at this point.
2763 eval 'conddep_dependers[$2]="${conddep_dependers[$2]} $1"'
2764 eval 'conddep_condition[$1---$2]="$3"'
2767 func_cond_module_p
()
2769 eval 'previous_dependers="${conddep_dependers[$1]}"'
2770 test -n "$previous_dependers"
2772 func_cond_module_condition
()
2774 eval 'condition="${conddep_condition[$1---$2]}"'
2777 func_uncond_add_module
()
2781 suffix
=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2785 eval 'conddep_isuncond_'"$suffix"'=true'
2786 eval 'unset conddep_dependers_'"$suffix"
2788 func_conddep_add_module
()
2792 suffix
=`echo "$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2796 eval 'isuncond="${conddep_isuncond_'"$suffix"'}"'
2797 if test -z "$isuncond"; then
2798 eval 'conddep_dependers_'"$suffix"'="${conddep_dependers_'"$suffix"'} $1"'
2799 suffix
=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
2800 eval 'conddep_condition_'"$suffix"'="$3"'
2803 func_cond_module_p
()
2807 suffix
=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2811 eval 'previous_dependers="${conddep_dependers_'"$suffix"'}"'
2812 test -n "$previous_dependers"
2814 func_cond_module_condition
()
2816 suffix
=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
2817 eval 'condition="${conddep_condition_'"$suffix"'}"'
2821 sed_dependencies_without_conditions
='s/ *\[.*//'
2823 # func_modules_transitive_closure
2825 # - local_gnulib_path from --local-dir
2826 # - gnu_make true if --gnu-make was given, false otherwise
2827 # - modcache true or false, from --cache-modules/--no-cache-modules
2828 # - modules list of specified modules
2829 # - inctests true if tests should be included, false otherwise
2830 # - incobsolete true if obsolete modules among dependencies should be
2831 # included, blank otherwise
2832 # - inc_cxx_tests true if C++ interoperability tests should be included,
2834 # - inc_longrunning_tests true if long-runnings tests should be included,
2836 # - inc_privileged_tests true if tests that require root privileges should be
2837 # included, blank otherwise
2838 # - inc_unportable_tests true if tests that fail on some platforms should be
2839 # included, blank otherwise
2840 # - inc_all_direct_tests true if all kinds of problematic unit tests among
2841 # the unit tests of the specified modules should be
2842 # included, blank otherwise
2843 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
2844 # the unit tests of the dependencies should be
2845 # included, blank otherwise
2846 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
2848 # - excl_longrunning_tests true if long-runnings tests should be excluded,
2850 # - excl_privileged_tests true if tests that require root privileges should be
2851 # excluded, blank otherwise
2852 # - excl_unportable_tests true if tests that fail on some platforms should be
2853 # excluded, blank otherwise
2854 # - avoidlist list of modules to avoid
2855 # - cond_dependencies true if conditional dependencies shall be supported,
2857 # - tmp pathname of a temporary directory
2859 # - modules list of modules, including dependencies
2860 # - conddep_dependers, conddep_condition information about conditionally
2862 func_modules_transitive_closure
()
2864 sed_escape_dependency
='s|\([/.]\)|\\\1|g'
2865 # In order to process every module only once (for speed), process an "input
2866 # list" of modules, producing an "output list" of modules. During each round,
2867 # more modules can be queued in the input list. Once a module on the input
2868 # list has been processed, it is added to the "handled list", so we can avoid
2869 # to process it again.
2871 inmodules
="$modules"
2873 fmtc_inc_all_tests
="$inc_all_direct_tests"
2874 if test "$cond_dependencies" = true
; then
2875 for module
in $inmodules; do
2877 if test -n "$module"; then
2878 if func_acceptable
$module; then
2879 func_uncond_add_module
$module
2884 while test -n "$inmodules"; do
2885 inmodules_this_round
="$inmodules"
2886 inmodules
= # Accumulator, queue for next round
2887 for module
in $inmodules_this_round; do
2889 if test -n "$module"; then
2890 if func_acceptable
$module; then
2891 func_append outmodules
" $module"
2892 if test "$cond_dependencies" = true
; then
2894 && func_get_automake_snippet_conditional
$module \
2895 |
grep '^if ' > /dev
/null
; then
2896 # A module whose Makefile.am snippet contains a reference to an
2897 # automake conditional. If we were to use it conditionally, we
2898 # would get an error
2899 # configure: error: conditional "..." was never defined.
2900 # because automake 1.11.1 does not handle nested conditionals
2901 # correctly. As a workaround, make the module unconditional.
2902 func_uncond_add_module
$module
2904 if func_cond_module_p
$module; then
2910 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
2911 # Duplicate dependencies are harmless, but Jim wants a warning.
2912 duplicated_deps
=`echo "$deps" | LC_ALL=C sort | LC_ALL=C uniq -d`
2913 if test -n "$duplicated_deps"; then
2914 func_warning
"module $module has duplicated dependencies: "`echo $duplicated_deps`
2917 testsmodule
=`func_get_tests_module $module`
2918 if test -n "$testsmodule"; then
2919 deps
="$deps $testsmodule"
2922 for dep
in $deps; do
2923 # Determine whether to include the dependency or tests module.
2925 for word
in `func_get_status $dep`; do
2928 test -n "$incobsolete" \
2932 test -z "$excl_cxx_tests" \
2934 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_cxx_tests" \
2938 test -z "$excl_longrunning_tests" \
2940 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_longrunning_tests" \
2944 test -z "$excl_privileged_tests" \
2946 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_privileged_tests" \
2950 test -z "$excl_unportable_tests" \
2952 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_unportable_tests" \
2956 test -n "$fmtc_inc_all_tests" \
2961 if $inc && func_acceptable
"$dep"; then
2962 func_append inmodules
" $dep"
2963 if test "$cond_dependencies" = true
; then
2964 escaped_dep
=`echo "$dep" | sed -e "$sed_escape_dependency"`
2965 sed_extract_condition1
='/^ *'"$escaped_dep"' *$/{
2968 sed_extract_condition2
='/^ *'"$escaped_dep"' *\[.*\] *$/{
2969 s/^ *'"$escaped_dep"' *\[\(.*\)\] *$/\1/p
2971 condition
=`func_get_dependencies $module | sed -n -e "$sed_extract_condition1" -e "$sed_extract_condition2"`
2972 if test "$condition" = true
; then
2975 if test -n "$condition"; then
2976 func_conddep_add_module
"$module" "$dep" "$condition"
2978 if $conditional; then
2979 func_conddep_add_module
"$module" "$dep" true
2981 func_uncond_add_module
"$dep"
2990 handledmodules
=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
2991 # Remove $handledmodules from $inmodules.
2992 for m
in $inmodules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/queued-modules
2993 inmodules
=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
2994 fmtc_inc_all_tests
="$inc_all_indirect_tests"
2996 modules
=`for m in $outmodules; do echo $m; done | LC_ALL=C sort -u`
2997 rm -f "$tmp"/queued-modules
3000 # func_show_module_list
3002 # - specified_modules list of specified modules (one per line, sorted)
3003 # - modules complete list of modules (one per line, sorted)
3004 # - tmp pathname of a temporary directory
3005 func_show_module_list
()
3011 # Assume xterm compatible escape sequences.
3012 bold_on
=`printf '\033[1m'`
3013 bold_off
=`printf '\033[0m'`
3018 echo "Module list with included dependencies (indented):"
3019 echo "$specified_modules" |
sed -e '/^$/d' -e 's/$/| /' > "$tmp"/specified-modules
3020 echo "$modules" |
sed -e '/^$/d' \
3021 | LC_ALL
=C
join -t '|' -a2 "$tmp"/specified-modules
- \
3022 |
sed -e 's/^\(.*\)|.*/|\1/' -e 's/^/ /' -e 's/^ |\(.*\)$/ '"${bold_on}"'\1'"${bold_off}"'/'
3025 # func_modules_transitive_closure_separately
3026 # Determine main module list and tests-related module list separately.
3027 # The main module list is the transitive closure of the specified modules,
3028 # ignoring tests modules. Its lib/* sources go into $sourcebase/. If --lgpl
3029 # is specified, it will consist only of LGPLed source.
3030 # The tests-related module list is the transitive closure of the specified
3031 # modules, including tests modules, minus the main module list excluding
3032 # modules of applicability 'all'. Its lib/* sources (brought in through
3033 # dependencies of *-tests modules) go into $testsbase/. It may contain GPLed
3034 # source, even if --lgpl is specified.
3036 # - local_gnulib_path from --local-dir
3037 # - modcache true or false, from --cache-modules/--no-cache-modules
3038 # - specified_modules list of specified modules
3039 # - inctests true if tests should be included, false otherwise
3040 # - incobsolete true if obsolete modules among dependencies should be
3041 # included, blank otherwise
3042 # - inc_cxx_tests true if C++ interoperability tests should be included,
3044 # - inc_longrunning_tests true if long-runnings tests should be included,
3046 # - inc_privileged_tests true if tests that require root privileges should be
3047 # included, blank otherwise
3048 # - inc_unportable_tests true if tests that fail on some platforms should be
3049 # included, blank otherwise
3050 # - inc_all_direct_tests true if all kinds of problematic unit tests among
3051 # the unit tests of the specified modules should be
3052 # included, blank otherwise
3053 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
3054 # the unit tests of the dependencies should be
3055 # included, blank otherwise
3056 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
3058 # - excl_longrunning_tests true if long-runnings tests should be excluded,
3060 # - excl_privileged_tests true if tests that require root privileges should be
3061 # excluded, blank otherwise
3062 # - excl_unportable_tests true if tests that fail on some platforms should be
3063 # excluded, blank otherwise
3064 # - avoidlist list of modules to avoid
3065 # - cond_dependencies true if conditional dependencies shall be supported,
3067 # - tmp pathname of a temporary directory
3069 # - main_modules list of modules, including dependencies
3070 # - testsrelated_modules list of tests-related modules, including dependencies
3071 # - conddep_dependers, conddep_condition information about conditionally
3073 func_modules_transitive_closure_separately
()
3075 # Determine main module list.
3076 saved_inctests
="$inctests"
3078 modules
="$specified_modules"
3079 func_modules_transitive_closure
3080 main_modules
="$modules"
3081 inctests
="$saved_inctests"
3082 if test $verbose -ge 1; then
3083 echo "Main module list:"
3084 echo "$main_modules" |
sed -e 's/^/ /'
3086 # Determine tests-related module list.
3087 echo "$final_modules" | LC_ALL
=C
sort -u > "$tmp"/final-modules
3088 testsrelated_modules
=`for module in $main_modules; do
3089 if test \`func_get_applicability
$module\
` = main; then
3093 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/final-modules`
3094 # If testsrelated_modules consists only of modules with applicability 'all',
3095 # set it to empty (because such modules are only helper modules for other modules).
3096 have_nontrivial_testsrelated_modules
=
3097 for module
in $testsrelated_modules; do
3098 if test `func_get_applicability $module` != all
; then
3099 have_nontrivial_testsrelated_modules
=yes
3103 if test -z "$have_nontrivial_testsrelated_modules"; then
3104 testsrelated_modules
=
3106 if test $verbose -ge 1; then
3107 echo "Tests-related module list:"
3108 echo "$testsrelated_modules" |
sed -e 's/^/ /'
3112 # func_determine_use_libtests
3113 # Determines whether a $testsbase/libtests.a is needed.
3115 # - local_gnulib_path from --local-dir
3116 # - modcache true or false, from --cache-modules/--no-cache-modules
3117 # - testsrelated_modules list of tests-related modules, including dependencies
3119 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
3120 func_determine_use_libtests
()
3123 for module
in $testsrelated_modules; do
3124 func_verify_nontests_module
3125 if test -n "$module"; then
3126 all_files
=`func_get_filelist $module`
3127 # Test whether some file in $all_files lies in lib/.
3128 for f
in $all_files; do
3140 # func_modules_add_dummy
3142 # - local_gnulib_path from --local-dir
3143 # - modcache true or false, from --cache-modules/--no-cache-modules
3144 # - modules list of modules, including dependencies
3146 # - modules list of modules, including 'dummy' if needed
3147 func_modules_add_dummy
()
3149 # Determine whether any module provides a lib_SOURCES augmentation.
3151 for module
in $modules; do
3152 func_verify_nontests_module
3153 if test -n "$module"; then
3154 # Extract the value of "lib_SOURCES += ...".
3155 for file in `func_get_automake_snippet "$module" | combine_lines |
3156 sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'`; do
3157 # Ignore .h files since they are not compiled.
3161 have_lib_SOURCES
=yes
3168 # Add the dummy module, to make sure the library will be non-empty.
3169 if test -z "$have_lib_SOURCES"; then
3170 if func_acceptable
"dummy"; then
3171 func_append modules
" dummy"
3176 # func_modules_add_dummy_separately
3178 # - local_gnulib_path from --local-dir
3179 # - modcache true or false, from --cache-modules/--no-cache-modules
3180 # - main_modules list of modules, including dependencies
3181 # - testsrelated_modules list of tests-related modules, including dependencies
3182 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
3184 # - main_modules list of modules, including 'dummy' if needed
3185 # - testsrelated_modules list of tests-related modules, including 'dummy' if
3187 func_modules_add_dummy_separately
()
3189 # Add the dummy module to the main module list if needed.
3190 modules
="$main_modules"
3191 func_modules_add_dummy
3192 main_modules
="$modules"
3194 # Add the dummy module to the tests-related module list if needed.
3195 if $use_libtests; then
3196 modules
="$testsrelated_modules"
3197 func_modules_add_dummy
3198 testsrelated_modules
="$modules"
3202 # func_modules_notice
3204 # - local_gnulib_path from --local-dir
3205 # - modcache true or false, from --cache-modules/--no-cache-modules
3206 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
3207 # - modules list of modules, including dependencies
3208 func_modules_notice
()
3210 if test $verbose -ge -1; then
3211 for module
in $modules; do
3213 if test -n "$module"; then
3214 msg
=`func_get_notice $module`
3215 if test -n "$msg"; then
3216 echo "Notice from module $module:"
3217 echo "$msg" |
sed -e 's/^/ /'
3224 # func_modules_to_filelist
3226 # - local_gnulib_path from --local-dir
3227 # - modcache true or false, from --cache-modules/--no-cache-modules
3228 # - modules list of modules, including dependencies
3230 # - files list of files
3231 func_modules_to_filelist
()
3234 for module
in $modules; do
3236 if test -n "$module"; then
3237 fs
=`func_get_filelist $module`
3238 func_append files
" $fs"
3241 files
=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
3244 # func_modules_to_filelist_separately
3245 # Determine the final file lists.
3246 # They must be computed separately, because files in lib/* go into
3247 # $sourcebase/ if they are in the main file list but into $testsbase/
3248 # if they are in the tests-related file list. Furthermore lib/dummy.c
3251 # - local_gnulib_path from --local-dir
3252 # - modcache true or false, from --cache-modules/--no-cache-modules
3253 # - main_modules list of modules, including dependencies
3254 # - testsrelated_modules list of tests-related modules, including dependencies
3255 func_modules_to_filelist_separately
()
3257 # Determine final main file list.
3258 modules
="$main_modules"
3259 func_modules_to_filelist
3261 # Determine final tests-related file list.
3262 modules
="$testsrelated_modules"
3263 func_modules_to_filelist
3264 testsrelated_files
=`echo "$files" | sed -e 's,^lib/,tests=lib/,'`
3265 # Merge both file lists.
3266 sed_remove_empty_lines
='/^$/d'
3267 files
=`{ echo "$main_files"; echo "$testsrelated_files"; } | sed -e "$sed_remove_empty_lines" | LC_ALL=C sort -u`
3268 if test $verbose -ge 0; then
3270 sed_prettyprint_files
='s,^tests=lib/\(.*\)$,lib/\1 -> tests/\1,'
3271 echo "$files" |
sed -e "$sed_prettyprint_files" -e 's/^/ /'
3275 # func_compute_include_guard_prefix
3276 # Determine include_guard_prefix.
3278 # - macro_prefix prefix of gl_LIBOBJS macros to use
3280 # - include_guard_prefix replacement for ${gl_include_guard_prefix}
3281 # - sed_replace_include_guard_prefix
3282 # sed expression for resolving ${gl_include_guard_prefix}
3283 func_compute_include_guard_prefix
()
3285 if test "$macro_prefix" = gl
; then
3286 include_guard_prefix
='GL'
3288 include_guard_prefix
='GL_'`echo "$macro_prefix" | LC_ALL=C tr '[a-z]' '[A-Z]'`
3290 sed_replace_include_guard_prefix
='s/\${gl_include_guard_prefix}/'"${include_guard_prefix}"'/g'
3293 # func_execute_command command [args...]
3294 # Executes a command.
3295 # Uses also the variables
3296 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
3297 func_execute_command
()
3299 if test $verbose -ge 0; then
3303 # Commands like automake produce output to stderr even when they succeed.
3304 # Turn this output off if the command succeeds.
3305 "$@" > "$tmp"/cmdout
2>&1
3307 if test $cmdret = 0; then
3311 cat "$tmp"/cmdout
1>&2
3318 # func_dest_tmpfilename file
3319 # determines the name of a temporary file (file is relative to destdir).
3321 # - destdir target directory
3322 # - doit : if actions shall be executed, false if only to be printed
3323 # - tmp pathname of a temporary directory
3325 # - tmpfile absolute filename of the temporary file
3326 func_dest_tmpfilename
()
3329 # Put the new contents of $file in a file in the same directory (needed
3330 # to guarantee that an 'mv' to "$destdir/$file" works).
3331 tmpfile
="$destdir/$1.tmp"
3333 # Put the new contents of $file in a file in a temporary directory
3334 # (because the directory of "$file" might not exist).
3335 tmpfile
="$tmp"/`basename "$1"`.tmp
3339 # func_is_local_file lookedup_file file
3340 # check whether file should be instantiated from local gnulib directory
3341 func_is_local_file
()
3344 func_remove_suffix dname
"/$2"
3345 func_path_foreach
"$local_gnulib_path" test %dir
% = "$dname"
3349 # determines whether the file $f should be copied, symlinked, or hardlinked.
3351 # - copymode copy mode for files in general
3352 # - lcopymode copy mode for files from local_gnulib_path
3353 # - f the original file name
3354 # - lookedup_file name of the merged (combined) file
3356 # - copyaction copy or symlink or hardlink
3359 if test -n "$lcopymode" && func_is_local_file
"$lookedup_file" "$f"; then
3360 copyaction
="$lcopymode"
3362 if test -n "$copymode"; then
3363 copyaction
="$copymode"
3371 # copies a file from gnulib into the destination directory. The destination
3372 # is known to not exist.
3374 # - destdir target directory
3375 # - local_gnulib_path from --local-dir
3376 # - modcache true or false, from --cache-modules/--no-cache-modules
3377 # - f the original file name
3378 # - lookedup_file name of the merged (combined) file
3379 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
3380 # - g the rewritten file name
3381 # - tmpfile absolute filename of the temporary file
3382 # - doit : if actions shall be executed, false if only to be printed
3383 # - copymode copy mode for files in general
3384 # - lcopymode copy mode for files from local_gnulib_path
3388 echo "Copying file $g"
3390 if test "$copyaction" = symlink \
3391 && test -z "$lookedup_tmp" \
3392 && cmp -s "$lookedup_file" "$tmpfile"; then
3393 func_symlink_if_changed
"$lookedup_file" "$destdir/$g"
3395 if test "$copyaction" = hardlink \
3396 && test -z "$lookedup_tmp" \
3397 && cmp -s "$lookedup_file" "$tmpfile"; then
3398 func_hardlink
"$lookedup_file" "$destdir/$g"
3400 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error
"failed"
3409 # copies a file from gnulib into the destination directory. The destination
3410 # is known to exist.
3412 # - destdir target directory
3413 # - local_gnulib_path from --local-dir
3414 # - modcache true or false, from --cache-modules/--no-cache-modules
3415 # - f the original file name
3416 # - lookedup_file name of the merged (combined) file
3417 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
3418 # - g the rewritten file name
3419 # - tmpfile absolute filename of the temporary file
3420 # - doit : if actions shall be executed, false if only to be printed
3421 # - copymode copy mode for files in general
3422 # - lcopymode copy mode for files from local_gnulib_path
3423 # - already_present nonempty if the file should already exist, empty otherwise
3426 if cmp -s "$destdir/$g" "$tmpfile"; then
3427 : # The file has not changed.
3431 if test -n "$already_present"; then
3432 echo "Updating file $g (backup in ${g}~)"
3434 echo "Replacing file $g (non-gnulib code backed up in ${g}~) !!"
3436 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error
"failed"
3438 if test "$copyaction" = symlink \
3439 && test -z "$lookedup_tmp" \
3440 && cmp -s "$lookedup_file" "$tmpfile"; then
3441 func_symlink_if_changed
"$lookedup_file" "$destdir/$g"
3443 if test "$copyaction" = hardlink \
3444 && test -z "$lookedup_tmp" \
3445 && cmp -s "$lookedup_file" "$tmpfile"; then
3446 func_hardlink
"$lookedup_file" "$destdir/$g"
3448 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error
"failed"
3452 if test -n "$already_present"; then
3453 echo "Update file $g (backup in ${g}~)"
3455 echo "Replace file $g (non-gnulib code backed up in ${g}~) !!"
3461 # func_emit_lib_Makefile_am
3462 # emits the contents of library makefile to standard output.
3464 # - local_gnulib_path from --local-dir
3465 # - modcache true or false, from --cache-modules/--no-cache-modules
3466 # - modules list of modules, including dependencies
3467 # - libname library name
3468 # - pobase directory relative to destdir where to place *.po files
3469 # - auxdir directory relative to destdir where to place build aux files
3470 # - gnu_make true if --gnu-make was given, false otherwise
3471 # - makefile_name from --makefile-name
3472 # - libtool true if libtool will be used, false or blank otherwise
3473 # - macro_prefix prefix of gl_LIBOBJS macros to use
3474 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
3475 # - witness_c_macro from --witness-c-macro
3476 # - actioncmd (optional) command that will reproduce this invocation
3477 # - for_test true if creating a package for testing, false otherwise
3478 # - sed_replace_include_guard_prefix
3479 # sed expression for resolving ${gl_include_guard_prefix}
3480 # - destfile filename relative to destdir of makefile being generated
3482 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val}
3483 # list of edits to be done to Makefile.am variables
3485 # - uses_subdirs nonempty if object files in subdirs exist
3486 func_emit_lib_Makefile_am
()
3489 # When using GNU make, or when creating an includable Makefile.am snippet,
3490 # augment variables with += instead of assigning them.
3491 if $gnu_make ||
test -n "$makefile_name"; then
3496 if test "$libtool" = true
; then
3499 sed_eliminate_LDFLAGS
="$sed_noop"
3503 sed_eliminate_LDFLAGS
='/^lib_LDFLAGS[ ]*+=/d'
3506 # When creating a package for testing: Attempt to provoke failures,
3507 # especially link errors, already during "make" rather than during
3508 # "make check", because "make check" is not possible in a cross-compiling
3509 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
3510 sed_transform_check_PROGRAMS
='s,check_PROGRAMS,noinst_PROGRAMS,g'
3512 sed_transform_check_PROGRAMS
="$sed_noop"
3514 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3515 echo "## Process this file with automake to produce Makefile.in."
3516 func_emit_copyright_notice
3517 if test -n "$actioncmd"; then
3518 # The maximum line length (excluding the terminating newline) of any file
3519 # that is to be preprocessed by config.status is 3070. config.status uses
3520 # awk, and the HP-UX 11.00 awk fails if a line has length >= 3071;
3521 # similarly, the IRIX 6.5 awk fails if a line has length >= 3072.
3522 len
=`echo "$actioncmd" | wc -c`
3523 if test -n "$len" && test "$len" -le 3000; then
3524 echo "# Reproduce by: $actioncmd"
3530 for module
in $modules; do
3531 func_verify_nontests_module
3532 if test -n "$module"; then
3534 func_get_automake_snippet_conditional
"$module" |
3536 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
3537 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
3538 -e "$sed_eliminate_LDFLAGS" \
3539 -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' \
3540 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
3541 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
3542 -e "$sed_transform_check_PROGRAMS" \
3543 -e "$sed_replace_include_guard_prefix"
3544 if test "$module" = 'alloca'; then
3545 echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
3546 echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@"
3548 } | combine_lines
"${libname}_${libext}_SOURCES" > "$tmp"/amsnippet1
3550 func_get_automake_snippet_unconditional
"$module" |
3551 LC_ALL
=C
sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g'
3552 } > "$tmp"/amsnippet2
3553 # Skip the contents if it's entirely empty.
3554 if grep '[^ ]' "$tmp"/amsnippet1
"$tmp"/amsnippet2
> /dev
/null
; then
3555 echo "## begin gnulib module $module"
3557 echo "ifeq (,\$(OMIT_GNULIB_MODULE_$module))"
3558 convert_to_gnu_make
='s/^if \(.*\)/ifneq (,$(\1))/'
3560 convert_to_gnu_make
=
3563 if test "$cond_dependencies" = true
; then
3564 if func_cond_module_p
"$module"; then
3565 func_module_conditional_name
"$module"
3567 echo "ifneq (,\$($conditional))"
3569 echo "if $conditional"
3573 sed "$convert_to_gnu_make" "$tmp"/amsnippet1
3574 if test "$cond_dependencies" = true
; then
3575 if func_cond_module_p
"$module"; then
3579 sed "$convert_to_gnu_make" "$tmp"/amsnippet2
3583 echo "## end gnulib module $module"
3586 rm -f "$tmp"/amsnippet1
"$tmp"/amsnippet2
3587 # Test whether there are some source files in subdirectories.
3588 for f
in `func_get_filelist "$module"`; do
3598 } > "$tmp"/allsnippets
3599 if test -z "$makefile_name"; then
3600 # If there are source files in subdirectories, prevent collision of the
3601 # object files (example: hash.c and libxml/hash.c).
3603 if test -n "$uses_subdirs"; then
3604 subdir_options
=' subdir-objects'
3606 echo "AUTOMAKE_OPTIONS = 1.9.6 gnits${subdir_options}"
3609 if test -z "$makefile_name"; then
3611 echo "noinst_HEADERS ="
3612 echo "noinst_LIBRARIES ="
3613 echo "noinst_LTLIBRARIES ="
3614 # Automake versions < 1.11.4 create an empty pkgdatadir at
3615 # installation time if you specify pkgdata_DATA to empty.
3616 # See automake bugs #10997 and #11030:
3617 # * https://debbugs.gnu.org/10997
3618 # * https://debbugs.gnu.org/11030
3619 # So we need this workaround.
3620 if grep '^pkgdata_DATA *+=' "$tmp"/allsnippets
> /dev
/null
; then
3621 echo "pkgdata_DATA ="
3624 echo "BUILT_SOURCES ="
3627 echo "MOSTLYCLEANFILES $assign core *.stackdump"
3628 if test -z "$makefile_name"; then
3629 echo "MOSTLYCLEANDIRS ="
3631 echo "DISTCLEANFILES ="
3632 echo "MAINTAINERCLEANFILES ="
3635 echo "# Start of GNU Make output."
3637 # Put autoconf output into a temporary file, so that its exit status
3638 # can be checked from the shell. Signal any error by putting a
3639 # syntax error into the output makefile.
3640 ${AUTOCONF} -t 'AC_SUBST:$1 = @$1@' "$configure_ac" \
3641 >"$tmp"/makeout
2>"$tmp"/makeout2
&&
3642 LC_ALL
=C
sort -u "$tmp"/makeout ||
{
3643 echo "== gnulib-tool GNU Make output failed as follows =="
3644 sed 's/^/# stderr: /' "$tmp"/makeout2
3646 rm -f "$tmp"/makeout
"$tmp"/makeout2
3648 echo "# End of GNU Make output."
3650 echo "# No GNU Make output."
3652 # Execute edits that apply to the Makefile.am being generated.
3654 while test $edit != $makefile_am_edits; do
3655 edit
=`expr $edit + 1`
3656 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
3657 eval var
=\"\
$makefile_am_edit${edit}_var
\"
3658 eval val
=\"\
$makefile_am_edit${edit}_val
\"
3659 if test -n "$var"; then
3660 if test "${dir}Makefile.am" = "$destfile" ||
test "./${dir}Makefile.am" = "$destfile"; then
3661 echo "${var} += ${val}"
3662 eval "makefile_am_edit${edit}_var="
3666 if test -n "$witness_c_macro"; then
3667 cppflags_part1
=" -D$witness_c_macro=1"
3672 cppflags_part2
=" -DGNULIB_STRICT_CHECKING=1"
3676 if test -z "$makefile_name"; then
3678 echo "AM_CPPFLAGS =$cppflags_part1$cppflags_part2"
3681 if test -n "$cppflags_part1$cppflags_part2"; then
3683 echo "AM_CPPFLAGS +=$cppflags_part1$cppflags_part2"
3687 if LC_ALL
=C
grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$tmp"/allsnippets
> /dev
/null \
3688 ||
{ test -n "$makefile_name" \
3689 && test -f "$sourcebase/Makefile.am" \
3690 && LC_ALL
=C
grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$sourcebase/Makefile.am" > /dev
/null
; \
3692 # One of the snippets or the user's Makefile.am already specifies an
3693 # installation location for the library. Don't confuse automake by saying
3694 # it should not be installed.
3697 # By default, the generated library should not be installed.
3698 echo "noinst_${perhapsLT}LIBRARIES += $libname.$libext"
3701 echo "${libname}_${libext}_SOURCES ="
3702 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
3703 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
3704 echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
3705 echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
3706 echo "EXTRA_${libname}_${libext}_SOURCES ="
3707 if test "$libtool" = true
; then
3708 echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)"
3709 echo "${libname}_${libext}_LDFLAGS += -no-undefined"
3710 # Synthesize an ${libname}_${libext}_LDFLAGS augmentation by combining
3711 # the link dependencies of all modules.
3712 for module
in $modules; do
3713 func_verify_nontests_module
3714 if test -n "$module"; then
3715 func_get_link_directive
"$module"
3718 | LC_ALL
=C
sed -e '/^$/d' -e 's/ when linking with libtool.*//' \
3719 | LC_ALL
=C
sort -u \
3720 | LC_ALL
=C
sed -e 's/^/'"${libname}_${libext}"'_LDFLAGS += /'
3723 if test -n "$pobase"; then
3724 echo "AM_CPPFLAGS += -DDEFAULT_TEXT_DOMAIN=\\\"${po_domain}-gnulib\\\""
3727 cat "$tmp"/allsnippets \
3728 |
sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
3730 echo "mostlyclean-local: mostlyclean-generic"
3731 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
3732 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
3733 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
3737 rm -f "$tmp"/allsnippets
3740 # func_emit_po_Makevars
3741 # emits the contents of po/ makefile parameterization to standard output.
3743 # - local_gnulib_path from --local-dir
3744 # - modcache true or false, from --cache-modules/--no-cache-modules
3745 # - sourcebase directory relative to destdir where to place source code
3746 # - pobase directory relative to destdir where to place *.po files
3747 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
3748 func_emit_po_Makevars
()
3750 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3751 func_emit_copyright_notice
3753 echo "# Usually the message domain is the same as the package name."
3754 echo "# But here it has a '-gnulib' suffix."
3755 echo "DOMAIN = ${po_domain}-gnulib"
3757 echo "# These two variables depend on the location of this directory."
3758 echo "subdir = ${pobase}"
3759 echo "top_builddir = "`echo "$pobase" | sed -e 's,//*,/,g' -e 's,[^/][^/]*,..,g'`
3762 # These options get passed to xgettext.
3763 XGETTEXT_OPTIONS
= \
3764 --keyword=_
--flag=_
:1:pass-c-format \
3765 --keyword=N_
--flag=N_
:1:pass-c-format \
3766 --keyword='proper_name:1,"This is a proper name. See the gettext manual, section Names."' \
3767 --keyword='proper_name_utf8:1,"This is a proper name. See the gettext manual, section Names."' \
3768 --flag=error
:3:c-format
--flag=error_at_line
:5:c-format
3770 # This is the copyright holder that gets inserted into the header of the
3771 # $(DOMAIN).pot file. gnulib is copyrighted by the FSF.
3772 COPYRIGHT_HOLDER
= Free Software Foundation
, Inc.
3774 # This is the email address or URL to which the translators shall report
3775 # bugs in the untranslated strings:
3776 # - Strings which are not entire sentences, see the maintainer guidelines
3777 # in the GNU gettext documentation, section 'Preparing Strings'.
3778 # - Strings which use unclear terms or require additional context to be
3780 # - Strings which make invalid assumptions about notation of date, time or
3782 # - Pluralisation problems.
3783 # - Incorrect English spelling.
3784 # - Incorrect formatting.
3785 # It can be your email address, or a mailing list address where translators
3786 # can write to without being subscribed, or the URL of a web page through
3787 # which the translators can contact you.
3788 MSGID_BUGS_ADDRESS
= bug-gnulib@gnu.org
3790 # This is the list of locale categories, beyond LC_MESSAGES, for which the
3791 # message catalogs shall be used. It is usually empty.
3792 EXTRA_LOCALE_CATEGORIES
=
3794 # This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
3795 # context. Possible values are "yes" and "no". Set this to yes if the
3796 # package uses functions taking also a message context, like pgettext(), or
3797 # if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
3802 # func_emit_po_POTFILES_in
3803 # emits the file list to be passed to xgettext to standard output.
3805 # - local_gnulib_path from --local-dir
3806 # - modcache true or false, from --cache-modules/--no-cache-modules
3807 # - sourcebase directory relative to destdir where to place source code
3808 # - files list of new files
3809 func_emit_po_POTFILES_in
()
3811 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3812 func_emit_copyright_notice
3814 echo "# List of files which contain translatable strings."
3815 echo "$files" |
sed -n -e "s,^lib/,$sourcebase/,p"
3818 # func_emit_tests_Makefile_am witness_macro
3819 # emits the contents of tests makefile to standard output.
3821 # - local_gnulib_path from --local-dir
3822 # - modcache true or false, from --cache-modules/--no-cache-modules
3823 # - modules list of modules, including dependencies
3824 # - libname library name
3825 # - auxdir directory relative to destdir where to place build aux files
3826 # - gnu_make true if --gnu-make was given, false otherwise
3827 # - makefile_name from --makefile-name
3828 # - libtool true if libtool will be used, false or blank otherwise
3829 # - sourcebase relative directory containing lib source code
3830 # - m4base relative directory containing autoconf macros
3831 # - testsbase relative directory containing unit test code
3832 # - macro_prefix prefix of gl_LIBOBJS macros to use
3833 # - witness_c_macro from --witness-c-macro
3834 # - for_test true if creating a package for testing, false otherwise
3835 # - single_configure true if a single configure file should be generated,
3836 # false for a separate configure file for the tests
3837 # - use_libtests true if a libtests.a should be built, false otherwise
3838 # - sed_replace_include_guard_prefix
3839 # sed expression for resolving ${gl_include_guard_prefix}
3840 # - destfile filename relative to destdir of makefile being generated
3842 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val}
3843 # list of edits to be done to Makefile.am variables
3845 # - uses_subdirs nonempty if object files in subdirs exist
3846 func_emit_tests_Makefile_am
()
3849 if test "$libtool" = true
; then
3852 sed_eliminate_LDFLAGS
="$sed_noop"
3856 sed_eliminate_LDFLAGS
='/^lib_LDFLAGS[ ]*+=/d'
3859 # When creating a package for testing: Attempt to provoke failures,
3860 # especially link errors, already during "make" rather than during
3861 # "make check", because "make check" is not possible in a cross-compiling
3862 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
3863 sed_transform_check_PROGRAMS
='s,check_PROGRAMS,noinst_PROGRAMS,g'
3865 sed_transform_check_PROGRAMS
="$sed_noop"
3867 testsbase_inverse
=`echo "$testsbase" | sed -e 's,/$,,' | sed -e 's,[^/][^/]*,..,g'`
3868 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3869 echo "## Process this file with automake to produce Makefile.in."
3870 func_emit_copyright_notice
3874 for module
in $modules; do
3875 if $for_test && ! $single_configure; then
3876 func_verify_tests_module
3880 if test -n "$module"; then
3882 func_get_automake_snippet
"$module" |
3884 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
3885 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
3886 -e "$sed_eliminate_LDFLAGS" \
3887 -e 's,lib_\([A-Z][A-Z]*\),libtests_a_\1,g' \
3888 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
3889 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
3890 -e "$sed_transform_check_PROGRAMS" \
3891 -e "$sed_replace_include_guard_prefix"
3892 if $use_libtests && test "$module" = 'alloca'; then
3893 echo "libtests_a_LIBADD += @ALLOCA@"
3894 echo "libtests_a_DEPENDENCIES += @ALLOCA@"
3896 } > "$tmp"/amsnippet
3897 # Skip the contents if it's entirely empty.
3898 if grep '[^ ]' "$tmp"/amsnippet
> /dev
/null
; then
3899 # Mention long-running tests at the end.
3901 for word
in `func_get_status "$module"`; do
3902 if test "$word" = 'longrunning-test'; then
3907 { echo "## begin gnulib module $module"
3909 echo "ifeq (,\$(OMIT_GNULIB_MODULE_$module))"
3912 cat "$tmp"/amsnippet
3916 echo "## end gnulib module $module"
3920 rm -f "$tmp"/amsnippet
3921 # Test whether there are some source files in subdirectories.
3922 for f
in `func_get_filelist "$module"`; do
3924 lib
/*/*.c |
tests
/*/*.c
)
3932 } 3> "$tmp"/main_snippets
4> "$tmp"/longrunning_snippets
3933 # Generate dependencies here, since it eases the debugging of test failures.
3934 # If there are source files in subdirectories, prevent collision of the
3935 # object files (example: hash.c and libxml/hash.c).
3937 if test -n "$uses_subdirs"; then
3938 subdir_options
=' subdir-objects'
3940 echo "AUTOMAKE_OPTIONS = 1.9.6 foreign${subdir_options}"
3942 if $for_test && ! $single_configure; then
3943 echo "ACLOCAL_AMFLAGS = -I ${testsbase_inverse}/${m4base}"
3946 # Nothing is being added to SUBDIRS; nevertheless the existence of this
3947 # variable is needed to avoid an error from automake:
3948 # "AM_GNU_GETTEXT used but SUBDIRS not defined"
3951 echo "XFAIL_TESTS ="
3952 echo "TESTS_ENVIRONMENT ="
3953 echo "noinst_PROGRAMS ="
3954 if ! $for_test; then
3955 echo "check_PROGRAMS ="
3957 echo "EXTRA_PROGRAMS ="
3958 echo "noinst_HEADERS ="
3959 echo "noinst_LIBRARIES ="
3960 if $use_libtests; then
3962 echo "noinst_LIBRARIES += libtests.a"
3964 echo "check_LIBRARIES = libtests.a"
3967 # Automake versions < 1.11.4 create an empty pkgdatadir at
3968 # installation time if you specify pkgdata_DATA to empty.
3969 # See automake bugs #10997 and #11030:
3970 # * https://debbugs.gnu.org/10997
3971 # * https://debbugs.gnu.org/11030
3972 # So we need this workaround.
3973 if grep '^pkgdata_DATA *+=' "$tmp"/main_snippets
"$tmp"/longrunning_snippets
> /dev
/null
; then
3974 echo "pkgdata_DATA ="
3977 echo "BUILT_SOURCES ="
3979 echo "MOSTLYCLEANFILES = core *.stackdump"
3980 echo "MOSTLYCLEANDIRS ="
3982 echo "DISTCLEANFILES ="
3983 echo "MAINTAINERCLEANFILES ="
3984 # Execute edits that apply to the Makefile.am being generated.
3986 while test $edit != $makefile_am_edits; do
3987 edit
=`expr $edit + 1`
3988 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
3989 eval var
=\"\
$makefile_am_edit${edit}_var
\"
3990 eval val
=\"\
$makefile_am_edit${edit}_val
\"
3991 if test -n "$var"; then
3992 if test "${dir}Makefile.am" = "$destfile" ||
test "./${dir}Makefile.am" = "$destfile"; then
3993 echo "${var} += ${val}"
3994 eval "makefile_am_edit${edit}_var="
3999 echo "AM_CPPFLAGS = \\"
4001 echo " -DGNULIB_STRICT_CHECKING=1 \\"
4003 if test -n "$witness_c_macro"; then
4004 echo " -D$witness_c_macro=1 \\"
4006 if test -n "${witness_macro}"; then
4007 echo " -D@${witness_macro}@=1 \\"
4009 echo " -I. -I\$(srcdir) \\"
4010 echo " -I${testsbase_inverse} -I\$(srcdir)/${testsbase_inverse} \\"
4011 echo " -I${testsbase_inverse}/${sourcebase-lib} -I\$(srcdir)/${testsbase_inverse}/${sourcebase-lib}"
4013 local_ldadd_before
=''
4014 local_ldadd_after
=''
4015 if $use_libtests; then
4016 # All test programs need to be linked with libtests.a.
4017 # It needs to be passed to the linker before ${libname}.${libext}, since
4018 # the tests-related modules depend on the main modules.
4019 # It also needs to be passed to the linker after ${libname}.${libext}
4020 # because the latter might contain incomplete modules (such as the 'error'
4021 # module whose dependency to 'progname' is voluntarily omitted).
4022 # The LIBTESTS_LIBDEPS can be passed to the linker once or twice, it does
4024 local_ldadd_before
=' libtests.a'
4025 local_ldadd_after
=' libtests.a $(LIBTESTS_LIBDEPS)'
4027 echo "LDADD =${local_ldadd_before} ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext}${local_ldadd_after}"
4029 if $use_libtests; then
4030 echo "libtests_a_SOURCES ="
4031 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
4032 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
4033 echo "libtests_a_LIBADD = \$(${macro_prefix}tests_LIBOBJS)"
4034 echo "libtests_a_DEPENDENCIES = \$(${macro_prefix}tests_LIBOBJS)"
4035 echo "EXTRA_libtests_a_SOURCES ="
4036 # The circular dependency in LDADD requires this.
4037 echo "AM_LIBTOOLFLAGS = --preserve-dup-deps"
4040 # Many test scripts use ${EXEEXT} or ${srcdir}.
4041 # EXEEXT is defined by AC_PROG_CC through autoconf.
4042 # srcdir is defined by autoconf and automake.
4043 echo "TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='\$(srcdir)'"
4045 cat "$tmp"/main_snippets
"$tmp"/longrunning_snippets \
4046 |
sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
4047 echo "# Clean up after Solaris cc."
4049 echo " rm -rf SunWS_cache"
4051 echo "mostlyclean-local: mostlyclean-generic"
4052 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
4053 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
4054 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
4058 rm -f "$tmp"/main_snippets
"$tmp"/longrunning_snippets
4061 # func_emit_initmacro_start macro_prefix
4062 # emits the first few statements of the gl_INIT macro to standard output.
4063 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4064 func_emit_initmacro_start
()
4066 macro_prefix_arg
="$1"
4067 # Overriding AC_LIBOBJ and AC_REPLACE_FUNCS has the effect of storing
4068 # platform-dependent object files in ${macro_prefix_arg}_LIBOBJS instead of
4069 # LIBOBJS. The purpose is to allow several gnulib instantiations under
4070 # a single configure.ac file. (AC_CONFIG_LIBOBJ_DIR does not allow this
4072 # Furthermore it avoids an automake error like this when a Makefile.am
4073 # that uses pieces of gnulib also uses $(LIBOBJ):
4074 # automatically discovered file `error.c' should not be explicitly mentioned
4075 echo " m4_pushdef([AC_LIBOBJ], m4_defn([${macro_prefix_arg}_LIBOBJ]))"
4076 echo " m4_pushdef([AC_REPLACE_FUNCS], m4_defn([${macro_prefix_arg}_REPLACE_FUNCS]))"
4077 # Overriding AC_LIBSOURCES has the same purpose of avoiding the automake
4078 # error when a Makefile.am that uses pieces of gnulib also uses $(LIBOBJ):
4079 # automatically discovered file `error.c' should not be explicitly mentioned
4080 # We let automake know about the files to be distributed through the
4081 # EXTRA_lib_SOURCES variable.
4082 echo " m4_pushdef([AC_LIBSOURCES], m4_defn([${macro_prefix_arg}_LIBSOURCES]))"
4083 # Create data variables for checking the presence of files that are mentioned
4084 # as AC_LIBSOURCES arguments. These are m4 variables, not shell variables,
4085 # because we want the check to happen when the configure file is created,
4086 # not when it is run. ${macro_prefix_arg}_LIBSOURCES_LIST is the list of
4087 # files to check for. ${macro_prefix_arg}_LIBSOURCES_DIR is the subdirectory
4088 # in which to expect them.
4089 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_LIST], [])"
4090 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_DIR], [])"
4094 # func_emit_initmacro_end macro_prefix
4095 # emits the last few statements of the gl_INIT macro to standard output.
4096 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4097 func_emit_initmacro_end
()
4099 macro_prefix_arg
="$1"
4100 # Check the presence of files that are mentioned as AC_LIBSOURCES arguments.
4101 # The check is performed only when autoconf is run from the directory where
4102 # the configure.ac resides; if it is run from a different directory, the
4104 echo " m4_ifval(${macro_prefix_arg}_LIBSOURCES_LIST, ["
4105 echo " m4_syscmd([test ! -d ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[ ||"
4106 echo " for gl_file in ]${macro_prefix_arg}_LIBSOURCES_LIST[ ; do"
4107 echo " if test ! -r ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file ; then"
4108 echo " echo \"missing file ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file\" >&2"
4112 echo " m4_if(m4_sysval, [0], [],"
4113 echo " [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])"
4115 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_DIR])"
4116 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_LIST])"
4117 echo " m4_popdef([AC_LIBSOURCES])"
4118 echo " m4_popdef([AC_REPLACE_FUNCS])"
4119 echo " m4_popdef([AC_LIBOBJ])"
4120 echo " AC_CONFIG_COMMANDS_PRE(["
4121 echo " ${macro_prefix_arg}_libobjs="
4122 echo " ${macro_prefix_arg}_ltlibobjs="
4123 echo " if test -n \"\$${macro_prefix_arg}_LIBOBJS\"; then"
4124 echo " # Remove the extension."
4125 echo " sed_drop_objext='s/\\.o\$//;s/\\.obj\$//'"
4126 echo " for i in \`for i in \$${macro_prefix_arg}_LIBOBJS; do echo \"\$i\"; done | sed -e \"\$sed_drop_objext\" | sort | uniq\`; do"
4127 echo " ${macro_prefix_arg}_libobjs=\"\$${macro_prefix_arg}_libobjs \$i.\$ac_objext\""
4128 echo " ${macro_prefix_arg}_ltlibobjs=\"\$${macro_prefix_arg}_ltlibobjs \$i.lo\""
4131 echo " AC_SUBST([${macro_prefix_arg}_LIBOBJS], [\$${macro_prefix_arg}_libobjs])"
4132 echo " AC_SUBST([${macro_prefix_arg}_LTLIBOBJS], [\$${macro_prefix_arg}_ltlibobjs])"
4136 # func_emit_initmacro_done macro_prefix sourcebase
4137 # emits a few statements after the gl_INIT macro to standard output.
4138 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4139 # - sourcebase directory relative to destdir where to place source code
4140 func_emit_initmacro_done
()
4142 macro_prefix_arg
="$1"
4145 echo "# Like AC_LIBOBJ, except that the module name goes"
4146 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
4147 echo "AC_DEFUN([${macro_prefix_arg}_LIBOBJ], ["
4148 echo " AS_LITERAL_IF([\$1], [${macro_prefix_arg}_LIBSOURCES([\$1.c])])dnl"
4149 echo " ${macro_prefix_arg}_LIBOBJS=\"\$${macro_prefix_arg}_LIBOBJS \$1.\$ac_objext\""
4152 echo "# Like AC_REPLACE_FUNCS, except that the module name goes"
4153 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
4154 echo "AC_DEFUN([${macro_prefix_arg}_REPLACE_FUNCS], ["
4155 echo " m4_foreach_w([gl_NAME], [\$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl"
4156 echo " AC_CHECK_FUNCS([\$1], , [${macro_prefix_arg}_LIBOBJ(\$ac_func)])"
4159 echo "# Like AC_LIBSOURCES, except the directory where the source file is"
4160 echo "# expected is derived from the gnulib-tool parameterization,"
4161 echo "# and alloca is special cased (for the alloca-opt module)."
4162 echo "# We could also entirely rely on EXTRA_lib..._SOURCES."
4163 echo "AC_DEFUN([${macro_prefix_arg}_LIBSOURCES], ["
4164 echo " m4_foreach([_gl_NAME], [\$1], ["
4165 echo " m4_if(_gl_NAME, [alloca.c], [], ["
4166 echo " m4_define([${macro_prefix_arg}_LIBSOURCES_DIR], [$sourcebase_arg])"
4167 echo " m4_append([${macro_prefix_arg}_LIBSOURCES_LIST], _gl_NAME, [ ])"
4173 # func_emit_autoconf_snippet indentation
4174 # emits the autoconf snippet of a module.
4176 # - indentation spaces to prepend on each line
4177 # - local_gnulib_path from --local-dir
4178 # - modcache true or false, from --cache-modules/--no-cache-modules
4179 # - sed_replace_build_aux sed expression that replaces reference to build-aux
4180 # - sed_replace_include_guard_prefix
4181 # sed expression for resolving ${gl_include_guard_prefix}
4182 # - module the module name
4183 # - toplevel true or false. 'false' means a subordinate use of
4185 # - disable_libtool true or false. It tells whether to disable libtool
4186 # handling even if it has been specified through the
4187 # command line options.
4188 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
4190 func_emit_autoconf_snippet
()
4193 if { case $module in
4194 gnumakefile | maintainer-makefile
)
4195 # These modules are meant to be used only in the top-level directory.
4201 func_get_autoconf_snippet
"$module" \
4202 |
sed -e '/^$/d;' -e "s/^/$indentation/" \
4203 -e "$sed_replace_build_aux" \
4204 -e "$sed_replace_include_guard_prefix" \
4205 |
{ if $disable_libtool; then
4206 sed -e 's/\$gl_cond_libtool/false/g' \
4207 -e 's/gl_libdeps/gltests_libdeps/g' \
4208 -e 's/gl_ltlibdeps/gltests_ltlibdeps/g'
4213 |
{ if $disable_gettext; then
4214 sed -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./'
4216 # Don't indent AM_GNU_GETTEXT_VERSION line, as that confuses
4217 # autopoint through at least GNU gettext version 0.18.2.
4218 sed -e 's/^ *AM_GNU_GETTEXT_VERSION/AM_GNU_GETTEXT_VERSION/'
4221 if test "$module" = 'alloca' && test "$libtool" = true
&& ! $disable_libtool; then
4222 echo 'changequote(,)dnl'
4223 echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
4224 echo 'changequote([, ])dnl'
4225 echo 'AC_SUBST([LTALLOCA])'
4230 # func_emit_autoconf_snippets modules referenceable_modules verifier toplevel disable_libtool disable_gettext
4231 # collects and emit the autoconf snippets of a set of modules.
4233 # - local_gnulib_path from --local-dir
4234 # - modcache true or false, from --cache-modules/--no-cache-modules
4235 # - sed_replace_build_aux sed expression that replaces reference to build-aux
4236 # - sed_replace_include_guard_prefix
4237 # sed expression for resolving ${gl_include_guard_prefix}
4238 # - modules the list of modules.
4239 # - referenceable_modules the list of modules which may be referenced as dependencies.
4240 # - verifier one of func_verify_module, func_verify_nontests_module,
4241 # func_verify_tests_module. It selects the subset of
4242 # $modules to consider.
4243 # - toplevel true or false. 'false' means a subordinate use of
4245 # - disable_libtool true or false. It tells whether to disable libtool
4246 # handling even if it has been specified through the
4247 # command line options.
4248 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
4250 func_emit_autoconf_snippets
()
4252 referenceable_modules
="$2"
4255 disable_libtool
="$5"
4256 disable_gettext
="$6"
4257 if test "$cond_dependencies" = true
; then
4258 for m
in $referenceable_modules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/modules
4259 # Emit the autoconf code for the unconditional modules.
4260 for module
in $1; do
4262 if test -n "$module"; then
4263 if func_cond_module_p
"$module"; then
4266 func_emit_autoconf_snippet
" "
4270 # Initialize the shell variables indicating that the modules are enabled.
4271 for module
in $1; do
4273 if test -n "$module"; then
4274 if func_cond_module_p
"$module"; then
4275 func_module_shellvar_name
"$module"
4276 echo " $shellvar=false"
4280 # Emit the autoconf code for the conditional modules, each in a separate
4281 # function. This makes it possible to support cycles among conditional
4283 for module
in $1; do
4285 if test -n "$module"; then
4286 if func_cond_module_p
"$module"; then
4287 func_module_shellfunc_name
"$module"
4288 func_module_shellvar_name
"$module"
4289 echo " $shellfunc ()"
4291 echo " if ! \$$shellvar; then"
4292 func_emit_autoconf_snippet
" "
4293 echo " $shellvar=true"
4294 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
4295 # Intersect $deps with the modules list $1.
4296 deps
=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
4297 for dep
in $deps; do
4298 if func_cond_module_p
"$dep"; then
4299 func_module_shellfunc_name
"$dep"
4300 func_cond_module_condition
"$module" "$dep"
4301 if test "$condition" != true
; then
4302 echo " if $condition; then"
4309 # The autoconf code for $dep has already been emitted above and
4310 # therefore is already executed when this function is run.
4319 # Emit the dependencies from the unconditional to the conditional modules.
4320 for module
in $1; do
4322 if test -n "$module"; then
4323 if func_cond_module_p
"$module"; then
4326 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
4327 # Intersect $deps with the modules list $1.
4328 deps
=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
4329 for dep
in $deps; do
4330 if func_cond_module_p
"$dep"; then
4331 func_module_shellfunc_name
"$dep"
4332 func_cond_module_condition
"$module" "$dep"
4333 if test "$condition" != true
; then
4334 echo " if $condition; then"
4341 # The autoconf code for $dep has already been emitted above and
4342 # therefore is already executed when this code is run.
4349 # Define the Automake conditionals.
4350 echo " m4_pattern_allow([^${macro_prefix}_GNULIB_ENABLED_])"
4351 for module
in $1; do
4353 if test -n "$module"; then
4354 if func_cond_module_p
"$module"; then
4355 func_module_conditional_name
"$module"
4356 func_module_shellvar_name
"$module"
4357 echo " AM_CONDITIONAL([$conditional], [\$$shellvar])"
4362 # Ignore the conditions, and enable all modules unconditionally.
4363 for module
in $1; do
4365 if test -n "$module"; then
4366 func_emit_autoconf_snippet
" "
4372 # func_emit_pre_early_macros require indentation modules
4373 # The require parameter can be ':' (AC_REQUIRE) or 'false' (direct call).
4374 func_emit_pre_early_macros
()
4377 echo "${2}# Pre-early section."
4379 _pre_early_snippet
="echo \"${2}AC_REQUIRE([\$_pre_early_macro])\""
4381 _pre_early_snippet
="echo \"${2}\$_pre_early_macro\""
4384 # We need to call gl_USE_SYSTEM_EXTENSIONS before gl_PROG_AR_RANLIB. Doing
4385 # AC_REQUIRE in configure-ac.early is not early enough.
4386 _pre_early_macro
="gl_USE_SYSTEM_EXTENSIONS"
4387 case "${nl}${3}${nl}" in
4388 *${nl}extensions
${nl}*) eval "$_pre_early_snippet" ;;
4391 _pre_early_macro
="gl_PROG_AR_RANLIB"
4392 eval "$_pre_early_snippet"
4396 # func_reconstruct_cached_dir
4397 # callback for func_reconstruct_cached_local_gnulib_path
4399 # - destdir from --dir
4401 # - local_gnulib_path restored '--local-dir' path from cache
4402 func_reconstruct_cached_dir
()
4405 if test -n "$cached_dir"; then
4408 func_path_append local_gnulib_path
"$destdir/$cached_dir" ;;
4410 case "$cached_dir" in
4412 func_path_append local_gnulib_path
"$destdir/$cached_dir" ;;
4414 func_relconcat
"$destdir" "$cached_dir"
4415 func_path_append local_gnulib_path
"$relconcat" ;;
4421 # func_reconstruct_cached_local_gnulib_path
4422 # reconstruct local_gnulib_path from cached_local_gnulib_path to be set
4423 # relatively to $destdir again.
4425 # - cached_local_gnulib_path local_gnulib_path stored within gnulib-cache.m4
4426 # - destdir from --dir
4428 # - local_gnulib_path restored '--local-dir' path from cache
4429 func_reconstruct_cached_local_gnulib_path
()
4431 func_path_foreach
"$cached_local_gnulib_path" func_reconstruct_cached_dir
%dir
%
4434 # func_import modules
4435 # Uses also the variables
4436 # - mode import or add-import or remove-import or update
4437 # - destdir target directory
4438 # - local_gnulib_path from --local-dir
4439 # - modcache true or false, from --cache-modules/--no-cache-modules
4440 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
4441 # - libname library name
4442 # - supplied_libname true if --lib was given, blank otherwise
4443 # - sourcebase directory relative to destdir where to place source code
4444 # - m4base directory relative to destdir where to place *.m4 macros
4445 # - pobase directory relative to destdir where to place *.po files
4446 # - docbase directory relative to destdir where to place doc files
4447 # - testsbase directory relative to destdir where to place unit test code
4448 # - auxdir directory relative to destdir where to place build aux files
4449 # - inctests true if --with-tests was given, false otherwise
4450 # - incobsolete true if --with-obsolete was given, blank otherwise
4451 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
4452 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
4454 # - inc_privileged_tests true if --with-privileged-tests was given, blank
4456 # - inc_unportable_tests true if --with-unportable-tests was given, blank
4458 # - inc_all_tests true if --with-all-tests was given, blank otherwise
4459 # - avoidlist list of modules to avoid, from --avoid
4460 # - cond_dependencies true if --conditional-dependencies was given, false if
4461 # --no-conditional-dependencies was given, blank otherwise
4462 # - lgpl yes or a number if library's license shall be LGPL,
4464 # - makefile_name from --makefile-name
4465 # - libtool true if --libtool was given, false if --no-libtool was
4466 # given, blank otherwise
4467 # - guessed_libtool true if the configure.ac file uses libtool, false otherwise
4468 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4469 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
4470 # - witness_c_macro from --witness-c-macro
4471 # - vc_files true if --vc-files was given, false if --no-vc-files was
4472 # given, blank otherwise
4473 # - autoconf_minversion minimum supported autoconf version
4474 # - doit : if actions shall be executed, false if only to be printed
4475 # - copymode copy mode for files in general
4476 # - lcopymode copy mode for files from local_gnulib_path
4477 # - do_copyrights true if copyright notices in files should be replaced,
4481 # Get the cached settings.
4482 # In 'import' mode, we read them only for the purpose of knowing the old
4483 # installed file list, and don't use them as defaults.
4484 cached_local_gnulib_path
=
4485 cached_specified_modules
=
4487 cached_inc_cxx_tests
=
4488 cached_inc_longrunning_tests
=
4489 cached_inc_privileged_tests
=
4490 cached_inc_unportable_tests
=
4491 cached_inc_all_tests
=
4501 cached_makefile_name
=
4502 cached_cond_dependencies
=
4504 cached_macro_prefix
=
4506 cached_witness_c_macro
=
4509 if test -f "$destdir"/$m4base/gnulib-cache.
m4; then
4510 cached_libtool
=false
4516 s,^.*gl_LOCAL_DIR([[ ]*\([^]"$`\\)]*\).*$,cached_local_gnulib_path="\1",p
4526 s,^.*gl_MODULES([[ ]*\([^]"$`\\)]*\).*$,cached_specified_modules="\1",p
4528 /gl_WITH_OBSOLETE/ {
4529 s,^.*$,cached_incobsolete=true,p
4531 /gl_WITH_CXX_TESTS/ {
4532 s,^.*$,cached_inc_cxx_tests=true,p
4534 /gl_WITH_LONGRUNNING_TESTS/ {
4535 s,^.*$,cached_inc_longrunning_tests=true,p
4537 /gl_WITH_PRIVILEGED_TESTS/ {
4538 s,^.*$,cached_inc_privileged_tests=true,p
4540 /gl_WITH_UNPORTABLE_TESTS/ {
4541 s,^.*$,cached_inc_unportable_tests=true,p
4543 /gl_WITH_ALL_TESTS/ {
4544 s,^.*$,cached_inc_all_tests=true,p
4547 s,^.*gl_AVOID([[ ]*\([^]"$`\\)]*\).*$,cached_avoidlist="\1",p
4550 s,^.*gl_SOURCE_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_sourcebase="\1",p
4553 s,^.*gl_M4_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_m4base="\1",p
4556 s,^.*gl_PO_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_pobase="\1",p
4559 s,^.*gl_DOC_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_docbase="\1",p
4562 s,^.*gl_TESTS_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_testsbase="\1",p
4565 s,^.*$,cached_inctests=true,p
4568 s,^.*gl_LIB([[ ]*\([^]"$`\\)]*\).*$,cached_libname="\1",p
4571 s,^.*gl_LGPL([[ ]*\([^]"$`\\)]*\).*$,cached_lgpl="\1",p
4574 s,^.*$,cached_lgpl=yes,p
4576 /gl_MAKEFILE_NAME(/ {
4577 s,^.*gl_MAKEFILE_NAME([[ ]*\([^]"$`\\)]*\).*$,cached_makefile_name="\1",p
4579 /gl_CONDITIONAL_DEPENDENCIES/ {
4580 s,^.*$,cached_cond_dependencies=true,p
4583 s,^.*$,cached_libtool=true,p
4585 /gl_MACRO_PREFIX(/ {
4586 s,^.*gl_MACRO_PREFIX([[ ]*\([^]"$`\\)]*\).*$,cached_macro_prefix="\1",p
4589 s,^.*gl_PO_DOMAIN([[ ]*\([^]"$`\\)]*\).*$,cached_po_domain="\1",p
4591 /gl_WITNESS_C_MACRO(/ {
4592 s,^.*gl_WITNESS_C_MACRO([[ ]*\([^]"$`\\)]*\).*$,cached_witness_c_macro="\1",p
4595 s,^.*gl_VC_FILES([[ ]*\([^]"$`\\)]*\).*$,cached_vc_files="\1",p
4597 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-cache.m4`
4598 if test -f "$destdir"/$m4base/gnulib-comp.
m4; then
4603 /AC_DEFUN(\['"${cached_macro_prefix}"'_FILE_LIST\], \[/ {
4604 s,^.*$,cached_files=",p
4617 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-comp.m4`
4621 if test "$mode" = import
; then
4622 # In 'import' mode, the new set of specified modules overrides the cached
4623 # set of modules. Ignore the cached settings.
4624 specified_modules
="$1"
4626 # Merge the cached settings with the specified ones.
4627 # The m4base must be the same as expected from the pathname.
4628 if test -n "$cached_m4base" && test "$cached_m4base" != "$m4base"; then
4629 func_fatal_error
"$m4base/gnulib-cache.m4 is expected to contain gl_M4_BASE([$m4base])"
4631 # The local_gnulib_path defaults to the cached one. Recall that the cached one
4632 # is relative to $destdir, whereas the one we use is relative to . or absolute.
4633 if test -z "$local_gnulib_path"; then
4634 func_reconstruct_cached_local_gnulib_path
4638 # Append the cached and the specified module names. So that
4639 # "gnulib-tool --add-import foo" means to add the module foo.
4640 specified_modules
="$cached_specified_modules $1"
4643 # Take the cached module names, minus the specified module names.
4645 if $have_associative; then
4646 # Use an associative array, for O(N) worst-case run time.
4647 declare -A to_remove
4649 eval 'to_remove[$m]=yes'
4651 for module
in $cached_specified_modules; do
4652 if eval 'test -z "${to_remove[$module]}"'; then
4653 func_append specified_modules
"$module "
4657 # This loop has O(N**2) worst-case run time.
4658 for module
in $cached_specified_modules; do
4661 if test "$m" = "$module"; then
4666 if test -z "$to_remove"; then
4667 func_append specified_modules
"$module "
4673 # Take the cached module names. There are no specified module names.
4674 specified_modules
="$cached_specified_modules"
4677 # Included obsolete modules among the dependencies if specified either way.
4678 if test -z "$incobsolete"; then
4679 incobsolete
="$cached_incobsolete"
4681 # Included special kinds of tests modules among the dependencies if specified
4683 if test -z "$inc_cxx_tests"; then
4684 inc_cxx_tests
="$cached_inc_cxx_tests"
4686 if test -z "$inc_longrunning_tests"; then
4687 inc_longrunning_tests
="$cached_inc_longrunning_tests"
4689 if test -z "$inc_privileged_tests"; then
4690 inc_privileged_tests
="$cached_inc_privileged_tests"
4692 if test -z "$inc_unportable_tests"; then
4693 inc_unportable_tests
="$cached_inc_unportable_tests"
4695 if test -z "$inc_all_tests"; then
4696 inc_all_tests
="$cached_inc_all_tests"
4698 # Append the cached and the specified avoidlist. This is probably better
4699 # than dropping the cached one when --avoid is specified at least once.
4700 avoidlist
=`for m in $cached_avoidlist $avoidlist; do echo $m; done | LC_ALL=C sort -u`
4701 avoidlist
=`echo $avoidlist`
4703 # The sourcebase defaults to the cached one.
4704 if test -z "$sourcebase"; then
4705 sourcebase
="$cached_sourcebase"
4706 if test -z "$sourcebase"; then
4707 func_fatal_error
"missing --source-base option"
4710 # The pobase defaults to the cached one.
4711 if test -z "$pobase"; then
4712 pobase
="$cached_pobase"
4714 # The docbase defaults to the cached one.
4715 if test -z "$docbase"; then
4716 docbase
="$cached_docbase"
4717 if test -z "$docbase"; then
4718 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."
4721 # The testsbase defaults to the cached one.
4722 if test -z "$testsbase"; then
4723 testsbase
="$cached_testsbase"
4724 if test -z "$testsbase"; then
4725 func_fatal_error
"missing --tests-base option"
4728 # Require the tests if specified either way.
4729 if ! $inctests; then
4730 inctests
="$cached_inctests"
4731 if test -z "$inctests"; then
4735 # The libname defaults to the cached one.
4736 if test -z "$supplied_libname"; then
4737 libname
="$cached_libname"
4738 if test -z "$libname"; then
4739 func_fatal_error
"missing --lib option"
4742 # Require LGPL if specified either way.
4743 if test -z "$lgpl"; then
4746 # The makefile_name defaults to the cached one.
4747 if test -z "$makefile_name"; then
4748 makefile_name
="$cached_makefile_name"
4750 # Use conditional dependencies if specified either way.
4751 if test -z "$cond_dependencies"; then
4752 cond_dependencies
="$cached_cond_dependencies"
4754 # Use libtool if specified either way, or if guessed.
4755 if test -z "$libtool"; then
4756 if test -n "$cached_m4base"; then
4757 libtool
="$cached_libtool"
4759 libtool
="$guessed_libtool"
4762 # The macro_prefix defaults to the cached one.
4763 if test -z "$macro_prefix"; then
4764 macro_prefix
="$cached_macro_prefix"
4765 if test -z "$macro_prefix"; then
4766 func_fatal_error
"missing --macro-prefix option"
4769 # The po_domain defaults to the cached one.
4770 if test -z "$po_domain"; then
4771 po_domain
="$cached_po_domain"
4773 # The witness_c_macro defaults to the cached one.
4774 if test -z "$witness_c_macro"; then
4775 witness_c_macro
="$cached_witness_c_macro"
4777 # The vc_files defaults to the cached one.
4778 if test -z "$vc_files"; then
4779 vc_files
="$cached_vc_files"
4781 # Ensure constraints.
4782 if test "$cond_dependencies" = true
&& $inctests; then
4783 echo "gnulib-tool: option --conditional-dependencies is not supported with --with-tests" 1>&2
4787 # --without-*-tests options are not supported here.
4789 excl_longrunning_tests
=
4790 excl_privileged_tests
=
4791 excl_unportable_tests
=
4793 # Canonicalize the list of specified modules.
4794 specified_modules
=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
4796 # Include all kinds of tests modules if --with-all-tests was specified.
4797 inc_all_direct_tests
="$inc_all_tests"
4798 inc_all_indirect_tests
="$inc_all_tests"
4800 # Determine final module list.
4801 modules
="$specified_modules"
4802 func_modules_transitive_closure
4803 if test $verbose -ge 0; then
4804 func_show_module_list
4806 final_modules
="$modules"
4808 # Determine main module list and tests-related module list separately.
4809 func_modules_transitive_closure_separately
4811 # Determine whether a $testsbase/libtests.a is needed.
4812 func_determine_use_libtests
4814 # Add the dummy module to the main module list or to the tests-related module
4816 func_modules_add_dummy_separately
4818 # If --lgpl, verify that the licenses of modules are compatible.
4819 if test -n "$lgpl"; then
4820 license_incompatibilities
=
4821 for module
in $main_modules; do
4822 license
=`func_get_license $module`
4824 'GPLed build tool') ;;
4825 'public domain' |
'unlimited' |
'unmodifiable license text') ;;
4830 LGPLv2
+ |
'LGPLv3+ or GPLv2' | LGPLv3
+ | LGPL
) ;;
4831 *) func_append license_incompatibilities
"$module $license$nl" ;;
4836 LGPLv2
+ |
'LGPLv3+ or GPLv2') ;;
4837 *) func_append license_incompatibilities
"$module $license$nl" ;;
4843 *) func_append license_incompatibilities
"$module $license$nl" ;;
4846 *) func_fatal_error
"invalid value lgpl=$lgpl" ;;
4851 if test -n "$license_incompatibilities"; then
4852 # Format the license incompatibilities as a table.
4853 sed_expand_column1_width50_indent17
='s,^\([^ ]*\) ,\1 ,
4854 s,^\(.................................................[^ ]*\) *, \1 ,'
4855 license_incompatibilities
=`echo "$license_incompatibilities" | sed -e "$sed_expand_column1_width50_indent17"`
4856 func_fatal_error
"incompatible license on modules:$nl$license_incompatibilities"
4860 # Show banner notice of every module.
4861 modules
="$main_modules"
4864 # Determine script to apply to imported library files.
4865 sed_transform_lib_file
=
4866 for module
in $main_modules; do
4867 if test $module = config-h
; then
4868 # Assume config.h exists, and that -DHAVE_CONFIG_H is omitted.
4869 sed_transform_lib_file
=$sed_transform_lib_file'
4870 s/^#ifdef[ ]*HAVE_CONFIG_H[ ]*$/#if 1/
4875 sed_transform_main_lib_file
="$sed_transform_lib_file"
4876 if test -n "$do_copyrights"; then
4877 if test -n "$lgpl"; then
4881 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
4882 s/GNU General/GNU Lesser General/g
4883 s/General Public License/Lesser General Public License/g
4884 s/Lesser Lesser General Public License/Lesser General Public License/g
4888 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
4889 /^ *This program is free software/i\
4890 This program is free software: you can redistribute it and\/or\
4891 modify it under the terms of either:\
4893 * the GNU Lesser General Public License as published by the Free\
4894 Software Foundation; either version 3 of the License, or (at your\
4895 option) any later version.\
4899 * the GNU General Public License as published by the Free\
4900 Software Foundation; either version 2 of the License, or (at your\
4901 option) any later version.\
4903 or both in parallel, as here.
4904 /^ *This program is free software/,/^$/d
4908 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
4909 s/GNU General/GNU Lesser General/g
4910 s/General Public License/Lesser General Public License/g
4911 s/Lesser Lesser General Public License/Lesser General Public License/g
4913 s/version [23]\([ ,]\)/version 2.1\1/g
4916 *) func_fatal_error
"invalid value lgpl=$lgpl" ;;
4920 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
4921 s/GNU Lesser General/GNU General/g
4922 s/Lesser General Public License/General Public License/g
4924 s/GNU Library General/GNU General/g
4925 s/Library General Public License/General Public License/g
4927 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
4932 # Determine script to apply to auxiliary files that go into $auxdir/.
4933 sed_transform_build_aux_file
=
4934 if test -n "$do_copyrights"; then
4936 sed_transform_build_aux_file
=$sed_transform_build_aux_file'
4937 s/GNU Lesser General/GNU General/g
4938 s/Lesser General Public License/General Public License/g
4940 s/GNU Library General/GNU General/g
4941 s/Library General Public License/General Public License/g
4943 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
4947 # Determine script to apply to library files that go into $testsbase/.
4948 sed_transform_testsrelated_lib_file
="$sed_transform_lib_file"
4949 if test -n "$do_copyrights"; then
4951 sed_transform_testsrelated_lib_file
=$sed_transform_testsrelated_lib_file'
4952 s/GNU Lesser General/GNU General/g
4953 s/Lesser General Public License/General Public License/g
4955 s/GNU Library General/GNU General/g
4956 s/Library General Public License/General Public License/g
4958 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
4962 # Determine the final file lists.
4963 func_modules_to_filelist_separately
4966 || func_fatal_error
"refusing to do nothing"
4968 # Add m4/gnulib-tool.m4 to the file list. It is not part of any module.
4969 new_files
="$files m4/gnulib-tool.m4"
4970 old_files
="$cached_files"
4971 if test -f "$destdir"/$m4base/gnulib-tool.
m4; then
4972 func_append old_files
" m4/gnulib-tool.m4"
4975 rewritten
='%REWRITTEN%'
4976 sed_rewrite_old_files
="\
4977 s,^build-aux/,$rewritten$auxdir/,
4978 s,^doc/,$rewritten$cached_docbase/,
4979 s,^lib/,$rewritten$cached_sourcebase/,
4980 s,^m4/,$rewritten$cached_m4base/,
4981 s,^tests/,$rewritten$cached_testsbase/,
4982 s,^tests=lib/,$rewritten$cached_testsbase/,
4985 sed_rewrite_new_files
="\
4986 s,^build-aux/,$rewritten$auxdir/,
4987 s,^doc/,$rewritten$docbase/,
4988 s,^lib/,$rewritten$sourcebase/,
4989 s,^m4/,$rewritten$m4base/,
4990 s,^tests/,$rewritten$testsbase/,
4991 s,^tests=lib/,$rewritten$testsbase/,
4995 # Create directories.
4996 { echo "$sourcebase"
4998 if test -n "$pobase"; then
5001 docfiles
=`echo "$files" | sed -n -e 's,^doc/,,p'`
5002 if test -n "$docfiles"; then
5009 for f
in $files; do echo $f; done \
5010 |
sed -e "$sed_rewrite_new_files" \
5011 |
sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
5014 { # Rearrange file descriptors. Needed because "while ... done < ..."
5015 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5016 exec 5<&0 < "$tmp"/dirs
5018 if test ! -d "$destdir/$d"; then
5020 echo "Creating directory $destdir/$d"
5021 mkdir
-p "$destdir/$d" || func_fatal_error
"failed"
5023 echo "Create directory $destdir/$d"
5030 # Copy files or make symbolic links or hard links. Remove obsolete files.
5034 # Construct a table with 2 columns: rewritten-file-name original-file-name,
5035 # representing the files according to the last gnulib-tool invocation.
5036 for f
in $old_files; do echo $f; done \
5037 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_old_files" \
5040 # Construct a table with 2 columns: rewritten-file-name original-file-name,
5041 # representing the files after this gnulib-tool invocation.
5042 for f
in $new_files; do echo $f; done \
5043 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" \
5046 # First the files that are in old-files, but not in new-files:
5047 sed_take_first_column
='s,'"$delimiter"'.*,,'
5048 for g
in `LC_ALL=C join -t"$delimiter" -v1 "$tmp"/old-files "$tmp"/new-files | sed -e "$sed_take_first_column"`; do
5049 # Remove the file. Do nothing if the user already removed it.
5050 if test -f "$destdir/$g" ||
test -h "$destdir/$g"; then
5052 echo "Removing file $g (backup in ${g}~)"
5053 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error
"failed"
5055 echo "Remove file $g (backup in ${g}~)"
5057 func_append removed_files
"$g$nl"
5060 # func_add_or_update handles a file that ought to be present afterwards.
5062 # - f the original file name
5063 # - g the rewritten file name
5064 # - already_present nonempty if the file should already exist, empty
5066 func_add_or_update
()
5070 tests
=lib
/*) f
=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
5072 func_dest_tmpfilename
"$g"
5073 func_lookup_file
"$f"
5074 cp "$lookedup_file" "$tmpfile" || func_fatal_error
"failed"
5077 # Don't process binary files with sed.
5080 if test -n "$sed_transform_main_lib_file"; then
5083 sed -e "$sed_transform_main_lib_file" \
5084 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
5088 if test -n "$sed_transform_build_aux_file"; then
5091 sed -e "$sed_transform_build_aux_file" \
5092 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
5096 if test -n "$sed_transform_testsrelated_lib_file"; then
5099 sed -e "$sed_transform_testsrelated_lib_file" \
5100 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
5106 if test -f "$destdir/$g"; then
5107 # The file already exists.
5111 # Don't protest if the file should be there but isn't: it happens
5112 # frequently that developers don't put autogenerated files under version control.
5114 func_append added_files
"$g$nl"
5118 # Then the files that are in new-files, but not in old-files:
5119 sed_take_last_column
='s,^.*'"$delimiter"',,'
5121 LC_ALL
=C
join -t"$delimiter" -v2 "$tmp"/old-files
"$tmp"/new-files \
5122 |
sed -e "$sed_take_last_column" \
5123 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/added-files
5124 { # Rearrange file descriptors. Needed because "while ... done < ..."
5125 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5126 exec 5<&0 < "$tmp"/added-files
5132 # Then the files that are in new-files and in old-files:
5133 already_present
=true
5134 LC_ALL
=C
join -t"$delimiter" "$tmp"/old-files
"$tmp"/new-files \
5135 |
sed -e "$sed_take_last_column" \
5136 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/kept-files
5137 { # Rearrange file descriptors. Needed because "while ... done < ..."
5138 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5139 exec 5<&0 < "$tmp"/kept-files
5146 # Command-line invocation printed in a comment in generated gnulib-cache.m4.
5147 actioncmd
="gnulib-tool --import"
5150 func_append_local_dir
()
5152 func_append
"$1" " --local-dir=$2"
5154 func_path_foreach
"$local_gnulib_path" func_append_local_dir actioncmd
%dir
%
5156 func_append actioncmd
" --lib=$libname"
5157 func_append actioncmd
" --source-base=$sourcebase"
5158 func_append actioncmd
" --m4-base=$m4base"
5159 if test -n "$pobase"; then
5160 func_append actioncmd
" --po-base=$pobase"
5162 func_append actioncmd
" --doc-base=$docbase"
5163 func_append actioncmd
" --tests-base=$testsbase"
5164 func_append actioncmd
" --aux-dir=$auxdir"
5166 func_append actioncmd
" --with-tests"
5168 if test -n "$incobsolete"; then
5169 func_append actioncmd
" --with-obsolete"
5171 if test -n "$inc_cxx_tests"; then
5172 func_append actioncmd
" --with-c++-tests"
5174 if test -n "$inc_longrunning_tests"; then
5175 func_append actioncmd
" --with-longrunning-tests"
5177 if test -n "$inc_privileged_tests"; then
5178 func_append actioncmd
" --with-privileged-tests"
5180 if test -n "$inc_unportable_tests"; then
5181 func_append actioncmd
" --with-unportable-tests"
5183 if test -n "$inc_all_tests"; then
5184 func_append actioncmd
" --with-all-tests"
5186 for module
in $avoidlist; do
5187 func_append actioncmd
" --avoid=$module"
5189 if test -n "$lgpl"; then
5190 if test "$lgpl" = yes; then
5191 func_append actioncmd
" --lgpl"
5193 func_append actioncmd
" --lgpl=$lgpl"
5197 func_append actioncmd
" --gnu-make"
5199 if test -n "$makefile_name"; then
5200 func_append actioncmd
" --makefile-name=$makefile_name"
5202 if test "$cond_dependencies" = true
; then
5203 func_append actioncmd
" --conditional-dependencies"
5205 func_append actioncmd
" --no-conditional-dependencies"
5207 if test "$libtool" = true
; then
5208 func_append actioncmd
" --libtool"
5210 func_append actioncmd
" --no-libtool"
5212 func_append actioncmd
" --macro-prefix=$macro_prefix"
5213 if test -n "$po_domain"; then
5214 func_append actioncmd
" --po-domain=$po_domain"
5216 if test -n "$witness_c_macro"; then
5217 func_append actioncmd
" --witness-c-macro=$witness_c_macro"
5219 if test -n "$vc_files"; then
5220 if test "$vc_files" = true
; then
5221 func_append actioncmd
" --vc-files"
5223 func_append actioncmd
" --no-vc-files"
5226 func_append actioncmd
" `echo $specified_modules`"
5228 # Determine include_guard_prefix.
5229 func_compute_include_guard_prefix
5231 # Default the makefile name to Makefile.am.
5232 if test -n "$makefile_name"; then
5233 makefile_am
=$makefile_name
5235 makefile_am
=Makefile.am
5238 # Create normal Makefile.ams.
5241 # Setup list of Makefile.am edits that are to be performed afterwards.
5242 # Some of these edits apply to files that we will generate; others are
5243 # under the responsibility of the developer.
5245 # func_note_Makefile_am_edit dir var value
5246 # remembers that ${dir}Makefile.am needs to be edited to that ${var} mentions
5248 func_note_Makefile_am_edit
()
5250 makefile_am_edits
=`expr $makefile_am_edits + 1`
5251 eval makefile_am_edit
${makefile_am_edits}_dir
=\"\
$1\"
5252 eval makefile_am_edit
${makefile_am_edits}_var
=\"\
$2\"
5253 eval makefile_am_edit
${makefile_am_edits}_val
=\"\
$3\"
5255 if test "$makefile_am" = Makefile.am
; then
5256 sourcebase_dir
=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'`
5257 sourcebase_base
=`basename "$sourcebase"`
5258 func_note_Makefile_am_edit
"$sourcebase_dir" SUBDIRS
"$sourcebase_base"
5260 if test -n "$pobase"; then
5261 pobase_dir
=`echo "$pobase" | sed -n -e 's,/[^/]*$,/,p'`
5262 pobase_base
=`basename "$pobase"`
5263 func_note_Makefile_am_edit
"$pobase_dir" SUBDIRS
"$pobase_base"
5266 if test "$makefile_am" = Makefile.am
; then
5267 testsbase_dir
=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'`
5268 testsbase_base
=`basename "$testsbase"`
5269 func_note_Makefile_am_edit
"$testsbase_dir" SUBDIRS
"$testsbase_base"
5272 func_note_Makefile_am_edit
"" ACLOCAL_AMFLAGS
"-I ${m4base}"
5274 # Find the first parent directory of $m4base that contains or will contain
5276 sed_last
='s,^.*/\([^/][^/]*\)//*$,\1/,
5278 sed_butlast
='s,[^/][^/]*//*$,,'
5279 dir1
="${m4base}/"; dir2
=""
5280 while test -n "$dir1" \
5281 && ! { test -f "${destdir}/${dir1}Makefile.am" \
5282 ||
test "${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
5283 ||
test "./${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
5285 && { test "${dir1}Makefile.am" = "$testsbase/$makefile_am" \
5286 ||
test "./${dir1}Makefile.am" = "$testsbase/$makefile_am"; }; }; }; do
5287 dir2
=`echo "$dir1" | sed -e "$sed_last"`"$dir2"
5288 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
5290 func_note_Makefile_am_edit
"$dir1" EXTRA_DIST
"${dir2}gnulib-cache.m4"
5293 # Create library makefile.
5294 func_dest_tmpfilename
$sourcebase/$makefile_am
5295 destfile
="$sourcebase/$makefile_am"
5296 modules
="$main_modules"
5297 func_emit_lib_Makefile_am
> "$tmpfile"
5298 if test -f "$destdir"/$sourcebase/$makefile_am; then
5299 if cmp -s "$destdir"/$sourcebase/$makefile_am "$tmpfile"; then
5303 echo "Updating $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
5304 mv -f "$destdir"/$sourcebase/$makefile_am "$destdir"/$sourcebase/$makefile_am~
5305 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
5307 echo "Update $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
5313 echo "Creating $sourcebase/$makefile_am"
5314 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
5316 echo "Create $sourcebase/$makefile_am"
5319 func_append added_files
"$sourcebase/$makefile_am$nl"
5322 # Create po/ directory.
5323 if test -n "$pobase"; then
5324 # Create po makefile and auxiliary files.
5325 for file in Makefile.
in.
in remove-potcdate.sin
; do
5326 func_dest_tmpfilename
$pobase/$file
5327 func_lookup_file build-aux
/po
/$file
5328 cat "$lookedup_file" > "$tmpfile"
5329 if test -f "$destdir"/$pobase/$file; then
5330 if cmp -s "$destdir"/$pobase/$file "$tmpfile"; then
5334 echo "Updating $pobase/$file (backup in $pobase/$file~)"
5335 mv -f "$destdir"/$pobase/$file "$destdir"/$pobase/$file~
5336 mv -f "$tmpfile" "$destdir"/$pobase/$file
5338 echo "Update $pobase/$file (backup in $pobase/$file~)"
5344 echo "Creating $pobase/$file"
5345 mv -f "$tmpfile" "$destdir"/$pobase/$file
5347 echo "Create $pobase/$file"
5350 func_append added_files
"$pobase/$file$nl"
5353 # Create po makefile parameterization, part 1.
5354 func_dest_tmpfilename
$pobase/Makevars
5355 func_emit_po_Makevars
> "$tmpfile"
5356 if test -f "$destdir"/$pobase/Makevars
; then
5357 if cmp -s "$destdir"/$pobase/Makevars
"$tmpfile"; then
5361 echo "Updating $pobase/Makevars (backup in $pobase/Makevars~)"
5362 mv -f "$destdir"/$pobase/Makevars
"$destdir"/$pobase/Makevars~
5363 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
5365 echo "Update $pobase/Makevars (backup in $pobase/Makevars~)"
5371 echo "Creating $pobase/Makevars"
5372 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
5374 echo "Create $pobase/Makevars"
5377 func_append added_files
"$pobase/Makevars$nl"
5379 # Create po makefile parameterization, part 2.
5380 func_dest_tmpfilename
$pobase/POTFILES.
in
5381 func_emit_po_POTFILES_in
> "$tmpfile"
5382 if test -f "$destdir"/$pobase/POTFILES.
in; then
5383 if cmp -s "$destdir"/$pobase/POTFILES.
in "$tmpfile"; then
5387 echo "Updating $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
5388 mv -f "$destdir"/$pobase/POTFILES.
in "$destdir"/$pobase/POTFILES.
in~
5389 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.
in
5391 echo "Update $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
5397 echo "Creating $pobase/POTFILES.in"
5398 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.
in
5400 echo "Create $pobase/POTFILES.in"
5403 func_append added_files
"$pobase/POTFILES.in$nl"
5406 TP_URL
="https://translationproject.org/latest/"
5407 TP_RSYNC_URI
="translationproject.org::tp/latest/"
5409 echo "Fetching gnulib PO files from $TP_URL"
5410 (cd "$destdir"/$pobase \
5411 && { # Prefer rsync over wget if it is available, since it consumes
5412 # less network bandwidth, due to compression.
5413 if type rsync
2>/dev
/null |
grep / > /dev
/null
; then
5414 rsync
--delete --exclude "*.s1" -Lrtz "${TP_RSYNC_URI}gnulib/" .
&& return
5417 wget
--no-verbose --mirror -nd -np -A.po
-P .
"${TP_URL}gnulib/"
5421 echo "Fetch gnulib PO files from $TP_URL"
5423 # Create po/LINGUAS.
5425 func_dest_tmpfilename
$pobase/LINGUAS
5426 (cd "$destdir"/$pobase \
5427 && { echo '# Set of available languages.'
5428 LC_ALL
=C
ls -1 *.po |
sed -e 's,\.po$,,'
5431 if test -f "$destdir"/$pobase/LINGUAS
; then
5432 if cmp -s "$destdir"/$pobase/LINGUAS
"$tmpfile"; then
5435 echo "Updating $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
5436 mv -f "$destdir"/$pobase/LINGUAS
"$destdir"/$pobase/LINGUAS~
5437 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
5440 echo "Creating $pobase/LINGUAS"
5441 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
5442 func_append added_files
"$pobase/LINGUAS$nl"
5445 if test -f "$destdir"/$pobase/LINGUAS
; then
5446 echo "Update $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
5448 echo "Create $pobase/LINGUAS"
5453 # func_count_relative_local_gnulib_path
5454 # gl_LOCAL_DIR requires local_gnulib_path to be set relatively to destdir
5456 # - local_gnulib_path from --local-dir
5457 # - destdir from --dir
5459 # - relative_local_dir path to be stored into gl_LOCAL_DIR
5460 func_count_relative_local_gnulib_path
()
5464 relative_local_gnulib_path
=
5465 for local_dir
in $local_gnulib_path
5467 # Store the local_dir relative to destdir.
5468 case "$local_dir" in
5470 relative_local_dir
="$local_dir" ;;
5473 /*) relative_local_dir
="$local_dir" ;;
5475 # destdir, local_dir are both relative.
5476 func_relativize
"$destdir" "$local_dir"
5477 relative_local_dir
="$reldir" ;;
5480 func_path_append relative_local_gnulib_path
"$relative_local_dir"
5485 # Create m4/gnulib-cache.m4.
5486 func_dest_tmpfilename
$m4base/gnulib-cache.
m4
5488 func_emit_copyright_notice
5490 echo "# This file represents the specification of how gnulib-tool is used."
5491 echo "# It acts as a cache: It is written and read by gnulib-tool."
5492 echo "# In projects that use version control, this file is meant to be put under"
5493 echo "# version control, like the configure.ac and various Makefile.am files."
5496 echo "# Specification in the form of a command-line invocation:"
5499 echo "# Specification in the form of a few gnulib-tool.m4 macro invocations:"
5500 func_count_relative_local_gnulib_path
5501 echo "gl_LOCAL_DIR([$relative_local_gnulib_path])"
5503 echo "$specified_modules" |
sed -e 's/^/ /g'
5505 test -z "$incobsolete" ||
echo "gl_WITH_OBSOLETE"
5506 test -z "$inc_cxx_tests" ||
echo "gl_WITH_CXX_TESTS"
5507 test -z "$inc_longrunning_tests" ||
echo "gl_WITH_LONGRUNNING_TESTS"
5508 test -z "$inc_privileged_tests" ||
echo "gl_WITH_PRIVILEGED_TESTS"
5509 test -z "$inc_unportable_tests" ||
echo "gl_WITH_UNPORTABLE_TESTS"
5510 test -z "$inc_all_tests" ||
echo "gl_WITH_ALL_TESTS"
5511 echo "gl_AVOID([$avoidlist])"
5512 echo "gl_SOURCE_BASE([$sourcebase])"
5513 echo "gl_M4_BASE([$m4base])"
5514 echo "gl_PO_BASE([$pobase])"
5515 echo "gl_DOC_BASE([$docbase])"
5516 echo "gl_TESTS_BASE([$testsbase])"
5518 echo "gl_WITH_TESTS"
5520 echo "gl_LIB([$libname])"
5521 if test -n "$lgpl"; then
5522 if test "$lgpl" = yes; then
5525 echo "gl_LGPL([$lgpl])"
5528 echo "gl_MAKEFILE_NAME([$makefile_name])"
5529 if test "$cond_dependencies" = true
; then
5530 echo "gl_CONDITIONAL_DEPENDENCIES"
5532 if test "$libtool" = true
; then
5535 echo "gl_MACRO_PREFIX([$macro_prefix])"
5536 echo "gl_PO_DOMAIN([$po_domain])"
5537 echo "gl_WITNESS_C_MACRO([$witness_c_macro])"
5538 if test -n "$vc_files"; then
5539 echo "gl_VC_FILES([$vc_files])"
5542 if test -f "$destdir"/$m4base/gnulib-cache.
m4; then
5543 if cmp -s "$destdir"/$m4base/gnulib-cache.
m4 "$tmpfile"; then
5547 echo "Updating $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
5548 mv -f "$destdir"/$m4base/gnulib-cache.
m4 "$destdir"/$m4base/gnulib-cache.
m4~
5549 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.
m4
5551 echo "Update $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
5555 echo "# gnulib-cache.m4 ends here"
5562 echo "Creating $m4base/gnulib-cache.m4"
5563 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.
m4
5565 echo "Create $m4base/gnulib-cache.m4"
5571 # Create m4/gnulib-comp.m4.
5572 func_dest_tmpfilename
$m4base/gnulib-comp.
m4
5574 echo "# DO NOT EDIT! GENERATED AUTOMATICALLY!"
5575 func_emit_copyright_notice
5577 echo "# This file represents the compiled summary of the specification in"
5578 echo "# gnulib-cache.m4. It lists the computed macro invocations that need"
5579 echo "# to be invoked from configure.ac."
5580 echo "# In projects that use version control, this file can be treated like"
5581 echo "# other built files."
5584 echo "# This macro should be invoked from $configure_ac, in the section"
5585 echo "# \"Checks for programs\", right after AC_PROG_CC, and certainly before"
5586 echo "# any checks for libraries, header files, types and library functions."
5587 echo "AC_DEFUN([${macro_prefix}_EARLY],"
5589 echo " m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
5590 echo " m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
5591 echo " m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
5592 echo " m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
5594 func_emit_pre_early_macros
: ' ' "$final_modules"
5596 if ! $gnu_make && test -n "$uses_subdirs"; then
5597 echo " AC_REQUIRE([AM_PROG_CC_C_O])"
5599 for module
in $final_modules; do
5601 if test -n "$module"; then
5602 echo "# Code from module $module:"
5603 func_get_autoconf_early_snippet
"$module"
5606 |
sed -e '/^$/d;' -e 's/^/ /'
5609 echo "# This macro should be invoked from $configure_ac, in the section"
5610 echo "# \"Check for header files, types and library functions\"."
5611 echo "AC_DEFUN([${macro_prefix}_INIT],"
5613 if test "$libtool" = true
; then
5614 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
5615 echo " gl_cond_libtool=true"
5617 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
5618 echo " gl_cond_libtool=false"
5620 echo " gl_ltlibdeps="
5622 if test "$auxdir" != "build-aux"; then
5623 sed_replace_build_aux
='
5625 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
5626 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
5630 sed_replace_build_aux
="$sed_noop"
5632 echo " gl_m4_base='$m4base'"
5633 func_emit_initmacro_start
$macro_prefix
5634 echo " gl_source_base='$sourcebase'"
5635 if test -n "$witness_c_macro"; then
5636 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$witness_c_macro])"
5638 func_emit_autoconf_snippets
"$main_modules" "$main_modules" func_verify_module true false true
5639 if test -n "$witness_c_macro"; then
5640 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
5642 echo " # End of code from modules"
5643 func_emit_initmacro_end
$macro_prefix
5644 echo " gltests_libdeps="
5645 echo " gltests_ltlibdeps="
5646 func_emit_initmacro_start
${macro_prefix}tests
5647 echo " gl_source_base='$testsbase'"
5648 # Define a tests witness macro that depends on the package.
5649 # PACKAGE is defined by AM_INIT_AUTOMAKE, PACKAGE_TARNAME is defined by AC_INIT.
5650 # See <https://lists.gnu.org/r/automake/2009-05/msg00145.html>.
5651 echo "changequote(,)dnl"
5652 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"
5653 echo "changequote([, ])dnl"
5654 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
5655 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
5656 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
5657 func_emit_autoconf_snippets
"$testsrelated_modules" "$main_modules $testsrelated_modules" func_verify_module true true true
5658 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
5659 func_emit_initmacro_end
${macro_prefix}tests
5660 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
5661 # created using libtool, because libtool already handles the dependencies.
5662 if test "$libtool" != true
; then
5663 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
5664 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
5665 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
5666 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
5667 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
5669 if $use_libtests; then
5670 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
5671 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
5674 func_emit_initmacro_done
$macro_prefix $sourcebase
5675 func_emit_initmacro_done
${macro_prefix}tests
$testsbase
5677 echo "# This macro records the list of files which have been installed by"
5678 echo "# gnulib-tool and may be removed by future gnulib-tool invocations."
5679 echo "AC_DEFUN([${macro_prefix}_FILE_LIST], ["
5680 echo "$files" |
sed -e 's,^, ,'
5683 if test -f "$destdir"/$m4base/gnulib-comp.
m4; then
5684 if cmp -s "$destdir"/$m4base/gnulib-comp.
m4 "$tmpfile"; then
5688 echo "Updating $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
5689 mv -f "$destdir"/$m4base/gnulib-comp.
m4 "$destdir"/$m4base/gnulib-comp.
m4~
5690 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.
m4
5692 echo "Update $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
5696 echo "# gnulib-comp.m4 ends here"
5703 echo "Creating $m4base/gnulib-comp.m4"
5704 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.
m4
5706 echo "Create $m4base/gnulib-comp.m4"
5713 # Create tests makefile.
5714 func_dest_tmpfilename
$testsbase/$makefile_am
5715 destfile
="$testsbase/$makefile_am"
5716 modules
="$testsrelated_modules"
5717 func_emit_tests_Makefile_am
"${macro_prefix}tests_WITNESS" > "$tmpfile"
5718 if test -f "$destdir"/$testsbase/$makefile_am; then
5719 if cmp -s "$destdir"/$testsbase/$makefile_am "$tmpfile"; then
5723 echo "Updating $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
5724 mv -f "$destdir"/$testsbase/$makefile_am "$destdir"/$testsbase/$makefile_am~
5725 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
5727 echo "Update $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
5733 echo "Creating $testsbase/$makefile_am"
5734 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
5736 echo "Create $testsbase/$makefile_am"
5739 func_append added_files
"$testsbase/$makefile_am$nl"
5743 if test "$vc_files" != false
; then
5744 # Update the .cvsignore and .gitignore files.
5745 { echo "$added_files" |
sed -e '/^$/d' -e 's,\([^/]*\)$,|A|\1,'
5746 echo "$removed_files" |
sed -e '/^$/d' -e 's,\([^/]*\)$,|R|\1,'
5747 # Treat gnulib-comp.m4 like an added file, even if it already existed.
5748 echo "$m4base/|A|gnulib-comp.m4"
5749 } | LC_ALL
=C
sort -t'|' -k1,1 > "$tmp"/fileset-changes
5750 { # Rearrange file descriptors. Needed because "while ... done < ..."
5751 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5752 exec 5<&0 < "$tmp"/fileset-changes
5753 func_update_ignorelist
()
5756 if test "$ignore" = .gitignore
; then
5757 # In a .gitignore file, "foo" applies to the current directory and all
5758 # subdirectories, whereas "/foo" applies to the current directory only.
5761 doubly_escaped_anchor
='\\/'
5765 doubly_escaped_anchor
=''
5767 if test -f "$destdir/$dir$ignore"; then
5768 if test -n "$dir_added" ||
test -n "$dir_removed"; then
5769 sed -e "s|^$anchor||" < "$destdir/$dir$ignore" | LC_ALL
=C
sort > "$tmp"/ignore
5770 (echo "$dir_added" |
sed -e '/^$/d' | LC_ALL
=C
sort -u \
5771 | LC_ALL
=C
join -v 1 - "$tmp"/ignore
> "$tmp"/ignore-added
5772 echo "$dir_removed" |
sed -e '/^$/d' | LC_ALL
=C
sort -u \
5773 > "$tmp"/ignore-removed
5775 if test -s "$tmp"/ignore-added ||
test -s "$tmp"/ignore-removed
; then
5777 echo "Updating $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
5778 mv -f "$destdir/$dir$ignore" "$destdir/$dir$ignore"~
5779 { sed -e 's,/,\\/,g' -e 's,^,/^,' -e 's,$,\$/d,' < "$tmp"/ignore-removed
5780 if test -n "$anchor"; then sed -e 's,/,\\/,g' -e "s,^,/^${doubly_escaped_anchor}," -e 's,$,$/d,' < "$tmp"/ignore-removed
; fi
5781 } > "$tmp"/sed-ignore-removed
5782 { cat "$destdir/$dir$ignore"~
5783 sed -e "s|^|$anchor|" < "$tmp"/ignore-added
5784 } |
sed -f "$tmp"/sed-ignore-removed \
5785 > "$destdir/$dir$ignore"
5787 echo "Update $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
5792 if test -n "$dir_added"; then
5794 echo "Creating $destdir/$dir$ignore"
5796 if test "$ignore" = .cvsignore
; then
5798 # Automake generates Makefile rules that create .dirstamp files.
5801 echo "$dir_added" |
sed -e '/^$/d' -e "s|^|$anchor|" | LC_ALL
=C
sort -u
5802 } > "$destdir/$dir$ignore"
5804 echo "Create $destdir/$dir$ignore"
5814 if test -d "$destdir/CVS" ||
test -d "$destdir/${dir}CVS" ||
test -f "$destdir/${dir}.cvsignore"; then
5815 func_update_ignorelist .cvsignore
5817 if test -d "$destdir/.git" ||
test -f "$destdir/${dir}.gitignore"; then
5818 func_update_ignorelist .gitignore
5825 # Why not ''read next_dir op file'' ? Because the dir column can be empty.
5826 next_dir
=`echo "$line" | sed -e 's,|.*,,'`
5827 op
=`echo "$line" | sed -e 's,^[^|]*|\([^|]*\)|.*$,\1,'`
5828 file=`echo "$line" | sed -e 's,^[^|]*|[^|]*|,,'`
5829 if test "$next_dir" != "$last_dir"; then
5830 func_done_dir
"$last_dir" "$last_dir_added" "$last_dir_removed"
5831 last_dir
="$next_dir"
5836 A
) func_append last_dir_added
"$file$nl";;
5837 R
) func_append last_dir_removed
"$file$nl";;
5840 func_done_dir
"$last_dir" "$last_dir_added" "$last_dir_removed"
5847 echo "You may need to add #include directives for the following .h files."
5848 # Intersect $specified_modules and $main_modules
5849 # (since $specified_modules is not necessarily of subset of $main_modules
5850 # - some may have been skipped through --avoid, and since the elements of
5851 # $main_modules but not in $specified_modules can go away without explicit
5852 # notice - through changes in the module dependencies).
5853 echo "$specified_modules" > "$tmp"/modules1
# a sorted list, one module per line
5854 echo "$main_modules" > "$tmp"/modules2
# also a sorted list, one module per line
5855 # First the #include <...> directives without #ifs, sorted for convenience,
5856 # then the #include "..." directives without #ifs, sorted for convenience,
5857 # then the #include directives that are surrounded by #ifs. Not sorted.
5858 for module
in `LC_ALL=C join "$tmp"/modules1 "$tmp"/modules2`; do
5859 include_directive
=`func_get_include_directive "$module"`
5860 case "$nl$include_directive" in
5862 echo "$include_directive" 1>&5
5865 echo "$include_directive" |
grep -v 'include "' 1>&6
5866 echo "$include_directive" |
grep 'include "' 1>&7
5869 done 5> "$tmp"/include-if
6> "$tmp"/include-angles
7> "$tmp"/include-quotes
5871 LC_ALL
=C
sort -u "$tmp"/include-angles
5872 LC_ALL
=C
sort -u "$tmp"/include-quotes
5873 cat "$tmp"/include-if
5874 ) |
sed -e '/^$/d' -e 's/^/ /'
5875 rm -f "$tmp"/include-angles
"$tmp"/include-quotes
"$tmp"/include-if
5877 for module
in $main_modules; do
5878 func_get_link_directive
"$module"
5880 | LC_ALL
=C
sort -u |
sed -e '/^$/d' -e 's/^/ /' > "$tmp"/link
5881 if test `wc -l < "$tmp"/link` != 0; then
5883 echo "You may need to use the following Makefile variables when linking."
5884 echo "Use them in <program>_LDADD when linking a program, or"
5885 echo "in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library."
5891 echo "Don't forget to"
5892 if test "$makefile_am" = Makefile.am
; then
5893 echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
5895 echo " - \"include $makefile_name\" from within \"$sourcebase/Makefile.am\","
5897 if test -n "$pobase"; then
5898 echo " - add \"$pobase/Makefile.in\" to AC_CONFIG_FILES in $configure_ac,"
5901 if test "$makefile_am" = Makefile.am
; then
5902 echo " - add \"$testsbase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
5904 echo " - \"include $makefile_name\" from within \"$testsbase/Makefile.am\","
5908 while test $edit != $makefile_am_edits; do
5909 edit
=`expr $edit + 1`
5910 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
5911 eval var
=\"\
$makefile_am_edit${edit}_var
\"
5912 eval val
=\"\
$makefile_am_edit${edit}_val
\"
5913 if test -n "$var"; then
5914 echo " - mention \"${val}\" in ${var} in ${dir}Makefile.am,"
5917 if grep '^ *AC_PROG_CC_STDC' "$configure_ac" > /dev
/null
; then
5918 position_early_after
=AC_PROG_CC_STDC
5920 if grep '^ *AC_PROG_CC_C99' "$configure_ac" > /dev
/null
; then
5921 position_early_after
=AC_PROG_CC_C99
5923 position_early_after
=AC_PROG_CC
5926 echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after $position_early_after,"
5927 echo " - invoke ${macro_prefix}_INIT in $configure_ac."
5930 # func_create_testdir testdir modules
5932 # - local_gnulib_path from --local-dir
5933 # - modcache true or false, from --cache-modules/--no-cache-modules
5934 # - auxdir directory relative to destdir where to place build aux files
5935 # - inctests true if tests should be included, false otherwise
5936 # - incobsolete true if obsolete modules among dependencies should be
5937 # included, blank otherwise
5938 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
5940 # - excl_longrunning_tests true if long-runnings tests should be excluded,
5942 # - excl_privileged_tests true if tests that require root privileges should be
5943 # excluded, blank otherwise
5944 # - excl_unportable_tests true if tests that fail on some platforms should be
5945 # excluded, blank otherwise
5946 # - single_configure true if a single configure file should be generated,
5947 # false for a separate configure file for the tests
5948 # - avoidlist list of modules to avoid
5949 # - cond_dependencies true if --conditional-dependencies was given, false if
5950 # --no-conditional-dependencies was given, blank otherwise
5951 # - libtool true if --libtool was given, false if --no-libtool was
5952 # given, blank otherwise
5953 # - copymode copy mode for files in general
5954 # - lcopymode copy mode for files from local_gnulib_path
5955 func_create_testdir
()
5959 if test -z "$modules"; then
5960 # All modules together.
5961 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
5962 # Except non-recursive-gnulib-prefix-hack, which represents a nonstandard
5963 # way of using Automake.
5964 # Except ftruncate, mountlist, which abort the configuration on mingw. FIXME.
5965 # Except lib-ignore, which leads to link errors when Sun C++ is used. FIXME.
5966 modules
=`func_all_modules`
5967 modules
=`for m in $modules; do case $m in config-h | non-recursive-gnulib-prefix-hack | ftruncate | mountlist | lib-ignore) ;; *) echo $m;; esac; done`
5969 specified_modules
="$modules"
5971 # Canonicalize the list of specified modules.
5972 specified_modules
=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
5974 # Test modules which invoke AC_CONFIG_FILES cannot be used with
5975 # --with-tests --single-configure. Avoid them.
5976 if $inctests && $single_configure; then
5977 avoidlist
="$avoidlist havelib-tests"
5980 # Unlike in func_import, here we want to include all kinds of tests for the
5981 # directly specified modules, but not for dependencies.
5982 inc_all_direct_tests
=true
5983 inc_all_indirect_tests
="$inc_all_tests"
5985 # Check that the license of every module is consistent with the license of
5987 saved_inctests
="$inctests"
5988 # When computing transitive closures, don't consider $module to depend on
5989 # $module-tests. Need this because tests are implicitly GPL and may depend
5990 # on GPL modules - therefore we don't want a warning in this case.
5992 for requested_module
in $specified_modules; do
5993 requested_license
=`func_get_license "$requested_module"`
5994 if test "$requested_license" != GPL
; then
5995 # Here we use func_modules_transitive_closure, not just
5996 # func_get_dependencies, so that we also detect weird situations like
5997 # an LGPL module which depends on a GPLed build tool module which depends
5999 modules
="$requested_module"
6000 func_modules_transitive_closure
6001 for module
in $modules; do
6002 license
=`func_get_license "$module"`
6004 'GPLed build tool') ;;
6005 'public domain' |
'unlimited' |
'unmodifiable license text') ;;
6007 case "$requested_license" in
6010 LGPLv2
+ |
'LGPLv3+ or GPLv2' | LGPLv3
+ | LGPL | GPLv2
+ | GPLv3
+ | GPL
) ;;
6011 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6016 LGPLv2
+ |
'LGPLv3+ or GPLv2' | GPLv2
+) ;;
6017 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6022 LGPLv2
+ |
'LGPLv3+ or GPLv2' | LGPLv3
+ | LGPL
) ;;
6023 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6028 LGPLv2
+ |
'LGPLv3+ or GPLv2') ;;
6029 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6035 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
6044 inctests
="$saved_inctests"
6046 # Subdirectory names.
6057 # Determine final module list.
6058 modules
="$specified_modules"
6059 func_modules_transitive_closure
6060 if test $verbose -ge 0; then
6061 func_show_module_list
6063 final_modules
="$modules"
6065 if $single_configure; then
6066 # Determine main module list and tests-related module list separately.
6067 func_modules_transitive_closure_separately
6070 if $single_configure; then
6071 # Determine whether a $testsbase/libtests.a is needed.
6072 func_determine_use_libtests
6075 # Add the dummy module if needed.
6076 if $single_configure; then
6077 func_modules_add_dummy_separately
6079 func_modules_add_dummy
6083 # If $single_configure, we use the module lists $main_modules and
6084 # $testsrelated_modules; $modules is merely a temporary variable.
6085 # Whereas if ! $configure, the module list is $modules.
6087 # Show banner notice of every module.
6088 if $single_configure; then
6089 modules
="$main_modules"
6095 # Determine final file list.
6096 if $single_configure; then
6097 func_modules_to_filelist_separately
6099 func_modules_to_filelist
6100 if test $verbose -ge 0; then
6102 echo "$files" |
sed -e 's/^/ /'
6105 # Add files for which the copy in gnulib is newer than the one that
6106 # "automake --add-missing --copy" would provide.
6107 files
="$files build-aux/config.guess"
6108 files
="$files build-aux/config.sub"
6109 files
=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
6111 rewritten
='%REWRITTEN%'
6112 sed_rewrite_files
="\
6113 s,^build-aux/,$rewritten$auxdir/,
6114 s,^doc/,$rewritten$docbase/,
6115 s,^lib/,$rewritten$sourcebase/,
6116 s,^m4/,$rewritten$m4base/,
6117 s,^tests/,$rewritten$testsbase/,
6118 s,^tests=lib/,$rewritten$testsbase/,
6122 # Create directories.
6123 for f
in $files; do echo $f; done \
6124 |
sed -e "$sed_rewrite_files" \
6125 |
sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
6126 | LC_ALL
=C
sort -u \
6128 { # Rearrange file descriptors. Needed because "while ... done < ..."
6129 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
6130 exec 5<&0 < "$tmp"/dirs
6132 mkdir
-p "$testdir/$d"
6137 # Copy files or make symbolic links or hard links.
6139 for f
in $files; do echo $f; done \
6140 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_files" \
6143 { # Rearrange file descriptors. Needed because "while ... done < ..."
6144 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
6145 exec 5<&0 < "$tmp"/files
6148 tests
=lib
/*) f
=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
6150 func_lookup_file
"$f"
6151 if test -n "$lookedup_tmp"; then
6152 cp -p "$lookedup_file" "$testdir/$g"
6155 if test "$copyaction" = symlink
; then
6156 func_symlink
"$lookedup_file" "$testdir/$g"
6158 if test "$copyaction" = hardlink
; then
6159 func_hardlink
"$lookedup_file" "$testdir/$g"
6161 cp -p "$lookedup_file" "$testdir/$g"
6169 # Determine include_guard_prefix.
6170 func_compute_include_guard_prefix
6172 # Create Makefile.ams that are for testing.
6175 # No special edits are needed.
6178 # Create $sourcebase/Makefile.am.
6179 mkdir
-p "$testdir/$sourcebase"
6180 destfile
="$sourcebase/Makefile.am"
6181 if $single_configure; then
6182 modules
="$main_modules"
6184 func_emit_lib_Makefile_am
> "$testdir/$sourcebase/Makefile.am"
6185 any_uses_subdirs
="$uses_subdirs"
6187 # Create $m4base/Makefile.am.
6188 mkdir
-p "$testdir/$m4base"
6189 (echo "## Process this file with automake to produce Makefile.in."
6195 echo "EXTRA_DIST += "`echo "$f" | sed -e 's,^m4/,,'` ;;
6198 ) > "$testdir/$m4base/Makefile.am"
6200 subdirs
="$sourcebase $m4base"
6201 subdirs_with_configure_ac
=""
6203 if false
&& test -f "$testdir"/$m4base/gettext.
m4; then
6204 # Avoid stupid error message from automake:
6205 # "AM_GNU_GETTEXT used but `po' not in SUBDIRS"
6206 mkdir
-p "$testdir/po"
6207 (echo "## Process this file with automake to produce Makefile.in."
6208 ) > "$testdir/po/Makefile.am"
6209 func_append subdirs
" po"
6213 test -d "$testdir/$testsbase" || mkdir
"$testdir/$testsbase"
6214 if $single_configure; then
6215 # Create $testsbase/Makefile.am.
6216 destfile
="$testsbase/Makefile.am"
6217 modules
="$testsrelated_modules"
6218 func_emit_tests_Makefile_am
"${macro_prefix}tests_WITNESS" > "$testdir/$testsbase/Makefile.am"
6220 # Viewed from the $testsbase subdirectory, $auxdir is different.
6221 saved_auxdir
="$auxdir"
6222 auxdir
=`echo "$testsbase/" | sed -e 's%[^/][^/]*//*%../%g'`"$auxdir"
6223 # Create $testsbase/Makefile.am.
6225 destfile
="$testsbase/Makefile.am"
6226 func_emit_tests_Makefile_am
"" > "$testdir/$testsbase/Makefile.am"
6227 any_uses_subdirs
="$any_uses_subdirs$uses_subdirs"
6228 # Create $testsbase/configure.ac.
6229 (echo "# Process this file with autoconf to produce a configure script."
6230 echo "AC_INIT([dummy], [0])"
6231 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6232 echo "AM_INIT_AUTOMAKE"
6234 echo "AC_CONFIG_HEADERS([config.h])"
6237 echo "AC_PROG_INSTALL"
6238 echo "AC_PROG_MAKE_SET"
6240 func_emit_pre_early_macros false
'' "$modules"
6242 if test -n "$uses_subdirs"; then
6243 echo "AM_PROG_CC_C_O"
6246 for module
in $modules; do
6248 if test -n "$module"; then
6250 gnumakefile | maintainer-makefile
)
6251 # These modules are meant to be used only in the top-level directory.
6254 func_get_autoconf_early_snippet
"$module"
6259 |
sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
6260 if test "$libtool" = true
; then
6261 echo "LT_INIT([win32-dll])"
6262 echo "LT_LANG([C++])"
6263 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
6264 echo "gl_cond_libtool=true"
6266 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
6267 echo "gl_cond_libtool=false"
6269 echo "gl_ltlibdeps="
6271 # Wrap the set of autoconf snippets into an autoconf macro that is then
6272 # invoked. This is needed because autoconf does not support AC_REQUIRE
6274 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
6275 # but we want the AC_REQUIRE to have its normal meaning (provide one
6276 # expansion of the required macro before the current point, and only one
6278 echo "AC_DEFUN([gl_INIT], ["
6279 sed_replace_build_aux
='
6281 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
6282 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
6285 echo "gl_m4_base='../$m4base'"
6286 func_emit_initmacro_start
$macro_prefix
6287 # We don't have explicit ordering constraints between the various
6288 # autoconf snippets. It's cleanest to put those of the library before
6289 # those of the tests.
6290 echo "gl_source_base='../$sourcebase'"
6291 func_emit_autoconf_snippets
"$modules" "$modules" func_verify_nontests_module false false false
6292 echo "gl_source_base='.'"
6293 func_emit_autoconf_snippets
"$modules" "$modules" func_verify_tests_module false false false
6294 func_emit_initmacro_end
$macro_prefix
6295 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
6296 # created using libtool, because libtool already handles the dependencies.
6297 if test "$libtool" != true
; then
6298 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
6299 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
6300 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
6301 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
6302 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
6305 func_emit_initmacro_done
$macro_prefix $sourcebase # FIXME use $sourcebase or $testsbase?
6309 # Usually $testsbase/config.h will be a superset of config.h. Verify this
6310 # by "merging" config.h into $testsbase/config.h; look out for gcc warnings.
6311 echo "AH_TOP([#include \"../config.h\"])"
6313 echo "AC_CONFIG_FILES([Makefile])"
6315 ) > "$testdir/$testsbase/configure.ac"
6316 auxdir
="$saved_auxdir"
6317 subdirs_with_configure_ac
="$subdirs_with_configure_ac $testsbase"
6319 func_append subdirs
" $testsbase"
6322 # Create Makefile.am.
6323 (echo "## Process this file with automake to produce Makefile.in."
6325 echo "AUTOMAKE_OPTIONS = 1.9.6 foreign"
6327 echo "SUBDIRS = $subdirs"
6329 echo "ACLOCAL_AMFLAGS = -I $m4base"
6330 ) > "$testdir/Makefile.am"
6332 # Create configure.ac.
6333 (echo "# Process this file with autoconf to produce a configure script."
6334 echo "AC_INIT([dummy], [0])"
6335 if test "$auxdir" != "."; then
6336 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6338 echo "AM_INIT_AUTOMAKE"
6340 echo "AC_CONFIG_HEADERS([config.h])"
6343 echo "AC_PROG_INSTALL"
6344 echo "AC_PROG_MAKE_SET"
6346 echo "# For autobuild."
6347 echo "AC_CANONICAL_BUILD"
6348 echo "AC_CANONICAL_HOST"
6350 echo "m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
6351 echo "m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
6352 echo "m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
6353 echo "m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
6355 func_emit_pre_early_macros false
'' "$final_modules"
6357 if test -n "$any_uses_subdirs"; then
6358 echo "AM_PROG_CC_C_O"
6361 for module
in $final_modules; do
6362 if $single_configure; then
6365 func_verify_nontests_module
6367 if test -n "$module"; then
6368 func_get_autoconf_early_snippet
"$module"
6371 |
sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
6372 if test "$libtool" = true
; then
6373 echo "LT_INIT([win32-dll])"
6374 echo "LT_LANG([C++])"
6375 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
6376 echo "gl_cond_libtool=true"
6378 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
6379 echo "gl_cond_libtool=false"
6381 echo "gl_ltlibdeps="
6383 # Wrap the set of autoconf snippets into an autoconf macro that is then
6384 # invoked. This is needed because autoconf does not support AC_REQUIRE
6386 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
6387 # but we want the AC_REQUIRE to have its normal meaning (provide one
6388 # expansion of the required macro before the current point, and only one
6390 echo "AC_DEFUN([gl_INIT], ["
6391 if test "$auxdir" != "build-aux"; then
6392 sed_replace_build_aux
='
6394 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
6395 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
6399 sed_replace_build_aux
="$sed_noop"
6401 echo "gl_m4_base='$m4base'"
6402 func_emit_initmacro_start
$macro_prefix
6403 echo "gl_source_base='$sourcebase'"
6404 if $single_configure; then
6405 func_emit_autoconf_snippets
"$main_modules" "$main_modules" func_verify_module true false false
6407 func_emit_autoconf_snippets
"$modules" "$modules" func_verify_nontests_module true false false
6409 func_emit_initmacro_end
$macro_prefix
6410 if $single_configure; then
6411 echo " gltests_libdeps="
6412 echo " gltests_ltlibdeps="
6413 func_emit_initmacro_start
${macro_prefix}tests
6414 echo " gl_source_base='$testsbase'"
6415 # Define a tests witness macro.
6416 echo " ${macro_prefix}tests_WITNESS=IN_GNULIB_TESTS"
6417 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
6418 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
6419 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
6420 func_emit_autoconf_snippets
"$testsrelated_modules" "$main_modules $testsrelated_modules" func_verify_module true false false
6421 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
6422 func_emit_initmacro_end
${macro_prefix}tests
6424 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
6425 # created using libtool, because libtool already handles the dependencies.
6426 if test "$libtool" != true
; then
6427 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
6428 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
6429 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
6430 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
6431 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
6433 if $single_configure; then
6434 if $use_libtests; then
6435 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
6436 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
6440 func_emit_initmacro_done
$macro_prefix $sourcebase
6441 if $single_configure; then
6442 func_emit_initmacro_done
${macro_prefix}tests
$testsbase
6447 if test -n "$subdirs_with_configure_ac"; then
6448 echo "AC_CONFIG_SUBDIRS(["`echo $subdirs_with_configure_ac`"])"
6450 makefiles
="Makefile"
6451 for d
in $subdirs; do
6452 # For subdirs that have a configure.ac by their own, it's the subdir's
6453 # configure.ac which creates the subdir's Makefile.am, not this one.
6454 case " $subdirs_with_configure_ac " in
6456 *) func_append makefiles
" $d/Makefile" ;;
6459 echo "AC_CONFIG_FILES([$makefiles])"
6461 ) > "$testdir/configure.ac"
6463 # Create autogenerated files.
6465 # Do not use "${AUTORECONF} --force --install", because it may invoke
6466 # autopoint, which brings in older versions of some of our .m4 files.
6467 if test -f $m4base/gettext.
m4; then
6468 func_execute_command
${AUTOPOINT} --force || func_exit
1
6469 for f
in $m4base/*.
m4~
; do
6471 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit
1
6475 if test "$libtool" = true
; then
6476 func_execute_command
${LIBTOOLIZE} --copy || func_exit
1
6478 func_execute_command
${ACLOCAL} -I $m4base || func_exit
1
6479 if ! test -d build-aux
; then
6480 func_execute_command mkdir build-aux || func_exit
1
6482 func_execute_command
${AUTOCONF} || func_exit
1
6483 # Explicit 'touch config.h.in': see <https://savannah.gnu.org/support/index.php?109406>.
6484 func_execute_command
${AUTOHEADER} &&
6485 func_execute_command
touch config.h.
in ||
6487 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6488 rm -rf autom4te.cache
6490 if $inctests && ! $single_configure; then
6491 # Create autogenerated files.
6492 (cd "$testdir/$testsbase" || func_exit
1
6493 # Do not use "${AUTORECONF} --force --install", because it may invoke
6494 # autopoint, which brings in older versions of some of our .m4 files.
6495 if test -f ..
/$m4base/gettext.
m4; then
6496 func_execute_command
${AUTOPOINT} --force || func_exit
1
6497 for f
in ..
/$m4base/*.
m4~
; do
6499 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit
1
6503 func_execute_command
${ACLOCAL} -I ..
/$m4base || func_exit
1
6504 if ! test -d ..
/build-aux
; then
6505 func_execute_command mkdir ..
/build-aux
6507 func_execute_command
${AUTOCONF} || func_exit
1
6508 # Explicit 'touch config.h.in': see <https://savannah.gnu.org/support/index.php?109406>.
6509 func_execute_command
${AUTOHEADER} &&
6510 func_execute_command
touch config.h.
in ||
6512 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6513 rm -rf autom4te.cache
6516 # Need to run configure and make once, to create built files that are to be
6517 # distributed (such as parse-datetime.c).
6518 sed_remove_make_variables
='s,[$]([A-Za-z0-9_]*),,g'
6519 # Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...".
6520 cleaned_files
=`combine_lines < "$testdir/$sourcebase/Makefile.am" \
6521 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
6522 cleaned_files
=`for file in $cleaned_files; do echo " $file "; done`
6523 # Extract the value of "BUILT_SOURCES += ...". Remove variable references
6524 # such $(FOO_H) because they don't refer to distributed files.
6525 built_sources
=`combine_lines < "$testdir/$sourcebase/Makefile.am" \
6526 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
6527 | sed -e "$sed_remove_make_variables"`
6528 distributed_built_sources
=`for file in $built_sources; do
6529 case "$cleaned_files" in
6534 tests_distributed_built_sources
=
6536 # Likewise for built files in the $testsbase directory.
6537 tests_cleaned_files
=`combine_lines < "$testdir/$testsbase/Makefile.am" \
6538 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
6539 tests_cleaned_files
=`for file in $tests_cleaned_files; do echo " $file "; done`
6540 tests_built_sources
=`combine_lines < "$testdir/$testsbase/Makefile.am" \
6541 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
6542 | sed -e "$sed_remove_make_variables"`
6543 tests_distributed_built_sources
=`for file in $tests_built_sources; do
6544 case "$tests_cleaned_files" in
6550 if test -n "$distributed_built_sources" ||
test -n "$tests_distributed_built_sources"; then
6552 .
/configure || func_exit
1
6553 if test -n "$distributed_built_sources"; then
6555 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
6556 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6561 if test -n "$tests_distributed_built_sources"; then
6563 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
6564 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6569 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6576 # func_create_megatestdir megatestdir allmodules
6578 # - local_gnulib_path from --local-dir
6579 # - modcache true or false, from --cache-modules/--no-cache-modules
6580 # - auxdir directory relative to destdir where to place build aux files
6581 func_create_megatestdir
()
6585 if test -z "$allmodules"; then
6586 allmodules
=`func_all_modules`
6590 # First, all modules one by one.
6591 for onemodule
in $allmodules; do
6592 func_create_testdir
"$megatestdir/$onemodule" $onemodule
6593 func_append megasubdirs
"$onemodule "
6595 # Then, all modules all together.
6596 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
6597 allmodules
=`for m in $allmodules; do if test $m != config-h; then echo $m; fi; done`
6598 func_create_testdir
"$megatestdir/ALL" "$allmodules"
6599 func_append megasubdirs
"ALL"
6602 cvsdate
=`vc_witness="$gnulib_dir/.git/refs/heads/master"; \
6603 sh "$gnulib_dir/build-aux/mdate-sh" "$vc_witness" \
6604 | sed -e 's,January,01,' -e 's,Jan,01,' \
6605 -e 's,February,02,' -e 's,Feb,02,' \
6606 -e 's,March,03,' -e 's,Mar,03,' \
6607 -e 's,April,04,' -e 's,Apr,04,' \
6609 -e 's,June,06,' -e 's,Jun,06,' \
6610 -e 's,July,07,' -e 's,Jul,07,' \
6611 -e 's,August,08,' -e 's,Aug,08,' \
6612 -e 's,September,09,' -e 's,Sep,09,' \
6613 -e 's,October,10,' -e 's,Oct,10,' \
6614 -e 's,November,11,' -e 's,Nov,11,' \
6615 -e 's,December,12,' -e 's,Dec,12,' \
6616 -e 's,^,00,' -e 's,^[0-9]*\([0-9][0-9] \),\1,' \
6617 -e 's,^\([0-9]*\) \([0-9]*\) \([0-9]*\),\3\2\1,'`
6619 echo "CVSDATE=$cvsdate"
6620 echo ": \${MAKE=make}"
6621 echo "test -d logs || mkdir logs"
6622 echo "for module in $megasubdirs; do"
6623 echo " echo \"Working on module \$module...\""
6624 echo " safemodule=\`echo \$module | sed -e 's|/|-|g'\`"
6625 echo " (echo \"To: gnulib@autobuild.josefsson.org\""
6628 echo " : autobuild project... \$module"
6629 echo " : autobuild revision... cvs-\$CVSDATE-000000"
6630 echo " : autobuild timestamp... \`date \"+%Y%m%d-%H%M%S\"\`"
6631 echo " : autobuild hostname... \`hostname\`"
6632 echo " cd \$module && ./configure \$CONFIGURE_OPTIONS && \$MAKE && \$MAKE check && \$MAKE distclean"
6634 echo " ) 2>&1 | { if test -n \"\$AUTOBUILD_SUBST\"; then sed -e \"\$AUTOBUILD_SUBST\"; else cat; fi; } > logs/\$safemodule"
6636 ) > "$megatestdir/do-autobuild"
6637 chmod a
+x
"$megatestdir/do-autobuild"
6639 # Create Makefile.am.
6640 (echo "## Process this file with automake to produce Makefile.in."
6642 echo "AUTOMAKE_OPTIONS = 1.9.6 foreign"
6644 echo "SUBDIRS = $megasubdirs"
6646 echo "EXTRA_DIST = do-autobuild"
6647 ) > "$megatestdir/Makefile.am"
6649 # Create configure.ac.
6650 (echo "# Process this file with autoconf to produce a configure script."
6651 echo "AC_INIT([dummy], [0])"
6652 if test "$auxdir" != "."; then
6653 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6655 echo "AM_INIT_AUTOMAKE"
6657 echo "AC_PROG_MAKE_SET"
6659 echo "AC_CONFIG_SUBDIRS([$megasubdirs])"
6660 echo "AC_CONFIG_FILES([Makefile])"
6662 ) > "$megatestdir/configure.ac"
6664 # Create autogenerated files.
6666 # Do not use "${AUTORECONF} --install", because autoreconf operates
6667 # recursively, but the subdirectories are already finished, therefore
6668 # calling autoreconf here would only waste lots of CPU time.
6669 func_execute_command
${ACLOCAL} || func_exit
1
6670 func_execute_command mkdir build-aux
6671 func_execute_command
${AUTOCONF} || func_exit
1
6672 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6673 rm -rf autom4te.cache
6679 func_fatal_error
"no mode specified" ;;
6686 # sed expression that converts a literal to a basic regular expression.
6687 # Needs to handle . [ \ * ^ $.
6688 sed_literal_to_basic_regex
='s/\\/\\\\/g
6694 if test -f "$gnulib_dir/$filename" \
6695 || func_lookup_local_file
"$filename"; then
6696 filename_anywhere_regex
=`echo "$filename" | sed -e "$sed_literal_to_basic_regex"`
6697 filename_line_regex
='^'"$filename_anywhere_regex"'$'
6700 (cd "$gnulib_dir" && find modules -type f -print | xargs -n 100 grep -l "$filename_line_regex" /dev/null | sed -e 's,^modules/,,')
6701 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$,,'
6703 | func_sanitize_modulelist \
6706 for module
in $module_candidates; do
6707 if func_get_filelist
$module |
grep "$filename_line_regex" > /dev
/null
; then
6712 func_warning
"file $filename does not exist"
6717 import | add-import | remove-import | update
)
6720 if test -z "$destdir"; then
6723 test -d "$destdir" \
6724 || func_fatal_error
"destination directory does not exist: $destdir"
6726 # Prefer configure.ac to configure.in.
6727 if test -f "$destdir"/configure.ac
; then
6728 configure_ac
="$destdir/configure.ac"
6730 if test -f "$destdir"/configure.
in; then
6731 configure_ac
="$destdir/configure.in"
6733 func_fatal_error
"cannot find $destdir/configure.ac - make sure you run gnulib-tool from within your package's directory"
6737 # Analyze configure.ac.
6739 guessed_libtool
=false
6744 /AC_CONFIG_AUX_DIR/ {
6745 s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^]"$`\\)]*\).*$,guessed_auxdir="\1",p
6747 /A[CM]_PROG_LIBTOOL/ {
6748 s,^.*$,guessed_libtool=true,p
6750 eval `sed -n -e "$my_sed_traces" < "$configure_ac"`
6752 if test -z "$auxdir"; then
6753 auxdir
="$guessed_auxdir"
6756 # Determine where to apply func_import.
6757 if test "$mode" = import
; then
6758 # Apply func_import to a particular gnulib directory.
6759 # The command line contains the complete specification; don't look at
6760 # the contents of gnulib-cache.m4.
6761 test -n "$supplied_libname" || supplied_libname
=true
6762 test -n "$sourcebase" || sourcebase
="lib"
6763 test -n "$m4base" || m4base
="m4"
6764 test -n "$docbase" || docbase
="doc"
6765 test -n "$testsbase" || testsbase
="tests"
6766 test -n "$macro_prefix" || macro_prefix
="gl"
6769 if test -n "$m4base"; then
6770 # Apply func_import to a particular gnulib directory.
6771 # Any number of additional modules can be given.
6772 if test ! -f "$destdir/$m4base"/gnulib-cache.
m4; then
6773 # First use of gnulib in the given m4base.
6774 test -n "$supplied_libname" || supplied_libname
=true
6775 test -n "$sourcebase" || sourcebase
="lib"
6776 test -n "$docbase" || docbase
="doc"
6777 test -n "$testsbase" || testsbase
="tests"
6778 test -n "$macro_prefix" || macro_prefix
="gl"
6782 # Apply func_import to all gnulib directories.
6783 # To get this list of directories, look at Makefile.am. (Not at
6784 # configure, because it may be omitted from version control. Also,
6785 # don't run "find $destdir -name gnulib-cache.m4", as it might be
6789 if test -f "$destdir"/Makefile.am
; then
6790 aclocal_amflags
=`sed -n -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/p' "$destdir"/Makefile.am`
6792 for arg
in $aclocal_amflags; do
6793 if test -n "$m4dir_is_next"; then
6794 # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
6798 if test -f "$destdir/$arg"/gnulib-cache.
m4; then
6799 func_append m4dirs
" $arg"
6800 m4dirs_count
=`expr $m4dirs_count + 1`
6806 if test "X$arg" = "X-I"; then
6814 # No Makefile.am! Oh well. Look at the last generated aclocal.m4.
6815 if test -f "$destdir"/aclocal.
m4; then
6816 sedexpr1
='s,^m4_include(\[\(.*\)])$,\1,p'
6817 sedexpr2
='s,^[^/]*$,.,'
6818 sedexpr3
='s,/[^/]*$,,'
6819 m4dirs
=`sed -n -e "$sedexpr1" aclocal.m4 | sed -e "$sedexpr2" -e "$sedexpr3" | LC_ALL=C sort -u`
6820 m4dirs
=`for arg in $m4dirs; do if test -f "$destdir/$arg"/gnulib-cache.m4; then echo $arg; fi; done`
6821 m4dirs_count
=`for arg in $m4dirs; do echo "$arg"; done | wc -l`
6824 if test $m4dirs_count = 0; then
6825 # First use of gnulib in a package.
6826 # Any number of additional modules can be given.
6827 test -n "$supplied_libname" || supplied_libname
=true
6828 test -n "$sourcebase" || sourcebase
="lib"
6830 test -n "$docbase" || docbase
="doc"
6831 test -n "$testsbase" || testsbase
="tests"
6832 test -n "$macro_prefix" || macro_prefix
="gl"
6835 if test $m4dirs_count = 1; then
6836 # There's only one use of gnulib here. Assume the user means it.
6837 # Any number of additional modules can be given.
6838 for m4base
in $m4dirs; do
6842 # Ambiguous - guess what the user meant.
6843 if test $# = 0; then
6844 # No further arguments. Guess the user wants to update all of them.
6845 for m4base
in $m4dirs; do
6846 # Perform func_import in a subshell, so that variable values
6848 # local_gnulib_path, incobsolete, inc_cxx_tests,
6849 # inc_longrunning_tests, inc_privileged_tests,
6850 # inc_unportable_tests, inc_all_tests, avoidlist, sourcebase,
6851 # m4base, pobase, docbase, testsbase, inctests, libname, lgpl,
6852 # makefile_name, libtool, macro_prefix, po_domain,
6853 # witness_c_macro, vc_files
6854 # don't propagate from one directory to another.
6855 (func_import
) || func_exit
1
6859 func_fatal_error
"Ambiguity: to which directory should the modules be added? Please specify at least --m4-base=..."
6868 if test -z "$destdir"; then
6869 func_fatal_error
"please specify --dir option"
6872 test -d "$destdir" \
6873 || func_fatal_error
"could not create destination directory"
6874 test -n "$auxdir" || auxdir
="build-aux"
6875 func_create_testdir
"$destdir" "$*"
6878 create-megatestdir
)
6879 if test -z "$destdir"; then
6880 func_fatal_error
"please specify --dir option"
6882 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
6883 test -n "$auxdir" || auxdir
="build-aux"
6884 func_create_megatestdir
"$destdir" "$*"
6888 test -n "$destdir" || destdir
=testdir$$
6889 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
6890 test -n "$auxdir" || auxdir
="build-aux"
6891 func_create_testdir
"$destdir" "$*"
6895 ..
/configure || func_exit
1
6896 $MAKE || func_exit
1
6897 $MAKE check || func_exit
1
6898 $MAKE distclean || func_exit
1
6899 remaining
=`find . -type f -print`
6900 if test -n "$remaining"; then
6901 echo "Remaining files:" $remaining 1>&2
6902 echo "gnulib-tool: *** Stop." 1>&2
6911 test -n "$destdir" || destdir
=testdir$$
6912 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
6913 test -n "$auxdir" || auxdir
="build-aux"
6914 func_create_megatestdir
"$destdir" "$*"
6922 remaining
=`find . -type f -print`
6923 if test -n "$remaining"; then
6924 echo "Remaining files:" $remaining 1>&2
6925 echo "gnulib-tool: *** Stop." 1>&2
6933 extract-description
)
6937 if test -n "$module"; then
6938 func_get_description
"$module"
6947 if test -n "$module"; then
6948 func_get_comment
"$module"
6957 if test -n "$module"; then
6958 func_get_status
"$module"
6967 if test -n "$module"; then
6968 func_get_notice
"$module"
6973 extract-applicability
)
6977 if test -n "$module"; then
6978 func_get_applicability
"$module"
6987 if test -n "$module"; then
6988 func_get_filelist
"$module"
6993 extract-dependencies
)
6994 if test -n "$avoidlist"; then
6995 func_fatal_error
"cannot combine --avoid and --extract-dependencies"
7000 if test -n "$module"; then
7001 func_get_dependencies
"$module"
7006 extract-autoconf-snippet
)
7010 if test -n "$module"; then
7011 func_get_autoconf_snippet
"$module"
7016 extract-automake-snippet
)
7020 if test -n "$module"; then
7021 func_get_automake_snippet
"$module"
7026 extract-include-directive
)
7030 if test -n "$module"; then
7031 func_get_include_directive
"$module"
7036 extract-link-directive
)
7040 if test -n "$module"; then
7041 func_get_link_directive
"$module"
7050 if test -n "$module"; then
7051 func_get_license
"$module"
7056 extract-maintainer
)
7060 if test -n "$module"; then
7061 func_get_maintainer
"$module"
7066 extract-tests-module
)
7070 if test -n "$module"; then
7071 func_get_tests_module
"$module"
7077 # Verify the number of arguments.
7078 if test $# -lt 1 ||
test $# -gt 2; then
7079 func_fatal_error
"invalid number of arguments for --$mode"
7082 # The first argument is the file to be copied.
7084 # Verify the file exists.
7085 func_lookup_file
"$f"
7087 # The second argument is the destination; either a directory ot a file.
7088 # It defaults to the current directory.
7090 test -n "$dest" || dest
='.'
7091 test -n "$sourcebase" || sourcebase
="lib"
7092 test -n "$m4base" || m4base
="m4"
7093 test -n "$docbase" || docbase
="doc"
7094 test -n "$testsbase" || testsbase
="tests"
7095 test -n "$auxdir" || auxdir
="build-aux"
7096 rewritten
='%REWRITTEN%'
7097 sed_rewrite_files
="\
7098 s,^build-aux/,$rewritten$auxdir/,
7099 s,^doc/,$rewritten$docbase/,
7100 s,^lib/,$rewritten$sourcebase/,
7101 s,^m4/,$rewritten$m4base/,
7102 s,^tests/,$rewritten$testsbase/,
7105 if test -d "$dest"; then
7107 g
=`echo "$f" | sed -e "$sed_rewrite_files"`
7109 destdir
=`dirname "$dest"`
7110 g
=`basename "$dest"`
7113 # Create the directory for destfile.
7114 d
=`dirname "$destdir/$g"`
7116 if test -n "$d" && test ! -d "$d"; then
7117 mkdir
-p "$d" || func_fatal_error
"failed"
7121 func_dest_tmpfilename
"$g"
7122 cp "$lookedup_file" "$tmpfile" || func_fatal_error
"failed"
7123 already_present
=true
7124 if test -f "$destdir/$g"; then
7125 # The file already exists.
7129 # Don't protest if the file should be there but isn't: it happens
7130 # frequently that developers don't put autogenerated files under version
7138 func_fatal_error
"unknown operation mode --$mode" ;;
7141 if test "$copymode" = hardlink
-o "$lcopymode" = hardlink
; then
7142 # Setting hard links modifies the ctime of files in the gnulib checkout.
7143 # This disturbs the result of the next "gitk" invocation.
7144 # Workaround: Let git scan the files. This can be done through
7145 # "git update-index --refresh" or "git status" or "git diff".
7146 if test -d "$gnulib_dir"/.git \
7147 && (git
--version) >/dev
/null
2>/dev
/null
; then
7148 (cd "$gnulib_dir" && git update-index
--refresh >/dev
/null
)
7153 # Undo the effect of the previous 'trap' command. Some shellology:
7154 # We cannot use "trap - 0 1 2 3 13 15", because Solaris sh would attempt to
7155 # execute the command "-". "trap '' ..." is fine only for signal 0 (= normal
7156 # exit); for the others we need to call 'exit' explicitly. The value of $? is
7157 # 128 + signal number and is set before the trap-registered command is run.
7159 trap 'func_exit $?' 1 2 3 13 15
7164 # indent-tabs-mode: nil
7165 # whitespace-check-buffer-indent: nil