3 # Copyright (C) 2002-2016 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 <http://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 # <http://lists.gnu.org/archive/html/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 --lgpl[=2|=3orGPLv2|=3]
268 Abort if modules aren't available under the LGPL.
269 Also modify license template from GPL to LGPL.
270 The version number of the LGPL can be specified;
271 the default is currently LGPLv3.
272 --makefile-name=NAME Name of makefile in automake syntax in the
273 source-base and tests-base directories
274 (default \"Makefile.am\").
275 --macro-prefix=PREFIX Specify the prefix of the macros 'gl_EARLY' and
276 'gl_INIT'. Default is 'gl'.
277 --po-domain=NAME Specify the prefix of the i18n domain. Usually use
278 the package name. A suffix '-gnulib' is appended.
279 --witness-c-macro=NAME Specify the C macro that is defined when the
280 sources in this directory are compiled or used.
281 --vc-files Update version control related files.
282 --no-vc-files Don't update version control related files
283 (.gitignore and/or .cvsignore).
285 Options for --create-[mega]testdir, --[mega]test:
287 --single-configure Generate a single configure file, not a separate
288 configure file for the tests directory.
290 Options for --import, --add/remove-import, --update,
291 --create-[mega]testdir, --[mega]test:
293 -s, --symbolic, --symlink Make symbolic links instead of copying files.
294 --local-symlink Make symbolic links instead of copying files, only
295 for files from the local override directory.
297 Options for --import, --add/remove-import, --update:
299 -S, --more-symlinks Make symbolic links instead of copying files, and
300 don't replace copyright notices.
302 Report bugs to <bug-gnulib@gnu.org>."
306 # outputs to stdout the --version message.
310 if test -d "$gnulib_dir"/.git \
311 && (git
--version) >/dev
/null
2>/dev
/null \
312 && (date --version) >/dev
/null
2>/dev
/null
; then
313 # gnulib checked out from git.
314 sed_extract_first_date
='/^Date/{
318 date=`cd "$gnulib_dir" && git log ChangeLog | sed -n -e "$sed_extract_first_date"`
319 # Turn "Fri Mar 21 07:16:51 2008 -0600" into "Mar 21 2008 07:16:51 -0600".
320 sed_year_before_time
='s/^[^ ]* \([^ ]*\) \([0-9]*\) \([0-9:]*\) \([0-9]*\) /\1 \2 \4 \3 /'
321 date=`echo "$date" | sed -e "$sed_year_before_time"`
322 # Use GNU date to compute the time in GMT.
323 date=`date -d "$date" -u +"%Y-%m-%d %H:%M:%S"`
324 version
=' '`cd "$gnulib_dir" && ./build-aux/git-version-gen /dev/null | sed -e 's/-dirty/-modified/'`
326 # gnulib copy without versioning information.
327 date=`sed -e 's/ .*//;q' "$gnulib_dir"/ChangeLog`
330 year
=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed -e 's,^.* ,,'`
332 gnulib-tool (GNU $package $date)$version
333 Copyright (C) $year Free Software Foundation, Inc.
334 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
335 This is free software: you are free to change and redistribute it.
336 There is NO WARRANTY, to the extent permitted by law.
338 printf "Written by %s, %s, and %s.\n" "Bruno Haible" "Paul Eggert" "Simon Josefsson"
341 # func_emit_copyright_notice
342 # outputs to stdout a header for a generated file.
343 func_emit_copyright_notice
()
345 sed -n -e '/Copyright/ {
348 }' < "$self_abspathname"
350 echo "# This file is free software; you can redistribute it and/or modify"
351 echo "# it under the terms of the GNU General Public License as published by"
352 echo "# the Free Software Foundation; either version 3 of the License, or"
353 echo "# (at your option) any later version."
355 echo "# This file is distributed in the hope that it will be useful,"
356 echo "# but WITHOUT ANY WARRANTY; without even the implied warranty of"
357 echo "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
358 echo "# GNU General Public License for more details."
360 echo "# You should have received a copy of the GNU General Public License"
361 echo "# along with this file. If not, see <http://www.gnu.org/licenses/>."
363 echo "# As a special exception to the GNU General Public License,"
364 echo "# this file may be distributed as part of a program that"
365 echo "# contains a configuration script generated by Autoconf, under"
366 echo "# the same distribution terms as the rest of that program."
368 echo "# Generated by gnulib-tool."
372 # exits with a given status.
373 # This function needs to be used, rather than 'exit', when a 'trap' handler is
374 # in effect that refers to $?.
381 # locates the directory where the gnulib repository lives
383 # - progname name of this program
385 # - self_abspathname absolute pathname of gnulib-tool
386 # - gnulib_dir absolute pathname of gnulib repository
390 /* | ?
:*) self_abspathname
="$progname" ;;
391 */*) self_abspathname
=`pwd`/"$progname" ;;
394 # Iterate through the elements of $PATH.
395 # We use IFS=: instead of
396 # for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'`
397 # because the latter does not work when some PATH element contains spaces.
398 # We use a canonicalized $pathx instead of $PATH, because empty PATH
399 # elements are by definition equivalent to '.', however field splitting
400 # according to IFS=: loses empty fields in many shells:
401 # - /bin/sh on OSF/1 and Solaris loses all empty fields (at the
402 # beginning, at the end, and in the middle),
403 # - /bin/sh on IRIX and /bin/ksh on IRIX and OSF/1 lose empty fields
404 # at the beginning and at the end,
405 # - GNU bash, /bin/sh on AIX and HP-UX, and /bin/ksh on AIX, HP-UX,
406 # Solaris lose empty fields at the end.
407 # The 'case' statement is an optimization, to avoid evaluating the
408 # explicit canonicalization command when $PATH contains no empty fields.
410 if test "$PATH_SEPARATOR" = ";"; then
411 # On Windows, programs are searched in "." before $PATH.
414 # On Unix, we have to convert empty PATH elements to ".".
418 pathx
=`echo ":$PATH:" | sed -e 's/:::*/:.:/g' -e 's/^://' -e 's/:\$//'`
423 IFS
="$PATH_SEPARATOR"
427 if test -x "$d/$progname" && test ! -d "$d/$progname"; then
428 self_abspathname
="$d/$progname"
433 if test -z "$self_abspathname"; then
434 func_fatal_error
"could not locate the gnulib-tool program - how did you invoke it?"
438 while test -h "$self_abspathname"; do
439 # Resolve symbolic link.
440 linkval
=`func_readlink "$self_abspathname"`
441 test -n "$linkval" ||
break
443 /* | ?
:* ) self_abspathname
="$linkval" ;;
444 * ) self_abspathname
=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;;
447 gnulib_dir
=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
451 # creates a temporary directory.
453 # - progname name of this program
455 # - tmp pathname of freshly created temporary directory
458 # Use the environment variable TMPDIR, falling back to /tmp. This allows
459 # users to specify a different temporary directory, for example, if their
460 # /tmp is filled up or too small.
463 # Use the mktemp program if available. If not available, hide the error
465 tmp
=`(umask 077 && mktemp -d "$TMPDIR/glXXXXXX") 2>/dev/null` &&
466 test -n "$tmp" && test -d "$tmp"
469 # Use a simple mkdir command. It is guaranteed to fail if the directory
470 # already exists. $RANDOM is bash specific and expands to empty in shells
471 # other than bash, ksh and zsh. Its use does not increase security;
472 # rather, it minimizes the probability of failure in a very cluttered /tmp
474 tmp
=$TMPDIR/gl$$
-$RANDOM
475 (umask 077 && mkdir
"$tmp")
478 echo "$progname: cannot create a temporary directory in $TMPDIR" >&2
483 # func_append var value
484 # appends the given value to the shell variable var.
485 if ( foo
=bar
; foo
+=baz
&& test "$foo" = barbaz
) >/dev
/null
2>&1; then
486 # Use bash's += operator. It reduces complexity of appending repeatedly to
487 # a single variable from O(n^2) to O(n).
492 fast_func_append
=true
496 eval "$1=\"\$$1\$2\""
498 fast_func_append
=false
501 # func_remove_prefix var prefix
502 # removes the given prefix from the value of the shell variable var.
503 # var should be the name of a shell variable.
504 # Its value should not contain a newline and not start or end with whitespace.
505 # prefix should not contain the characters "$`\{}[]^|.
506 if ( foo
=bar
; eval 'test "${foo#b}" = ar' ) >/dev
/null
2>&1; then
507 func_remove_prefix
()
511 fast_func_remove_prefix
=true
513 func_remove_prefix
()
515 eval "value=\"\$$1\""
519 sed_escape_dots
='s/\([.]\)/\\\1/g'
520 prefix
=`echo "$prefix" | sed -e "$sed_escape_dots"`
523 value
=`echo "$value" | sed -e "s|^${prefix}||"`
524 eval "$1=\"\$value\""
526 fast_func_remove_prefix
=false
529 # Determine whether we should use ':' or ';' as PATH_SEPARATOR.
530 func_determine_path_separator
()
532 if test "${PATH_SEPARATOR+set}" != set; then
533 # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
534 # contains only /bin. Note that ksh looks also at the FPATH variable,
535 # so we have to set that as well for the test.
537 (PATH
='/bin;/bin'; FPATH
=$PATH; sh
-c :) >/dev
/null
2>&1 \
538 && { (PATH
='/bin:/bin'; FPATH
=$PATH; sh
-c :) >/dev
/null
2>&1 \
539 || PATH_SEPARATOR
=';'
544 # func_path_prepend pathvar directory
545 # puts directory before pathvar, delimiting directories by PATH_SEPARATOR.
546 # Newly added directory into pathvar has the highest priority.
549 if eval "test -n \"\$$1\""; then
550 eval "$1=\$2\$PATH_SEPARATOR\$$1"
556 # func_path_append pathvar directory
557 # Similar to func_path_prepend except that the newest directory has the lowest
561 if eval "test -n \"\$$1\""; then
562 func_append
"$1" "$PATH_SEPARATOR$2"
568 # func_path_foreach_inner
569 # helper for func_path_foreach because we need new 'args' array
571 # - fpf_dir directory from local_gnulib_path
572 # - fpf_cb callback to be run for fpf_dir
573 func_path_foreach_inner
()
595 # func_path_foreach path method args
596 # Execute method for each directory in path. The method will be called
597 # like `method args` while any argument '%dir%' within args will be replaced
598 # with processed directory from path.
607 for fpf_dir
in $fpf_dirs
609 func_path_foreach_inner
"$@" && fpf_rc
=:
615 # func_remove_suffix var suffix
616 # removes the given suffix from the value of the shell variable var.
617 # var should be the name of a shell variable.
618 # Its value should not contain a newline and not start or end with whitespace.
619 # suffix should not contain the characters "$`\{}[]^|.
620 if ( foo
=bar
; eval 'test "${foo%r}" = ba' ) >/dev
/null
2>&1; then
621 func_remove_suffix
()
625 fast_func_remove_suffix
=true
627 func_remove_suffix
()
629 eval "value=\"\$$1\""
633 sed_escape_dots
='s/\([.]\)/\\\1/g'
634 suffix
=`echo "$suffix" | sed -e "$sed_escape_dots"`
637 value
=`echo "$value" | sed -e "s|${suffix}\$||"`
638 eval "$1=\"\$value\""
640 fast_func_remove_suffix
=false
643 # func_fatal_error message
644 # outputs to stderr a fatal error message, and terminates the program.
646 # - progname name of this program
649 echo "$progname: *** $1" 1>&2
650 echo "$progname: *** Stop." 1>&2
654 # func_warning message
655 # Outputs to stderr a warning message,
658 echo "gnulib-tool: warning: $1" 1>&2
661 # func_readlink SYMLINK
662 # outputs the target of the given symlink.
663 if (type readlink
) > /dev
/null
2>&1; then
666 # Use the readlink program from GNU coreutils.
672 # Use two sed invocations. A single sed -n -e 's,^.* -> \(.*\)$,\1,p'
673 # would do the wrong thing if the link target contains " -> ".
674 LC_ALL
=C
ls -l "$1" |
sed -e 's, -> ,#%%#,' |
sed -n -e 's,^.*#%%#\(.*\)$,\1,p'
678 # func_relativize DIR1 DIR2
679 # computes a relative pathname RELDIR such that DIR1/RELDIR = DIR2.
681 # - DIR1 relative pathname, relative to the current directory
682 # - DIR2 relative pathname, relative to the current directory
684 # - reldir relative pathname of DIR2, relative to DIR1
690 sed_first
='s,^\([^/]*\)/.*$,\1,'
691 sed_rest
='s,^[^/]*/*,,'
692 sed_last
='s,^.*/\([^/]*\)$,\1,'
693 sed_butlast
='s,/*[^/]*$,,'
694 while test -n "$dir1"; do
695 first
=`echo "$dir1" | sed -e "$sed_first"`
696 if test "$first" != "."; then
697 if test "$first" = ".."; then
698 dir2
=`echo "$dir0" | sed -e "$sed_last"`/"$dir2"
699 dir0
=`echo "$dir0" | sed -e "$sed_butlast"`
701 first2
=`echo "$dir2" | sed -e "$sed_first"`
702 if test "$first2" = "$first"; then
703 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
707 dir0
="$dir0"/"$first"
710 dir1
=`echo "$dir1" | sed -e "$sed_rest"`
715 # func_relconcat DIR1 DIR2
716 # computes a relative pathname DIR1/DIR2, with obvious simplifications.
718 # - DIR1 relative pathname, relative to the current directory
719 # - DIR2 relative pathname, relative to DIR1
721 # - relconcat DIR1/DIR2, relative to the current directory
726 sed_first
='s,^\([^/]*\)/.*$,\1,'
727 sed_rest
='s,^[^/]*/*,,'
728 sed_last
='s,^.*/\([^/]*\)$,\1,'
729 sed_butlast
='s,/*[^/]*$,,'
731 first
=`echo "$dir2" | sed -e "$sed_first"`
732 if test "$first" = "."; then
733 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
734 if test -z "$dir2"; then
739 last
=`echo "$dir1" | sed -e "$sed_last"`
740 while test "$last" = "."; do
741 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
742 last
=`echo "$dir1" | sed -e "$sed_last"`
744 if test -z "$dir1"; then
748 if test "$first" = ".."; then
749 if test "$last" = ".."; then
750 relconcat
="$dir1/$dir2"
753 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
754 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
755 if test -z "$dir1"; then
759 if test -z "$dir2"; then
764 relconcat
="$dir1/$dir2"
772 # Like ln -s, except use cp -p if ln -s fails.
776 echo "$progname: ln -s failed; falling back on cp -p" >&2
779 /* | ?
:*) # SRC is absolute.
781 *) # SRC is relative to the directory of DEST.
790 # Like func_ln_s, except that SRC is given relative to the current directory (or
791 # absolute), not given relative to the directory of DEST.
796 func_ln_s
"$1" "$2" ;;
797 *) # SRC is relative.
800 func_ln_s
"`pwd`/$1" "$2" ;;
801 *) # DEST is relative too.
802 ln_destdir
=`echo "$2" | sed -e 's,[^/]*$,,'`
803 test -n "$ln_destdir" || ln_destdir
="."
804 func_relativize
"$ln_destdir" "$1"
805 func_ln_s
"$reldir" "$2"
812 # func_ln_if_changed SRC DEST
813 # Like func_ln, but avoids munging timestamps if the link is correct.
814 func_ln_if_changed
()
816 if test $# -ne 2; then
817 echo "usage: func_ln_if_changed SRC DEST" >&2
819 ln_target
=`func_readlink "$2"`
820 if test -h "$2" && test "$1" = "$ln_target"; then
828 # Ensure an 'echo' command that
829 # 1. does not interpret backslashes and
830 # 2. does not print an error message "broken pipe" when writing into a pipe
833 # Test cases for problem 1:
834 # echo '\n' | wc -l prints 1 when OK, 2 when KO
835 # echo '\t' | grep t > /dev/null has return code 0 when OK, 1 when KO
836 # Test cases for problem 2:
837 # echo hi | true frequently prints
838 # "bash: echo: write error: Broken pipe"
839 # to standard error in bash 3.2.
841 # Problem 1 is a weird heritage from SVR4. BSD got it right (except that
842 # BSD echo interprets '-n' as an option, which is also not desirable).
843 # Nowadays the problem occurs in 4 situations:
844 # - in bash, when the shell option xpg_echo is set (bash >= 2.04)
845 # or when it was built with --enable-usg-echo-default (bash >= 2.0)
846 # or when it was built with DEFAULT_ECHO_TO_USG (bash < 2.0),
847 # - in zsh, when sh-emulation is not set,
848 # - in ksh (e.g. AIX /bin/sh and Solaris /usr/xpg4/bin/sh are ksh instances,
849 # and HP-UX /bin/sh and IRIX /bin/sh behave similarly),
850 # - in Solaris /bin/sh and OSF/1 /bin/sh.
851 # We try the following workarounds:
852 # - for all: respawn using $CONFIG_SHELL if that is set and works.
853 # - for bash >= 2.04: unset the shell option xpg_echo.
854 # - for bash >= 2.0: define echo to a function that uses the printf built-in.
855 # - for bash < 2.0: define echo to a function that uses cat of a here document.
856 # - for zsh: turn sh-emulation on.
857 # - for ksh: alias echo to 'print -r'.
858 # - for ksh: alias echo to a function that uses cat of a here document.
859 # - for Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh and rely on
860 # the ksh workaround.
861 # - otherwise: respawn using /bin/sh and rely on the workarounds.
862 # When respawning, we pass --no-reexec as first argument, so as to avoid
863 # turning this script into a fork bomb in unlucky situations.
865 # Problem 2 is specific to bash 3.2 and affects the 'echo' built-in, but not
866 # the 'printf' built-in. See
867 # <http://lists.gnu.org/archive/html/bug-bash/2008-12/msg00050.html>
868 # <http://lists.gnu.org/archive/html/bug-gnulib/2010-02/msg00154.html>
869 # The workaround is: define echo to a function that uses the printf built-in.
871 if echo '\t' |
grep t
> /dev
/null
; then
872 have_echo
=yes # Lucky!
874 # Try the workarounds.
875 # Respawn using $CONFIG_SHELL if that is set and works.
876 if test -z "$have_echo" \
877 && test "X$1" != "X--no-reexec" \
878 && test -n "$CONFIG_SHELL" \
879 && test -f "$CONFIG_SHELL" \
880 && $CONFIG_SHELL -c "echo '\\t' | grep t > /dev/null"; then
881 exec $CONFIG_SHELL "$0" --no-reexec "$@"
884 # For bash >= 2.04: unset the shell option xpg_echo.
885 if test -z "$have_echo" \
886 && test -n "$BASH_VERSION" \
887 && (shopt -o xpg_echo
; echo '\t' |
grep t
> /dev
/null
) 2>/dev
/null
; then
891 # For bash >= 2.0: define echo to a function that uses the printf built-in.
892 # For bash < 2.0: define echo to a function that uses cat of a here document.
893 # (There is no win in using 'printf' over 'cat' if it is not a shell built-in.)
894 # Also handle problem 2, specific to bash 3.2, here.
895 if { test -z "$have_echo" \
896 ||
case "$BASH_VERSION" in 3.2*) true
;; *) false
;; esac; \
898 && test -n "$BASH_VERSION"; then \
899 if type printf 2>/dev
/null |
grep / > /dev
/null
; then
900 # 'printf' is not a shell built-in.
908 # 'printf' is a shell built-in.
914 if echo '\t' |
grep t
> /dev
/null
; then
918 # For zsh: turn sh-emulation on.
919 if test -z "$have_echo" \
920 && test -n "$ZSH_VERSION" \
921 && (emulate sh
) >/dev
/null
2>&1; then
924 # For ksh: alias echo to 'print -r'.
925 if test -z "$have_echo" \
926 && (type print
) >/dev
/null
2>&1; then
927 # A 'print' command exists.
928 if type print
2>/dev
/null |
grep / > /dev
/null
; then
931 # 'print' is a shell built-in.
932 if (print
-r '\told' |
grep told
> /dev
/null
) 2>/dev
/null
; then
933 # 'print' is the ksh shell built-in.
934 alias echo='print -r'
938 if test -z "$have_echo" \
939 && echo '\t' |
grep t
> /dev
/null
; then
942 # For ksh: alias echo to a function that uses cat of a here document.
943 # The ksh manual page says:
944 # "Aliasing is performed when scripts are read, not while they are executed.
945 # Therefore, for an alias to take effect, the alias definition command has
946 # to be executed before the command which references the alias is read."
947 # Because of this, we have to play strange tricks with have_echo, to ensure
948 # that the top-level statement containing the test starts after the 'alias'
950 if test -z "$have_echo"; then
957 if (alias echo=bsd_echo
) 2>/dev
/null
; then
958 alias echo=bsd_echo
2>/dev
/null
961 if test -z "$have_echo" \
962 && echo '\t' |
grep t
> /dev
/null
; then
965 if test -z "$have_echo"; then
966 if (alias echo=bsd_echo
) 2>/dev
/null
; then
967 unalias echo 2>/dev
/null
970 # For Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh.
971 if test -z "$have_echo" \
972 && test "X$1" != "X--no-reexec" \
973 && test -f /bin
/ksh
; then
974 exec /bin
/ksh
"$0" --no-reexec "$@"
977 # Otherwise: respawn using /bin/sh.
978 if test -z "$have_echo" \
979 && test "X$1" != "X--no-reexec" \
980 && test -f /bin
/sh
; then
981 exec /bin
/sh
"$0" --no-reexec "$@"
984 if test -z "$have_echo"; then
985 func_fatal_error
"Shell does not support 'echo' correctly. Please install GNU bash and set the environment variable CONFIG_SHELL to point to it."
987 if echo '\t' |
grep t
> /dev
/null
; then
990 func_fatal_error
"Shell does not support 'echo' correctly. Workaround does not work. Please report this as a bug to bug-gnulib@gnu.org."
992 if test "X$1" = "X--no-reexec"; then
996 # Unset CDPATH. Otherwise, output from 'cd dir' can surprise callers.
997 (unset CDPATH
) >/dev
/null
2>&1 && unset CDPATH
999 # Determine the path separator early because the following option parsing code
1001 func_determine_path_separator
1003 # Command-line option processing.
1004 # Removes the OPTIONS from the arguments. Sets the variables:
1005 # - mode one of: list, find, import, add-import, remove-import,
1006 # update, create-testdir, create-megatestdir, test, megatest,
1008 # - destdir from --dir
1009 # - local_gnulib_path from --local-dir
1010 # - modcache true or false, from --cache-modules/--no-cache-modules
1011 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
1012 # - libname, supplied_libname from --lib
1013 # - sourcebase from --source-base
1014 # - m4base from --m4-base
1015 # - pobase from --po-base
1016 # - docbase from --doc-base
1017 # - testsbase from --tests-base
1018 # - auxdir from --aux-dir
1019 # - inctests true if --with-tests was given, false if --without-tests
1020 # was given, blank otherwise
1021 # - incobsolete true if --with-obsolete was given, blank otherwise
1022 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
1023 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
1025 # - inc_privileged_tests true if --with-privileged-tests was given, blank
1027 # - inc_unportable_tests true if --with-unportable-tests was given, blank
1029 # - inc_all_tests true if --with-all-tests was given, blank otherwise
1030 # - excl_cxx_tests true if --without-c++-tests was given, blank otherwise
1031 # - excl_longrunning_tests true if --without-longrunning-tests was given,
1033 # - excl_privileged_tests true if --without-privileged-tests was given, blank
1035 # - excl_unportable_tests true if --without-unportable-tests was given, blank
1037 # - single_configure true if --single-configure was given, false otherwise
1038 # - avoidlist list of modules to avoid, from --avoid
1039 # - cond_dependencies true if --conditional-dependencies was given, false if
1040 # --no-conditional-dependencies was given, blank otherwise
1041 # - lgpl yes or a number if --lgpl was given, blank otherwise
1042 # - makefile_name from --makefile-name
1043 # - libtool true if --libtool was given, false if --no-libtool was
1044 # given, blank otherwise
1045 # - macro_prefix from --macro-prefix
1046 # - po_domain from --po-domain
1047 # - witness_c_macro from --witness-c-macro
1048 # - vc_files true if --vc-files was given, false if --no-vc-files was
1049 # given, blank otherwise
1050 # - autoconf_minversion minimum supported autoconf version
1051 # - doit : if actions shall be executed, false if only to be printed
1052 # - symbolic true if --symlink or --more-symlinks was given, blank
1054 # - lsymbolic true if --local-symlink was given, blank otherwise
1055 # - do_copyrights blank if --more-symlinks was given, true otherwise
1073 inc_longrunning_tests
=
1074 inc_privileged_tests
=
1075 inc_unportable_tests
=
1078 excl_longrunning_tests
=
1079 excl_privileged_tests
=
1080 excl_unportable_tests
=
1081 single_configure
=false
1098 while test $# -gt 0; do
1103 --find |
--fin |
--fi |
--f )
1106 --import |
--impor |
--impo |
--imp |
--im |
--i )
1109 --add-import |
--add-impor |
--add-impo |
--add-imp |
--add-im |
--add-i |
--add- |
--add |
--ad )
1112 --remove-import |
--remove-impor |
--remove-impo |
--remove-imp |
--remove-im |
--remove-i |
--remove- |
--remove |
--remov |
--remo |
--rem |
--re |
--r )
1115 --update |
--updat |
--upda |
--upd |
--up |
--u )
1118 --create-testdir |
--create-testdi |
--create-testd |
--create-test |
--create-tes |
--create-te |
--create-t )
1121 --create-megatestdir |
--create-megatestdi |
--create-megatestd |
--create-megatest |
--create-megates |
--create-megate |
--create-megat |
--create-mega |
--create-meg |
--create-me |
--create-m )
1122 mode
=create-megatestdir
1124 --test |
--tes |
--te |
--t )
1127 --megatest |
--megates |
--megate |
--megat |
--mega |
--meg |
--me |
--m )
1131 mode
=`echo "X$1" | sed -e 's/^X--//'`
1133 --copy-file |
--copy-fil |
--copy-fi |
--copy-f |
--copy- |
--copy |
--cop )
1138 if test $# = 0; then
1139 func_fatal_error
"missing argument for --dir"
1144 destdir
=`echo "X$1" | sed -e 's/^X--dir=//'`
1148 if test $# = 0; then
1149 func_fatal_error
"missing argument for --local-dir"
1151 func_path_prepend local_gnulib_path
"$1"
1154 local_dir
=`echo "X$1" | sed -e 's/^X--local-dir=//'`
1155 func_path_prepend local_gnulib_path
"$local_dir"
1157 --cache-modules |
--cache-module |
--cache-modul |
--cache-modu |
--cache-mod |
--cache-mo |
--cache-m |
--cache- |
--cache |
--cach |
--cac |
--ca )
1160 --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 )
1163 --verbose |
--verbos |
--verbo |
--verb )
1164 verbose
=`expr $verbose + 1`
1166 --quiet |
--quie |
--qui |
--qu |
--q )
1167 verbose
=`expr $verbose - 1`
1171 if test $# = 0; then
1172 func_fatal_error
"missing argument for --lib"
1175 supplied_libname
=true
1178 libname
=`echo "X$1" | sed -e 's/^X--lib=//'`
1179 supplied_libname
=true
1183 if test $# = 0; then
1184 func_fatal_error
"missing argument for --source-base"
1189 sourcebase
=`echo "X$1" | sed -e 's/^X--source-base=//'`
1193 if test $# = 0; then
1194 func_fatal_error
"missing argument for --m4-base"
1199 m4base
=`echo "X$1" | sed -e 's/^X--m4-base=//'`
1203 if test $# = 0; then
1204 func_fatal_error
"missing argument for --po-base"
1209 pobase
=`echo "X$1" | sed -e 's/^X--po-base=//'`
1213 if test $# = 0; then
1214 func_fatal_error
"missing argument for --doc-base"
1219 docbase
=`echo "X$1" | sed -e 's/^X--doc-base=//'`
1223 if test $# = 0; then
1224 func_fatal_error
"missing argument for --tests-base"
1229 testsbase
=`echo "X$1" | sed -e 's/^X--tests-base=//'`
1233 if test $# = 0; then
1234 func_fatal_error
"missing argument for --aux-dir"
1239 auxdir
=`echo "X$1" | sed -e 's/^X--aux-dir=//'`
1241 --with-tests |
--with-test |
--with-tes |
--with-te |
--with-t)
1244 --with-obsolete |
--with-obsolet |
--with-obsole |
--with-obsol |
--with-obso |
--with-obs |
--with-ob |
--with-o)
1247 --with-c++-tests |
--with-c++-test |
--with-c++-tes |
--with-c++-te |
--with-c++-t |
--with-c++- |
--with-c++ |
--with-c+ |
--with-c)
1250 --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)
1251 inc_longrunning_tests
=true
1253 --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)
1254 inc_privileged_tests
=true
1256 --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)
1257 inc_unportable_tests
=true
1259 --with-all-tests |
--with-all-test |
--with-all-tes |
--with-all-te |
--with-all-t |
--with-all- |
--with-all |
--with-al |
--with-a)
1262 --without-tests |
--without-test |
--without-tes |
--without-te |
--without-t)
1265 --without-c++-tests |
--without-c++-test |
--without-c++-tes |
--without-c++-te |
--without-c++-t |
--without-c++- |
--without-c++ |
--without-c+ |
--without-c)
1268 --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)
1269 excl_longrunning_tests
=true
1271 --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)
1272 excl_privileged_tests
=true
1274 --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)
1275 excl_unportable_tests
=true
1277 --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)
1278 single_configure
=true
1282 if test $# = 0; then
1283 func_fatal_error
"missing argument for --avoid"
1285 func_append avoidlist
" $1"
1288 arg
=`echo "X$1" | sed -e 's/^X--avoid=//'`
1289 func_append avoidlist
" $arg"
1291 --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)
1292 cond_dependencies
=true
1294 --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)
1295 cond_dependencies
=false
1301 arg
=`echo "X$1" | sed -e 's/^X--lgpl=//'`
1303 2 |
3orGPLv2 |
3) ;;
1304 *) func_fatal_error
"invalid LGPL version number for --lgpl" ;;
1310 if test $# = 0; then
1311 func_fatal_error
"missing argument for --makefile-name"
1316 makefile_name
=`echo "X$1" | sed -e 's/^X--makefile-name=//'`
1326 if test $# = 0; then
1327 func_fatal_error
"missing argument for --macro-prefix"
1332 macro_prefix
=`echo "X$1" | sed -e 's/^X--macro-prefix=//'`
1336 if test $# = 0; then
1337 func_fatal_error
"missing argument for --po-domain"
1342 po_domain
=`echo "X$1" | sed -e 's/^X--po-domain=//'`
1346 if test $# = 0; then
1347 func_fatal_error
"missing argument for --witness-c-macro"
1349 witness_c_macro
="$1"
1351 --witness-c-macro=* )
1352 witness_c_macro
=`echo "X$1" | sed -e 's/^X--witness-c-macro=//'`
1360 --no-changelog |
--no-changelo |
--no-changel |
--no-change |
--no-chang |
--no-chan |
--no-cha |
--no-ch )
1361 # A no-op for backward compatibility.
1366 -s |
--symbolic |
--symboli |
--symbol |
--symbo |
--symb |
--symlink |
--symlin |
--symli |
--syml |
--sym |
--sy )
1369 --local-symlink |
--local-symlin |
--local-symli |
--local-syml |
--local-sym |
--local-sy |
--local-s )
1372 -S |
--more-symlinks |
--more-symlink |
--more-symlin |
--more-symli |
--more-syml |
--more-sym |
--more-sy |
--more-s |
--more- |
--more |
--mor |
--mo )
1376 --help |
--hel |
--he |
--h )
1379 --version |
--versio |
--versi |
--vers )
1383 # Stop option processing
1387 echo "gnulib-tool: unknown option $1" 1>&2
1388 echo "Try 'gnulib-tool --help' for more information." 1>&2
1395 if case "$mode" in import | add-import | remove-import
) true
;; *) false
;; esac; then
1396 if test -n "$excl_cxx_tests" ||
test -n "$excl_longrunning_tests" \
1397 ||
test -n "$excl_privileged_tests" ||
test -n "$excl_unportable_tests" \
1398 ||
test "$single_configure" != false
; then
1399 echo "gnulib-tool: invalid options for '$mode' mode" 1>&2
1400 echo "Try 'gnulib-tool --help' for more information." 1>&2
1404 if test "$mode" = update
; then
1405 if test $# != 0; then
1406 echo "gnulib-tool: too many arguments in 'update' mode" 1>&2
1407 echo "Try 'gnulib-tool --help' for more information." 1>&2
1408 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1409 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1412 if test -n "$local_gnulib_path" ||
test -n "$supplied_libname" \
1413 ||
test -n "$sourcebase" ||
test -n "$m4base" ||
test -n "$pobase" \
1414 ||
test -n "$docbase" ||
test -n "$testsbase" ||
test -n "$auxdir" \
1415 ||
test -n "$inctests" ||
test -n "$incobsolete" \
1416 ||
test -n "$inc_cxx_tests" ||
test -n "$inc_longrunning_tests" \
1417 ||
test -n "$inc_privileged_tests" ||
test -n "$inc_unportable_tests" \
1418 ||
test -n "$inc_all_tests" \
1419 ||
test -n "$excl_cxx_tests" ||
test -n "$excl_longrunning_tests" \
1420 ||
test -n "$excl_privileged_tests" ||
test -n "$excl_unportable_tests" \
1421 ||
test -n "$avoidlist" ||
test -n "$lgpl" ||
test -n "$makefile_name" \
1422 ||
test -n "$macro_prefix" ||
test -n "$po_domain" \
1423 ||
test -n "$witness_c_macro" ||
test -n "$vc_files"; then
1424 echo "gnulib-tool: invalid options for 'update' mode" 1>&2
1425 echo "Try 'gnulib-tool --help' for more information." 1>&2
1426 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1427 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1431 if test -n "$pobase" && test -z "$po_domain"; then
1432 echo "gnulib-tool: together with --po-base, you need to specify --po-domain" 1>&2
1433 echo "Try 'gnulib-tool --help' for more information." 1>&2
1436 if test -z "$pobase" && test -n "$po_domain"; then
1437 func_warning
"--po-domain has no effect without a --po-base option"
1439 # Canonicalize the inctests variable.
1441 import | add-import | remove-import | update
)
1442 if test -z "$inctests"; then
1446 create-testdir | create-megatestdir |
test | megatest
)
1447 if test -z "$inctests"; then
1452 # Now the only possible values of "$inctests" are true and false
1453 # (or blank but then it is irrelevant).
1454 if test "$cond_dependencies" = true
&& test "$inctests" = true
; then
1455 echo "gnulib-tool: option --conditional-dependencies is not supported with --with-tests" 1>&2
1459 # Determine the minimum supported autoconf version from the project's
1461 DEFAULT_AUTOCONF_MINVERSION
="2.59"
1462 autoconf_minversion
=
1464 if case "$mode" in import | add-import | remove-import | update
) true
;; *) false
;; esac \
1465 && test -n "$destdir"; then
1466 if test -f "$destdir"/configure.ac
; then
1467 configure_ac
="$destdir/configure.ac"
1469 if test -f "$destdir"/configure.
in; then
1470 configure_ac
="$destdir/configure.in"
1474 if test -f configure.ac
; then
1475 configure_ac
="configure.ac"
1477 if test -f configure.
in; then
1478 configure_ac
="configure.in"
1482 if test -n "$configure_ac"; then
1483 # Use sed, not autoconf --trace, to look for the AC_PREREQ invocation,
1484 # because when some m4 files are omitted from a version control repository,
1485 # "autoconf --trace=AC_PREREQ" fails with an error message like this:
1486 # m4: aclocal.m4:851: Cannot open m4/absolute-header.m4: No such file or directory
1487 # autom4te: m4 failed with exit status: 1
1494 s,^.*AC_PREREQ([[ ]*\([^])]*\).*$,\1,p
1496 prereqs
=`sed -n -e "$my_sed_traces" < "$configure_ac"`
1497 if test -n "$prereqs"; then
1498 autoconf_minversion
=`
1499 for version in $prereqs; do echo $version; done |
1500 LC_ALL=C sort -nru | sed -e 1q
1504 if test -z "$autoconf_minversion"; then
1505 autoconf_minversion
=$DEFAULT_AUTOCONF_MINVERSION
1507 case "$autoconf_minversion" in
1508 1.
* |
2.
[0-4]* |
2.5[0-8]*)
1509 func_fatal_error
"minimum supported autoconf version is 2.59. Try adding AC_PREREQ([$DEFAULT_AUTOCONF_MINVERSION]) to your configure.ac." ;;
1512 # Remove trailing slashes from the directory names. This is necessary for
1513 # m4base (to avoid an error in func_import) and optional for the others.
1514 sed_trimtrailingslashes
='s,\([^/]\)//*$,\1,'
1515 old_local_gnulib_path
=$local_gnulib_path
1519 for dir
in $old_local_gnulib_path
1522 */ ) dir
=`echo "$dir" | sed -e "$sed_trimtrailingslashes"` ;;
1524 func_path_append local_gnulib_path
"$dir"
1527 case "$sourcebase" in
1528 */ ) sourcebase
=`echo "$sourcebase" | sed -e "$sed_trimtrailingslashes"` ;;
1531 */ ) m4base
=`echo "$m4base" | sed -e "$sed_trimtrailingslashes"` ;;
1534 */ ) pobase
=`echo "$pobase" | sed -e "$sed_trimtrailingslashes"` ;;
1537 */ ) docbase
=`echo "$docbase" | sed -e "$sed_trimtrailingslashes"` ;;
1539 case "$testsbase" in
1540 */ ) testsbase
=`echo "$testsbase" | sed -e "$sed_trimtrailingslashes"` ;;
1543 */ ) auxdir
=`echo "$auxdir" | sed -e "$sed_trimtrailingslashes"` ;;
1549 trap 'exit_status=$?
1550 if test "$signal" != 0; then
1551 echo "caught signal $signal" >&2
1554 exit $exit_status' 0
1555 for signal
in 1 2 3 13 15; do
1556 trap '{ signal='$signal'; func_exit 1; }' $signal
1560 # Note: The 'eval' silences stderr output in dash.
1561 if (declare -A x
&& { x
[f
/2]='foo'; x
[f
/3]='bar'; eval test '${x[f/2]}' = foo
; }) 2>/dev
/null
; then
1562 # Zsh 4 and Bash 4 have associative arrays.
1563 have_associative
=true
1565 # For other shells, use 'eval' with computed shell variable names.
1566 have_associative
=false
1569 # func_lookup_local_file_cb dir file
1570 # return true and set func_lookup_local_file_result if the file 'dir/file'
1572 func_lookup_local_file_cb
()
1574 test -n "$func_lookup_local_file_result" && return 1 # already found?
1575 test -f "$1/$2" ||
return 1
1576 func_lookup_local_file_result
=$1/$2
1580 # func_lookup_local_file file
1581 # looks up a file in $local_gnulib_path.
1583 # - local_gnulib_path from --local-dir
1585 # - func_lookup_local_file_result name of the file, valid only when the
1586 # function succeeded.
1587 func_lookup_local_file
()
1589 func_lookup_local_file_result
=
1590 func_path_foreach
"$local_gnulib_path" func_lookup_local_file_cb
%dir
% "$1"
1593 # func_lookup_file file
1594 # looks up a file in $local_gnulib_path or $gnulib_dir, or combines it through
1597 # - local_gnulib_path from --local-dir
1599 # - lookedup_file name of the merged (combined) file
1600 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
1604 if func_lookup_local_file
"$lkfile"; then
1605 lookedup_file
=$func_lookup_local_file_result
1608 if test -f "$gnulib_dir/$lkfile"; then
1609 if func_lookup_local_file
"$lkfile.diff"; then
1610 lkbase
=`echo "$lkfile" | sed -e 's,^.*/,,'`
1611 rm -f "$tmp/$lkbase"
1612 cp "$gnulib_dir/$lkfile" "$tmp/$lkbase"
1613 patch -s "$tmp/$lkbase" < "$func_lookup_local_file_result" >&2 \
1614 || func_fatal_error
"patch file $func_lookup_local_file_result didn't apply cleanly"
1615 lookedup_file
="$tmp/$lkbase"
1618 lookedup_file
="$gnulib_dir/$lkfile"
1622 func_fatal_error
"file $gnulib_dir/$lkfile not found"
1627 # func_sanitize_modulelist
1628 # receives a list of possible module names on standard input, one per line.
1629 # It removes those which are just file names unrelated to modules, and outputs
1630 # the resulting list to standard output, one per line.
1631 func_sanitize_modulelist
()
1633 sed -e '/^ChangeLog$/d' -e '/\/ChangeLog$/d' \
1634 -e '/^COPYING$/d' -e '/\/COPYING$/d' \
1635 -e '/^README$/d' -e '/\/README$/d' \
1636 -e '/^TEMPLATE$/d' \
1637 -e '/^TEMPLATE-EXTENDED$/d' \
1638 -e '/^TEMPLATE-TESTS$/d' \
1644 # func_modules_in_dir dir
1645 # outputs all module files in dir to standard output.
1646 func_modules_in_dir
()
1648 (test -d "$1" && cd "$1" && find modules
-type f
-print)
1653 # - local_gnulib_path from --local-dir
1656 # Filter out metainformation files like README, which are not modules.
1657 # Filter out unit test modules; they can be retrieved through
1658 # --extract-tests-module if desired.
1660 (cd "$gnulib_dir" && find modules
-type f
-print |
sed -e 's,^modules/,,')
1661 func_path_foreach
"$local_gnulib_path" func_modules_in_dir
%dir
% |
sed -e 's,^modules/,,' -e 's,\.diff$,,'
1663 | func_sanitize_modulelist \
1664 |
sed -e '/-tests$/d' \
1668 # func_exists_local_module dir module
1669 # returns true if module exists in dir
1670 func_exists_local_module
()
1672 test -d "$1/modules" && test -f "$1/modules/$2";
1675 # func_exists_module module
1676 # tests whether a module, given by name, exists
1678 # - local_gnulib_path from --local-dir
1679 func_exists_module
()
1681 { test -f "$gnulib_dir/modules/$1" \
1682 || func_path_foreach
"$local_gnulib_path" func_exists_local_module
%dir
% "$1" ; } \
1683 && test "ChangeLog" != "$1" \
1684 && test "COPYING" != "$1" \
1685 && test "README" != "$1" \
1686 && test "TEMPLATE" != "$1" \
1687 && test "TEMPLATE-EXTENDED" != "$1" \
1688 && test "TEMPLATE-TESTS" != "$1"
1691 # func_verify_module
1692 # verifies a module name
1694 # - local_gnulib_path from --local-dir
1695 # - module module name argument
1696 func_verify_module
()
1698 if func_exists_module
"$module"; then
1699 # OK, $module is a correct module name.
1700 # Verify that building the module description with 'patch' succeeds.
1701 func_lookup_file
"modules/$module"
1703 func_warning
"module $module doesn't exist"
1708 # func_verify_nontests_module
1709 # verifies a module name, excluding tests modules
1711 # - local_gnulib_path from --local-dir
1712 # - module module name argument
1713 func_verify_nontests_module
()
1716 *-tests ) module
= ;;
1717 * ) func_verify_module
;;
1721 # func_verify_tests_module
1722 # verifies a module name, considering only tests modules
1724 # - local_gnulib_path from --local-dir
1725 # - module module name argument
1726 func_verify_tests_module
()
1729 *-tests ) func_verify_module
;;
1734 # Suffix of a sed expression that extracts a particular field from a
1735 # module description.
1736 # A field starts with a line that contains a keyword, such as 'Description',
1737 # followed by a colon and optional whitespace. All following lines, up to
1738 # the next field (or end of file if there is none) form the contents of the
1740 # An absent field is equivalent to a field with empty contents.
1741 # NOTE: Keep this in sync with sed_extract_cache_prog below!
1742 sed_extract_prog
=':[ ]*$/ {
1745 s/^Description:[ ]*$//
1749 s/^Applicability:[ ]*$//
1751 s/^Depends-on:[ ]*$//
1752 s/^configure\.ac-early:[ ]*$//
1753 s/^configure\.ac:[ ]*$//
1754 s/^Makefile\.am:[ ]*$//
1758 s/^Maintainer:[ ]*$//
1765 # Piece of a sed expression that converts a field header line to a shell
1767 # NOTE: Keep this in sync with sed_extract_prog above!
1768 sed_extract_field_header
='
1769 s/^Description:[ ]*$/description/
1770 s/^Comment:[ ]*$/comment/
1771 s/^Status:[ ]*$/status/
1772 s/^Notice:[ ]*$/notice/
1773 s/^Applicability:[ ]*$/applicability/
1774 s/^Files:[ ]*$/files/
1775 s/^Depends-on:[ ]*$/dependson/
1776 s/^configure\.ac-early:[ ]*$/configureac_early/
1777 s/^configure\.ac:[ ]*$/configureac/
1778 s/^Makefile\.am:[ ]*$/makefile/
1779 s/^Include:[ ]*$/include/
1781 s/^License:[ ]*$/license/
1782 s/^Maintainer:[ ]*$/maintainer/'
1786 if $have_associative; then
1788 # Declare the associative arrays.
1789 declare -A modcache_cached
1790 sed_to_declare_statement
='s|^.*/\([a-zA-Z0-9_]*\)/$|declare -A modcache_\1|p'
1791 declare_script
=`echo "$sed_extract_field_header" | sed -n -e "$sed_to_declare_statement"`
1792 eval "$declare_script"
1796 # func_cache_var module
1797 # computes the cache variable name corresponding to $module.
1798 # Note: This computation can map different module names to the same
1799 # cachevar (such as 'foo-bar', 'foo_bar', or 'foo/bar'); the caller has
1800 # to protect against this case.
1802 # - cachevar a shell variable name
1803 if (f
=foo
; eval echo '${f//o/e}') < /dev
/null
2>/dev
/null |
grep fee
>/dev
/null
; then
1804 # Bash 2.0 and newer, ksh, and zsh support the syntax
1805 # ${param//pattern/replacement}
1806 # as a shorthand for
1807 # `echo "$param" | sed -e "s/pattern/replacement/g"`.
1808 # Note: The 'eval' is necessary for dash and NetBSD /bin/sh.
1809 eval 'func_cache_var ()
1811 cachevar=c_${1//[!a-zA-Z0-9_]/_}
1818 cachevar
=c_
`echo "$1" | LC_ALL=C sed -e 's/[^a-zA-Z0-9_]/_/g'` ;;
1827 # func_init_sed_convert_to_cache_statements
1829 # - modcachevar_assignment
1831 # - sed_convert_to_cache_statements
1832 func_init_sed_convert_to_cache_statements
()
1834 # 'sed' script that turns a module description into shell script
1835 # assignments, suitable to be eval'ed. All active characters are escaped.
1838 # Some module's description
1843 # modcache_description[$1]=\
1844 # 'Some module'"'"'s description
1846 # modcache_files[$1]=\
1849 # c_MODULE_description_set=set; c_MODULE_description=\
1850 # 'Some module'"'"'s description
1852 # c_MODULE_files_set=set; c_MODULE_files=\
1854 # The script consists of two parts:
1855 # 1) Ignore the lines before the first field header.
1856 # 2) A loop, treating non-field-header lines by escaping single quotes
1857 # and adding a closing quote in the last line,
1858 sed_convert_to_cache_statements
="
1860 # Here we have not yet seen a field header.
1862 # See if the current line contains a field header.
1865 ${sed_extract_field_header}
1868 # No field header. Ignore the line.
1870 # Read the next line. Upon EOF, just exit.
1875 # The current line contains a field header.
1877 # Turn it into the beginning of an assignment.
1878 s/^\\(.*\\)\$/${modcachevar_assignment}\\\\/
1880 # Move it to the hold space. Don't print it yet,
1881 # because we want no assignment if the field is empty.
1884 # Read the next line.
1885 # Upon EOF, the field was empty. Print no assignment. Just exit.
1888 # See if the current line contains a field header.
1891 ${sed_extract_field_header}
1892 # If it is, the previous field was empty. Print no assignment.
1895 # Not a field header.
1897 # Print the previous line, held in the hold space.
1902 # Transform single quotes.
1905 # Prepend a single quote.
1910 # Move it to the hold space.
1913 # Read the next line.
1920 # See if the current line contains a field header.
1923 ${sed_extract_field_header}
1926 # Print the previous line, held in the hold space.
1931 # Transform single quotes.
1938 # Print the previous line, held in the hold space, with a single quote
1939 # to end the assignment.
1949 # Print the previous line, held in the hold space, with a single quote
1950 # to end the assignment.
1957 if ! $sed_comments; then
1959 sed_convert_to_cache_statements
=`echo "$sed_convert_to_cache_statements" \
1960 | sed -e 's/^ *//' -e 's/^#.*//'`
1964 if $have_associative; then
1965 # sed_convert_to_cache_statements does not depend on the module.
1966 modcachevar_assignment
='modcache_\1[$1]='
1967 func_init_sed_convert_to_cache_statements
1970 # func_cache_lookup_module module
1972 # looks up a module, like 'func_lookup_file modules/$module', and stores all
1973 # of its relevant data in a cache in the memory of the processing shell. If
1974 # already cached, it does not look it up again, thus saving file access time.
1976 # - module non-empty string
1977 # Output if $have_associative:
1978 # - modcache_cached[$module] set to yes
1979 # - modcache_description[$module] ==
1980 # - modcache_status[$module] \ set to the field's value, minus the
1981 # - ... / final newline,
1982 # - modcache_maintainer[$module] == or unset if the field's value is empty
1983 # Output if ! $have_associative:
1984 # - cachevar a shell variable name
1985 # - ${cachevar}_cached set to $module
1986 # - ${cachevar}_description ==
1987 # - ${cachevar}_status \ set to the field's value, minus the
1988 # - ... / final newline,
1989 # - ${cachevar}_maintainer == or unset if the field's value is empty
1990 # - ${cachevar}_description_set ==
1991 # - ${cachevar}_status_set \ set to non-empty if the field's value
1992 # - ... / is non-empty,
1993 # - ${cachevar}_maintainer_set == or unset if the field's value is empty
1994 func_cache_lookup_module
()
1996 if $have_associative; then
1997 eval 'cached=${modcache_cached[$1]}'
2000 eval "cached=\"\$${cachevar}_cached\""
2002 if test -z "$cached"; then
2003 # Not found in cache. Look it up on the file system.
2004 func_lookup_file
"modules/$1"
2005 if $have_associative; then
2006 eval 'modcache_cached[$1]=yes'
2008 eval "${cachevar}_cached=\"\$1\""
2010 if ! $have_associative; then
2011 # sed_convert_to_cache_statements depends on the module.
2012 modcachevar_assignment
="${cachevar}"'_\1_set=set; '"${cachevar}"'_\1='
2013 func_init_sed_convert_to_cache_statements
2015 cache_statements
=`LC_ALL=C sed -n -e "$sed_convert_to_cache_statements" < "$lookedup_file"`
2016 eval "$cache_statements"
2018 if ! $have_associative; then
2019 if test "$1" != "$cached"; then
2020 func_fatal_error
"cache variable collision between $1 and $cached"
2028 # func_get_description module
2030 # - local_gnulib_path from --local-dir
2031 # - modcache true or false, from --cache-modules/--no-cache-modules
2032 func_get_description
()
2034 if ! $modcache; then
2035 func_lookup_file
"modules/$1"
2036 sed -n -e "/^Description$sed_extract_prog" < "$lookedup_file"
2038 func_cache_lookup_module
"$1"
2039 # Output the field's value, including the final newline (if any).
2040 if $have_associative; then
2041 if eval 'test -n "${modcache_description[$1]+set}"'; then
2042 eval 'echo "${modcache_description[$1]}"'
2045 eval "field_set=\"\$${cachevar}_description_set\""
2046 if test -n "$field_set"; then
2047 eval "field_value=\"\$${cachevar}_description\""
2048 echo "${field_value}"
2054 # func_get_comment module
2056 # - local_gnulib_path from --local-dir
2057 # - modcache true or false, from --cache-modules/--no-cache-modules
2060 if ! $modcache; then
2061 func_lookup_file
"modules/$1"
2062 sed -n -e "/^Comment$sed_extract_prog" < "$lookedup_file"
2064 func_cache_lookup_module
"$1"
2065 # Output the field's value, including the final newline (if any).
2066 if $have_associative; then
2067 if eval 'test -n "${modcache_comment[$1]+set}"'; then
2068 eval 'echo "${modcache_comment[$1]}"'
2071 eval "field_set=\"\$${cachevar}_comment_set\""
2072 if test -n "$field_set"; then
2073 eval "field_value=\"\$${cachevar}_comment\""
2074 echo "${field_value}"
2080 # func_get_status module
2082 # - local_gnulib_path from --local-dir
2083 # - modcache true or false, from --cache-modules/--no-cache-modules
2086 if ! $modcache; then
2087 func_lookup_file
"modules/$1"
2088 sed -n -e "/^Status$sed_extract_prog" < "$lookedup_file"
2090 func_cache_lookup_module
"$1"
2091 # Output the field's value, including the final newline (if any).
2092 if $have_associative; then
2093 if eval 'test -n "${modcache_status[$1]+set}"'; then
2094 eval 'echo "${modcache_status[$1]}"'
2097 eval "field_set=\"\$${cachevar}_status_set\""
2098 if test -n "$field_set"; then
2099 eval "field_value=\"\$${cachevar}_status\""
2100 echo "${field_value}"
2106 # func_get_notice module
2108 # - local_gnulib_path from --local-dir
2109 # - modcache true or false, from --cache-modules/--no-cache-modules
2112 if ! $modcache; then
2113 func_lookup_file
"modules/$1"
2114 sed -n -e "/^Notice$sed_extract_prog" < "$lookedup_file"
2116 func_cache_lookup_module
"$1"
2117 # Output the field's value, including the final newline (if any).
2118 if $have_associative; then
2119 if eval 'test -n "${modcache_notice[$1]+set}"'; then
2120 eval 'echo "${modcache_notice[$1]}"'
2123 eval "field_set=\"\$${cachevar}_notice_set\""
2124 if test -n "$field_set"; then
2125 eval "field_value=\"\$${cachevar}_notice\""
2126 echo "${field_value}"
2132 # func_get_applicability module
2134 # - local_gnulib_path from --local-dir
2135 # - modcache true or false, from --cache-modules/--no-cache-modules
2136 # The expected result (on stdout) is either 'main', or 'tests', or 'all'.
2137 func_get_applicability
()
2139 if ! $modcache; then
2140 func_lookup_file
"modules/$1"
2141 my_applicability
=`sed -n -e "/^Applicability$sed_extract_prog" < "$lookedup_file"`
2143 func_cache_lookup_module
"$1"
2144 # Get the field's value, without the final newline.
2145 if $have_associative; then
2146 eval 'my_applicability="${modcache_applicability[$1]}"'
2148 eval "my_applicability=\"\$${cachevar}_applicability\""
2151 if test -n "$my_applicability"; then
2152 echo $my_applicability
2154 # The default is 'main' or 'tests', depending on the module's name.
2156 *-tests) echo "tests";;
2162 # func_get_filelist module
2164 # - local_gnulib_path from --local-dir
2165 # - modcache true or false, from --cache-modules/--no-cache-modules
2166 func_get_filelist
()
2168 if ! $modcache; then
2169 func_lookup_file
"modules/$1"
2170 sed -n -e "/^Files$sed_extract_prog" < "$lookedup_file"
2172 func_cache_lookup_module
"$1"
2173 # Output the field's value, including the final newline (if any).
2174 if $have_associative; then
2175 if eval 'test -n "${modcache_files[$1]+set}"'; then
2176 eval 'echo "${modcache_files[$1]}"'
2179 eval "field_set=\"\$${cachevar}_files_set\""
2180 if test -n "$field_set"; then
2181 eval "field_value=\"\$${cachevar}_files\""
2182 echo "${field_value}"
2187 echo m
4/gnulib-common.
m4
2188 case "$autoconf_minversion" in
2195 # func_filter_filelist outputvar separator filelist prefix suffix removed_prefix removed_suffix [added_prefix [added_suffix]]
2196 # stores in outputvar the filtered and processed filelist. Filtering: Only the
2197 # elements starting with prefix and ending with suffix are considered.
2198 # Processing: removed_prefix and removed_suffix are removed from each element,
2199 # added_prefix and added_suffix are added to each element.
2200 # prefix, suffix should not contain shell-special characters.
2201 # removed_prefix, removed_suffix should not contain the characters "$`\{}[]^|.
2202 # added_prefix, added_suffix should not contain the characters \|&.
2203 func_filter_filelist
()
2205 if test "$2" != "$nl" \
2206 ||
{ $fast_func_append \
2207 && { test -z "$6" ||
$fast_func_remove_prefix; } \
2208 && { test -z "$7" ||
$fast_func_remove_suffix; }; \
2212 # Do not quote possibly-empty parameters in case patterns,
2213 # AIX and HP-UX ksh won't match them if they are empty.
2216 if test -n "$6"; then
2217 func_remove_prefix fff
"$6"
2219 if test -n "$7"; then
2220 func_remove_suffix fff
"$7"
2223 if test -z "$ffflist"; then
2226 func_append ffflist
"$2${fff}"
2232 sed_fff_filter
="s|^$6\(.*\)$7\$|$8\\1$9|"
2233 ffflist
=`for fff in $3; do
2235 $4*$5) echo "$fff" ;;
2237 done | sed -e "$sed_fff_filter"`
2239 eval "$1=\"\$ffflist\""
2242 # func_get_dependencies module
2244 # - local_gnulib_path from --local-dir
2245 # - modcache true or false, from --cache-modules/--no-cache-modules
2246 func_get_dependencies
()
2248 # ${module}-tests implicitly depends on ${module}, if that module exists.
2252 func_remove_suffix fgd1
'-tests'
2253 if func_exists_module
"$fgd1"; then
2258 # Then the explicit dependencies listed in the module description.
2259 { if ! $modcache; then
2260 func_lookup_file
"modules/$1"
2261 sed -n -e "/^Depends-on$sed_extract_prog" < "$lookedup_file"
2263 func_cache_lookup_module
"$1"
2264 # Output the field's value, including the final newline (if any).
2265 if $have_associative; then
2266 if eval 'test -n "${modcache_dependson[$1]+set}"'; then
2267 eval 'echo "${modcache_dependson[$1]}"'
2270 eval "field_set=\"\$${cachevar}_dependson_set\""
2271 if test -n "$field_set"; then
2272 eval "field_value=\"\$${cachevar}_dependson\""
2273 echo "${field_value}"
2281 # func_get_autoconf_early_snippet module
2283 # - local_gnulib_path from --local-dir
2284 # - modcache true or false, from --cache-modules/--no-cache-modules
2285 func_get_autoconf_early_snippet
()
2287 if ! $modcache; then
2288 func_lookup_file
"modules/$1"
2289 sed -n -e "/^configure\.ac-early$sed_extract_prog" < "$lookedup_file"
2291 func_cache_lookup_module
"$1"
2292 # Output the field's value, including the final newline (if any).
2293 if $have_associative; then
2294 if eval 'test -n "${modcache_configureac_early[$1]+set}"'; then
2295 eval 'echo "${modcache_configureac_early[$1]}"'
2298 eval "field_set=\"\$${cachevar}_configureac_early_set\""
2299 if test -n "$field_set"; then
2300 eval "field_value=\"\$${cachevar}_configureac_early\""
2301 echo "${field_value}"
2307 # func_get_autoconf_snippet module
2309 # - local_gnulib_path from --local-dir
2310 # - modcache true or false, from --cache-modules/--no-cache-modules
2311 func_get_autoconf_snippet
()
2313 if ! $modcache; then
2314 func_lookup_file
"modules/$1"
2315 sed -n -e "/^configure\.ac$sed_extract_prog" < "$lookedup_file"
2317 func_cache_lookup_module
"$1"
2318 # Output the field's value, including the final newline (if any).
2319 if $have_associative; then
2320 if eval 'test -n "${modcache_configureac[$1]+set}"'; then
2321 eval 'echo "${modcache_configureac[$1]}"'
2324 eval "field_set=\"\$${cachevar}_configureac_set\""
2325 if test -n "$field_set"; then
2326 eval "field_value=\"\$${cachevar}_configureac\""
2327 echo "${field_value}"
2333 # Concatenate lines with trailing slash.
2334 # $1 is an optional filter to restrict the
2335 # concatenation to groups starting with that expression
2337 sed -e "/$1.*"'\\$/{
2346 # func_get_automake_snippet_conditional module
2347 # returns the part of the Makefile.am snippet that can be put inside Automake
2350 # - local_gnulib_path from --local-dir
2351 # - modcache true or false, from --cache-modules/--no-cache-modules
2352 func_get_automake_snippet_conditional
()
2354 if ! $modcache; then
2355 func_lookup_file
"modules/$1"
2356 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
2358 func_cache_lookup_module
"$1"
2359 # Output the field's value, including the final newline (if any).
2360 if $have_associative; then
2361 if eval 'test -n "${modcache_makefile[$1]+set}"'; then
2362 eval 'echo "${modcache_makefile[$1]}"'
2365 eval "field_set=\"\$${cachevar}_makefile_set\""
2366 if test -n "$field_set"; then
2367 eval "field_value=\"\$${cachevar}_makefile\""
2368 echo "${field_value}"
2374 # func_get_automake_snippet_unconditional module
2375 # returns the part of the Makefile.am snippet that must stay outside of
2376 # Automake conditionals.
2378 # - local_gnulib_path from --local-dir
2379 # - modcache true or false, from --cache-modules/--no-cache-modules
2380 func_get_automake_snippet_unconditional
()
2384 # *-tests module live in tests/, not lib/.
2385 # Synthesize an EXTRA_DIST augmentation.
2386 all_files
=`func_get_filelist $1`
2387 func_filter_filelist tests_files
" " "$all_files" 'tests/' '' 'tests/' ''
2388 extra_files
="$tests_files"
2389 if test -n "$extra_files"; then
2390 echo "EXTRA_DIST +=" $extra_files
2395 # Synthesize an EXTRA_DIST augmentation.
2396 sed_extract_mentioned_files
='s/^lib_SOURCES[ ]*+=[ ]*//p'
2397 already_mentioned_files
=` \
2398 { if ! $modcache; then
2399 func_lookup_file "modules/$1"
2400 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
2402 func_cache_lookup_module "$1"
2403 if $have_associative; then
2404 if eval 'test -n "${modcache_makefile[$1]+set}"'; then
2405 eval 'echo "${modcache_makefile[$1]}"'
2408 eval 'field_set="$'"${cachevar}"'_makefile_set"'
2409 if test -n "$field_set"; then
2410 eval 'field_value="$'"${cachevar}"'_makefile"'
2411 echo "${field_value}"
2417 | sed -n -e "$sed_extract_mentioned_files" | sed -e 's/#.*//'`
2418 all_files
=`func_get_filelist $1`
2419 func_filter_filelist lib_files
"$nl" "$all_files" 'lib/' '' 'lib/' ''
2420 # Remove $already_mentioned_files from $lib_files.
2421 echo "$lib_files" | LC_ALL
=C
sort -u > "$tmp"/lib-files
2422 extra_files
=`for f in $already_mentioned_files; do echo $f; done \
2423 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/lib-files`
2424 if test -n "$extra_files"; then
2425 echo "EXTRA_DIST +=" $extra_files
2428 # Synthesize also an EXTRA_lib_SOURCES augmentation.
2429 # This is necessary so that automake can generate the right list of
2431 # A possible approach would be to use autom4te --trace of the redefined
2432 # AC_LIBOBJ and AC_REPLACE_FUNCS macros when creating the Makefile.am
2433 # (use autom4te --trace, not just grep, so that AC_LIBOBJ invocations
2434 # inside autoconf's built-in macros are not missed).
2435 # But it's simpler and more robust to do it here, based on the file list.
2436 # If some .c file exists and is not used with AC_LIBOBJ - for example,
2437 # a .c file is preprocessed into another .c file for BUILT_SOURCES -,
2438 # automake will generate a useless dependency; this is harmless.
2440 relocatable-prog-wrapper
) ;;
2443 func_filter_filelist extra_files
"$nl" "$extra_files" '' '.c' '' ''
2444 if test -n "$extra_files"; then
2445 echo "EXTRA_lib_SOURCES +=" $extra_files
2450 # Synthesize an EXTRA_DIST augmentation also for the files in build-aux/.
2451 func_filter_filelist buildaux_files
"$nl" "$all_files" 'build-aux/' '' 'build-aux/' ''
2452 if test -n "$buildaux_files"; then
2453 sed_prepend_auxdir
='s,^,$(top_srcdir)/'"$auxdir"'/,'
2454 echo "EXTRA_DIST += "`echo "$buildaux_files" | sed -e "$sed_prepend_auxdir"`
2457 # Synthesize an EXTRA_DIST augmentation also for the files from top/.
2458 func_filter_filelist top_files
"$nl" "$all_files" 'top/' '' 'top/' ''
2459 if test -n "$top_files"; then
2460 sed_prepend_topdir
='s,^,$(top_srcdir)/,'
2461 echo "EXTRA_DIST += "`echo "$top_files" | sed -e "$sed_prepend_topdir"`
2468 # func_get_automake_snippet module
2470 # - local_gnulib_path from --local-dir
2471 # - modcache true or false, from --cache-modules/--no-cache-modules
2472 func_get_automake_snippet
()
2474 func_get_automake_snippet_conditional
"$1"
2475 func_get_automake_snippet_unconditional
"$1"
2478 # func_get_include_directive module
2480 # - local_gnulib_path from --local-dir
2481 # - modcache true or false, from --cache-modules/--no-cache-modules
2482 func_get_include_directive
()
2485 if ! $modcache; then
2486 func_lookup_file
"modules/$1"
2487 sed -n -e "/^Include$sed_extract_prog" < "$lookedup_file"
2489 func_cache_lookup_module
"$1"
2490 # Output the field's value, including the final newline (if any).
2491 if $have_associative; then
2492 if eval 'test -n "${modcache_include[$1]+set}"'; then
2493 eval 'echo "${modcache_include[$1]}"'
2496 eval "field_set=\"\$${cachevar}_include_set\""
2497 if test -n "$field_set"; then
2498 eval "field_value=\"\$${cachevar}_include\""
2499 echo "${field_value}"
2503 } |
sed -e 's/^\(["<]\)/#include \1/'
2506 # func_get_link_directive module
2508 # - local_gnulib_path from --local-dir
2509 # - modcache true or false, from --cache-modules/--no-cache-modules
2510 func_get_link_directive
()
2512 if ! $modcache; then
2513 func_lookup_file
"modules/$1"
2514 sed -n -e "/^Link$sed_extract_prog" < "$lookedup_file"
2516 func_cache_lookup_module
"$1"
2517 # Output the field's value, including the final newline (if any).
2518 if $have_associative; then
2519 if eval 'test -n "${modcache_link[$1]+set}"'; then
2520 eval 'echo "${modcache_link[$1]}"'
2523 eval "field_set=\"\$${cachevar}_link_set\""
2524 if test -n "$field_set"; then
2525 eval "field_value=\"\$${cachevar}_link\""
2526 echo "${field_value}"
2532 # func_get_license_raw module
2534 # - local_gnulib_path from --local-dir
2535 # - modcache true or false, from --cache-modules/--no-cache-modules
2536 func_get_license_raw
()
2538 if ! $modcache; then
2539 func_lookup_file
"modules/$1"
2540 sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
2542 func_cache_lookup_module
"$1"
2543 # Output the field's value, including the final newline (if any).
2544 if $have_associative; then
2545 if eval 'test -n "${modcache_license[$1]+set}"'; then
2546 eval 'echo "${modcache_license[$1]}"'
2549 eval "field_set=\"\$${cachevar}_license_set\""
2550 if test -n "$field_set"; then
2551 eval "field_value=\"\$${cachevar}_license\""
2552 echo "${field_value}"
2558 # func_get_license module
2560 # - local_gnulib_path from --local-dir
2561 # - modcache true or false, from --cache-modules/--no-cache-modules
2564 # Warn if the License field is missing.
2568 license
=`func_get_license_raw "$1"`
2569 if test -z "$license"; then
2570 func_warning
"module $1 lacks a License"
2576 # These modules are under a weaker license only for the purpose of some
2577 # users who hand-edit it and don't use gnulib-tool. For the regular
2578 # gnulib users they are under a stricter license.
2583 func_get_license_raw
"$1"
2584 # The default is GPL.
2586 } |
sed -e 's,^ *$,,' |
sed -e 1q
2591 # func_get_maintainer module
2593 # - local_gnulib_path from --local-dir
2594 # - modcache true or false, from --cache-modules/--no-cache-modules
2595 func_get_maintainer
()
2597 if ! $modcache; then
2598 func_lookup_file
"modules/$1"
2599 sed -n -e "/^Maintainer$sed_extract_prog" < "$lookedup_file"
2601 func_cache_lookup_module
"$1"
2602 # Output the field's value, including the final newline (if any).
2603 if $have_associative; then
2604 if eval 'test -n "${modcache_maintainer[$1]+set}"'; then
2605 eval 'echo "${modcache_maintainer[$1]}"'
2608 eval "field_set=\"\$${cachevar}_maintainer_set\""
2609 if test -n "$field_set"; then
2610 eval "field_value=\"\$${cachevar}_maintainer\""
2611 echo "${field_value}"
2617 # func_get_tests_module module
2619 # - local_gnulib_path from --local-dir
2620 func_get_tests_module
()
2622 # The naming convention for tests modules is hardwired: ${module}-tests.
2623 if test -f "$gnulib_dir/modules/$1"-tests \
2624 || func_path_foreach
"$local_gnulib_path" func_exists_local_module
%dir
% "$1-tests"; then
2629 # func_acceptable module
2630 # tests whether a module is acceptable.
2632 # - avoidlist list of modules to avoid
2635 for avoid
in $avoidlist; do
2636 if test "$avoid" = "$1"; then
2643 # sed expression to keep the first 32 characters of each line.
2644 sed_first_32_chars
='s/^\(................................\).*/\1/'
2646 # func_module_shellfunc_name module
2647 # computes the shell function name that will contain the m4 macros for the module.
2649 # - macro_prefix prefix to use
2651 # - shellfunc shell function name
2652 func_module_shellfunc_name
()
2656 shellfunc
=func_
${macro_prefix}_gnulib_m4code_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2658 shellfunc
=func_
${macro_prefix}_gnulib_m4code_
$1 ;;
2662 # func_module_shellvar_name module
2663 # computes the shell variable name the will be set to true once the m4 macros
2664 # for the module have been executed.
2666 # - shellvar shell variable name
2667 func_module_shellvar_name
()
2671 shellvar
=${macro_prefix}_gnulib_enabled_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2673 shellvar
=${macro_prefix}_gnulib_enabled_
$1 ;;
2677 # func_module_conditional_name module
2678 # computes the automake conditional name for the module.
2680 # - conditional name of automake conditional
2681 func_module_conditional_name
()
2685 conditional
=${macro_prefix}_GNULIB_ENABLED_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2687 conditional
=${macro_prefix}_GNULIB_ENABLED_
$1 ;;
2691 # func_uncond_add_module B
2692 # notes the presence of B as an unconditional module.
2694 # func_conddep_add_module A B cond
2695 # notes the presence of a conditional dependency from module A to module B,
2696 # subject to the condition that A is enabled and cond is true.
2698 # func_cond_module_p B
2699 # tests whether module B is conditional.
2701 # func_cond_module_condition A B
2702 # returns the condition when B should be enabled as a dependency of A, once the
2703 # m4 code for A has been executed.
2704 # Output: - condition
2706 if $have_associative; then
2707 declare -A conddep_isuncond
2708 declare -A conddep_dependers
2709 declare -A conddep_condition
2710 func_uncond_add_module
()
2712 eval 'conddep_isuncond[$1]=true'
2713 eval 'unset conddep_dependers[$1]'
2715 func_conddep_add_module
()
2717 eval 'isuncond="${conddep_isuncond[$2]}"'
2718 if test -z "$isuncond"; then
2719 # No unconditional dependency to B known at this point.
2720 eval 'conddep_dependers[$2]="${conddep_dependers[$2]} $1"'
2721 eval 'conddep_condition[$1---$2]="$3"'
2724 func_cond_module_p
()
2726 eval 'previous_dependers="${conddep_dependers[$1]}"'
2727 test -n "$previous_dependers"
2729 func_cond_module_condition
()
2731 eval 'condition="${conddep_condition[$1---$2]}"'
2734 func_uncond_add_module
()
2738 suffix
=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2742 eval 'conddep_isuncond_'"$suffix"'=true'
2743 eval 'unset conddep_dependers_'"$suffix"
2745 func_conddep_add_module
()
2749 suffix
=`echo "$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2753 eval 'isuncond="${conddep_isuncond_'"$suffix"'}"'
2754 if test -z "$isuncond"; then
2755 eval 'conddep_dependers_'"$suffix"'="${conddep_dependers_'"$suffix"'} $1"'
2756 suffix
=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
2757 eval 'conddep_condition_'"$suffix"'="$3"'
2760 func_cond_module_p
()
2764 suffix
=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2768 eval 'previous_dependers="${conddep_dependers_'"$suffix"'}"'
2769 test -n "$previous_dependers"
2771 func_cond_module_condition
()
2773 suffix
=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
2774 eval 'condition="${conddep_condition_'"$suffix"'}"'
2778 sed_dependencies_without_conditions
='s/ *\[.*//'
2780 # func_modules_transitive_closure
2782 # - local_gnulib_path from --local-dir
2783 # - modcache true or false, from --cache-modules/--no-cache-modules
2784 # - modules list of specified modules
2785 # - inctests true if tests should be included, false otherwise
2786 # - incobsolete true if obsolete modules among dependencies should be
2787 # included, blank otherwise
2788 # - inc_cxx_tests true if C++ interoperability tests should be included,
2790 # - inc_longrunning_tests true if long-runnings tests should be included,
2792 # - inc_privileged_tests true if tests that require root privileges should be
2793 # included, blank otherwise
2794 # - inc_unportable_tests true if tests that fail on some platforms should be
2795 # included, blank otherwise
2796 # - inc_all_direct_tests true if all kinds of problematic unit tests among
2797 # the unit tests of the specified modules should be
2798 # included, blank otherwise
2799 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
2800 # the unit tests of the dependencies should be
2801 # included, blank otherwise
2802 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
2804 # - excl_longrunning_tests true if long-runnings tests should be excluded,
2806 # - excl_privileged_tests true if tests that require root privileges should be
2807 # excluded, blank otherwise
2808 # - excl_unportable_tests true if tests that fail on some platforms should be
2809 # excluded, blank otherwise
2810 # - avoidlist list of modules to avoid
2811 # - cond_dependencies true if conditional dependencies shall be supported,
2813 # - tmp pathname of a temporary directory
2815 # - modules list of modules, including dependencies
2816 # - conddep_dependers, conddep_condition information about conditionally
2818 func_modules_transitive_closure
()
2820 sed_escape_dependency
='s|\([/.]\)|\\\1|g'
2821 # In order to process every module only once (for speed), process an "input
2822 # list" of modules, producing an "output list" of modules. During each round,
2823 # more modules can be queued in the input list. Once a module on the input
2824 # list has been processed, it is added to the "handled list", so we can avoid
2825 # to process it again.
2827 inmodules
="$modules"
2829 fmtc_inc_all_tests
="$inc_all_direct_tests"
2830 if test "$cond_dependencies" = true
; then
2831 for module
in $inmodules; do
2833 if test -n "$module"; then
2834 if func_acceptable
$module; then
2835 func_uncond_add_module
$module
2840 while test -n "$inmodules"; do
2841 inmodules_this_round
="$inmodules"
2842 inmodules
= # Accumulator, queue for next round
2843 for module
in $inmodules_this_round; do
2845 if test -n "$module"; then
2846 if func_acceptable
$module; then
2847 func_append outmodules
" $module"
2848 if test "$cond_dependencies" = true
; then
2849 if func_get_automake_snippet_conditional
$module |
grep '^if ' > /dev
/null
; then
2850 # A module whose Makefile.am snippet contains a reference to an
2851 # automake conditional. If we were to use it conditionally, we
2852 # would get an error
2853 # configure: error: conditional "..." was never defined.
2854 # because automake 1.11.1 does not handle nested conditionals
2855 # correctly. As a workaround, make the module unconditional.
2856 func_uncond_add_module
$module
2858 if func_cond_module_p
$module; then
2864 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
2865 # Duplicate dependencies are harmless, but Jim wants a warning.
2866 duplicated_deps
=`echo "$deps" | LC_ALL=C sort | LC_ALL=C uniq -d`
2867 if test -n "$duplicated_deps"; then
2868 func_warning
"module $module has duplicated dependencies: "`echo $duplicated_deps`
2871 testsmodule
=`func_get_tests_module $module`
2872 if test -n "$testsmodule"; then
2873 deps
="$deps $testsmodule"
2876 for dep
in $deps; do
2877 # Determine whether to include the dependency or tests module.
2879 for word
in `func_get_status $dep`; do
2882 test -n "$incobsolete" \
2886 test -z "$excl_cxx_tests" \
2888 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_cxx_tests" \
2892 test -z "$excl_longrunning_tests" \
2894 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_longrunning_tests" \
2898 test -z "$excl_privileged_tests" \
2900 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_privileged_tests" \
2904 test -z "$excl_unportable_tests" \
2906 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_unportable_tests" \
2910 test -n "$fmtc_inc_all_tests" \
2915 if $inc && func_acceptable
"$dep"; then
2916 func_append inmodules
" $dep"
2917 if test "$cond_dependencies" = true
; then
2918 escaped_dep
=`echo "$dep" | sed -e "$sed_escape_dependency"`
2919 sed_extract_condition1
='/^ *'"$escaped_dep"' *$/{
2922 sed_extract_condition2
='/^ *'"$escaped_dep"' *\[.*\] *$/{
2923 s/^ *'"$escaped_dep"' *\[\(.*\)\] *$/\1/p
2925 condition
=`func_get_dependencies $module | sed -n -e "$sed_extract_condition1" -e "$sed_extract_condition2"`
2926 if test "$condition" = true
; then
2929 if test -n "$condition"; then
2930 func_conddep_add_module
"$module" "$dep" "$condition"
2932 if $conditional; then
2933 func_conddep_add_module
"$module" "$dep" true
2935 func_uncond_add_module
"$dep"
2944 handledmodules
=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
2945 # Remove $handledmodules from $inmodules.
2946 for m
in $inmodules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/queued-modules
2947 inmodules
=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
2948 fmtc_inc_all_tests
="$inc_all_indirect_tests"
2950 modules
=`for m in $outmodules; do echo $m; done | LC_ALL=C sort -u`
2951 rm -f "$tmp"/queued-modules
2954 # func_show_module_list
2956 # - specified_modules list of specified modules (one per line, sorted)
2957 # - modules complete list of modules (one per line, sorted)
2958 # - tmp pathname of a temporary directory
2959 func_show_module_list
()
2965 # Assume xterm compatible escape sequences.
2966 bold_on
=`printf '\033[1m'`
2967 bold_off
=`printf '\033[0m'`
2972 echo "Module list with included dependencies (indented):"
2973 echo "$specified_modules" |
sed -e '/^$/d' -e 's/$/| /' > "$tmp"/specified-modules
2974 echo "$modules" |
sed -e '/^$/d' \
2975 | LC_ALL
=C
join -t '|' -a2 "$tmp"/specified-modules
- \
2976 |
sed -e 's/^\(.*\)|.*/|\1/' -e 's/^/ /' -e 's/^ |\(.*\)$/ '"${bold_on}"'\1'"${bold_off}"'/'
2979 # func_modules_transitive_closure_separately
2980 # Determine main module list and tests-related module list separately.
2981 # The main module list is the transitive closure of the specified modules,
2982 # ignoring tests modules. Its lib/* sources go into $sourcebase/. If --lgpl
2983 # is specified, it will consist only of LGPLed source.
2984 # The tests-related module list is the transitive closure of the specified
2985 # modules, including tests modules, minus the main module list excluding
2986 # modules of applicability 'all'. Its lib/* sources (brought in through
2987 # dependencies of *-tests modules) go into $testsbase/. It may contain GPLed
2988 # source, even if --lgpl is specified.
2990 # - local_gnulib_path from --local-dir
2991 # - modcache true or false, from --cache-modules/--no-cache-modules
2992 # - specified_modules list of specified modules
2993 # - inctests true if tests should be included, false otherwise
2994 # - incobsolete true if obsolete modules among dependencies should be
2995 # included, blank otherwise
2996 # - inc_cxx_tests true if C++ interoperability tests should be included,
2998 # - inc_longrunning_tests true if long-runnings tests should be included,
3000 # - inc_privileged_tests true if tests that require root privileges should be
3001 # included, blank otherwise
3002 # - inc_unportable_tests true if tests that fail on some platforms should be
3003 # included, blank otherwise
3004 # - inc_all_direct_tests true if all kinds of problematic unit tests among
3005 # the unit tests of the specified modules should be
3006 # included, blank otherwise
3007 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
3008 # the unit tests of the dependencies should be
3009 # included, blank otherwise
3010 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
3012 # - excl_longrunning_tests true if long-runnings tests should be excluded,
3014 # - excl_privileged_tests true if tests that require root privileges should be
3015 # excluded, blank otherwise
3016 # - excl_unportable_tests true if tests that fail on some platforms should be
3017 # excluded, blank otherwise
3018 # - avoidlist list of modules to avoid
3019 # - cond_dependencies true if conditional dependencies shall be supported,
3021 # - tmp pathname of a temporary directory
3023 # - main_modules list of modules, including dependencies
3024 # - testsrelated_modules list of tests-related modules, including dependencies
3025 # - conddep_dependers, conddep_condition information about conditionally
3027 func_modules_transitive_closure_separately
()
3029 # Determine main module list.
3030 saved_inctests
="$inctests"
3032 modules
="$specified_modules"
3033 func_modules_transitive_closure
3034 main_modules
="$modules"
3035 inctests
="$saved_inctests"
3036 if test $verbose -ge 1; then
3037 echo "Main module list:"
3038 echo "$main_modules" |
sed -e 's/^/ /'
3040 # Determine tests-related module list.
3041 echo "$final_modules" | LC_ALL
=C
sort -u > "$tmp"/final-modules
3042 testsrelated_modules
=`for module in $main_modules; do
3043 if test \`func_get_applicability
$module\
` = main; then
3047 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/final-modules`
3048 if test $verbose -ge 1; then
3049 echo "Tests-related module list:"
3050 echo "$testsrelated_modules" |
sed -e 's/^/ /'
3054 # func_determine_use_libtests
3055 # Determines whether a $testsbase/libtests.a is needed.
3057 # - local_gnulib_path from --local-dir
3058 # - modcache true or false, from --cache-modules/--no-cache-modules
3059 # - testsrelated_modules list of tests-related modules, including dependencies
3061 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
3062 func_determine_use_libtests
()
3065 for module
in $testsrelated_modules; do
3066 func_verify_nontests_module
3067 if test -n "$module"; then
3068 all_files
=`func_get_filelist $module`
3069 # Test whether some file in $all_files lies in lib/.
3070 for f
in $all_files; do
3082 # func_modules_add_dummy
3084 # - local_gnulib_path from --local-dir
3085 # - modcache true or false, from --cache-modules/--no-cache-modules
3086 # - modules list of modules, including dependencies
3088 # - modules list of modules, including 'dummy' if needed
3089 func_modules_add_dummy
()
3091 # Determine whether any module provides a lib_SOURCES augmentation.
3093 for module
in $modules; do
3094 func_verify_nontests_module
3095 if test -n "$module"; then
3096 # Extract the value of "lib_SOURCES += ...".
3097 for file in `func_get_automake_snippet "$module" | combine_lines |
3098 sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'`; do
3099 # Ignore .h files since they are not compiled.
3103 have_lib_SOURCES
=yes
3110 # Add the dummy module, to make sure the library will be non-empty.
3111 if test -z "$have_lib_SOURCES"; then
3112 if func_acceptable
"dummy"; then
3113 func_append modules
" dummy"
3118 # func_modules_add_dummy_separately
3120 # - local_gnulib_path from --local-dir
3121 # - modcache true or false, from --cache-modules/--no-cache-modules
3122 # - main_modules list of modules, including dependencies
3123 # - testsrelated_modules list of tests-related modules, including dependencies
3124 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
3126 # - main_modules list of modules, including 'dummy' if needed
3127 # - testsrelated_modules list of tests-related modules, including 'dummy' if
3129 func_modules_add_dummy_separately
()
3131 # Add the dummy module to the main module list if needed.
3132 modules
="$main_modules"
3133 func_modules_add_dummy
3134 main_modules
="$modules"
3136 # Add the dummy module to the tests-related module list if needed.
3137 if $use_libtests; then
3138 modules
="$testsrelated_modules"
3139 func_modules_add_dummy
3140 testsrelated_modules
="$modules"
3144 # func_modules_notice
3146 # - local_gnulib_path from --local-dir
3147 # - modcache true or false, from --cache-modules/--no-cache-modules
3148 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
3149 # - modules list of modules, including dependencies
3150 func_modules_notice
()
3152 if test $verbose -ge -1; then
3153 for module
in $modules; do
3155 if test -n "$module"; then
3156 msg
=`func_get_notice $module`
3157 if test -n "$msg"; then
3158 echo "Notice from module $module:"
3159 echo "$msg" |
sed -e 's/^/ /'
3166 # func_modules_to_filelist
3168 # - local_gnulib_path from --local-dir
3169 # - modcache true or false, from --cache-modules/--no-cache-modules
3170 # - modules list of modules, including dependencies
3172 # - files list of files
3173 func_modules_to_filelist
()
3176 for module
in $modules; do
3178 if test -n "$module"; then
3179 fs
=`func_get_filelist $module`
3180 func_append files
" $fs"
3183 files
=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
3186 # func_modules_to_filelist_separately
3187 # Determine the final file lists.
3188 # They must be computed separately, because files in lib/* go into
3189 # $sourcebase/ if they are in the main file list but into $testsbase/
3190 # if they are in the tests-related file list. Furthermore lib/dummy.c
3193 # - local_gnulib_path from --local-dir
3194 # - modcache true or false, from --cache-modules/--no-cache-modules
3195 # - main_modules list of modules, including dependencies
3196 # - testsrelated_modules list of tests-related modules, including dependencies
3197 func_modules_to_filelist_separately
()
3199 # Determine final main file list.
3200 modules
="$main_modules"
3201 func_modules_to_filelist
3203 # Determine final tests-related file list.
3204 modules
="$testsrelated_modules"
3205 func_modules_to_filelist
3206 testsrelated_files
=`echo "$files" | sed -e 's,^lib/,tests=lib/,'`
3207 # Merge both file lists.
3208 sed_remove_empty_lines
='/^$/d'
3209 files
=`{ echo "$main_files"; echo "$testsrelated_files"; } | sed -e "$sed_remove_empty_lines" | LC_ALL=C sort -u`
3210 if test $verbose -ge 0; then
3212 sed_prettyprint_files
='s,^tests=lib/\(.*\)$,lib/\1 -> tests/\1,'
3213 echo "$files" |
sed -e "$sed_prettyprint_files" -e 's/^/ /'
3217 # func_compute_include_guard_prefix
3218 # Determine include_guard_prefix.
3220 # - macro_prefix prefix of gl_LIBOBJS macros to use
3222 # - include_guard_prefix replacement for ${gl_include_guard_prefix}
3223 # - sed_replace_include_guard_prefix
3224 # sed expression for resolving ${gl_include_guard_prefix}
3225 func_compute_include_guard_prefix
()
3227 if test "$macro_prefix" = gl
; then
3228 include_guard_prefix
='GL'
3230 include_guard_prefix
='GL_'`echo "$macro_prefix" | LC_ALL=C tr '[a-z]' '[A-Z]'`
3232 sed_replace_include_guard_prefix
='s/\${gl_include_guard_prefix}/'"${include_guard_prefix}"'/g'
3235 # func_execute_command command [args...]
3236 # Executes a command.
3237 # Uses also the variables
3238 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
3239 func_execute_command
()
3241 if test $verbose -ge 0; then
3245 # Commands like automake produce output to stderr even when they succeed.
3246 # Turn this output off if the command succeeds.
3247 "$@" > "$tmp"/cmdout
2>&1
3249 if test $cmdret = 0; then
3253 cat "$tmp"/cmdout
1>&2
3260 # func_dest_tmpfilename file
3261 # determines the name of a temporary file (file is relative to destdir).
3263 # - destdir target directory
3264 # - doit : if actions shall be executed, false if only to be printed
3265 # - tmp pathname of a temporary directory
3267 # - tmpfile absolute filename of the temporary file
3268 func_dest_tmpfilename
()
3271 # Put the new contents of $file in a file in the same directory (needed
3272 # to guarantee that an 'mv' to "$destdir/$file" works).
3273 tmpfile
="$destdir/$1.tmp"
3275 # Put the new contents of $file in a file in a temporary directory
3276 # (because the directory of "$file" might not exist).
3277 tmpfile
="$tmp"/`basename "$1"`.tmp
3281 # func_is_local_file lookedup_file file
3282 # check whether file should be instantiated from local gnulib directory
3283 func_is_local_file
()
3286 func_remove_suffix dname
"/$2"
3287 func_path_foreach
"$local_gnulib_path" test %dir
% = "$dname"
3290 # func_should_symlink
3291 # returns 0 when the file $f should be symlinked
3293 # - symbolic true if files should be symlinked, copied otherwise
3294 # - lsymbolic true if files from local_gnulib_path should be symlinked,
3296 # - f the original file name
3297 # - lookedup_file name of the merged (combined) file
3298 func_should_symlink
()
3300 test -n "$symbolic" \
3301 ||
{ test -n "$lsymbolic" \
3302 && func_is_local_file
"$lookedup_file" "$f"; }
3306 # copies a file from gnulib into the destination directory. The destination
3307 # is known to not exist.
3309 # - destdir target directory
3310 # - local_gnulib_path from --local-dir
3311 # - modcache true or false, from --cache-modules/--no-cache-modules
3312 # - f the original file name
3313 # - lookedup_file name of the merged (combined) file
3314 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
3315 # - g the rewritten file name
3316 # - tmpfile absolute filename of the temporary file
3317 # - doit : if actions shall be executed, false if only to be printed
3318 # - symbolic true if files should be symlinked, copied otherwise
3319 # - lsymbolic true if files from local_gnulib_path should be symlinked,
3324 echo "Copying file $g"
3325 if func_should_symlink \
3326 && test -z "$lookedup_tmp" \
3327 && cmp -s "$lookedup_file" "$tmpfile"; then
3328 func_ln_if_changed
"$lookedup_file" "$destdir/$g"
3330 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error
"failed"
3338 # copies a file from gnulib into the destination directory. The destination
3339 # is known to exist.
3341 # - destdir target directory
3342 # - local_gnulib_path from --local-dir
3343 # - modcache true or false, from --cache-modules/--no-cache-modules
3344 # - f the original file name
3345 # - lookedup_file name of the merged (combined) file
3346 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
3347 # - g the rewritten file name
3348 # - tmpfile absolute filename of the temporary file
3349 # - doit : if actions shall be executed, false if only to be printed
3350 # - symbolic true if files should be symlinked, copied otherwise
3351 # - lsymbolic true if files from local_gnulib_path should be symlinked,
3353 # - already_present nonempty if the file should already exist, empty otherwise
3356 if cmp -s "$destdir/$g" "$tmpfile"; then
3357 : # The file has not changed.
3361 if test -n "$already_present"; then
3362 echo "Updating file $g (backup in ${g}~)"
3364 echo "Replacing file $g (non-gnulib code backed up in ${g}~) !!"
3366 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error
"failed"
3367 if func_should_symlink \
3368 && test -z "$lookedup_tmp" \
3369 && cmp -s "$lookedup_file" "$tmpfile"; then
3370 func_ln_if_changed
"$lookedup_file" "$destdir/$g"
3372 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error
"failed"
3375 if test -n "$already_present"; then
3376 echo "Update file $g (backup in ${g}~)"
3378 echo "Replace file $g (non-gnulib code backed up in ${g}~) !!"
3384 # func_emit_lib_Makefile_am
3385 # emits the contents of library makefile to standard output.
3387 # - local_gnulib_path from --local-dir
3388 # - modcache true or false, from --cache-modules/--no-cache-modules
3389 # - modules list of modules, including dependencies
3390 # - libname library name
3391 # - pobase directory relative to destdir where to place *.po files
3392 # - auxdir directory relative to destdir where to place build aux files
3393 # - makefile_name from --makefile-name
3394 # - libtool true if libtool will be used, false or blank otherwise
3395 # - macro_prefix prefix of gl_LIBOBJS macros to use
3396 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
3397 # - witness_c_macro from --witness-c-macro
3398 # - actioncmd (optional) command that will reproduce this invocation
3399 # - for_test true if creating a package for testing, false otherwise
3400 # - sed_replace_include_guard_prefix
3401 # sed expression for resolving ${gl_include_guard_prefix}
3402 # - destfile filename relative to destdir of makefile being generated
3404 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val}
3405 # list of edits to be done to Makefile.am variables
3407 # - uses_subdirs nonempty if object files in subdirs exist
3408 func_emit_lib_Makefile_am
()
3410 # When creating an includable Makefile.am snippet, augment variables with
3411 # += instead of assigning them.
3412 if test -n "$makefile_name"; then
3417 if test "$libtool" = true
; then
3420 sed_eliminate_LDFLAGS
="$sed_noop"
3424 sed_eliminate_LDFLAGS
='/^lib_LDFLAGS[ ]*+=/d'
3427 # When creating a package for testing: Attempt to provoke failures,
3428 # especially link errors, already during "make" rather than during
3429 # "make check", because "make check" is not possible in a cross-compiling
3430 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
3431 sed_transform_check_PROGRAMS
='s,check_PROGRAMS,noinst_PROGRAMS,g'
3433 sed_transform_check_PROGRAMS
="$sed_noop"
3435 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3436 echo "## Process this file with automake to produce Makefile.in."
3437 func_emit_copyright_notice
3438 if test -n "$actioncmd"; then
3439 # The maximum line length (excluding the terminating newline) of any file
3440 # that is to be preprocessed by config.status is 3070. config.status uses
3441 # awk, and the HP-UX 11.00 awk fails if a line has length >= 3071;
3442 # similarly, the IRIX 6.5 awk fails if a line has length >= 3072.
3443 len
=`echo "$actioncmd" | wc -c`
3444 if test -n "$len" && test "$len" -le 3000; then
3445 echo "# Reproduce by: $actioncmd"
3451 for module
in $modules; do
3452 func_verify_nontests_module
3453 if test -n "$module"; then
3455 func_get_automake_snippet_conditional
"$module" |
3457 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
3458 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
3459 -e "$sed_eliminate_LDFLAGS" \
3460 -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' \
3461 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
3462 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
3463 -e "$sed_transform_check_PROGRAMS" \
3464 -e "$sed_replace_include_guard_prefix"
3465 if test "$module" = 'alloca'; then
3466 echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
3467 echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@"
3469 } | combine_lines
"${libname}_${libext}_SOURCES" > "$tmp"/amsnippet1
3471 func_get_automake_snippet_unconditional
"$module" |
3472 LC_ALL
=C
sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g'
3473 } > "$tmp"/amsnippet2
3474 # Skip the contents if it's entirely empty.
3475 if grep '[^ ]' "$tmp"/amsnippet1
"$tmp"/amsnippet2
> /dev
/null
; then
3476 echo "## begin gnulib module $module"
3478 if test "$cond_dependencies" = true
; then
3479 if func_cond_module_p
"$module"; then
3480 func_module_conditional_name
"$module"
3481 echo "if $conditional"
3484 cat "$tmp"/amsnippet1
3485 if test "$cond_dependencies" = true
; then
3486 if func_cond_module_p
"$module"; then
3490 cat "$tmp"/amsnippet2
3491 echo "## end gnulib module $module"
3494 rm -f "$tmp"/amsnippet1
"$tmp"/amsnippet2
3495 # Test whether there are some source files in subdirectories.
3496 for f
in `func_get_filelist "$module"`; do
3506 } > "$tmp"/allsnippets
3507 if test -z "$makefile_name"; then
3508 # If there are source files in subdirectories, prevent collision of the
3509 # object files (example: hash.c and libxml/hash.c).
3511 if test -n "$uses_subdirs"; then
3512 subdir_options
=' subdir-objects'
3514 echo "AUTOMAKE_OPTIONS = 1.9.6 gnits${subdir_options}"
3517 if test -z "$makefile_name"; then
3519 echo "noinst_HEADERS ="
3520 echo "noinst_LIBRARIES ="
3521 echo "noinst_LTLIBRARIES ="
3522 # Automake versions < 1.11.4 create an empty pkgdatadir at
3523 # installation time if you specify pkgdata_DATA to empty.
3524 # See automake bugs #10997 and #11030:
3525 # * http://debbugs.gnu.org/10997
3526 # * http://debbugs.gnu.org/11030
3527 # So we need this workaround.
3528 if grep '^pkgdata_DATA *+=' "$tmp"/allsnippets
> /dev
/null
; then
3529 echo "pkgdata_DATA ="
3532 echo "BUILT_SOURCES ="
3535 echo "MOSTLYCLEANFILES $assign core *.stackdump"
3536 if test -z "$makefile_name"; then
3537 echo "MOSTLYCLEANDIRS ="
3539 echo "DISTCLEANFILES ="
3540 echo "MAINTAINERCLEANFILES ="
3542 # Execute edits that apply to the Makefile.am being generated.
3544 while test $edit != $makefile_am_edits; do
3545 edit
=`expr $edit + 1`
3546 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
3547 eval var
=\"\
$makefile_am_edit${edit}_var
\"
3548 eval val
=\"\
$makefile_am_edit${edit}_val
\"
3549 if test -n "$var"; then
3550 if test "${dir}Makefile.am" = "$destfile" ||
test "./${dir}Makefile.am" = "$destfile"; then
3551 echo "${var} += ${val}"
3552 eval "makefile_am_edit${edit}_var="
3556 if test -n "$witness_c_macro"; then
3557 cppflags_part1
=" -D$witness_c_macro=1"
3562 cppflags_part2
=" -DGNULIB_STRICT_CHECKING=1"
3566 if test -z "$makefile_name"; then
3568 echo "AM_CPPFLAGS =$cppflags_part1$cppflags_part2"
3571 if test -n "$cppflags_part1$cppflags_part2"; then
3573 echo "AM_CPPFLAGS +=$cppflags_part1$cppflags_part2"
3577 if LC_ALL
=C
grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$tmp"/allsnippets
> /dev
/null \
3578 ||
{ test -n "$makefile_name" \
3579 && test -f "$sourcebase/Makefile.am" \
3580 && LC_ALL
=C
grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$sourcebase/Makefile.am" > /dev
/null
; \
3582 # One of the snippets or the user's Makefile.am already specifies an
3583 # installation location for the library. Don't confuse automake by saying
3584 # it should not be installed.
3587 # By default, the generated library should not be installed.
3588 echo "noinst_${perhapsLT}LIBRARIES += $libname.$libext"
3591 echo "${libname}_${libext}_SOURCES ="
3592 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
3593 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
3594 echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
3595 echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
3596 echo "EXTRA_${libname}_${libext}_SOURCES ="
3597 if test "$libtool" = true
; then
3598 echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)"
3599 echo "${libname}_${libext}_LDFLAGS += -no-undefined"
3600 # Synthesize an ${libname}_${libext}_LDFLAGS augmentation by combining
3601 # the link dependencies of all modules.
3602 for module
in $modules; do
3603 func_verify_nontests_module
3604 if test -n "$module"; then
3605 func_get_link_directive
"$module"
3608 | LC_ALL
=C
sed -e '/^$/d' -e 's/ when linking with libtool.*//' \
3609 | LC_ALL
=C
sort -u \
3610 | LC_ALL
=C
sed -e 's/^/'"${libname}_${libext}"'_LDFLAGS += /'
3613 if test -n "$pobase"; then
3614 echo "AM_CPPFLAGS += -DDEFAULT_TEXT_DOMAIN=\\\"${po_domain}-gnulib\\\""
3617 cat "$tmp"/allsnippets \
3618 |
sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
3620 echo "mostlyclean-local: mostlyclean-generic"
3621 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
3622 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
3623 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
3627 rm -f "$tmp"/allsnippets
3630 # func_emit_po_Makevars
3631 # emits the contents of po/ makefile parameterization to standard output.
3633 # - local_gnulib_path from --local-dir
3634 # - modcache true or false, from --cache-modules/--no-cache-modules
3635 # - sourcebase directory relative to destdir where to place source code
3636 # - pobase directory relative to destdir where to place *.po files
3637 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
3638 func_emit_po_Makevars
()
3640 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3641 func_emit_copyright_notice
3643 echo "# Usually the message domain is the same as the package name."
3644 echo "# But here it has a '-gnulib' suffix."
3645 echo "DOMAIN = ${po_domain}-gnulib"
3647 echo "# These two variables depend on the location of this directory."
3648 echo "subdir = ${pobase}"
3649 echo "top_builddir = "`echo "$pobase" | sed -e 's,//*,/,g' -e 's,[^/][^/]*,..,g'`
3652 # These options get passed to xgettext.
3653 XGETTEXT_OPTIONS
= \
3654 --keyword=_
--flag=_
:1:pass-c-format \
3655 --keyword=N_
--flag=N_
:1:pass-c-format \
3656 --keyword='proper_name:1,"This is a proper name. See the gettext manual, section Names."' \
3657 --keyword='proper_name_utf8:1,"This is a proper name. See the gettext manual, section Names."' \
3658 --flag=error
:3:c-format
--flag=error_at_line
:5:c-format
3660 # This is the copyright holder that gets inserted into the header of the
3661 # $(DOMAIN).pot file. gnulib is copyrighted by the FSF.
3662 COPYRIGHT_HOLDER
= Free Software Foundation
, Inc.
3664 # This is the email address or URL to which the translators shall report
3665 # bugs in the untranslated strings:
3666 # - Strings which are not entire sentences, see the maintainer guidelines
3667 # in the GNU gettext documentation, section 'Preparing Strings'.
3668 # - Strings which use unclear terms or require additional context to be
3670 # - Strings which make invalid assumptions about notation of date, time or
3672 # - Pluralisation problems.
3673 # - Incorrect English spelling.
3674 # - Incorrect formatting.
3675 # It can be your email address, or a mailing list address where translators
3676 # can write to without being subscribed, or the URL of a web page through
3677 # which the translators can contact you.
3678 MSGID_BUGS_ADDRESS
= bug-gnulib@gnu.org
3680 # This is the list of locale categories, beyond LC_MESSAGES, for which the
3681 # message catalogs shall be used. It is usually empty.
3682 EXTRA_LOCALE_CATEGORIES
=
3684 # This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
3685 # context. Possible values are "yes" and "no". Set this to yes if the
3686 # package uses functions taking also a message context, like pgettext(), or
3687 # if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
3692 # func_emit_po_POTFILES_in
3693 # emits the file list to be passed to xgettext to standard output.
3695 # - local_gnulib_path from --local-dir
3696 # - modcache true or false, from --cache-modules/--no-cache-modules
3697 # - sourcebase directory relative to destdir where to place source code
3698 # - files list of new files
3699 func_emit_po_POTFILES_in
()
3701 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3702 func_emit_copyright_notice
3704 echo "# List of files which contain translatable strings."
3705 echo "$files" |
sed -n -e "s,^lib/,$sourcebase/,p"
3708 # func_emit_tests_Makefile_am witness_macro
3709 # emits the contents of tests makefile to standard output.
3711 # - local_gnulib_path from --local-dir
3712 # - modcache true or false, from --cache-modules/--no-cache-modules
3713 # - modules list of modules, including dependencies
3714 # - libname library name
3715 # - auxdir directory relative to destdir where to place build aux files
3716 # - makefile_name from --makefile-name
3717 # - libtool true if libtool will be used, false or blank otherwise
3718 # - sourcebase relative directory containing lib source code
3719 # - m4base relative directory containing autoconf macros
3720 # - testsbase relative directory containing unit test code
3721 # - macro_prefix prefix of gl_LIBOBJS macros to use
3722 # - witness_c_macro from --witness-c-macro
3723 # - for_test true if creating a package for testing, false otherwise
3724 # - single_configure true if a single configure file should be generated,
3725 # false for a separate configure file for the tests
3726 # - use_libtests true if a libtests.a should be built, false otherwise
3727 # - sed_replace_include_guard_prefix
3728 # sed expression for resolving ${gl_include_guard_prefix}
3729 # - destfile filename relative to destdir of makefile being generated
3731 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val}
3732 # list of edits to be done to Makefile.am variables
3734 # - uses_subdirs nonempty if object files in subdirs exist
3735 func_emit_tests_Makefile_am
()
3738 if test "$libtool" = true
; then
3741 sed_eliminate_LDFLAGS
="$sed_noop"
3745 sed_eliminate_LDFLAGS
='/^lib_LDFLAGS[ ]*+=/d'
3748 # When creating a package for testing: Attempt to provoke failures,
3749 # especially link errors, already during "make" rather than during
3750 # "make check", because "make check" is not possible in a cross-compiling
3751 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
3752 sed_transform_check_PROGRAMS
='s,check_PROGRAMS,noinst_PROGRAMS,g'
3754 sed_transform_check_PROGRAMS
="$sed_noop"
3756 testsbase_inverse
=`echo "$testsbase" | sed -e 's,/$,,' | sed -e 's,[^/][^/]*,..,g'`
3757 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3758 echo "## Process this file with automake to produce Makefile.in."
3759 func_emit_copyright_notice
3763 for module
in $modules; do
3764 if $for_test && ! $single_configure; then
3765 func_verify_tests_module
3769 if test -n "$module"; then
3771 func_get_automake_snippet
"$module" |
3773 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
3774 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
3775 -e "$sed_eliminate_LDFLAGS" \
3776 -e 's,lib_\([A-Z][A-Z]*\),libtests_a_\1,g' \
3777 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
3778 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
3779 -e "$sed_transform_check_PROGRAMS" \
3780 -e "$sed_replace_include_guard_prefix"
3781 if $use_libtests && test "$module" = 'alloca'; then
3782 echo "libtests_a_LIBADD += @${perhapsLT}ALLOCA@"
3783 echo "libtests_a_DEPENDENCIES += @${perhapsLT}ALLOCA@"
3785 } > "$tmp"/amsnippet
3786 # Skip the contents if it's entirely empty.
3787 if grep '[^ ]' "$tmp"/amsnippet
> /dev
/null
; then
3788 # Mention long-running tests at the end.
3790 for word
in `func_get_status "$module"`; do
3791 if test "$word" = 'longrunning-test'; then
3796 { echo "## begin gnulib module $module"
3798 cat "$tmp"/amsnippet
3799 echo "## end gnulib module $module"
3803 rm -f "$tmp"/amsnippet
3804 # Test whether there are some source files in subdirectories.
3805 for f
in `func_get_filelist "$module"`; do
3807 lib
/*/*.c |
tests
/*/*.c
)
3815 } 3> "$tmp"/main_snippets
4> "$tmp"/longrunning_snippets
3816 # Generate dependencies here, since it eases the debugging of test failures.
3817 # If there are source files in subdirectories, prevent collision of the
3818 # object files (example: hash.c and libxml/hash.c).
3820 if test -n "$uses_subdirs"; then
3821 subdir_options
=' subdir-objects'
3823 echo "AUTOMAKE_OPTIONS = 1.9.6 foreign${subdir_options}"
3825 if $for_test && ! $single_configure; then
3826 echo "ACLOCAL_AMFLAGS = -I ${testsbase_inverse}/${m4base}"
3829 # Nothing is being added to SUBDIRS; nevertheless the existence of this
3830 # variable is needed to avoid an error from automake:
3831 # "AM_GNU_GETTEXT used but SUBDIRS not defined"
3834 echo "XFAIL_TESTS ="
3835 echo "TESTS_ENVIRONMENT ="
3836 echo "noinst_PROGRAMS ="
3837 if ! $for_test; then
3838 echo "check_PROGRAMS ="
3840 echo "noinst_HEADERS ="
3841 echo "noinst_LIBRARIES ="
3842 if $use_libtests; then
3844 echo "noinst_LIBRARIES += libtests.a"
3846 echo "check_LIBRARIES = libtests.a"
3849 # Automake versions < 1.11.4 create an empty pkgdatadir at
3850 # installation time if you specify pkgdata_DATA to empty.
3851 # See automake bugs #10997 and #11030:
3852 # * http://debbugs.gnu.org/10997
3853 # * http://debbugs.gnu.org/11030
3854 # So we need this workaround.
3855 if grep '^pkgdata_DATA *+=' "$tmp"/main_snippets
"$tmp"/longrunning_snippets
> /dev
/null
; then
3856 echo "pkgdata_DATA ="
3859 echo "BUILT_SOURCES ="
3861 echo "MOSTLYCLEANFILES = core *.stackdump"
3862 echo "MOSTLYCLEANDIRS ="
3864 echo "DISTCLEANFILES ="
3865 echo "MAINTAINERCLEANFILES ="
3866 # Execute edits that apply to the Makefile.am being generated.
3868 while test $edit != $makefile_am_edits; do
3869 edit
=`expr $edit + 1`
3870 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
3871 eval var
=\"\
$makefile_am_edit${edit}_var
\"
3872 eval val
=\"\
$makefile_am_edit${edit}_val
\"
3873 if test -n "$var"; then
3874 if test "${dir}Makefile.am" = "$destfile" ||
test "./${dir}Makefile.am" = "$destfile"; then
3875 echo "${var} += ${val}"
3876 eval "makefile_am_edit${edit}_var="
3881 echo "AM_CPPFLAGS = \\"
3883 echo " -DGNULIB_STRICT_CHECKING=1 \\"
3885 if test -n "$witness_c_macro"; then
3886 echo " -D$witness_c_macro=1 \\"
3888 if test -n "${witness_macro}"; then
3889 echo " -D@${witness_macro}@=1 \\"
3891 echo " -I. -I\$(srcdir) \\"
3892 echo " -I${testsbase_inverse} -I\$(srcdir)/${testsbase_inverse} \\"
3893 echo " -I${testsbase_inverse}/${sourcebase-lib} -I\$(srcdir)/${testsbase_inverse}/${sourcebase-lib}"
3895 local_ldadd_before
=''
3896 local_ldadd_after
=''
3897 if $use_libtests; then
3898 # All test programs need to be linked with libtests.a.
3899 # It needs to be passed to the linker before ${libname}.${libext}, since
3900 # the tests-related modules depend on the main modules.
3901 # It also needs to be passed to the linker after ${libname}.${libext}
3902 # because the latter might contain incomplete modules (such as the 'error'
3903 # module whose dependency to 'progname' is voluntarily omitted).
3904 # The LIBTESTS_LIBDEPS can be passed to the linker once or twice, it does
3906 local_ldadd_before
=' libtests.a'
3907 local_ldadd_after
=' libtests.a $(LIBTESTS_LIBDEPS)'
3909 echo "LDADD =${local_ldadd_before} ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext}${local_ldadd_after}"
3911 if $use_libtests; then
3912 echo "libtests_a_SOURCES ="
3913 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
3914 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
3915 echo "libtests_a_LIBADD = \$(${macro_prefix}tests_LIBOBJS)"
3916 echo "libtests_a_DEPENDENCIES = \$(${macro_prefix}tests_LIBOBJS)"
3917 echo "EXTRA_libtests_a_SOURCES ="
3918 # The circular dependency in LDADD requires this.
3919 echo "AM_LIBTOOLFLAGS = --preserve-dup-deps"
3922 # Many test scripts use ${EXEEXT} or ${srcdir}.
3923 # EXEEXT is defined by AC_PROG_CC through autoconf.
3924 # srcdir is defined by autoconf and automake.
3925 echo "TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='\$(srcdir)'"
3927 cat "$tmp"/main_snippets
"$tmp"/longrunning_snippets \
3928 |
sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
3929 echo "# Clean up after Solaris cc."
3931 echo " rm -rf SunWS_cache"
3933 echo "mostlyclean-local: mostlyclean-generic"
3934 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
3935 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
3936 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
3940 rm -f "$tmp"/main_snippets
"$tmp"/longrunning_snippets
3943 # func_emit_initmacro_start macro_prefix
3944 # emits the first few statements of the gl_INIT macro to standard output.
3945 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
3946 func_emit_initmacro_start
()
3948 macro_prefix_arg
="$1"
3949 # Overriding AC_LIBOBJ and AC_REPLACE_FUNCS has the effect of storing
3950 # platform-dependent object files in ${macro_prefix_arg}_LIBOBJS instead of
3951 # LIBOBJS. The purpose is to allow several gnulib instantiations under
3952 # a single configure.ac file. (AC_CONFIG_LIBOBJ_DIR does not allow this
3954 # Furthermore it avoids an automake error like this when a Makefile.am
3955 # that uses pieces of gnulib also uses $(LIBOBJ):
3956 # automatically discovered file `error.c' should not be explicitly mentioned
3957 echo " m4_pushdef([AC_LIBOBJ], m4_defn([${macro_prefix_arg}_LIBOBJ]))"
3958 echo " m4_pushdef([AC_REPLACE_FUNCS], m4_defn([${macro_prefix_arg}_REPLACE_FUNCS]))"
3959 # Overriding AC_LIBSOURCES has the same purpose of avoiding the automake
3960 # error when a Makefile.am that uses pieces of gnulib also uses $(LIBOBJ):
3961 # automatically discovered file `error.c' should not be explicitly mentioned
3962 # We let automake know about the files to be distributed through the
3963 # EXTRA_lib_SOURCES variable.
3964 echo " m4_pushdef([AC_LIBSOURCES], m4_defn([${macro_prefix_arg}_LIBSOURCES]))"
3965 # Create data variables for checking the presence of files that are mentioned
3966 # as AC_LIBSOURCES arguments. These are m4 variables, not shell variables,
3967 # because we want the check to happen when the configure file is created,
3968 # not when it is run. ${macro_prefix_arg}_LIBSOURCES_LIST is the list of
3969 # files to check for. ${macro_prefix_arg}_LIBSOURCES_DIR is the subdirectory
3970 # in which to expect them.
3971 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_LIST], [])"
3972 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_DIR], [])"
3976 # func_emit_initmacro_end macro_prefix
3977 # emits the last few statements of the gl_INIT macro to standard output.
3978 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
3979 func_emit_initmacro_end
()
3981 macro_prefix_arg
="$1"
3982 # Check the presence of files that are mentioned as AC_LIBSOURCES arguments.
3983 # The check is performed only when autoconf is run from the directory where
3984 # the configure.ac resides; if it is run from a different directory, the
3986 echo " m4_ifval(${macro_prefix_arg}_LIBSOURCES_LIST, ["
3987 echo " m4_syscmd([test ! -d ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[ ||"
3988 echo " for gl_file in ]${macro_prefix_arg}_LIBSOURCES_LIST[ ; do"
3989 echo " if test ! -r ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file ; then"
3990 echo " echo \"missing file ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file\" >&2"
3994 echo " m4_if(m4_sysval, [0], [],"
3995 echo " [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])"
3997 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_DIR])"
3998 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_LIST])"
3999 echo " m4_popdef([AC_LIBSOURCES])"
4000 echo " m4_popdef([AC_REPLACE_FUNCS])"
4001 echo " m4_popdef([AC_LIBOBJ])"
4002 echo " AC_CONFIG_COMMANDS_PRE(["
4003 echo " ${macro_prefix_arg}_libobjs="
4004 echo " ${macro_prefix_arg}_ltlibobjs="
4005 echo " if test -n \"\$${macro_prefix_arg}_LIBOBJS\"; then"
4006 echo " # Remove the extension."
4007 echo " sed_drop_objext='s/\\.o\$//;s/\\.obj\$//'"
4008 echo " for i in \`for i in \$${macro_prefix_arg}_LIBOBJS; do echo \"\$i\"; done | sed -e \"\$sed_drop_objext\" | sort | uniq\`; do"
4009 echo " ${macro_prefix_arg}_libobjs=\"\$${macro_prefix_arg}_libobjs \$i.\$ac_objext\""
4010 echo " ${macro_prefix_arg}_ltlibobjs=\"\$${macro_prefix_arg}_ltlibobjs \$i.lo\""
4013 echo " AC_SUBST([${macro_prefix_arg}_LIBOBJS], [\$${macro_prefix_arg}_libobjs])"
4014 echo " AC_SUBST([${macro_prefix_arg}_LTLIBOBJS], [\$${macro_prefix_arg}_ltlibobjs])"
4018 # func_emit_initmacro_done macro_prefix sourcebase
4019 # emits a few statements after the gl_INIT macro to standard output.
4020 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4021 # - sourcebase directory relative to destdir where to place source code
4022 func_emit_initmacro_done
()
4024 macro_prefix_arg
="$1"
4027 echo "# Like AC_LIBOBJ, except that the module name goes"
4028 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
4029 echo "AC_DEFUN([${macro_prefix_arg}_LIBOBJ], ["
4030 echo " AS_LITERAL_IF([\$1], [${macro_prefix_arg}_LIBSOURCES([\$1.c])])dnl"
4031 echo " ${macro_prefix_arg}_LIBOBJS=\"\$${macro_prefix_arg}_LIBOBJS \$1.\$ac_objext\""
4034 echo "# Like AC_REPLACE_FUNCS, except that the module name goes"
4035 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
4036 echo "AC_DEFUN([${macro_prefix_arg}_REPLACE_FUNCS], ["
4037 echo " m4_foreach_w([gl_NAME], [\$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl"
4038 echo " AC_CHECK_FUNCS([\$1], , [${macro_prefix_arg}_LIBOBJ(\$ac_func)])"
4041 echo "# Like AC_LIBSOURCES, except the directory where the source file is"
4042 echo "# expected is derived from the gnulib-tool parameterization,"
4043 echo "# and alloca is special cased (for the alloca-opt module)."
4044 echo "# We could also entirely rely on EXTRA_lib..._SOURCES."
4045 echo "AC_DEFUN([${macro_prefix_arg}_LIBSOURCES], ["
4046 echo " m4_foreach([_gl_NAME], [\$1], ["
4047 echo " m4_if(_gl_NAME, [alloca.c], [], ["
4048 echo " m4_define([${macro_prefix_arg}_LIBSOURCES_DIR], [$sourcebase_arg])"
4049 echo " m4_append([${macro_prefix_arg}_LIBSOURCES_LIST], _gl_NAME, [ ])"
4055 # func_emit_autoconf_snippet indentation
4056 # emits the autoconf snippet of a module.
4058 # - indentation spaces to prepend on each line
4059 # - local_gnulib_path from --local-dir
4060 # - modcache true or false, from --cache-modules/--no-cache-modules
4061 # - sed_replace_build_aux sed expression that replaces reference to build-aux
4062 # - sed_replace_include_guard_prefix
4063 # sed expression for resolving ${gl_include_guard_prefix}
4064 # - module the module name
4065 # - toplevel true or false. 'false' means a subordinate use of
4067 # - disable_libtool true or false. It tells whether to disable libtool
4068 # handling even if it has been specified through the
4069 # command line options.
4070 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
4072 func_emit_autoconf_snippet
()
4075 if { case $module in
4076 gnumakefile | maintainer-makefile
)
4077 # These modules are meant to be used only in the top-level directory.
4083 func_get_autoconf_snippet
"$module" \
4084 |
sed -e '/^$/d;' -e "s/^/$indentation/" \
4085 -e "$sed_replace_build_aux" \
4086 -e "$sed_replace_include_guard_prefix" \
4087 |
{ if $disable_libtool; then
4088 sed -e 's/\$gl_cond_libtool/false/g' \
4089 -e 's/gl_libdeps/gltests_libdeps/g' \
4090 -e 's/gl_ltlibdeps/gltests_ltlibdeps/g'
4095 |
{ if $disable_gettext; then
4096 sed -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./'
4098 # Don't indent AM_GNU_GETTEXT_VERSION line, as that confuses
4099 # autopoint through at least GNU gettext version 0.18.2.
4100 sed -e 's/^ *AM_GNU_GETTEXT_VERSION/AM_GNU_GETTEXT_VERSION/'
4103 if test "$module" = 'alloca' && test "$libtool" = true
&& ! $disable_libtool; then
4104 echo 'changequote(,)dnl'
4105 echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
4106 echo 'changequote([, ])dnl'
4107 echo 'AC_SUBST([LTALLOCA])'
4112 # func_emit_autoconf_snippets modules verifier toplevel disable_libtool disable_gettext
4113 # collects and emit the autoconf snippets of a set of modules.
4115 # - local_gnulib_path from --local-dir
4116 # - modcache true or false, from --cache-modules/--no-cache-modules
4117 # - sed_replace_build_aux sed expression that replaces reference to build-aux
4118 # - sed_replace_include_guard_prefix
4119 # sed expression for resolving ${gl_include_guard_prefix}
4120 # - modules the list of modules.
4121 # - verifier one of func_verify_module, func_verify_nontests_module,
4122 # func_verify_tests_module. It selects the subset of
4123 # $modules to consider.
4124 # - toplevel true or false. 'false' means a subordinate use of
4126 # - disable_libtool true or false. It tells whether to disable libtool
4127 # handling even if it has been specified through the
4128 # command line options.
4129 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
4131 func_emit_autoconf_snippets
()
4135 disable_libtool
="$4"
4136 disable_gettext
="$5"
4137 if test "$cond_dependencies" = true
; then
4138 for m
in $modules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/modules
4139 # Emit the autoconf code for the unconditional modules.
4140 for module
in $1; do
4142 if test -n "$module"; then
4143 if func_cond_module_p
"$module"; then
4146 func_emit_autoconf_snippet
" "
4150 # Initialize the shell variables indicating that the modules are enabled.
4151 for module
in $1; do
4153 if test -n "$module"; then
4154 if func_cond_module_p
"$module"; then
4155 func_module_shellvar_name
"$module"
4156 echo " $shellvar=false"
4160 # Emit the autoconf code for the conditional modules, each in a separate
4161 # function. This makes it possible to support cycles among conditional
4163 for module
in $1; do
4165 if test -n "$module"; then
4166 if func_cond_module_p
"$module"; then
4167 func_module_shellfunc_name
"$module"
4168 func_module_shellvar_name
"$module"
4169 echo " $shellfunc ()"
4171 echo " if ! \$$shellvar; then"
4172 func_emit_autoconf_snippet
" "
4173 echo " $shellvar=true"
4174 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
4175 # Intersect $deps with the modules list $1.
4176 deps
=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
4177 for dep
in $deps; do
4178 if func_cond_module_p
"$dep"; then
4179 func_module_shellfunc_name
"$dep"
4180 func_cond_module_condition
"$module" "$dep"
4181 if test "$condition" != true
; then
4182 echo " if $condition; then"
4189 # The autoconf code for $dep has already been emitted above and
4190 # therefore is already executed when this function is run.
4199 # Emit the dependencies from the unconditional to the conditional modules.
4200 for module
in $1; do
4202 if test -n "$module"; then
4203 if func_cond_module_p
"$module"; then
4206 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
4207 # Intersect $deps with the modules list $1.
4208 deps
=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
4209 for dep
in $deps; do
4210 if func_cond_module_p
"$dep"; then
4211 func_module_shellfunc_name
"$dep"
4212 func_cond_module_condition
"$module" "$dep"
4213 if test "$condition" != true
; then
4214 echo " if $condition; then"
4221 # The autoconf code for $dep has already been emitted above and
4222 # therefore is already executed when this code is run.
4229 # Define the Automake conditionals.
4230 echo " m4_pattern_allow([^${macro_prefix}_GNULIB_ENABLED_])"
4231 for module
in $1; do
4233 if test -n "$module"; then
4234 if func_cond_module_p
"$module"; then
4235 func_module_conditional_name
"$module"
4236 func_module_shellvar_name
"$module"
4237 echo " AM_CONDITIONAL([$conditional], [\$$shellvar])"
4242 # Ignore the conditions, and enable all modules unconditionally.
4243 for module
in $1; do
4245 if test -n "$module"; then
4246 func_emit_autoconf_snippet
" "
4252 # func_emit_pre_early_macros require indentation modules
4253 # The require parameter can be ':' (AC_REQUIRE) or 'false' (direct call).
4254 func_emit_pre_early_macros
()
4257 echo "${2}# Pre-early section."
4259 _pre_early_snippet
="echo \"${2}AC_REQUIRE([\$_pre_early_macro])\""
4261 _pre_early_snippet
="echo \"${2}\$_pre_early_macro\""
4264 # We need to call gl_USE_SYSTEM_EXTENSIONS before gl_PROG_AR_RANLIB. Doing
4265 # AC_REQUIRE in configure-ac.early is not early enough.
4266 _pre_early_macro
="gl_USE_SYSTEM_EXTENSIONS"
4267 case "${nl}${3}${nl}" in
4268 *${nl}extensions
${nl}*) eval "$_pre_early_snippet" ;;
4271 _pre_early_macro
="gl_PROG_AR_RANLIB"
4272 eval "$_pre_early_snippet"
4276 # func_reconstruct_cached_dir
4277 # callback for func_reconstruct_cached_local_gnulib_path
4279 # - destdir from --dir
4281 # - local_gnulib_path restored '--local-dir' path from cache
4282 func_reconstruct_cached_dir
()
4285 if test -n "$cached_dir"; then
4288 func_path_append local_gnulib_path
"$destdir/$cached_dir" ;;
4290 case "$cached_dir" in
4292 func_path_append local_gnulib_path
"$destdir/$cached_dir" ;;
4294 func_relconcat
"$destdir" "$cached_dir"
4295 func_path_append local_gnulib_path
"$relconcat" ;;
4301 # func_reconstruct_cached_local_gnulib_path
4302 # reconstruct local_gnulib_path from cached_local_gnulib_path to be set
4303 # relatively to $destdir again.
4305 # - cached_local_gnulib_path local_gnulib_path stored within gnulib-cache.m4
4306 # - destdir from --dir
4308 # - local_gnulib_path restored '--local-dir' path from cache
4309 func_reconstruct_cached_local_gnulib_path
()
4311 func_path_foreach
"$cached_local_gnulib_path" func_reconstruct_cached_dir
%dir
%
4314 # func_import modules
4315 # Uses also the variables
4316 # - mode import or add-import or remove-import or update
4317 # - destdir target directory
4318 # - local_gnulib_path from --local-dir
4319 # - modcache true or false, from --cache-modules/--no-cache-modules
4320 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
4321 # - libname library name
4322 # - supplied_libname true if --lib was given, blank otherwise
4323 # - sourcebase directory relative to destdir where to place source code
4324 # - m4base directory relative to destdir where to place *.m4 macros
4325 # - pobase directory relative to destdir where to place *.po files
4326 # - docbase directory relative to destdir where to place doc files
4327 # - testsbase directory relative to destdir where to place unit test code
4328 # - auxdir directory relative to destdir where to place build aux files
4329 # - inctests true if --with-tests was given, false otherwise
4330 # - incobsolete true if --with-obsolete was given, blank otherwise
4331 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
4332 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
4334 # - inc_privileged_tests true if --with-privileged-tests was given, blank
4336 # - inc_unportable_tests true if --with-unportable-tests was given, blank
4338 # - inc_all_tests true if --with-all-tests was given, blank otherwise
4339 # - avoidlist list of modules to avoid, from --avoid
4340 # - cond_dependencies true if --conditional-dependencies was given, false if
4341 # --no-conditional-dependencies was given, blank otherwise
4342 # - lgpl yes or a number if library's license shall be LGPL,
4344 # - makefile_name from --makefile-name
4345 # - libtool true if --libtool was given, false if --no-libtool was
4346 # given, blank otherwise
4347 # - guessed_libtool true if the configure.ac file uses libtool, false otherwise
4348 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4349 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
4350 # - witness_c_macro from --witness-c-macro
4351 # - vc_files true if --vc-files was given, false if --no-vc-files was
4352 # given, blank otherwise
4353 # - autoconf_minversion minimum supported autoconf version
4354 # - doit : if actions shall be executed, false if only to be printed
4355 # - symbolic true if files should be symlinked, copied otherwise
4356 # - lsymbolic true if files from local_gnulib_path should be symlinked,
4358 # - do_copyrights true if copyright notices in files should be replaced,
4362 # Get the cached settings.
4363 # In 'import' mode, we read them only for the purpose of knowing the old
4364 # installed file list, and don't use them as defaults.
4365 cached_local_gnulib_path
=
4366 cached_specified_modules
=
4368 cached_inc_cxx_tests
=
4369 cached_inc_longrunning_tests
=
4370 cached_inc_privileged_tests
=
4371 cached_inc_unportable_tests
=
4372 cached_inc_all_tests
=
4382 cached_makefile_name
=
4383 cached_cond_dependencies
=
4385 cached_macro_prefix
=
4387 cached_witness_c_macro
=
4390 if test -f "$destdir"/$m4base/gnulib-cache.
m4; then
4391 cached_libtool
=false
4397 s,^.*gl_LOCAL_DIR([[ ]*\([^]"$`\\)]*\).*$,cached_local_gnulib_path="\1",p
4407 s,^.*gl_MODULES([[ ]*\([^]"$`\\)]*\).*$,cached_specified_modules="\1",p
4409 /gl_WITH_OBSOLETE/ {
4410 s,^.*$,cached_incobsolete=true,p
4412 /gl_WITH_CXX_TESTS/ {
4413 s,^.*$,cached_inc_cxx_tests=true,p
4415 /gl_WITH_LONGRUNNING_TESTS/ {
4416 s,^.*$,cached_inc_longrunning_tests=true,p
4418 /gl_WITH_PRIVILEGED_TESTS/ {
4419 s,^.*$,cached_inc_privileged_tests=true,p
4421 /gl_WITH_UNPORTABLE_TESTS/ {
4422 s,^.*$,cached_inc_unportable_tests=true,p
4424 /gl_WITH_ALL_TESTS/ {
4425 s,^.*$,cached_inc_all_tests=true,p
4428 s,^.*gl_AVOID([[ ]*\([^]"$`\\)]*\).*$,cached_avoidlist="\1",p
4431 s,^.*gl_SOURCE_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_sourcebase="\1",p
4434 s,^.*gl_M4_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_m4base="\1",p
4437 s,^.*gl_PO_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_pobase="\1",p
4440 s,^.*gl_DOC_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_docbase="\1",p
4443 s,^.*gl_TESTS_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_testsbase="\1",p
4446 s,^.*$,cached_inctests=true,p
4449 s,^.*gl_LIB([[ ]*\([^]"$`\\)]*\).*$,cached_libname="\1",p
4452 s,^.*gl_LGPL([[ ]*\([^]"$`\\)]*\).*$,cached_lgpl="\1",p
4455 s,^.*$,cached_lgpl=yes,p
4457 /gl_MAKEFILE_NAME(/ {
4458 s,^.*gl_MAKEFILE_NAME([[ ]*\([^]"$`\\)]*\).*$,cached_makefile_name="\1",p
4460 /gl_CONDITIONAL_DEPENDENCIES/ {
4461 s,^.*$,cached_cond_dependencies=true,p
4464 s,^.*$,cached_libtool=true,p
4466 /gl_MACRO_PREFIX(/ {
4467 s,^.*gl_MACRO_PREFIX([[ ]*\([^]"$`\\)]*\).*$,cached_macro_prefix="\1",p
4470 s,^.*gl_PO_DOMAIN([[ ]*\([^]"$`\\)]*\).*$,cached_po_domain="\1",p
4472 /gl_WITNESS_C_MACRO(/ {
4473 s,^.*gl_WITNESS_C_MACRO([[ ]*\([^]"$`\\)]*\).*$,cached_witness_c_macro="\1",p
4476 s,^.*gl_VC_FILES([[ ]*\([^]"$`\\)]*\).*$,cached_vc_files="\1",p
4478 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-cache.m4`
4479 if test -f "$destdir"/$m4base/gnulib-comp.
m4; then
4484 /AC_DEFUN(\['"${cached_macro_prefix}"'_FILE_LIST\], \[/ {
4485 s,^.*$,cached_files=",p
4498 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-comp.m4`
4502 if test "$mode" = import
; then
4503 # In 'import' mode, the new set of specified modules overrides the cached
4504 # set of modules. Ignore the cached settings.
4505 specified_modules
="$1"
4507 # Merge the cached settings with the specified ones.
4508 # The m4base must be the same as expected from the pathname.
4509 if test -n "$cached_m4base" && test "$cached_m4base" != "$m4base"; then
4510 func_fatal_error
"$m4base/gnulib-cache.m4 is expected to contain gl_M4_BASE([$m4base])"
4512 # The local_gnulib_path defaults to the cached one. Recall that the cached one
4513 # is relative to $destdir, whereas the one we use is relative to . or absolute.
4514 if test -z "$local_gnulib_path"; then
4515 func_reconstruct_cached_local_gnulib_path
4519 # Append the cached and the specified module names. So that
4520 # "gnulib-tool --add-import foo" means to add the module foo.
4521 specified_modules
="$cached_specified_modules $1"
4524 # Take the cached module names, minus the specified module names.
4526 if $have_associative; then
4527 # Use an associative array, for O(N) worst-case run time.
4528 declare -A to_remove
4530 eval 'to_remove[$m]=yes'
4532 for module
in $cached_specified_modules; do
4533 if eval 'test -z "${to_remove[$module]}"'; then
4534 func_append specified_modules
"$module "
4538 # This loop has O(N**2) worst-case run time.
4539 for module
in $cached_specified_modules; do
4542 if test "$m" = "$module"; then
4547 if test -z "$to_remove"; then
4548 func_append specified_modules
"$module "
4554 # Take the cached module names. There are no specified module names.
4555 specified_modules
="$cached_specified_modules"
4558 # Included obsolete modules among the dependencies if specified either way.
4559 if test -z "$incobsolete"; then
4560 incobsolete
="$cached_incobsolete"
4562 # Included special kinds of tests modules among the dependencies if specified
4564 if test -z "$inc_cxx_tests"; then
4565 inc_cxx_tests
="$cached_inc_cxx_tests"
4567 if test -z "$inc_longrunning_tests"; then
4568 inc_longrunning_tests
="$cached_inc_longrunning_tests"
4570 if test -z "$inc_privileged_tests"; then
4571 inc_privileged_tests
="$cached_inc_privileged_tests"
4573 if test -z "$inc_unportable_tests"; then
4574 inc_unportable_tests
="$cached_inc_unportable_tests"
4576 if test -z "$inc_all_tests"; then
4577 inc_all_tests
="$cached_inc_all_tests"
4579 # Append the cached and the specified avoidlist. This is probably better
4580 # than dropping the cached one when --avoid is specified at least once.
4581 avoidlist
=`for m in $cached_avoidlist $avoidlist; do echo $m; done | LC_ALL=C sort -u`
4582 avoidlist
=`echo $avoidlist`
4584 # The sourcebase defaults to the cached one.
4585 if test -z "$sourcebase"; then
4586 sourcebase
="$cached_sourcebase"
4587 if test -z "$sourcebase"; then
4588 func_fatal_error
"missing --source-base option"
4591 # The pobase defaults to the cached one.
4592 if test -z "$pobase"; then
4593 pobase
="$cached_pobase"
4595 # The docbase defaults to the cached one.
4596 if test -z "$docbase"; then
4597 docbase
="$cached_docbase"
4598 if test -z "$docbase"; then
4599 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."
4602 # The testsbase defaults to the cached one.
4603 if test -z "$testsbase"; then
4604 testsbase
="$cached_testsbase"
4605 if test -z "$testsbase"; then
4606 func_fatal_error
"missing --tests-base option"
4609 # Require the tests if specified either way.
4610 if ! $inctests; then
4611 inctests
="$cached_inctests"
4612 if test -z "$inctests"; then
4616 # The libname defaults to the cached one.
4617 if test -z "$supplied_libname"; then
4618 libname
="$cached_libname"
4619 if test -z "$libname"; then
4620 func_fatal_error
"missing --lib option"
4623 # Require LGPL if specified either way.
4624 if test -z "$lgpl"; then
4627 # The makefile_name defaults to the cached one.
4628 if test -z "$makefile_name"; then
4629 makefile_name
="$cached_makefile_name"
4631 # Use conditional dependencies if specified either way.
4632 if test -z "$cond_dependencies"; then
4633 cond_dependencies
="$cached_cond_dependencies"
4635 # Use libtool if specified either way, or if guessed.
4636 if test -z "$libtool"; then
4637 if test -n "$cached_m4base"; then
4638 libtool
="$cached_libtool"
4640 libtool
="$guessed_libtool"
4643 # The macro_prefix defaults to the cached one.
4644 if test -z "$macro_prefix"; then
4645 macro_prefix
="$cached_macro_prefix"
4646 if test -z "$macro_prefix"; then
4647 func_fatal_error
"missing --macro-prefix option"
4650 # The po_domain defaults to the cached one.
4651 if test -z "$po_domain"; then
4652 po_domain
="$cached_po_domain"
4654 # The witness_c_macro defaults to the cached one.
4655 if test -z "$witness_c_macro"; then
4656 witness_c_macro
="$cached_witness_c_macro"
4658 # The vc_files defaults to the cached one.
4659 if test -z "$vc_files"; then
4660 vc_files
="$cached_vc_files"
4662 # Ensure constraints.
4663 if test "$cond_dependencies" = true
&& $inctests; then
4664 echo "gnulib-tool: option --conditional-dependencies is not supported with --with-tests" 1>&2
4668 # --without-*-tests options are not supported here.
4670 excl_longrunning_tests
=
4671 excl_privileged_tests
=
4672 excl_unportable_tests
=
4674 # Canonicalize the list of specified modules.
4675 specified_modules
=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
4677 # Include all kinds of tests modules if --with-all-tests was specified.
4678 inc_all_direct_tests
="$inc_all_tests"
4679 inc_all_indirect_tests
="$inc_all_tests"
4681 # Determine final module list.
4682 modules
="$specified_modules"
4683 func_modules_transitive_closure
4684 if test $verbose -ge 0; then
4685 func_show_module_list
4687 final_modules
="$modules"
4689 # Determine main module list and tests-related module list separately.
4690 func_modules_transitive_closure_separately
4692 # Determine whether a $testsbase/libtests.a is needed.
4693 func_determine_use_libtests
4695 # Add the dummy module to the main module list or to the tests-related module
4697 func_modules_add_dummy_separately
4699 # If --lgpl, verify that the licenses of modules are compatible.
4700 if test -n "$lgpl"; then
4701 license_incompatibilities
=
4702 for module
in $main_modules; do
4703 license
=`func_get_license $module`
4705 'GPLed build tool') ;;
4706 'public domain' |
'unlimited' |
'unmodifiable license text') ;;
4711 LGPLv2
+ |
'LGPLv3+ or GPLv2' | LGPLv3
+ | LGPL
) ;;
4712 *) func_append license_incompatibilities
"$module $license$nl" ;;
4717 LGPLv2
+ |
'LGPLv3+ or GPLv2') ;;
4718 *) func_append license_incompatibilities
"$module $license$nl" ;;
4724 *) func_append license_incompatibilities
"$module $license$nl" ;;
4727 *) func_fatal_error
"invalid value lgpl=$lgpl" ;;
4732 if test -n "$license_incompatibilities"; then
4733 # Format the license incompatibilities as a table.
4734 sed_expand_column1_width50_indent17
='s,^\([^ ]*\) ,\1 ,
4735 s,^\(.................................................[^ ]*\) *, \1 ,'
4736 license_incompatibilities
=`echo "$license_incompatibilities" | sed -e "$sed_expand_column1_width50_indent17"`
4737 func_fatal_error
"incompatible license on modules:$nl$license_incompatibilities"
4741 # Show banner notice of every module.
4742 modules
="$main_modules"
4745 # Determine script to apply to imported library files.
4746 sed_transform_lib_file
=
4747 for module
in $main_modules; do
4748 if test $module = config-h
; then
4749 # Assume config.h exists, and that -DHAVE_CONFIG_H is omitted.
4750 sed_transform_lib_file
=$sed_transform_lib_file'
4751 s/^#ifdef[ ]*HAVE_CONFIG_H[ ]*$/#if 1/
4756 sed_transform_main_lib_file
="$sed_transform_lib_file"
4757 if test -n "$do_copyrights"; then
4758 if test -n "$lgpl"; then
4762 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
4763 s/GNU General/GNU Lesser General/g
4764 s/General Public License/Lesser General Public License/g
4765 s/Lesser Lesser General Public License/Lesser General Public License/g
4769 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
4770 s/GNU General/GNU Lesser General/g
4771 s/General Public License/Lesser General Public License/g
4772 s/Lesser Lesser General Public License/Lesser General Public License/g
4774 s/version [23]\([ ,]\)/version 2.1\1/g
4777 *) func_fatal_error
"invalid value lgpl=$lgpl" ;;
4781 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
4782 s/GNU Lesser General/GNU General/g
4783 s/Lesser General Public License/General Public License/g
4785 s/GNU Library General/GNU General/g
4786 s/Library General Public License/General Public License/g
4788 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
4793 # Determine script to apply to auxiliary files that go into $auxdir/.
4794 sed_transform_build_aux_file
=
4795 if test -n "$do_copyrights"; then
4797 sed_transform_build_aux_file
=$sed_transform_build_aux_file'
4798 s/GNU Lesser General/GNU General/g
4799 s/Lesser General Public License/General Public License/g
4801 s/GNU Library General/GNU General/g
4802 s/Library General Public License/General Public License/g
4804 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
4808 # Determine script to apply to library files that go into $testsbase/.
4809 sed_transform_testsrelated_lib_file
="$sed_transform_lib_file"
4810 if test -n "$do_copyrights"; then
4812 sed_transform_testsrelated_lib_file
=$sed_transform_testsrelated_lib_file'
4813 s/GNU Lesser General/GNU General/g
4814 s/Lesser General Public License/General Public License/g
4816 s/GNU Library General/GNU General/g
4817 s/Library General Public License/General Public License/g
4819 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
4823 # Determine the final file lists.
4824 func_modules_to_filelist_separately
4827 || func_fatal_error
"refusing to do nothing"
4829 # Add m4/gnulib-tool.m4 to the file list. It is not part of any module.
4830 new_files
="$files m4/gnulib-tool.m4"
4831 old_files
="$cached_files"
4832 if test -f "$destdir"/$m4base/gnulib-tool.
m4; then
4833 func_append old_files
" m4/gnulib-tool.m4"
4836 rewritten
='%REWRITTEN%'
4837 sed_rewrite_old_files
="\
4838 s,^build-aux/,$rewritten$auxdir/,
4839 s,^doc/,$rewritten$cached_docbase/,
4840 s,^lib/,$rewritten$cached_sourcebase/,
4841 s,^m4/,$rewritten$cached_m4base/,
4842 s,^tests/,$rewritten$cached_testsbase/,
4843 s,^tests=lib/,$rewritten$cached_testsbase/,
4846 sed_rewrite_new_files
="\
4847 s,^build-aux/,$rewritten$auxdir/,
4848 s,^doc/,$rewritten$docbase/,
4849 s,^lib/,$rewritten$sourcebase/,
4850 s,^m4/,$rewritten$m4base/,
4851 s,^tests/,$rewritten$testsbase/,
4852 s,^tests=lib/,$rewritten$testsbase/,
4856 # Create directories.
4857 { echo "$sourcebase"
4859 if test -n "$pobase"; then
4862 docfiles
=`echo "$files" | sed -n -e 's,^doc/,,p'`
4863 if test -n "$docfiles"; then
4870 for f
in $files; do echo $f; done \
4871 |
sed -e "$sed_rewrite_new_files" \
4872 |
sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
4875 { # Rearrange file descriptors. Needed because "while ... done < ..."
4876 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
4877 exec 5<&0 < "$tmp"/dirs
4879 if test ! -d "$destdir/$d"; then
4881 echo "Creating directory $destdir/$d"
4882 mkdir
-p "$destdir/$d" || func_fatal_error
"failed"
4884 echo "Create directory $destdir/$d"
4891 # Copy files or make symbolic links. Remove obsolete files.
4895 # Construct a table with 2 columns: rewritten-file-name original-file-name,
4896 # representing the files according to the last gnulib-tool invocation.
4897 for f
in $old_files; do echo $f; done \
4898 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_old_files" \
4901 # Construct a table with 2 columns: rewritten-file-name original-file-name,
4902 # representing the files after this gnulib-tool invocation.
4903 for f
in $new_files; do echo $f; done \
4904 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" \
4907 # First the files that are in old-files, but not in new-files:
4908 sed_take_first_column
='s,'"$delimiter"'.*,,'
4909 for g
in `LC_ALL=C join -t"$delimiter" -v1 "$tmp"/old-files "$tmp"/new-files | sed -e "$sed_take_first_column"`; do
4910 # Remove the file. Do nothing if the user already removed it.
4911 if test -f "$destdir/$g" ||
test -h "$destdir/$g"; then
4913 echo "Removing file $g (backup in ${g}~)"
4914 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error
"failed"
4916 echo "Remove file $g (backup in ${g}~)"
4918 func_append removed_files
"$g$nl"
4921 # func_add_or_update handles a file that ought to be present afterwards.
4923 # - f the original file name
4924 # - g the rewritten file name
4925 # - already_present nonempty if the file should already exist, empty
4927 func_add_or_update
()
4931 tests
=lib
/*) f
=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
4935 *.class |
*.mo
) is_binary_file
=true
;;
4937 func_dest_tmpfilename
"$g"
4938 func_lookup_file
"$f"
4939 cp "$lookedup_file" "$tmpfile" || func_fatal_error
"failed"
4940 if test -n "$sed_transform_main_lib_file" \
4941 && test -z "$is_binary_file"; then
4944 sed -e "$sed_transform_main_lib_file" \
4945 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
4949 if test -n "$sed_transform_build_aux_file" \
4950 && test -z "$is_binary_file"; then
4953 sed -e "$sed_transform_build_aux_file" \
4954 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
4958 if test -n "$sed_transform_testsrelated_lib_file" \
4959 && test -z "$is_binary_file"; then
4962 sed -e "$sed_transform_testsrelated_lib_file" \
4963 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
4967 if test -f "$destdir/$g"; then
4968 # The file already exists.
4972 # Don't protest if the file should be there but isn't: it happens
4973 # frequently that developers don't put autogenerated files under version control.
4975 func_append added_files
"$g$nl"
4979 # Then the files that are in new-files, but not in old-files:
4980 sed_take_last_column
='s,^.*'"$delimiter"',,'
4982 LC_ALL
=C
join -t"$delimiter" -v2 "$tmp"/old-files
"$tmp"/new-files \
4983 |
sed -e "$sed_take_last_column" \
4984 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/added-files
4985 { # Rearrange file descriptors. Needed because "while ... done < ..."
4986 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
4987 exec 5<&0 < "$tmp"/added-files
4993 # Then the files that are in new-files and in old-files:
4994 already_present
=true
4995 LC_ALL
=C
join -t"$delimiter" "$tmp"/old-files
"$tmp"/new-files \
4996 |
sed -e "$sed_take_last_column" \
4997 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/kept-files
4998 { # Rearrange file descriptors. Needed because "while ... done < ..."
4999 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5000 exec 5<&0 < "$tmp"/kept-files
5007 # Command-line invocation printed in a comment in generated gnulib-cache.m4.
5008 actioncmd
="gnulib-tool --import"
5011 func_append_local_dir
()
5013 func_append
"$1" " --local-dir=$2"
5015 func_path_foreach
"$local_gnulib_path" func_append_local_dir actioncmd
%dir
%
5017 func_append actioncmd
" --lib=$libname"
5018 func_append actioncmd
" --source-base=$sourcebase"
5019 func_append actioncmd
" --m4-base=$m4base"
5020 if test -n "$pobase"; then
5021 func_append actioncmd
" --po-base=$pobase"
5023 func_append actioncmd
" --doc-base=$docbase"
5024 func_append actioncmd
" --tests-base=$testsbase"
5025 func_append actioncmd
" --aux-dir=$auxdir"
5027 func_append actioncmd
" --with-tests"
5029 if test -n "$incobsolete"; then
5030 func_append actioncmd
" --with-obsolete"
5032 if test -n "$inc_cxx_tests"; then
5033 func_append actioncmd
" --with-c++-tests"
5035 if test -n "$inc_longrunning_tests"; then
5036 func_append actioncmd
" --with-longrunning-tests"
5038 if test -n "$inc_privileged_tests"; then
5039 func_append actioncmd
" --with-privileged-tests"
5041 if test -n "$inc_unportable_tests"; then
5042 func_append actioncmd
" --with-unportable-tests"
5044 if test -n "$inc_all_tests"; then
5045 func_append actioncmd
" --with-all-tests"
5047 for module
in $avoidlist; do
5048 func_append actioncmd
" --avoid=$module"
5050 if test -n "$lgpl"; then
5051 if test "$lgpl" = yes; then
5052 func_append actioncmd
" --lgpl"
5054 func_append actioncmd
" --lgpl=$lgpl"
5057 if test -n "$makefile_name"; then
5058 func_append actioncmd
" --makefile-name=$makefile_name"
5060 if test "$cond_dependencies" = true
; then
5061 func_append actioncmd
" --conditional-dependencies"
5063 func_append actioncmd
" --no-conditional-dependencies"
5065 if test "$libtool" = true
; then
5066 func_append actioncmd
" --libtool"
5068 func_append actioncmd
" --no-libtool"
5070 func_append actioncmd
" --macro-prefix=$macro_prefix"
5071 if test -n "$po_domain"; then
5072 func_append actioncmd
" --po-domain=$po_domain"
5074 if test -n "$witness_c_macro"; then
5075 func_append actioncmd
" --witness-c-macro=$witness_c_macro"
5077 if test -n "$vc_files"; then
5078 if test "$vc_files" = true
; then
5079 func_append actioncmd
" --vc-files"
5081 func_append actioncmd
" --no-vc-files"
5084 func_append actioncmd
" `echo $specified_modules`"
5086 # Determine include_guard_prefix.
5087 func_compute_include_guard_prefix
5089 # Default the makefile name to Makefile.am.
5090 if test -n "$makefile_name"; then
5091 makefile_am
=$makefile_name
5093 makefile_am
=Makefile.am
5096 # Create normal Makefile.ams.
5099 # Setup list of Makefile.am edits that are to be performed afterwards.
5100 # Some of these edits apply to files that we will generate; others are
5101 # under the responsibility of the developer.
5103 # func_note_Makefile_am_edit dir var value
5104 # remembers that ${dir}Makefile.am needs to be edited to that ${var} mentions
5106 func_note_Makefile_am_edit
()
5108 makefile_am_edits
=`expr $makefile_am_edits + 1`
5109 eval makefile_am_edit
${makefile_am_edits}_dir
=\"\
$1\"
5110 eval makefile_am_edit
${makefile_am_edits}_var
=\"\
$2\"
5111 eval makefile_am_edit
${makefile_am_edits}_val
=\"\
$3\"
5113 if test "$makefile_am" = Makefile.am
; then
5114 sourcebase_dir
=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'`
5115 sourcebase_base
=`basename "$sourcebase"`
5116 func_note_Makefile_am_edit
"$sourcebase_dir" SUBDIRS
"$sourcebase_base"
5118 if test -n "$pobase"; then
5119 pobase_dir
=`echo "$pobase" | sed -n -e 's,/[^/]*$,/,p'`
5120 pobase_base
=`basename "$pobase"`
5121 func_note_Makefile_am_edit
"$pobase_dir" SUBDIRS
"$pobase_base"
5124 if test "$makefile_am" = Makefile.am
; then
5125 testsbase_dir
=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'`
5126 testsbase_base
=`basename "$testsbase"`
5127 func_note_Makefile_am_edit
"$testsbase_dir" SUBDIRS
"$testsbase_base"
5130 func_note_Makefile_am_edit
"" ACLOCAL_AMFLAGS
"-I ${m4base}"
5132 # Find the first parent directory of $m4base that contains or will contain
5134 sed_last
='s,^.*/\([^/][^/]*\)//*$,\1/,
5136 sed_butlast
='s,[^/][^/]*//*$,,'
5137 dir1
="${m4base}/"; dir2
=""
5138 while test -n "$dir1" \
5139 && ! { test -f "${destdir}/${dir1}Makefile.am" \
5140 ||
test "${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
5141 ||
test "./${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
5143 && { test "${dir1}Makefile.am" = "$testsbase/$makefile_am" \
5144 ||
test "./${dir1}Makefile.am" = "$testsbase/$makefile_am"; }; }; }; do
5145 dir2
=`echo "$dir1" | sed -e "$sed_last"`"$dir2"
5146 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
5148 func_note_Makefile_am_edit
"$dir1" EXTRA_DIST
"${dir2}gnulib-cache.m4"
5151 # Create library makefile.
5152 func_dest_tmpfilename
$sourcebase/$makefile_am
5153 destfile
="$sourcebase/$makefile_am"
5154 modules
="$main_modules"
5155 func_emit_lib_Makefile_am
> "$tmpfile"
5156 if test -f "$destdir"/$sourcebase/$makefile_am; then
5157 if cmp -s "$destdir"/$sourcebase/$makefile_am "$tmpfile"; then
5161 echo "Updating $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
5162 mv -f "$destdir"/$sourcebase/$makefile_am "$destdir"/$sourcebase/$makefile_am~
5163 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
5165 echo "Update $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
5171 echo "Creating $sourcebase/$makefile_am"
5172 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
5174 echo "Create $sourcebase/$makefile_am"
5177 func_append added_files
"$sourcebase/$makefile_am$nl"
5180 # Create po/ directory.
5181 if test -n "$pobase"; then
5182 # Create po makefile and auxiliary files.
5183 for file in Makefile.
in.
in remove-potcdate.sin
; do
5184 func_dest_tmpfilename
$pobase/$file
5185 func_lookup_file build-aux
/po
/$file
5186 cat "$lookedup_file" > "$tmpfile"
5187 if test -f "$destdir"/$pobase/$file; then
5188 if cmp -s "$destdir"/$pobase/$file "$tmpfile"; then
5192 echo "Updating $pobase/$file (backup in $pobase/$file~)"
5193 mv -f "$destdir"/$pobase/$file "$destdir"/$pobase/$file~
5194 mv -f "$tmpfile" "$destdir"/$pobase/$file
5196 echo "Update $pobase/$file (backup in $pobase/$file~)"
5202 echo "Creating $pobase/$file"
5203 mv -f "$tmpfile" "$destdir"/$pobase/$file
5205 echo "Create $pobase/$file"
5208 func_append added_files
"$pobase/$file$nl"
5211 # Create po makefile parameterization, part 1.
5212 func_dest_tmpfilename
$pobase/Makevars
5213 func_emit_po_Makevars
> "$tmpfile"
5214 if test -f "$destdir"/$pobase/Makevars
; then
5215 if cmp -s "$destdir"/$pobase/Makevars
"$tmpfile"; then
5219 echo "Updating $pobase/Makevars (backup in $pobase/Makevars~)"
5220 mv -f "$destdir"/$pobase/Makevars
"$destdir"/$pobase/Makevars~
5221 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
5223 echo "Update $pobase/Makevars (backup in $pobase/Makevars~)"
5229 echo "Creating $pobase/Makevars"
5230 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
5232 echo "Create $pobase/Makevars"
5235 func_append added_files
"$pobase/Makevars$nl"
5237 # Create po makefile parameterization, part 2.
5238 func_dest_tmpfilename
$pobase/POTFILES.
in
5239 func_emit_po_POTFILES_in
> "$tmpfile"
5240 if test -f "$destdir"/$pobase/POTFILES.
in; then
5241 if cmp -s "$destdir"/$pobase/POTFILES.
in "$tmpfile"; then
5245 echo "Updating $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
5246 mv -f "$destdir"/$pobase/POTFILES.
in "$destdir"/$pobase/POTFILES.
in~
5247 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.
in
5249 echo "Update $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
5255 echo "Creating $pobase/POTFILES.in"
5256 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.
in
5258 echo "Create $pobase/POTFILES.in"
5261 func_append added_files
"$pobase/POTFILES.in$nl"
5264 TP_URL
="http://translationproject.org/latest/"
5265 TP_RSYNC_URI
="translationproject.org::tp/latest/"
5267 echo "Fetching gnulib PO files from $TP_URL"
5268 (cd "$destdir"/$pobase \
5269 && { # Prefer rsync over wget if it is available, since it consumes
5270 # less network bandwidth, due to compression.
5271 if type rsync
2>/dev
/null |
grep / > /dev
/null
; then
5272 rsync
--delete --exclude "*.s1" -Lrtz "${TP_RSYNC_URI}gnulib/" .
&& return
5275 wget
--no-verbose --mirror -nd -np -A.po
-P .
"${TP_URL}gnulib/"
5279 echo "Fetch gnulib PO files from $TP_URL"
5281 # Create po/LINGUAS.
5283 func_dest_tmpfilename
$pobase/LINGUAS
5284 (cd "$destdir"/$pobase \
5285 && { echo '# Set of available languages.'
5286 LC_ALL
=C
ls -1 *.po |
sed -e 's,\.po$,,'
5289 if test -f "$destdir"/$pobase/LINGUAS
; then
5290 if cmp -s "$destdir"/$pobase/LINGUAS
"$tmpfile"; then
5293 echo "Updating $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
5294 mv -f "$destdir"/$pobase/LINGUAS
"$destdir"/$pobase/LINGUAS~
5295 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
5298 echo "Creating $pobase/LINGUAS"
5299 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
5300 func_append added_files
"$pobase/LINGUAS$nl"
5303 if test -f "$destdir"/$pobase/LINGUAS
; then
5304 echo "Update $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
5306 echo "Create $pobase/LINGUAS"
5311 # func_count_relative_local_gnulib_path
5312 # gl_LOCAL_DIR requires local_gnulib_path to be set relatively to destdir
5314 # - local_gnulib_path from --local-dir
5315 # - destdir from --dir
5317 # - relative_local_dir path to be stored into gl_LOCAL_DIR
5318 func_count_relative_local_gnulib_path
()
5322 relative_local_gnulib_path
=
5323 for local_dir
in $local_gnulib_path
5325 # Store the local_dir relative to destdir.
5326 case "$local_dir" in
5328 relative_local_dir
="$local_dir" ;;
5331 /*) relative_local_dir
="$local_dir" ;;
5333 # destdir, local_dir are both relative.
5334 func_relativize
"$destdir" "$local_dir"
5335 relative_local_dir
="$reldir" ;;
5338 func_path_append relative_local_gnulib_path
"$relative_local_dir"
5343 # Create m4/gnulib-cache.m4.
5344 func_dest_tmpfilename
$m4base/gnulib-cache.
m4
5346 func_emit_copyright_notice
5348 echo "# This file represents the specification of how gnulib-tool is used."
5349 echo "# It acts as a cache: It is written and read by gnulib-tool."
5350 echo "# In projects that use version control, this file is meant to be put under"
5351 echo "# version control, like the configure.ac and various Makefile.am files."
5354 echo "# Specification in the form of a command-line invocation:"
5357 echo "# Specification in the form of a few gnulib-tool.m4 macro invocations:"
5358 func_count_relative_local_gnulib_path
5359 echo "gl_LOCAL_DIR([$relative_local_gnulib_path])"
5361 echo "$specified_modules" |
sed -e 's/^/ /g'
5363 test -z "$incobsolete" ||
echo "gl_WITH_OBSOLETE"
5364 test -z "$inc_cxx_tests" ||
echo "gl_WITH_CXX_TESTS"
5365 test -z "$inc_longrunning_tests" ||
echo "gl_WITH_LONGRUNNING_TESTS"
5366 test -z "$inc_privileged_tests" ||
echo "gl_WITH_PRIVILEGED_TESTS"
5367 test -z "$inc_unportable_tests" ||
echo "gl_WITH_UNPORTABLE_TESTS"
5368 test -z "$inc_all_tests" ||
echo "gl_WITH_ALL_TESTS"
5369 echo "gl_AVOID([$avoidlist])"
5370 echo "gl_SOURCE_BASE([$sourcebase])"
5371 echo "gl_M4_BASE([$m4base])"
5372 echo "gl_PO_BASE([$pobase])"
5373 echo "gl_DOC_BASE([$docbase])"
5374 echo "gl_TESTS_BASE([$testsbase])"
5376 echo "gl_WITH_TESTS"
5378 echo "gl_LIB([$libname])"
5379 if test -n "$lgpl"; then
5380 if test "$lgpl" = yes; then
5383 echo "gl_LGPL([$lgpl])"
5386 echo "gl_MAKEFILE_NAME([$makefile_name])"
5387 if test "$cond_dependencies" = true
; then
5388 echo "gl_CONDITIONAL_DEPENDENCIES"
5390 if test "$libtool" = true
; then
5393 echo "gl_MACRO_PREFIX([$macro_prefix])"
5394 echo "gl_PO_DOMAIN([$po_domain])"
5395 echo "gl_WITNESS_C_MACRO([$witness_c_macro])"
5396 if test -n "$vc_files"; then
5397 echo "gl_VC_FILES([$vc_files])"
5400 if test -f "$destdir"/$m4base/gnulib-cache.
m4; then
5401 if cmp -s "$destdir"/$m4base/gnulib-cache.
m4 "$tmpfile"; then
5405 echo "Updating $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
5406 mv -f "$destdir"/$m4base/gnulib-cache.
m4 "$destdir"/$m4base/gnulib-cache.
m4~
5407 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.
m4
5409 echo "Update $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
5413 echo "# gnulib-cache.m4 ends here"
5420 echo "Creating $m4base/gnulib-cache.m4"
5421 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.
m4
5423 echo "Create $m4base/gnulib-cache.m4"
5429 # Create m4/gnulib-comp.m4.
5430 func_dest_tmpfilename
$m4base/gnulib-comp.
m4
5432 echo "# DO NOT EDIT! GENERATED AUTOMATICALLY!"
5433 func_emit_copyright_notice
5435 echo "# This file represents the compiled summary of the specification in"
5436 echo "# gnulib-cache.m4. It lists the computed macro invocations that need"
5437 echo "# to be invoked from configure.ac."
5438 echo "# In projects that use version control, this file can be treated like"
5439 echo "# other built files."
5442 echo "# This macro should be invoked from $configure_ac, in the section"
5443 echo "# \"Checks for programs\", right after AC_PROG_CC, and certainly before"
5444 echo "# any checks for libraries, header files, types and library functions."
5445 echo "AC_DEFUN([${macro_prefix}_EARLY],"
5447 echo " m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
5448 echo " m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
5449 echo " m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
5450 echo " m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
5452 func_emit_pre_early_macros
: ' ' "$final_modules"
5454 if test -n "$uses_subdirs"; then
5455 echo " AC_REQUIRE([AM_PROG_CC_C_O])"
5457 for module
in $final_modules; do
5459 if test -n "$module"; then
5460 echo "# Code from module $module:"
5461 func_get_autoconf_early_snippet
"$module"
5464 |
sed -e '/^$/d;' -e 's/^/ /'
5467 echo "# This macro should be invoked from $configure_ac, in the section"
5468 echo "# \"Check for header files, types and library functions\"."
5469 echo "AC_DEFUN([${macro_prefix}_INIT],"
5471 if test "$libtool" = true
; then
5472 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
5473 echo " gl_cond_libtool=true"
5475 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
5476 echo " gl_cond_libtool=false"
5478 echo " gl_ltlibdeps="
5480 if test "$auxdir" != "build-aux"; then
5481 sed_replace_build_aux
='
5483 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
5484 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
5488 sed_replace_build_aux
="$sed_noop"
5490 echo " gl_m4_base='$m4base'"
5491 func_emit_initmacro_start
$macro_prefix
5492 echo " gl_source_base='$sourcebase'"
5493 if test -n "$witness_c_macro"; then
5494 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$witness_c_macro])"
5496 func_emit_autoconf_snippets
"$main_modules" func_verify_module true false true
5497 if test -n "$witness_c_macro"; then
5498 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
5500 echo " # End of code from modules"
5501 func_emit_initmacro_end
$macro_prefix
5502 echo " gltests_libdeps="
5503 echo " gltests_ltlibdeps="
5504 func_emit_initmacro_start
${macro_prefix}tests
5505 echo " gl_source_base='$testsbase'"
5506 # Define a tests witness macro that depends on the package.
5507 # PACKAGE is defined by AM_INIT_AUTOMAKE, PACKAGE_TARNAME is defined by AC_INIT.
5508 # See <http://lists.gnu.org/archive/html/automake/2009-05/msg00145.html>.
5509 echo "changequote(,)dnl"
5510 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"
5511 echo "changequote([, ])dnl"
5512 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
5513 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
5514 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
5515 func_emit_autoconf_snippets
"$testsrelated_modules" func_verify_module true true true
5516 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
5517 func_emit_initmacro_end
${macro_prefix}tests
5518 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
5519 # created using libtool, because libtool already handles the dependencies.
5520 if test "$libtool" != true
; then
5521 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
5522 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
5523 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
5524 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
5525 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
5527 if $use_libtests; then
5528 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
5529 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
5532 func_emit_initmacro_done
$macro_prefix $sourcebase
5533 func_emit_initmacro_done
${macro_prefix}tests
$testsbase
5535 echo "# This macro records the list of files which have been installed by"
5536 echo "# gnulib-tool and may be removed by future gnulib-tool invocations."
5537 echo "AC_DEFUN([${macro_prefix}_FILE_LIST], ["
5538 echo "$files" |
sed -e 's,^, ,'
5541 if test -f "$destdir"/$m4base/gnulib-comp.
m4; then
5542 if cmp -s "$destdir"/$m4base/gnulib-comp.
m4 "$tmpfile"; then
5546 echo "Updating $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
5547 mv -f "$destdir"/$m4base/gnulib-comp.
m4 "$destdir"/$m4base/gnulib-comp.
m4~
5548 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.
m4
5550 echo "Update $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
5554 echo "# gnulib-comp.m4 ends here"
5561 echo "Creating $m4base/gnulib-comp.m4"
5562 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.
m4
5564 echo "Create $m4base/gnulib-comp.m4"
5571 # Create tests makefile.
5572 func_dest_tmpfilename
$testsbase/$makefile_am
5573 destfile
="$testsbase/$makefile_am"
5574 modules
="$testsrelated_modules"
5575 func_emit_tests_Makefile_am
"${macro_prefix}tests_WITNESS" > "$tmpfile"
5576 if test -f "$destdir"/$testsbase/$makefile_am; then
5577 if cmp -s "$destdir"/$testsbase/$makefile_am "$tmpfile"; then
5581 echo "Updating $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
5582 mv -f "$destdir"/$testsbase/$makefile_am "$destdir"/$testsbase/$makefile_am~
5583 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
5585 echo "Update $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
5591 echo "Creating $testsbase/$makefile_am"
5592 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
5594 echo "Create $testsbase/$makefile_am"
5597 func_append added_files
"$testsbase/$makefile_am$nl"
5601 if test "$vc_files" != false
; then
5602 # Update the .cvsignore and .gitignore files.
5603 { echo "$added_files" |
sed -e '/^$/d' -e 's,\([^/]*\)$,|A|\1,'
5604 echo "$removed_files" |
sed -e '/^$/d' -e 's,\([^/]*\)$,|R|\1,'
5605 # Treat gnulib-comp.m4 like an added file, even if it already existed.
5606 echo "$m4base/|A|gnulib-comp.m4"
5607 } | LC_ALL
=C
sort -t'|' -k1,1 > "$tmp"/fileset-changes
5608 { # Rearrange file descriptors. Needed because "while ... done < ..."
5609 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5610 exec 5<&0 < "$tmp"/fileset-changes
5611 func_update_ignorelist
()
5614 if test "$ignore" = .gitignore
; then
5615 # In a .gitignore file, "foo" applies to the current directory and all
5616 # subdirectories, whereas "/foo" applies to the current directory only.
5619 doubly_escaped_anchor
='\\/'
5623 doubly_escaped_anchor
=''
5625 if test -f "$destdir/$dir$ignore"; then
5626 if test -n "$dir_added" ||
test -n "$dir_removed"; then
5627 sed -e "s|^$anchor||" < "$destdir/$dir$ignore" | LC_ALL
=C
sort > "$tmp"/ignore
5628 (echo "$dir_added" |
sed -e '/^$/d' | LC_ALL
=C
sort -u \
5629 | LC_ALL
=C
join -v 1 - "$tmp"/ignore
> "$tmp"/ignore-added
5630 echo "$dir_removed" |
sed -e '/^$/d' | LC_ALL
=C
sort -u \
5631 > "$tmp"/ignore-removed
5633 if test -s "$tmp"/ignore-added ||
test -s "$tmp"/ignore-removed
; then
5635 echo "Updating $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
5636 mv -f "$destdir/$dir$ignore" "$destdir/$dir$ignore"~
5637 { sed -e 's,/,\\/,g' -e 's,^,/^,' -e 's,$,\$/d,' < "$tmp"/ignore-removed
5638 if test -n "$anchor"; then sed -e 's,/,\\/,g' -e "s,^,/^${doubly_escaped_anchor}," -e 's,$,$/d,' < "$tmp"/ignore-removed
; fi
5639 } > "$tmp"/sed-ignore-removed
5640 { cat "$destdir/$dir$ignore"~
5641 sed -e "s|^|$anchor|" < "$tmp"/ignore-added
5642 } |
sed -f "$tmp"/sed-ignore-removed \
5643 > "$destdir/$dir$ignore"
5645 echo "Update $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
5650 if test -n "$dir_added"; then
5652 echo "Creating $destdir/$dir$ignore"
5654 if test "$ignore" = .cvsignore
; then
5656 # Automake generates Makefile rules that create .dirstamp files.
5659 echo "$dir_added" |
sed -e '/^$/d' -e "s|^|$anchor|" | LC_ALL
=C
sort -u
5660 } > "$destdir/$dir$ignore"
5662 echo "Create $destdir/$dir$ignore"
5672 if test -d "$destdir/CVS" ||
test -d "$destdir/${dir}CVS" ||
test -f "$destdir/${dir}.cvsignore"; then
5673 func_update_ignorelist .cvsignore
5675 if test -d "$destdir/.git" ||
test -f "$destdir/${dir}.gitignore"; then
5676 func_update_ignorelist .gitignore
5683 # Why not ''read next_dir op file'' ? Because the dir column can be empty.
5684 next_dir
=`echo "$line" | sed -e 's,|.*,,'`
5685 op
=`echo "$line" | sed -e 's,^[^|]*|\([^|]*\)|.*$,\1,'`
5686 file=`echo "$line" | sed -e 's,^[^|]*|[^|]*|,,'`
5687 if test "$next_dir" != "$last_dir"; then
5688 func_done_dir
"$last_dir" "$last_dir_added" "$last_dir_removed"
5689 last_dir
="$next_dir"
5694 A
) func_append last_dir_added
"$file$nl";;
5695 R
) func_append last_dir_removed
"$file$nl";;
5698 func_done_dir
"$last_dir" "$last_dir_added" "$last_dir_removed"
5705 echo "You may need to add #include directives for the following .h files."
5706 # Intersect $specified_modules and $main_modules
5707 # (since $specified_modules is not necessarily of subset of $main_modules
5708 # - some may have been skipped through --avoid, and since the elements of
5709 # $main_modules but not in $specified_modules can go away without explicit
5710 # notice - through changes in the module dependencies).
5711 echo "$specified_modules" > "$tmp"/modules1
# a sorted list, one module per line
5712 echo "$main_modules" > "$tmp"/modules2
# also a sorted list, one module per line
5713 # First the #include <...> directives without #ifs, sorted for convenience,
5714 # then the #include "..." directives without #ifs, sorted for convenience,
5715 # then the #include directives that are surrounded by #ifs. Not sorted.
5716 for module
in `LC_ALL=C join "$tmp"/modules1 "$tmp"/modules2`; do
5717 include_directive
=`func_get_include_directive "$module"`
5718 case "$nl$include_directive" in
5720 echo "$include_directive" 1>&5
5723 echo "$include_directive" |
grep -v 'include "' 1>&6
5724 echo "$include_directive" |
grep 'include "' 1>&7
5727 done 5> "$tmp"/include-if
6> "$tmp"/include-angles
7> "$tmp"/include-quotes
5729 LC_ALL
=C
sort -u "$tmp"/include-angles
5730 LC_ALL
=C
sort -u "$tmp"/include-quotes
5731 cat "$tmp"/include-if
5732 ) |
sed -e '/^$/d' -e 's/^/ /'
5733 rm -f "$tmp"/include-angles
"$tmp"/include-quotes
"$tmp"/include-if
5735 for module
in $main_modules; do
5736 func_get_link_directive
"$module"
5738 | LC_ALL
=C
sort -u |
sed -e '/^$/d' -e 's/^/ /' > "$tmp"/link
5739 if test `wc -l < "$tmp"/link` != 0; then
5741 echo "You may need to use the following Makefile variables when linking."
5742 echo "Use them in <program>_LDADD when linking a program, or"
5743 echo "in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library."
5749 echo "Don't forget to"
5750 if test "$makefile_am" = Makefile.am
; then
5751 echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
5753 echo " - \"include $makefile_name\" from within \"$sourcebase/Makefile.am\","
5755 if test -n "$pobase"; then
5756 echo " - add \"$pobase/Makefile.in\" to AC_CONFIG_FILES in $configure_ac,"
5759 if test "$makefile_am" = Makefile.am
; then
5760 echo " - add \"$testsbase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
5762 echo " - \"include $makefile_name\" from within \"$testsbase/Makefile.am\","
5766 while test $edit != $makefile_am_edits; do
5767 edit
=`expr $edit + 1`
5768 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
5769 eval var
=\"\
$makefile_am_edit${edit}_var
\"
5770 eval val
=\"\
$makefile_am_edit${edit}_val
\"
5771 if test -n "$var"; then
5772 echo " - mention \"${val}\" in ${var} in ${dir}Makefile.am,"
5775 if grep '^ *AC_PROG_CC_STDC' "$configure_ac" > /dev
/null
; then
5776 position_early_after
=AC_PROG_CC_STDC
5778 if grep '^ *AC_PROG_CC_C99' "$configure_ac" > /dev
/null
; then
5779 position_early_after
=AC_PROG_CC_C99
5781 position_early_after
=AC_PROG_CC
5784 echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after $position_early_after,"
5785 echo " - invoke ${macro_prefix}_INIT in $configure_ac."
5788 # func_create_testdir testdir modules
5790 # - local_gnulib_path from --local-dir
5791 # - modcache true or false, from --cache-modules/--no-cache-modules
5792 # - auxdir directory relative to destdir where to place build aux files
5793 # - inctests true if tests should be included, false otherwise
5794 # - incobsolete true if obsolete modules among dependencies should be
5795 # included, blank otherwise
5796 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
5798 # - excl_longrunning_tests true if long-runnings tests should be excluded,
5800 # - excl_privileged_tests true if tests that require root privileges should be
5801 # excluded, blank otherwise
5802 # - excl_unportable_tests true if tests that fail on some platforms should be
5803 # excluded, blank otherwise
5804 # - single_configure true if a single configure file should be generated,
5805 # false for a separate configure file for the tests
5806 # - avoidlist list of modules to avoid
5807 # - cond_dependencies true if --conditional-dependencies was given, false if
5808 # --no-conditional-dependencies was given, blank otherwise
5809 # - libtool true if --libtool was given, false if --no-libtool was
5810 # given, blank otherwise
5811 # - symbolic true if files should be symlinked, copied otherwise
5812 # - lsymbolic true if files from local_gnulib_path should be symlinked,
5814 func_create_testdir
()
5818 if test -z "$modules"; then
5819 # All modules together.
5820 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
5821 # Except non-recursive-gnulib-prefix-hack, which represents a nonstandard
5822 # way of using Automake.
5823 # Except ftruncate, mountlist, which abort the configuration on mingw. FIXME.
5824 # Except lib-ignore, which leads to link errors when Sun C++ is used. FIXME.
5825 modules
=`func_all_modules`
5826 modules
=`for m in $modules; do case $m in config-h | non-recursive-gnulib-prefix-hack | ftruncate | mountlist | lib-ignore) ;; *) echo $m;; esac; done`
5828 specified_modules
="$modules"
5830 # Canonicalize the list of specified modules.
5831 specified_modules
=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
5833 # Unlike in func_import, here we want to include all kinds of tests for the
5834 # directly specified modules, but not for dependencies.
5835 inc_all_direct_tests
=true
5836 inc_all_indirect_tests
="$inc_all_tests"
5838 # Check that the license of every module is consistent with the license of
5840 saved_inctests
="$inctests"
5841 # When computing transitive closures, don't consider $module to depend on
5842 # $module-tests. Need this because tests are implicitly GPL and may depend
5843 # on GPL modules - therefore we don't want a warning in this case.
5845 for requested_module
in $specified_modules; do
5846 requested_license
=`func_get_license "$requested_module"`
5847 if test "$requested_license" != GPL
; then
5848 # Here we use func_modules_transitive_closure, not just
5849 # func_get_dependencies, so that we also detect weird situations like
5850 # an LGPL module which depends on a GPLed build tool module which depends
5852 modules
="$requested_module"
5853 func_modules_transitive_closure
5854 for module
in $modules; do
5855 license
=`func_get_license "$module"`
5857 'GPLed build tool') ;;
5858 'public domain' |
'unlimited' |
'unmodifiable license text') ;;
5860 case "$requested_license" in
5863 LGPLv2
+ |
'LGPLv3+ or GPLv2' | LGPLv3
+ | LGPL | GPLv2
+ | GPLv3
+ | GPL
) ;;
5864 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
5869 LGPLv2
+ |
'LGPLv3+ or GPLv2' | GPLv2
+) ;;
5870 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
5875 LGPLv2
+ |
'LGPLv3+ or GPLv2' | LGPLv3
+ | LGPL
) ;;
5876 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
5881 LGPLv2
+ |
'LGPLv3+ or GPLv2') ;;
5882 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
5888 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
5897 inctests
="$saved_inctests"
5899 # Subdirectory names.
5910 # Determine final module list.
5911 modules
="$specified_modules"
5912 func_modules_transitive_closure
5913 if test $verbose -ge 0; then
5914 func_show_module_list
5916 final_modules
="$modules"
5918 if $single_configure; then
5919 # Determine main module list and tests-related module list separately.
5920 func_modules_transitive_closure_separately
5923 if $single_configure; then
5924 # Determine whether a $testsbase/libtests.a is needed.
5925 func_determine_use_libtests
5928 # Add the dummy module if needed.
5929 if $single_configure; then
5930 func_modules_add_dummy_separately
5932 func_modules_add_dummy
5935 # Show banner notice of every module.
5936 if $single_configure; then
5937 modules
="$main_modules"
5943 # Determine final file list.
5944 if $single_configure; then
5945 func_modules_to_filelist_separately
5947 func_modules_to_filelist
5948 if test $verbose -ge 0; then
5950 echo "$files" |
sed -e 's/^/ /'
5953 # Add files for which the copy in gnulib is newer than the one that
5954 # "automake --add-missing --copy" would provide.
5955 files
="$files build-aux/config.guess"
5956 files
="$files build-aux/config.sub"
5957 files
=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
5959 rewritten
='%REWRITTEN%'
5960 sed_rewrite_files
="\
5961 s,^build-aux/,$rewritten$auxdir/,
5962 s,^doc/,$rewritten$docbase/,
5963 s,^lib/,$rewritten$sourcebase/,
5964 s,^m4/,$rewritten$m4base/,
5965 s,^tests/,$rewritten$testsbase/,
5966 s,^tests=lib/,$rewritten$testsbase/,
5970 # Create directories.
5971 for f
in $files; do echo $f; done \
5972 |
sed -e "$sed_rewrite_files" \
5973 |
sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
5974 | LC_ALL
=C
sort -u \
5976 { # Rearrange file descriptors. Needed because "while ... done < ..."
5977 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5978 exec 5<&0 < "$tmp"/dirs
5980 mkdir
-p "$testdir/$d"
5985 # Copy files or make symbolic links.
5987 for f
in $files; do echo $f; done \
5988 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_files" \
5991 { # Rearrange file descriptors. Needed because "while ... done < ..."
5992 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5993 exec 5<&0 < "$tmp"/files
5996 tests
=lib
/*) f
=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
5998 func_lookup_file
"$f"
5999 if test -n "$lookedup_tmp"; then
6000 cp -p "$lookedup_file" "$testdir/$g"
6002 ln "$lookedup_file" "$testdir/$g" 2>/dev
/null ||
6003 if func_should_symlink
; then
6004 func_ln
"$lookedup_file" "$testdir/$g"
6006 cp -p "$lookedup_file" "$testdir/$g"
6013 # Determine include_guard_prefix.
6014 func_compute_include_guard_prefix
6016 # Create Makefile.ams that are for testing.
6019 # No special edits are needed.
6022 # Create $sourcebase/Makefile.am.
6023 mkdir
-p "$testdir/$sourcebase"
6024 destfile
="$sourcebase/Makefile.am"
6025 if $single_configure; then
6026 modules
="$main_modules"
6028 func_emit_lib_Makefile_am
> "$testdir/$sourcebase/Makefile.am"
6029 any_uses_subdirs
="$uses_subdirs"
6031 # Create $m4base/Makefile.am.
6032 mkdir
-p "$testdir/$m4base"
6033 (echo "## Process this file with automake to produce Makefile.in."
6039 echo "EXTRA_DIST += "`echo "$f" | sed -e 's,^m4/,,'` ;;
6042 ) > "$testdir/$m4base/Makefile.am"
6044 subdirs
="$sourcebase $m4base"
6045 subdirs_with_configure_ac
=""
6047 if false
&& test -f "$testdir"/$m4base/gettext.
m4; then
6048 # Avoid stupid error message from automake:
6049 # "AM_GNU_GETTEXT used but `po' not in SUBDIRS"
6050 mkdir
-p "$testdir/po"
6051 (echo "## Process this file with automake to produce Makefile.in."
6052 ) > "$testdir/po/Makefile.am"
6053 func_append subdirs
" po"
6057 test -d "$testdir/$testsbase" || mkdir
"$testdir/$testsbase"
6058 if $single_configure; then
6059 # Create $testsbase/Makefile.am.
6060 destfile
="$testsbase/Makefile.am"
6061 modules
="$testsrelated_modules"
6062 func_emit_tests_Makefile_am
"${macro_prefix}tests_WITNESS" > "$testdir/$testsbase/Makefile.am"
6064 # Viewed from the $testsbase subdirectory, $auxdir is different.
6065 saved_auxdir
="$auxdir"
6066 auxdir
=`echo "$testsbase/" | sed -e 's%[^/][^/]*//*%../%g'`"$auxdir"
6067 # Create $testsbase/Makefile.am.
6069 destfile
="$testsbase/Makefile.am"
6070 func_emit_tests_Makefile_am
"" > "$testdir/$testsbase/Makefile.am"
6071 any_uses_subdirs
="$any_uses_subdirs$uses_subdirs"
6072 # Create $testsbase/configure.ac.
6073 (echo "# Process this file with autoconf to produce a configure script."
6074 echo "AC_INIT([dummy], [0])"
6075 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6076 echo "AM_INIT_AUTOMAKE"
6078 echo "AC_CONFIG_HEADERS([config.h])"
6081 echo "AC_PROG_INSTALL"
6082 echo "AC_PROG_MAKE_SET"
6084 func_emit_pre_early_macros false
'' "$modules"
6086 if test -n "$uses_subdirs"; then
6087 echo "AM_PROG_CC_C_O"
6090 for module
in $modules; do
6092 if test -n "$module"; then
6094 gnumakefile | maintainer-makefile
)
6095 # These modules are meant to be used only in the top-level directory.
6098 func_get_autoconf_early_snippet
"$module"
6103 |
sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
6104 if test "$libtool" = true
; then
6105 echo "LT_INIT([win32-dll])"
6106 echo "LT_LANG([C++])"
6107 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
6108 echo "gl_cond_libtool=true"
6110 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
6111 echo "gl_cond_libtool=false"
6113 echo "gl_ltlibdeps="
6115 # Wrap the set of autoconf snippets into an autoconf macro that is then
6116 # invoked. This is needed because autoconf does not support AC_REQUIRE
6118 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
6119 # but we want the AC_REQUIRE to have its normal meaning (provide one
6120 # expansion of the required macro before the current point, and only one
6122 echo "AC_DEFUN([gl_INIT], ["
6123 sed_replace_build_aux
='
6125 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
6126 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
6129 echo "gl_m4_base='../$m4base'"
6130 func_emit_initmacro_start
$macro_prefix
6131 # We don't have explicit ordering constraints between the various
6132 # autoconf snippets. It's cleanest to put those of the library before
6133 # those of the tests.
6134 echo "gl_source_base='../$sourcebase'"
6135 func_emit_autoconf_snippets
"$modules" func_verify_nontests_module false false false
6136 echo "gl_source_base='.'"
6137 func_emit_autoconf_snippets
"$modules" func_verify_tests_module false false false
6138 func_emit_initmacro_end
$macro_prefix
6139 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
6140 # created using libtool, because libtool already handles the dependencies.
6141 if test "$libtool" != true
; then
6142 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
6143 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
6144 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
6145 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
6146 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
6149 func_emit_initmacro_done
$macro_prefix $sourcebase # FIXME use $sourcebase or $testsbase?
6153 # Usually $testsbase/config.h will be a superset of config.h. Verify this
6154 # by "merging" config.h into $testsbase/config.h; look out for gcc warnings.
6155 echo "AH_TOP([#include \"../config.h\"])"
6157 echo "AC_CONFIG_FILES([Makefile])"
6159 ) > "$testdir/$testsbase/configure.ac"
6160 auxdir
="$saved_auxdir"
6161 subdirs_with_configure_ac
="$subdirs_with_configure_ac $testsbase"
6163 func_append subdirs
" $testsbase"
6166 # Create Makefile.am.
6167 (echo "## Process this file with automake to produce Makefile.in."
6169 echo "AUTOMAKE_OPTIONS = 1.9.6 foreign"
6171 echo "SUBDIRS = $subdirs"
6173 echo "ACLOCAL_AMFLAGS = -I $m4base"
6174 ) > "$testdir/Makefile.am"
6176 # Create configure.ac.
6177 (echo "# Process this file with autoconf to produce a configure script."
6178 echo "AC_INIT([dummy], [0])"
6179 if test "$auxdir" != "."; then
6180 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6182 echo "AM_INIT_AUTOMAKE"
6184 echo "AC_CONFIG_HEADERS([config.h])"
6187 echo "AC_PROG_INSTALL"
6188 echo "AC_PROG_MAKE_SET"
6190 echo "# For autobuild."
6191 echo "AC_CANONICAL_BUILD"
6192 echo "AC_CANONICAL_HOST"
6194 echo "m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
6195 echo "m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
6196 echo "m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
6197 echo "m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
6199 func_emit_pre_early_macros false
'' "$final_modules"
6201 if test -n "$any_uses_subdirs"; then
6202 echo "AM_PROG_CC_C_O"
6205 for module
in $final_modules; do
6206 if $single_configure; then
6209 func_verify_nontests_module
6211 if test -n "$module"; then
6212 func_get_autoconf_early_snippet
"$module"
6215 |
sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
6216 if test "$libtool" = true
; then
6217 echo "LT_INIT([win32-dll])"
6218 echo "LT_LANG([C++])"
6219 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
6220 echo "gl_cond_libtool=true"
6222 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
6223 echo "gl_cond_libtool=false"
6225 echo "gl_ltlibdeps="
6227 # Wrap the set of autoconf snippets into an autoconf macro that is then
6228 # invoked. This is needed because autoconf does not support AC_REQUIRE
6230 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
6231 # but we want the AC_REQUIRE to have its normal meaning (provide one
6232 # expansion of the required macro before the current point, and only one
6234 echo "AC_DEFUN([gl_INIT], ["
6235 if test "$auxdir" != "build-aux"; then
6236 sed_replace_build_aux
='
6238 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
6239 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
6243 sed_replace_build_aux
="$sed_noop"
6245 echo "gl_m4_base='$m4base'"
6246 func_emit_initmacro_start
$macro_prefix
6247 echo "gl_source_base='$sourcebase'"
6248 if $single_configure; then
6249 func_emit_autoconf_snippets
"$main_modules" func_verify_module true false false
6251 func_emit_autoconf_snippets
"$modules" func_verify_nontests_module true false false
6253 func_emit_initmacro_end
$macro_prefix
6254 if $single_configure; then
6255 echo " gltests_libdeps="
6256 echo " gltests_ltlibdeps="
6257 func_emit_initmacro_start
${macro_prefix}tests
6258 echo " gl_source_base='$testsbase'"
6259 # Define a tests witness macro.
6260 echo " ${macro_prefix}tests_WITNESS=IN_GNULIB_TESTS"
6261 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
6262 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
6263 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
6264 func_emit_autoconf_snippets
"$testsrelated_modules" func_verify_module true false false
6265 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
6266 func_emit_initmacro_end
${macro_prefix}tests
6268 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
6269 # created using libtool, because libtool already handles the dependencies.
6270 if test "$libtool" != true
; then
6271 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
6272 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
6273 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
6274 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
6275 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
6277 if $single_configure; then
6278 if $use_libtests; then
6279 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
6280 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
6284 func_emit_initmacro_done
$macro_prefix $sourcebase
6285 if $single_configure; then
6286 func_emit_initmacro_done
${macro_prefix}tests
$testsbase
6291 if test -n "$subdirs_with_configure_ac"; then
6292 echo "AC_CONFIG_SUBDIRS(["`echo $subdirs_with_configure_ac`"])"
6294 makefiles
="Makefile"
6295 for d
in $subdirs; do
6296 # For subdirs that have a configure.ac by their own, it's the subdir's
6297 # configure.ac which creates the subdir's Makefile.am, not this one.
6298 case " $subdirs_with_configure_ac " in
6300 *) func_append makefiles
" $d/Makefile" ;;
6303 echo "AC_CONFIG_FILES([$makefiles])"
6305 ) > "$testdir/configure.ac"
6307 # Create autogenerated files.
6309 # Do not use "${AUTORECONF} --force --install", because it may invoke
6310 # autopoint, which brings in older versions of some of our .m4 files.
6311 if test -f $m4base/gettext.
m4; then
6312 func_execute_command
${AUTOPOINT} --force || func_exit
1
6313 for f
in $m4base/*.
m4~
; do
6315 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit
1
6319 if test "$libtool" = true
; then
6320 func_execute_command
${LIBTOOLIZE} --copy || func_exit
1
6322 func_execute_command
${ACLOCAL} -I $m4base || func_exit
1
6323 if ! test -d build-aux
; then
6324 func_execute_command mkdir build-aux || func_exit
1
6326 func_execute_command
${AUTOCONF} || func_exit
1
6327 func_execute_command
${AUTOHEADER} || func_exit
1
6328 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6330 if $inctests && ! $single_configure; then
6331 # Create autogenerated files.
6332 (cd "$testdir/$testsbase" || func_exit
1
6333 # Do not use "${AUTORECONF} --force --install", because it may invoke
6334 # autopoint, which brings in older versions of some of our .m4 files.
6335 if test -f ..
/$m4base/gettext.
m4; then
6336 func_execute_command
${AUTOPOINT} --force || func_exit
1
6337 for f
in ..
/$m4base/*.
m4~
; do
6339 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit
1
6343 func_execute_command
${ACLOCAL} -I ..
/$m4base || func_exit
1
6344 if ! test -d ..
/build-aux
; then
6345 func_execute_command mkdir ..
/build-aux
6347 func_execute_command
${AUTOCONF} || func_exit
1
6348 func_execute_command
${AUTOHEADER} || func_exit
1
6349 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6352 # Need to run configure and make once, to create built files that are to be
6353 # distributed (such as parse-datetime.c).
6354 sed_remove_make_variables
='s,[$]([A-Za-z0-9_]*),,g'
6355 # Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...".
6356 cleaned_files
=`combine_lines < "$testdir/$sourcebase/Makefile.am" \
6357 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
6358 cleaned_files
=`for file in $cleaned_files; do echo " $file "; done`
6359 # Extract the value of "BUILT_SOURCES += ...". Remove variable references
6360 # such $(FOO_H) because they don't refer to distributed files.
6361 built_sources
=`combine_lines < "$testdir/$sourcebase/Makefile.am" \
6362 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
6363 | sed -e "$sed_remove_make_variables"`
6364 distributed_built_sources
=`for file in $built_sources; do
6365 case "$cleaned_files" in
6370 tests_distributed_built_sources
=
6372 # Likewise for built files in the $testsbase directory.
6373 tests_cleaned_files
=`combine_lines < "$testdir/$testsbase/Makefile.am" \
6374 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
6375 tests_cleaned_files
=`for file in $tests_cleaned_files; do echo " $file "; done`
6376 tests_built_sources
=`combine_lines < "$testdir/$testsbase/Makefile.am" \
6377 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
6378 | sed -e "$sed_remove_make_variables"`
6379 tests_distributed_built_sources
=`for file in $tests_built_sources; do
6380 case "$tests_cleaned_files" in
6386 if test -n "$distributed_built_sources" ||
test -n "$tests_distributed_built_sources"; then
6388 .
/configure || func_exit
1
6389 if test -n "$distributed_built_sources"; then
6391 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
6392 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6397 if test -n "$tests_distributed_built_sources"; then
6399 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
6400 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6405 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6412 # func_create_megatestdir megatestdir allmodules
6414 # - local_gnulib_path from --local-dir
6415 # - modcache true or false, from --cache-modules/--no-cache-modules
6416 # - auxdir directory relative to destdir where to place build aux files
6417 func_create_megatestdir
()
6421 if test -z "$allmodules"; then
6422 allmodules
=`func_all_modules`
6426 # First, all modules one by one.
6427 for onemodule
in $allmodules; do
6428 func_create_testdir
"$megatestdir/$onemodule" $onemodule
6429 func_append megasubdirs
"$onemodule "
6431 # Then, all modules all together.
6432 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
6433 allmodules
=`for m in $allmodules; do if test $m != config-h; then echo $m; fi; done`
6434 func_create_testdir
"$megatestdir/ALL" "$allmodules"
6435 func_append megasubdirs
"ALL"
6438 cvsdate
=`vc_witness="$gnulib_dir/.git/refs/heads/master"; \
6439 sh "$gnulib_dir/build-aux/mdate-sh" "$vc_witness" \
6440 | sed -e 's,January,01,' -e 's,Jan,01,' \
6441 -e 's,February,02,' -e 's,Feb,02,' \
6442 -e 's,March,03,' -e 's,Mar,03,' \
6443 -e 's,April,04,' -e 's,Apr,04,' \
6445 -e 's,June,06,' -e 's,Jun,06,' \
6446 -e 's,July,07,' -e 's,Jul,07,' \
6447 -e 's,August,08,' -e 's,Aug,08,' \
6448 -e 's,September,09,' -e 's,Sep,09,' \
6449 -e 's,October,10,' -e 's,Oct,10,' \
6450 -e 's,November,11,' -e 's,Nov,11,' \
6451 -e 's,December,12,' -e 's,Dec,12,' \
6452 -e 's,^,00,' -e 's,^[0-9]*\([0-9][0-9] \),\1,' \
6453 -e 's,^\([0-9]*\) \([0-9]*\) \([0-9]*\),\3\2\1,'`
6455 echo "CVSDATE=$cvsdate"
6456 echo ": \${MAKE=make}"
6457 echo "test -d logs || mkdir logs"
6458 echo "for module in $megasubdirs; do"
6459 echo " echo \"Working on module \$module...\""
6460 echo " safemodule=\`echo \$module | sed -e 's|/|-|g'\`"
6461 echo " (echo \"To: gnulib@autobuild.josefsson.org\""
6464 echo " : autobuild project... \$module"
6465 echo " : autobuild revision... cvs-\$CVSDATE-000000"
6466 echo " : autobuild timestamp... \`date \"+%Y%m%d-%H%M%S\"\`"
6467 echo " : autobuild hostname... \`hostname\`"
6468 echo " cd \$module && ./configure \$CONFIGURE_OPTIONS && \$MAKE && \$MAKE check && \$MAKE distclean"
6470 echo " ) 2>&1 | { if test -n \"\$AUTOBUILD_SUBST\"; then sed -e \"\$AUTOBUILD_SUBST\"; else cat; fi; } > logs/\$safemodule"
6472 ) > "$megatestdir/do-autobuild"
6473 chmod a
+x
"$megatestdir/do-autobuild"
6475 # Create Makefile.am.
6476 (echo "## Process this file with automake to produce Makefile.in."
6478 echo "AUTOMAKE_OPTIONS = 1.9.6 foreign"
6480 echo "SUBDIRS = $megasubdirs"
6482 echo "EXTRA_DIST = do-autobuild"
6483 ) > "$megatestdir/Makefile.am"
6485 # Create configure.ac.
6486 (echo "# Process this file with autoconf to produce a configure script."
6487 echo "AC_INIT([dummy], [0])"
6488 if test "$auxdir" != "."; then
6489 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6491 echo "AM_INIT_AUTOMAKE"
6493 echo "AC_PROG_MAKE_SET"
6495 echo "AC_CONFIG_SUBDIRS([$megasubdirs])"
6496 echo "AC_CONFIG_FILES([Makefile])"
6498 ) > "$megatestdir/configure.ac"
6500 # Create autogenerated files.
6502 # Do not use "${AUTORECONF} --install", because autoreconf operates
6503 # recursively, but the subdirectories are already finished, therefore
6504 # calling autoreconf here would only waste lots of CPU time.
6505 func_execute_command
${ACLOCAL} || func_exit
1
6506 func_execute_command mkdir build-aux
6507 func_execute_command
${AUTOCONF} || func_exit
1
6508 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6514 func_fatal_error
"no mode specified" ;;
6521 # sed expression that converts a literal to a basic regular expression.
6522 # Needs to handle . [ \ * ^ $.
6523 sed_literal_to_basic_regex
='s/\\/\\\\/g
6529 if test -f "$gnulib_dir/$filename" \
6530 || func_lookup_local_file
"$filename"; then
6531 filename_anywhere_regex
=`echo "$filename" | sed -e "$sed_literal_to_basic_regex"`
6532 filename_line_regex
='^'"$filename_anywhere_regex"'$'
6535 (cd "$gnulib_dir" && find modules -type f -print | xargs -n 100 grep -l "$filename_line_regex" /dev/null | sed -e 's,^modules/,,')
6536 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$,,'
6538 | func_sanitize_modulelist \
6541 for module
in $module_candidates; do
6542 if func_get_filelist
$module |
grep "$filename_line_regex" > /dev
/null
; then
6547 func_warning
"file $filename does not exist"
6552 import | add-import | remove-import | update
)
6555 if test -z "$destdir"; then
6558 test -d "$destdir" \
6559 || func_fatal_error
"destination directory does not exist: $destdir"
6561 # Prefer configure.ac to configure.in.
6562 if test -f "$destdir"/configure.ac
; then
6563 configure_ac
="$destdir/configure.ac"
6565 if test -f "$destdir"/configure.
in; then
6566 configure_ac
="$destdir/configure.in"
6568 func_fatal_error
"cannot find $destdir/configure.ac - make sure you run gnulib-tool from within your package's directory"
6572 # Analyze configure.ac.
6574 guessed_libtool
=false
6579 /AC_CONFIG_AUX_DIR/ {
6580 s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^]"$`\\)]*\).*$,guessed_auxdir="\1",p
6582 /A[CM]_PROG_LIBTOOL/ {
6583 s,^.*$,guessed_libtool=true,p
6585 eval `sed -n -e "$my_sed_traces" < "$configure_ac"`
6587 if test -z "$auxdir"; then
6588 auxdir
="$guessed_auxdir"
6591 # Determine where to apply func_import.
6592 if test "$mode" = import
; then
6593 # Apply func_import to a particular gnulib directory.
6594 # The command line contains the complete specification; don't look at
6595 # the contents of gnulib-cache.m4.
6596 test -n "$supplied_libname" || supplied_libname
=true
6597 test -n "$sourcebase" || sourcebase
="lib"
6598 test -n "$m4base" || m4base
="m4"
6599 test -n "$docbase" || docbase
="doc"
6600 test -n "$testsbase" || testsbase
="tests"
6601 test -n "$macro_prefix" || macro_prefix
="gl"
6604 if test -n "$m4base"; then
6605 # Apply func_import to a particular gnulib directory.
6606 # Any number of additional modules can be given.
6607 if test ! -f "$destdir/$m4base"/gnulib-cache.
m4; then
6608 # First use of gnulib in the given m4base.
6609 test -n "$supplied_libname" || supplied_libname
=true
6610 test -n "$sourcebase" || sourcebase
="lib"
6611 test -n "$docbase" || docbase
="doc"
6612 test -n "$testsbase" || testsbase
="tests"
6613 test -n "$macro_prefix" || macro_prefix
="gl"
6617 # Apply func_import to all gnulib directories.
6618 # To get this list of directories, look at Makefile.am. (Not at
6619 # configure, because it may be omitted from version control. Also,
6620 # don't run "find $destdir -name gnulib-cache.m4", as it might be
6624 if test -f "$destdir"/Makefile.am
; then
6625 aclocal_amflags
=`sed -n -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/p' "$destdir"/Makefile.am`
6627 for arg
in $aclocal_amflags; do
6628 if test -n "$m4dir_is_next"; then
6629 # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
6633 if test -f "$destdir/$arg"/gnulib-cache.
m4; then
6634 func_append m4dirs
" $arg"
6635 m4dirs_count
=`expr $m4dirs_count + 1`
6641 if test "X$arg" = "X-I"; then
6649 # No Makefile.am! Oh well. Look at the last generated aclocal.m4.
6650 if test -f "$destdir"/aclocal.
m4; then
6651 sedexpr1
='s,^m4_include(\[\(.*\)])$,\1,p'
6652 sedexpr2
='s,^[^/]*$,.,'
6653 sedexpr3
='s,/[^/]*$,,'
6654 m4dirs
=`sed -n -e "$sedexpr1" aclocal.m4 | sed -e "$sedexpr2" -e "$sedexpr3" | LC_ALL=C sort -u`
6655 m4dirs
=`for arg in $m4dirs; do if test -f "$destdir/$arg"/gnulib-cache.m4; then echo $arg; fi; done`
6656 m4dirs_count
=`for arg in $m4dirs; do echo "$arg"; done | wc -l`
6659 if test $m4dirs_count = 0; then
6660 # First use of gnulib in a package.
6661 # Any number of additional modules can be given.
6662 test -n "$supplied_libname" || supplied_libname
=true
6663 test -n "$sourcebase" || sourcebase
="lib"
6665 test -n "$docbase" || docbase
="doc"
6666 test -n "$testsbase" || testsbase
="tests"
6667 test -n "$macro_prefix" || macro_prefix
="gl"
6670 if test $m4dirs_count = 1; then
6671 # There's only one use of gnulib here. Assume the user means it.
6672 # Any number of additional modules can be given.
6673 for m4base
in $m4dirs; do
6677 # Ambiguous - guess what the user meant.
6678 if test $# = 0; then
6679 # No further arguments. Guess the user wants to update all of them.
6680 for m4base
in $m4dirs; do
6681 # Perform func_import in a subshell, so that variable values
6683 # local_gnulib_path, incobsolete, inc_cxx_tests,
6684 # inc_longrunning_tests, inc_privileged_tests,
6685 # inc_unportable_tests, inc_all_tests, avoidlist, sourcebase,
6686 # m4base, pobase, docbase, testsbase, inctests, libname, lgpl,
6687 # makefile_name, libtool, macro_prefix, po_domain,
6688 # witness_c_macro, vc_files
6689 # don't propagate from one directory to another.
6690 (func_import
) || func_exit
1
6694 func_fatal_error
"Ambiguity: to which directory should the modules be added? Please specify at least --m4-base=..."
6703 if test -z "$destdir"; then
6704 func_fatal_error
"please specify --dir option"
6707 test -d "$destdir" \
6708 || func_fatal_error
"could not create destination directory"
6709 test -n "$auxdir" || auxdir
="build-aux"
6710 func_create_testdir
"$destdir" "$*"
6713 create-megatestdir
)
6714 if test -z "$destdir"; then
6715 func_fatal_error
"please specify --dir option"
6717 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
6718 test -n "$auxdir" || auxdir
="build-aux"
6719 func_create_megatestdir
"$destdir" "$*"
6723 test -n "$destdir" || destdir
=testdir$$
6724 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
6725 test -n "$auxdir" || auxdir
="build-aux"
6726 func_create_testdir
"$destdir" "$*"
6730 ..
/configure || func_exit
1
6731 $MAKE || func_exit
1
6732 $MAKE check || func_exit
1
6733 $MAKE distclean || func_exit
1
6734 remaining
=`find . -type f -print`
6735 if test -n "$remaining"; then
6736 echo "Remaining files:" $remaining 1>&2
6737 echo "gnulib-tool: *** Stop." 1>&2
6746 test -n "$destdir" || destdir
=testdir$$
6747 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
6748 test -n "$auxdir" || auxdir
="build-aux"
6749 func_create_megatestdir
"$destdir" "$*"
6757 remaining
=`find . -type f -print`
6758 if test -n "$remaining"; then
6759 echo "Remaining files:" $remaining 1>&2
6760 echo "gnulib-tool: *** Stop." 1>&2
6768 extract-description
)
6772 if test -n "$module"; then
6773 func_get_description
"$module"
6782 if test -n "$module"; then
6783 func_get_comment
"$module"
6792 if test -n "$module"; then
6793 func_get_status
"$module"
6802 if test -n "$module"; then
6803 func_get_notice
"$module"
6808 extract-applicability
)
6812 if test -n "$module"; then
6813 func_get_applicability
"$module"
6822 if test -n "$module"; then
6823 func_get_filelist
"$module"
6828 extract-dependencies
)
6829 if test -n "$avoidlist"; then
6830 func_fatal_error
"cannot combine --avoid and --extract-dependencies"
6835 if test -n "$module"; then
6836 func_get_dependencies
"$module"
6841 extract-autoconf-snippet
)
6845 if test -n "$module"; then
6846 func_get_autoconf_snippet
"$module"
6851 extract-automake-snippet
)
6855 if test -n "$module"; then
6856 func_get_automake_snippet
"$module"
6861 extract-include-directive
)
6865 if test -n "$module"; then
6866 func_get_include_directive
"$module"
6871 extract-link-directive
)
6875 if test -n "$module"; then
6876 func_get_link_directive
"$module"
6885 if test -n "$module"; then
6886 func_get_license
"$module"
6891 extract-maintainer
)
6895 if test -n "$module"; then
6896 func_get_maintainer
"$module"
6901 extract-tests-module
)
6905 if test -n "$module"; then
6906 func_get_tests_module
"$module"
6912 # Verify the number of arguments.
6913 if test $# -lt 1 ||
test $# -gt 2; then
6914 func_fatal_error
"invalid number of arguments for --$mode"
6917 # The first argument is the file to be copied.
6919 # Verify the file exists.
6920 func_lookup_file
"$f"
6922 # The second argument is the destination; either a directory ot a file.
6923 # It defaults to the current directory.
6925 test -n "$dest" || dest
='.'
6926 test -n "$sourcebase" || sourcebase
="lib"
6927 test -n "$m4base" || m4base
="m4"
6928 test -n "$docbase" || docbase
="doc"
6929 test -n "$testsbase" || testsbase
="tests"
6930 test -n "$auxdir" || auxdir
="build-aux"
6931 rewritten
='%REWRITTEN%'
6932 sed_rewrite_files
="\
6933 s,^build-aux/,$rewritten$auxdir/,
6934 s,^doc/,$rewritten$docbase/,
6935 s,^lib/,$rewritten$sourcebase/,
6936 s,^m4/,$rewritten$m4base/,
6937 s,^tests/,$rewritten$testsbase/,
6940 if test -d "$dest"; then
6942 g
=`echo "$f" | sed -e "$sed_rewrite_files"`
6944 destdir
=`dirname "$dest"`
6945 g
=`basename "$dest"`
6948 # Create the directory for destfile.
6949 d
=`dirname "$destdir/$g"`
6951 if test -n "$d" && test ! -d "$d"; then
6952 mkdir
-p "$d" || func_fatal_error
"failed"
6956 func_dest_tmpfilename
"$g"
6957 cp "$lookedup_file" "$tmpfile" || func_fatal_error
"failed"
6958 already_present
=true
6959 if test -f "$destdir/$g"; then
6960 # The file already exists.
6964 # Don't protest if the file should be there but isn't: it happens
6965 # frequently that developers don't put autogenerated files under version
6973 func_fatal_error
"unknown operation mode --$mode" ;;
6977 # Undo the effect of the previous 'trap' command. Some shellology:
6978 # We cannot use "trap - 0 1 2 3 13 15", because Solaris sh would attempt to
6979 # execute the command "-". "trap '' ..." is fine only for signal 0 (= normal
6980 # exit); for the others we need to call 'exit' explicitly. The value of $? is
6981 # 128 + signal number and is set before the trap-registered command is run.
6983 trap 'func_exit $?' 1 2 3 13 15
6988 # indent-tabs-mode: nil
6989 # whitespace-check-buffer-indent: nil