3 # Copyright (C) 2002-2011 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
192 --dir=DIRECTORY Specify the target directory.
193 For --import, this specifies where your
194 configure.ac can be found. Defaults to current
196 --local-dir=DIRECTORY Specify a local override directory where to look
197 up files before looking in gnulib's directory.
198 --cache-modules Enable module caching optimization.
199 --no-cache-modules Disable module caching optimization.
200 --verbose Increase verbosity. May be repeated.
201 --quiet Decrease verbosity. May be repeated.
203 Options for --import, --add/remove-import, --update:
205 --dry-run Only print what would have been done.
207 Options for --import, --add/remove-import,
208 --create-[mega]testdir, --[mega]test:
210 --with-tests Include unit tests for the included modules.
211 --with-obsolete Include obsolete modules when they occur among the
212 dependencies. By default, dependencies to obsolete
214 --with-c++-tests Include even unit tests for C++ interoperability.
215 --with-longrunning-tests
216 Include even unit tests that are long-runners.
217 --with-privileged-tests
218 Include even unit tests that require root
220 --with-unportable-tests
221 Include even unit tests that fail on some platforms.
222 --with-all-tests Include all kinds of problematic unit tests.
223 --avoid=MODULE Avoid including the given MODULE. Useful if you
224 have code that provides equivalent functionality.
225 This option can be repeated.
226 --conditional-dependencies
227 Support conditional dependencies (may save configure
228 time and object code).
229 --no-conditional-dependencies
230 Don't use conditional dependencies.
231 --libtool Use libtool rules.
232 --no-libtool Don't use libtool rules.
234 Options for --import, --add/remove-import:
236 --lib=LIBRARY Specify the library name. Defaults to 'libgnu'.
237 --source-base=DIRECTORY
238 Directory relative to --dir where source code is
239 placed (default \"lib\").
240 --m4-base=DIRECTORY Directory relative to --dir where *.m4 macros are
241 placed (default \"m4\").
242 --po-base=DIRECTORY Directory relative to --dir where *.po files are
243 placed (default \"po\").
244 --doc-base=DIRECTORY Directory relative to --dir where doc files are
245 placed (default \"doc\").
246 --tests-base=DIRECTORY
247 Directory relative to --dir where unit tests are
248 placed (default \"tests\").
249 --aux-dir=DIRECTORY Directory relative to --dir where auxiliary build
250 tools are placed (default comes from configure.ac).
251 --lgpl[=2|=3] Abort if modules aren't available under the LGPL.
252 Also modify license template from GPL to LGPL.
253 The version number of the LGPL can be specified;
254 the default is currently LGPLv3.
255 --makefile-name=NAME Name of makefile in automake syntax in the
256 source-base and tests-base directories
257 (default \"Makefile.am\").
258 --macro-prefix=PREFIX Specify the prefix of the macros 'gl_EARLY' and
259 'gl_INIT'. Default is 'gl'.
260 --po-domain=NAME Specify the prefix of the i18n domain. Usually use
261 the package name. A suffix '-gnulib' is appended.
262 --witness-c-macro=NAME Specify the C macro that is defined when the
263 sources in this directory are compiled or used.
264 --vc-files Update version control related files.
265 --no-vc-files Don't update version control related files
266 (.gitignore and/or .cvsignore).
267 --no-changelog Don't update or create ChangeLog files.
269 Options for --create-[mega]testdir, --[mega]test:
271 --without-c++-tests Exclude unit tests for C++ interoperability.
272 --without-longrunning-tests
273 Exclude unit tests that are long-runners.
274 --without-privileged-tests
275 Exclude unit tests that require root privileges.
276 --without-unportable-tests
277 Exclude unit tests that fail on some platforms.
278 --single-configure Generate a single configure file, not a separate
279 configure file for the tests directory.
281 Options for --import, --add/remove-import, --update,
282 --create-[mega]testdir, --[mega]test:
284 -s, --symbolic, --symlink Make symbolic links instead of copying files.
285 --local-symlink Make symbolic links instead of copying files, only
286 for files from the local override directory.
288 Options for --import, --add/remove-import, --update:
290 -S, --more-symlinks Make symbolic links instead of copying files, and
291 don't replace copyright notices.
293 Report bugs to <bug-gnulib@gnu.org>."
297 # outputs to stdout the --version message.
301 if test -d "$gnulib_dir"/.git \
302 && (git
--version) >/dev
/null
2>/dev
/null \
303 && (date --version) >/dev
/null
2>/dev
/null
; then
304 # gnulib checked out from git.
305 sed_extract_first_date
='/^Date/{
309 date=`cd "$gnulib_dir" && git log ChangeLog | sed -n -e "$sed_extract_first_date"`
310 # Turn "Fri Mar 21 07:16:51 2008 -0600" into "Mar 21 2008 07:16:51 -0600".
311 sed_year_before_time
='s/^[^ ]* \([^ ]*\) \([0-9]*\) \([0-9:]*\) \([0-9]*\) /\1 \2 \4 \3 /'
312 date=`echo "$date" | sed -e "$sed_year_before_time"`
313 # Use GNU date to compute the time in GMT.
314 date=`date -d "$date" -u +"%Y-%m-%d %H:%M:%S"`
315 version
=' '`cd "$gnulib_dir" && ./build-aux/git-version-gen /dev/null | sed -e 's/-dirty/-modified/'`
317 if test -d "$gnulib_dir"/CVS \
318 && (cvs
--version) >/dev
/null
2>/dev
/null
; then
319 # gnulib checked out from CVS.
320 sed_extract_first_date
='/^date: /{
321 s/^date: \([0-9][0-9][0-9][0-9]\).\([0-9][0-9]\).\([0-9][0-9]\) \([0-9][0-9]:[0-9][0-9]:[0-9][0-9]\).*/\1-\2-\3 \4/p
324 date=`cd "$gnulib_dir" && cvs log -N ChangeLog 2>/dev/null | sed -n -e "$sed_extract_first_date"`
326 # gnulib copy without versioning information.
327 date=`sed -e 's/ .*//;q' "$gnulib_dir"/ChangeLog`
331 year
=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed -e 's,^.* ,,'`
333 gnulib-tool (GNU $package $date)$version
334 Copyright (C) $year Free Software Foundation, Inc.
335 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
336 This is free software: you are free to change and redistribute it.
337 There is NO WARRANTY, to the extent permitted by law.
339 Written by" "Bruno Haible" "and" "Simon Josefsson"
342 # func_emit_copyright_notice
343 # outputs to stdout a header for a generated file.
344 func_emit_copyright_notice
()
346 sed -n -e '/Copyright/ {
349 }' < "$self_abspathname"
351 echo "# This file is free software; you can redistribute it and/or modify"
352 echo "# it under the terms of the GNU General Public License as published by"
353 echo "# the Free Software Foundation; either version 3 of the License, or"
354 echo "# (at your option) any later version."
356 echo "# This file is distributed in the hope that it will be useful,"
357 echo "# but WITHOUT ANY WARRANTY; without even the implied warranty of"
358 echo "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
359 echo "# GNU General Public License for more details."
361 echo "# You should have received a copy of the GNU General Public License"
362 echo "# along with this file. If not, see <http://www.gnu.org/licenses/>."
364 echo "# As a special exception to the GNU General Public License,"
365 echo "# this file may be distributed as part of a program that"
366 echo "# contains a configuration script generated by Autoconf, under"
367 echo "# the same distribution terms as the rest of that program."
369 echo "# Generated by gnulib-tool."
373 # exits with a given status.
374 # This function needs to be used, rather than 'exit', when a 'trap' handler is
375 # in effect that refers to $?.
382 # locates the directory where the gnulib repository lives
384 # - progname name of this program
386 # - self_abspathname absolute pathname of gnulib-tool
387 # - gnulib_dir absolute pathname of gnulib repository
391 /*) self_abspathname
="$progname" ;;
392 */*) self_abspathname
=`pwd`/"$progname" ;;
395 # Iterate through the elements of $PATH.
396 # We use IFS=: instead of
397 # for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'`
398 # because the latter does not work when some PATH element contains spaces.
399 # We use a canonicalized $pathx instead of $PATH, because empty PATH
400 # elements are by definition equivalent to '.', however field splitting
401 # according to IFS=: loses empty fields in many shells:
402 # - /bin/sh on OSF/1 and Solaris loses all empty fields (at the
403 # beginning, at the end, and in the middle),
404 # - /bin/sh on IRIX and /bin/ksh on IRIX and OSF/1 lose empty fields
405 # at the beginning and at the end,
406 # - GNU bash, /bin/sh on AIX and HP-UX, and /bin/ksh on AIX, HP-UX,
407 # Solaris lose empty fields at the end.
408 # The 'case' statement is an optimization, to avoid evaluating the
409 # explicit canonicalization command when $PATH contains no empty fields.
411 if test "${PATH_SEPARATOR+set}" != set; then
412 # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
413 # contains only /bin. Note that ksh looks also at the FPATH variable,
414 # so we have to set that as well for the test.
416 (PATH
='/bin;/bin'; FPATH
=$PATH; sh
-c :) >/dev
/null
2>&1 \
417 && { (PATH
='/bin:/bin'; FPATH
=$PATH; sh
-c :) >/dev
/null
2>&1 \
418 || PATH_SEPARATOR
=';'
421 if test "$PATH_SEPARATOR" = ";"; then
422 # On Windows, programs are searched in "." before $PATH.
425 # On Unix, we have to convert empty PATH elements to ".".
429 pathx
=`echo ":$PATH:" | sed -e 's/:::*/:.:/g' -e 's/^://' -e 's/:\$//'`
434 IFS
="$PATH_SEPARATOR"
438 if test -x "$d/$progname" && test ! -d "$d/$progname"; then
439 self_abspathname
="$d/$progname"
444 if test -z "$self_abspathname"; then
445 func_fatal_error
"could not locate the gnulib-tool program - how did you invoke it?"
449 while test -h "$self_abspathname"; do
450 # Resolve symbolic link.
451 linkval
=`func_readlink "$self_abspathname"`
452 test -n "$linkval" ||
break
454 /* ) self_abspathname
="$linkval" ;;
455 * ) self_abspathname
=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;;
458 gnulib_dir
=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
462 # creates a temporary directory.
464 # - progname name of this program
466 # - tmp pathname of freshly created temporary directory
469 # Use the environment variable TMPDIR, falling back to /tmp. This allows
470 # users to specify a different temporary directory, for example, if their
471 # /tmp is filled up or too small.
474 # Use the mktemp program if available. If not available, hide the error
476 tmp
=`(umask 077 && mktemp -d "$TMPDIR/glXXXXXX") 2>/dev/null` &&
477 test -n "$tmp" && test -d "$tmp"
480 # Use a simple mkdir command. It is guaranteed to fail if the directory
481 # already exists. $RANDOM is bash specific and expands to empty in shells
482 # other than bash, ksh and zsh. Its use does not increase security;
483 # rather, it minimizes the probability of failure in a very cluttered /tmp
485 tmp
=$TMPDIR/gl$$
-$RANDOM
486 (umask 077 && mkdir
"$tmp")
489 echo "$progname: cannot create a temporary directory in $TMPDIR" >&2
494 # func_append var value
495 # appends the given value to the shell variable var.
496 if ( foo
=bar
; foo
+=baz
&& test "$foo" = barbaz
) >/dev
/null
2>&1; then
497 # Use bash's += operator. It reduces complexity of appending repeatedly to
498 # a single variable from O(n^2) to O(n).
503 fast_func_append
=true
507 eval "$1=\"\$$1\$2\""
509 fast_func_append
=false
512 # func_remove_prefix var prefix
513 # removes the given prefix from the value of the shell variable var.
514 # var should be the name of a shell variable.
515 # Its value should not contain a newline and not start or end with whitespace.
516 # prefix should not contain the characters "$`\{}[]^|.
517 if ( foo
=bar
; eval 'test "${foo#b}" = ar' ) >/dev
/null
2>&1; then
518 func_remove_prefix
()
522 fast_func_remove_prefix
=true
524 func_remove_prefix
()
526 eval "value=\"\$$1\""
530 sed_escape_dots
='s/\([.]\)/\\\1/g'
531 prefix
=`echo "$prefix" | sed -e "$sed_escape_dots"`
534 value
=`echo "$value" | sed -e "s|^${prefix}||"`
535 eval "$1=\"\$value\""
537 fast_func_remove_prefix
=false
540 # func_remove_suffix var suffix
541 # removes the given suffix from the value of the shell variable var.
542 # var should be the name of a shell variable.
543 # Its value should not contain a newline and not start or end with whitespace.
544 # suffix should not contain the characters "$`\{}[]^|.
545 if ( foo
=bar
; eval 'test "${foo%r}" = ba' ) >/dev
/null
2>&1; then
546 func_remove_suffix
()
550 fast_func_remove_suffix
=true
552 func_remove_suffix
()
554 eval "value=\"\$$1\""
558 sed_escape_dots
='s/\([.]\)/\\\1/g'
559 suffix
=`echo "$suffix" | sed -e "$sed_escape_dots"`
562 value
=`echo "$value" | sed -e "s|${suffix}\$||"`
563 eval "$1=\"\$value\""
565 fast_func_remove_suffix
=false
568 # func_fatal_error message
569 # outputs to stderr a fatal error message, and terminates the program.
571 # - progname name of this program
574 echo "$progname: *** $1" 1>&2
575 echo "$progname: *** Stop." 1>&2
579 # func_warning message
580 # Outputs to stderr a warning message,
583 echo "gnulib-tool: warning: $1" 1>&2
586 # func_readlink SYMLINK
587 # outputs the target of the given symlink.
588 if (type -p readlink
) > /dev
/null
2>&1; then
591 # Use the readlink program from GNU coreutils.
597 # Use two sed invocations. A single sed -n -e 's,^.* -> \(.*\)$,\1,p'
598 # would do the wrong thing if the link target contains " -> ".
599 LC_ALL
=C
ls -l "$1" |
sed -e 's, -> ,#%%#,' |
sed -n -e 's,^.*#%%#\(.*\)$,\1,p'
603 # func_relativize DIR1 DIR2
604 # computes a relative pathname RELDIR such that DIR1/RELDIR = DIR2.
606 # - DIR1 relative pathname, relative to the current directory
607 # - DIR2 relative pathname, relative to the current directory
609 # - reldir relative pathname of DIR2, relative to DIR1
615 sed_first
='s,^\([^/]*\)/.*$,\1,'
616 sed_rest
='s,^[^/]*/*,,'
617 sed_last
='s,^.*/\([^/]*\)$,\1,'
618 sed_butlast
='s,/*[^/]*$,,'
619 while test -n "$dir1"; do
620 first
=`echo "$dir1" | sed -e "$sed_first"`
621 if test "$first" != "."; then
622 if test "$first" = ".."; then
623 dir2
=`echo "$dir0" | sed -e "$sed_last"`/"$dir2"
624 dir0
=`echo "$dir0" | sed -e "$sed_butlast"`
626 first2
=`echo "$dir2" | sed -e "$sed_first"`
627 if test "$first2" = "$first"; then
628 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
632 dir0
="$dir0"/"$first"
635 dir1
=`echo "$dir1" | sed -e "$sed_rest"`
640 # func_relconcat DIR1 DIR2
641 # computes a relative pathname DIR1/DIR2, with obvious simplifications.
643 # - DIR1 relative pathname, relative to the current directory
644 # - DIR2 relative pathname, relative to DIR1
646 # - relconcat DIR1/DIR2, relative to the current directory
651 sed_first
='s,^\([^/]*\)/.*$,\1,'
652 sed_rest
='s,^[^/]*/*,,'
653 sed_last
='s,^.*/\([^/]*\)$,\1,'
654 sed_butlast
='s,/*[^/]*$,,'
656 first
=`echo "$dir2" | sed -e "$sed_first"`
657 if test "$first" = "."; then
658 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
659 if test -z "$dir2"; then
664 last
=`echo "$dir1" | sed -e "$sed_last"`
665 while test "$last" = "."; do
666 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
667 last
=`echo "$dir1" | sed -e "$sed_last"`
669 if test -z "$dir1"; then
673 if test "$first" = ".."; then
674 if test "$last" = ".."; then
675 relconcat
="$dir1/$dir2"
678 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
679 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
680 if test -z "$dir1"; then
684 if test -z "$dir2"; then
689 relconcat
="$dir1/$dir2"
697 # Like ln -s, except that SRC is given relative to the current directory (or
698 # absolute), not given relative to the directory of DEST.
704 *) # SRC is relative.
707 ln -s "`pwd`/$1" "$2" ;;
708 *) # DEST is relative too.
709 ln_destdir
=`echo "$2" | sed -e 's,[^/]*$,,'`
710 test -n "$ln_destdir" || ln_destdir
="."
711 func_relativize
"$ln_destdir" "$1"
719 # func_ln_if_changed SRC DEST
720 # Like func_ln, but avoids munging timestamps if the link is correct.
721 func_ln_if_changed
()
723 if test $# -ne 2; then
724 echo "usage: func_ln_if_changed SRC DEST" >&2
726 ln_target
=`func_readlink "$2"`
727 if test -h "$2" && test "$1" = "$ln_target"; then
735 # Ensure an 'echo' command that
736 # 1. does not interpret backslashes and
737 # 2. does not print an error message "broken pipe" when writing into a pipe
740 # Test cases for problem 1:
741 # echo '\n' | wc -l prints 1 when OK, 2 when KO
742 # echo '\t' | grep t > /dev/null has return code 0 when OK, 1 when KO
743 # Test cases for problem 2:
744 # echo hi | true frequently prints
745 # "bash: echo: write error: Broken pipe"
746 # to standard error in bash 3.2.
748 # Problem 1 is a weird heritage from SVR4. BSD got it right (except that
749 # BSD echo interprets '-n' as an option, which is also not desirable).
750 # Nowadays the problem occurs in 4 situations:
751 # - in bash, when the shell option xpg_echo is set (bash >= 2.04)
752 # or when it was built with --enable-usg-echo-default (bash >= 2.0)
753 # or when it was built with DEFAULT_ECHO_TO_USG (bash < 2.0),
754 # - in zsh, when sh-emulation is not set,
755 # - in ksh (e.g. AIX /bin/sh and Solaris /usr/xpg4/bin/sh are ksh instances,
756 # and HP-UX /bin/sh and IRIX /bin/sh behave similarly),
757 # - in Solaris /bin/sh and OSF/1 /bin/sh.
758 # We try the following workarounds:
759 # - for all: respawn using $CONFIG_SHELL if that is set and works.
760 # - for bash >= 2.04: unset the shell option xpg_echo.
761 # - for bash >= 2.0: define echo to a function that uses the printf built-in.
762 # - for bash < 2.0: define echo to a function that uses cat of a here document.
763 # - for zsh: turn sh-emulation on.
764 # - for ksh: alias echo to 'print -r'.
765 # - for ksh: alias echo to a function that uses cat of a here document.
766 # - for Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh and rely on
767 # the ksh workaround.
768 # - otherwise: respawn using /bin/sh and rely on the workarounds.
769 # When respawning, we pass --no-reexec as first argument, so as to avoid
770 # turning this script into a fork bomb in unlucky situations.
772 # Problem 2 is specific to bash 3.2 and affects the 'echo' built-in, but not
773 # the 'printf' built-in. See
774 # <http://lists.gnu.org/archive/html/bug-bash/2008-12/msg00050.html>
775 # <http://lists.gnu.org/archive/html/bug-gnulib/2010-02/msg00154.html>
776 # The workaround is: define echo to a function that uses the printf built-in.
778 if echo '\t' |
grep t
> /dev
/null
; then
779 have_echo
=yes # Lucky!
781 # Try the workarounds.
782 # Respawn using $CONFIG_SHELL if that is set and works.
783 if test -z "$have_echo" \
784 && test "X$1" != "X--no-reexec" \
785 && test -n "$CONFIG_SHELL" \
786 && test -f "$CONFIG_SHELL" \
787 && $CONFIG_SHELL -c "echo '\\t' | grep t > /dev/null"; then
788 exec $CONFIG_SHELL "$0" --no-reexec "$@"
791 # For bash >= 2.04: unset the shell option xpg_echo.
792 if test -z "$have_echo" \
793 && test -n "$BASH_VERSION" \
794 && (shopt -o xpg_echo
; echo '\t' |
grep t
> /dev
/null
) 2>/dev
/null
; then
798 # For bash >= 2.0: define echo to a function that uses the printf built-in.
799 # For bash < 2.0: define echo to a function that uses cat of a here document.
800 # (There is no win in using 'printf' over 'cat' if it is not a shell built-in.)
801 # Also handle problem 2, specific to bash 3.2, here.
802 if { test -z "$have_echo" \
803 ||
case "$BASH_VERSION" in 3.2*) true
;; *) false
;; esac; \
805 && test -n "$BASH_VERSION"; then \
806 if type printf 2>/dev
/null |
grep / > /dev
/null
; then
807 # 'printf' is not a shell built-in.
815 # 'printf' is a shell built-in.
821 if echo '\t' |
grep t
> /dev
/null
; then
825 # For zsh: turn sh-emulation on.
826 if test -z "$have_echo" \
827 && test -n "$ZSH_VERSION" \
828 && (emulate sh
) >/dev
/null
2>&1; then
831 # For ksh: alias echo to 'print -r'.
832 if test -z "$have_echo" \
833 && (type print
) >/dev
/null
2>&1; then
834 # A 'print' command exists.
835 if type print
2>/dev
/null |
grep / > /dev
/null
; then
838 # 'print' is a shell built-in.
839 if (print
-r '\told' |
grep told
> /dev
/null
) 2>/dev
/null
; then
840 # 'print' is the ksh shell built-in.
841 alias echo='print -r'
845 if test -z "$have_echo" \
846 && echo '\t' |
grep t
> /dev
/null
; then
849 # For ksh: alias echo to a function that uses cat of a here document.
850 # The ksh manual page says:
851 # "Aliasing is performed when scripts are read, not while they are executed.
852 # Therefore, for an alias to take effect, the alias definition command has
853 # to be executed before the command which references the alias is read."
854 # Because of this, we have to play strange tricks with have_echo, to ensure
855 # that the top-level statement containing the test starts after the 'alias'
857 if test -z "$have_echo"; then
864 if (alias echo=bsd_echo
) 2>/dev
/null
; then
865 alias echo=bsd_echo
2>/dev
/null
868 if test -z "$have_echo" \
869 && echo '\t' |
grep t
> /dev
/null
; then
872 if test -z "$have_echo"; then
873 if (alias echo=bsd_echo
) 2>/dev
/null
; then
874 unalias echo 2>/dev
/null
877 # For Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh.
878 if test -z "$have_echo" \
879 && test "X$1" != "X--no-reexec" \
880 && test -f /bin
/ksh
; then
881 exec /bin
/ksh
"$0" --no-reexec "$@"
884 # Otherwise: respawn using /bin/sh.
885 if test -z "$have_echo" \
886 && test "X$1" != "X--no-reexec" \
887 && test -f /bin
/sh
; then
888 exec /bin
/sh
"$0" --no-reexec "$@"
891 if test -z "$have_echo"; then
892 func_fatal_error
"Shell does not support 'echo' correctly. Please install GNU bash and set the environment variable CONFIG_SHELL to point to it."
894 if echo '\t' |
grep t
> /dev
/null
; then
897 func_fatal_error
"Shell does not support 'echo' correctly. Workaround does not work. Please report this as a bug to bug-gnulib@gnu.org."
899 if test "X$1" = "X--no-reexec"; then
903 # Command-line option processing.
904 # Removes the OPTIONS from the arguments. Sets the variables:
905 # - mode list or import or add-import or remove-import or update
906 # or create-testdir or create-megatestdir
907 # - destdir from --dir
908 # - local_gnulib_dir from --local-dir
909 # - modcache true or false, from --cache-modules/--no-cache-modules
910 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
911 # - libname, supplied_libname from --lib
912 # - sourcebase from --source-base
913 # - m4base from --m4-base
914 # - pobase from --po-base
915 # - docbase from --doc-base
916 # - testsbase from --tests-base
917 # - auxdir from --aux-dir
918 # - inctests true if --with-tests was given, blank otherwise
919 # - incobsolete true if --with-obsolete was given, blank otherwise
920 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
921 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
923 # - inc_privileged_tests true if --with-privileged-tests was given, blank
925 # - inc_unportable_tests true if --with-unportable-tests was given, blank
927 # - inc_all_tests true if --with-all-tests was given, blank otherwise
928 # - excl_cxx_tests true if --without-c++-tests was given, blank otherwise
929 # - excl_longrunning_tests true if --without-longrunning-tests was given,
931 # - excl_privileged_tests true if --without-privileged-tests was given, blank
933 # - excl_unportable_tests true if --without-unportable-tests was given, blank
935 # - single_configure true if --single-configure was given, false otherwise
936 # - avoidlist list of modules to avoid, from --avoid
937 # - cond_dependencies true if --conditional-dependencies was given, false if
938 # --no-conditional-dependencies was given, blank otherwise
939 # - lgpl yes or a number if --lgpl was given, blank otherwise
940 # - makefile_name from --makefile-name
941 # - libtool true if --libtool was given, false if --no-libtool was
942 # given, blank otherwise
943 # - macro_prefix from --macro-prefix
944 # - po_domain from --po-domain
945 # - witness_c_macro from --witness-c-macro
946 # - vc_files true if --vc-files was given, false if --no-vc-files was
947 # given, blank otherwise
948 # - autoconf_minversion minimum supported autoconf version
949 # - do_changelog false if --no-changelog was given, : otherwise
950 # - doit : if actions shall be executed, false if only to be printed
951 # - symbolic true if --symlink or --more-symlinks was given, blank
953 # - lsymbolic true if --local-symlink was given, blank otherwise
954 # - do_copyrights blank if --more-symlinks was given, true otherwise
972 inc_longrunning_tests
=
973 inc_privileged_tests
=
974 inc_unportable_tests
=
977 excl_longrunning_tests
=
978 excl_privileged_tests
=
979 excl_unportable_tests
=
980 single_configure
=false
998 while test $# -gt 0; do
1003 --find |
--fin |
--fi |
--f )
1006 --import |
--impor |
--impo |
--imp |
--im |
--i )
1009 --add-import |
--add-impor |
--add-impo |
--add-imp |
--add-im |
--add-i |
--add- |
--add |
--ad )
1012 --remove-import |
--remove-impor |
--remove-impo |
--remove-imp |
--remove-im |
--remove-i |
--remove- |
--remove |
--remov |
--remo |
--rem |
--re |
--r )
1015 --update |
--updat |
--upda |
--upd |
--up |
--u )
1018 --create-testdir |
--create-testdi |
--create-testd |
--create-test |
--create-tes |
--create-te |
--create-t )
1021 --create-megatestdir |
--create-megatestdi |
--create-megatestd |
--create-megatest |
--create-megates |
--create-megate |
--create-megat |
--create-mega |
--create-meg |
--create-me |
--create-m )
1022 mode
=create-megatestdir
1024 --test |
--tes |
--te |
--t )
1027 --megatest |
--megates |
--megate |
--megat |
--mega |
--meg |
--me |
--m )
1031 mode
=`echo "X$1" | sed -e 's/^X--//'`
1033 --copy-file |
--copy-fil |
--copy-fi |
--copy-f |
--copy- |
--copy |
--cop )
1038 if test $# = 0; then
1039 func_fatal_error
"missing argument for --dir"
1044 destdir
=`echo "X$1" | sed -e 's/^X--dir=//'`
1048 if test $# = 0; then
1049 func_fatal_error
"missing argument for --local-dir"
1054 local_gnulib_dir
=`echo "X$1" | sed -e 's/^X--local-dir=//'`
1056 --cache-modules |
--cache-module |
--cache-modul |
--cache-modu |
--cache-mod |
--cache-mo |
--cache-m |
--cache- |
--cache |
--cach |
--cac |
--ca )
1059 --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 )
1062 --verbose |
--verbos |
--verbo |
--verb )
1063 verbose
=`expr $verbose + 1`
1065 --quiet |
--quie |
--qui |
--qu |
--q )
1066 verbose
=`expr $verbose - 1`
1070 if test $# = 0; then
1071 func_fatal_error
"missing argument for --lib"
1074 supplied_libname
=true
1077 libname
=`echo "X$1" | sed -e 's/^X--lib=//'`
1078 supplied_libname
=true
1082 if test $# = 0; then
1083 func_fatal_error
"missing argument for --source-base"
1088 sourcebase
=`echo "X$1" | sed -e 's/^X--source-base=//'`
1092 if test $# = 0; then
1093 func_fatal_error
"missing argument for --m4-base"
1098 m4base
=`echo "X$1" | sed -e 's/^X--m4-base=//'`
1102 if test $# = 0; then
1103 func_fatal_error
"missing argument for --po-base"
1108 pobase
=`echo "X$1" | sed -e 's/^X--po-base=//'`
1112 if test $# = 0; then
1113 func_fatal_error
"missing argument for --doc-base"
1118 docbase
=`echo "X$1" | sed -e 's/^X--doc-base=//'`
1122 if test $# = 0; then
1123 func_fatal_error
"missing argument for --tests-base"
1128 testsbase
=`echo "X$1" | sed -e 's/^X--tests-base=//'`
1132 if test $# = 0; then
1133 func_fatal_error
"missing argument for --aux-dir"
1138 auxdir
=`echo "X$1" | sed -e 's/^X--aux-dir=//'`
1140 --with-tests |
--with-test |
--with-tes |
--with-te |
--with-t)
1143 --with-obsolete |
--with-obsolet |
--with-obsole |
--with-obsol |
--with-obso |
--with-obs |
--with-ob |
--with-o)
1146 --with-c++-tests |
--with-c++-test |
--with-c++-tes |
--with-c++-te |
--with-c++-t |
--with-c++- |
--with-c++ |
--with-c+ |
--with-c)
1149 --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)
1150 inc_longrunning_tests
=true
1152 --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)
1153 inc_privileged_tests
=true
1155 --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)
1156 inc_unportable_tests
=true
1158 --with-all-tests |
--with-all-test |
--with-all-tes |
--with-all-te |
--with-all-t |
--with-all- |
--with-all |
--with-al |
--with-a)
1161 --without-c++-tests |
--without-c++-test |
--without-c++-tes |
--without-c++-te |
--without-c++-t |
--without-c++- |
--without-c++ |
--without-c+ |
--without-c)
1164 --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)
1165 excl_longrunning_tests
=true
1167 --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)
1168 excl_privileged_tests
=true
1170 --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)
1171 excl_unportable_tests
=true
1173 --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)
1174 single_configure
=true
1178 if test $# = 0; then
1179 func_fatal_error
"missing argument for --avoid"
1181 func_append avoidlist
" $1"
1184 arg
=`echo "X$1" | sed -e 's/^X--avoid=//'`
1185 func_append avoidlist
" $arg"
1187 --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)
1188 cond_dependencies
=true
1190 --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)
1191 cond_dependencies
=false
1197 arg
=`echo "X$1" | sed -e 's/^X--lgpl=//'`
1200 *) func_fatal_error
"invalid LGPL version number for --lgpl" ;;
1206 if test $# = 0; then
1207 func_fatal_error
"missing argument for --makefile-name"
1212 makefile_name
=`echo "X$1" | sed -e 's/^X--makefile-name=//'`
1222 if test $# = 0; then
1223 func_fatal_error
"missing argument for --macro-prefix"
1228 macro_prefix
=`echo "X$1" | sed -e 's/^X--macro-prefix=//'`
1232 if test $# = 0; then
1233 func_fatal_error
"missing argument for --po-domain"
1238 po_domain
=`echo "X$1" | sed -e 's/^X--po-domain=//'`
1242 if test $# = 0; then
1243 func_fatal_error
"missing argument for --witness-c-macro"
1245 witness_c_macro
="$1"
1247 --witness-c-macro=* )
1248 witness_c_macro
=`echo "X$1" | sed -e 's/^X--witness-c-macro=//'`
1256 --no-changelog |
--no-changelo |
--no-changel |
--no-change |
--no-chang |
--no-chan |
--no-cha |
--no-ch )
1262 -s |
--symbolic |
--symboli |
--symbol |
--symbo |
--symb |
--symlink |
--symlin |
--symli |
--syml |
--sym |
--sy )
1265 --local-symlink |
--local-symlin |
--local-symli |
--local-syml |
--local-sym |
--local-sy |
--local-s )
1268 -S |
--more-symlinks |
--more-symlink |
--more-symlin |
--more-symli |
--more-syml |
--more-sym |
--more-sy |
--more-s |
--more- |
--more |
--mor |
--mo )
1272 --help |
--hel |
--he |
--h )
1275 --version |
--versio |
--versi |
--vers )
1279 # Stop option processing
1283 echo "gnulib-tool: unknown option $1" 1>&2
1284 echo "Try 'gnulib-tool --help' for more information." 1>&2
1291 if case "$mode" in import | add-import | remove-import
) true
;; *) false
;; esac; then
1292 if test -n "$excl_cxx_tests" ||
test -n "$excl_longrunning_tests" \
1293 ||
test -n "$excl_privileged_tests" ||
test -n "$excl_unportable_tests" \
1294 ||
test "$single_configure" != false
; then
1295 echo "gnulib-tool: invalid options for '$mode' mode" 1>&2
1296 echo "Try 'gnulib-tool --help' for more information." 1>&2
1300 # This code helps migrating from --import to --add-import or --update. It can
1301 # be removed on 2012-01-01.
1302 if test "$mode" = import
&& test $# = 0; then
1303 echo "gnulib-tool: cowardly refusing to erase the module list." 1>&2
1304 echo "The meaning of the option '--import' has changed." 1>&2
1305 echo "See the documentation at" 1>&2
1306 echo "<http://www.gnu.org/software/gnulib/manual/html_node/Modified-imports.html>." 1>&2
1307 echo "For updating to a newer version of gnulib, use" 1>&2
1308 echo " gnulib-tool --add-import" 1>&2
1309 echo "For restoring files that were omitted from version control, use" 1>&2
1310 echo " gnulib-tool --update" 1>&2
1313 if test "$mode" = update
; then
1314 if test $# != 0; then
1315 echo "gnulib-tool: too many arguments in 'update' mode" 1>&2
1316 echo "Try 'gnulib-tool --help' for more information." 1>&2
1317 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1318 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1321 if test -n "$local_gnulib_dir" ||
test -n "$supplied_libname" \
1322 ||
test -n "$sourcebase" ||
test -n "$m4base" ||
test -n "$pobase" \
1323 ||
test -n "$docbase" ||
test -n "$testsbase" ||
test -n "$auxdir" \
1324 ||
test -n "$inctests" ||
test -n "$incobsolete" \
1325 ||
test -n "$inc_cxx_tests" ||
test -n "$inc_longrunning_tests" \
1326 ||
test -n "$inc_privileged_tests" ||
test -n "$inc_unportable_tests" \
1327 ||
test -n "$inc_all_tests" \
1328 ||
test -n "$excl_cxx_tests" ||
test -n "$excl_longrunning_tests" \
1329 ||
test -n "$excl_privileged_tests" ||
test -n "$excl_unportable_tests" \
1330 ||
test -n "$avoidlist" ||
test -n "$lgpl" ||
test -n "$makefile_name" \
1331 ||
test -n "$macro_prefix" ||
test -n "$po_domain" \
1332 ||
test -n "$witness_c_macro" ||
test -n "$vc_files"; then
1333 echo "gnulib-tool: invalid options for 'update' mode" 1>&2
1334 echo "Try 'gnulib-tool --help' for more information." 1>&2
1335 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1336 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1341 if test -n "$pobase" && test -z "$po_domain"; then
1342 echo "gnulib-tool: together with --po-base, you need to specify --po-domain" 1>&2
1343 echo "Try 'gnulib-tool --help' for more information." 1>&2
1346 if test -z "$pobase" && test -n "$po_domain"; then
1347 func_warning
"--po-domain has no effect without a --po-base option"
1349 if test "$cond_dependencies" = true
&& test -n "$inctests"; then
1350 echo "gnulib-tool: option --conditional-dependencies is not supported with --with-tests" 1>&2
1354 # Determine the minimum supported autoconf version from the project's
1356 DEFAULT_AUTOCONF_MINVERSION
="2.59"
1357 autoconf_minversion
=
1359 if case "$mode" in import | add-import | remove-import | update
) true
;; *) false
;; esac \
1360 && test -n "$destdir"; then
1361 if test -f "$destdir"/configure.ac
; then
1362 configure_ac
="$destdir/configure.ac"
1364 if test -f "$destdir"/configure.
in; then
1365 configure_ac
="$destdir/configure.in"
1369 if test -f configure.ac
; then
1370 configure_ac
="configure.ac"
1372 if test -f configure.
in; then
1373 configure_ac
="configure.in"
1377 if test -n "$configure_ac"; then
1378 # Use sed, not autoconf --trace, to look for the AC_PREREQ invocation,
1379 # because when some m4 files are omitted from a version control repository,
1380 # "autoconf --trace=AC_PREREQ" fails with an error message like this:
1381 # m4: aclocal.m4:851: Cannot open m4/absolute-header.m4: No such file or directory
1382 # autom4te: m4 failed with exit status: 1
1389 s,^.*AC_PREREQ([[ ]*\([^])]*\).*$,\1,p
1391 prereqs
=`sed -n -e "$my_sed_traces" < "$configure_ac"`
1392 if test -n "$prereqs"; then
1393 autoconf_minversion
=`
1394 for version in $prereqs; do echo $version; done |
1395 LC_ALL=C sort -nru | sed -e 1q
1399 if test -z "$autoconf_minversion"; then
1400 autoconf_minversion
=$DEFAULT_AUTOCONF_MINVERSION
1402 case "$autoconf_minversion" in
1403 1.
* |
2.
[0-4]* |
2.5[0-8]*)
1404 func_fatal_error
"minimum supported autoconf version is 2.59. Try adding AC_PREREQ([$DEFAULT_AUTOCONF_MINVERSION]) to your configure.ac." ;;
1407 # Remove trailing slashes from the directory names. This is necessary for
1408 # m4base (to avoid an error in func_import) and optional for the others.
1409 sed_trimtrailingslashes
='s,\([^/]\)//*$,\1,'
1410 case "$local_gnulib_dir" in
1411 */ ) local_gnulib_dir
=`echo "$local_gnulib_dir" | sed -e "$sed_trimtrailingslashes"` ;;
1413 case "$sourcebase" in
1414 */ ) sourcebase
=`echo "$sourcebase" | sed -e "$sed_trimtrailingslashes"` ;;
1417 */ ) m4base
=`echo "$m4base" | sed -e "$sed_trimtrailingslashes"` ;;
1420 */ ) pobase
=`echo "$pobase" | sed -e "$sed_trimtrailingslashes"` ;;
1423 */ ) docbase
=`echo "$docbase" | sed -e "$sed_trimtrailingslashes"` ;;
1425 case "$testsbase" in
1426 */ ) testsbase
=`echo "$testsbase" | sed -e "$sed_trimtrailingslashes"` ;;
1429 */ ) auxdir
=`echo "$auxdir" | sed -e "$sed_trimtrailingslashes"` ;;
1435 trap 'exit_status=$?
1436 if test "$signal" != 0; then
1437 echo "caught signal $signal" >&2
1440 exit $exit_status' 0
1441 for signal
in 1 2 3 13 15; do
1442 trap '{ signal='$signal'; func_exit 1; }' $signal
1446 # Note: The 'eval' silences stderr output in dash.
1447 if (declare -A x
&& { x
[f
/2]='foo'; x
[f
/3]='bar'; eval test '${x[f/2]}' = foo
; }) 2>/dev
/null
; then
1448 # Zsh 4 and Bash 4 have associative arrays.
1449 have_associative
=true
1451 # For other shells, use 'eval' with computed shell variable names.
1452 have_associative
=false
1455 # func_lookup_file file
1456 # looks up a file in $local_gnulib_dir or $gnulib_dir, or combines it through
1459 # - local_gnulib_dir from --local-dir
1461 # - lookedup_file name of the merged (combined) file
1462 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
1466 if test -n "$local_gnulib_dir" && test -f "$local_gnulib_dir/$lkfile"; then
1467 lookedup_file
="$local_gnulib_dir/$lkfile"
1470 if test -f "$gnulib_dir/$lkfile"; then
1471 if test -n "$local_gnulib_dir" && test -f "$local_gnulib_dir/$lkfile.diff"; then
1472 lkbase
=`echo "$lkfile" | sed -e 's,^.*/,,'`
1473 rm -f "$tmp/$lkbase"
1474 cp "$gnulib_dir/$lkfile" "$tmp/$lkbase"
1475 patch -s "$tmp/$lkbase" < "$local_gnulib_dir/$lkfile.diff" \
1476 || func_fatal_error
"patch file $local_gnulib_dir/$lkfile.diff didn't apply cleanly"
1477 lookedup_file
="$tmp/$lkbase"
1480 lookedup_file
="$gnulib_dir/$lkfile"
1484 func_fatal_error
"file $gnulib_dir/$lkfile not found"
1489 # func_sanitize_modulelist
1490 # receives a list of possible module names on standard input, one per line.
1491 # It removes those which are just file names unrelated to modules, and outputs
1492 # the resulting list to standard output, one per line.
1493 func_sanitize_modulelist
()
1495 sed -e '/^CVS\//d' -e '/\/CVS\//d' \
1496 -e '/^ChangeLog$/d' -e '/\/ChangeLog$/d' \
1497 -e '/^COPYING$/d' -e '/\/COPYING$/d' \
1498 -e '/^README$/d' -e '/\/README$/d' \
1499 -e '/^TEMPLATE$/d' \
1500 -e '/^TEMPLATE-EXTENDED$/d' \
1501 -e '/^TEMPLATE-TESTS$/d' \
1508 # - local_gnulib_dir from --local-dir
1511 # Filter out metainformation files like README, which are not modules.
1512 # Filter out unit test modules; they can be retrieved through
1513 # --extract-tests-module if desired.
1515 (cd "$gnulib_dir" && find modules
-type f
-print |
sed -e 's,^modules/,,')
1516 if test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules"; then
1517 (cd "$local_gnulib_dir" && find modules
-type f
-print |
sed -e 's,^modules/,,' -e 's,\.diff$,,')
1520 | func_sanitize_modulelist \
1521 |
sed -e '/-tests$/d' \
1525 # func_exists_module module
1526 # tests whether a module, given by name, exists
1528 # - local_gnulib_dir from --local-dir
1529 func_exists_module
()
1531 { test -f "$gnulib_dir/modules/$1" \
1532 ||
{ test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules" \
1533 && test -f "$local_gnulib_dir/modules/$1"; }; } \
1534 && test "CVS" != "$1" \
1535 && test "ChangeLog" != "$1" \
1536 && test "COPYING" != "$1" \
1537 && test "README" != "$1" \
1538 && test "TEMPLATE" != "$1" \
1539 && test "TEMPLATE-EXTENDED" != "$1" \
1540 && test "TEMPLATE-TESTS" != "$1"
1543 # func_verify_module
1544 # verifies a module name
1546 # - local_gnulib_dir from --local-dir
1547 # - module module name argument
1548 func_verify_module
()
1550 if func_exists_module
"$module"; then
1551 # OK, $module is a correct module name.
1552 # Verify that building the module description with 'patch' succeeds.
1553 func_lookup_file
"modules/$module"
1555 func_warning
"module $module doesn't exist"
1560 # func_verify_nontests_module
1561 # verifies a module name, excluding tests modules
1563 # - local_gnulib_dir from --local-dir
1564 # - module module name argument
1565 func_verify_nontests_module
()
1568 *-tests ) module
= ;;
1569 * ) func_verify_module
;;
1573 # func_verify_tests_module
1574 # verifies a module name, considering only tests modules
1576 # - local_gnulib_dir from --local-dir
1577 # - module module name argument
1578 func_verify_tests_module
()
1581 *-tests ) func_verify_module
;;
1586 # Suffix of a sed expression that extracts a particular field from a
1587 # module description.
1588 # A field starts with a line that contains a keyword, such as 'Description',
1589 # followed by a colon and optional whitespace. All following lines, up to
1590 # the next field (or end of file if there is none) form the contents of the
1592 # An absent field is equivalent to a field with empty contents.
1593 # NOTE: Keep this in sync with sed_extract_cache_prog below!
1594 sed_extract_prog
=':[ ]*$/ {
1597 s/^Description:[ ]*$//
1601 s/^Applicability:[ ]*$//
1603 s/^Depends-on:[ ]*$//
1604 s/^configure\.ac-early:[ ]*$//
1605 s/^configure\.ac:[ ]*$//
1606 s/^Makefile\.am:[ ]*$//
1610 s/^Maintainer:[ ]*$//
1617 # Piece of a sed expression that converts a field header line to a shell
1619 # NOTE: Keep this in sync with sed_extract_prog above!
1620 sed_extract_field_header
='
1621 s/^Description:[ ]*$/description/
1622 s/^Comment:[ ]*$/comment/
1623 s/^Status:[ ]*$/status/
1624 s/^Notice:[ ]*$/notice/
1625 s/^Applicability:[ ]*$/applicability/
1626 s/^Files:[ ]*$/files/
1627 s/^Depends-on:[ ]*$/dependson/
1628 s/^configure\.ac-early:[ ]*$/configureac_early/
1629 s/^configure\.ac:[ ]*$/configureac/
1630 s/^Makefile\.am:[ ]*$/makefile/
1631 s/^Include:[ ]*$/include/
1633 s/^License:[ ]*$/license/
1634 s/^Maintainer:[ ]*$/maintainer/'
1638 if $have_associative; then
1640 # Declare the associative arrays.
1641 declare -A modcache_cached
1642 sed_to_declare_statement
='s|^.*/\([a-zA-Z0-9_]*\)/$|declare -A modcache_\1|p'
1643 declare_script
=`echo "$sed_extract_field_header" | sed -n -e "$sed_to_declare_statement"`
1644 eval "$declare_script"
1648 # func_cache_var module
1649 # computes the cache variable name corresponding to $module.
1650 # Note: This computation can map different module names to the same
1651 # cachevar (such as 'foo-bar', 'foo_bar', or 'foo/bar'); the caller has
1652 # to protect against this case.
1654 # - cachevar a shell variable name
1655 if (f
=foo
; eval echo '${f//o/e}') < /dev
/null
2>/dev
/null |
grep fee
>/dev
/null
; then
1656 # Bash 2.0 and newer, ksh, and zsh support the syntax
1657 # ${param//pattern/replacement}
1658 # as a shorthand for
1659 # `echo "$param" | sed -e "s/pattern/replacement/g"`.
1660 # Note: The 'eval' is necessary for dash and NetBSD /bin/sh.
1661 eval 'func_cache_var ()
1663 cachevar=c_${1//[!a-zA-Z0-9_]/_}
1670 cachevar
=c_
`echo "$1" | LC_ALL=C sed -e 's/[^a-zA-Z0-9_]/_/g'` ;;
1679 # func_init_sed_convert_to_cache_statements
1681 # - modcachevar_assignment
1683 # - sed_convert_to_cache_statements
1684 func_init_sed_convert_to_cache_statements
()
1686 # 'sed' script that turns a module description into shell script
1687 # assignments, suitable to be eval'ed. All active characters are escaped.
1690 # Some module's description
1695 # modcache_description[$1]=\
1696 # 'Some module'"'"'s description
1698 # modcache_files[$1]=\
1701 # c_MODULE_description_set=set; c_MODULE_description=\
1702 # 'Some module'"'"'s description
1704 # c_MODULE_files_set=set; c_MODULE_files=\
1706 # The script consists of two parts:
1707 # 1) Ignore the lines before the first field header.
1708 # 2) A loop, treating non-field-header lines by escaping single quotes
1709 # and adding a closing quote in the last line,
1710 sed_convert_to_cache_statements
="
1712 # Here we have not yet seen a field header.
1714 # See if the current line contains a field header.
1717 ${sed_extract_field_header}
1720 # No field header. Ignore the line.
1722 # Read the next line. Upon EOF, just exit.
1727 # The current line contains a field header.
1729 # Turn it into the beginning of an assignment.
1730 s/^\\(.*\\)\$/${modcachevar_assignment}\\\\/
1732 # Move it to the hold space. Don't print it yet,
1733 # because we want no assignment if the field is empty.
1736 # Read the next line.
1737 # Upon EOF, the field was empty. Print no assignment. Just exit.
1740 # See if the current line contains a field header.
1743 ${sed_extract_field_header}
1744 # If it is, the previous field was empty. Print no assignment.
1747 # Not a field header.
1749 # Print the previous line, held in the hold space.
1754 # Transform single quotes.
1757 # Prepend a single quote.
1762 # Move it to the hold space.
1765 # Read the next line.
1772 # See if the current line contains a field header.
1775 ${sed_extract_field_header}
1778 # Print the previous line, held in the hold space.
1783 # Transform single quotes.
1790 # Print the previous line, held in the hold space, with a single quote
1791 # to end the assignment.
1801 # Print the previous line, held in the hold space, with a single quote
1802 # to end the assignment.
1809 if ! $sed_comments; then
1811 sed_convert_to_cache_statements
=`echo "$sed_convert_to_cache_statements" \
1812 | sed -e 's/^ *//' -e 's/^#.*//'`
1816 if $have_associative; then
1817 # sed_convert_to_cache_statements does not depend on the module.
1818 modcachevar_assignment
='modcache_\1[$1]='
1819 func_init_sed_convert_to_cache_statements
1822 # func_cache_lookup_module module
1824 # looks up a module, like 'func_lookup_file modules/$module', and stores all
1825 # of its relevant data in a cache in the memory of the processing shell. If
1826 # already cached, it does not look it up again, thus saving file access time.
1828 # - module non-empty string
1829 # Output if $have_associative:
1830 # - modcache_cached[$module] set to yes
1831 # - modcache_description[$module] ==
1832 # - modcache_status[$module] \ set to the field's value, minus the
1833 # - ... / final newline,
1834 # - modcache_maintainer[$module] == or unset if the field's value is empty
1835 # Output if ! $have_associative:
1836 # - cachevar a shell variable name
1837 # - ${cachevar}_cached set to $module
1838 # - ${cachevar}_description ==
1839 # - ${cachevar}_status \ set to the field's value, minus the
1840 # - ... / final newline,
1841 # - ${cachevar}_maintainer == or unset if the field's value is empty
1842 # - ${cachevar}_description_set ==
1843 # - ${cachevar}_status_set \ set to non-empty if the field's value
1844 # - ... / is non-empty,
1845 # - ${cachevar}_maintainer_set == or unset if the field's value is empty
1846 func_cache_lookup_module
()
1848 if $have_associative; then
1849 eval 'cached=${modcache_cached[$1]}'
1852 eval "cached=\"\$${cachevar}_cached\""
1854 if test -z "$cached"; then
1855 # Not found in cache. Look it up on the file system.
1856 func_lookup_file
"modules/$1"
1857 if $have_associative; then
1858 eval 'modcache_cached[$1]=yes'
1860 eval "${cachevar}_cached=\"\$1\""
1862 if ! $have_associative; then
1863 # sed_convert_to_cache_statements depends on the module.
1864 modcachevar_assignment
="${cachevar}"'_\1_set=set; '"${cachevar}"'_\1='
1865 func_init_sed_convert_to_cache_statements
1867 cache_statements
=`LC_ALL=C sed -n -e "$sed_convert_to_cache_statements" < "$lookedup_file"`
1868 eval "$cache_statements"
1870 if ! $have_associative; then
1871 if test "$1" != "$cached"; then
1872 func_fatal_error
"cache variable collision between $1 and $cached"
1880 # func_get_description module
1882 # - local_gnulib_dir from --local-dir
1883 # - modcache true or false, from --cache-modules/--no-cache-modules
1884 func_get_description
()
1886 if ! $modcache; then
1887 func_lookup_file
"modules/$1"
1888 sed -n -e "/^Description$sed_extract_prog" < "$lookedup_file"
1890 func_cache_lookup_module
"$1"
1891 # Output the field's value, including the final newline (if any).
1892 if $have_associative; then
1893 if eval 'test -n "${modcache_description[$1]+set}"'; then
1894 eval 'echo "${modcache_description[$1]}"'
1897 eval "field_set=\"\$${cachevar}_description_set\""
1898 if test -n "$field_set"; then
1899 eval "field_value=\"\$${cachevar}_description\""
1900 echo "${field_value}"
1906 # func_get_comment module
1908 # - local_gnulib_dir from --local-dir
1909 # - modcache true or false, from --cache-modules/--no-cache-modules
1912 if ! $modcache; then
1913 func_lookup_file
"modules/$1"
1914 sed -n -e "/^Comment$sed_extract_prog" < "$lookedup_file"
1916 func_cache_lookup_module
"$1"
1917 # Output the field's value, including the final newline (if any).
1918 if $have_associative; then
1919 if eval 'test -n "${modcache_comment[$1]+set}"'; then
1920 eval 'echo "${modcache_comment[$1]}"'
1923 eval "field_set=\"\$${cachevar}_comment_set\""
1924 if test -n "$field_set"; then
1925 eval "field_value=\"\$${cachevar}_comment\""
1926 echo "${field_value}"
1932 # func_get_status module
1934 # - local_gnulib_dir from --local-dir
1935 # - modcache true or false, from --cache-modules/--no-cache-modules
1938 if ! $modcache; then
1939 func_lookup_file
"modules/$1"
1940 sed -n -e "/^Status$sed_extract_prog" < "$lookedup_file"
1942 func_cache_lookup_module
"$1"
1943 # Output the field's value, including the final newline (if any).
1944 if $have_associative; then
1945 if eval 'test -n "${modcache_status[$1]+set}"'; then
1946 eval 'echo "${modcache_status[$1]}"'
1949 eval "field_set=\"\$${cachevar}_status_set\""
1950 if test -n "$field_set"; then
1951 eval "field_value=\"\$${cachevar}_status\""
1952 echo "${field_value}"
1958 # func_get_notice module
1960 # - local_gnulib_dir from --local-dir
1961 # - modcache true or false, from --cache-modules/--no-cache-modules
1964 if ! $modcache; then
1965 func_lookup_file
"modules/$1"
1966 sed -n -e "/^Notice$sed_extract_prog" < "$lookedup_file"
1968 func_cache_lookup_module
"$1"
1969 # Output the field's value, including the final newline (if any).
1970 if $have_associative; then
1971 if eval 'test -n "${modcache_notice[$1]+set}"'; then
1972 eval 'echo "${modcache_notice[$1]}"'
1975 eval "field_set=\"\$${cachevar}_notice_set\""
1976 if test -n "$field_set"; then
1977 eval "field_value=\"\$${cachevar}_notice\""
1978 echo "${field_value}"
1984 # func_get_applicability module
1986 # - local_gnulib_dir from --local-dir
1987 # - modcache true or false, from --cache-modules/--no-cache-modules
1988 # The expected result (on stdout) is either 'main', or 'tests', or 'all'.
1989 func_get_applicability
()
1991 if ! $modcache; then
1992 func_lookup_file
"modules/$1"
1993 my_applicability
=`sed -n -e "/^Applicability$sed_extract_prog" < "$lookedup_file"`
1995 func_cache_lookup_module
"$1"
1996 # Get the field's value, without the final newline.
1997 if $have_associative; then
1998 eval 'my_applicability="${modcache_applicability[$1]}"'
2000 eval "my_applicability=\"\$${cachevar}_applicability\""
2003 if test -n "$my_applicability"; then
2004 echo $my_applicability
2006 # The default is 'main' or 'tests', depending on the module's name.
2008 *-tests) echo "tests";;
2014 # func_get_filelist module
2016 # - local_gnulib_dir from --local-dir
2017 # - modcache true or false, from --cache-modules/--no-cache-modules
2018 func_get_filelist
()
2020 if ! $modcache; then
2021 func_lookup_file
"modules/$1"
2022 sed -n -e "/^Files$sed_extract_prog" < "$lookedup_file"
2024 func_cache_lookup_module
"$1"
2025 # Output the field's value, including the final newline (if any).
2026 if $have_associative; then
2027 if eval 'test -n "${modcache_files[$1]+set}"'; then
2028 eval 'echo "${modcache_files[$1]}"'
2031 eval "field_set=\"\$${cachevar}_files_set\""
2032 if test -n "$field_set"; then
2033 eval "field_value=\"\$${cachevar}_files\""
2034 echo "${field_value}"
2039 echo m
4/gnulib-common.
m4
2040 case "$autoconf_minversion" in
2047 # func_filter_filelist outputvar separator filelist prefix suffix removed_prefix removed_suffix [added_prefix [added_suffix]]
2048 # stores in outputvar the filtered and processed filelist. Filtering: Only the
2049 # elements starting with prefix and ending with suffix are considered.
2050 # Processing: removed_prefix and removed_suffix are removed from each element,
2051 # added_prefix and added_suffix are added to each element.
2052 # prefix, suffix should not contain shell-special characters.
2053 # removed_prefix, removed_suffix should not contain the characters "$`\{}[]^|.
2054 # added_prefix, added_suffix should not contain the characters \|&.
2055 func_filter_filelist
()
2057 if test "$2" != "$nl" \
2058 ||
{ $fast_func_append \
2059 && { test -z "$6" ||
$fast_func_remove_prefix; } \
2060 && { test -z "$7" ||
$fast_func_remove_suffix; }; \
2064 # Do not quote possibly-empty parameters in case patterns,
2065 # AIX and HP-UX ksh won't match them if they are empty.
2068 if test -n "$6"; then
2069 func_remove_prefix fff
"$6"
2071 if test -n "$7"; then
2072 func_remove_suffix fff
"$7"
2075 if test -z "$ffflist"; then
2078 func_append ffflist
"$2${fff}"
2084 sed_fff_filter
="s|^$6\(.*\)$7\$|$8\\1$9|"
2085 ffflist
=`for fff in $3; do
2087 $4*$5) echo "$fff" ;;
2089 done | sed -e "$sed_fff_filter"`
2091 eval "$1=\"\$ffflist\""
2094 # func_get_dependencies module
2096 # - local_gnulib_dir from --local-dir
2097 # - modcache true or false, from --cache-modules/--no-cache-modules
2098 func_get_dependencies
()
2100 # ${module}-tests implicitly depends on ${module}, if that module exists.
2104 func_remove_suffix fgd1
'-tests'
2105 if func_exists_module
"$fgd1"; then
2110 # Then the explicit dependencies listed in the module description.
2111 { if ! $modcache; then
2112 func_lookup_file
"modules/$1"
2113 sed -n -e "/^Depends-on$sed_extract_prog" < "$lookedup_file"
2115 func_cache_lookup_module
"$1"
2116 # Output the field's value, including the final newline (if any).
2117 if $have_associative; then
2118 if eval 'test -n "${modcache_dependson[$1]+set}"'; then
2119 eval 'echo "${modcache_dependson[$1]}"'
2122 eval "field_set=\"\$${cachevar}_dependson_set\""
2123 if test -n "$field_set"; then
2124 eval "field_value=\"\$${cachevar}_dependson\""
2125 echo "${field_value}"
2133 # func_get_autoconf_early_snippet module
2135 # - local_gnulib_dir from --local-dir
2136 # - modcache true or false, from --cache-modules/--no-cache-modules
2137 func_get_autoconf_early_snippet
()
2139 if ! $modcache; then
2140 func_lookup_file
"modules/$1"
2141 sed -n -e "/^configure\.ac-early$sed_extract_prog" < "$lookedup_file"
2143 func_cache_lookup_module
"$1"
2144 # Output the field's value, including the final newline (if any).
2145 if $have_associative; then
2146 if eval 'test -n "${modcache_configureac_early[$1]+set}"'; then
2147 eval 'echo "${modcache_configureac_early[$1]}"'
2150 eval "field_set=\"\$${cachevar}_configureac_early_set\""
2151 if test -n "$field_set"; then
2152 eval "field_value=\"\$${cachevar}_configureac_early\""
2153 echo "${field_value}"
2159 # func_get_autoconf_snippet module
2161 # - local_gnulib_dir from --local-dir
2162 # - modcache true or false, from --cache-modules/--no-cache-modules
2163 func_get_autoconf_snippet
()
2165 if ! $modcache; then
2166 func_lookup_file
"modules/$1"
2167 sed -n -e "/^configure\.ac$sed_extract_prog" < "$lookedup_file"
2169 func_cache_lookup_module
"$1"
2170 # Output the field's value, including the final newline (if any).
2171 if $have_associative; then
2172 if eval 'test -n "${modcache_configureac[$1]+set}"'; then
2173 eval 'echo "${modcache_configureac[$1]}"'
2176 eval "field_set=\"\$${cachevar}_configureac_set\""
2177 if test -n "$field_set"; then
2178 eval "field_value=\"\$${cachevar}_configureac\""
2179 echo "${field_value}"
2185 # func_get_automake_snippet_conditional module
2186 # returns the part of the Makefile.am snippet that can be put inside Automake
2189 # - local_gnulib_dir from --local-dir
2190 # - modcache true or false, from --cache-modules/--no-cache-modules
2191 func_get_automake_snippet_conditional
()
2193 if ! $modcache; then
2194 func_lookup_file
"modules/$1"
2195 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
2197 func_cache_lookup_module
"$1"
2198 # Output the field's value, including the final newline (if any).
2199 if $have_associative; then
2200 if eval 'test -n "${modcache_makefile[$1]+set}"'; then
2201 eval 'echo "${modcache_makefile[$1]}"'
2204 eval "field_set=\"\$${cachevar}_makefile_set\""
2205 if test -n "$field_set"; then
2206 eval "field_value=\"\$${cachevar}_makefile\""
2207 echo "${field_value}"
2213 # func_get_automake_snippet_unconditional module
2214 # returns the part of the Makefile.am snippet that must stay outside of
2215 # Automake conditionals.
2217 # - local_gnulib_dir from --local-dir
2218 # - modcache true or false, from --cache-modules/--no-cache-modules
2219 func_get_automake_snippet_unconditional
()
2223 # *-tests module live in tests/, not lib/.
2224 # Synthesize an EXTRA_DIST augmentation.
2225 all_files
=`func_get_filelist $1`
2226 func_filter_filelist tests_files
" " "$all_files" 'tests/' '' 'tests/' ''
2227 extra_files
="$tests_files"
2228 if test -n "$extra_files"; then
2229 echo "EXTRA_DIST +=" $extra_files
2234 # Synthesize an EXTRA_DIST augmentation.
2235 sed_combine_lines
='/\\$/{
2242 sed_extract_mentioned_files
='s/^lib_SOURCES[ ]*+=[ ]*//p'
2243 already_mentioned_files
=` \
2244 { if ! $modcache; then
2245 func_lookup_file "modules/$1"
2246 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
2248 func_cache_lookup_module "$1"
2249 if $have_associative; then
2250 if eval 'test -n "${modcache_makefile[$1]+set}"'; then
2251 eval 'echo "${modcache_makefile[$1]}"'
2254 eval 'field_set="$'"${cachevar}"'_makefile_set"'
2255 if test -n "$field_set"; then
2256 eval 'field_value="$'"${cachevar}"'_makefile"'
2257 echo "${field_value}"
2262 | sed -e "$sed_combine_lines" \
2263 | sed -n -e "$sed_extract_mentioned_files" | sed -e 's/#.*//'`
2264 all_files
=`func_get_filelist $1`
2265 func_filter_filelist lib_files
"$nl" "$all_files" 'lib/' '' 'lib/' ''
2266 # Remove $already_mentioned_files from $lib_files.
2267 echo "$lib_files" | LC_ALL
=C
sort -u > "$tmp"/lib-files
2268 extra_files
=`for f in $already_mentioned_files; do echo $f; done \
2269 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/lib-files`
2270 if test -n "$extra_files"; then
2271 echo "EXTRA_DIST +=" $extra_files
2274 # Synthesize also an EXTRA_lib_SOURCES augmentation.
2275 # This is necessary so that automake can generate the right list of
2277 # A possible approach would be to use autom4te --trace of the redefined
2278 # AC_LIBOBJ and AC_REPLACE_FUNCS macros when creating the Makefile.am
2279 # (use autom4te --trace, not just grep, so that AC_LIBOBJ invocations
2280 # inside autoconf's built-in macros are not missed).
2281 # But it's simpler and more robust to do it here, based on the file list.
2282 # If some .c file exists and is not used with AC_LIBOBJ - for example,
2283 # a .c file is preprocessed into another .c file for BUILT_SOURCES -,
2284 # automake will generate a useless dependency; this is harmless.
2286 relocatable-prog-wrapper
) ;;
2289 func_filter_filelist extra_files
"$nl" "$extra_files" '' '.c' '' ''
2290 if test -n "$extra_files"; then
2291 echo "EXTRA_lib_SOURCES +=" $extra_files
2296 # Synthesize an EXTRA_DIST augmentation also for the files in build-aux/.
2297 func_filter_filelist buildaux_files
"$nl" "$all_files" 'build-aux/' '' 'build-aux/' ''
2298 if test -n "$buildaux_files"; then
2299 sed_prepend_auxdir
='s,^,$(top_srcdir)/'"$auxdir"'/,'
2300 echo "EXTRA_DIST += "`echo "$buildaux_files" | sed -e "$sed_prepend_auxdir"`
2303 # Synthesize an EXTRA_DIST augmentation also for the files from top/.
2304 func_filter_filelist top_files
"$nl" "$all_files" 'top/' '' 'top/' ''
2305 if test -n "$top_files"; then
2306 sed_prepend_topdir
='s,^,$(top_srcdir)/,'
2307 echo "EXTRA_DIST += "`echo "$top_files" | sed -e "$sed_prepend_topdir"`
2314 # func_get_automake_snippet module
2316 # - local_gnulib_dir from --local-dir
2317 # - modcache true or false, from --cache-modules/--no-cache-modules
2318 func_get_automake_snippet
()
2320 func_get_automake_snippet_conditional
"$1"
2321 func_get_automake_snippet_unconditional
"$1"
2324 # func_get_include_directive module
2326 # - local_gnulib_dir from --local-dir
2327 # - modcache true or false, from --cache-modules/--no-cache-modules
2328 func_get_include_directive
()
2331 if ! $modcache; then
2332 func_lookup_file
"modules/$1"
2333 sed -n -e "/^Include$sed_extract_prog" < "$lookedup_file"
2335 func_cache_lookup_module
"$1"
2336 # Output the field's value, including the final newline (if any).
2337 if $have_associative; then
2338 if eval 'test -n "${modcache_include[$1]+set}"'; then
2339 eval 'echo "${modcache_include[$1]}"'
2342 eval "field_set=\"\$${cachevar}_include_set\""
2343 if test -n "$field_set"; then
2344 eval "field_value=\"\$${cachevar}_include\""
2345 echo "${field_value}"
2349 } |
sed -e 's/^\(["<]\)/#include \1/'
2352 # func_get_link_directive module
2354 # - local_gnulib_dir from --local-dir
2355 # - modcache true or false, from --cache-modules/--no-cache-modules
2356 func_get_link_directive
()
2358 if ! $modcache; then
2359 func_lookup_file
"modules/$1"
2360 sed -n -e "/^Link$sed_extract_prog" < "$lookedup_file"
2362 func_cache_lookup_module
"$1"
2363 # Output the field's value, including the final newline (if any).
2364 if $have_associative; then
2365 if eval 'test -n "${modcache_link[$1]+set}"'; then
2366 eval 'echo "${modcache_link[$1]}"'
2369 eval "field_set=\"\$${cachevar}_link_set\""
2370 if test -n "$field_set"; then
2371 eval "field_value=\"\$${cachevar}_link\""
2372 echo "${field_value}"
2378 # func_get_license module
2380 # - local_gnulib_dir from --local-dir
2381 # - modcache true or false, from --cache-modules/--no-cache-modules
2385 if ! $modcache; then
2386 func_lookup_file
"modules/$1"
2387 sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
2389 func_cache_lookup_module
"$1"
2390 # Output the field's value, including the final newline (if any).
2391 if $have_associative; then
2392 if eval 'test -n "${modcache_license[$1]+set}"'; then
2393 eval 'echo "${modcache_license[$1]}"'
2396 eval "field_set=\"\$${cachevar}_license_set\""
2397 if test -n "$field_set"; then
2398 eval "field_value=\"\$${cachevar}_license\""
2399 echo "${field_value}"
2403 # The default is GPL.
2405 } |
sed -e 's,^ *$,,' |
sed -e 1q
2408 # func_get_maintainer module
2410 # - local_gnulib_dir from --local-dir
2411 # - modcache true or false, from --cache-modules/--no-cache-modules
2412 func_get_maintainer
()
2414 if ! $modcache; then
2415 func_lookup_file
"modules/$1"
2416 sed -n -e "/^Maintainer$sed_extract_prog" < "$lookedup_file"
2418 func_cache_lookup_module
"$1"
2419 # Output the field's value, including the final newline (if any).
2420 if $have_associative; then
2421 if eval 'test -n "${modcache_maintainer[$1]+set}"'; then
2422 eval 'echo "${modcache_maintainer[$1]}"'
2425 eval "field_set=\"\$${cachevar}_maintainer_set\""
2426 if test -n "$field_set"; then
2427 eval "field_value=\"\$${cachevar}_maintainer\""
2428 echo "${field_value}"
2434 # func_get_tests_module module
2436 # - local_gnulib_dir from --local-dir
2437 func_get_tests_module
()
2439 # The naming convention for tests modules is hardwired: ${module}-tests.
2440 if test -f "$gnulib_dir/modules/$1"-tests \
2441 ||
{ test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules" \
2442 && test -f "$local_gnulib_dir/modules/$1"-tests; }; then
2447 # func_acceptable module
2448 # tests whether a module is acceptable.
2450 # - avoidlist list of modules to avoid
2453 for avoid
in $avoidlist; do
2454 if test "$avoid" = "$1"; then
2461 # sed expression to keep the first 32 characters of each line.
2462 sed_first_32_chars
='s/^\(................................\).*/\1/'
2464 # func_module_shellfunc_name module
2465 # computes the shell function name that will contain the m4 macros for the module.
2467 # - macro_prefix prefix to use
2469 # - shellfunc shell function name
2470 func_module_shellfunc_name
()
2474 shellfunc
=func_
${macro_prefix}_gnulib_m4code_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2476 shellfunc
=func_
${macro_prefix}_gnulib_m4code_
$1 ;;
2480 # func_module_shellvar_name module
2481 # computes the shell variable name the will be set to true once the m4 macros
2482 # for the module have been executed.
2484 # - shellvar shell variable name
2485 func_module_shellvar_name
()
2489 shellvar
=${macro_prefix}_gnulib_enabled_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2491 shellvar
=${macro_prefix}_gnulib_enabled_
$1 ;;
2495 # func_module_conditional_name module
2496 # computes the automake conditional name for the module.
2498 # - conditional name of automake conditional
2499 func_module_conditional_name
()
2503 conditional
=${macro_prefix}_GNULIB_ENABLED_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2505 conditional
=${macro_prefix}_GNULIB_ENABLED_
$1 ;;
2509 # func_uncond_add_module B
2510 # notes the presence of B as an unconditional module.
2512 # func_conddep_add_module A B cond
2513 # notes the presence of a conditional dependency from module A to module B,
2514 # subject to the condition that A is enabled and cond is true.
2516 # func_cond_module_p B
2517 # tests whether module B is conditional.
2519 # func_cond_module_condition A B
2520 # returns the condition when B should be enabled as a dependency of A, once the
2521 # m4 code for A has been executed.
2522 # Output: - condition
2524 if $have_associative; then
2525 declare -A conddep_isuncond
2526 declare -A conddep_dependers
2527 declare -A conddep_condition
2528 func_uncond_add_module
()
2530 eval 'conddep_isuncond[$1]=true'
2531 eval 'unset conddep_dependers[$1]'
2533 func_conddep_add_module
()
2535 eval 'isuncond="${conddep_isuncond[$2]}"'
2536 if test -z "$isuncond"; then
2537 # No unconditional dependency to B known at this point.
2538 eval 'conddep_dependers[$2]="${conddep_dependers[$2]} $1"'
2539 eval 'conddep_condition[$1---$2]="$3"'
2542 func_cond_module_p
()
2544 eval 'previous_dependers="${conddep_dependers[$1]}"'
2545 test -n "$previous_dependers"
2547 func_cond_module_condition
()
2549 eval 'condition="${conddep_condition[$1---$2]}"'
2552 func_uncond_add_module
()
2556 suffix
=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2560 eval 'conddep_isuncond_'"$suffix"'=true'
2561 eval 'unset conddep_dependers_'"$suffix"
2563 func_conddep_add_module
()
2567 suffix
=`echo "$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2571 eval 'isuncond="${conddep_isuncond_'"$suffix"'}"'
2572 if test -z "$isuncond"; then
2573 eval 'conddep_dependers_'"$suffix"'="${conddep_dependers_'"$suffix"'} $1"'
2574 suffix
=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
2575 eval 'conddep_condition_'"$suffix"'="$3"'
2578 func_cond_module_p
()
2582 suffix
=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2586 eval 'previous_dependers="${conddep_dependers_'"$suffix"'}"'
2587 test -n "$previous_dependers"
2589 func_cond_module_condition
()
2591 suffix
=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
2592 eval 'condition="${conddep_condition_'"$suffix"'}"'
2596 sed_dependencies_without_conditions
='s/ *\[.*//'
2598 # func_modules_transitive_closure
2600 # - local_gnulib_dir from --local-dir
2601 # - modcache true or false, from --cache-modules/--no-cache-modules
2602 # - modules list of specified modules
2603 # - inctests true if tests should be included, blank otherwise
2604 # - incobsolete true if obsolete modules among dependencies should be
2605 # included, blank otherwise
2606 # - inc_cxx_tests true if C++ interoperability tests should be included,
2608 # - inc_longrunning_tests true if long-runnings tests should be included,
2610 # - inc_privileged_tests true if tests that require root privileges should be
2611 # included, blank otherwise
2612 # - inc_unportable_tests true if tests that fail on some platforms should be
2613 # included, blank otherwise
2614 # - inc_all_direct_tests true if all kinds of problematic unit tests among
2615 # the unit tests of the specified modules should be
2616 # included, blank otherwise
2617 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
2618 # the unit tests of the dependencies should be
2619 # included, blank otherwise
2620 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
2622 # - excl_longrunning_tests true if long-runnings tests should be excluded,
2624 # - excl_privileged_tests true if tests that require root privileges should be
2625 # excluded, blank otherwise
2626 # - excl_unportable_tests true if tests that fail on some platforms should be
2627 # excluded, blank otherwise
2628 # - avoidlist list of modules to avoid
2629 # - cond_dependencies true if conditional dependencies shall be supported,
2631 # - tmp pathname of a temporary directory
2633 # - modules list of modules, including dependencies
2634 # - conddep_dependers, conddep_condition information about conditionally
2636 func_modules_transitive_closure
()
2638 sed_escape_dependency
='s|\([/.]\)|\\\1|g'
2639 # In order to process every module only once (for speed), process an "input
2640 # list" of modules, producing an "output list" of modules. During each round,
2641 # more modules can be queued in the input list. Once a module on the input
2642 # list has been processed, it is added to the "handled list", so we can avoid
2643 # to process it again.
2645 inmodules
="$modules"
2647 fmtc_inc_all_tests
="$inc_all_direct_tests"
2648 if test "$cond_dependencies" = true
; then
2649 for module
in $inmodules; do
2651 if test -n "$module"; then
2652 if func_acceptable
$module; then
2653 func_uncond_add_module
$module
2658 while test -n "$inmodules"; do
2659 inmodules_this_round
="$inmodules"
2660 inmodules
= # Accumulator, queue for next round
2661 for module
in $inmodules_this_round; do
2663 if test -n "$module"; then
2664 if func_acceptable
$module; then
2665 func_append outmodules
" $module"
2666 if test "$cond_dependencies" = true
; then
2667 if func_get_automake_snippet_conditional
$module |
grep '^if ' > /dev
/null
; then
2668 # A module whose Makefile.am snippet contains a reference to an
2669 # automake conditional. If we were to use it conditionally, we
2670 # would get an error
2671 # configure: error: conditional "..." was never defined.
2672 # because automake 1.11.1 does not handle nested conditionals
2673 # correctly. As a workaround, make the module unconditional.
2674 func_uncond_add_module
$module
2676 if func_cond_module_p
$module; then
2682 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
2683 # Duplicate dependencies are harmless, but Jim wants a warning.
2684 duplicated_deps
=`echo "$deps" | LC_ALL=C sort | LC_ALL=C uniq -d`
2685 if test -n "$duplicated_deps"; then
2686 func_warning
"module $module has duplicated dependencies: "`echo $duplicated_deps`
2688 if test -n "$inctests"; then
2689 testsmodule
=`func_get_tests_module $module`
2690 if test -n "$testsmodule"; then
2691 deps
="$deps $testsmodule"
2694 for dep
in $deps; do
2695 # Determine whether to include the dependency or tests module.
2697 for word
in `func_get_status $dep`; do
2700 test -n "$incobsolete" \
2704 test -z "$excl_cxx_tests" \
2706 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_cxx_tests" \
2710 test -z "$excl_longrunning_tests" \
2712 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_longrunning_tests" \
2716 test -z "$excl_privileged_tests" \
2718 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_privileged_tests" \
2722 test -z "$excl_unportable_tests" \
2724 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_unportable_tests" \
2728 test -n "$fmtc_inc_all_tests" \
2733 if $inc && func_acceptable
"$dep"; then
2734 func_append inmodules
" $dep"
2735 if test "$cond_dependencies" = true
; then
2736 escaped_dep
=`echo "$dep" | sed -e "$sed_escape_dependency"`
2737 sed_extract_condition1
='/^ *'"$escaped_dep"' *$/{
2740 sed_extract_condition2
='/^ *'"$escaped_dep"' *\[.*\] *$/{
2741 s/^ *'"$escaped_dep"' *\[\(.*\)\] *$/\1/p
2743 condition
=`func_get_dependencies $module | sed -n -e "$sed_extract_condition1" -e "$sed_extract_condition2"`
2744 if test "$condition" = true
; then
2747 if test -n "$condition"; then
2748 func_conddep_add_module
"$module" "$dep" "$condition"
2750 if $conditional; then
2751 func_conddep_add_module
"$module" "$dep" true
2753 func_uncond_add_module
"$dep"
2762 handledmodules
=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
2763 # Remove $handledmodules from $inmodules.
2764 for m
in $inmodules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/queued-modules
2765 inmodules
=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
2766 fmtc_inc_all_tests
="$inc_all_indirect_tests"
2768 modules
=`for m in $outmodules; do echo $m; done | LC_ALL=C sort -u`
2769 rm -f "$tmp"/queued-modules
2772 # func_show_module_list
2774 # - specified_modules list of specified modules (one per line, sorted)
2775 # - modules complete list of modules (one per line, sorted)
2776 # - tmp pathname of a temporary directory
2777 func_show_module_list
()
2783 # Assume xterm compatible escape sequences.
2784 bold_on
=`printf '\x1b[1m'`
2785 bold_off
=`printf '\x1b[0m'`
2790 echo "Module list with included dependencies (indented):"
2791 echo "$specified_modules" |
sed -e '/^$/d' -e 's/$/| /' > "$tmp"/specified-modules
2792 echo "$modules" |
sed -e '/^$/d' \
2793 | LC_ALL
=C
join -t '|' -a2 "$tmp"/specified-modules
- \
2794 |
sed -e 's/^\(.*\)|.*/|\1/' -e 's/^/ /' -e 's/^ |\(.*\)$/ '"${bold_on}"'\1'"${bold_off}"'/'
2797 # func_modules_transitive_closure_separately
2798 # Determine main module list and tests-related module list separately.
2799 # The main module list is the transitive closure of the specified modules,
2800 # ignoring tests modules. Its lib/* sources go into $sourcebase/. If --lgpl
2801 # is specified, it will consist only of LGPLed source.
2802 # The tests-related module list is the transitive closure of the specified
2803 # modules, including tests modules, minus the main module list excluding
2804 # modules of applicability 'all'. Its lib/* sources (brought in through
2805 # dependencies of *-tests modules) go into $testsbase/. It may contain GPLed
2806 # source, even if --lgpl is specified.
2808 # - local_gnulib_dir from --local-dir
2809 # - modcache true or false, from --cache-modules/--no-cache-modules
2810 # - specified_modules list of specified modules
2811 # - inctests true if tests should be included, blank otherwise
2812 # - incobsolete true if obsolete modules among dependencies should be
2813 # included, blank otherwise
2814 # - inc_cxx_tests true if C++ interoperability tests should be included,
2816 # - inc_longrunning_tests true if long-runnings tests should be included,
2818 # - inc_privileged_tests true if tests that require root privileges should be
2819 # included, blank otherwise
2820 # - inc_unportable_tests true if tests that fail on some platforms should be
2821 # included, blank otherwise
2822 # - inc_all_direct_tests true if all kinds of problematic unit tests among
2823 # the unit tests of the specified modules should be
2824 # included, blank otherwise
2825 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
2826 # the unit tests of the dependencies should be
2827 # included, blank otherwise
2828 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
2830 # - excl_longrunning_tests true if long-runnings tests should be excluded,
2832 # - excl_privileged_tests true if tests that require root privileges should be
2833 # excluded, blank otherwise
2834 # - excl_unportable_tests true if tests that fail on some platforms should be
2835 # excluded, blank otherwise
2836 # - avoidlist list of modules to avoid
2837 # - cond_dependencies true if conditional dependencies shall be supported,
2839 # - tmp pathname of a temporary directory
2841 # - main_modules list of modules, including dependencies
2842 # - testsrelated_modules list of tests-related modules, including dependencies
2843 # - conddep_dependers, conddep_condition information about conditionally
2845 func_modules_transitive_closure_separately
()
2847 # Determine main module list.
2848 saved_inctests
="$inctests"
2850 modules
="$specified_modules"
2851 func_modules_transitive_closure
2852 main_modules
="$modules"
2853 inctests
="$saved_inctests"
2854 if test $verbose -ge 1; then
2855 echo "Main module list:"
2856 echo "$main_modules" |
sed -e 's/^/ /'
2858 # Determine tests-related module list.
2859 echo "$final_modules" | LC_ALL
=C
sort -u > "$tmp"/final-modules
2860 testsrelated_modules
=`for module in $main_modules; do
2861 if test \`func_get_applicability
$module\
` = main; then
2865 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/final-modules`
2866 if test $verbose -ge 1; then
2867 echo "Tests-related module list:"
2868 echo "$testsrelated_modules" |
sed -e 's/^/ /'
2872 # func_determine_use_libtests
2873 # Determines whether a $testsbase/libtests.a is needed.
2875 # - local_gnulib_dir from --local-dir
2876 # - modcache true or false, from --cache-modules/--no-cache-modules
2877 # - testsrelated_modules list of tests-related modules, including dependencies
2879 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
2880 func_determine_use_libtests
()
2883 for module
in $testsrelated_modules; do
2884 func_verify_nontests_module
2885 if test -n "$module"; then
2886 all_files
=`func_get_filelist $module`
2887 # Test whether some file in $all_files lies in lib/.
2888 for f
in $all_files; do
2900 # func_modules_add_dummy
2902 # - local_gnulib_dir from --local-dir
2903 # - modcache true or false, from --cache-modules/--no-cache-modules
2904 # - modules list of modules, including dependencies
2906 # - modules list of modules, including 'dummy' if needed
2907 func_modules_add_dummy
()
2909 # Determine whether any module provides a lib_SOURCES augmentation.
2911 sed_remove_backslash_newline
=':a
2918 for module
in $modules; do
2919 func_verify_nontests_module
2920 if test -n "$module"; then
2921 # Extract the value of "lib_SOURCES += ...".
2922 for file in `func_get_automake_snippet "$module" | sed -e "$sed_remove_backslash_newline" | sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'`; do
2923 # Ignore .h files since they are not compiled.
2927 have_lib_SOURCES
=yes
2934 # Add the dummy module, to make sure the library will be non-empty.
2935 if test -z "$have_lib_SOURCES"; then
2936 if func_acceptable
"dummy"; then
2937 func_append modules
" dummy"
2942 # func_modules_add_dummy_separately
2944 # - local_gnulib_dir from --local-dir
2945 # - modcache true or false, from --cache-modules/--no-cache-modules
2946 # - main_modules list of modules, including dependencies
2947 # - testsrelated_modules list of tests-related modules, including dependencies
2948 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
2950 # - main_modules list of modules, including 'dummy' if needed
2951 # - testsrelated_modules list of tests-related modules, including 'dummy' if
2953 func_modules_add_dummy_separately
()
2955 # Add the dummy module to the main module list if needed.
2956 modules
="$main_modules"
2957 func_modules_add_dummy
2958 main_modules
="$modules"
2960 # Add the dummy module to the tests-related module list if needed.
2961 if $use_libtests; then
2962 modules
="$testsrelated_modules"
2963 func_modules_add_dummy
2964 testsrelated_modules
="$modules"
2968 # func_modules_notice
2970 # - local_gnulib_dir from --local-dir
2971 # - modcache true or false, from --cache-modules/--no-cache-modules
2972 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
2973 # - modules list of modules, including dependencies
2974 func_modules_notice
()
2976 if test $verbose -ge -1; then
2977 for module
in $modules; do
2979 if test -n "$module"; then
2980 msg
=`func_get_notice $module`
2981 if test -n "$msg"; then
2982 echo "Notice from module $module:"
2983 echo "$msg" |
sed -e 's/^/ /'
2990 # func_modules_to_filelist
2992 # - local_gnulib_dir from --local-dir
2993 # - modcache true or false, from --cache-modules/--no-cache-modules
2994 # - modules list of modules, including dependencies
2996 # - files list of files
2997 func_modules_to_filelist
()
3000 for module
in $modules; do
3002 if test -n "$module"; then
3003 fs
=`func_get_filelist $module`
3004 func_append files
" $fs"
3007 files
=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
3010 # func_modules_to_filelist_separately
3011 # Determine the final file lists.
3012 # They must be computed separately, because files in lib/* go into
3013 # $sourcebase/ if they are in the main file list but into $testsbase/
3014 # if they are in the tests-related file list. Furthermore lib/dummy.c
3017 # - local_gnulib_dir from --local-dir
3018 # - modcache true or false, from --cache-modules/--no-cache-modules
3019 # - main_modules list of modules, including dependencies
3020 # - testsrelated_modules list of tests-related modules, including dependencies
3021 func_modules_to_filelist_separately
()
3023 # Determine final main file list.
3024 modules
="$main_modules"
3025 func_modules_to_filelist
3027 # Determine final tests-related file list.
3028 modules
="$testsrelated_modules"
3029 func_modules_to_filelist
3030 testsrelated_files
=`echo "$files" | sed -e 's,^lib/,tests=lib/,'`
3031 # Merge both file lists.
3032 sed_remove_empty_lines
='/^$/d'
3033 files
=`{ echo "$main_files"; echo "$testsrelated_files"; } | sed -e "$sed_remove_empty_lines" | LC_ALL=C sort -u`
3034 if test $verbose -ge 0; then
3036 sed_prettyprint_files
='s,^tests=lib/\(.*\)$,lib/\1 -> tests/\1,'
3037 echo "$files" |
sed -e "$sed_prettyprint_files" -e 's/^/ /'
3041 # func_compute_include_guard_prefix
3042 # Determine include_guard_prefix.
3044 # - macro_prefix prefix of gl_LIBOBJS macros to use
3046 # - include_guard_prefix replacement for ${gl_include_guard_prefix}
3047 # - sed_replace_include_guard_prefix
3048 # sed expression for resolving ${gl_include_guard_prefix}
3049 func_compute_include_guard_prefix
()
3051 if test "$macro_prefix" = gl
; then
3052 include_guard_prefix
='GL'
3054 include_guard_prefix
='GL_'`echo "$macro_prefix" | LC_ALL=C tr '[a-z]' '[A-Z]'`
3056 sed_replace_include_guard_prefix
='s/\${gl_include_guard_prefix}/'"${include_guard_prefix}"'/g'
3059 # func_execute_command command [args...]
3060 # Executes a command.
3061 # Uses also the variables
3062 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
3063 func_execute_command
()
3065 if test $verbose -ge 0; then
3069 # Commands like automake produce output to stderr even when they succeed.
3070 # Turn this output off if the command succeeds.
3071 "$@" > "$tmp"/cmdout
2>&1
3073 if test $cmdret = 0; then
3077 cat "$tmp"/cmdout
1>&2
3084 # func_dest_tmpfilename file
3085 # determines the name of a temporary file (file is relative to destdir).
3087 # - destdir target directory
3088 # - doit : if actions shall be executed, false if only to be printed
3089 # - tmp pathname of a temporary directory
3091 # - tmpfile absolute filename of the temporary file
3092 func_dest_tmpfilename
()
3095 # Put the new contents of $file in a file in the same directory (needed
3096 # to guarantee that an 'mv' to "$destdir/$file" works).
3097 tmpfile
="$destdir/$1.tmp"
3099 # Put the new contents of $file in a file in a temporary directory
3100 # (because the directory of "$file" might not exist).
3101 tmpfile
="$tmp"/`basename "$1"`.tmp
3106 # copies a file from gnulib into the destination directory. The destination
3107 # is known to not exist.
3109 # - destdir target directory
3110 # - local_gnulib_dir from --local-dir
3111 # - modcache true or false, from --cache-modules/--no-cache-modules
3112 # - f the original file name
3113 # - lookedup_file name of the merged (combined) file
3114 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
3115 # - g the rewritten file name
3116 # - tmpfile absolute filename of the temporary file
3117 # - doit : if actions shall be executed, false if only to be printed
3118 # - symbolic true if files should be symlinked, copied otherwise
3119 # - lsymbolic true if files from local_gnulib_dir should be symlinked,
3124 echo "Copying file $g"
3125 if { test -n "$symbolic" \
3126 ||
{ test -n "$lsymbolic" \
3127 && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; } \
3128 && test -z "$lookedup_tmp" \
3129 && cmp "$lookedup_file" "$tmpfile" > /dev
/null
; then
3130 func_ln_if_changed
"$lookedup_file" "$destdir/$g"
3132 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error
"failed"
3140 # copies a file from gnulib into the destination directory. The destination
3141 # is known to exist.
3143 # - destdir target directory
3144 # - local_gnulib_dir from --local-dir
3145 # - modcache true or false, from --cache-modules/--no-cache-modules
3146 # - f the original file name
3147 # - lookedup_file name of the merged (combined) file
3148 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
3149 # - g the rewritten file name
3150 # - tmpfile absolute filename of the temporary file
3151 # - doit : if actions shall be executed, false if only to be printed
3152 # - symbolic true if files should be symlinked, copied otherwise
3153 # - lsymbolic true if files from local_gnulib_dir should be symlinked,
3155 # - already_present nonempty if the file should already exist, empty otherwise
3158 if cmp "$destdir/$g" "$tmpfile" > /dev
/null
; then
3159 : # The file has not changed.
3163 if test -n "$already_present"; then
3164 echo "Updating file $g (backup in ${g}~)"
3166 echo "Replacing file $g (non-gnulib code backed up in ${g}~) !!"
3168 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error
"failed"
3169 if { test -n "$symbolic" \
3170 ||
{ test -n "$lsymbolic" \
3171 && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; } \
3172 && test -z "$lookedup_tmp" \
3173 && cmp "$lookedup_file" "$tmpfile" > /dev
/null
; then
3174 func_ln_if_changed
"$lookedup_file" "$destdir/$g"
3176 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error
"failed"
3179 if test -n "$already_present"; then
3180 echo "Update file $g (backup in ${g}~)"
3182 echo "Replace file $g (non-gnulib code backed up in ${g}~) !!"
3188 # func_emit_lib_Makefile_am
3189 # emits the contents of library makefile to standard output.
3191 # - local_gnulib_dir from --local-dir
3192 # - modcache true or false, from --cache-modules/--no-cache-modules
3193 # - modules list of modules, including dependencies
3194 # - libname library name
3195 # - pobase directory relative to destdir where to place *.po files
3196 # - auxdir directory relative to destdir where to place build aux files
3197 # - makefile_name from --makefile-name
3198 # - libtool true if libtool will be used, false or blank otherwise
3199 # - macro_prefix prefix of gl_LIBOBJS macros to use
3200 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
3201 # - witness_c_macro from --witness-c-macro
3202 # - actioncmd (optional) command that will reproduce this invocation
3203 # - for_test true if creating a package for testing, false otherwise
3204 # - sed_replace_include_guard_prefix
3205 # sed expression for resolving ${gl_include_guard_prefix}
3206 # - destfile filename relative to destdir of makefile being generated
3208 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val}
3209 # list of edits to be done to Makefile.am variables
3211 # - uses_subdirs nonempty if object files in subdirs exist
3212 func_emit_lib_Makefile_am
()
3214 # When creating an includable Makefile.am snippet, augment variables with
3215 # += instead of assigning them.
3216 if test -n "$makefile_name"; then
3221 if test "$libtool" = true
; then
3224 sed_eliminate_LDFLAGS
="$sed_noop"
3228 sed_eliminate_LDFLAGS
='/^lib_LDFLAGS[ ]*+=/d'
3231 # When creating a package for testing: Attempt to provoke failures,
3232 # especially link errors, already during "make" rather than during
3233 # "make check", because "make check" is not possible in a cross-compiling
3234 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
3235 sed_transform_check_PROGRAMS
='s,check_PROGRAMS,noinst_PROGRAMS,g'
3237 sed_transform_check_PROGRAMS
="$sed_noop"
3239 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3240 echo "## Process this file with automake to produce Makefile.in."
3241 func_emit_copyright_notice
3242 if test -n "$actioncmd"; then
3243 # The maximum line length (excluding the terminating newline) of any file
3244 # that is to be preprocessed by config.status is 3070. config.status uses
3245 # awk, and the HP-UX 11.00 awk fails if a line has length >= 3071;
3246 # similarly, the IRIX 6.5 awk fails if a line has length >= 3072.
3247 len
=`echo "$actioncmd" | wc -c`
3248 if test -n "$len" && test "$len" -le 3000; then
3249 echo "# Reproduce by: $actioncmd"
3255 for module
in $modules; do
3256 func_verify_nontests_module
3257 if test -n "$module"; then
3259 func_get_automake_snippet_conditional
"$module" |
3261 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
3262 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
3263 -e "$sed_eliminate_LDFLAGS" \
3264 -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' \
3265 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
3266 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
3267 -e "$sed_transform_check_PROGRAMS" \
3268 -e "$sed_replace_include_guard_prefix"
3269 if test "$module" = 'alloca'; then
3270 echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
3271 echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@"
3273 } > "$tmp"/amsnippet1
3275 func_get_automake_snippet_unconditional
"$module" |
3276 LC_ALL
=C
sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g'
3277 } > "$tmp"/amsnippet2
3278 # Skip the contents if it's entirely empty.
3279 if grep '[^ ]' "$tmp"/amsnippet1
"$tmp"/amsnippet2
> /dev
/null
; then
3280 echo "## begin gnulib module $module"
3282 if test "$cond_dependencies" = true
; then
3283 if func_cond_module_p
"$module"; then
3284 func_module_conditional_name
"$module"
3285 echo "if $conditional"
3288 cat "$tmp"/amsnippet1
3289 if test "$cond_dependencies" = true
; then
3290 if func_cond_module_p
"$module"; then
3294 cat "$tmp"/amsnippet2
3295 echo "## end gnulib module $module"
3298 rm -f "$tmp"/amsnippet1
"$tmp"/amsnippet2
3299 # Test whether there are some source files in subdirectories.
3300 for f
in `func_get_filelist "$module"`; do
3310 } > "$tmp"/allsnippets
3311 if test -z "$makefile_name"; then
3312 # If there are source files in subdirectories, prevent collision of the
3313 # object files (example: hash.c and libxml/hash.c).
3315 if test -n "$uses_subdirs"; then
3316 subdir_options
=' subdir-objects'
3318 echo "AUTOMAKE_OPTIONS = 1.5 gnits${subdir_options}"
3321 if test -z "$makefile_name"; then
3323 echo "noinst_HEADERS ="
3324 echo "noinst_LIBRARIES ="
3325 echo "noinst_LTLIBRARIES ="
3326 # Automake versions < 1.9b create an empty pkgdatadir at installation time
3327 # if you specify pkgdata_DATA to empty. This is a workaround.
3328 if grep '^pkgdata_DATA *+=' "$tmp"/allsnippets
> /dev
/null
; then
3329 echo "pkgdata_DATA ="
3332 echo "BUILT_SOURCES ="
3335 echo "MOSTLYCLEANFILES $assign core *.stackdump"
3336 if test -z "$makefile_name"; then
3337 echo "MOSTLYCLEANDIRS ="
3339 echo "DISTCLEANFILES ="
3340 echo "MAINTAINERCLEANFILES ="
3342 # Execute edits that apply to the Makefile.am being generated.
3344 while test $edit != $makefile_am_edits; do
3345 edit
=`expr $edit + 1`
3346 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
3347 eval var
=\"\
$makefile_am_edit${edit}_var
\"
3348 eval val
=\"\
$makefile_am_edit${edit}_val
\"
3349 if test -n "$var"; then
3350 if test "${dir}Makefile.am" = "$destfile" ||
test "./${dir}Makefile.am" = "$destfile"; then
3351 echo "${var} += ${val}"
3352 eval "makefile_am_edit${edit}_var="
3356 if test -n "$witness_c_macro"; then
3357 cppflags_part1
=" -D$witness_c_macro=1"
3362 cppflags_part2
=" -DGNULIB_STRICT_CHECKING=1"
3366 if test -z "$makefile_name"; then
3368 echo "AM_CPPFLAGS =$cppflags_part1$cppflags_part2"
3371 if test -n "$cppflags_part1$cppflags_part2"; then
3373 echo "AM_CPPFLAGS +=$cppflags_part1$cppflags_part2"
3377 if LC_ALL
=C
grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$tmp"/allsnippets
> /dev
/null \
3378 ||
{ test -n "$makefile_name" \
3379 && test -f "$sourcebase/Makefile.am" \
3380 && LC_ALL
=C
grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$sourcebase/Makefile.am" > /dev
/null
; \
3382 # One of the snippets or the user's Makefile.am already specifies an
3383 # installation location for the library. Don't confuse automake by saying
3384 # it should not be installed.
3387 # By default, the generated library should not be installed.
3388 echo "noinst_${perhapsLT}LIBRARIES += $libname.$libext"
3391 echo "${libname}_${libext}_SOURCES ="
3392 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
3393 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
3394 echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
3395 echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
3396 echo "EXTRA_${libname}_${libext}_SOURCES ="
3397 if test "$libtool" = true
; then
3398 echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)"
3399 echo "${libname}_${libext}_LDFLAGS += -no-undefined"
3400 # Synthesize an ${libname}_${libext}_LDFLAGS augmentation by combining
3401 # the link dependencies of all modules.
3402 for module
in $modules; do
3403 func_verify_nontests_module
3404 if test -n "$module"; then
3405 func_get_link_directive
"$module"
3408 | LC_ALL
=C
sed -e '/^$/d' -e 's/ when linking with libtool.*//' \
3409 | LC_ALL
=C
sort -u \
3410 | LC_ALL
=C
sed -e 's/^/'"${libname}_${libext}"'_LDFLAGS += /'
3413 if test -n "$pobase"; then
3414 echo "AM_CPPFLAGS += -DDEFAULT_TEXT_DOMAIN=\\\"${po_domain}-gnulib\\\""
3417 cat "$tmp"/allsnippets \
3418 |
sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
3420 echo "mostlyclean-local: mostlyclean-generic"
3421 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
3422 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
3423 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
3427 rm -f "$tmp"/allsnippets
3430 # func_emit_po_Makevars
3431 # emits the contents of po/ makefile parameterization to standard output.
3433 # - local_gnulib_dir from --local-dir
3434 # - modcache true or false, from --cache-modules/--no-cache-modules
3435 # - sourcebase directory relative to destdir where to place source code
3436 # - pobase directory relative to destdir where to place *.po files
3437 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
3438 func_emit_po_Makevars
()
3440 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3441 func_emit_copyright_notice
3443 echo "# Usually the message domain is the same as the package name."
3444 echo "# But here it has a '-gnulib' suffix."
3445 echo "DOMAIN = ${po_domain}-gnulib"
3447 echo "# These two variables depend on the location of this directory."
3448 echo "subdir = ${pobase}"
3449 echo "top_builddir = "`echo "$pobase" | sed -e 's,//*,/,g' -e 's,[^/][^/]*,..,g'`
3452 # These options get passed to xgettext.
3453 XGETTEXT_OPTIONS
= \
3454 --keyword=_
--flag=_
:1:pass-c-format \
3455 --keyword=N_
--flag=N_
:1:pass-c-format \
3456 --keyword='proper_name:1,"This is a proper name. See the gettext manual, section Names."' \
3457 --keyword='proper_name_utf8:1,"This is a proper name. See the gettext manual, section Names."' \
3458 --flag=error
:3:c-format
--flag=error_at_line
:5:c-format
3460 # This is the copyright holder that gets inserted into the header of the
3461 # $(DOMAIN).pot file. gnulib is copyrighted by the FSF.
3462 COPYRIGHT_HOLDER
= Free Software Foundation
, Inc.
3464 # This is the email address or URL to which the translators shall report
3465 # bugs in the untranslated strings:
3466 # - Strings which are not entire sentences, see the maintainer guidelines
3467 # in the GNU gettext documentation, section 'Preparing Strings'.
3468 # - Strings which use unclear terms or require additional context to be
3470 # - Strings which make invalid assumptions about notation of date, time or
3472 # - Pluralisation problems.
3473 # - Incorrect English spelling.
3474 # - Incorrect formatting.
3475 # It can be your email address, or a mailing list address where translators
3476 # can write to without being subscribed, or the URL of a web page through
3477 # which the translators can contact you.
3478 MSGID_BUGS_ADDRESS
= bug-gnulib@gnu.org
3480 # This is the list of locale categories, beyond LC_MESSAGES, for which the
3481 # message catalogs shall be used. It is usually empty.
3482 EXTRA_LOCALE_CATEGORIES
=
3484 # This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
3485 # context. Possible values are "yes" and "no". Set this to yes if the
3486 # package uses functions taking also a message context, like pgettext(), or
3487 # if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
3492 # func_emit_po_POTFILES_in
3493 # emits the file list to be passed to xgettext to standard output.
3495 # - local_gnulib_dir from --local-dir
3496 # - modcache true or false, from --cache-modules/--no-cache-modules
3497 # - sourcebase directory relative to destdir where to place source code
3498 # - files list of new files
3499 func_emit_po_POTFILES_in
()
3501 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3502 func_emit_copyright_notice
3504 echo "# List of files which contain translatable strings."
3505 echo "$files" |
sed -n -e "s,^lib/,$sourcebase/,p"
3508 # func_emit_tests_Makefile_am witness_macro
3509 # emits the contents of tests makefile to standard output.
3511 # - local_gnulib_dir from --local-dir
3512 # - modcache true or false, from --cache-modules/--no-cache-modules
3513 # - modules list of modules, including dependencies
3514 # - libname library name
3515 # - auxdir directory relative to destdir where to place build aux files
3516 # - makefile_name from --makefile-name
3517 # - libtool true if libtool will be used, false or blank otherwise
3518 # - sourcebase relative directory containing lib source code
3519 # - m4base relative directory containing autoconf macros
3520 # - testsbase relative directory containing unit test code
3521 # - macro_prefix prefix of gl_LIBOBJS macros to use
3522 # - witness_c_macro from --witness-c-macro
3523 # - for_test true if creating a package for testing, false otherwise
3524 # - single_configure true if a single configure file should be generated,
3525 # false for a separate configure file for the tests
3526 # - use_libtests true if a libtests.a should be built, false otherwise
3527 # - sed_replace_include_guard_prefix
3528 # sed expression for resolving ${gl_include_guard_prefix}
3529 # - destfile filename relative to destdir of makefile being generated
3531 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val}
3532 # list of edits to be done to Makefile.am variables
3534 # - uses_subdirs nonempty if object files in subdirs exist
3535 func_emit_tests_Makefile_am
()
3538 if test "$libtool" = true
; then
3540 sed_eliminate_LDFLAGS
="$sed_noop"
3543 sed_eliminate_LDFLAGS
='/^lib_LDFLAGS[ ]*+=/d'
3546 # When creating a package for testing: Attempt to provoke failures,
3547 # especially link errors, already during "make" rather than during
3548 # "make check", because "make check" is not possible in a cross-compiling
3549 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
3550 sed_transform_check_PROGRAMS
='s,check_PROGRAMS,noinst_PROGRAMS,g'
3552 sed_transform_check_PROGRAMS
="$sed_noop"
3554 testsbase_inverse
=`echo "$testsbase" | sed -e 's,/$,,' | sed -e 's,[^/][^/]*,..,g'`
3555 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3556 echo "## Process this file with automake to produce Makefile.in."
3557 func_emit_copyright_notice
3561 for module
in $modules; do
3562 if $for_test && ! $single_configure; then
3563 func_verify_tests_module
3567 if test -n "$module"; then
3569 func_get_automake_snippet
"$module" |
3571 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
3572 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
3573 -e "$sed_eliminate_LDFLAGS" \
3574 -e 's,lib_\([A-Z][A-Z]*\),libtests_a_\1,g' \
3575 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
3576 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
3577 -e "$sed_transform_check_PROGRAMS" \
3578 -e "$sed_replace_include_guard_prefix"
3579 if $use_libtests && test "$module" = 'alloca'; then
3580 echo "libtests_a_LIBADD += @${perhapsLT}ALLOCA@"
3581 echo "libtests_a_DEPENDENCIES += @${perhapsLT}ALLOCA@"
3583 } > "$tmp"/amsnippet
3584 # Skip the contents if it's entirely empty.
3585 if grep '[^ ]' "$tmp"/amsnippet
> /dev
/null
; then
3586 # Mention long-running tests at the end.
3588 for word
in `func_get_status "$module"`; do
3589 if test "$word" = 'longrunning-test'; then
3594 { echo "## begin gnulib module $module"
3596 cat "$tmp"/amsnippet
3597 echo "## end gnulib module $module"
3601 rm -f "$tmp"/amsnippet
3602 # Test whether there are some source files in subdirectories.
3603 for f
in `func_get_filelist "$module"`; do
3605 lib
/*/*.c |
tests
/*/*.c
)
3613 } 3> "$tmp"/main_snippets
4> "$tmp"/longrunning_snippets
3614 # Generate dependencies here, since it eases the debugging of test failures.
3615 # If there are source files in subdirectories, prevent collision of the
3616 # object files (example: hash.c and libxml/hash.c).
3618 if test -n "$uses_subdirs"; then
3619 subdir_options
=' subdir-objects'
3621 echo "AUTOMAKE_OPTIONS = 1.5 foreign${subdir_options}"
3623 if $for_test && ! $single_configure; then
3624 echo "ACLOCAL_AMFLAGS = -I ${testsbase_inverse}/${m4base}"
3627 # Nothing is being added to SUBDIRS; nevertheless the existence of this
3628 # variable is needed to avoid an error from automake:
3629 # "AM_GNU_GETTEXT used but SUBDIRS not defined"
3632 echo "XFAIL_TESTS ="
3633 echo "TESTS_ENVIRONMENT ="
3634 echo "noinst_PROGRAMS ="
3635 if ! $for_test; then
3636 echo "check_PROGRAMS ="
3638 echo "noinst_HEADERS ="
3639 echo "noinst_LIBRARIES ="
3640 if $use_libtests; then
3642 echo "noinst_LIBRARIES += libtests.a"
3644 echo "check_LIBRARIES = libtests.a"
3647 # Automake versions < 1.9b create an empty pkgdatadir at installation time
3648 # if you specify pkgdata_DATA to empty. This is a workaround.
3649 if grep '^pkgdata_DATA *+=' "$tmp"/main_snippets
"$tmp"/longrunning_snippets
> /dev
/null
; then
3650 echo "pkgdata_DATA ="
3653 echo "BUILT_SOURCES ="
3655 echo "MOSTLYCLEANFILES = core *.stackdump"
3656 echo "MOSTLYCLEANDIRS ="
3658 echo "DISTCLEANFILES ="
3659 echo "MAINTAINERCLEANFILES ="
3660 # Execute edits that apply to the Makefile.am being generated.
3662 while test $edit != $makefile_am_edits; do
3663 edit
=`expr $edit + 1`
3664 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
3665 eval var
=\"\
$makefile_am_edit${edit}_var
\"
3666 eval val
=\"\
$makefile_am_edit${edit}_val
\"
3667 if test -n "$var"; then
3668 if test "${dir}Makefile.am" = "$destfile" ||
test "./${dir}Makefile.am" = "$destfile"; then
3669 echo "${var} += ${val}"
3670 eval "makefile_am_edit${edit}_var="
3675 echo "AM_CPPFLAGS = \\"
3677 echo " -DGNULIB_STRICT_CHECKING=1 \\"
3679 if test -n "$witness_c_macro"; then
3680 echo " -D$witness_c_macro=1 \\"
3682 if test -n "${witness_macro}"; then
3683 echo " -D@${witness_macro}@=1 \\"
3685 echo " -I. -I\$(srcdir) \\"
3686 echo " -I${testsbase_inverse} -I\$(srcdir)/${testsbase_inverse} \\"
3687 echo " -I${testsbase_inverse}/${sourcebase-lib} -I\$(srcdir)/${testsbase_inverse}/${sourcebase-lib}"
3689 local_ldadd_before
=''
3690 local_ldadd_after
=''
3691 if $use_libtests; then
3692 # All test programs need to be linked with libtests.a.
3693 # It needs to be passed to the linker before ${libname}.${libext}, since
3694 # the tests-related modules depend on the main modules.
3695 # It also needs to be passed to the linker after ${libname}.${libext}
3696 # because the latter might contain incomplete modules (such as the 'error'
3697 # module whose dependency to 'progname' is voluntarily omitted).
3698 # The LIBTESTS_LIBDEPS can be passed to the linker once or twice, it does
3700 local_ldadd_before
=' libtests.a'
3701 local_ldadd_after
=' libtests.a $(LIBTESTS_LIBDEPS)'
3703 echo "LDADD =${local_ldadd_before} ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext}${local_ldadd_after}"
3705 if $use_libtests; then
3706 echo "libtests_a_SOURCES ="
3707 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
3708 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
3709 echo "libtests_a_LIBADD = \$(${macro_prefix}tests_LIBOBJS)"
3710 echo "libtests_a_DEPENDENCIES = \$(${macro_prefix}tests_LIBOBJS)"
3711 echo "EXTRA_libtests_a_SOURCES ="
3712 # The circular dependency in LDADD requires this.
3713 echo "AM_LIBTOOLFLAGS = --preserve-dup-deps"
3716 # Many test scripts use ${EXEEXT} or ${srcdir}.
3717 # EXEEXT is defined by AC_PROG_CC through autoconf.
3718 # srcdir is defined by autoconf and automake.
3719 echo "TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='\$(srcdir)'"
3721 cat "$tmp"/main_snippets
"$tmp"/longrunning_snippets \
3722 |
sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
3723 echo "# Clean up after Solaris cc."
3725 echo " rm -rf SunWS_cache"
3727 echo "mostlyclean-local: mostlyclean-generic"
3728 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
3729 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
3730 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
3734 rm -f "$tmp"/main_snippets
"$tmp"/longrunning_snippets
3737 # func_emit_initmacro_start macro_prefix
3738 # emits the first few statements of the gl_INIT macro to standard output.
3739 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
3740 func_emit_initmacro_start
()
3742 macro_prefix_arg
="$1"
3743 # Overriding AC_LIBOBJ and AC_REPLACE_FUNCS has the effect of storing
3744 # platform-dependent object files in ${macro_prefix_arg}_LIBOBJS instead of
3745 # LIBOBJS. The purpose is to allow several gnulib instantiations under
3746 # a single configure.ac file. (AC_CONFIG_LIBOBJ_DIR does not allow this
3748 # Furthermore it avoids an automake error like this when a Makefile.am
3749 # that uses pieces of gnulib also uses $(LIBOBJ):
3750 # automatically discovered file `error.c' should not be explicitly mentioned
3751 echo " m4_pushdef([AC_LIBOBJ], m4_defn([${macro_prefix_arg}_LIBOBJ]))"
3752 echo " m4_pushdef([AC_REPLACE_FUNCS], m4_defn([${macro_prefix_arg}_REPLACE_FUNCS]))"
3753 # Overriding AC_LIBSOURCES has the same purpose of avoiding the automake
3754 # error when a Makefile.am that uses pieces of gnulib also uses $(LIBOBJ):
3755 # automatically discovered file `error.c' should not be explicitly mentioned
3756 # We let automake know about the files to be distributed through the
3757 # EXTRA_lib_SOURCES variable.
3758 echo " m4_pushdef([AC_LIBSOURCES], m4_defn([${macro_prefix_arg}_LIBSOURCES]))"
3759 # Create data variables for checking the presence of files that are mentioned
3760 # as AC_LIBSOURCES arguments. These are m4 variables, not shell variables,
3761 # because we want the check to happen when the configure file is created,
3762 # not when it is run. ${macro_prefix_arg}_LIBSOURCES_LIST is the list of
3763 # files to check for. ${macro_prefix_arg}_LIBSOURCES_DIR is the subdirectory
3764 # in which to expect them.
3765 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_LIST], [])"
3766 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_DIR], [])"
3770 # func_emit_initmacro_end macro_prefix
3771 # emits the last few statements of the gl_INIT macro to standard output.
3772 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
3773 func_emit_initmacro_end
()
3775 macro_prefix_arg
="$1"
3776 # Check the presence of files that are mentioned as AC_LIBSOURCES arguments.
3777 # The check is performed only when autoconf is run from the directory where
3778 # the configure.ac resides; if it is run from a different directory, the
3780 echo " m4_ifval(${macro_prefix_arg}_LIBSOURCES_LIST, ["
3781 echo " m4_syscmd([test ! -d ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[ ||"
3782 echo " for gl_file in ]${macro_prefix_arg}_LIBSOURCES_LIST[ ; do"
3783 echo " if test ! -r ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file ; then"
3784 echo " echo \"missing file ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file\" >&2"
3788 echo " m4_if(m4_sysval, [0], [],"
3789 echo " [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])"
3791 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_DIR])"
3792 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_LIST])"
3793 echo " m4_popdef([AC_LIBSOURCES])"
3794 echo " m4_popdef([AC_REPLACE_FUNCS])"
3795 echo " m4_popdef([AC_LIBOBJ])"
3796 echo " AC_CONFIG_COMMANDS_PRE(["
3797 echo " ${macro_prefix_arg}_libobjs="
3798 echo " ${macro_prefix_arg}_ltlibobjs="
3799 echo " if test -n \"\$${macro_prefix_arg}_LIBOBJS\"; then"
3800 echo " # Remove the extension."
3801 echo " sed_drop_objext='s/\\.o\$//;s/\\.obj\$//'"
3802 echo " for i in \`for i in \$${macro_prefix_arg}_LIBOBJS; do echo \"\$i\"; done | sed -e \"\$sed_drop_objext\" | sort | uniq\`; do"
3803 echo " ${macro_prefix_arg}_libobjs=\"\$${macro_prefix_arg}_libobjs \$i.\$ac_objext\""
3804 echo " ${macro_prefix_arg}_ltlibobjs=\"\$${macro_prefix_arg}_ltlibobjs \$i.lo\""
3807 echo " AC_SUBST([${macro_prefix_arg}_LIBOBJS], [\$${macro_prefix_arg}_libobjs])"
3808 echo " AC_SUBST([${macro_prefix_arg}_LTLIBOBJS], [\$${macro_prefix_arg}_ltlibobjs])"
3812 # func_emit_initmacro_done macro_prefix sourcebase
3813 # emits a few statements after the gl_INIT macro to standard output.
3814 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
3815 # - sourcebase directory relative to destdir where to place source code
3816 func_emit_initmacro_done
()
3818 macro_prefix_arg
="$1"
3821 echo "# Like AC_LIBOBJ, except that the module name goes"
3822 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
3823 echo "AC_DEFUN([${macro_prefix_arg}_LIBOBJ], ["
3824 echo " AS_LITERAL_IF([\$1], [${macro_prefix_arg}_LIBSOURCES([\$1.c])])dnl"
3825 echo " ${macro_prefix_arg}_LIBOBJS=\"\$${macro_prefix_arg}_LIBOBJS \$1.\$ac_objext\""
3828 echo "# Like AC_REPLACE_FUNCS, except that the module name goes"
3829 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
3830 echo "AC_DEFUN([${macro_prefix_arg}_REPLACE_FUNCS], ["
3831 echo " m4_foreach_w([gl_NAME], [\$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl"
3832 echo " AC_CHECK_FUNCS([\$1], , [${macro_prefix_arg}_LIBOBJ(\$ac_func)])"
3835 echo "# Like AC_LIBSOURCES, except the directory where the source file is"
3836 echo "# expected is derived from the gnulib-tool parameterization,"
3837 echo "# and alloca is special cased (for the alloca-opt module)."
3838 echo "# We could also entirely rely on EXTRA_lib..._SOURCES."
3839 echo "AC_DEFUN([${macro_prefix_arg}_LIBSOURCES], ["
3840 echo " m4_foreach([_gl_NAME], [\$1], ["
3841 echo " m4_if(_gl_NAME, [alloca.c], [], ["
3842 echo " m4_define([${macro_prefix_arg}_LIBSOURCES_DIR], [$sourcebase_arg])"
3843 echo " m4_append([${macro_prefix_arg}_LIBSOURCES_LIST], _gl_NAME, [ ])"
3849 # func_emit_autoconf_snippet indentation
3850 # emits the autoconf snippet of a module.
3852 # - local_gnulib_dir from --local-dir
3853 # - modcache true or false, from --cache-modules/--no-cache-modules
3854 # - sed_replace_build_aux sed expression that replaces reference to build-aux
3855 # - module the module name
3856 # - toplevel true or false. 'false' means a subordinate use of
3858 # - disable_libtool true or false. It tells whether to disable libtool
3859 # handling even if it has been specified through the
3860 # command line options.
3861 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
3863 # - indentation spaces to prepend on each line
3864 func_emit_autoconf_snippet
()
3866 if { case $module in
3867 gnumakefile | maintainer-makefile
)
3868 # These modules are meant to be used only in the top-level directory.
3874 func_get_autoconf_snippet
"$module" \
3875 |
sed -e '/^$/d;' -e "s/^/$indentation/" \
3876 -e "$sed_replace_build_aux" \
3877 |
{ if $disable_libtool; then
3878 sed -e 's/\$gl_cond_libtool/false/g' \
3879 -e 's/gl_libdeps/gltests_libdeps/g' \
3880 -e 's/gl_ltlibdeps/gltests_ltlibdeps/g'
3885 |
{ if $disable_gettext; then
3886 sed -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./'
3891 if test "$module" = 'alloca' && test "$libtool" = true
&& ! $disable_libtool; then
3892 echo 'changequote(,)dnl'
3893 echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
3894 echo 'changequote([, ])dnl'
3895 echo 'AC_SUBST([LTALLOCA])'
3900 # func_emit_autoconf_snippets modules verifier toplevel disable_libtool disable_gettext
3901 # collects and emit the autoconf snippets of a set of modules.
3903 # - local_gnulib_dir from --local-dir
3904 # - modcache true or false, from --cache-modules/--no-cache-modules
3905 # - sed_replace_build_aux sed expression that replaces reference to build-aux
3906 # - modules the list of modules.
3907 # - verifier one of func_verify_module, func_verify_nontests_module,
3908 # func_verify_tests_module. It selects the subset of
3909 # $modules to consider.
3910 # - toplevel true or false. 'false' means a subordinate use of
3912 # - disable_libtool true or false. It tells whether to disable libtool
3913 # handling even if it has been specified through the
3914 # command line options.
3915 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
3917 func_emit_autoconf_snippets
()
3921 disable_libtool
="$4"
3922 disable_gettext
="$5"
3923 if test "$cond_dependencies" = true
; then
3924 for m
in $modules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/modules
3925 # Emit the autoconf code for the unconditional modules.
3926 for module
in $1; do
3928 if test -n "$module"; then
3929 if func_cond_module_p
"$module"; then
3932 func_emit_autoconf_snippet
" "
3936 # Initialize the shell variables indicating that the modules are enabled.
3937 for module
in $1; do
3939 if test -n "$module"; then
3940 if func_cond_module_p
"$module"; then
3941 func_module_shellvar_name
"$module"
3942 echo " $shellvar=false"
3946 # Emit the autoconf code for the conditional modules, each in a separate
3947 # function. This makes it possible to support cycles among conditional
3949 for module
in $1; do
3951 if test -n "$module"; then
3952 if func_cond_module_p
"$module"; then
3953 func_module_shellfunc_name
"$module"
3954 func_module_shellvar_name
"$module"
3955 echo " $shellfunc ()"
3957 echo " if ! \$$shellvar; then"
3958 func_emit_autoconf_snippet
" "
3959 echo " $shellvar=true"
3960 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
3961 # Intersect $deps with the modules list $1.
3962 deps
=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
3963 for dep
in $deps; do
3964 if func_cond_module_p
"$dep"; then
3965 func_module_shellfunc_name
"$dep"
3966 func_cond_module_condition
"$module" "$dep"
3967 if test "$condition" != true
; then
3968 echo " if $condition; then"
3975 # The autoconf code for $dep has already been emitted above and
3976 # therefore is already executed when this function is run.
3985 # Emit the dependencies from the unconditional to the conditional modules.
3986 for module
in $1; do
3988 if test -n "$module"; then
3989 if func_cond_module_p
"$module"; then
3992 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
3993 # Intersect $deps with the modules list $1.
3994 deps
=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
3995 for dep
in $deps; do
3996 if func_cond_module_p
"$dep"; then
3997 func_module_shellfunc_name
"$dep"
3998 func_cond_module_condition
"$module" "$dep"
3999 if test "$condition" != true
; then
4000 echo " if $condition; then"
4007 # The autoconf code for $dep has already been emitted above and
4008 # therefore is already executed when this code is run.
4015 # Define the Automake conditionals.
4016 echo " m4_pattern_allow([^${macro_prefix}_GNULIB_ENABLED_])"
4017 for module
in $1; do
4019 if test -n "$module"; then
4020 if func_cond_module_p
"$module"; then
4021 func_module_conditional_name
"$module"
4022 func_module_shellvar_name
"$module"
4023 echo " AM_CONDITIONAL([$conditional], [\$$shellvar])"
4028 # Ignore the conditions, and enable all modules unconditionally.
4029 for module
in $1; do
4031 if test -n "$module"; then
4032 func_emit_autoconf_snippet
" "
4038 # func_import modules
4039 # Uses also the variables
4040 # - mode import or add-import or remove-import or update
4041 # - destdir target directory
4042 # - local_gnulib_dir from --local-dir
4043 # - modcache true or false, from --cache-modules/--no-cache-modules
4044 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
4045 # - libname library name
4046 # - supplied_libname true if --lib was given, blank otherwise
4047 # - sourcebase directory relative to destdir where to place source code
4048 # - m4base directory relative to destdir where to place *.m4 macros
4049 # - pobase directory relative to destdir where to place *.po files
4050 # - docbase directory relative to destdir where to place doc files
4051 # - testsbase directory relative to destdir where to place unit test code
4052 # - auxdir directory relative to destdir where to place build aux files
4053 # - inctests true if --with-tests was given, blank otherwise
4054 # - incobsolete true if --with-obsolete was given, blank otherwise
4055 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
4056 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
4058 # - inc_privileged_tests true if --with-privileged-tests was given, blank
4060 # - inc_unportable_tests true if --with-unportable-tests was given, blank
4062 # - inc_all_tests true if --with-all-tests was given, blank otherwise
4063 # - avoidlist list of modules to avoid, from --avoid
4064 # - cond_dependencies true if --conditional-dependencies was given, false if
4065 # --no-conditional-dependencies was given, blank otherwise
4066 # - lgpl yes or a number if library's license shall be LGPL,
4068 # - makefile_name from --makefile-name
4069 # - libtool true if --libtool was given, false if --no-libtool was
4070 # given, blank otherwise
4071 # - guessed_libtool true if the configure.ac file uses libtool, false otherwise
4072 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4073 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
4074 # - witness_c_macro from --witness-c-macro
4075 # - vc_files true if --vc-files was given, false if --no-vc-files was
4076 # given, blank otherwise
4077 # - autoconf_minversion minimum supported autoconf version
4078 # - doit : if actions shall be executed, false if only to be printed
4079 # - symbolic true if files should be symlinked, copied otherwise
4080 # - lsymbolic true if files from local_gnulib_dir should be symlinked,
4082 # - do_copyrights true if copyright notices in files should be replaced,
4086 # Get the cached settings.
4087 # In 'import' mode, we read them only for the purpose of knowing the old
4088 # installed file list, and don't use them as defaults.
4089 cached_local_gnulib_dir
=
4090 cached_specified_modules
=
4092 cached_inc_cxx_tests
=
4093 cached_inc_longrunning_tests
=
4094 cached_inc_privileged_tests
=
4095 cached_inc_unportable_tests
=
4096 cached_inc_all_tests
=
4106 cached_makefile_name
=
4107 cached_cond_dependencies
=
4109 cached_macro_prefix
=
4111 cached_witness_c_macro
=
4114 if test -f "$destdir"/$m4base/gnulib-cache.
m4; then
4115 cached_libtool
=false
4121 s,^.*gl_LOCAL_DIR([[ ]*\([^]"$`\\)]*\).*$,cached_local_gnulib_dir="\1",p
4131 s,^.*gl_MODULES([[ ]*\([^]"$`\\)]*\).*$,cached_specified_modules="\1",p
4133 /gl_WITH_OBSOLETE/ {
4134 s,^.*$,cached_incobsolete=true,p
4136 /gl_WITH_CXX_TESTS/ {
4137 s,^.*$,cached_inc_cxx_tests=true,p
4139 /gl_WITH_LONGRUNNING_TESTS/ {
4140 s,^.*$,cached_inc_longrunning_tests=true,p
4142 /gl_WITH_PRIVILEGED_TESTS/ {
4143 s,^.*$,cached_inc_privileged_tests=true,p
4145 /gl_WITH_UNPORTABLE_TESTS/ {
4146 s,^.*$,cached_inc_unportable_tests=true,p
4148 /gl_WITH_ALL_TESTS/ {
4149 s,^.*$,cached_inc_all_tests=true,p
4152 s,^.*gl_AVOID([[ ]*\([^]"$`\\)]*\).*$,cached_avoidlist="\1",p
4155 s,^.*gl_SOURCE_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_sourcebase="\1",p
4158 s,^.*gl_M4_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_m4base="\1",p
4161 s,^.*gl_PO_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_pobase="\1",p
4164 s,^.*gl_DOC_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_docbase="\1",p
4167 s,^.*gl_TESTS_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_testsbase="\1",p
4170 s,^.*$,cached_inctests=true,p
4173 s,^.*gl_LIB([[ ]*\([^]"$`\\)]*\).*$,cached_libname="\1",p
4176 s,^.*gl_LGPL([[ ]*\([^]"$`\\)]*\).*$,cached_lgpl="\1",p
4179 s,^.*$,cached_lgpl=yes,p
4181 /gl_MAKEFILE_NAME(/ {
4182 s,^.*gl_MAKEFILE_NAME([[ ]*\([^]"$`\\)]*\).*$,cached_makefile_name="\1",p
4184 /gl_CONDITIONAL_DEPENDENCIES/ {
4185 s,^.*$,cached_cond_dependencies=true,p
4188 s,^.*$,cached_libtool=true,p
4190 /gl_MACRO_PREFIX(/ {
4191 s,^.*gl_MACRO_PREFIX([[ ]*\([^]"$`\\)]*\).*$,cached_macro_prefix="\1",p
4194 s,^.*gl_PO_DOMAIN([[ ]*\([^]"$`\\)]*\).*$,cached_po_domain="\1",p
4196 /gl_WITNESS_C_MACRO(/ {
4197 s,^.*gl_WITNESS_C_MACRO([[ ]*\([^]"$`\\)]*\).*$,cached_witness_c_macro="\1",p
4200 s,^.*gl_VC_FILES([[ ]*\([^]"$`\\)]*\).*$,cached_vc_files="\1",p
4202 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-cache.m4`
4203 if test -f "$destdir"/$m4base/gnulib-comp.
m4; then
4208 /AC_DEFUN(\['"${cached_macro_prefix}"'_FILE_LIST\], \[/ {
4209 s,^.*$,cached_files=",p
4222 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-comp.m4`
4226 if test "$mode" = import
; then
4227 # In 'import' mode, the new set of specified modules overrides the cached
4228 # set of modules. Ignore the cached settings.
4229 specified_modules
="$1"
4231 # Merge the cached settings with the specified ones.
4232 # The m4base must be the same as expected from the pathname.
4233 if test -n "$cached_m4base" && test "$cached_m4base" != "$m4base"; then
4234 func_fatal_error
"$m4base/gnulib-cache.m4 is expected to contain gl_M4_BASE([$m4base])"
4236 # The local_gnulib_dir defaults to the cached one. Recall that the cached one
4237 # is relative to $destdir, whereas the one we use is relative to . or absolute.
4238 if test -z "$local_gnulib_dir"; then
4239 if test -n "$cached_local_gnulib_dir"; then
4242 local_gnulib_dir
="$destdir/$cached_local_gnulib_dir" ;;
4244 case "$cached_local_gnulib_dir" in
4246 local_gnulib_dir
="$destdir/$cached_local_gnulib_dir" ;;
4248 func_relconcat
"$destdir" "$cached_local_gnulib_dir"
4249 local_gnulib_dir
="$relconcat" ;;
4256 # Append the cached and the specified module names. So that
4257 # "gnulib-tool --add-import foo" means to add the module foo.
4258 specified_modules
="$cached_specified_modules $1"
4261 # Take the cached module names, minus the specified module names.
4263 if $have_associative; then
4264 # Use an associative array, for O(N) worst-case run time.
4265 declare -A to_remove
4267 eval 'to_remove[$m]=yes'
4269 for module
in $cached_specified_modules; do
4270 if eval 'test -z "${to_remove[$module]}"'; then
4271 func_append specified_modules
"$module "
4275 # This loop has O(N²) worst-case run time.
4276 for module
in $cached_specified_modules; do
4279 if test "$m" = "$module"; then
4284 if test -z "$to_remove"; then
4285 func_append specified_modules
"$module "
4291 # Take the cached module names. There are no specified module names.
4292 specified_modules
="$cached_specified_modules"
4295 # Included obsolete modules among the dependencies if specified either way.
4296 if test -z "$incobsolete"; then
4297 incobsolete
="$cached_incobsolete"
4299 # Included special kinds of tests modules among the dependencies if specified
4301 if test -z "$inc_cxx_tests"; then
4302 inc_cxx_tests
="$cached_inc_cxx_tests"
4304 if test -z "$inc_longrunning_tests"; then
4305 inc_longrunning_tests
="$cached_inc_longrunning_tests"
4307 if test -z "$inc_privileged_tests"; then
4308 inc_privileged_tests
="$cached_inc_privileged_tests"
4310 if test -z "$inc_unportable_tests"; then
4311 inc_unportable_tests
="$cached_inc_unportable_tests"
4313 if test -z "$inc_all_tests"; then
4314 inc_all_tests
="$cached_inc_all_tests"
4316 # Append the cached and the specified avoidlist. This is probably better
4317 # than dropping the cached one when --avoid is specified at least once.
4318 avoidlist
=`for m in $cached_avoidlist $avoidlist; do echo $m; done | LC_ALL=C sort -u`
4319 avoidlist
=`echo $avoidlist`
4321 # The sourcebase defaults to the cached one.
4322 if test -z "$sourcebase"; then
4323 sourcebase
="$cached_sourcebase"
4324 if test -z "$sourcebase"; then
4325 func_fatal_error
"missing --source-base option"
4328 # The pobase defaults to the cached one.
4329 if test -z "$pobase"; then
4330 pobase
="$cached_pobase"
4332 # The docbase defaults to the cached one.
4333 if test -z "$docbase"; then
4334 docbase
="$cached_docbase"
4335 if test -z "$docbase"; then
4336 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."
4339 # The testsbase defaults to the cached one.
4340 if test -z "$testsbase"; then
4341 testsbase
="$cached_testsbase"
4342 if test -z "$testsbase"; then
4343 func_fatal_error
"missing --tests-base option"
4346 # Require the tests if specified either way.
4347 if test -z "$inctests"; then
4348 inctests
="$cached_inctests"
4350 # The libname defaults to the cached one.
4351 if test -z "$supplied_libname"; then
4352 libname
="$cached_libname"
4353 if test -z "$libname"; then
4354 func_fatal_error
"missing --lib option"
4357 # Require LGPL if specified either way.
4358 if test -z "$lgpl"; then
4361 # The makefile_name defaults to the cached one.
4362 if test -z "$makefile_name"; then
4363 makefile_name
="$cached_makefile_name"
4365 # Use conditional dependencies if specified either way.
4366 if test -z "$cond_dependencies"; then
4367 cond_dependencies
="$cached_cond_dependencies"
4369 # Use libtool if specified either way, or if guessed.
4370 if test -z "$libtool"; then
4371 if test -n "$cached_m4base"; then
4372 libtool
="$cached_libtool"
4374 libtool
="$guessed_libtool"
4377 # The macro_prefix defaults to the cached one.
4378 if test -z "$macro_prefix"; then
4379 macro_prefix
="$cached_macro_prefix"
4380 if test -z "$macro_prefix"; then
4381 func_fatal_error
"missing --macro-prefix option"
4384 # The po_domain defaults to the cached one.
4385 if test -z "$po_domain"; then
4386 po_domain
="$cached_po_domain"
4388 # The witness_c_macro defaults to the cached one.
4389 if test -z "$witness_c_macro"; then
4390 witness_c_macro
="$cached_witness_c_macro"
4392 # The vc_files defaults to the cached one.
4393 if test -z "$vc_files"; then
4394 vc_files
="$cached_vc_files"
4396 # Ensure constraints.
4397 if test "$cond_dependencies" = true
&& test -n "$inctests"; then
4398 echo "gnulib-tool: option --conditional-dependencies is not supported with --with-tests" 1>&2
4402 # --without-*-tests options are not supported here.
4404 excl_longrunning_tests
=
4405 excl_privileged_tests
=
4406 excl_unportable_tests
=
4408 # Canonicalize the list of specified modules.
4409 specified_modules
=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
4411 # Include all kinds of tests modules if --with-all-tests was specified.
4412 inc_all_direct_tests
="$inc_all_tests"
4413 inc_all_indirect_tests
="$inc_all_tests"
4415 # Determine final module list.
4416 modules
="$specified_modules"
4417 func_modules_transitive_closure
4418 if test $verbose -ge 0; then
4419 func_show_module_list
4421 final_modules
="$modules"
4423 # Determine main module list and tests-related module list separately.
4424 func_modules_transitive_closure_separately
4426 # Determine whether a $testsbase/libtests.a is needed.
4427 func_determine_use_libtests
4429 # Add the dummy module to the main module list or to the tests-related module
4431 func_modules_add_dummy_separately
4433 # If --lgpl, verify that the licenses of modules are compatible.
4434 if test -n "$lgpl"; then
4435 license_incompatibilities
=
4436 for module
in $main_modules; do
4437 license
=`func_get_license $module`
4439 'GPLed build tool') ;;
4440 'public domain' |
'unlimited' |
'unmodifiable license text') ;;
4445 LGPL | LGPLv2
+ | LGPLv3
+) ;;
4446 *) func_append license_incompatibilities
"$module $license$nl" ;;
4452 *) func_append license_incompatibilities
"$module $license$nl" ;;
4455 *) func_fatal_error
"invalid value lgpl=$lgpl" ;;
4460 if test -n "$license_incompatibilities"; then
4461 # Format the license incompatibilities as a table.
4462 sed_expand_column1_width50_indent17
='s,^\([^ ]*\) ,\1 ,
4463 s,^\(.................................................[^ ]*\) *, \1 ,'
4464 license_incompatibilities
=`echo "$license_incompatibilities" | sed -e "$sed_expand_column1_width50_indent17"`
4465 func_fatal_error
"incompatible license on modules:$nl$license_incompatibilities"
4469 # Show banner notice of every module.
4470 modules
="$main_modules"
4473 # Determine script to apply to imported library files.
4474 sed_transform_lib_file
=
4475 for module
in $main_modules; do
4476 if test $module = config-h
; then
4477 # Assume config.h exists, and that -DHAVE_CONFIG_H is omitted.
4478 sed_transform_lib_file
=$sed_transform_lib_file'
4479 s/^#ifdef[ ]*HAVE_CONFIG_H[ ]*$/#if 1/
4484 sed_transform_main_lib_file
="$sed_transform_lib_file"
4485 if test -n "$do_copyrights"; then
4486 if test -n "$lgpl"; then
4490 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
4491 s/GNU General/GNU Lesser General/g
4492 s/General Public License/Lesser General Public License/g
4493 s/Lesser Lesser General Public License/Lesser General Public License/g
4497 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
4498 s/GNU General/GNU Lesser General/g
4499 s/General Public License/Lesser General Public License/g
4500 s/Lesser Lesser General Public License/Lesser General Public License/g
4502 s/version [23]\([ ,]\)/version 2.1\1/g
4505 *) func_fatal_error
"invalid value lgpl=$lgpl" ;;
4509 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
4510 s/GNU Lesser General/GNU General/g
4511 s/Lesser General Public License/General Public License/g
4513 s/GNU Library General/GNU General/g
4514 s/Library General Public License/General Public License/g
4516 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
4521 # Determine script to apply to auxiliary files that go into $auxdir/.
4522 sed_transform_build_aux_file
=
4523 if test -n "$do_copyrights"; then
4525 sed_transform_build_aux_file
=$sed_transform_build_aux_file'
4526 s/GNU Lesser General/GNU General/g
4527 s/Lesser General Public License/General Public License/g
4529 s/GNU Library General/GNU General/g
4530 s/Library General Public License/General Public License/g
4532 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
4536 # Determine script to apply to library files that go into $testsbase/.
4537 sed_transform_testsrelated_lib_file
="$sed_transform_lib_file"
4538 if test -n "$do_copyrights"; then
4540 sed_transform_testsrelated_lib_file
=$sed_transform_testsrelated_lib_file'
4541 s/GNU Lesser General/GNU General/g
4542 s/Lesser General Public License/General Public License/g
4544 s/GNU Library General/GNU General/g
4545 s/Library General Public License/General Public License/g
4547 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
4551 # Determine the final file lists.
4552 func_modules_to_filelist_separately
4555 || func_fatal_error
"refusing to do nothing"
4557 # Add m4/gnulib-tool.m4 to the file list. It is not part of any module.
4558 new_files
="$files m4/gnulib-tool.m4"
4559 old_files
="$cached_files"
4560 if test -f "$destdir"/$m4base/gnulib-tool.
m4; then
4561 func_append old_files
" m4/gnulib-tool.m4"
4564 rewritten
='%REWRITTEN%'
4565 sed_rewrite_old_files
="\
4566 s,^build-aux/,$rewritten$auxdir/,
4567 s,^doc/,$rewritten$cached_docbase/,
4568 s,^lib/,$rewritten$cached_sourcebase/,
4569 s,^m4/,$rewritten$cached_m4base/,
4570 s,^tests/,$rewritten$cached_testsbase/,
4571 s,^tests=lib/,$rewritten$cached_testsbase/,
4574 sed_rewrite_new_files
="\
4575 s,^build-aux/,$rewritten$auxdir/,
4576 s,^doc/,$rewritten$docbase/,
4577 s,^lib/,$rewritten$sourcebase/,
4578 s,^m4/,$rewritten$m4base/,
4579 s,^tests/,$rewritten$testsbase/,
4580 s,^tests=lib/,$rewritten$testsbase/,
4584 # Create directories.
4585 { echo "$sourcebase"
4587 if test -n "$pobase"; then
4590 docfiles
=`echo "$files" | sed -n -e 's,^doc/,,p'`
4591 if test -n "$docfiles"; then
4594 if test -n "$inctests"; then
4598 for f
in $files; do echo $f; done \
4599 |
sed -e "$sed_rewrite_new_files" \
4600 |
sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
4603 { # Rearrange file descriptors. Needed because "while ... done < ..."
4604 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
4605 exec 5<&0 < "$tmp"/dirs
4607 if test ! -d "$destdir/$d"; then
4609 echo "Creating directory $destdir/$d"
4610 mkdir
-p "$destdir/$d" || func_fatal_error
"failed"
4612 echo "Create directory $destdir/$d"
4619 # Copy files or make symbolic links. Remove obsolete files.
4623 # Construct a table with 2 columns: rewritten-file-name original-file-name,
4624 # representing the files according to the last gnulib-tool invocation.
4625 for f
in $old_files; do echo $f; done \
4626 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_old_files" \
4629 # Construct a table with 2 columns: rewritten-file-name original-file-name,
4630 # representing the files after this gnulib-tool invocation.
4631 for f
in $new_files; do echo $f; done \
4632 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" \
4635 # First the files that are in old-files, but not in new-files:
4636 sed_take_first_column
='s,'"$delimiter"'.*,,'
4637 for g
in `LC_ALL=C join -t"$delimiter" -v1 "$tmp"/old-files "$tmp"/new-files | sed -e "$sed_take_first_column"`; do
4638 # Remove the file. Do nothing if the user already removed it.
4639 if test -f "$destdir/$g" ||
test -h "$destdir/$g"; then
4641 echo "Removing file $g (backup in ${g}~)"
4642 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error
"failed"
4644 echo "Remove file $g (backup in ${g}~)"
4646 func_append removed_files
"$g$nl"
4649 # func_add_or_update handles a file that ought to be present afterwards.
4651 # - f the original file name
4652 # - g the rewritten file name
4653 # - already_present nonempty if the file should already exist, empty
4655 func_add_or_update
()
4659 tests
=lib
/*) f
=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
4661 func_dest_tmpfilename
"$g"
4662 func_lookup_file
"$f"
4663 cp "$lookedup_file" "$tmpfile" || func_fatal_error
"failed"
4664 if test -n "$sed_transform_main_lib_file"; then
4667 sed -e "$sed_transform_main_lib_file" \
4668 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
4672 if test -n "$sed_transform_build_aux_file"; then
4675 sed -e "$sed_transform_build_aux_file" \
4676 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
4680 if test -n "$sed_transform_testsrelated_lib_file"; then
4683 sed -e "$sed_transform_testsrelated_lib_file" \
4684 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
4688 if test -f "$destdir/$g"; then
4689 # The file already exists.
4693 # Don't protest if the file should be there but isn't: it happens
4694 # frequently that developers don't put autogenerated files under version control.
4696 func_append added_files
"$g$nl"
4700 # Then the files that are in new-files, but not in old-files:
4701 sed_take_last_column
='s,^.*'"$delimiter"',,'
4703 LC_ALL
=C
join -t"$delimiter" -v2 "$tmp"/old-files
"$tmp"/new-files \
4704 |
sed -e "$sed_take_last_column" \
4705 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/added-files
4706 { # Rearrange file descriptors. Needed because "while ... done < ..."
4707 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
4708 exec 5<&0 < "$tmp"/added-files
4714 # Then the files that are in new-files and in old-files:
4715 already_present
=true
4716 LC_ALL
=C
join -t"$delimiter" "$tmp"/old-files
"$tmp"/new-files \
4717 |
sed -e "$sed_take_last_column" \
4718 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/kept-files
4719 { # Rearrange file descriptors. Needed because "while ... done < ..."
4720 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
4721 exec 5<&0 < "$tmp"/kept-files
4728 # Command-line invocation printed in a comment in generated gnulib-cache.m4.
4729 actioncmd
="gnulib-tool --import"
4730 func_append actioncmd
" --dir=$destdir"
4731 if test -n "$local_gnulib_dir"; then
4732 func_append actioncmd
" --local-dir=$local_gnulib_dir"
4734 func_append actioncmd
" --lib=$libname"
4735 func_append actioncmd
" --source-base=$sourcebase"
4736 func_append actioncmd
" --m4-base=$m4base"
4737 if test -n "$pobase"; then
4738 func_append actioncmd
" --po-base=$pobase"
4740 func_append actioncmd
" --doc-base=$docbase"
4741 func_append actioncmd
" --tests-base=$testsbase"
4742 func_append actioncmd
" --aux-dir=$auxdir"
4743 if test -n "$inctests"; then
4744 func_append actioncmd
" --with-tests"
4746 if test -n "$incobsolete"; then
4747 func_append actioncmd
" --with-obsolete"
4749 if test -n "$inc_cxx_tests"; then
4750 func_append actioncmd
" --with-c++-tests"
4752 if test -n "$inc_longrunning_tests"; then
4753 func_append actioncmd
" --with-longrunning-tests"
4755 if test -n "$inc_privileged_tests"; then
4756 func_append actioncmd
" --with-privileged-tests"
4758 if test -n "$inc_unportable_tests"; then
4759 func_append actioncmd
" --with-unportable-tests"
4761 if test -n "$inc_all_tests"; then
4762 func_append actioncmd
" --with-all-tests"
4764 for module
in $avoidlist; do
4765 func_append actioncmd
" --avoid=$module"
4767 if test -n "$lgpl"; then
4768 if test "$lgpl" = yes; then
4769 func_append actioncmd
" --lgpl"
4771 func_append actioncmd
" --lgpl=$lgpl"
4774 if test -n "$makefile_name"; then
4775 func_append actioncmd
" --makefile-name=$makefile_name"
4777 if test "$cond_dependencies" = true
; then
4778 func_append actioncmd
" --conditional-dependencies"
4780 func_append actioncmd
" --no-conditional-dependencies"
4782 if test "$libtool" = true
; then
4783 func_append actioncmd
" --libtool"
4785 func_append actioncmd
" --no-libtool"
4787 func_append actioncmd
" --macro-prefix=$macro_prefix"
4788 if test -n "$po_domain"; then
4789 func_append actioncmd
" --po-domain=$po_domain"
4791 if test -n "$witness_c_macro"; then
4792 func_append actioncmd
" --witness-c-macro=$witness_c_macro"
4794 if test -n "$vc_files"; then
4795 if test "$vc_files" = true
; then
4796 func_append actioncmd
" --vc-files"
4798 func_append actioncmd
" --no-vc-files"
4801 func_append actioncmd
" `echo $specified_modules`"
4803 # Determine include_guard_prefix.
4804 func_compute_include_guard_prefix
4806 # Default the makefile name to Makefile.am.
4807 if test -n "$makefile_name"; then
4808 makefile_am
=$makefile_name
4810 makefile_am
=Makefile.am
4813 # Create normal Makefile.ams.
4816 # Setup list of Makefile.am edits that are to be performed afterwards.
4817 # Some of these edits apply to files that we will generate; others are
4818 # under the responsibility of the developer.
4820 # func_note_Makefile_am_edit dir var value
4821 # remembers that ${dir}Makefile.am needs to be edited to that ${var} mentions
4823 func_note_Makefile_am_edit
()
4825 makefile_am_edits
=`expr $makefile_am_edits + 1`
4826 eval makefile_am_edit
${makefile_am_edits}_dir
=\"\
$1\"
4827 eval makefile_am_edit
${makefile_am_edits}_var
=\"\
$2\"
4828 eval makefile_am_edit
${makefile_am_edits}_val
=\"\
$3\"
4830 if test "$makefile_am" = Makefile.am
; then
4831 sourcebase_dir
=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'`
4832 sourcebase_base
=`basename "$sourcebase"`
4833 func_note_Makefile_am_edit
"$sourcebase_dir" SUBDIRS
"$sourcebase_base"
4835 if test -n "$pobase"; then
4836 pobase_dir
=`echo "$pobase" | sed -n -e 's,/[^/]*$,/,p'`
4837 pobase_base
=`basename "$pobase"`
4838 func_note_Makefile_am_edit
"$pobase_dir" SUBDIRS
"$pobase_base"
4840 if test -n "$inctests"; then
4841 if test "$makefile_am" = Makefile.am
; then
4842 testsbase_dir
=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'`
4843 testsbase_base
=`basename "$testsbase"`
4844 func_note_Makefile_am_edit
"$testsbase_dir" SUBDIRS
"$testsbase_base"
4847 func_note_Makefile_am_edit
"" ACLOCAL_AMFLAGS
"-I ${m4base}"
4849 # Find the first parent directory of $m4base that contains or will contain
4851 sed_last
='s,^.*/\([^/][^/]*\)//*$,\1/,
4853 sed_butlast
='s,[^/][^/]*//*$,,'
4854 dir1
="${m4base}/"; dir2
=""
4855 while test -n "$dir1" \
4856 && ! { test -f "${destdir}/${dir1}Makefile.am" \
4857 ||
test "${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
4858 ||
test "./${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
4859 ||
{ test -n "$inctests" \
4860 && { test "${dir1}Makefile.am" = "$testsbase/$makefile_am" \
4861 ||
test "./${dir1}Makefile.am" = "$testsbase/$makefile_am"; }; }; }; do
4862 dir2
=`echo "$dir1" | sed -e "$sed_last"`"$dir2"
4863 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
4865 func_note_Makefile_am_edit
"$dir1" EXTRA_DIST
"${dir2}gnulib-cache.m4"
4868 # Create library makefile.
4869 func_dest_tmpfilename
$sourcebase/$makefile_am
4870 destfile
="$sourcebase/$makefile_am"
4871 modules
="$main_modules"
4872 func_emit_lib_Makefile_am
> "$tmpfile"
4873 if test -f "$destdir"/$sourcebase/$makefile_am; then
4874 if cmp "$destdir"/$sourcebase/$makefile_am "$tmpfile" > /dev
/null
; then
4878 echo "Updating $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
4879 mv -f "$destdir"/$sourcebase/$makefile_am "$destdir"/$sourcebase/$makefile_am~
4880 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
4882 echo "Update $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
4888 echo "Creating $sourcebase/$makefile_am"
4889 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
4891 echo "Create $sourcebase/$makefile_am"
4894 func_append added_files
"$sourcebase/$makefile_am$nl"
4897 # Create po/ directory.
4898 if test -n "$pobase"; then
4899 # Create po makefile and auxiliary files.
4900 for file in Makefile.
in.
in remove-potcdate.sin
; do
4901 func_dest_tmpfilename
$pobase/$file
4902 func_lookup_file build-aux
/po
/$file
4903 cat "$lookedup_file" > "$tmpfile"
4904 if test -f "$destdir"/$pobase/$file; then
4905 if cmp "$destdir"/$pobase/$file "$tmpfile" > /dev
/null
; then
4909 echo "Updating $pobase/$file (backup in $pobase/$file~)"
4910 mv -f "$destdir"/$pobase/$file "$destdir"/$pobase/$file~
4911 mv -f "$tmpfile" "$destdir"/$pobase/$file
4913 echo "Update $pobase/$file (backup in $pobase/$file~)"
4919 echo "Creating $pobase/$file"
4920 mv -f "$tmpfile" "$destdir"/$pobase/$file
4922 echo "Create $pobase/$file"
4925 func_append added_files
"$pobase/$file$nl"
4928 # Create po makefile parameterization, part 1.
4929 func_dest_tmpfilename
$pobase/Makevars
4930 func_emit_po_Makevars
> "$tmpfile"
4931 if test -f "$destdir"/$pobase/Makevars
; then
4932 if cmp "$destdir"/$pobase/Makevars
"$tmpfile" > /dev
/null
; then
4936 echo "Updating $pobase/Makevars (backup in $pobase/Makevars~)"
4937 mv -f "$destdir"/$pobase/Makevars
"$destdir"/$pobase/Makevars~
4938 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
4940 echo "Update $pobase/Makevars (backup in $pobase/Makevars~)"
4946 echo "Creating $pobase/Makevars"
4947 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
4949 echo "Create $pobase/Makevars"
4952 func_append added_files
"$pobase/Makevars$nl"
4954 # Create po makefile parameterization, part 2.
4955 func_dest_tmpfilename
$pobase/POTFILES.
in
4956 func_emit_po_POTFILES_in
> "$tmpfile"
4957 if test -f "$destdir"/$pobase/POTFILES.
in; then
4958 if cmp "$destdir"/$pobase/POTFILES.
in "$tmpfile" > /dev
/null
; then
4962 echo "Updating $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
4963 mv -f "$destdir"/$pobase/POTFILES.
in "$destdir"/$pobase/POTFILES.
in~
4964 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.
in
4966 echo "Update $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
4972 echo "Creating $pobase/POTFILES.in"
4973 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.
in
4975 echo "Create $pobase/POTFILES.in"
4978 func_append added_files
"$pobase/POTFILES.in$nl"
4981 TP_URL
="http://translationproject.org/latest/"
4982 TP_RSYNC_URI
="translationproject.org::tp/latest/"
4984 echo "Fetching gnulib PO files from $TP_URL"
4985 (cd "$destdir"/$pobase \
4986 && { # Prefer rsync over wget if it is available, since it consumes
4987 # less network bandwidth, due to compression.
4988 if type rsync
2>/dev
/null |
grep / > /dev
/null
; then
4989 rsync
-Lrtz "${TP_RSYNC_URI}gnulib/" .
4991 wget
--quiet -r -l1 -nd -np -A.po
"${TP_URL}gnulib"
4996 echo "Fetch gnulib PO files from $TP_URL"
4998 # Create po/LINGUAS.
5000 func_dest_tmpfilename
$pobase/LINGUAS
5001 (cd "$destdir"/$pobase \
5002 && { echo '# Set of available languages.'
5003 LC_ALL
=C
ls -1 *.po |
sed -e 's,\.po$,,'
5006 if test -f "$destdir"/$pobase/LINGUAS
; then
5007 if cmp "$destdir"/$pobase/LINGUAS
"$tmpfile" > /dev
/null
; then
5010 echo "Updating $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
5011 mv -f "$destdir"/$pobase/LINGUAS
"$destdir"/$pobase/LINGUAS~
5012 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
5015 echo "Creating $pobase/LINGUAS"
5016 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
5017 func_append added_files
"$pobase/LINGUAS$nl"
5020 if test -f "$destdir"/$pobase/LINGUAS
; then
5021 echo "Update $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
5023 echo "Create $pobase/LINGUAS"
5028 # Create m4/gnulib-cache.m4.
5029 func_dest_tmpfilename
$m4base/gnulib-cache.
m4
5031 func_emit_copyright_notice
5033 echo "# This file represents the specification of how gnulib-tool is used."
5034 echo "# It acts as a cache: It is written and read by gnulib-tool."
5035 echo "# In projects that use version control, this file is meant to be put under"
5036 echo "# version control, like the configure.ac and various Makefile.am files."
5039 echo "# Specification in the form of a command-line invocation:"
5042 echo "# Specification in the form of a few gnulib-tool.m4 macro invocations:"
5043 # Store the local_gnulib_dir relative to destdir.
5044 case "$local_gnulib_dir" in
5046 relative_local_gnulib_dir
="$local_gnulib_dir" ;;
5049 /*) relative_local_gnulib_dir
="$local_gnulib_dir" ;;
5051 # destdir, local_gnulib_dir are both relative.
5052 func_relativize
"$destdir" "$local_gnulib_dir"
5053 relative_local_gnulib_dir
="$reldir" ;;
5056 echo "gl_LOCAL_DIR([$relative_local_gnulib_dir])"
5058 echo "$specified_modules" |
sed -e 's/^/ /g'
5060 test -z "$incobsolete" ||
echo "gl_WITH_OBSOLETE"
5061 test -z "$inc_cxx_tests" ||
echo "gl_WITH_CXX_TESTS"
5062 test -z "$inc_longrunning_tests" ||
echo "gl_WITH_LONGRUNNING_TESTS"
5063 test -z "$inc_privileged_tests" ||
echo "gl_WITH_PRIVILEGED_TESTS"
5064 test -z "$inc_unportable_tests" ||
echo "gl_WITH_UNPORTABLE_TESTS"
5065 test -z "$inc_all_tests" ||
echo "gl_WITH_ALL_TESTS"
5066 echo "gl_AVOID([$avoidlist])"
5067 echo "gl_SOURCE_BASE([$sourcebase])"
5068 echo "gl_M4_BASE([$m4base])"
5069 echo "gl_PO_BASE([$pobase])"
5070 echo "gl_DOC_BASE([$docbase])"
5071 echo "gl_TESTS_BASE([$testsbase])"
5072 test -z "$inctests" ||
echo "gl_WITH_TESTS"
5073 echo "gl_LIB([$libname])"
5074 if test -n "$lgpl"; then
5075 if test "$lgpl" = yes; then
5078 echo "gl_LGPL([$lgpl])"
5081 echo "gl_MAKEFILE_NAME([$makefile_name])"
5082 if test "$cond_dependencies" = true
; then
5083 echo "gl_CONDITIONAL_DEPENDENCIES"
5085 if test "$libtool" = true
; then
5088 echo "gl_MACRO_PREFIX([$macro_prefix])"
5089 echo "gl_PO_DOMAIN([$po_domain])"
5090 echo "gl_WITNESS_C_DOMAIN([$witness_c_macro])"
5091 if test -n "$vc_files"; then
5092 echo "gl_VC_FILES([$vc_files])"
5095 if test -f "$destdir"/$m4base/gnulib-cache.
m4; then
5096 if cmp "$destdir"/$m4base/gnulib-cache.
m4 "$tmpfile" > /dev
/null
; then
5100 echo "Updating $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
5101 mv -f "$destdir"/$m4base/gnulib-cache.
m4 "$destdir"/$m4base/gnulib-cache.
m4~
5102 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.
m4
5104 echo "Update $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
5108 echo "# gnulib-cache.m4 ends here"
5115 echo "Creating $m4base/gnulib-cache.m4"
5116 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.
m4
5118 echo "Create $m4base/gnulib-cache.m4"
5124 # Create m4/gnulib-comp.m4.
5125 func_dest_tmpfilename
$m4base/gnulib-comp.
m4
5127 echo "# DO NOT EDIT! GENERATED AUTOMATICALLY!"
5128 func_emit_copyright_notice
5130 echo "# This file represents the compiled summary of the specification in"
5131 echo "# gnulib-cache.m4. It lists the computed macro invocations that need"
5132 echo "# to be invoked from configure.ac."
5133 echo "# In projects that use version control, this file can be treated like"
5134 echo "# other built files."
5137 echo "# This macro should be invoked from $configure_ac, in the section"
5138 echo "# \"Checks for programs\", right after AC_PROG_CC, and certainly before"
5139 echo "# any checks for libraries, header files, types and library functions."
5140 echo "AC_DEFUN([${macro_prefix}_EARLY],"
5142 echo " m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
5143 echo " m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
5144 echo " m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
5145 echo " m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
5146 echo " AC_REQUIRE([gl_PROG_AR_RANLIB])"
5147 if test -n "$uses_subdirs"; then
5148 echo " AC_REQUIRE([AM_PROG_CC_C_O])"
5150 for module
in $final_modules; do
5152 if test -n "$module"; then
5153 echo "# Code from module $module:"
5154 func_get_autoconf_early_snippet
"$module"
5157 |
sed -e '/^$/d;' -e 's/^/ /'
5160 echo "# This macro should be invoked from $configure_ac, in the section"
5161 echo "# \"Check for header files, types and library functions\"."
5162 echo "AC_DEFUN([${macro_prefix}_INIT],"
5164 if test "$libtool" = true
; then
5165 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
5166 echo " gl_cond_libtool=true"
5168 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
5169 echo " gl_cond_libtool=false"
5171 echo " gl_ltlibdeps="
5173 if test "$auxdir" != "build-aux"; then
5174 sed_replace_build_aux
='
5176 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
5177 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
5181 sed_replace_build_aux
="$sed_noop"
5183 echo " gl_m4_base='$m4base'"
5184 func_emit_initmacro_start
$macro_prefix
5185 echo " gl_source_base='$sourcebase'"
5186 if test -n "$witness_c_macro"; then
5187 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$witness_c_macro])"
5189 func_emit_autoconf_snippets
"$main_modules" func_verify_module true false true
5190 if test -n "$witness_c_macro"; then
5191 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
5193 echo " # End of code from modules"
5194 func_emit_initmacro_end
$macro_prefix
5195 echo " gltests_libdeps="
5196 echo " gltests_ltlibdeps="
5197 func_emit_initmacro_start
${macro_prefix}tests
5198 echo " gl_source_base='$testsbase'"
5199 # Define a tests witness macro that depends on the package.
5200 # PACKAGE is defined by AM_INIT_AUTOMAKE, PACKAGE_TARNAME is defined by AC_INIT.
5201 # See <http://lists.gnu.org/archive/html/automake/2009-05/msg00145.html>.
5202 echo "changequote(,)dnl"
5203 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"
5204 echo "changequote([, ])dnl"
5205 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
5206 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
5207 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
5208 func_emit_autoconf_snippets
"$testsrelated_modules" func_verify_module true true true
5209 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
5210 func_emit_initmacro_end
${macro_prefix}tests
5211 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
5212 # created using libtool, because libtool already handles the dependencies.
5213 if test "$libtool" != true
; then
5214 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
5215 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
5216 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
5217 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
5218 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
5220 if $use_libtests; then
5221 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
5222 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
5225 func_emit_initmacro_done
$macro_prefix $sourcebase
5226 func_emit_initmacro_done
${macro_prefix}tests
$testsbase
5228 echo "# This macro records the list of files which have been installed by"
5229 echo "# gnulib-tool and may be removed by future gnulib-tool invocations."
5230 echo "AC_DEFUN([${macro_prefix}_FILE_LIST], ["
5231 echo "$files" |
sed -e 's,^, ,'
5234 if test -f "$destdir"/$m4base/gnulib-comp.
m4; then
5235 if cmp "$destdir"/$m4base/gnulib-comp.
m4 "$tmpfile" > /dev
/null
; then
5239 echo "Updating $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
5240 mv -f "$destdir"/$m4base/gnulib-comp.
m4 "$destdir"/$m4base/gnulib-comp.
m4~
5241 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.
m4
5243 echo "Update $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
5247 echo "# gnulib-comp.m4 ends here"
5254 echo "Creating $m4base/gnulib-comp.m4"
5255 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.
m4
5257 echo "Create $m4base/gnulib-comp.m4"
5263 if test -n "$inctests"; then
5264 # Create tests makefile.
5265 func_dest_tmpfilename
$testsbase/$makefile_am
5266 destfile
="$testsbase/$makefile_am"
5267 modules
="$testsrelated_modules"
5268 func_emit_tests_Makefile_am
"${macro_prefix}tests_WITNESS" > "$tmpfile"
5269 if test -f "$destdir"/$testsbase/$makefile_am; then
5270 if cmp "$destdir"/$testsbase/$makefile_am "$tmpfile" > /dev
/null
; then
5274 echo "Updating $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
5275 mv -f "$destdir"/$testsbase/$makefile_am "$destdir"/$testsbase/$makefile_am~
5276 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
5278 echo "Update $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
5284 echo "Creating $testsbase/$makefile_am"
5285 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
5287 echo "Create $testsbase/$makefile_am"
5290 func_append added_files
"$testsbase/$makefile_am$nl"
5294 if test "$vc_files" != false
; then
5295 # Update the .cvsignore and .gitignore files.
5296 { echo "$added_files" |
sed -e '/^$/d' -e 's,\([^/]*\)$,|A|\1,'
5297 echo "$removed_files" |
sed -e '/^$/d' -e 's,\([^/]*\)$,|R|\1,'
5298 # Treat gnulib-comp.m4 like an added file, even if it already existed.
5299 echo "$m4base/|A|gnulib-comp.m4"
5300 } | LC_ALL
=C
sort -t'|' -k1,1 > "$tmp"/fileset-changes
5301 { # Rearrange file descriptors. Needed because "while ... done < ..."
5302 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5303 exec 5<&0 < "$tmp"/fileset-changes
5304 func_update_ignorelist
()
5307 if test "$ignore" = .gitignore
; then
5308 # In a .gitignore file, "foo" applies to the current directory and all
5309 # subdirectories, whereas "/foo" applies to the current directory only.
5312 doubly_escaped_anchor
='\\/'
5316 doubly_escaped_anchor
=''
5318 if test -f "$destdir/$dir$ignore"; then
5319 if test -n "$dir_added" ||
test -n "$dir_removed"; then
5320 sed -e "s|^$anchor||" < "$destdir/$dir$ignore" | LC_ALL
=C
sort > "$tmp"/ignore
5321 (echo "$dir_added" |
sed -e '/^$/d' | LC_ALL
=C
sort -u \
5322 | LC_ALL
=C
join -v 1 - "$tmp"/ignore
> "$tmp"/ignore-added
5323 echo "$dir_removed" |
sed -e '/^$/d' | LC_ALL
=C
sort -u \
5324 | LC_ALL
=C
join -v 1 - "$tmp"/ignore
> "$tmp"/ignore-removed
5326 if test -s "$tmp"/ignore-added ||
test -s "$tmp"/ignore-removed
; then
5328 echo "Updating $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
5329 mv -f "$destdir/$dir$ignore" "$destdir/$dir$ignore"~
5330 { sed -e 's,/,\\/,g' -e 's,^,/^,' -e 's,$,\$/d,' < "$tmp"/ignore-removed
5331 if test -n "$anchor"; then sed -e 's,/,\\/,g' -e "s,^,/^${doubly_escaped_anchor}," -e 's,$,$/d,' < "$tmp"/ignore-removed
; fi
5332 } > "$tmp"/sed-ignore-removed
5333 { cat "$destdir/$dir$ignore"~
5334 sed -e "s|^|$anchor|" < "$tmp"/ignore-added
5335 } |
sed -f "$tmp"/sed-ignore-removed \
5336 > "$destdir/$dir$ignore"
5338 echo "Update $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
5343 if test -n "$dir_added"; then
5345 echo "Creating $destdir/$dir$ignore"
5347 if test "$ignore" = .cvsignore
; then
5349 # Automake generates Makefile rules that create .dirstamp files.
5352 echo "$dir_added" |
sed -e '/^$/d' -e "s|^|$anchor|" | LC_ALL
=C
sort -u
5353 } > "$destdir/$dir$ignore"
5355 echo "Create $destdir/$dir$ignore"
5365 if test -d "$destdir/CVS" ||
test -d "$destdir/${dir}CVS" ||
test -f "$destdir/${dir}.cvsignore"; then
5366 func_update_ignorelist .cvsignore
5368 if test -d "$destdir/.git" ||
test -f "$destdir/${dir}.gitignore"; then
5369 func_update_ignorelist .gitignore
5376 # Why not ''read next_dir op file'' ? Because the dir column can be empty.
5377 next_dir
=`echo "$line" | sed -e 's,|.*,,'`
5378 op
=`echo "$line" | sed -e 's,^[^|]*|\([^|]*\)|.*$,\1,'`
5379 file=`echo "$line" | sed -e 's,^[^|]*|[^|]*|,,'`
5380 if test "$next_dir" != "$last_dir"; then
5381 func_done_dir
"$last_dir" "$last_dir_added" "$last_dir_removed"
5382 last_dir
="$next_dir"
5387 A
) func_append last_dir_added
"$file$nl";;
5388 R
) func_append last_dir_removed
"$file$nl";;
5391 func_done_dir
"$last_dir" "$last_dir_added" "$last_dir_removed"
5398 echo "You may need to add #include directives for the following .h files."
5399 # Intersect $specified_modules and $main_modules
5400 # (since $specified_modules is not necessarily of subset of $main_modules
5401 # - some may have been skipped through --avoid, and since the elements of
5402 # $main_modules but not in $specified_modules can go away without explicit
5403 # notice - through changes in the module dependencies).
5404 echo "$specified_modules" > "$tmp"/modules1
# a sorted list, one module per line
5405 echo "$main_modules" > "$tmp"/modules2
# also a sorted list, one module per line
5406 # First the #include <...> directives without #ifs, sorted for convenience,
5407 # then the #include "..." directives without #ifs, sorted for convenience,
5408 # then the #include directives that are surrounded by #ifs. Not sorted.
5409 for module
in `LC_ALL=C join "$tmp"/modules1 "$tmp"/modules2`; do
5410 include_directive
=`func_get_include_directive "$module"`
5411 case "$nl$include_directive" in
5413 echo "$include_directive" 1>&5
5416 echo "$include_directive" |
grep -v 'include "' 1>&6
5417 echo "$include_directive" |
grep 'include "' 1>&7
5420 done 5> "$tmp"/include-if
6> "$tmp"/include-angles
7> "$tmp"/include-quotes
5422 LC_ALL
=C
sort -u "$tmp"/include-angles
5423 LC_ALL
=C
sort -u "$tmp"/include-quotes
5424 cat "$tmp"/include-if
5425 ) |
sed -e '/^$/d' -e 's/^/ /'
5426 rm -f "$tmp"/include-angles
"$tmp"/include-quotes
"$tmp"/include-if
5428 for module
in $main_modules; do
5429 func_get_link_directive
"$module"
5431 | LC_ALL
=C
sort -u |
sed -e '/^$/d' -e 's/^/ /' > "$tmp"/link
5432 if test `wc -l < "$tmp"/link` != 0; then
5434 echo "You may need to use the following Makefile variables when linking."
5435 echo "Use them in <program>_LDADD when linking a program, or"
5436 echo "in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library."
5442 echo "Don't forget to"
5443 if test "$makefile_am" = Makefile.am
; then
5444 echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
5446 echo " - \"include $makefile_name\" from within \"$sourcebase/Makefile.am\","
5448 if test -n "$pobase"; then
5449 echo " - add \"$pobase/Makefile.in\" to AC_CONFIG_FILES in $configure_ac,"
5451 if test -n "$inctests"; then
5452 if test "$makefile_am" = Makefile.am
; then
5453 echo " - add \"$testsbase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
5455 echo " - \"include $makefile_name\" from within \"$testsbase/Makefile.am\","
5459 while test $edit != $makefile_am_edits; do
5460 edit
=`expr $edit + 1`
5461 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
5462 eval var
=\"\
$makefile_am_edit${edit}_var
\"
5463 eval val
=\"\
$makefile_am_edit${edit}_val
\"
5464 if test -n "$var"; then
5465 echo " - mention \"${val}\" in ${var} in ${dir}Makefile.am,"
5468 if grep '^ *AC_PROG_CC_STDC' "$configure_ac" > /dev
/null
; then
5469 position_early_after
=AC_PROG_CC_STDC
5471 if grep '^ *AC_PROG_CC_C99' "$configure_ac" > /dev
/null
; then
5472 position_early_after
=AC_PROG_CC_C99
5474 position_early_after
=AC_PROG_CC
5477 echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after $position_early_after,"
5478 echo " - invoke ${macro_prefix}_INIT in $configure_ac."
5481 # func_create_testdir testdir modules
5483 # - local_gnulib_dir from --local-dir
5484 # - modcache true or false, from --cache-modules/--no-cache-modules
5485 # - auxdir directory relative to destdir where to place build aux files
5486 # - inctests true if tests should be included, blank otherwise
5487 # - incobsolete true if obsolete modules among dependencies should be
5488 # included, blank otherwise
5489 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
5491 # - excl_longrunning_tests true if long-runnings tests should be excluded,
5493 # - excl_privileged_tests true if tests that require root privileges should be
5494 # excluded, blank otherwise
5495 # - excl_unportable_tests true if tests that fail on some platforms should be
5496 # excluded, blank otherwise
5497 # - single_configure true if a single configure file should be generated,
5498 # false for a separate configure file for the tests
5499 # - avoidlist list of modules to avoid
5500 # - cond_dependencies true if --conditional-dependencies was given, false if
5501 # --no-conditional-dependencies was given, blank otherwise
5502 # - libtool true if --libtool was given, false if --no-libtool was
5503 # given, blank otherwise
5504 # - symbolic true if files should be symlinked, copied otherwise
5505 # - lsymbolic true if files from local_gnulib_dir should be symlinked,
5507 func_create_testdir
()
5511 if test -z "$modules"; then
5512 # All modules together.
5513 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
5514 # Except ftruncate, mountlist, which abort the configuration on mingw. FIXME.
5515 # Except lib-ignore, which leads to link errors when Sun C++ is used. FIXME.
5516 modules
=`func_all_modules`
5517 modules
=`for m in $modules; do case $m in config-h | ftruncate | mountlist | lib-ignore) ;; *) echo $m;; esac; done`
5519 specified_modules
="$modules"
5521 # Canonicalize the list of specified modules.
5522 specified_modules
=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
5524 # Unlike in func_import, here we want to include all kinds of tests for the
5525 # directly specified modules, but not for dependencies.
5526 inc_all_direct_tests
=true
5527 inc_all_indirect_tests
="$inc_all_tests"
5529 # Check that the license of every module is consistent with the license of
5531 saved_inctests
="$inctests"
5532 # When computing transitive closures, don't consider $module to depend on
5533 # $module-tests. Need this becauses tests are implicitly GPL and may depend
5534 # on GPL modules - therefore we don't want a warning in this case.
5536 for requested_module
in $specified_modules; do
5537 requested_license
=`func_get_license "$requested_module"`
5538 if test "$requested_license" != GPL
; then
5539 # Here we use func_modules_transitive_closure, not just
5540 # func_get_dependencies, so that we also detect weird situations like
5541 # an LGPL module which depends on a GPLed build tool module which depends
5543 modules
="$requested_module"
5544 func_modules_transitive_closure
5545 for module
in $modules; do
5546 license
=`func_get_license "$module"`
5548 'GPLed build tool') ;;
5549 'public domain' |
'unlimited' |
'unmodifiable license text') ;;
5551 case "$requested_license" in
5554 GPLv2
+ | LGPLv2
+) ;;
5555 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
5561 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
5567 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
5576 inctests
="$saved_inctests"
5578 # Subdirectory names.
5589 # Determine final module list.
5590 modules
="$specified_modules"
5591 func_modules_transitive_closure
5592 if test $verbose -ge 0; then
5593 func_show_module_list
5595 final_modules
="$modules"
5597 if $single_configure; then
5598 # Determine main module list and tests-related module list separately.
5599 func_modules_transitive_closure_separately
5602 if $single_configure; then
5603 # Determine whether a $testsbase/libtests.a is needed.
5604 func_determine_use_libtests
5607 # Add the dummy module if needed.
5608 if $single_configure; then
5609 func_modules_add_dummy_separately
5611 func_modules_add_dummy
5614 # Show banner notice of every module.
5615 if $single_configure; then
5616 modules
="$main_modules"
5622 # Determine final file list.
5623 if $single_configure; then
5624 func_modules_to_filelist_separately
5626 func_modules_to_filelist
5627 if test $verbose -ge 0; then
5629 echo "$files" |
sed -e 's/^/ /'
5632 # Add files for which the copy in gnulib is newer than the one that
5633 # "automake --add-missing --copy" would provide.
5634 files
="$files build-aux/config.guess"
5635 files
="$files build-aux/config.sub"
5636 files
=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
5638 rewritten
='%REWRITTEN%'
5639 sed_rewrite_files
="\
5640 s,^build-aux/,$rewritten$auxdir/,
5641 s,^doc/,$rewritten$docbase/,
5642 s,^lib/,$rewritten$sourcebase/,
5643 s,^m4/,$rewritten$m4base/,
5644 s,^tests/,$rewritten$testsbase/,
5645 s,^tests=lib/,$rewritten$testsbase/,
5649 # Create directories.
5650 for f
in $files; do echo $f; done \
5651 |
sed -e "$sed_rewrite_files" \
5652 |
sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
5653 | LC_ALL
=C
sort -u \
5655 { # Rearrange file descriptors. Needed because "while ... done < ..."
5656 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5657 exec 5<&0 < "$tmp"/dirs
5659 mkdir
-p "$testdir/$d"
5664 # Copy files or make symbolic links.
5666 for f
in $files; do echo $f; done \
5667 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_files" \
5670 { # Rearrange file descriptors. Needed because "while ... done < ..."
5671 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5672 exec 5<&0 < "$tmp"/files
5675 tests
=lib
/*) f
=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
5677 func_lookup_file
"$f"
5678 if test -n "$lookedup_tmp"; then
5679 cp -p "$lookedup_file" "$testdir/$g"
5681 ln "$lookedup_file" "$testdir/$g" 2>/dev
/null ||
5682 if { test -n "$symbolic" \
5683 ||
{ test -n "$lsymbolic" \
5684 && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; }; then
5685 func_ln
"$lookedup_file" "$testdir/$g"
5687 cp -p "$lookedup_file" "$testdir/$g"
5694 # Determine include_guard_prefix.
5695 func_compute_include_guard_prefix
5697 # Create Makefile.ams that are for testing.
5700 # No special edits are needed.
5703 # Create $sourcebase/Makefile.am.
5704 mkdir
-p "$testdir/$sourcebase"
5705 destfile
="$sourcebase/Makefile.am"
5706 if $single_configure; then
5707 modules
="$main_modules"
5709 func_emit_lib_Makefile_am
> "$testdir/$sourcebase/Makefile.am"
5710 any_uses_subdirs
="$uses_subdirs"
5712 # Create $m4base/Makefile.am.
5713 mkdir
-p "$testdir/$m4base"
5714 (echo "## Process this file with automake to produce Makefile.in."
5720 echo "EXTRA_DIST += "`echo "$f" | sed -e 's,^m4/,,'` ;;
5723 ) > "$testdir/$m4base/Makefile.am"
5725 subdirs
="$sourcebase $m4base"
5726 subdirs_with_configure_ac
=""
5728 if false
&& test -f "$testdir"/$m4base/gettext.
m4; then
5729 # Avoid stupid error message from automake:
5730 # "AM_GNU_GETTEXT used but `po' not in SUBDIRS"
5731 mkdir
-p "$testdir/po"
5732 (echo "## Process this file with automake to produce Makefile.in."
5733 ) > "$testdir/po/Makefile.am"
5734 func_append subdirs
" po"
5737 if test -n "$inctests"; then
5738 test -d "$testdir/$testsbase" || mkdir
"$testdir/$testsbase"
5739 if $single_configure; then
5740 # Create $testsbase/Makefile.am.
5741 destfile
="$testsbase/Makefile.am"
5742 modules
="$testsrelated_modules"
5743 func_emit_tests_Makefile_am
"${macro_prefix}tests_WITNESS" > "$testdir/$testsbase/Makefile.am"
5745 # Viewed from the $testsbase subdirectory, $auxdir is different.
5746 saved_auxdir
="$auxdir"
5747 auxdir
=`echo "$testsbase/" | sed -e 's%[^/][^/]*//*%../%g'`"$auxdir"
5748 # Create $testsbase/Makefile.am.
5750 destfile
="$testsbase/Makefile.am"
5751 func_emit_tests_Makefile_am
"" > "$testdir/$testsbase/Makefile.am"
5752 any_uses_subdirs
="$any_uses_subdirs$uses_subdirs"
5753 # Create $testsbase/configure.ac.
5754 (echo "# Process this file with autoconf to produce a configure script."
5755 echo "AC_INIT([dummy], [0])"
5756 echo "AC_CONFIG_AUX_DIR([$auxdir])"
5757 echo "AM_INIT_AUTOMAKE"
5759 echo "AC_CONFIG_HEADERS([config.h])"
5762 echo "AC_PROG_INSTALL"
5763 echo "AC_PROG_MAKE_SET"
5764 echo "gl_PROG_AR_RANLIB"
5766 if test -n "$uses_subdirs"; then
5767 echo "AM_PROG_CC_C_O"
5770 for module
in $modules; do
5772 if test -n "$module"; then
5774 gnumakefile | maintainer-makefile
)
5775 # These modules are meant to be used only in the top-level directory.
5778 func_get_autoconf_early_snippet
"$module"
5783 |
sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
5784 if test "$libtool" = true
; then
5785 echo "LT_INIT([win32-dll])"
5786 echo "LT_LANG([C++])"
5787 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
5788 echo "gl_cond_libtool=true"
5790 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
5791 echo "gl_cond_libtool=false"
5793 echo "gl_ltlibdeps="
5795 # Wrap the set of autoconf snippets into an autoconf macro that is then
5796 # invoked. This is needed because autoconf does not support AC_REQUIRE
5798 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
5799 # but we want the AC_REQUIRE to have its normal meaning (provide one
5800 # expansion of the required macro before the current point, and only one
5802 echo "AC_DEFUN([gl_INIT], ["
5803 sed_replace_build_aux
='
5805 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
5806 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
5809 echo "gl_m4_base='../$m4base'"
5810 func_emit_initmacro_start
$macro_prefix
5811 # We don't have explicit ordering constraints between the various
5812 # autoconf snippets. It's cleanest to put those of the library before
5813 # those of the tests.
5814 echo "gl_source_base='../$sourcebase'"
5815 func_emit_autoconf_snippets
"$modules" func_verify_nontests_module false false false
5816 echo "gl_source_base='.'"
5817 func_emit_autoconf_snippets
"$modules" func_verify_tests_module false false false
5818 func_emit_initmacro_end
$macro_prefix
5819 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
5820 # created using libtool, because libtool already handles the dependencies.
5821 if test "$libtool" != true
; then
5822 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
5823 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
5824 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
5825 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
5826 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
5829 func_emit_initmacro_done
$macro_prefix $sourcebase # FIXME use $sourcebase or $testsbase?
5833 # Usually $testsbase/config.h will be a superset of config.h. Verify this
5834 # by "merging" config.h into $testsbase/config.h; look out for gcc warnings.
5835 echo "AH_TOP([#include \"../config.h\"])"
5837 echo "AC_CONFIG_FILES([Makefile])"
5839 ) > "$testdir/$testsbase/configure.ac"
5840 auxdir
="$saved_auxdir"
5841 subdirs_with_configure_ac
="$subdirs_with_configure_ac $testsbase"
5843 func_append subdirs
" $testsbase"
5846 # Create Makefile.am.
5847 (echo "## Process this file with automake to produce Makefile.in."
5849 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
5851 echo "SUBDIRS = $subdirs"
5853 echo "ACLOCAL_AMFLAGS = -I $m4base"
5854 ) > "$testdir/Makefile.am"
5856 # Create configure.ac.
5857 (echo "# Process this file with autoconf to produce a configure script."
5858 echo "AC_INIT([dummy], [0])"
5859 if test "$auxdir" != "."; then
5860 echo "AC_CONFIG_AUX_DIR([$auxdir])"
5862 echo "AM_INIT_AUTOMAKE"
5864 echo "AC_CONFIG_HEADERS([config.h])"
5867 echo "AC_PROG_INSTALL"
5868 echo "AC_PROG_MAKE_SET"
5870 echo "# For autobuild."
5871 echo "AC_CANONICAL_BUILD"
5872 echo "AC_CANONICAL_HOST"
5874 echo "m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
5875 echo "m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
5876 echo "m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
5877 echo "m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
5879 echo "gl_PROG_AR_RANLIB"
5881 if test -n "$any_uses_subdirs"; then
5882 echo "AM_PROG_CC_C_O"
5885 for module
in $final_modules; do
5886 if $single_configure; then
5889 func_verify_nontests_module
5891 if test -n "$module"; then
5892 func_get_autoconf_early_snippet
"$module"
5895 |
sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
5896 if test "$libtool" = true
; then
5897 echo "LT_INIT([win32-dll])"
5898 echo "LT_LANG([C++])"
5899 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
5900 echo "gl_cond_libtool=true"
5902 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
5903 echo "gl_cond_libtool=false"
5905 echo "gl_ltlibdeps="
5907 # Wrap the set of autoconf snippets into an autoconf macro that is then
5908 # invoked. This is needed because autoconf does not support AC_REQUIRE
5910 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
5911 # but we want the AC_REQUIRE to have its normal meaning (provide one
5912 # expansion of the required macro before the current point, and only one
5914 echo "AC_DEFUN([gl_INIT], ["
5915 if test "$auxdir" != "build-aux"; then
5916 sed_replace_build_aux
='
5918 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
5919 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
5923 sed_replace_build_aux
="$sed_noop"
5925 echo "gl_m4_base='$m4base'"
5926 func_emit_initmacro_start
$macro_prefix
5927 echo "gl_source_base='$sourcebase'"
5928 if $single_configure; then
5929 func_emit_autoconf_snippets
"$main_modules" func_verify_module true false false
5931 func_emit_autoconf_snippets
"$modules" func_verify_nontests_module true false false
5933 func_emit_initmacro_end
$macro_prefix
5934 if $single_configure; then
5935 echo " gltests_libdeps="
5936 echo " gltests_ltlibdeps="
5937 func_emit_initmacro_start
${macro_prefix}tests
5938 echo " gl_source_base='$testsbase'"
5939 # Define a tests witness macro.
5940 echo " ${macro_prefix}tests_WITNESS=IN_GNULIB_TESTS"
5941 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
5942 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
5943 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
5944 func_emit_autoconf_snippets
"$testsrelated_modules" func_verify_module true false false
5945 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
5946 func_emit_initmacro_end
${macro_prefix}tests
5948 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
5949 # created using libtool, because libtool already handles the dependencies.
5950 if test "$libtool" != true
; then
5951 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
5952 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
5953 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
5954 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
5955 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
5957 if $single_configure; then
5958 if $use_libtests; then
5959 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
5960 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
5964 func_emit_initmacro_done
$macro_prefix $sourcebase
5965 if $single_configure; then
5966 func_emit_initmacro_done
${macro_prefix}tests
$testsbase
5971 if test -n "$subdirs_with_configure_ac"; then
5972 echo "AC_CONFIG_SUBDIRS(["`echo $subdirs_with_configure_ac`"])"
5974 makefiles
="Makefile"
5975 for d
in $subdirs; do
5976 # For subdirs that have a configure.ac by their own, it's the subdir's
5977 # configure.ac which creates the subdir's Makefile.am, not this one.
5978 case " $subdirs_with_configure_ac " in
5980 *) func_append makefiles
" $d/Makefile" ;;
5983 echo "AC_CONFIG_FILES([$makefiles])"
5985 ) > "$testdir/configure.ac"
5987 # Create autogenerated files.
5989 # Do not use "${AUTORECONF} --force --install", because it may invoke
5990 # autopoint, which brings in older versions of some of our .m4 files.
5991 if test -f $m4base/gettext.
m4; then
5992 func_execute_command
${AUTOPOINT} --force || func_exit
1
5993 for f
in $m4base/*.
m4~
; do
5995 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit
1
5999 if test "$libtool" = true
; then
6000 func_execute_command
${LIBTOOLIZE} --copy || func_exit
1
6002 func_execute_command
${ACLOCAL} -I $m4base || func_exit
1
6003 if ! test -d build-aux
; then
6004 func_execute_command mkdir build-aux || func_exit
1
6006 func_execute_command
${AUTOCONF} || func_exit
1
6007 func_execute_command
${AUTOHEADER} || func_exit
1
6008 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6010 if test -n "$inctests" && ! $single_configure; then
6011 # Create autogenerated files.
6012 (cd "$testdir/$testsbase" || func_exit
1
6013 # Do not use "${AUTORECONF} --force --install", because it may invoke
6014 # autopoint, which brings in older versions of some of our .m4 files.
6015 if test -f ..
/$m4base/gettext.
m4; then
6016 func_execute_command
${AUTOPOINT} --force || func_exit
1
6017 for f
in ..
/$m4base/*.
m4~
; do
6019 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit
1
6023 func_execute_command
${ACLOCAL} -I ..
/$m4base || func_exit
1
6024 if ! test -d ..
/build-aux
; then
6025 func_execute_command mkdir ..
/build-aux
6027 func_execute_command
${AUTOCONF} || func_exit
1
6028 func_execute_command
${AUTOHEADER} || func_exit
1
6029 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6032 # Need to run configure and make once, to create built files that are to be
6033 # distributed (such as parse-datetime.c).
6034 sed_remove_make_variables
='s,[$]([A-Za-z0-9_]*),,g'
6035 # Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...".
6036 cleaned_files
=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \
6037 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
6038 cleaned_files
=`for file in $cleaned_files; do echo " $file "; done`
6039 # Extract the value of "BUILT_SOURCES += ...". Remove variable references
6040 # such $(FOO_H) because they don't refer to distributed files.
6041 built_sources
=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \
6042 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
6043 | sed -e "$sed_remove_make_variables"`
6044 distributed_built_sources
=`for file in $built_sources; do
6045 case "$cleaned_files" in
6050 tests_distributed_built_sources
=
6051 if test -n "$inctests"; then
6052 # Likewise for built files in the $testsbase directory.
6053 tests_cleaned_files
=`sed -e "$sed_remove_backslash_newline" < "$testdir/$testsbase/Makefile.am" \
6054 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
6055 tests_cleaned_files
=`for file in $tests_cleaned_files; do echo " $file "; done`
6056 tests_built_sources
=`sed -e "$sed_remove_backslash_newline" < "$testdir/$testsbase/Makefile.am" \
6057 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
6058 | sed -e "$sed_remove_make_variables"`
6059 tests_distributed_built_sources
=`for file in $tests_built_sources; do
6060 case "$tests_cleaned_files" in
6066 if test -n "$distributed_built_sources" ||
test -n "$tests_distributed_built_sources"; then
6068 .
/configure || func_exit
1
6069 if test -n "$distributed_built_sources"; then
6071 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
6072 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6077 if test -n "$tests_distributed_built_sources"; then
6079 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
6080 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6085 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6092 # func_create_megatestdir megatestdir allmodules
6094 # - local_gnulib_dir from --local-dir
6095 # - modcache true or false, from --cache-modules/--no-cache-modules
6096 # - auxdir directory relative to destdir where to place build aux files
6097 func_create_megatestdir
()
6101 if test -z "$allmodules"; then
6102 allmodules
=`func_all_modules`
6106 # First, all modules one by one.
6107 for onemodule
in $allmodules; do
6108 func_create_testdir
"$megatestdir/$onemodule" $onemodule
6109 func_append megasubdirs
"$onemodule "
6111 # Then, all modules all together.
6112 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
6113 allmodules
=`for m in $allmodules; do if test $m != config-h; then echo $m; fi; done`
6114 func_create_testdir
"$megatestdir/ALL" "$allmodules"
6115 func_append megasubdirs
"ALL"
6118 cvsdate
=`if test -f "$gnulib_dir/CVS/Entries"; then \
6119 vc_witness="$gnulib_dir/CVS/Entries"; \
6121 vc_witness="$gnulib_dir/.git/refs/heads/master"; \
6123 sh "$gnulib_dir/build-aux/mdate-sh" "$vc_witness" \
6124 | sed -e 's,January,01,' -e 's,Jan,01,' \
6125 -e 's,February,02,' -e 's,Feb,02,' \
6126 -e 's,March,03,' -e 's,Mar,03,' \
6127 -e 's,April,04,' -e 's,Apr,04,' \
6129 -e 's,June,06,' -e 's,Jun,06,' \
6130 -e 's,July,07,' -e 's,Jul,07,' \
6131 -e 's,August,08,' -e 's,Aug,08,' \
6132 -e 's,September,09,' -e 's,Sep,09,' \
6133 -e 's,October,10,' -e 's,Oct,10,' \
6134 -e 's,November,11,' -e 's,Nov,11,' \
6135 -e 's,December,12,' -e 's,Dec,12,' \
6136 -e 's,^,00,' -e 's,^[0-9]*\([0-9][0-9] \),\1,' \
6137 -e 's,^\([0-9]*\) \([0-9]*\) \([0-9]*\),\3\2\1,'`
6139 echo "CVSDATE=$cvsdate"
6140 echo ": \${MAKE=make}"
6141 echo "test -d logs || mkdir logs"
6142 echo "for module in $megasubdirs; do"
6143 echo " echo \"Working on module \$module...\""
6144 echo " safemodule=\`echo \$module | sed -e 's|/|-|g'\`"
6145 echo " (echo \"To: gnulib@autobuild.josefsson.org\""
6148 echo " : autobuild project... \$module"
6149 echo " : autobuild revision... cvs-\$CVSDATE-000000"
6150 echo " : autobuild timestamp... \`date \"+%Y%m%d-%H%M%S\"\`"
6151 echo " : autobuild hostname... \`hostname\`"
6152 echo " cd \$module && ./configure \$CONFIGURE_OPTIONS && \$MAKE && \$MAKE check && \$MAKE distclean"
6154 echo " ) 2>&1 | { if test -n \"\$AUTOBUILD_SUBST\"; then sed -e \"\$AUTOBUILD_SUBST\"; else cat; fi; } > logs/\$safemodule"
6156 ) > "$megatestdir/do-autobuild"
6157 chmod a
+x
"$megatestdir/do-autobuild"
6159 # Create Makefile.am.
6160 (echo "## Process this file with automake to produce Makefile.in."
6162 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
6164 echo "SUBDIRS = $megasubdirs"
6166 echo "EXTRA_DIST = do-autobuild"
6167 ) > "$megatestdir/Makefile.am"
6169 # Create configure.ac.
6170 (echo "# Process this file with autoconf to produce a configure script."
6171 echo "AC_INIT([dummy], [0])"
6172 if test "$auxdir" != "."; then
6173 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6175 echo "AM_INIT_AUTOMAKE"
6177 echo "AC_PROG_MAKE_SET"
6179 echo "AC_CONFIG_SUBDIRS([$megasubdirs])"
6180 echo "AC_CONFIG_FILES([Makefile])"
6182 ) > "$megatestdir/configure.ac"
6184 # Create autogenerated files.
6186 # Do not use "${AUTORECONF} --install", because autoreconf operates
6187 # recursively, but the subdirectories are already finished, therefore
6188 # calling autoreconf here would only waste lots of CPU time.
6189 func_execute_command
${ACLOCAL} || func_exit
1
6190 func_execute_command mkdir build-aux
6191 func_execute_command
${AUTOCONF} || func_exit
1
6192 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6198 func_fatal_error
"no mode specified" ;;
6205 # sed expression that converts a literal to a basic regular expression.
6206 # Needs to handle . [ \ * ^ $.
6207 sed_literal_to_basic_regex
='s/\\/\\\\/g
6213 if test -f "$gnulib_dir/$filename" \
6214 ||
{ test -n "$local_gnulib_dir" && test -f "$local_gnulib_dir/$filename"; }; then
6215 filename_anywhere_regex
=`echo "$filename" | sed -e "$sed_literal_to_basic_regex"`
6216 filename_line_regex
='^'"$filename_anywhere_regex"'$'
6219 (cd "$gnulib_dir" && find modules -type f -print | xargs -n 100 grep -l "$filename_line_regex" /dev/null | sed -e 's,^modules/,,')
6220 if test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules"; then
6221 (cd "$local_gnulib_dir" && find modules -type f -print | xargs -n 100 grep -l "$filename_anywhere_regex" /dev/null | sed -e 's,^modules/,,' -e 's,\.diff$,,')
6224 | func_sanitize_modulelist \
6227 for module
in $module_candidates; do
6228 if func_get_filelist
$module |
grep "$filename_line_regex" > /dev
/null
; then
6233 func_warning
"file $filename does not exist"
6238 import | add-import | remove-import | update
)
6241 if test -z "$destdir"; then
6244 test -d "$destdir" \
6245 || func_fatal_error
"destination directory does not exist: $destdir"
6247 # Prefer configure.ac to configure.in.
6248 if test -f "$destdir"/configure.ac
; then
6249 configure_ac
="$destdir/configure.ac"
6251 if test -f "$destdir"/configure.
in; then
6252 configure_ac
="$destdir/configure.in"
6254 func_fatal_error
"cannot find $destdir/configure.ac - make sure you run gnulib-tool from within your package's directory"
6258 # Analyze configure.ac.
6260 guessed_libtool
=false
6265 /AC_CONFIG_AUX_DIR/ {
6266 s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^]"$`\\)]*\).*$,guessed_auxdir="\1",p
6268 /A[CM]_PROG_LIBTOOL/ {
6269 s,^.*$,guessed_libtool=true,p
6271 eval `sed -n -e "$my_sed_traces" < "$configure_ac"`
6273 if test -z "$auxdir"; then
6274 auxdir
="$guessed_auxdir"
6277 # Determine where to apply func_import.
6278 if test "$mode" = import
; then
6279 # Apply func_import to a particular gnulib directory.
6280 # The command line contains the complete specification; don't look at
6281 # the contents of gnulib-cache.m4.
6282 test -n "$supplied_libname" || supplied_libname
=true
6283 test -n "$sourcebase" || sourcebase
="lib"
6284 test -n "$m4base" || m4base
="m4"
6285 test -n "$docbase" || docbase
="doc"
6286 test -n "$testsbase" || testsbase
="tests"
6287 test -n "$macro_prefix" || macro_prefix
="gl"
6290 if test -n "$m4base"; then
6291 # Apply func_import to a particular gnulib directory.
6292 # Any number of additional modules can be given.
6293 if test ! -f "$destdir/$m4base"/gnulib-cache.
m4; then
6294 # First use of gnulib in the given m4base.
6295 test -n "$supplied_libname" || supplied_libname
=true
6296 test -n "$sourcebase" || sourcebase
="lib"
6297 test -n "$docbase" || docbase
="doc"
6298 test -n "$testsbase" || testsbase
="tests"
6299 test -n "$macro_prefix" || macro_prefix
="gl"
6303 # Apply func_import to all gnulib directories.
6304 # To get this list of directories, look at Makefile.am. (Not at
6305 # configure, because it may be omitted from version control. Also,
6306 # don't run "find $destdir -name gnulib-cache.m4", as it might be
6310 if test -f "$destdir"/Makefile.am
; then
6311 aclocal_amflags
=`sed -n -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/p' "$destdir"/Makefile.am`
6313 for arg
in $aclocal_amflags; do
6314 if test -n "$m4dir_is_next"; then
6315 # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
6319 if test -f "$destdir/$arg"/gnulib-cache.
m4; then
6320 func_append m4dirs
" $arg"
6321 m4dirs_count
=`expr $m4dirs_count + 1`
6327 if test "X$arg" = "X-I"; then
6335 # No Makefile.am! Oh well. Look at the last generated aclocal.m4.
6336 if test -f "$destdir"/aclocal.
m4; then
6337 sedexpr1
='s,^m4_include(\[\(.*\)])$,\1,p'
6338 sedexpr2
='s,^[^/]*$,.,'
6339 sedexpr3
='s,/[^/]*$,,'
6340 m4dirs
=`sed -n -e "$sedexpr1" aclocal.m4 | sed -e "$sedexpr2" -e "$sedexpr3" | LC_ALL=C sort -u`
6341 m4dirs
=`for arg in $m4dirs; do if test -f "$destdir/$arg"/gnulib-cache.m4; then echo $arg; fi; done`
6342 m4dirs_count
=`for arg in $m4dirs; do echo "$arg"; done | wc -l`
6345 if test $m4dirs_count = 0; then
6346 # First use of gnulib in a package.
6347 # Any number of additional modules can be given.
6348 test -n "$supplied_libname" || supplied_libname
=true
6349 test -n "$sourcebase" || sourcebase
="lib"
6351 test -n "$docbase" || docbase
="doc"
6352 test -n "$testsbase" || testsbase
="tests"
6353 test -n "$macro_prefix" || macro_prefix
="gl"
6356 if test $m4dirs_count = 1; then
6357 # There's only one use of gnulib here. Assume the user means it.
6358 # Any number of additional modules can be given.
6359 for m4base
in $m4dirs; do
6363 # Ambiguous - guess what the user meant.
6364 if test $# = 0; then
6365 # No further arguments. Guess the user wants to update all of them.
6366 for m4base
in $m4dirs; do
6367 # Perform func_import in a subshell, so that variable values
6369 # local_gnulib_dir, incobsolete, inc_cxx_tests,
6370 # inc_longrunning_tests, inc_privileged_tests,
6371 # inc_unportable_tests, inc_all_tests, avoidlist, sourcebase,
6372 # m4base, pobase, docbase, testsbase, inctests, libname, lgpl,
6373 # makefile_name, libtool, macro_prefix, po_domain,
6374 # witness_c_macro, vc_files
6375 # don't propagate from one directory to another.
6376 (func_import
) || func_exit
1
6380 func_fatal_error
"Ambiguity: to which directory should the modules be added? Please specify at least --m4-base=..."
6389 if test -z "$destdir"; then
6390 func_fatal_error
"please specify --dir option"
6393 test -d "$destdir" \
6394 || func_fatal_error
"could not create destination directory"
6395 test -n "$auxdir" || auxdir
="build-aux"
6396 func_create_testdir
"$destdir" "$*"
6399 create-megatestdir
)
6400 if test -z "$destdir"; then
6401 func_fatal_error
"please specify --dir option"
6403 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
6404 test -n "$auxdir" || auxdir
="build-aux"
6405 func_create_megatestdir
"$destdir" "$*"
6409 test -n "$destdir" || destdir
=testdir$$
6410 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
6411 test -n "$auxdir" || auxdir
="build-aux"
6412 func_create_testdir
"$destdir" "$*"
6416 ..
/configure || func_exit
1
6417 $MAKE || func_exit
1
6418 $MAKE check || func_exit
1
6419 $MAKE distclean || func_exit
1
6420 remaining
=`find . -type f -print`
6421 if test -n "$remaining"; then
6422 echo "Remaining files:" $remaining 1>&2
6423 echo "gnulib-tool: *** Stop." 1>&2
6432 test -n "$destdir" || destdir
=testdir$$
6433 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
6434 test -n "$auxdir" || auxdir
="build-aux"
6435 func_create_megatestdir
"$destdir" "$*"
6443 remaining
=`find . -type f -print`
6444 if test -n "$remaining"; then
6445 echo "Remaining files:" $remaining 1>&2
6446 echo "gnulib-tool: *** Stop." 1>&2
6454 extract-description
)
6458 if test -n "$module"; then
6459 func_get_description
"$module"
6468 if test -n "$module"; then
6469 func_get_comment
"$module"
6478 if test -n "$module"; then
6479 func_get_status
"$module"
6488 if test -n "$module"; then
6489 func_get_notice
"$module"
6494 extract-applicability
)
6498 if test -n "$module"; then
6499 func_get_applicability
"$module"
6508 if test -n "$module"; then
6509 func_get_filelist
"$module"
6514 extract-dependencies
)
6515 if test -n "$avoidlist"; then
6516 func_fatal_error
"cannot combine --avoid and --extract-dependencies"
6521 if test -n "$module"; then
6522 func_get_dependencies
"$module"
6527 extract-autoconf-snippet
)
6531 if test -n "$module"; then
6532 func_get_autoconf_snippet
"$module"
6537 extract-automake-snippet
)
6541 if test -n "$module"; then
6542 func_get_automake_snippet
"$module"
6547 extract-include-directive
)
6551 if test -n "$module"; then
6552 func_get_include_directive
"$module"
6557 extract-link-directive
)
6561 if test -n "$module"; then
6562 func_get_link_directive
"$module"
6571 if test -n "$module"; then
6572 func_get_license
"$module"
6577 extract-maintainer
)
6581 if test -n "$module"; then
6582 func_get_maintainer
"$module"
6587 extract-tests-module
)
6591 if test -n "$module"; then
6592 func_get_tests_module
"$module"
6598 # Verify the number of arguments.
6599 if test $# -lt 1 ||
test $# -gt 2; then
6600 func_fatal_error
"invalid number of arguments for --$mode"
6603 # The first argument is the file to be copied.
6605 # Verify the file exists.
6606 func_lookup_file
"$f"
6608 # The second argument is the destination; either a directory ot a file.
6609 # It defaults to the current directory.
6611 test -n "$dest" || dest
='.'
6612 test -n "$sourcebase" || sourcebase
="lib"
6613 test -n "$m4base" || m4base
="m4"
6614 test -n "$docbase" || docbase
="doc"
6615 test -n "$testsbase" || testsbase
="tests"
6616 test -n "$auxdir" || auxdir
="build-aux"
6617 rewritten
='%REWRITTEN%'
6618 sed_rewrite_files
="\
6619 s,^build-aux/,$rewritten$auxdir/,
6620 s,^doc/,$rewritten$docbase/,
6621 s,^lib/,$rewritten$sourcebase/,
6622 s,^m4/,$rewritten$m4base/,
6623 s,^tests/,$rewritten$testsbase/,
6626 if test -d "$dest"; then
6628 g
=`echo "$f" | sed -e "$sed_rewrite_files"`
6630 destdir
=`dirname "$dest"`
6631 g
=`basename "$dest"`
6634 # Create the directory for destfile.
6635 d
=`dirname "$destdir/$g"`
6637 if test -n "$d" && test ! -d "$d"; then
6638 mkdir
-p "$d" || func_fatal_error
"failed"
6642 func_dest_tmpfilename
"$g"
6643 cp "$lookedup_file" "$tmpfile" || func_fatal_error
"failed"
6644 already_present
=true
6645 if test -f "$destdir/$g"; then
6646 # The file already exists.
6650 # Don't protest if the file should be there but isn't: it happens
6651 # frequently that developers don't put autogenerated files under version
6659 func_fatal_error
"unknown operation mode --$mode" ;;
6663 # Undo the effect of the previous 'trap' command. Some shellology:
6664 # We cannot use "trap - 0 1 2 3 13 15", because Solaris sh would attempt to
6665 # execute the command "-". "trap '' ..." is fine only for signal 0 (= normal
6666 # exit); for the others we need to call 'exit' explicitly. The value of $? is
6667 # 128 + signal number and is set before the trap-registered command is run.
6669 trap 'func_exit $?' 1 2 3 13 15
6674 # indent-tabs-mode: nil
6675 # whitespace-check-buffer-indent: nil