3 # Copyright (C) 2002-2012 Free Software Foundation, Inc.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 # This program is meant for authors or maintainers which want to import
20 # modules from gnulib into their packages.
28 # You can set AUTOCONFPATH to empty if autoconf 2.57 is already in your PATH.
32 # AUTOCONFBINDIR=/packages/gnu-inst-autoconf/2.57/bin
33 # AUTOCONFPATH="eval env PATH=${AUTOCONFBINDIR}:\$PATH "
37 # You can set AUTOMAKEPATH to empty if automake 1.9.x is already in your PATH.
40 # You can set GETTEXTPATH to empty if autopoint 0.15 is already in your PATH.
43 # You can set LIBTOOLPATH to empty if libtoolize 2.x is already in your PATH.
46 # If you didn't set AUTOCONFPATH and AUTOMAKEPATH, you can also set the
47 # variables AUTOCONF, AUTOHEADER, ACLOCAL, AUTOMAKE, AUTORECONF individually.
48 if test -z "${AUTOCONF}" ||
test -n "${AUTOCONFPATH}"; then
49 AUTOCONF
="${AUTOCONFPATH}autoconf"
51 if test -z "${AUTOHEADER}" ||
test -n "${AUTOCONFPATH}"; then
52 AUTOHEADER
="${AUTOCONFPATH}autoheader"
54 if test -z "${ACLOCAL}" ||
test -n "${AUTOMAKEPATH}"; then
55 ACLOCAL
="${AUTOMAKEPATH}aclocal"
57 if test -z "${AUTOMAKE}" ||
test -n "${AUTOMAKEPATH}"; then
58 AUTOMAKE
="${AUTOMAKEPATH}automake"
60 if test -z "${AUTORECONF}" ||
test -n "${AUTOCONFPATH}"; then
61 AUTORECONF
="${AUTOCONFPATH}autoreconf"
64 # If you didn't set GETTEXTPATH, you can also set the variable AUTOPOINT.
65 if test -z "${AUTOPOINT}" ||
test -n "${GETTEXTPATH}"; then
66 AUTOPOINT
="${GETTEXTPATH}autopoint"
69 # If you didn't set LIBTOOLPATH, you can also set the variable LIBTOOLIZE.
70 if test -z "${LIBTOOLIZE}" ||
test -n "${LIBTOOLPATH}"; then
71 LIBTOOLIZE
="${LIBTOOLPATH}libtoolize"
75 if test -z "${MAKE}"; then
79 # When using GNU sed, turn off as many GNU extensions as possible,
80 # to minimize the risk of accidentally using non-portable features.
81 # However, do this only for gnulib-tool itself, not for the code that
82 # gnulib-tool generates, since we don't want "sed --posix" to leak
83 # into makefiles. And do it only for sed versions 4.2 or newer,
84 # because "sed --posix" is buggy in GNU sed 4.1.5, see
85 # <http://lists.gnu.org/archive/html/bug-gnulib/2009-02/msg00225.html>.
86 if (alias) > /dev
/null
2>&1 \
87 && echo |
sed --posix -e d
>/dev
/null
2>&1 \
88 && case `sed --version | sed -e 's/^[^0-9]*//' -e 1q` in \
89 [1-3]* |
4.
[01]*) false
;; \
93 # Define sed as an alias.
94 # It is not always possible to use aliases. Aliases are guaranteed to work
95 # if the executing shell is bash and either it is invoked as /bin/sh or
96 # is a version >= 2.0, supporting shopt. This is the common case.
97 # Two other approaches (use of a variable $sed or of a function func_sed
98 # instead of an alias) require massive, fragile code changes.
99 # An other approach (use of function sed) requires `which sed` - but
100 # 'which' is hard to emulate, due to missing "test -x" on some platforms.
101 if test -n "$BASH_VERSION"; then
102 shopt -s expand_aliases
>/dev
/null
2>&1
104 alias sed='sed --posix'
107 # sed_noop is a sed expression that does nothing.
108 # An empty expression does not work with the native 'sed' on AIX 6.1.
111 # sed_comments is true or false, depending whether 'sed' supports comments.
112 # AIX 5.3 sed barfs over indented comments.
113 if echo fo |
sed -e 's/f/g/
116 s/o/e/' 2>/dev
/null |
grep ge
> /dev
/null
; then
123 # outputs to stdout the --help usage message.
127 Usage: gnulib-tool --list
128 gnulib-tool --find filename
129 gnulib-tool --import [module1 ... moduleN]
130 gnulib-tool --add-import [module1 ... moduleN]
131 gnulib-tool --remove-import [module1 ... moduleN]
133 gnulib-tool --create-testdir --dir=directory [module1 ... moduleN]
134 gnulib-tool --create-megatestdir --dir=directory [module1 ... moduleN]
135 gnulib-tool --test --dir=directory module1 ... moduleN
136 gnulib-tool --megatest --dir=directory [module1 ... moduleN]
137 gnulib-tool --extract-description module
138 gnulib-tool --extract-comment module
139 gnulib-tool --extract-status module
140 gnulib-tool --extract-notice module
141 gnulib-tool --extract-applicability module
142 gnulib-tool --extract-filelist module
143 gnulib-tool --extract-dependencies module
144 gnulib-tool --extract-autoconf-snippet module
145 gnulib-tool --extract-automake-snippet module
146 gnulib-tool --extract-include-directive module
147 gnulib-tool --extract-link-directive module
148 gnulib-tool --extract-license module
149 gnulib-tool --extract-maintainer module
150 gnulib-tool --extract-tests-module module
151 gnulib-tool --copy-file file [destination]
155 --list print the available module names
156 --find find the modules which contain the specified file
157 --import import the given modules into the current package
158 --add-import augment the list of imports from gnulib into the
159 current package, by adding the given modules;
160 if no modules are specified, update the current
161 package from the current gnulib
162 --remove-import reduce the list of imports from gnulib into the
163 current package, by removing the given modules
164 --update update the current package, restore files omitted
166 --create-testdir create a scratch package with the given modules
167 --create-megatestdir create a mega scratch package with the given modules
168 one by one and all together
169 --test test the combination of the given modules
170 (recommended to use CC=\"gcc -Wall\" here)
171 --megatest test the given modules one by one and all together
172 (recommended to use CC=\"gcc -Wall\" here)
173 --extract-description extract the description
174 --extract-comment extract the comment
175 --extract-status extract the status (obsolete etc.)
176 --extract-notice extract the notice or banner
177 --extract-applicability extract the applicability
178 --extract-filelist extract the list of files
179 --extract-dependencies extract the dependencies
180 --extract-autoconf-snippet extract the snippet for configure.ac
181 --extract-automake-snippet extract the snippet for library makefile
182 --extract-include-directive extract the #include directive
183 --extract-link-directive extract the linker directive
184 --extract-license report the license terms of the source files
186 --extract-maintainer report the maintainer(s) inside gnulib
187 --extract-tests-module report the unit test module, if it exists
188 --copy-file copy a file that is not part of any module
189 --help Show this help text.
190 --version Show version and authorship information.
194 --dir=DIRECTORY Specify the target directory.
195 For --import, this specifies where your
196 configure.ac can be found. Defaults to current
198 --local-dir=DIRECTORY Specify a local override directory where to look
199 up files before looking in gnulib's directory.
200 --cache-modules Enable module caching optimization.
201 --no-cache-modules Disable module caching optimization.
202 --verbose Increase verbosity. May be repeated.
203 --quiet Decrease verbosity. May be repeated.
205 Options for --import, --add/remove-import, --update:
207 --dry-run Only print what would have been done.
209 Options for --import, --add/remove-import:
211 --with-tests Include unit tests for the included modules.
213 Options for --create-[mega]testdir, --[mega]test:
215 --without-tests Don't include unit tests for the included modules.
217 Options for --import, --add/remove-import,
218 --create-[mega]testdir, --[mega]test:
220 --with-obsolete Include obsolete modules when they occur among the
221 dependencies. By default, dependencies to obsolete
223 --with-c++-tests Include even unit tests for C++ interoperability.
224 --without-c++-tests Exclude unit tests for C++ interoperability.
225 --with-longrunning-tests
226 Include even unit tests that are long-runners.
227 --without-longrunning-tests
228 Exclude unit tests that are long-runners.
229 --with-privileged-tests
230 Include even unit tests that require root
232 --without-privileged-tests
233 Exclude unit tests that require root privileges.
234 --with-unportable-tests
235 Include even unit tests that fail on some platforms.
236 --without-unportable-tests
237 Exclude unit tests that fail on some platforms.
238 --with-all-tests Include all kinds of problematic unit tests.
239 --avoid=MODULE Avoid including the given MODULE. Useful if you
240 have code that provides equivalent functionality.
241 This option can be repeated.
242 --conditional-dependencies
243 Support conditional dependencies (may save configure
244 time and object code).
245 --no-conditional-dependencies
246 Don't use conditional dependencies.
247 --libtool Use libtool rules.
248 --no-libtool Don't use libtool rules.
250 Options for --import, --add/remove-import:
252 --lib=LIBRARY Specify the library name. Defaults to 'libgnu'.
253 --source-base=DIRECTORY
254 Directory relative to --dir where source code is
255 placed (default \"lib\").
256 --m4-base=DIRECTORY Directory relative to --dir where *.m4 macros are
257 placed (default \"m4\").
258 --po-base=DIRECTORY Directory relative to --dir where *.po files are
259 placed (default \"po\").
260 --doc-base=DIRECTORY Directory relative to --dir where doc files are
261 placed (default \"doc\").
262 --tests-base=DIRECTORY
263 Directory relative to --dir where unit tests are
264 placed (default \"tests\").
265 --aux-dir=DIRECTORY Directory relative to --dir where auxiliary build
266 tools are placed (default comes from configure.ac).
267 --lgpl[=2|=3] Abort if modules aren't available under the LGPL.
268 Also modify license template from GPL to LGPL.
269 The version number of the LGPL can be specified;
270 the default is currently LGPLv3.
271 --makefile-name=NAME Name of makefile in automake syntax in the
272 source-base and tests-base directories
273 (default \"Makefile.am\").
274 --macro-prefix=PREFIX Specify the prefix of the macros 'gl_EARLY' and
275 'gl_INIT'. Default is 'gl'.
276 --po-domain=NAME Specify the prefix of the i18n domain. Usually use
277 the package name. A suffix '-gnulib' is appended.
278 --witness-c-macro=NAME Specify the C macro that is defined when the
279 sources in this directory are compiled or used.
280 --vc-files Update version control related files.
281 --no-vc-files Don't update version control related files
282 (.gitignore and/or .cvsignore).
283 --no-changelog Don't update or create ChangeLog files.
285 Options for --create-[mega]testdir, --[mega]test:
287 --single-configure Generate a single configure file, not a separate
288 configure file for the tests directory.
290 Options for --import, --add/remove-import, --update,
291 --create-[mega]testdir, --[mega]test:
293 -s, --symbolic, --symlink Make symbolic links instead of copying files.
294 --local-symlink Make symbolic links instead of copying files, only
295 for files from the local override directory.
297 Options for --import, --add/remove-import, --update:
299 -S, --more-symlinks Make symbolic links instead of copying files, and
300 don't replace copyright notices.
302 Report bugs to <bug-gnulib@gnu.org>."
306 # outputs to stdout the --version message.
310 if test -d "$gnulib_dir"/.git \
311 && (git
--version) >/dev
/null
2>/dev
/null \
312 && (date --version) >/dev
/null
2>/dev
/null
; then
313 # gnulib checked out from git.
314 sed_extract_first_date
='/^Date/{
318 date=`cd "$gnulib_dir" && git log ChangeLog | sed -n -e "$sed_extract_first_date"`
319 # Turn "Fri Mar 21 07:16:51 2008 -0600" into "Mar 21 2008 07:16:51 -0600".
320 sed_year_before_time
='s/^[^ ]* \([^ ]*\) \([0-9]*\) \([0-9:]*\) \([0-9]*\) /\1 \2 \4 \3 /'
321 date=`echo "$date" | sed -e "$sed_year_before_time"`
322 # Use GNU date to compute the time in GMT.
323 date=`date -d "$date" -u +"%Y-%m-%d %H:%M:%S"`
324 version
=' '`cd "$gnulib_dir" && ./build-aux/git-version-gen /dev/null | sed -e 's/-dirty/-modified/'`
326 if test -d "$gnulib_dir"/CVS \
327 && (cvs
--version) >/dev
/null
2>/dev
/null
; then
328 # gnulib checked out from CVS.
329 sed_extract_first_date
='/^date: /{
330 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
333 date=`cd "$gnulib_dir" && cvs log -N ChangeLog 2>/dev/null | sed -n -e "$sed_extract_first_date"`
335 # gnulib copy without versioning information.
336 date=`sed -e 's/ .*//;q' "$gnulib_dir"/ChangeLog`
340 year
=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed -e 's,^.* ,,'`
342 gnulib-tool (GNU $package $date)$version
343 Copyright (C) $year Free Software Foundation, Inc.
344 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
345 This is free software: you are free to change and redistribute it.
346 There is NO WARRANTY, to the extent permitted by law.
348 printf "Written by %s, %s, and %s.\n" "Bruno Haible" "Paul Eggert" "Simon Josefsson"
351 # func_emit_copyright_notice
352 # outputs to stdout a header for a generated file.
353 func_emit_copyright_notice
()
355 sed -n -e '/Copyright/ {
358 }' < "$self_abspathname"
360 echo "# This file is free software; you can redistribute it and/or modify"
361 echo "# it under the terms of the GNU General Public License as published by"
362 echo "# the Free Software Foundation; either version 3 of the License, or"
363 echo "# (at your option) any later version."
365 echo "# This file is distributed in the hope that it will be useful,"
366 echo "# but WITHOUT ANY WARRANTY; without even the implied warranty of"
367 echo "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
368 echo "# GNU General Public License for more details."
370 echo "# You should have received a copy of the GNU General Public License"
371 echo "# along with this file. If not, see <http://www.gnu.org/licenses/>."
373 echo "# As a special exception to the GNU General Public License,"
374 echo "# this file may be distributed as part of a program that"
375 echo "# contains a configuration script generated by Autoconf, under"
376 echo "# the same distribution terms as the rest of that program."
378 echo "# Generated by gnulib-tool."
382 # exits with a given status.
383 # This function needs to be used, rather than 'exit', when a 'trap' handler is
384 # in effect that refers to $?.
391 # locates the directory where the gnulib repository lives
393 # - progname name of this program
395 # - self_abspathname absolute pathname of gnulib-tool
396 # - gnulib_dir absolute pathname of gnulib repository
400 /*) self_abspathname
="$progname" ;;
401 */*) self_abspathname
=`pwd`/"$progname" ;;
404 # Iterate through the elements of $PATH.
405 # We use IFS=: instead of
406 # for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'`
407 # because the latter does not work when some PATH element contains spaces.
408 # We use a canonicalized $pathx instead of $PATH, because empty PATH
409 # elements are by definition equivalent to '.', however field splitting
410 # according to IFS=: loses empty fields in many shells:
411 # - /bin/sh on OSF/1 and Solaris loses all empty fields (at the
412 # beginning, at the end, and in the middle),
413 # - /bin/sh on IRIX and /bin/ksh on IRIX and OSF/1 lose empty fields
414 # at the beginning and at the end,
415 # - GNU bash, /bin/sh on AIX and HP-UX, and /bin/ksh on AIX, HP-UX,
416 # Solaris lose empty fields at the end.
417 # The 'case' statement is an optimization, to avoid evaluating the
418 # explicit canonicalization command when $PATH contains no empty fields.
420 if test "${PATH_SEPARATOR+set}" != set; then
421 # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
422 # contains only /bin. Note that ksh looks also at the FPATH variable,
423 # so we have to set that as well for the test.
425 (PATH
='/bin;/bin'; FPATH
=$PATH; sh
-c :) >/dev
/null
2>&1 \
426 && { (PATH
='/bin:/bin'; FPATH
=$PATH; sh
-c :) >/dev
/null
2>&1 \
427 || PATH_SEPARATOR
=';'
430 if test "$PATH_SEPARATOR" = ";"; then
431 # On Windows, programs are searched in "." before $PATH.
434 # On Unix, we have to convert empty PATH elements to ".".
438 pathx
=`echo ":$PATH:" | sed -e 's/:::*/:.:/g' -e 's/^://' -e 's/:\$//'`
443 IFS
="$PATH_SEPARATOR"
447 if test -x "$d/$progname" && test ! -d "$d/$progname"; then
448 self_abspathname
="$d/$progname"
453 if test -z "$self_abspathname"; then
454 func_fatal_error
"could not locate the gnulib-tool program - how did you invoke it?"
458 while test -h "$self_abspathname"; do
459 # Resolve symbolic link.
460 linkval
=`func_readlink "$self_abspathname"`
461 test -n "$linkval" ||
break
463 /* ) self_abspathname
="$linkval" ;;
464 * ) self_abspathname
=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;;
467 gnulib_dir
=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
471 # creates a temporary directory.
473 # - progname name of this program
475 # - tmp pathname of freshly created temporary directory
478 # Use the environment variable TMPDIR, falling back to /tmp. This allows
479 # users to specify a different temporary directory, for example, if their
480 # /tmp is filled up or too small.
483 # Use the mktemp program if available. If not available, hide the error
485 tmp
=`(umask 077 && mktemp -d "$TMPDIR/glXXXXXX") 2>/dev/null` &&
486 test -n "$tmp" && test -d "$tmp"
489 # Use a simple mkdir command. It is guaranteed to fail if the directory
490 # already exists. $RANDOM is bash specific and expands to empty in shells
491 # other than bash, ksh and zsh. Its use does not increase security;
492 # rather, it minimizes the probability of failure in a very cluttered /tmp
494 tmp
=$TMPDIR/gl$$
-$RANDOM
495 (umask 077 && mkdir
"$tmp")
498 echo "$progname: cannot create a temporary directory in $TMPDIR" >&2
503 # func_append var value
504 # appends the given value to the shell variable var.
505 if ( foo
=bar
; foo
+=baz
&& test "$foo" = barbaz
) >/dev
/null
2>&1; then
506 # Use bash's += operator. It reduces complexity of appending repeatedly to
507 # a single variable from O(n^2) to O(n).
512 fast_func_append
=true
516 eval "$1=\"\$$1\$2\""
518 fast_func_append
=false
521 # func_remove_prefix var prefix
522 # removes the given prefix from the value of the shell variable var.
523 # var should be the name of a shell variable.
524 # Its value should not contain a newline and not start or end with whitespace.
525 # prefix should not contain the characters "$`\{}[]^|.
526 if ( foo
=bar
; eval 'test "${foo#b}" = ar' ) >/dev
/null
2>&1; then
527 func_remove_prefix
()
531 fast_func_remove_prefix
=true
533 func_remove_prefix
()
535 eval "value=\"\$$1\""
539 sed_escape_dots
='s/\([.]\)/\\\1/g'
540 prefix
=`echo "$prefix" | sed -e "$sed_escape_dots"`
543 value
=`echo "$value" | sed -e "s|^${prefix}||"`
544 eval "$1=\"\$value\""
546 fast_func_remove_prefix
=false
549 # func_remove_suffix var suffix
550 # removes the given suffix from the value of the shell variable var.
551 # var should be the name of a shell variable.
552 # Its value should not contain a newline and not start or end with whitespace.
553 # suffix should not contain the characters "$`\{}[]^|.
554 if ( foo
=bar
; eval 'test "${foo%r}" = ba' ) >/dev
/null
2>&1; then
555 func_remove_suffix
()
559 fast_func_remove_suffix
=true
561 func_remove_suffix
()
563 eval "value=\"\$$1\""
567 sed_escape_dots
='s/\([.]\)/\\\1/g'
568 suffix
=`echo "$suffix" | sed -e "$sed_escape_dots"`
571 value
=`echo "$value" | sed -e "s|${suffix}\$||"`
572 eval "$1=\"\$value\""
574 fast_func_remove_suffix
=false
577 # func_fatal_error message
578 # outputs to stderr a fatal error message, and terminates the program.
580 # - progname name of this program
583 echo "$progname: *** $1" 1>&2
584 echo "$progname: *** Stop." 1>&2
588 # func_warning message
589 # Outputs to stderr a warning message,
592 echo "gnulib-tool: warning: $1" 1>&2
595 # func_readlink SYMLINK
596 # outputs the target of the given symlink.
597 if (type readlink
) > /dev
/null
2>&1; then
600 # Use the readlink program from GNU coreutils.
606 # Use two sed invocations. A single sed -n -e 's,^.* -> \(.*\)$,\1,p'
607 # would do the wrong thing if the link target contains " -> ".
608 LC_ALL
=C
ls -l "$1" |
sed -e 's, -> ,#%%#,' |
sed -n -e 's,^.*#%%#\(.*\)$,\1,p'
612 # func_relativize DIR1 DIR2
613 # computes a relative pathname RELDIR such that DIR1/RELDIR = DIR2.
615 # - DIR1 relative pathname, relative to the current directory
616 # - DIR2 relative pathname, relative to the current directory
618 # - reldir relative pathname of DIR2, relative to DIR1
624 sed_first
='s,^\([^/]*\)/.*$,\1,'
625 sed_rest
='s,^[^/]*/*,,'
626 sed_last
='s,^.*/\([^/]*\)$,\1,'
627 sed_butlast
='s,/*[^/]*$,,'
628 while test -n "$dir1"; do
629 first
=`echo "$dir1" | sed -e "$sed_first"`
630 if test "$first" != "."; then
631 if test "$first" = ".."; then
632 dir2
=`echo "$dir0" | sed -e "$sed_last"`/"$dir2"
633 dir0
=`echo "$dir0" | sed -e "$sed_butlast"`
635 first2
=`echo "$dir2" | sed -e "$sed_first"`
636 if test "$first2" = "$first"; then
637 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
641 dir0
="$dir0"/"$first"
644 dir1
=`echo "$dir1" | sed -e "$sed_rest"`
649 # func_relconcat DIR1 DIR2
650 # computes a relative pathname DIR1/DIR2, with obvious simplifications.
652 # - DIR1 relative pathname, relative to the current directory
653 # - DIR2 relative pathname, relative to DIR1
655 # - relconcat DIR1/DIR2, relative to the current directory
660 sed_first
='s,^\([^/]*\)/.*$,\1,'
661 sed_rest
='s,^[^/]*/*,,'
662 sed_last
='s,^.*/\([^/]*\)$,\1,'
663 sed_butlast
='s,/*[^/]*$,,'
665 first
=`echo "$dir2" | sed -e "$sed_first"`
666 if test "$first" = "."; then
667 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
668 if test -z "$dir2"; then
673 last
=`echo "$dir1" | sed -e "$sed_last"`
674 while test "$last" = "."; do
675 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
676 last
=`echo "$dir1" | sed -e "$sed_last"`
678 if test -z "$dir1"; then
682 if test "$first" = ".."; then
683 if test "$last" = ".."; then
684 relconcat
="$dir1/$dir2"
687 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
688 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
689 if test -z "$dir1"; then
693 if test -z "$dir2"; then
698 relconcat
="$dir1/$dir2"
706 # Like ln -s, except that SRC is given relative to the current directory (or
707 # absolute), not given relative to the directory of DEST.
713 *) # SRC is relative.
716 ln -s "`pwd`/$1" "$2" ;;
717 *) # DEST is relative too.
718 ln_destdir
=`echo "$2" | sed -e 's,[^/]*$,,'`
719 test -n "$ln_destdir" || ln_destdir
="."
720 func_relativize
"$ln_destdir" "$1"
728 # func_ln_if_changed SRC DEST
729 # Like func_ln, but avoids munging timestamps if the link is correct.
730 func_ln_if_changed
()
732 if test $# -ne 2; then
733 echo "usage: func_ln_if_changed SRC DEST" >&2
735 ln_target
=`func_readlink "$2"`
736 if test -h "$2" && test "$1" = "$ln_target"; then
744 # Ensure an 'echo' command that
745 # 1. does not interpret backslashes and
746 # 2. does not print an error message "broken pipe" when writing into a pipe
749 # Test cases for problem 1:
750 # echo '\n' | wc -l prints 1 when OK, 2 when KO
751 # echo '\t' | grep t > /dev/null has return code 0 when OK, 1 when KO
752 # Test cases for problem 2:
753 # echo hi | true frequently prints
754 # "bash: echo: write error: Broken pipe"
755 # to standard error in bash 3.2.
757 # Problem 1 is a weird heritage from SVR4. BSD got it right (except that
758 # BSD echo interprets '-n' as an option, which is also not desirable).
759 # Nowadays the problem occurs in 4 situations:
760 # - in bash, when the shell option xpg_echo is set (bash >= 2.04)
761 # or when it was built with --enable-usg-echo-default (bash >= 2.0)
762 # or when it was built with DEFAULT_ECHO_TO_USG (bash < 2.0),
763 # - in zsh, when sh-emulation is not set,
764 # - in ksh (e.g. AIX /bin/sh and Solaris /usr/xpg4/bin/sh are ksh instances,
765 # and HP-UX /bin/sh and IRIX /bin/sh behave similarly),
766 # - in Solaris /bin/sh and OSF/1 /bin/sh.
767 # We try the following workarounds:
768 # - for all: respawn using $CONFIG_SHELL if that is set and works.
769 # - for bash >= 2.04: unset the shell option xpg_echo.
770 # - for bash >= 2.0: define echo to a function that uses the printf built-in.
771 # - for bash < 2.0: define echo to a function that uses cat of a here document.
772 # - for zsh: turn sh-emulation on.
773 # - for ksh: alias echo to 'print -r'.
774 # - for ksh: alias echo to a function that uses cat of a here document.
775 # - for Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh and rely on
776 # the ksh workaround.
777 # - otherwise: respawn using /bin/sh and rely on the workarounds.
778 # When respawning, we pass --no-reexec as first argument, so as to avoid
779 # turning this script into a fork bomb in unlucky situations.
781 # Problem 2 is specific to bash 3.2 and affects the 'echo' built-in, but not
782 # the 'printf' built-in. See
783 # <http://lists.gnu.org/archive/html/bug-bash/2008-12/msg00050.html>
784 # <http://lists.gnu.org/archive/html/bug-gnulib/2010-02/msg00154.html>
785 # The workaround is: define echo to a function that uses the printf built-in.
787 if echo '\t' |
grep t
> /dev
/null
; then
788 have_echo
=yes # Lucky!
790 # Try the workarounds.
791 # Respawn using $CONFIG_SHELL if that is set and works.
792 if test -z "$have_echo" \
793 && test "X$1" != "X--no-reexec" \
794 && test -n "$CONFIG_SHELL" \
795 && test -f "$CONFIG_SHELL" \
796 && $CONFIG_SHELL -c "echo '\\t' | grep t > /dev/null"; then
797 exec $CONFIG_SHELL "$0" --no-reexec "$@"
800 # For bash >= 2.04: unset the shell option xpg_echo.
801 if test -z "$have_echo" \
802 && test -n "$BASH_VERSION" \
803 && (shopt -o xpg_echo
; echo '\t' |
grep t
> /dev
/null
) 2>/dev
/null
; then
807 # For bash >= 2.0: define echo to a function that uses the printf built-in.
808 # For bash < 2.0: define echo to a function that uses cat of a here document.
809 # (There is no win in using 'printf' over 'cat' if it is not a shell built-in.)
810 # Also handle problem 2, specific to bash 3.2, here.
811 if { test -z "$have_echo" \
812 ||
case "$BASH_VERSION" in 3.2*) true
;; *) false
;; esac; \
814 && test -n "$BASH_VERSION"; then \
815 if type printf 2>/dev
/null |
grep / > /dev
/null
; then
816 # 'printf' is not a shell built-in.
824 # 'printf' is a shell built-in.
830 if echo '\t' |
grep t
> /dev
/null
; then
834 # For zsh: turn sh-emulation on.
835 if test -z "$have_echo" \
836 && test -n "$ZSH_VERSION" \
837 && (emulate sh
) >/dev
/null
2>&1; then
840 # For ksh: alias echo to 'print -r'.
841 if test -z "$have_echo" \
842 && (type print
) >/dev
/null
2>&1; then
843 # A 'print' command exists.
844 if type print
2>/dev
/null |
grep / > /dev
/null
; then
847 # 'print' is a shell built-in.
848 if (print
-r '\told' |
grep told
> /dev
/null
) 2>/dev
/null
; then
849 # 'print' is the ksh shell built-in.
850 alias echo='print -r'
854 if test -z "$have_echo" \
855 && echo '\t' |
grep t
> /dev
/null
; then
858 # For ksh: alias echo to a function that uses cat of a here document.
859 # The ksh manual page says:
860 # "Aliasing is performed when scripts are read, not while they are executed.
861 # Therefore, for an alias to take effect, the alias definition command has
862 # to be executed before the command which references the alias is read."
863 # Because of this, we have to play strange tricks with have_echo, to ensure
864 # that the top-level statement containing the test starts after the 'alias'
866 if test -z "$have_echo"; then
873 if (alias echo=bsd_echo
) 2>/dev
/null
; then
874 alias echo=bsd_echo
2>/dev
/null
877 if test -z "$have_echo" \
878 && echo '\t' |
grep t
> /dev
/null
; then
881 if test -z "$have_echo"; then
882 if (alias echo=bsd_echo
) 2>/dev
/null
; then
883 unalias echo 2>/dev
/null
886 # For Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh.
887 if test -z "$have_echo" \
888 && test "X$1" != "X--no-reexec" \
889 && test -f /bin
/ksh
; then
890 exec /bin
/ksh
"$0" --no-reexec "$@"
893 # Otherwise: respawn using /bin/sh.
894 if test -z "$have_echo" \
895 && test "X$1" != "X--no-reexec" \
896 && test -f /bin
/sh
; then
897 exec /bin
/sh
"$0" --no-reexec "$@"
900 if test -z "$have_echo"; then
901 func_fatal_error
"Shell does not support 'echo' correctly. Please install GNU bash and set the environment variable CONFIG_SHELL to point to it."
903 if echo '\t' |
grep t
> /dev
/null
; then
906 func_fatal_error
"Shell does not support 'echo' correctly. Workaround does not work. Please report this as a bug to bug-gnulib@gnu.org."
908 if test "X$1" = "X--no-reexec"; then
912 # Command-line option processing.
913 # Removes the OPTIONS from the arguments. Sets the variables:
914 # - mode one of: list, find, import, add-import, remove-import,
915 # update, create-testdir, create-megatestdir, test, megatest,
917 # - destdir from --dir
918 # - local_gnulib_dir from --local-dir
919 # - modcache true or false, from --cache-modules/--no-cache-modules
920 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
921 # - libname, supplied_libname from --lib
922 # - sourcebase from --source-base
923 # - m4base from --m4-base
924 # - pobase from --po-base
925 # - docbase from --doc-base
926 # - testsbase from --tests-base
927 # - auxdir from --aux-dir
928 # - inctests true if --with-tests was given, false if --without-tests
929 # was given, blank otherwise
930 # - incobsolete true if --with-obsolete was given, blank otherwise
931 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
932 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
934 # - inc_privileged_tests true if --with-privileged-tests was given, blank
936 # - inc_unportable_tests true if --with-unportable-tests was given, blank
938 # - inc_all_tests true if --with-all-tests was given, blank otherwise
939 # - excl_cxx_tests true if --without-c++-tests was given, blank otherwise
940 # - excl_longrunning_tests true if --without-longrunning-tests was given,
942 # - excl_privileged_tests true if --without-privileged-tests was given, blank
944 # - excl_unportable_tests true if --without-unportable-tests was given, blank
946 # - single_configure true if --single-configure was given, false otherwise
947 # - avoidlist list of modules to avoid, from --avoid
948 # - cond_dependencies true if --conditional-dependencies was given, false if
949 # --no-conditional-dependencies was given, blank otherwise
950 # - lgpl yes or a number if --lgpl was given, blank otherwise
951 # - makefile_name from --makefile-name
952 # - libtool true if --libtool was given, false if --no-libtool was
953 # given, blank otherwise
954 # - macro_prefix from --macro-prefix
955 # - po_domain from --po-domain
956 # - witness_c_macro from --witness-c-macro
957 # - vc_files true if --vc-files was given, false if --no-vc-files was
958 # given, blank otherwise
959 # - autoconf_minversion minimum supported autoconf version
960 # - do_changelog false if --no-changelog was given, : otherwise
961 # - doit : if actions shall be executed, false if only to be printed
962 # - symbolic true if --symlink or --more-symlinks was given, blank
964 # - lsymbolic true if --local-symlink was given, blank otherwise
965 # - do_copyrights blank if --more-symlinks was given, true otherwise
983 inc_longrunning_tests
=
984 inc_privileged_tests
=
985 inc_unportable_tests
=
988 excl_longrunning_tests
=
989 excl_privileged_tests
=
990 excl_unportable_tests
=
991 single_configure
=false
1009 while test $# -gt 0; do
1014 --find |
--fin |
--fi |
--f )
1017 --import |
--impor |
--impo |
--imp |
--im |
--i )
1020 --add-import |
--add-impor |
--add-impo |
--add-imp |
--add-im |
--add-i |
--add- |
--add |
--ad )
1023 --remove-import |
--remove-impor |
--remove-impo |
--remove-imp |
--remove-im |
--remove-i |
--remove- |
--remove |
--remov |
--remo |
--rem |
--re |
--r )
1026 --update |
--updat |
--upda |
--upd |
--up |
--u )
1029 --create-testdir |
--create-testdi |
--create-testd |
--create-test |
--create-tes |
--create-te |
--create-t )
1032 --create-megatestdir |
--create-megatestdi |
--create-megatestd |
--create-megatest |
--create-megates |
--create-megate |
--create-megat |
--create-mega |
--create-meg |
--create-me |
--create-m )
1033 mode
=create-megatestdir
1035 --test |
--tes |
--te |
--t )
1038 --megatest |
--megates |
--megate |
--megat |
--mega |
--meg |
--me |
--m )
1042 mode
=`echo "X$1" | sed -e 's/^X--//'`
1044 --copy-file |
--copy-fil |
--copy-fi |
--copy-f |
--copy- |
--copy |
--cop )
1049 if test $# = 0; then
1050 func_fatal_error
"missing argument for --dir"
1055 destdir
=`echo "X$1" | sed -e 's/^X--dir=//'`
1059 if test $# = 0; then
1060 func_fatal_error
"missing argument for --local-dir"
1065 local_gnulib_dir
=`echo "X$1" | sed -e 's/^X--local-dir=//'`
1067 --cache-modules |
--cache-module |
--cache-modul |
--cache-modu |
--cache-mod |
--cache-mo |
--cache-m |
--cache- |
--cache |
--cach |
--cac |
--ca )
1070 --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 )
1073 --verbose |
--verbos |
--verbo |
--verb )
1074 verbose
=`expr $verbose + 1`
1076 --quiet |
--quie |
--qui |
--qu |
--q )
1077 verbose
=`expr $verbose - 1`
1081 if test $# = 0; then
1082 func_fatal_error
"missing argument for --lib"
1085 supplied_libname
=true
1088 libname
=`echo "X$1" | sed -e 's/^X--lib=//'`
1089 supplied_libname
=true
1093 if test $# = 0; then
1094 func_fatal_error
"missing argument for --source-base"
1099 sourcebase
=`echo "X$1" | sed -e 's/^X--source-base=//'`
1103 if test $# = 0; then
1104 func_fatal_error
"missing argument for --m4-base"
1109 m4base
=`echo "X$1" | sed -e 's/^X--m4-base=//'`
1113 if test $# = 0; then
1114 func_fatal_error
"missing argument for --po-base"
1119 pobase
=`echo "X$1" | sed -e 's/^X--po-base=//'`
1123 if test $# = 0; then
1124 func_fatal_error
"missing argument for --doc-base"
1129 docbase
=`echo "X$1" | sed -e 's/^X--doc-base=//'`
1133 if test $# = 0; then
1134 func_fatal_error
"missing argument for --tests-base"
1139 testsbase
=`echo "X$1" | sed -e 's/^X--tests-base=//'`
1143 if test $# = 0; then
1144 func_fatal_error
"missing argument for --aux-dir"
1149 auxdir
=`echo "X$1" | sed -e 's/^X--aux-dir=//'`
1151 --with-tests |
--with-test |
--with-tes |
--with-te |
--with-t)
1154 --with-obsolete |
--with-obsolet |
--with-obsole |
--with-obsol |
--with-obso |
--with-obs |
--with-ob |
--with-o)
1157 --with-c++-tests |
--with-c++-test |
--with-c++-tes |
--with-c++-te |
--with-c++-t |
--with-c++- |
--with-c++ |
--with-c+ |
--with-c)
1160 --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)
1161 inc_longrunning_tests
=true
1163 --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)
1164 inc_privileged_tests
=true
1166 --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)
1167 inc_unportable_tests
=true
1169 --with-all-tests |
--with-all-test |
--with-all-tes |
--with-all-te |
--with-all-t |
--with-all- |
--with-all |
--with-al |
--with-a)
1172 --without-tests |
--without-test |
--without-tes |
--without-te |
--without-t)
1175 --without-c++-tests |
--without-c++-test |
--without-c++-tes |
--without-c++-te |
--without-c++-t |
--without-c++- |
--without-c++ |
--without-c+ |
--without-c)
1178 --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)
1179 excl_longrunning_tests
=true
1181 --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)
1182 excl_privileged_tests
=true
1184 --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)
1185 excl_unportable_tests
=true
1187 --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)
1188 single_configure
=true
1192 if test $# = 0; then
1193 func_fatal_error
"missing argument for --avoid"
1195 func_append avoidlist
" $1"
1198 arg
=`echo "X$1" | sed -e 's/^X--avoid=//'`
1199 func_append avoidlist
" $arg"
1201 --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)
1202 cond_dependencies
=true
1204 --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)
1205 cond_dependencies
=false
1211 arg
=`echo "X$1" | sed -e 's/^X--lgpl=//'`
1214 *) func_fatal_error
"invalid LGPL version number for --lgpl" ;;
1220 if test $# = 0; then
1221 func_fatal_error
"missing argument for --makefile-name"
1226 makefile_name
=`echo "X$1" | sed -e 's/^X--makefile-name=//'`
1236 if test $# = 0; then
1237 func_fatal_error
"missing argument for --macro-prefix"
1242 macro_prefix
=`echo "X$1" | sed -e 's/^X--macro-prefix=//'`
1246 if test $# = 0; then
1247 func_fatal_error
"missing argument for --po-domain"
1252 po_domain
=`echo "X$1" | sed -e 's/^X--po-domain=//'`
1256 if test $# = 0; then
1257 func_fatal_error
"missing argument for --witness-c-macro"
1259 witness_c_macro
="$1"
1261 --witness-c-macro=* )
1262 witness_c_macro
=`echo "X$1" | sed -e 's/^X--witness-c-macro=//'`
1270 --no-changelog |
--no-changelo |
--no-changel |
--no-change |
--no-chang |
--no-chan |
--no-cha |
--no-ch )
1276 -s |
--symbolic |
--symboli |
--symbol |
--symbo |
--symb |
--symlink |
--symlin |
--symli |
--syml |
--sym |
--sy )
1279 --local-symlink |
--local-symlin |
--local-symli |
--local-syml |
--local-sym |
--local-sy |
--local-s )
1282 -S |
--more-symlinks |
--more-symlink |
--more-symlin |
--more-symli |
--more-syml |
--more-sym |
--more-sy |
--more-s |
--more- |
--more |
--mor |
--mo )
1286 --help |
--hel |
--he |
--h )
1289 --version |
--versio |
--versi |
--vers )
1293 # Stop option processing
1297 echo "gnulib-tool: unknown option $1" 1>&2
1298 echo "Try 'gnulib-tool --help' for more information." 1>&2
1305 if case "$mode" in import | add-import | remove-import
) true
;; *) false
;; esac; then
1306 if test -n "$excl_cxx_tests" ||
test -n "$excl_longrunning_tests" \
1307 ||
test -n "$excl_privileged_tests" ||
test -n "$excl_unportable_tests" \
1308 ||
test "$single_configure" != false
; then
1309 echo "gnulib-tool: invalid options for '$mode' mode" 1>&2
1310 echo "Try 'gnulib-tool --help' for more information." 1>&2
1314 if test "$mode" = update
; then
1315 if test $# != 0; then
1316 echo "gnulib-tool: too many arguments in 'update' mode" 1>&2
1317 echo "Try 'gnulib-tool --help' for more information." 1>&2
1318 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1319 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1322 if test -n "$local_gnulib_dir" ||
test -n "$supplied_libname" \
1323 ||
test -n "$sourcebase" ||
test -n "$m4base" ||
test -n "$pobase" \
1324 ||
test -n "$docbase" ||
test -n "$testsbase" ||
test -n "$auxdir" \
1325 ||
test -n "$inctests" ||
test -n "$incobsolete" \
1326 ||
test -n "$inc_cxx_tests" ||
test -n "$inc_longrunning_tests" \
1327 ||
test -n "$inc_privileged_tests" ||
test -n "$inc_unportable_tests" \
1328 ||
test -n "$inc_all_tests" \
1329 ||
test -n "$excl_cxx_tests" ||
test -n "$excl_longrunning_tests" \
1330 ||
test -n "$excl_privileged_tests" ||
test -n "$excl_unportable_tests" \
1331 ||
test -n "$avoidlist" ||
test -n "$lgpl" ||
test -n "$makefile_name" \
1332 ||
test -n "$macro_prefix" ||
test -n "$po_domain" \
1333 ||
test -n "$witness_c_macro" ||
test -n "$vc_files"; then
1334 echo "gnulib-tool: invalid options for 'update' mode" 1>&2
1335 echo "Try 'gnulib-tool --help' for more information." 1>&2
1336 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1337 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1342 if test -n "$pobase" && test -z "$po_domain"; then
1343 echo "gnulib-tool: together with --po-base, you need to specify --po-domain" 1>&2
1344 echo "Try 'gnulib-tool --help' for more information." 1>&2
1347 if test -z "$pobase" && test -n "$po_domain"; then
1348 func_warning
"--po-domain has no effect without a --po-base option"
1350 # Canonicalize the inctests variable.
1352 import | add-import | remove-import
)
1353 if test -z "$inctests"; then
1357 create-testdir | create-megatestdir |
test | megatest
)
1358 if test -z "$inctests"; then
1363 # Now the only possible values of "$inctests" are true and false
1364 # (or blank but then it is irrelevant).
1365 if test "$cond_dependencies" = true
&& test "$inctests" = true
; then
1366 echo "gnulib-tool: option --conditional-dependencies is not supported with --with-tests" 1>&2
1370 # Determine the minimum supported autoconf version from the project's
1372 DEFAULT_AUTOCONF_MINVERSION
="2.59"
1373 autoconf_minversion
=
1375 if case "$mode" in import | add-import | remove-import | update
) true
;; *) false
;; esac \
1376 && test -n "$destdir"; then
1377 if test -f "$destdir"/configure.ac
; then
1378 configure_ac
="$destdir/configure.ac"
1380 if test -f "$destdir"/configure.
in; then
1381 configure_ac
="$destdir/configure.in"
1385 if test -f configure.ac
; then
1386 configure_ac
="configure.ac"
1388 if test -f configure.
in; then
1389 configure_ac
="configure.in"
1393 if test -n "$configure_ac"; then
1394 # Use sed, not autoconf --trace, to look for the AC_PREREQ invocation,
1395 # because when some m4 files are omitted from a version control repository,
1396 # "autoconf --trace=AC_PREREQ" fails with an error message like this:
1397 # m4: aclocal.m4:851: Cannot open m4/absolute-header.m4: No such file or directory
1398 # autom4te: m4 failed with exit status: 1
1405 s,^.*AC_PREREQ([[ ]*\([^])]*\).*$,\1,p
1407 prereqs
=`sed -n -e "$my_sed_traces" < "$configure_ac"`
1408 if test -n "$prereqs"; then
1409 autoconf_minversion
=`
1410 for version in $prereqs; do echo $version; done |
1411 LC_ALL=C sort -nru | sed -e 1q
1415 if test -z "$autoconf_minversion"; then
1416 autoconf_minversion
=$DEFAULT_AUTOCONF_MINVERSION
1418 case "$autoconf_minversion" in
1419 1.
* |
2.
[0-4]* |
2.5[0-8]*)
1420 func_fatal_error
"minimum supported autoconf version is 2.59. Try adding AC_PREREQ([$DEFAULT_AUTOCONF_MINVERSION]) to your configure.ac." ;;
1423 # Remove trailing slashes from the directory names. This is necessary for
1424 # m4base (to avoid an error in func_import) and optional for the others.
1425 sed_trimtrailingslashes
='s,\([^/]\)//*$,\1,'
1426 case "$local_gnulib_dir" in
1427 */ ) local_gnulib_dir
=`echo "$local_gnulib_dir" | sed -e "$sed_trimtrailingslashes"` ;;
1429 case "$sourcebase" in
1430 */ ) sourcebase
=`echo "$sourcebase" | sed -e "$sed_trimtrailingslashes"` ;;
1433 */ ) m4base
=`echo "$m4base" | sed -e "$sed_trimtrailingslashes"` ;;
1436 */ ) pobase
=`echo "$pobase" | sed -e "$sed_trimtrailingslashes"` ;;
1439 */ ) docbase
=`echo "$docbase" | sed -e "$sed_trimtrailingslashes"` ;;
1441 case "$testsbase" in
1442 */ ) testsbase
=`echo "$testsbase" | sed -e "$sed_trimtrailingslashes"` ;;
1445 */ ) auxdir
=`echo "$auxdir" | sed -e "$sed_trimtrailingslashes"` ;;
1451 trap 'exit_status=$?
1452 if test "$signal" != 0; then
1453 echo "caught signal $signal" >&2
1456 exit $exit_status' 0
1457 for signal
in 1 2 3 13 15; do
1458 trap '{ signal='$signal'; func_exit 1; }' $signal
1462 # Note: The 'eval' silences stderr output in dash.
1463 if (declare -A x
&& { x
[f
/2]='foo'; x
[f
/3]='bar'; eval test '${x[f/2]}' = foo
; }) 2>/dev
/null
; then
1464 # Zsh 4 and Bash 4 have associative arrays.
1465 have_associative
=true
1467 # For other shells, use 'eval' with computed shell variable names.
1468 have_associative
=false
1471 # func_lookup_file file
1472 # looks up a file in $local_gnulib_dir or $gnulib_dir, or combines it through
1475 # - local_gnulib_dir from --local-dir
1477 # - lookedup_file name of the merged (combined) file
1478 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
1482 if test -n "$local_gnulib_dir" && test -f "$local_gnulib_dir/$lkfile"; then
1483 lookedup_file
="$local_gnulib_dir/$lkfile"
1486 if test -f "$gnulib_dir/$lkfile"; then
1487 if test -n "$local_gnulib_dir" && test -f "$local_gnulib_dir/$lkfile.diff"; then
1488 lkbase
=`echo "$lkfile" | sed -e 's,^.*/,,'`
1489 rm -f "$tmp/$lkbase"
1490 cp "$gnulib_dir/$lkfile" "$tmp/$lkbase"
1491 patch -s "$tmp/$lkbase" < "$local_gnulib_dir/$lkfile.diff" \
1492 || func_fatal_error
"patch file $local_gnulib_dir/$lkfile.diff didn't apply cleanly"
1493 lookedup_file
="$tmp/$lkbase"
1496 lookedup_file
="$gnulib_dir/$lkfile"
1500 func_fatal_error
"file $gnulib_dir/$lkfile not found"
1505 # func_sanitize_modulelist
1506 # receives a list of possible module names on standard input, one per line.
1507 # It removes those which are just file names unrelated to modules, and outputs
1508 # the resulting list to standard output, one per line.
1509 func_sanitize_modulelist
()
1511 sed -e '/^CVS\//d' -e '/\/CVS\//d' \
1512 -e '/^ChangeLog$/d' -e '/\/ChangeLog$/d' \
1513 -e '/^COPYING$/d' -e '/\/COPYING$/d' \
1514 -e '/^README$/d' -e '/\/README$/d' \
1515 -e '/^TEMPLATE$/d' \
1516 -e '/^TEMPLATE-EXTENDED$/d' \
1517 -e '/^TEMPLATE-TESTS$/d' \
1524 # - local_gnulib_dir from --local-dir
1527 # Filter out metainformation files like README, which are not modules.
1528 # Filter out unit test modules; they can be retrieved through
1529 # --extract-tests-module if desired.
1531 (cd "$gnulib_dir" && find modules
-type f
-print |
sed -e 's,^modules/,,')
1532 if test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules"; then
1533 (cd "$local_gnulib_dir" && find modules
-type f
-print |
sed -e 's,^modules/,,' -e 's,\.diff$,,')
1536 | func_sanitize_modulelist \
1537 |
sed -e '/-tests$/d' \
1541 # func_exists_module module
1542 # tests whether a module, given by name, exists
1544 # - local_gnulib_dir from --local-dir
1545 func_exists_module
()
1547 { test -f "$gnulib_dir/modules/$1" \
1548 ||
{ test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules" \
1549 && test -f "$local_gnulib_dir/modules/$1"; }; } \
1550 && test "CVS" != "$1" \
1551 && test "ChangeLog" != "$1" \
1552 && test "COPYING" != "$1" \
1553 && test "README" != "$1" \
1554 && test "TEMPLATE" != "$1" \
1555 && test "TEMPLATE-EXTENDED" != "$1" \
1556 && test "TEMPLATE-TESTS" != "$1"
1559 # func_verify_module
1560 # verifies a module name
1562 # - local_gnulib_dir from --local-dir
1563 # - module module name argument
1564 func_verify_module
()
1566 if func_exists_module
"$module"; then
1567 # OK, $module is a correct module name.
1568 # Verify that building the module description with 'patch' succeeds.
1569 func_lookup_file
"modules/$module"
1571 func_warning
"module $module doesn't exist"
1576 # func_verify_nontests_module
1577 # verifies a module name, excluding tests modules
1579 # - local_gnulib_dir from --local-dir
1580 # - module module name argument
1581 func_verify_nontests_module
()
1584 *-tests ) module
= ;;
1585 * ) func_verify_module
;;
1589 # func_verify_tests_module
1590 # verifies a module name, considering only tests modules
1592 # - local_gnulib_dir from --local-dir
1593 # - module module name argument
1594 func_verify_tests_module
()
1597 *-tests ) func_verify_module
;;
1602 # Suffix of a sed expression that extracts a particular field from a
1603 # module description.
1604 # A field starts with a line that contains a keyword, such as 'Description',
1605 # followed by a colon and optional whitespace. All following lines, up to
1606 # the next field (or end of file if there is none) form the contents of the
1608 # An absent field is equivalent to a field with empty contents.
1609 # NOTE: Keep this in sync with sed_extract_cache_prog below!
1610 sed_extract_prog
=':[ ]*$/ {
1613 s/^Description:[ ]*$//
1617 s/^Applicability:[ ]*$//
1619 s/^Depends-on:[ ]*$//
1620 s/^configure\.ac-early:[ ]*$//
1621 s/^configure\.ac:[ ]*$//
1622 s/^Makefile\.am:[ ]*$//
1626 s/^Maintainer:[ ]*$//
1633 # Piece of a sed expression that converts a field header line to a shell
1635 # NOTE: Keep this in sync with sed_extract_prog above!
1636 sed_extract_field_header
='
1637 s/^Description:[ ]*$/description/
1638 s/^Comment:[ ]*$/comment/
1639 s/^Status:[ ]*$/status/
1640 s/^Notice:[ ]*$/notice/
1641 s/^Applicability:[ ]*$/applicability/
1642 s/^Files:[ ]*$/files/
1643 s/^Depends-on:[ ]*$/dependson/
1644 s/^configure\.ac-early:[ ]*$/configureac_early/
1645 s/^configure\.ac:[ ]*$/configureac/
1646 s/^Makefile\.am:[ ]*$/makefile/
1647 s/^Include:[ ]*$/include/
1649 s/^License:[ ]*$/license/
1650 s/^Maintainer:[ ]*$/maintainer/'
1654 if $have_associative; then
1656 # Declare the associative arrays.
1657 declare -A modcache_cached
1658 sed_to_declare_statement
='s|^.*/\([a-zA-Z0-9_]*\)/$|declare -A modcache_\1|p'
1659 declare_script
=`echo "$sed_extract_field_header" | sed -n -e "$sed_to_declare_statement"`
1660 eval "$declare_script"
1664 # func_cache_var module
1665 # computes the cache variable name corresponding to $module.
1666 # Note: This computation can map different module names to the same
1667 # cachevar (such as 'foo-bar', 'foo_bar', or 'foo/bar'); the caller has
1668 # to protect against this case.
1670 # - cachevar a shell variable name
1671 if (f
=foo
; eval echo '${f//o/e}') < /dev
/null
2>/dev
/null |
grep fee
>/dev
/null
; then
1672 # Bash 2.0 and newer, ksh, and zsh support the syntax
1673 # ${param//pattern/replacement}
1674 # as a shorthand for
1675 # `echo "$param" | sed -e "s/pattern/replacement/g"`.
1676 # Note: The 'eval' is necessary for dash and NetBSD /bin/sh.
1677 eval 'func_cache_var ()
1679 cachevar=c_${1//[!a-zA-Z0-9_]/_}
1686 cachevar
=c_
`echo "$1" | LC_ALL=C sed -e 's/[^a-zA-Z0-9_]/_/g'` ;;
1695 # func_init_sed_convert_to_cache_statements
1697 # - modcachevar_assignment
1699 # - sed_convert_to_cache_statements
1700 func_init_sed_convert_to_cache_statements
()
1702 # 'sed' script that turns a module description into shell script
1703 # assignments, suitable to be eval'ed. All active characters are escaped.
1706 # Some module's description
1711 # modcache_description[$1]=\
1712 # 'Some module'"'"'s description
1714 # modcache_files[$1]=\
1717 # c_MODULE_description_set=set; c_MODULE_description=\
1718 # 'Some module'"'"'s description
1720 # c_MODULE_files_set=set; c_MODULE_files=\
1722 # The script consists of two parts:
1723 # 1) Ignore the lines before the first field header.
1724 # 2) A loop, treating non-field-header lines by escaping single quotes
1725 # and adding a closing quote in the last line,
1726 sed_convert_to_cache_statements
="
1728 # Here we have not yet seen a field header.
1730 # See if the current line contains a field header.
1733 ${sed_extract_field_header}
1736 # No field header. Ignore the line.
1738 # Read the next line. Upon EOF, just exit.
1743 # The current line contains a field header.
1745 # Turn it into the beginning of an assignment.
1746 s/^\\(.*\\)\$/${modcachevar_assignment}\\\\/
1748 # Move it to the hold space. Don't print it yet,
1749 # because we want no assignment if the field is empty.
1752 # Read the next line.
1753 # Upon EOF, the field was empty. Print no assignment. Just exit.
1756 # See if the current line contains a field header.
1759 ${sed_extract_field_header}
1760 # If it is, the previous field was empty. Print no assignment.
1763 # Not a field header.
1765 # Print the previous line, held in the hold space.
1770 # Transform single quotes.
1773 # Prepend a single quote.
1778 # Move it to the hold space.
1781 # Read the next line.
1788 # See if the current line contains a field header.
1791 ${sed_extract_field_header}
1794 # Print the previous line, held in the hold space.
1799 # Transform single quotes.
1806 # Print the previous line, held in the hold space, with a single quote
1807 # to end the assignment.
1817 # Print the previous line, held in the hold space, with a single quote
1818 # to end the assignment.
1825 if ! $sed_comments; then
1827 sed_convert_to_cache_statements
=`echo "$sed_convert_to_cache_statements" \
1828 | sed -e 's/^ *//' -e 's/^#.*//'`
1832 if $have_associative; then
1833 # sed_convert_to_cache_statements does not depend on the module.
1834 modcachevar_assignment
='modcache_\1[$1]='
1835 func_init_sed_convert_to_cache_statements
1838 # func_cache_lookup_module module
1840 # looks up a module, like 'func_lookup_file modules/$module', and stores all
1841 # of its relevant data in a cache in the memory of the processing shell. If
1842 # already cached, it does not look it up again, thus saving file access time.
1844 # - module non-empty string
1845 # Output if $have_associative:
1846 # - modcache_cached[$module] set to yes
1847 # - modcache_description[$module] ==
1848 # - modcache_status[$module] \ set to the field's value, minus the
1849 # - ... / final newline,
1850 # - modcache_maintainer[$module] == or unset if the field's value is empty
1851 # Output if ! $have_associative:
1852 # - cachevar a shell variable name
1853 # - ${cachevar}_cached set to $module
1854 # - ${cachevar}_description ==
1855 # - ${cachevar}_status \ set to the field's value, minus the
1856 # - ... / final newline,
1857 # - ${cachevar}_maintainer == or unset if the field's value is empty
1858 # - ${cachevar}_description_set ==
1859 # - ${cachevar}_status_set \ set to non-empty if the field's value
1860 # - ... / is non-empty,
1861 # - ${cachevar}_maintainer_set == or unset if the field's value is empty
1862 func_cache_lookup_module
()
1864 if $have_associative; then
1865 eval 'cached=${modcache_cached[$1]}'
1868 eval "cached=\"\$${cachevar}_cached\""
1870 if test -z "$cached"; then
1871 # Not found in cache. Look it up on the file system.
1872 func_lookup_file
"modules/$1"
1873 if $have_associative; then
1874 eval 'modcache_cached[$1]=yes'
1876 eval "${cachevar}_cached=\"\$1\""
1878 if ! $have_associative; then
1879 # sed_convert_to_cache_statements depends on the module.
1880 modcachevar_assignment
="${cachevar}"'_\1_set=set; '"${cachevar}"'_\1='
1881 func_init_sed_convert_to_cache_statements
1883 cache_statements
=`LC_ALL=C sed -n -e "$sed_convert_to_cache_statements" < "$lookedup_file"`
1884 eval "$cache_statements"
1886 if ! $have_associative; then
1887 if test "$1" != "$cached"; then
1888 func_fatal_error
"cache variable collision between $1 and $cached"
1896 # func_get_description module
1898 # - local_gnulib_dir from --local-dir
1899 # - modcache true or false, from --cache-modules/--no-cache-modules
1900 func_get_description
()
1902 if ! $modcache; then
1903 func_lookup_file
"modules/$1"
1904 sed -n -e "/^Description$sed_extract_prog" < "$lookedup_file"
1906 func_cache_lookup_module
"$1"
1907 # Output the field's value, including the final newline (if any).
1908 if $have_associative; then
1909 if eval 'test -n "${modcache_description[$1]+set}"'; then
1910 eval 'echo "${modcache_description[$1]}"'
1913 eval "field_set=\"\$${cachevar}_description_set\""
1914 if test -n "$field_set"; then
1915 eval "field_value=\"\$${cachevar}_description\""
1916 echo "${field_value}"
1922 # func_get_comment module
1924 # - local_gnulib_dir from --local-dir
1925 # - modcache true or false, from --cache-modules/--no-cache-modules
1928 if ! $modcache; then
1929 func_lookup_file
"modules/$1"
1930 sed -n -e "/^Comment$sed_extract_prog" < "$lookedup_file"
1932 func_cache_lookup_module
"$1"
1933 # Output the field's value, including the final newline (if any).
1934 if $have_associative; then
1935 if eval 'test -n "${modcache_comment[$1]+set}"'; then
1936 eval 'echo "${modcache_comment[$1]}"'
1939 eval "field_set=\"\$${cachevar}_comment_set\""
1940 if test -n "$field_set"; then
1941 eval "field_value=\"\$${cachevar}_comment\""
1942 echo "${field_value}"
1948 # func_get_status module
1950 # - local_gnulib_dir from --local-dir
1951 # - modcache true or false, from --cache-modules/--no-cache-modules
1954 if ! $modcache; then
1955 func_lookup_file
"modules/$1"
1956 sed -n -e "/^Status$sed_extract_prog" < "$lookedup_file"
1958 func_cache_lookup_module
"$1"
1959 # Output the field's value, including the final newline (if any).
1960 if $have_associative; then
1961 if eval 'test -n "${modcache_status[$1]+set}"'; then
1962 eval 'echo "${modcache_status[$1]}"'
1965 eval "field_set=\"\$${cachevar}_status_set\""
1966 if test -n "$field_set"; then
1967 eval "field_value=\"\$${cachevar}_status\""
1968 echo "${field_value}"
1974 # func_get_notice module
1976 # - local_gnulib_dir from --local-dir
1977 # - modcache true or false, from --cache-modules/--no-cache-modules
1980 if ! $modcache; then
1981 func_lookup_file
"modules/$1"
1982 sed -n -e "/^Notice$sed_extract_prog" < "$lookedup_file"
1984 func_cache_lookup_module
"$1"
1985 # Output the field's value, including the final newline (if any).
1986 if $have_associative; then
1987 if eval 'test -n "${modcache_notice[$1]+set}"'; then
1988 eval 'echo "${modcache_notice[$1]}"'
1991 eval "field_set=\"\$${cachevar}_notice_set\""
1992 if test -n "$field_set"; then
1993 eval "field_value=\"\$${cachevar}_notice\""
1994 echo "${field_value}"
2000 # func_get_applicability module
2002 # - local_gnulib_dir from --local-dir
2003 # - modcache true or false, from --cache-modules/--no-cache-modules
2004 # The expected result (on stdout) is either 'main', or 'tests', or 'all'.
2005 func_get_applicability
()
2007 if ! $modcache; then
2008 func_lookup_file
"modules/$1"
2009 my_applicability
=`sed -n -e "/^Applicability$sed_extract_prog" < "$lookedup_file"`
2011 func_cache_lookup_module
"$1"
2012 # Get the field's value, without the final newline.
2013 if $have_associative; then
2014 eval 'my_applicability="${modcache_applicability[$1]}"'
2016 eval "my_applicability=\"\$${cachevar}_applicability\""
2019 if test -n "$my_applicability"; then
2020 echo $my_applicability
2022 # The default is 'main' or 'tests', depending on the module's name.
2024 *-tests) echo "tests";;
2030 # func_get_filelist module
2032 # - local_gnulib_dir from --local-dir
2033 # - modcache true or false, from --cache-modules/--no-cache-modules
2034 func_get_filelist
()
2036 if ! $modcache; then
2037 func_lookup_file
"modules/$1"
2038 sed -n -e "/^Files$sed_extract_prog" < "$lookedup_file"
2040 func_cache_lookup_module
"$1"
2041 # Output the field's value, including the final newline (if any).
2042 if $have_associative; then
2043 if eval 'test -n "${modcache_files[$1]+set}"'; then
2044 eval 'echo "${modcache_files[$1]}"'
2047 eval "field_set=\"\$${cachevar}_files_set\""
2048 if test -n "$field_set"; then
2049 eval "field_value=\"\$${cachevar}_files\""
2050 echo "${field_value}"
2055 echo m
4/gnulib-common.
m4
2056 case "$autoconf_minversion" in
2063 # func_filter_filelist outputvar separator filelist prefix suffix removed_prefix removed_suffix [added_prefix [added_suffix]]
2064 # stores in outputvar the filtered and processed filelist. Filtering: Only the
2065 # elements starting with prefix and ending with suffix are considered.
2066 # Processing: removed_prefix and removed_suffix are removed from each element,
2067 # added_prefix and added_suffix are added to each element.
2068 # prefix, suffix should not contain shell-special characters.
2069 # removed_prefix, removed_suffix should not contain the characters "$`\{}[]^|.
2070 # added_prefix, added_suffix should not contain the characters \|&.
2071 func_filter_filelist
()
2073 if test "$2" != "$nl" \
2074 ||
{ $fast_func_append \
2075 && { test -z "$6" ||
$fast_func_remove_prefix; } \
2076 && { test -z "$7" ||
$fast_func_remove_suffix; }; \
2080 # Do not quote possibly-empty parameters in case patterns,
2081 # AIX and HP-UX ksh won't match them if they are empty.
2084 if test -n "$6"; then
2085 func_remove_prefix fff
"$6"
2087 if test -n "$7"; then
2088 func_remove_suffix fff
"$7"
2091 if test -z "$ffflist"; then
2094 func_append ffflist
"$2${fff}"
2100 sed_fff_filter
="s|^$6\(.*\)$7\$|$8\\1$9|"
2101 ffflist
=`for fff in $3; do
2103 $4*$5) echo "$fff" ;;
2105 done | sed -e "$sed_fff_filter"`
2107 eval "$1=\"\$ffflist\""
2110 # func_get_dependencies module
2112 # - local_gnulib_dir from --local-dir
2113 # - modcache true or false, from --cache-modules/--no-cache-modules
2114 func_get_dependencies
()
2116 # ${module}-tests implicitly depends on ${module}, if that module exists.
2120 func_remove_suffix fgd1
'-tests'
2121 if func_exists_module
"$fgd1"; then
2126 # Then the explicit dependencies listed in the module description.
2127 { if ! $modcache; then
2128 func_lookup_file
"modules/$1"
2129 sed -n -e "/^Depends-on$sed_extract_prog" < "$lookedup_file"
2131 func_cache_lookup_module
"$1"
2132 # Output the field's value, including the final newline (if any).
2133 if $have_associative; then
2134 if eval 'test -n "${modcache_dependson[$1]+set}"'; then
2135 eval 'echo "${modcache_dependson[$1]}"'
2138 eval "field_set=\"\$${cachevar}_dependson_set\""
2139 if test -n "$field_set"; then
2140 eval "field_value=\"\$${cachevar}_dependson\""
2141 echo "${field_value}"
2149 # func_get_autoconf_early_snippet module
2151 # - local_gnulib_dir from --local-dir
2152 # - modcache true or false, from --cache-modules/--no-cache-modules
2153 func_get_autoconf_early_snippet
()
2155 if ! $modcache; then
2156 func_lookup_file
"modules/$1"
2157 sed -n -e "/^configure\.ac-early$sed_extract_prog" < "$lookedup_file"
2159 func_cache_lookup_module
"$1"
2160 # Output the field's value, including the final newline (if any).
2161 if $have_associative; then
2162 if eval 'test -n "${modcache_configureac_early[$1]+set}"'; then
2163 eval 'echo "${modcache_configureac_early[$1]}"'
2166 eval "field_set=\"\$${cachevar}_configureac_early_set\""
2167 if test -n "$field_set"; then
2168 eval "field_value=\"\$${cachevar}_configureac_early\""
2169 echo "${field_value}"
2175 # func_get_autoconf_snippet module
2177 # - local_gnulib_dir from --local-dir
2178 # - modcache true or false, from --cache-modules/--no-cache-modules
2179 func_get_autoconf_snippet
()
2181 if ! $modcache; then
2182 func_lookup_file
"modules/$1"
2183 sed -n -e "/^configure\.ac$sed_extract_prog" < "$lookedup_file"
2185 func_cache_lookup_module
"$1"
2186 # Output the field's value, including the final newline (if any).
2187 if $have_associative; then
2188 if eval 'test -n "${modcache_configureac[$1]+set}"'; then
2189 eval 'echo "${modcache_configureac[$1]}"'
2192 eval "field_set=\"\$${cachevar}_configureac_set\""
2193 if test -n "$field_set"; then
2194 eval "field_value=\"\$${cachevar}_configureac\""
2195 echo "${field_value}"
2201 # func_get_automake_snippet_conditional module
2202 # returns the part of the Makefile.am snippet that can be put inside Automake
2205 # - local_gnulib_dir from --local-dir
2206 # - modcache true or false, from --cache-modules/--no-cache-modules
2207 func_get_automake_snippet_conditional
()
2209 if ! $modcache; then
2210 func_lookup_file
"modules/$1"
2211 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
2213 func_cache_lookup_module
"$1"
2214 # Output the field's value, including the final newline (if any).
2215 if $have_associative; then
2216 if eval 'test -n "${modcache_makefile[$1]+set}"'; then
2217 eval 'echo "${modcache_makefile[$1]}"'
2220 eval "field_set=\"\$${cachevar}_makefile_set\""
2221 if test -n "$field_set"; then
2222 eval "field_value=\"\$${cachevar}_makefile\""
2223 echo "${field_value}"
2229 # func_get_automake_snippet_unconditional module
2230 # returns the part of the Makefile.am snippet that must stay outside of
2231 # Automake conditionals.
2233 # - local_gnulib_dir from --local-dir
2234 # - modcache true or false, from --cache-modules/--no-cache-modules
2235 func_get_automake_snippet_unconditional
()
2239 # *-tests module live in tests/, not lib/.
2240 # Synthesize an EXTRA_DIST augmentation.
2241 all_files
=`func_get_filelist $1`
2242 func_filter_filelist tests_files
" " "$all_files" 'tests/' '' 'tests/' ''
2243 extra_files
="$tests_files"
2244 if test -n "$extra_files"; then
2245 echo "EXTRA_DIST +=" $extra_files
2250 # Synthesize an EXTRA_DIST augmentation.
2251 sed_combine_lines
='/\\$/{
2258 sed_extract_mentioned_files
='s/^lib_SOURCES[ ]*+=[ ]*//p'
2259 already_mentioned_files
=` \
2260 { if ! $modcache; then
2261 func_lookup_file "modules/$1"
2262 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
2264 func_cache_lookup_module "$1"
2265 if $have_associative; then
2266 if eval 'test -n "${modcache_makefile[$1]+set}"'; then
2267 eval 'echo "${modcache_makefile[$1]}"'
2270 eval 'field_set="$'"${cachevar}"'_makefile_set"'
2271 if test -n "$field_set"; then
2272 eval 'field_value="$'"${cachevar}"'_makefile"'
2273 echo "${field_value}"
2278 | sed -e "$sed_combine_lines" \
2279 | sed -n -e "$sed_extract_mentioned_files" | sed -e 's/#.*//'`
2280 all_files
=`func_get_filelist $1`
2281 func_filter_filelist lib_files
"$nl" "$all_files" 'lib/' '' 'lib/' ''
2282 # Remove $already_mentioned_files from $lib_files.
2283 echo "$lib_files" | LC_ALL
=C
sort -u > "$tmp"/lib-files
2284 extra_files
=`for f in $already_mentioned_files; do echo $f; done \
2285 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/lib-files`
2286 if test -n "$extra_files"; then
2287 echo "EXTRA_DIST +=" $extra_files
2290 # Synthesize also an EXTRA_lib_SOURCES augmentation.
2291 # This is necessary so that automake can generate the right list of
2293 # A possible approach would be to use autom4te --trace of the redefined
2294 # AC_LIBOBJ and AC_REPLACE_FUNCS macros when creating the Makefile.am
2295 # (use autom4te --trace, not just grep, so that AC_LIBOBJ invocations
2296 # inside autoconf's built-in macros are not missed).
2297 # But it's simpler and more robust to do it here, based on the file list.
2298 # If some .c file exists and is not used with AC_LIBOBJ - for example,
2299 # a .c file is preprocessed into another .c file for BUILT_SOURCES -,
2300 # automake will generate a useless dependency; this is harmless.
2302 relocatable-prog-wrapper
) ;;
2305 func_filter_filelist extra_files
"$nl" "$extra_files" '' '.c' '' ''
2306 if test -n "$extra_files"; then
2307 echo "EXTRA_lib_SOURCES +=" $extra_files
2312 # Synthesize an EXTRA_DIST augmentation also for the files in build-aux/.
2313 func_filter_filelist buildaux_files
"$nl" "$all_files" 'build-aux/' '' 'build-aux/' ''
2314 if test -n "$buildaux_files"; then
2315 sed_prepend_auxdir
='s,^,$(top_srcdir)/'"$auxdir"'/,'
2316 echo "EXTRA_DIST += "`echo "$buildaux_files" | sed -e "$sed_prepend_auxdir"`
2319 # Synthesize an EXTRA_DIST augmentation also for the files from top/.
2320 func_filter_filelist top_files
"$nl" "$all_files" 'top/' '' 'top/' ''
2321 if test -n "$top_files"; then
2322 sed_prepend_topdir
='s,^,$(top_srcdir)/,'
2323 echo "EXTRA_DIST += "`echo "$top_files" | sed -e "$sed_prepend_topdir"`
2330 # func_get_automake_snippet module
2332 # - local_gnulib_dir from --local-dir
2333 # - modcache true or false, from --cache-modules/--no-cache-modules
2334 func_get_automake_snippet
()
2336 func_get_automake_snippet_conditional
"$1"
2337 func_get_automake_snippet_unconditional
"$1"
2340 # func_get_include_directive module
2342 # - local_gnulib_dir from --local-dir
2343 # - modcache true or false, from --cache-modules/--no-cache-modules
2344 func_get_include_directive
()
2347 if ! $modcache; then
2348 func_lookup_file
"modules/$1"
2349 sed -n -e "/^Include$sed_extract_prog" < "$lookedup_file"
2351 func_cache_lookup_module
"$1"
2352 # Output the field's value, including the final newline (if any).
2353 if $have_associative; then
2354 if eval 'test -n "${modcache_include[$1]+set}"'; then
2355 eval 'echo "${modcache_include[$1]}"'
2358 eval "field_set=\"\$${cachevar}_include_set\""
2359 if test -n "$field_set"; then
2360 eval "field_value=\"\$${cachevar}_include\""
2361 echo "${field_value}"
2365 } |
sed -e 's/^\(["<]\)/#include \1/'
2368 # func_get_link_directive module
2370 # - local_gnulib_dir from --local-dir
2371 # - modcache true or false, from --cache-modules/--no-cache-modules
2372 func_get_link_directive
()
2374 if ! $modcache; then
2375 func_lookup_file
"modules/$1"
2376 sed -n -e "/^Link$sed_extract_prog" < "$lookedup_file"
2378 func_cache_lookup_module
"$1"
2379 # Output the field's value, including the final newline (if any).
2380 if $have_associative; then
2381 if eval 'test -n "${modcache_link[$1]+set}"'; then
2382 eval 'echo "${modcache_link[$1]}"'
2385 eval "field_set=\"\$${cachevar}_link_set\""
2386 if test -n "$field_set"; then
2387 eval "field_value=\"\$${cachevar}_link\""
2388 echo "${field_value}"
2394 # func_get_license_raw module
2396 # - local_gnulib_dir from --local-dir
2397 # - modcache true or false, from --cache-modules/--no-cache-modules
2398 func_get_license_raw
()
2400 if ! $modcache; then
2401 func_lookup_file
"modules/$1"
2402 sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
2404 func_cache_lookup_module
"$1"
2405 # Output the field's value, including the final newline (if any).
2406 if $have_associative; then
2407 if eval 'test -n "${modcache_license[$1]+set}"'; then
2408 eval 'echo "${modcache_license[$1]}"'
2411 eval "field_set=\"\$${cachevar}_license_set\""
2412 if test -n "$field_set"; then
2413 eval "field_value=\"\$${cachevar}_license\""
2414 echo "${field_value}"
2420 # func_get_license module
2422 # - local_gnulib_dir from --local-dir
2423 # - modcache true or false, from --cache-modules/--no-cache-modules
2426 # Warn if the License field is missing.
2430 license
=`func_get_license_raw "$1"`
2431 if test -z "$license"; then
2432 func_warning
"module $1 lacks a License"
2437 func_get_license_raw
"$1"
2438 # The default is GPL.
2440 } |
sed -e 's,^ *$,,' |
sed -e 1q
2443 # func_get_maintainer module
2445 # - local_gnulib_dir from --local-dir
2446 # - modcache true or false, from --cache-modules/--no-cache-modules
2447 func_get_maintainer
()
2449 if ! $modcache; then
2450 func_lookup_file
"modules/$1"
2451 sed -n -e "/^Maintainer$sed_extract_prog" < "$lookedup_file"
2453 func_cache_lookup_module
"$1"
2454 # Output the field's value, including the final newline (if any).
2455 if $have_associative; then
2456 if eval 'test -n "${modcache_maintainer[$1]+set}"'; then
2457 eval 'echo "${modcache_maintainer[$1]}"'
2460 eval "field_set=\"\$${cachevar}_maintainer_set\""
2461 if test -n "$field_set"; then
2462 eval "field_value=\"\$${cachevar}_maintainer\""
2463 echo "${field_value}"
2469 # func_get_tests_module module
2471 # - local_gnulib_dir from --local-dir
2472 func_get_tests_module
()
2474 # The naming convention for tests modules is hardwired: ${module}-tests.
2475 if test -f "$gnulib_dir/modules/$1"-tests \
2476 ||
{ test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules" \
2477 && test -f "$local_gnulib_dir/modules/$1"-tests; }; then
2482 # func_acceptable module
2483 # tests whether a module is acceptable.
2485 # - avoidlist list of modules to avoid
2488 for avoid
in $avoidlist; do
2489 if test "$avoid" = "$1"; then
2496 # sed expression to keep the first 32 characters of each line.
2497 sed_first_32_chars
='s/^\(................................\).*/\1/'
2499 # func_module_shellfunc_name module
2500 # computes the shell function name that will contain the m4 macros for the module.
2502 # - macro_prefix prefix to use
2504 # - shellfunc shell function name
2505 func_module_shellfunc_name
()
2509 shellfunc
=func_
${macro_prefix}_gnulib_m4code_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2511 shellfunc
=func_
${macro_prefix}_gnulib_m4code_
$1 ;;
2515 # func_module_shellvar_name module
2516 # computes the shell variable name the will be set to true once the m4 macros
2517 # for the module have been executed.
2519 # - shellvar shell variable name
2520 func_module_shellvar_name
()
2524 shellvar
=${macro_prefix}_gnulib_enabled_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2526 shellvar
=${macro_prefix}_gnulib_enabled_
$1 ;;
2530 # func_module_conditional_name module
2531 # computes the automake conditional name for the module.
2533 # - conditional name of automake conditional
2534 func_module_conditional_name
()
2538 conditional
=${macro_prefix}_GNULIB_ENABLED_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2540 conditional
=${macro_prefix}_GNULIB_ENABLED_
$1 ;;
2544 # func_uncond_add_module B
2545 # notes the presence of B as an unconditional module.
2547 # func_conddep_add_module A B cond
2548 # notes the presence of a conditional dependency from module A to module B,
2549 # subject to the condition that A is enabled and cond is true.
2551 # func_cond_module_p B
2552 # tests whether module B is conditional.
2554 # func_cond_module_condition A B
2555 # returns the condition when B should be enabled as a dependency of A, once the
2556 # m4 code for A has been executed.
2557 # Output: - condition
2559 if $have_associative; then
2560 declare -A conddep_isuncond
2561 declare -A conddep_dependers
2562 declare -A conddep_condition
2563 func_uncond_add_module
()
2565 eval 'conddep_isuncond[$1]=true'
2566 eval 'unset conddep_dependers[$1]'
2568 func_conddep_add_module
()
2570 eval 'isuncond="${conddep_isuncond[$2]}"'
2571 if test -z "$isuncond"; then
2572 # No unconditional dependency to B known at this point.
2573 eval 'conddep_dependers[$2]="${conddep_dependers[$2]} $1"'
2574 eval 'conddep_condition[$1---$2]="$3"'
2577 func_cond_module_p
()
2579 eval 'previous_dependers="${conddep_dependers[$1]}"'
2580 test -n "$previous_dependers"
2582 func_cond_module_condition
()
2584 eval 'condition="${conddep_condition[$1---$2]}"'
2587 func_uncond_add_module
()
2591 suffix
=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2595 eval 'conddep_isuncond_'"$suffix"'=true'
2596 eval 'unset conddep_dependers_'"$suffix"
2598 func_conddep_add_module
()
2602 suffix
=`echo "$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2606 eval 'isuncond="${conddep_isuncond_'"$suffix"'}"'
2607 if test -z "$isuncond"; then
2608 eval 'conddep_dependers_'"$suffix"'="${conddep_dependers_'"$suffix"'} $1"'
2609 suffix
=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
2610 eval 'conddep_condition_'"$suffix"'="$3"'
2613 func_cond_module_p
()
2617 suffix
=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2621 eval 'previous_dependers="${conddep_dependers_'"$suffix"'}"'
2622 test -n "$previous_dependers"
2624 func_cond_module_condition
()
2626 suffix
=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
2627 eval 'condition="${conddep_condition_'"$suffix"'}"'
2631 sed_dependencies_without_conditions
='s/ *\[.*//'
2633 # func_modules_transitive_closure
2635 # - local_gnulib_dir from --local-dir
2636 # - modcache true or false, from --cache-modules/--no-cache-modules
2637 # - modules list of specified modules
2638 # - inctests true if tests should be included, false otherwise
2639 # - incobsolete true if obsolete modules among dependencies should be
2640 # included, blank otherwise
2641 # - inc_cxx_tests true if C++ interoperability tests should be included,
2643 # - inc_longrunning_tests true if long-runnings tests should be included,
2645 # - inc_privileged_tests true if tests that require root privileges should be
2646 # included, blank otherwise
2647 # - inc_unportable_tests true if tests that fail on some platforms should be
2648 # included, blank otherwise
2649 # - inc_all_direct_tests true if all kinds of problematic unit tests among
2650 # the unit tests of the specified modules should be
2651 # included, blank otherwise
2652 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
2653 # the unit tests of the dependencies should be
2654 # included, blank otherwise
2655 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
2657 # - excl_longrunning_tests true if long-runnings tests should be excluded,
2659 # - excl_privileged_tests true if tests that require root privileges should be
2660 # excluded, blank otherwise
2661 # - excl_unportable_tests true if tests that fail on some platforms should be
2662 # excluded, blank otherwise
2663 # - avoidlist list of modules to avoid
2664 # - cond_dependencies true if conditional dependencies shall be supported,
2666 # - tmp pathname of a temporary directory
2668 # - modules list of modules, including dependencies
2669 # - conddep_dependers, conddep_condition information about conditionally
2671 func_modules_transitive_closure
()
2673 sed_escape_dependency
='s|\([/.]\)|\\\1|g'
2674 # In order to process every module only once (for speed), process an "input
2675 # list" of modules, producing an "output list" of modules. During each round,
2676 # more modules can be queued in the input list. Once a module on the input
2677 # list has been processed, it is added to the "handled list", so we can avoid
2678 # to process it again.
2680 inmodules
="$modules"
2682 fmtc_inc_all_tests
="$inc_all_direct_tests"
2683 if test "$cond_dependencies" = true
; then
2684 for module
in $inmodules; do
2686 if test -n "$module"; then
2687 if func_acceptable
$module; then
2688 func_uncond_add_module
$module
2693 while test -n "$inmodules"; do
2694 inmodules_this_round
="$inmodules"
2695 inmodules
= # Accumulator, queue for next round
2696 for module
in $inmodules_this_round; do
2698 if test -n "$module"; then
2699 if func_acceptable
$module; then
2700 func_append outmodules
" $module"
2701 if test "$cond_dependencies" = true
; then
2702 if func_get_automake_snippet_conditional
$module |
grep '^if ' > /dev
/null
; then
2703 # A module whose Makefile.am snippet contains a reference to an
2704 # automake conditional. If we were to use it conditionally, we
2705 # would get an error
2706 # configure: error: conditional "..." was never defined.
2707 # because automake 1.11.1 does not handle nested conditionals
2708 # correctly. As a workaround, make the module unconditional.
2709 func_uncond_add_module
$module
2711 if func_cond_module_p
$module; then
2717 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
2718 # Duplicate dependencies are harmless, but Jim wants a warning.
2719 duplicated_deps
=`echo "$deps" | LC_ALL=C sort | LC_ALL=C uniq -d`
2720 if test -n "$duplicated_deps"; then
2721 func_warning
"module $module has duplicated dependencies: "`echo $duplicated_deps`
2724 testsmodule
=`func_get_tests_module $module`
2725 if test -n "$testsmodule"; then
2726 deps
="$deps $testsmodule"
2729 for dep
in $deps; do
2730 # Determine whether to include the dependency or tests module.
2732 for word
in `func_get_status $dep`; do
2735 test -n "$incobsolete" \
2739 test -z "$excl_cxx_tests" \
2741 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_cxx_tests" \
2745 test -z "$excl_longrunning_tests" \
2747 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_longrunning_tests" \
2751 test -z "$excl_privileged_tests" \
2753 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_privileged_tests" \
2757 test -z "$excl_unportable_tests" \
2759 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_unportable_tests" \
2763 test -n "$fmtc_inc_all_tests" \
2768 if $inc && func_acceptable
"$dep"; then
2769 func_append inmodules
" $dep"
2770 if test "$cond_dependencies" = true
; then
2771 escaped_dep
=`echo "$dep" | sed -e "$sed_escape_dependency"`
2772 sed_extract_condition1
='/^ *'"$escaped_dep"' *$/{
2775 sed_extract_condition2
='/^ *'"$escaped_dep"' *\[.*\] *$/{
2776 s/^ *'"$escaped_dep"' *\[\(.*\)\] *$/\1/p
2778 condition
=`func_get_dependencies $module | sed -n -e "$sed_extract_condition1" -e "$sed_extract_condition2"`
2779 if test "$condition" = true
; then
2782 if test -n "$condition"; then
2783 func_conddep_add_module
"$module" "$dep" "$condition"
2785 if $conditional; then
2786 func_conddep_add_module
"$module" "$dep" true
2788 func_uncond_add_module
"$dep"
2797 handledmodules
=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
2798 # Remove $handledmodules from $inmodules.
2799 for m
in $inmodules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/queued-modules
2800 inmodules
=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
2801 fmtc_inc_all_tests
="$inc_all_indirect_tests"
2803 modules
=`for m in $outmodules; do echo $m; done | LC_ALL=C sort -u`
2804 rm -f "$tmp"/queued-modules
2807 # func_show_module_list
2809 # - specified_modules list of specified modules (one per line, sorted)
2810 # - modules complete list of modules (one per line, sorted)
2811 # - tmp pathname of a temporary directory
2812 func_show_module_list
()
2818 # Assume xterm compatible escape sequences.
2819 bold_on
=`printf '\x1b[1m'`
2820 bold_off
=`printf '\x1b[0m'`
2825 echo "Module list with included dependencies (indented):"
2826 echo "$specified_modules" |
sed -e '/^$/d' -e 's/$/| /' > "$tmp"/specified-modules
2827 echo "$modules" |
sed -e '/^$/d' \
2828 | LC_ALL
=C
join -t '|' -a2 "$tmp"/specified-modules
- \
2829 |
sed -e 's/^\(.*\)|.*/|\1/' -e 's/^/ /' -e 's/^ |\(.*\)$/ '"${bold_on}"'\1'"${bold_off}"'/'
2832 # func_modules_transitive_closure_separately
2833 # Determine main module list and tests-related module list separately.
2834 # The main module list is the transitive closure of the specified modules,
2835 # ignoring tests modules. Its lib/* sources go into $sourcebase/. If --lgpl
2836 # is specified, it will consist only of LGPLed source.
2837 # The tests-related module list is the transitive closure of the specified
2838 # modules, including tests modules, minus the main module list excluding
2839 # modules of applicability 'all'. Its lib/* sources (brought in through
2840 # dependencies of *-tests modules) go into $testsbase/. It may contain GPLed
2841 # source, even if --lgpl is specified.
2843 # - local_gnulib_dir from --local-dir
2844 # - modcache true or false, from --cache-modules/--no-cache-modules
2845 # - specified_modules list of specified modules
2846 # - inctests true if tests should be included, false otherwise
2847 # - incobsolete true if obsolete modules among dependencies should be
2848 # included, blank otherwise
2849 # - inc_cxx_tests true if C++ interoperability tests should be included,
2851 # - inc_longrunning_tests true if long-runnings tests should be included,
2853 # - inc_privileged_tests true if tests that require root privileges should be
2854 # included, blank otherwise
2855 # - inc_unportable_tests true if tests that fail on some platforms should be
2856 # included, blank otherwise
2857 # - inc_all_direct_tests true if all kinds of problematic unit tests among
2858 # the unit tests of the specified modules should be
2859 # included, blank otherwise
2860 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
2861 # the unit tests of the dependencies should be
2862 # included, blank otherwise
2863 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
2865 # - excl_longrunning_tests true if long-runnings tests should be excluded,
2867 # - excl_privileged_tests true if tests that require root privileges should be
2868 # excluded, blank otherwise
2869 # - excl_unportable_tests true if tests that fail on some platforms should be
2870 # excluded, blank otherwise
2871 # - avoidlist list of modules to avoid
2872 # - cond_dependencies true if conditional dependencies shall be supported,
2874 # - tmp pathname of a temporary directory
2876 # - main_modules list of modules, including dependencies
2877 # - testsrelated_modules list of tests-related modules, including dependencies
2878 # - conddep_dependers, conddep_condition information about conditionally
2880 func_modules_transitive_closure_separately
()
2882 # Determine main module list.
2883 saved_inctests
="$inctests"
2885 modules
="$specified_modules"
2886 func_modules_transitive_closure
2887 main_modules
="$modules"
2888 inctests
="$saved_inctests"
2889 if test $verbose -ge 1; then
2890 echo "Main module list:"
2891 echo "$main_modules" |
sed -e 's/^/ /'
2893 # Determine tests-related module list.
2894 echo "$final_modules" | LC_ALL
=C
sort -u > "$tmp"/final-modules
2895 testsrelated_modules
=`for module in $main_modules; do
2896 if test \`func_get_applicability
$module\
` = main; then
2900 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/final-modules`
2901 if test $verbose -ge 1; then
2902 echo "Tests-related module list:"
2903 echo "$testsrelated_modules" |
sed -e 's/^/ /'
2907 # func_determine_use_libtests
2908 # Determines whether a $testsbase/libtests.a is needed.
2910 # - local_gnulib_dir from --local-dir
2911 # - modcache true or false, from --cache-modules/--no-cache-modules
2912 # - testsrelated_modules list of tests-related modules, including dependencies
2914 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
2915 func_determine_use_libtests
()
2918 for module
in $testsrelated_modules; do
2919 func_verify_nontests_module
2920 if test -n "$module"; then
2921 all_files
=`func_get_filelist $module`
2922 # Test whether some file in $all_files lies in lib/.
2923 for f
in $all_files; do
2935 # func_modules_add_dummy
2937 # - local_gnulib_dir from --local-dir
2938 # - modcache true or false, from --cache-modules/--no-cache-modules
2939 # - modules list of modules, including dependencies
2941 # - modules list of modules, including 'dummy' if needed
2942 func_modules_add_dummy
()
2944 # Determine whether any module provides a lib_SOURCES augmentation.
2946 sed_remove_backslash_newline
=':a
2953 for module
in $modules; do
2954 func_verify_nontests_module
2955 if test -n "$module"; then
2956 # Extract the value of "lib_SOURCES += ...".
2957 for file in `func_get_automake_snippet "$module" | sed -e "$sed_remove_backslash_newline" | sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'`; do
2958 # Ignore .h files since they are not compiled.
2962 have_lib_SOURCES
=yes
2969 # Add the dummy module, to make sure the library will be non-empty.
2970 if test -z "$have_lib_SOURCES"; then
2971 if func_acceptable
"dummy"; then
2972 func_append modules
" dummy"
2977 # func_modules_add_dummy_separately
2979 # - local_gnulib_dir from --local-dir
2980 # - modcache true or false, from --cache-modules/--no-cache-modules
2981 # - main_modules list of modules, including dependencies
2982 # - testsrelated_modules list of tests-related modules, including dependencies
2983 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
2985 # - main_modules list of modules, including 'dummy' if needed
2986 # - testsrelated_modules list of tests-related modules, including 'dummy' if
2988 func_modules_add_dummy_separately
()
2990 # Add the dummy module to the main module list if needed.
2991 modules
="$main_modules"
2992 func_modules_add_dummy
2993 main_modules
="$modules"
2995 # Add the dummy module to the tests-related module list if needed.
2996 if $use_libtests; then
2997 modules
="$testsrelated_modules"
2998 func_modules_add_dummy
2999 testsrelated_modules
="$modules"
3003 # func_modules_notice
3005 # - local_gnulib_dir from --local-dir
3006 # - modcache true or false, from --cache-modules/--no-cache-modules
3007 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
3008 # - modules list of modules, including dependencies
3009 func_modules_notice
()
3011 if test $verbose -ge -1; then
3012 for module
in $modules; do
3014 if test -n "$module"; then
3015 msg
=`func_get_notice $module`
3016 if test -n "$msg"; then
3017 echo "Notice from module $module:"
3018 echo "$msg" |
sed -e 's/^/ /'
3025 # func_modules_to_filelist
3027 # - local_gnulib_dir from --local-dir
3028 # - modcache true or false, from --cache-modules/--no-cache-modules
3029 # - modules list of modules, including dependencies
3031 # - files list of files
3032 func_modules_to_filelist
()
3035 for module
in $modules; do
3037 if test -n "$module"; then
3038 fs
=`func_get_filelist $module`
3039 func_append files
" $fs"
3042 files
=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
3045 # func_modules_to_filelist_separately
3046 # Determine the final file lists.
3047 # They must be computed separately, because files in lib/* go into
3048 # $sourcebase/ if they are in the main file list but into $testsbase/
3049 # if they are in the tests-related file list. Furthermore lib/dummy.c
3052 # - local_gnulib_dir from --local-dir
3053 # - modcache true or false, from --cache-modules/--no-cache-modules
3054 # - main_modules list of modules, including dependencies
3055 # - testsrelated_modules list of tests-related modules, including dependencies
3056 func_modules_to_filelist_separately
()
3058 # Determine final main file list.
3059 modules
="$main_modules"
3060 func_modules_to_filelist
3062 # Determine final tests-related file list.
3063 modules
="$testsrelated_modules"
3064 func_modules_to_filelist
3065 testsrelated_files
=`echo "$files" | sed -e 's,^lib/,tests=lib/,'`
3066 # Merge both file lists.
3067 sed_remove_empty_lines
='/^$/d'
3068 files
=`{ echo "$main_files"; echo "$testsrelated_files"; } | sed -e "$sed_remove_empty_lines" | LC_ALL=C sort -u`
3069 if test $verbose -ge 0; then
3071 sed_prettyprint_files
='s,^tests=lib/\(.*\)$,lib/\1 -> tests/\1,'
3072 echo "$files" |
sed -e "$sed_prettyprint_files" -e 's/^/ /'
3076 # func_compute_include_guard_prefix
3077 # Determine include_guard_prefix.
3079 # - macro_prefix prefix of gl_LIBOBJS macros to use
3081 # - include_guard_prefix replacement for ${gl_include_guard_prefix}
3082 # - sed_replace_include_guard_prefix
3083 # sed expression for resolving ${gl_include_guard_prefix}
3084 func_compute_include_guard_prefix
()
3086 if test "$macro_prefix" = gl
; then
3087 include_guard_prefix
='GL'
3089 include_guard_prefix
='GL_'`echo "$macro_prefix" | LC_ALL=C tr '[a-z]' '[A-Z]'`
3091 sed_replace_include_guard_prefix
='s/\${gl_include_guard_prefix}/'"${include_guard_prefix}"'/g'
3094 # func_execute_command command [args...]
3095 # Executes a command.
3096 # Uses also the variables
3097 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
3098 func_execute_command
()
3100 if test $verbose -ge 0; then
3104 # Commands like automake produce output to stderr even when they succeed.
3105 # Turn this output off if the command succeeds.
3106 "$@" > "$tmp"/cmdout
2>&1
3108 if test $cmdret = 0; then
3112 cat "$tmp"/cmdout
1>&2
3119 # func_dest_tmpfilename file
3120 # determines the name of a temporary file (file is relative to destdir).
3122 # - destdir target directory
3123 # - doit : if actions shall be executed, false if only to be printed
3124 # - tmp pathname of a temporary directory
3126 # - tmpfile absolute filename of the temporary file
3127 func_dest_tmpfilename
()
3130 # Put the new contents of $file in a file in the same directory (needed
3131 # to guarantee that an 'mv' to "$destdir/$file" works).
3132 tmpfile
="$destdir/$1.tmp"
3134 # Put the new contents of $file in a file in a temporary directory
3135 # (because the directory of "$file" might not exist).
3136 tmpfile
="$tmp"/`basename "$1"`.tmp
3141 # copies a file from gnulib into the destination directory. The destination
3142 # is known to not exist.
3144 # - destdir target directory
3145 # - local_gnulib_dir from --local-dir
3146 # - modcache true or false, from --cache-modules/--no-cache-modules
3147 # - f the original file name
3148 # - lookedup_file name of the merged (combined) file
3149 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
3150 # - g the rewritten file name
3151 # - tmpfile absolute filename of the temporary file
3152 # - doit : if actions shall be executed, false if only to be printed
3153 # - symbolic true if files should be symlinked, copied otherwise
3154 # - lsymbolic true if files from local_gnulib_dir should be symlinked,
3159 echo "Copying file $g"
3160 if { test -n "$symbolic" \
3161 ||
{ test -n "$lsymbolic" \
3162 && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; } \
3163 && test -z "$lookedup_tmp" \
3164 && cmp -s "$lookedup_file" "$tmpfile"; then
3165 func_ln_if_changed
"$lookedup_file" "$destdir/$g"
3167 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error
"failed"
3175 # copies a file from gnulib into the destination directory. The destination
3176 # is known to exist.
3178 # - destdir target directory
3179 # - local_gnulib_dir from --local-dir
3180 # - modcache true or false, from --cache-modules/--no-cache-modules
3181 # - f the original file name
3182 # - lookedup_file name of the merged (combined) file
3183 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
3184 # - g the rewritten file name
3185 # - tmpfile absolute filename of the temporary file
3186 # - doit : if actions shall be executed, false if only to be printed
3187 # - symbolic true if files should be symlinked, copied otherwise
3188 # - lsymbolic true if files from local_gnulib_dir should be symlinked,
3190 # - already_present nonempty if the file should already exist, empty otherwise
3193 if cmp -s "$destdir/$g" "$tmpfile"; then
3194 : # The file has not changed.
3198 if test -n "$already_present"; then
3199 echo "Updating file $g (backup in ${g}~)"
3201 echo "Replacing file $g (non-gnulib code backed up in ${g}~) !!"
3203 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error
"failed"
3204 if { test -n "$symbolic" \
3205 ||
{ test -n "$lsymbolic" \
3206 && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; } \
3207 && test -z "$lookedup_tmp" \
3208 && cmp -s "$lookedup_file" "$tmpfile"; then
3209 func_ln_if_changed
"$lookedup_file" "$destdir/$g"
3211 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error
"failed"
3214 if test -n "$already_present"; then
3215 echo "Update file $g (backup in ${g}~)"
3217 echo "Replace file $g (non-gnulib code backed up in ${g}~) !!"
3223 # func_emit_lib_Makefile_am
3224 # emits the contents of library makefile to standard output.
3226 # - local_gnulib_dir from --local-dir
3227 # - modcache true or false, from --cache-modules/--no-cache-modules
3228 # - modules list of modules, including dependencies
3229 # - libname library name
3230 # - pobase directory relative to destdir where to place *.po files
3231 # - auxdir directory relative to destdir where to place build aux files
3232 # - makefile_name from --makefile-name
3233 # - libtool true if libtool will be used, false or blank otherwise
3234 # - macro_prefix prefix of gl_LIBOBJS macros to use
3235 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
3236 # - witness_c_macro from --witness-c-macro
3237 # - actioncmd (optional) command that will reproduce this invocation
3238 # - for_test true if creating a package for testing, false otherwise
3239 # - sed_replace_include_guard_prefix
3240 # sed expression for resolving ${gl_include_guard_prefix}
3241 # - destfile filename relative to destdir of makefile being generated
3243 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val}
3244 # list of edits to be done to Makefile.am variables
3246 # - uses_subdirs nonempty if object files in subdirs exist
3247 func_emit_lib_Makefile_am
()
3249 # When creating an includable Makefile.am snippet, augment variables with
3250 # += instead of assigning them.
3251 if test -n "$makefile_name"; then
3256 if test "$libtool" = true
; then
3259 sed_eliminate_LDFLAGS
="$sed_noop"
3263 sed_eliminate_LDFLAGS
='/^lib_LDFLAGS[ ]*+=/d'
3266 # When creating a package for testing: Attempt to provoke failures,
3267 # especially link errors, already during "make" rather than during
3268 # "make check", because "make check" is not possible in a cross-compiling
3269 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
3270 sed_transform_check_PROGRAMS
='s,check_PROGRAMS,noinst_PROGRAMS,g'
3272 sed_transform_check_PROGRAMS
="$sed_noop"
3274 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3275 echo "## Process this file with automake to produce Makefile.in."
3276 func_emit_copyright_notice
3277 if test -n "$actioncmd"; then
3278 # The maximum line length (excluding the terminating newline) of any file
3279 # that is to be preprocessed by config.status is 3070. config.status uses
3280 # awk, and the HP-UX 11.00 awk fails if a line has length >= 3071;
3281 # similarly, the IRIX 6.5 awk fails if a line has length >= 3072.
3282 len
=`echo "$actioncmd" | wc -c`
3283 if test -n "$len" && test "$len" -le 3000; then
3284 echo "# Reproduce by: $actioncmd"
3290 for module
in $modules; do
3291 func_verify_nontests_module
3292 if test -n "$module"; then
3294 func_get_automake_snippet_conditional
"$module" |
3296 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
3297 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
3298 -e "$sed_eliminate_LDFLAGS" \
3299 -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' \
3300 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
3301 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
3302 -e "$sed_transform_check_PROGRAMS" \
3303 -e "$sed_replace_include_guard_prefix"
3304 if test "$module" = 'alloca'; then
3305 echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
3306 echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@"
3308 } > "$tmp"/amsnippet1
3310 func_get_automake_snippet_unconditional
"$module" |
3311 LC_ALL
=C
sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g'
3312 } > "$tmp"/amsnippet2
3313 # Skip the contents if it's entirely empty.
3314 if grep '[^ ]' "$tmp"/amsnippet1
"$tmp"/amsnippet2
> /dev
/null
; then
3315 echo "## begin gnulib module $module"
3317 if test "$cond_dependencies" = true
; then
3318 if func_cond_module_p
"$module"; then
3319 func_module_conditional_name
"$module"
3320 echo "if $conditional"
3323 cat "$tmp"/amsnippet1
3324 if test "$cond_dependencies" = true
; then
3325 if func_cond_module_p
"$module"; then
3329 cat "$tmp"/amsnippet2
3330 echo "## end gnulib module $module"
3333 rm -f "$tmp"/amsnippet1
"$tmp"/amsnippet2
3334 # Test whether there are some source files in subdirectories.
3335 for f
in `func_get_filelist "$module"`; do
3345 } > "$tmp"/allsnippets
3346 if test -z "$makefile_name"; then
3347 # If there are source files in subdirectories, prevent collision of the
3348 # object files (example: hash.c and libxml/hash.c).
3350 if test -n "$uses_subdirs"; then
3351 subdir_options
=' subdir-objects'
3353 echo "AUTOMAKE_OPTIONS = 1.5 gnits${subdir_options}"
3356 if test -z "$makefile_name"; then
3358 echo "noinst_HEADERS ="
3359 echo "noinst_LIBRARIES ="
3360 echo "noinst_LTLIBRARIES ="
3361 # Automake versions < 1.11.4 create an empty pkgdatadir at
3362 # installation time if you specify pkgdata_DATA to empty.
3363 # See automake bugs #10997 and #11030:
3364 # * http://debbugs.gnu.org/10997
3365 # * http://debbugs.gnu.org/11030
3366 # So we need this workaround.
3367 if grep '^pkgdata_DATA *+=' "$tmp"/allsnippets
> /dev
/null
; then
3368 echo "pkgdata_DATA ="
3371 echo "BUILT_SOURCES ="
3374 echo "MOSTLYCLEANFILES $assign core *.stackdump"
3375 if test -z "$makefile_name"; then
3376 echo "MOSTLYCLEANDIRS ="
3378 echo "DISTCLEANFILES ="
3379 echo "MAINTAINERCLEANFILES ="
3381 # Execute edits that apply to the Makefile.am being generated.
3383 while test $edit != $makefile_am_edits; do
3384 edit
=`expr $edit + 1`
3385 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
3386 eval var
=\"\
$makefile_am_edit${edit}_var
\"
3387 eval val
=\"\
$makefile_am_edit${edit}_val
\"
3388 if test -n "$var"; then
3389 if test "${dir}Makefile.am" = "$destfile" ||
test "./${dir}Makefile.am" = "$destfile"; then
3390 echo "${var} += ${val}"
3391 eval "makefile_am_edit${edit}_var="
3395 if test -n "$witness_c_macro"; then
3396 cppflags_part1
=" -D$witness_c_macro=1"
3401 cppflags_part2
=" -DGNULIB_STRICT_CHECKING=1"
3405 if test -z "$makefile_name"; then
3407 echo "AM_CPPFLAGS =$cppflags_part1$cppflags_part2"
3410 if test -n "$cppflags_part1$cppflags_part2"; then
3412 echo "AM_CPPFLAGS +=$cppflags_part1$cppflags_part2"
3416 if LC_ALL
=C
grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$tmp"/allsnippets
> /dev
/null \
3417 ||
{ test -n "$makefile_name" \
3418 && test -f "$sourcebase/Makefile.am" \
3419 && LC_ALL
=C
grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$sourcebase/Makefile.am" > /dev
/null
; \
3421 # One of the snippets or the user's Makefile.am already specifies an
3422 # installation location for the library. Don't confuse automake by saying
3423 # it should not be installed.
3426 # By default, the generated library should not be installed.
3427 echo "noinst_${perhapsLT}LIBRARIES += $libname.$libext"
3430 echo "${libname}_${libext}_SOURCES ="
3431 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
3432 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
3433 echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
3434 echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
3435 echo "EXTRA_${libname}_${libext}_SOURCES ="
3436 if test "$libtool" = true
; then
3437 echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)"
3438 echo "${libname}_${libext}_LDFLAGS += -no-undefined"
3439 # Synthesize an ${libname}_${libext}_LDFLAGS augmentation by combining
3440 # the link dependencies of all modules.
3441 for module
in $modules; do
3442 func_verify_nontests_module
3443 if test -n "$module"; then
3444 func_get_link_directive
"$module"
3447 | LC_ALL
=C
sed -e '/^$/d' -e 's/ when linking with libtool.*//' \
3448 | LC_ALL
=C
sort -u \
3449 | LC_ALL
=C
sed -e 's/^/'"${libname}_${libext}"'_LDFLAGS += /'
3452 if test -n "$pobase"; then
3453 echo "AM_CPPFLAGS += -DDEFAULT_TEXT_DOMAIN=\\\"${po_domain}-gnulib\\\""
3456 cat "$tmp"/allsnippets \
3457 |
sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
3459 echo "mostlyclean-local: mostlyclean-generic"
3460 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
3461 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
3462 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
3466 rm -f "$tmp"/allsnippets
3469 # func_emit_po_Makevars
3470 # emits the contents of po/ makefile parameterization to standard output.
3472 # - local_gnulib_dir from --local-dir
3473 # - modcache true or false, from --cache-modules/--no-cache-modules
3474 # - sourcebase directory relative to destdir where to place source code
3475 # - pobase directory relative to destdir where to place *.po files
3476 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
3477 func_emit_po_Makevars
()
3479 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3480 func_emit_copyright_notice
3482 echo "# Usually the message domain is the same as the package name."
3483 echo "# But here it has a '-gnulib' suffix."
3484 echo "DOMAIN = ${po_domain}-gnulib"
3486 echo "# These two variables depend on the location of this directory."
3487 echo "subdir = ${pobase}"
3488 echo "top_builddir = "`echo "$pobase" | sed -e 's,//*,/,g' -e 's,[^/][^/]*,..,g'`
3491 # These options get passed to xgettext.
3492 XGETTEXT_OPTIONS
= \
3493 --keyword=_
--flag=_
:1:pass-c-format \
3494 --keyword=N_
--flag=N_
:1:pass-c-format \
3495 --keyword='proper_name:1,"This is a proper name. See the gettext manual, section Names."' \
3496 --keyword='proper_name_utf8:1,"This is a proper name. See the gettext manual, section Names."' \
3497 --flag=error
:3:c-format
--flag=error_at_line
:5:c-format
3499 # This is the copyright holder that gets inserted into the header of the
3500 # $(DOMAIN).pot file. gnulib is copyrighted by the FSF.
3501 COPYRIGHT_HOLDER
= Free Software Foundation
, Inc.
3503 # This is the email address or URL to which the translators shall report
3504 # bugs in the untranslated strings:
3505 # - Strings which are not entire sentences, see the maintainer guidelines
3506 # in the GNU gettext documentation, section 'Preparing Strings'.
3507 # - Strings which use unclear terms or require additional context to be
3509 # - Strings which make invalid assumptions about notation of date, time or
3511 # - Pluralisation problems.
3512 # - Incorrect English spelling.
3513 # - Incorrect formatting.
3514 # It can be your email address, or a mailing list address where translators
3515 # can write to without being subscribed, or the URL of a web page through
3516 # which the translators can contact you.
3517 MSGID_BUGS_ADDRESS
= bug-gnulib@gnu.org
3519 # This is the list of locale categories, beyond LC_MESSAGES, for which the
3520 # message catalogs shall be used. It is usually empty.
3521 EXTRA_LOCALE_CATEGORIES
=
3523 # This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
3524 # context. Possible values are "yes" and "no". Set this to yes if the
3525 # package uses functions taking also a message context, like pgettext(), or
3526 # if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
3531 # func_emit_po_POTFILES_in
3532 # emits the file list to be passed to xgettext to standard output.
3534 # - local_gnulib_dir from --local-dir
3535 # - modcache true or false, from --cache-modules/--no-cache-modules
3536 # - sourcebase directory relative to destdir where to place source code
3537 # - files list of new files
3538 func_emit_po_POTFILES_in
()
3540 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3541 func_emit_copyright_notice
3543 echo "# List of files which contain translatable strings."
3544 echo "$files" |
sed -n -e "s,^lib/,$sourcebase/,p"
3547 # func_emit_tests_Makefile_am witness_macro
3548 # emits the contents of tests makefile to standard output.
3550 # - local_gnulib_dir from --local-dir
3551 # - modcache true or false, from --cache-modules/--no-cache-modules
3552 # - modules list of modules, including dependencies
3553 # - libname library name
3554 # - auxdir directory relative to destdir where to place build aux files
3555 # - makefile_name from --makefile-name
3556 # - libtool true if libtool will be used, false or blank otherwise
3557 # - sourcebase relative directory containing lib source code
3558 # - m4base relative directory containing autoconf macros
3559 # - testsbase relative directory containing unit test code
3560 # - macro_prefix prefix of gl_LIBOBJS macros to use
3561 # - witness_c_macro from --witness-c-macro
3562 # - for_test true if creating a package for testing, false otherwise
3563 # - single_configure true if a single configure file should be generated,
3564 # false for a separate configure file for the tests
3565 # - use_libtests true if a libtests.a should be built, false otherwise
3566 # - sed_replace_include_guard_prefix
3567 # sed expression for resolving ${gl_include_guard_prefix}
3568 # - destfile filename relative to destdir of makefile being generated
3570 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val}
3571 # list of edits to be done to Makefile.am variables
3573 # - uses_subdirs nonempty if object files in subdirs exist
3574 func_emit_tests_Makefile_am
()
3577 if test "$libtool" = true
; then
3579 sed_eliminate_LDFLAGS
="$sed_noop"
3582 sed_eliminate_LDFLAGS
='/^lib_LDFLAGS[ ]*+=/d'
3585 # When creating a package for testing: Attempt to provoke failures,
3586 # especially link errors, already during "make" rather than during
3587 # "make check", because "make check" is not possible in a cross-compiling
3588 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
3589 sed_transform_check_PROGRAMS
='s,check_PROGRAMS,noinst_PROGRAMS,g'
3591 sed_transform_check_PROGRAMS
="$sed_noop"
3593 testsbase_inverse
=`echo "$testsbase" | sed -e 's,/$,,' | sed -e 's,[^/][^/]*,..,g'`
3594 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3595 echo "## Process this file with automake to produce Makefile.in."
3596 func_emit_copyright_notice
3600 for module
in $modules; do
3601 if $for_test && ! $single_configure; then
3602 func_verify_tests_module
3606 if test -n "$module"; then
3608 func_get_automake_snippet
"$module" |
3610 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
3611 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
3612 -e "$sed_eliminate_LDFLAGS" \
3613 -e 's,lib_\([A-Z][A-Z]*\),libtests_a_\1,g' \
3614 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
3615 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
3616 -e "$sed_transform_check_PROGRAMS" \
3617 -e "$sed_replace_include_guard_prefix"
3618 if $use_libtests && test "$module" = 'alloca'; then
3619 echo "libtests_a_LIBADD += @${perhapsLT}ALLOCA@"
3620 echo "libtests_a_DEPENDENCIES += @${perhapsLT}ALLOCA@"
3622 } > "$tmp"/amsnippet
3623 # Skip the contents if it's entirely empty.
3624 if grep '[^ ]' "$tmp"/amsnippet
> /dev
/null
; then
3625 # Mention long-running tests at the end.
3627 for word
in `func_get_status "$module"`; do
3628 if test "$word" = 'longrunning-test'; then
3633 { echo "## begin gnulib module $module"
3635 cat "$tmp"/amsnippet
3636 echo "## end gnulib module $module"
3640 rm -f "$tmp"/amsnippet
3641 # Test whether there are some source files in subdirectories.
3642 for f
in `func_get_filelist "$module"`; do
3644 lib
/*/*.c |
tests
/*/*.c
)
3652 } 3> "$tmp"/main_snippets
4> "$tmp"/longrunning_snippets
3653 # Generate dependencies here, since it eases the debugging of test failures.
3654 # If there are source files in subdirectories, prevent collision of the
3655 # object files (example: hash.c and libxml/hash.c).
3657 if test -n "$uses_subdirs"; then
3658 subdir_options
=' subdir-objects'
3660 echo "AUTOMAKE_OPTIONS = 1.5 foreign${subdir_options}"
3662 if $for_test && ! $single_configure; then
3663 echo "ACLOCAL_AMFLAGS = -I ${testsbase_inverse}/${m4base}"
3666 # Nothing is being added to SUBDIRS; nevertheless the existence of this
3667 # variable is needed to avoid an error from automake:
3668 # "AM_GNU_GETTEXT used but SUBDIRS not defined"
3671 echo "XFAIL_TESTS ="
3672 echo "TESTS_ENVIRONMENT ="
3673 echo "noinst_PROGRAMS ="
3674 if ! $for_test; then
3675 echo "check_PROGRAMS ="
3677 echo "noinst_HEADERS ="
3678 echo "noinst_LIBRARIES ="
3679 if $use_libtests; then
3681 echo "noinst_LIBRARIES += libtests.a"
3683 echo "check_LIBRARIES = libtests.a"
3686 # Automake versions < 1.11.4 create an empty pkgdatadir at
3687 # installation time if you specify pkgdata_DATA to empty.
3688 # See automake bugs #10997 and #11030:
3689 # * http://debbugs.gnu.org/10997
3690 # * http://debbugs.gnu.org/11030
3691 # So we need this workaround.
3692 if grep '^pkgdata_DATA *+=' "$tmp"/main_snippets
"$tmp"/longrunning_snippets
> /dev
/null
; then
3693 echo "pkgdata_DATA ="
3696 echo "BUILT_SOURCES ="
3698 echo "MOSTLYCLEANFILES = core *.stackdump"
3699 echo "MOSTLYCLEANDIRS ="
3701 echo "DISTCLEANFILES ="
3702 echo "MAINTAINERCLEANFILES ="
3703 # Execute edits that apply to the Makefile.am being generated.
3705 while test $edit != $makefile_am_edits; do
3706 edit
=`expr $edit + 1`
3707 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
3708 eval var
=\"\
$makefile_am_edit${edit}_var
\"
3709 eval val
=\"\
$makefile_am_edit${edit}_val
\"
3710 if test -n "$var"; then
3711 if test "${dir}Makefile.am" = "$destfile" ||
test "./${dir}Makefile.am" = "$destfile"; then
3712 echo "${var} += ${val}"
3713 eval "makefile_am_edit${edit}_var="
3718 echo "AM_CPPFLAGS = \\"
3720 echo " -DGNULIB_STRICT_CHECKING=1 \\"
3722 if test -n "$witness_c_macro"; then
3723 echo " -D$witness_c_macro=1 \\"
3725 if test -n "${witness_macro}"; then
3726 echo " -D@${witness_macro}@=1 \\"
3728 echo " -I. -I\$(srcdir) \\"
3729 echo " -I${testsbase_inverse} -I\$(srcdir)/${testsbase_inverse} \\"
3730 echo " -I${testsbase_inverse}/${sourcebase-lib} -I\$(srcdir)/${testsbase_inverse}/${sourcebase-lib}"
3732 local_ldadd_before
=''
3733 local_ldadd_after
=''
3734 if $use_libtests; then
3735 # All test programs need to be linked with libtests.a.
3736 # It needs to be passed to the linker before ${libname}.${libext}, since
3737 # the tests-related modules depend on the main modules.
3738 # It also needs to be passed to the linker after ${libname}.${libext}
3739 # because the latter might contain incomplete modules (such as the 'error'
3740 # module whose dependency to 'progname' is voluntarily omitted).
3741 # The LIBTESTS_LIBDEPS can be passed to the linker once or twice, it does
3743 local_ldadd_before
=' libtests.a'
3744 local_ldadd_after
=' libtests.a $(LIBTESTS_LIBDEPS)'
3746 echo "LDADD =${local_ldadd_before} ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext}${local_ldadd_after}"
3748 if $use_libtests; then
3749 echo "libtests_a_SOURCES ="
3750 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
3751 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
3752 echo "libtests_a_LIBADD = \$(${macro_prefix}tests_LIBOBJS)"
3753 echo "libtests_a_DEPENDENCIES = \$(${macro_prefix}tests_LIBOBJS)"
3754 echo "EXTRA_libtests_a_SOURCES ="
3755 # The circular dependency in LDADD requires this.
3756 echo "AM_LIBTOOLFLAGS = --preserve-dup-deps"
3759 # Many test scripts use ${EXEEXT} or ${srcdir}.
3760 # EXEEXT is defined by AC_PROG_CC through autoconf.
3761 # srcdir is defined by autoconf and automake.
3762 echo "TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='\$(srcdir)'"
3764 cat "$tmp"/main_snippets
"$tmp"/longrunning_snippets \
3765 |
sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
3766 echo "# Clean up after Solaris cc."
3768 echo " rm -rf SunWS_cache"
3770 echo "mostlyclean-local: mostlyclean-generic"
3771 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
3772 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
3773 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
3777 rm -f "$tmp"/main_snippets
"$tmp"/longrunning_snippets
3780 # func_emit_initmacro_start macro_prefix
3781 # emits the first few statements of the gl_INIT macro to standard output.
3782 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
3783 func_emit_initmacro_start
()
3785 macro_prefix_arg
="$1"
3786 # Overriding AC_LIBOBJ and AC_REPLACE_FUNCS has the effect of storing
3787 # platform-dependent object files in ${macro_prefix_arg}_LIBOBJS instead of
3788 # LIBOBJS. The purpose is to allow several gnulib instantiations under
3789 # a single configure.ac file. (AC_CONFIG_LIBOBJ_DIR does not allow this
3791 # Furthermore it avoids an automake error like this when a Makefile.am
3792 # that uses pieces of gnulib also uses $(LIBOBJ):
3793 # automatically discovered file `error.c' should not be explicitly mentioned
3794 echo " m4_pushdef([AC_LIBOBJ], m4_defn([${macro_prefix_arg}_LIBOBJ]))"
3795 echo " m4_pushdef([AC_REPLACE_FUNCS], m4_defn([${macro_prefix_arg}_REPLACE_FUNCS]))"
3796 # Overriding AC_LIBSOURCES has the same purpose of avoiding the automake
3797 # error when a Makefile.am that uses pieces of gnulib also uses $(LIBOBJ):
3798 # automatically discovered file `error.c' should not be explicitly mentioned
3799 # We let automake know about the files to be distributed through the
3800 # EXTRA_lib_SOURCES variable.
3801 echo " m4_pushdef([AC_LIBSOURCES], m4_defn([${macro_prefix_arg}_LIBSOURCES]))"
3802 # Create data variables for checking the presence of files that are mentioned
3803 # as AC_LIBSOURCES arguments. These are m4 variables, not shell variables,
3804 # because we want the check to happen when the configure file is created,
3805 # not when it is run. ${macro_prefix_arg}_LIBSOURCES_LIST is the list of
3806 # files to check for. ${macro_prefix_arg}_LIBSOURCES_DIR is the subdirectory
3807 # in which to expect them.
3808 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_LIST], [])"
3809 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_DIR], [])"
3813 # func_emit_initmacro_end macro_prefix
3814 # emits the last few statements of the gl_INIT macro to standard output.
3815 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
3816 func_emit_initmacro_end
()
3818 macro_prefix_arg
="$1"
3819 # Check the presence of files that are mentioned as AC_LIBSOURCES arguments.
3820 # The check is performed only when autoconf is run from the directory where
3821 # the configure.ac resides; if it is run from a different directory, the
3823 echo " m4_ifval(${macro_prefix_arg}_LIBSOURCES_LIST, ["
3824 echo " m4_syscmd([test ! -d ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[ ||"
3825 echo " for gl_file in ]${macro_prefix_arg}_LIBSOURCES_LIST[ ; do"
3826 echo " if test ! -r ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file ; then"
3827 echo " echo \"missing file ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file\" >&2"
3831 echo " m4_if(m4_sysval, [0], [],"
3832 echo " [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])"
3834 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_DIR])"
3835 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_LIST])"
3836 echo " m4_popdef([AC_LIBSOURCES])"
3837 echo " m4_popdef([AC_REPLACE_FUNCS])"
3838 echo " m4_popdef([AC_LIBOBJ])"
3839 echo " AC_CONFIG_COMMANDS_PRE(["
3840 echo " ${macro_prefix_arg}_libobjs="
3841 echo " ${macro_prefix_arg}_ltlibobjs="
3842 echo " if test -n \"\$${macro_prefix_arg}_LIBOBJS\"; then"
3843 echo " # Remove the extension."
3844 echo " sed_drop_objext='s/\\.o\$//;s/\\.obj\$//'"
3845 echo " for i in \`for i in \$${macro_prefix_arg}_LIBOBJS; do echo \"\$i\"; done | sed -e \"\$sed_drop_objext\" | sort | uniq\`; do"
3846 echo " ${macro_prefix_arg}_libobjs=\"\$${macro_prefix_arg}_libobjs \$i.\$ac_objext\""
3847 echo " ${macro_prefix_arg}_ltlibobjs=\"\$${macro_prefix_arg}_ltlibobjs \$i.lo\""
3850 echo " AC_SUBST([${macro_prefix_arg}_LIBOBJS], [\$${macro_prefix_arg}_libobjs])"
3851 echo " AC_SUBST([${macro_prefix_arg}_LTLIBOBJS], [\$${macro_prefix_arg}_ltlibobjs])"
3855 # func_emit_initmacro_done macro_prefix sourcebase
3856 # emits a few statements after the gl_INIT macro to standard output.
3857 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
3858 # - sourcebase directory relative to destdir where to place source code
3859 func_emit_initmacro_done
()
3861 macro_prefix_arg
="$1"
3864 echo "# Like AC_LIBOBJ, except that the module name goes"
3865 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
3866 echo "AC_DEFUN([${macro_prefix_arg}_LIBOBJ], ["
3867 echo " AS_LITERAL_IF([\$1], [${macro_prefix_arg}_LIBSOURCES([\$1.c])])dnl"
3868 echo " ${macro_prefix_arg}_LIBOBJS=\"\$${macro_prefix_arg}_LIBOBJS \$1.\$ac_objext\""
3871 echo "# Like AC_REPLACE_FUNCS, except that the module name goes"
3872 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
3873 echo "AC_DEFUN([${macro_prefix_arg}_REPLACE_FUNCS], ["
3874 echo " m4_foreach_w([gl_NAME], [\$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl"
3875 echo " AC_CHECK_FUNCS([\$1], , [${macro_prefix_arg}_LIBOBJ(\$ac_func)])"
3878 echo "# Like AC_LIBSOURCES, except the directory where the source file is"
3879 echo "# expected is derived from the gnulib-tool parameterization,"
3880 echo "# and alloca is special cased (for the alloca-opt module)."
3881 echo "# We could also entirely rely on EXTRA_lib..._SOURCES."
3882 echo "AC_DEFUN([${macro_prefix_arg}_LIBSOURCES], ["
3883 echo " m4_foreach([_gl_NAME], [\$1], ["
3884 echo " m4_if(_gl_NAME, [alloca.c], [], ["
3885 echo " m4_define([${macro_prefix_arg}_LIBSOURCES_DIR], [$sourcebase_arg])"
3886 echo " m4_append([${macro_prefix_arg}_LIBSOURCES_LIST], _gl_NAME, [ ])"
3892 # func_emit_autoconf_snippet indentation
3893 # emits the autoconf snippet of a module.
3895 # - local_gnulib_dir from --local-dir
3896 # - modcache true or false, from --cache-modules/--no-cache-modules
3897 # - sed_replace_build_aux sed expression that replaces reference to build-aux
3898 # - sed_replace_include_guard_prefix
3899 # sed expression for resolving ${gl_include_guard_prefix}
3900 # - module the module name
3901 # - toplevel true or false. 'false' means a subordinate use of
3903 # - disable_libtool true or false. It tells whether to disable libtool
3904 # handling even if it has been specified through the
3905 # command line options.
3906 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
3908 # - indentation spaces to prepend on each line
3909 func_emit_autoconf_snippet
()
3911 if { case $module in
3912 gnumakefile | maintainer-makefile
)
3913 # These modules are meant to be used only in the top-level directory.
3919 func_get_autoconf_snippet
"$module" \
3920 |
sed -e '/^$/d;' -e "s/^/$indentation/" \
3921 -e "$sed_replace_build_aux" \
3922 -e "$sed_replace_include_guard_prefix" \
3923 |
{ if $disable_libtool; then
3924 sed -e 's/\$gl_cond_libtool/false/g' \
3925 -e 's/gl_libdeps/gltests_libdeps/g' \
3926 -e 's/gl_ltlibdeps/gltests_ltlibdeps/g'
3931 |
{ if $disable_gettext; then
3932 sed -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./'
3937 if test "$module" = 'alloca' && test "$libtool" = true
&& ! $disable_libtool; then
3938 echo 'changequote(,)dnl'
3939 echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
3940 echo 'changequote([, ])dnl'
3941 echo 'AC_SUBST([LTALLOCA])'
3946 # func_emit_autoconf_snippets modules verifier toplevel disable_libtool disable_gettext
3947 # collects and emit the autoconf snippets of a set of modules.
3949 # - local_gnulib_dir from --local-dir
3950 # - modcache true or false, from --cache-modules/--no-cache-modules
3951 # - sed_replace_build_aux sed expression that replaces reference to build-aux
3952 # - sed_replace_include_guard_prefix
3953 # sed expression for resolving ${gl_include_guard_prefix}
3954 # - modules the list of modules.
3955 # - verifier one of func_verify_module, func_verify_nontests_module,
3956 # func_verify_tests_module. It selects the subset of
3957 # $modules to consider.
3958 # - toplevel true or false. 'false' means a subordinate use of
3960 # - disable_libtool true or false. It tells whether to disable libtool
3961 # handling even if it has been specified through the
3962 # command line options.
3963 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
3965 func_emit_autoconf_snippets
()
3969 disable_libtool
="$4"
3970 disable_gettext
="$5"
3971 if test "$cond_dependencies" = true
; then
3972 for m
in $modules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/modules
3973 # Emit the autoconf code for the unconditional modules.
3974 for module
in $1; do
3976 if test -n "$module"; then
3977 if func_cond_module_p
"$module"; then
3980 func_emit_autoconf_snippet
" "
3984 # Initialize the shell variables indicating that the modules are enabled.
3985 for module
in $1; do
3987 if test -n "$module"; then
3988 if func_cond_module_p
"$module"; then
3989 func_module_shellvar_name
"$module"
3990 echo " $shellvar=false"
3994 # Emit the autoconf code for the conditional modules, each in a separate
3995 # function. This makes it possible to support cycles among conditional
3997 for module
in $1; do
3999 if test -n "$module"; then
4000 if func_cond_module_p
"$module"; then
4001 func_module_shellfunc_name
"$module"
4002 func_module_shellvar_name
"$module"
4003 echo " $shellfunc ()"
4005 echo " if ! \$$shellvar; then"
4006 func_emit_autoconf_snippet
" "
4007 echo " $shellvar=true"
4008 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
4009 # Intersect $deps with the modules list $1.
4010 deps
=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
4011 for dep
in $deps; do
4012 if func_cond_module_p
"$dep"; then
4013 func_module_shellfunc_name
"$dep"
4014 func_cond_module_condition
"$module" "$dep"
4015 if test "$condition" != true
; then
4016 echo " if $condition; then"
4023 # The autoconf code for $dep has already been emitted above and
4024 # therefore is already executed when this function is run.
4033 # Emit the dependencies from the unconditional to the conditional modules.
4034 for module
in $1; do
4036 if test -n "$module"; then
4037 if func_cond_module_p
"$module"; then
4040 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
4041 # Intersect $deps with the modules list $1.
4042 deps
=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
4043 for dep
in $deps; do
4044 if func_cond_module_p
"$dep"; then
4045 func_module_shellfunc_name
"$dep"
4046 func_cond_module_condition
"$module" "$dep"
4047 if test "$condition" != true
; then
4048 echo " if $condition; then"
4055 # The autoconf code for $dep has already been emitted above and
4056 # therefore is already executed when this code is run.
4063 # Define the Automake conditionals.
4064 echo " m4_pattern_allow([^${macro_prefix}_GNULIB_ENABLED_])"
4065 for module
in $1; do
4067 if test -n "$module"; then
4068 if func_cond_module_p
"$module"; then
4069 func_module_conditional_name
"$module"
4070 func_module_shellvar_name
"$module"
4071 echo " AM_CONDITIONAL([$conditional], [\$$shellvar])"
4076 # Ignore the conditions, and enable all modules unconditionally.
4077 for module
in $1; do
4079 if test -n "$module"; then
4080 func_emit_autoconf_snippet
" "
4086 # func_import modules
4087 # Uses also the variables
4088 # - mode import or add-import or remove-import or update
4089 # - destdir target directory
4090 # - local_gnulib_dir from --local-dir
4091 # - modcache true or false, from --cache-modules/--no-cache-modules
4092 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
4093 # - libname library name
4094 # - supplied_libname true if --lib was given, blank otherwise
4095 # - sourcebase directory relative to destdir where to place source code
4096 # - m4base directory relative to destdir where to place *.m4 macros
4097 # - pobase directory relative to destdir where to place *.po files
4098 # - docbase directory relative to destdir where to place doc files
4099 # - testsbase directory relative to destdir where to place unit test code
4100 # - auxdir directory relative to destdir where to place build aux files
4101 # - inctests true if --with-tests was given, false otherwise
4102 # - incobsolete true if --with-obsolete was given, blank otherwise
4103 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
4104 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
4106 # - inc_privileged_tests true if --with-privileged-tests was given, blank
4108 # - inc_unportable_tests true if --with-unportable-tests was given, blank
4110 # - inc_all_tests true if --with-all-tests was given, blank otherwise
4111 # - avoidlist list of modules to avoid, from --avoid
4112 # - cond_dependencies true if --conditional-dependencies was given, false if
4113 # --no-conditional-dependencies was given, blank otherwise
4114 # - lgpl yes or a number if library's license shall be LGPL,
4116 # - makefile_name from --makefile-name
4117 # - libtool true if --libtool was given, false if --no-libtool was
4118 # given, blank otherwise
4119 # - guessed_libtool true if the configure.ac file uses libtool, false otherwise
4120 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4121 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
4122 # - witness_c_macro from --witness-c-macro
4123 # - vc_files true if --vc-files was given, false if --no-vc-files was
4124 # given, blank otherwise
4125 # - autoconf_minversion minimum supported autoconf version
4126 # - doit : if actions shall be executed, false if only to be printed
4127 # - symbolic true if files should be symlinked, copied otherwise
4128 # - lsymbolic true if files from local_gnulib_dir should be symlinked,
4130 # - do_copyrights true if copyright notices in files should be replaced,
4134 # Get the cached settings.
4135 # In 'import' mode, we read them only for the purpose of knowing the old
4136 # installed file list, and don't use them as defaults.
4137 cached_local_gnulib_dir
=
4138 cached_specified_modules
=
4140 cached_inc_cxx_tests
=
4141 cached_inc_longrunning_tests
=
4142 cached_inc_privileged_tests
=
4143 cached_inc_unportable_tests
=
4144 cached_inc_all_tests
=
4154 cached_makefile_name
=
4155 cached_cond_dependencies
=
4157 cached_macro_prefix
=
4159 cached_witness_c_macro
=
4162 if test -f "$destdir"/$m4base/gnulib-cache.
m4; then
4163 cached_libtool
=false
4169 s,^.*gl_LOCAL_DIR([[ ]*\([^]"$`\\)]*\).*$,cached_local_gnulib_dir="\1",p
4179 s,^.*gl_MODULES([[ ]*\([^]"$`\\)]*\).*$,cached_specified_modules="\1",p
4181 /gl_WITH_OBSOLETE/ {
4182 s,^.*$,cached_incobsolete=true,p
4184 /gl_WITH_CXX_TESTS/ {
4185 s,^.*$,cached_inc_cxx_tests=true,p
4187 /gl_WITH_LONGRUNNING_TESTS/ {
4188 s,^.*$,cached_inc_longrunning_tests=true,p
4190 /gl_WITH_PRIVILEGED_TESTS/ {
4191 s,^.*$,cached_inc_privileged_tests=true,p
4193 /gl_WITH_UNPORTABLE_TESTS/ {
4194 s,^.*$,cached_inc_unportable_tests=true,p
4196 /gl_WITH_ALL_TESTS/ {
4197 s,^.*$,cached_inc_all_tests=true,p
4200 s,^.*gl_AVOID([[ ]*\([^]"$`\\)]*\).*$,cached_avoidlist="\1",p
4203 s,^.*gl_SOURCE_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_sourcebase="\1",p
4206 s,^.*gl_M4_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_m4base="\1",p
4209 s,^.*gl_PO_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_pobase="\1",p
4212 s,^.*gl_DOC_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_docbase="\1",p
4215 s,^.*gl_TESTS_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_testsbase="\1",p
4218 s,^.*$,cached_inctests=true,p
4221 s,^.*gl_LIB([[ ]*\([^]"$`\\)]*\).*$,cached_libname="\1",p
4224 s,^.*gl_LGPL([[ ]*\([^]"$`\\)]*\).*$,cached_lgpl="\1",p
4227 s,^.*$,cached_lgpl=yes,p
4229 /gl_MAKEFILE_NAME(/ {
4230 s,^.*gl_MAKEFILE_NAME([[ ]*\([^]"$`\\)]*\).*$,cached_makefile_name="\1",p
4232 /gl_CONDITIONAL_DEPENDENCIES/ {
4233 s,^.*$,cached_cond_dependencies=true,p
4236 s,^.*$,cached_libtool=true,p
4238 /gl_MACRO_PREFIX(/ {
4239 s,^.*gl_MACRO_PREFIX([[ ]*\([^]"$`\\)]*\).*$,cached_macro_prefix="\1",p
4242 s,^.*gl_PO_DOMAIN([[ ]*\([^]"$`\\)]*\).*$,cached_po_domain="\1",p
4244 /gl_WITNESS_C_MACRO(/ {
4245 s,^.*gl_WITNESS_C_MACRO([[ ]*\([^]"$`\\)]*\).*$,cached_witness_c_macro="\1",p
4248 s,^.*gl_VC_FILES([[ ]*\([^]"$`\\)]*\).*$,cached_vc_files="\1",p
4250 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-cache.m4`
4251 if test -f "$destdir"/$m4base/gnulib-comp.
m4; then
4256 /AC_DEFUN(\['"${cached_macro_prefix}"'_FILE_LIST\], \[/ {
4257 s,^.*$,cached_files=",p
4270 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-comp.m4`
4274 if test "$mode" = import
; then
4275 # In 'import' mode, the new set of specified modules overrides the cached
4276 # set of modules. Ignore the cached settings.
4277 specified_modules
="$1"
4279 # Merge the cached settings with the specified ones.
4280 # The m4base must be the same as expected from the pathname.
4281 if test -n "$cached_m4base" && test "$cached_m4base" != "$m4base"; then
4282 func_fatal_error
"$m4base/gnulib-cache.m4 is expected to contain gl_M4_BASE([$m4base])"
4284 # The local_gnulib_dir defaults to the cached one. Recall that the cached one
4285 # is relative to $destdir, whereas the one we use is relative to . or absolute.
4286 if test -z "$local_gnulib_dir"; then
4287 if test -n "$cached_local_gnulib_dir"; then
4290 local_gnulib_dir
="$destdir/$cached_local_gnulib_dir" ;;
4292 case "$cached_local_gnulib_dir" in
4294 local_gnulib_dir
="$destdir/$cached_local_gnulib_dir" ;;
4296 func_relconcat
"$destdir" "$cached_local_gnulib_dir"
4297 local_gnulib_dir
="$relconcat" ;;
4304 # Append the cached and the specified module names. So that
4305 # "gnulib-tool --add-import foo" means to add the module foo.
4306 specified_modules
="$cached_specified_modules $1"
4309 # Take the cached module names, minus the specified module names.
4311 if $have_associative; then
4312 # Use an associative array, for O(N) worst-case run time.
4313 declare -A to_remove
4315 eval 'to_remove[$m]=yes'
4317 for module
in $cached_specified_modules; do
4318 if eval 'test -z "${to_remove[$module]}"'; then
4319 func_append specified_modules
"$module "
4323 # This loop has O(N²) worst-case run time.
4324 for module
in $cached_specified_modules; do
4327 if test "$m" = "$module"; then
4332 if test -z "$to_remove"; then
4333 func_append specified_modules
"$module "
4339 # Take the cached module names. There are no specified module names.
4340 specified_modules
="$cached_specified_modules"
4343 # Included obsolete modules among the dependencies if specified either way.
4344 if test -z "$incobsolete"; then
4345 incobsolete
="$cached_incobsolete"
4347 # Included special kinds of tests modules among the dependencies if specified
4349 if test -z "$inc_cxx_tests"; then
4350 inc_cxx_tests
="$cached_inc_cxx_tests"
4352 if test -z "$inc_longrunning_tests"; then
4353 inc_longrunning_tests
="$cached_inc_longrunning_tests"
4355 if test -z "$inc_privileged_tests"; then
4356 inc_privileged_tests
="$cached_inc_privileged_tests"
4358 if test -z "$inc_unportable_tests"; then
4359 inc_unportable_tests
="$cached_inc_unportable_tests"
4361 if test -z "$inc_all_tests"; then
4362 inc_all_tests
="$cached_inc_all_tests"
4364 # Append the cached and the specified avoidlist. This is probably better
4365 # than dropping the cached one when --avoid is specified at least once.
4366 avoidlist
=`for m in $cached_avoidlist $avoidlist; do echo $m; done | LC_ALL=C sort -u`
4367 avoidlist
=`echo $avoidlist`
4369 # The sourcebase defaults to the cached one.
4370 if test -z "$sourcebase"; then
4371 sourcebase
="$cached_sourcebase"
4372 if test -z "$sourcebase"; then
4373 func_fatal_error
"missing --source-base option"
4376 # The pobase defaults to the cached one.
4377 if test -z "$pobase"; then
4378 pobase
="$cached_pobase"
4380 # The docbase defaults to the cached one.
4381 if test -z "$docbase"; then
4382 docbase
="$cached_docbase"
4383 if test -z "$docbase"; then
4384 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."
4387 # The testsbase defaults to the cached one.
4388 if test -z "$testsbase"; then
4389 testsbase
="$cached_testsbase"
4390 if test -z "$testsbase"; then
4391 func_fatal_error
"missing --tests-base option"
4394 # Require the tests if specified either way.
4395 if ! $inctests; then
4396 inctests
="$cached_inctests"
4397 if test -z "$inctests"; then
4401 # The libname defaults to the cached one.
4402 if test -z "$supplied_libname"; then
4403 libname
="$cached_libname"
4404 if test -z "$libname"; then
4405 func_fatal_error
"missing --lib option"
4408 # Require LGPL if specified either way.
4409 if test -z "$lgpl"; then
4412 # The makefile_name defaults to the cached one.
4413 if test -z "$makefile_name"; then
4414 makefile_name
="$cached_makefile_name"
4416 # Use conditional dependencies if specified either way.
4417 if test -z "$cond_dependencies"; then
4418 cond_dependencies
="$cached_cond_dependencies"
4420 # Use libtool if specified either way, or if guessed.
4421 if test -z "$libtool"; then
4422 if test -n "$cached_m4base"; then
4423 libtool
="$cached_libtool"
4425 libtool
="$guessed_libtool"
4428 # The macro_prefix defaults to the cached one.
4429 if test -z "$macro_prefix"; then
4430 macro_prefix
="$cached_macro_prefix"
4431 if test -z "$macro_prefix"; then
4432 func_fatal_error
"missing --macro-prefix option"
4435 # The po_domain defaults to the cached one.
4436 if test -z "$po_domain"; then
4437 po_domain
="$cached_po_domain"
4439 # The witness_c_macro defaults to the cached one.
4440 if test -z "$witness_c_macro"; then
4441 witness_c_macro
="$cached_witness_c_macro"
4443 # The vc_files defaults to the cached one.
4444 if test -z "$vc_files"; then
4445 vc_files
="$cached_vc_files"
4447 # Ensure constraints.
4448 if test "$cond_dependencies" = true
&& $inctests; then
4449 echo "gnulib-tool: option --conditional-dependencies is not supported with --with-tests" 1>&2
4453 # --without-*-tests options are not supported here.
4455 excl_longrunning_tests
=
4456 excl_privileged_tests
=
4457 excl_unportable_tests
=
4459 # Canonicalize the list of specified modules.
4460 specified_modules
=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
4462 # Include all kinds of tests modules if --with-all-tests was specified.
4463 inc_all_direct_tests
="$inc_all_tests"
4464 inc_all_indirect_tests
="$inc_all_tests"
4466 # Determine final module list.
4467 modules
="$specified_modules"
4468 func_modules_transitive_closure
4469 if test $verbose -ge 0; then
4470 func_show_module_list
4472 final_modules
="$modules"
4474 # Determine main module list and tests-related module list separately.
4475 func_modules_transitive_closure_separately
4477 # Determine whether a $testsbase/libtests.a is needed.
4478 func_determine_use_libtests
4480 # Add the dummy module to the main module list or to the tests-related module
4482 func_modules_add_dummy_separately
4484 # If --lgpl, verify that the licenses of modules are compatible.
4485 if test -n "$lgpl"; then
4486 license_incompatibilities
=
4487 for module
in $main_modules; do
4488 license
=`func_get_license $module`
4490 'GPLed build tool') ;;
4491 'public domain' |
'unlimited' |
'unmodifiable license text') ;;
4496 LGPL | LGPLv2
+ | LGPLv3
+) ;;
4497 *) func_append license_incompatibilities
"$module $license$nl" ;;
4503 *) func_append license_incompatibilities
"$module $license$nl" ;;
4506 *) func_fatal_error
"invalid value lgpl=$lgpl" ;;
4511 if test -n "$license_incompatibilities"; then
4512 # Format the license incompatibilities as a table.
4513 sed_expand_column1_width50_indent17
='s,^\([^ ]*\) ,\1 ,
4514 s,^\(.................................................[^ ]*\) *, \1 ,'
4515 license_incompatibilities
=`echo "$license_incompatibilities" | sed -e "$sed_expand_column1_width50_indent17"`
4516 func_fatal_error
"incompatible license on modules:$nl$license_incompatibilities"
4520 # Show banner notice of every module.
4521 modules
="$main_modules"
4524 # Determine script to apply to imported library files.
4525 sed_transform_lib_file
=
4526 for module
in $main_modules; do
4527 if test $module = config-h
; then
4528 # Assume config.h exists, and that -DHAVE_CONFIG_H is omitted.
4529 sed_transform_lib_file
=$sed_transform_lib_file'
4530 s/^#ifdef[ ]*HAVE_CONFIG_H[ ]*$/#if 1/
4535 sed_transform_main_lib_file
="$sed_transform_lib_file"
4536 if test -n "$do_copyrights"; then
4537 if test -n "$lgpl"; then
4541 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
4542 s/GNU General/GNU Lesser General/g
4543 s/General Public License/Lesser General Public License/g
4544 s/Lesser Lesser General Public License/Lesser General Public License/g
4548 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
4549 s/GNU General/GNU Lesser General/g
4550 s/General Public License/Lesser General Public License/g
4551 s/Lesser Lesser General Public License/Lesser General Public License/g
4553 s/version [23]\([ ,]\)/version 2.1\1/g
4556 *) func_fatal_error
"invalid value lgpl=$lgpl" ;;
4560 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
4561 s/GNU Lesser General/GNU General/g
4562 s/Lesser General Public License/General Public License/g
4564 s/GNU Library General/GNU General/g
4565 s/Library General Public License/General Public License/g
4567 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
4572 # Determine script to apply to auxiliary files that go into $auxdir/.
4573 sed_transform_build_aux_file
=
4574 if test -n "$do_copyrights"; then
4576 sed_transform_build_aux_file
=$sed_transform_build_aux_file'
4577 s/GNU Lesser General/GNU General/g
4578 s/Lesser General Public License/General Public License/g
4580 s/GNU Library General/GNU General/g
4581 s/Library General Public License/General Public License/g
4583 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
4587 # Determine script to apply to library files that go into $testsbase/.
4588 sed_transform_testsrelated_lib_file
="$sed_transform_lib_file"
4589 if test -n "$do_copyrights"; then
4591 sed_transform_testsrelated_lib_file
=$sed_transform_testsrelated_lib_file'
4592 s/GNU Lesser General/GNU General/g
4593 s/Lesser General Public License/General Public License/g
4595 s/GNU Library General/GNU General/g
4596 s/Library General Public License/General Public License/g
4598 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
4602 # Determine the final file lists.
4603 func_modules_to_filelist_separately
4606 || func_fatal_error
"refusing to do nothing"
4608 # Add m4/gnulib-tool.m4 to the file list. It is not part of any module.
4609 new_files
="$files m4/gnulib-tool.m4"
4610 old_files
="$cached_files"
4611 if test -f "$destdir"/$m4base/gnulib-tool.
m4; then
4612 func_append old_files
" m4/gnulib-tool.m4"
4615 rewritten
='%REWRITTEN%'
4616 sed_rewrite_old_files
="\
4617 s,^build-aux/,$rewritten$auxdir/,
4618 s,^doc/,$rewritten$cached_docbase/,
4619 s,^lib/,$rewritten$cached_sourcebase/,
4620 s,^m4/,$rewritten$cached_m4base/,
4621 s,^tests/,$rewritten$cached_testsbase/,
4622 s,^tests=lib/,$rewritten$cached_testsbase/,
4625 sed_rewrite_new_files
="\
4626 s,^build-aux/,$rewritten$auxdir/,
4627 s,^doc/,$rewritten$docbase/,
4628 s,^lib/,$rewritten$sourcebase/,
4629 s,^m4/,$rewritten$m4base/,
4630 s,^tests/,$rewritten$testsbase/,
4631 s,^tests=lib/,$rewritten$testsbase/,
4635 # Create directories.
4636 { echo "$sourcebase"
4638 if test -n "$pobase"; then
4641 docfiles
=`echo "$files" | sed -n -e 's,^doc/,,p'`
4642 if test -n "$docfiles"; then
4649 for f
in $files; do echo $f; done \
4650 |
sed -e "$sed_rewrite_new_files" \
4651 |
sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
4654 { # Rearrange file descriptors. Needed because "while ... done < ..."
4655 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
4656 exec 5<&0 < "$tmp"/dirs
4658 if test ! -d "$destdir/$d"; then
4660 echo "Creating directory $destdir/$d"
4661 mkdir
-p "$destdir/$d" || func_fatal_error
"failed"
4663 echo "Create directory $destdir/$d"
4670 # Copy files or make symbolic links. Remove obsolete files.
4674 # Construct a table with 2 columns: rewritten-file-name original-file-name,
4675 # representing the files according to the last gnulib-tool invocation.
4676 for f
in $old_files; do echo $f; done \
4677 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_old_files" \
4680 # Construct a table with 2 columns: rewritten-file-name original-file-name,
4681 # representing the files after this gnulib-tool invocation.
4682 for f
in $new_files; do echo $f; done \
4683 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" \
4686 # First the files that are in old-files, but not in new-files:
4687 sed_take_first_column
='s,'"$delimiter"'.*,,'
4688 for g
in `LC_ALL=C join -t"$delimiter" -v1 "$tmp"/old-files "$tmp"/new-files | sed -e "$sed_take_first_column"`; do
4689 # Remove the file. Do nothing if the user already removed it.
4690 if test -f "$destdir/$g" ||
test -h "$destdir/$g"; then
4692 echo "Removing file $g (backup in ${g}~)"
4693 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error
"failed"
4695 echo "Remove file $g (backup in ${g}~)"
4697 func_append removed_files
"$g$nl"
4700 # func_add_or_update handles a file that ought to be present afterwards.
4702 # - f the original file name
4703 # - g the rewritten file name
4704 # - already_present nonempty if the file should already exist, empty
4706 func_add_or_update
()
4710 tests
=lib
/*) f
=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
4712 func_dest_tmpfilename
"$g"
4713 func_lookup_file
"$f"
4714 cp "$lookedup_file" "$tmpfile" || func_fatal_error
"failed"
4715 if test -n "$sed_transform_main_lib_file"; then
4718 sed -e "$sed_transform_main_lib_file" \
4719 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
4723 if test -n "$sed_transform_build_aux_file"; then
4726 sed -e "$sed_transform_build_aux_file" \
4727 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
4731 if test -n "$sed_transform_testsrelated_lib_file"; then
4734 sed -e "$sed_transform_testsrelated_lib_file" \
4735 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
4739 if test -f "$destdir/$g"; then
4740 # The file already exists.
4744 # Don't protest if the file should be there but isn't: it happens
4745 # frequently that developers don't put autogenerated files under version control.
4747 func_append added_files
"$g$nl"
4751 # Then the files that are in new-files, but not in old-files:
4752 sed_take_last_column
='s,^.*'"$delimiter"',,'
4754 LC_ALL
=C
join -t"$delimiter" -v2 "$tmp"/old-files
"$tmp"/new-files \
4755 |
sed -e "$sed_take_last_column" \
4756 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/added-files
4757 { # Rearrange file descriptors. Needed because "while ... done < ..."
4758 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
4759 exec 5<&0 < "$tmp"/added-files
4765 # Then the files that are in new-files and in old-files:
4766 already_present
=true
4767 LC_ALL
=C
join -t"$delimiter" "$tmp"/old-files
"$tmp"/new-files \
4768 |
sed -e "$sed_take_last_column" \
4769 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/kept-files
4770 { # Rearrange file descriptors. Needed because "while ... done < ..."
4771 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
4772 exec 5<&0 < "$tmp"/kept-files
4779 # Command-line invocation printed in a comment in generated gnulib-cache.m4.
4780 actioncmd
="gnulib-tool --import"
4781 func_append actioncmd
" --dir=$destdir"
4782 if test -n "$local_gnulib_dir"; then
4783 func_append actioncmd
" --local-dir=$local_gnulib_dir"
4785 func_append actioncmd
" --lib=$libname"
4786 func_append actioncmd
" --source-base=$sourcebase"
4787 func_append actioncmd
" --m4-base=$m4base"
4788 if test -n "$pobase"; then
4789 func_append actioncmd
" --po-base=$pobase"
4791 func_append actioncmd
" --doc-base=$docbase"
4792 func_append actioncmd
" --tests-base=$testsbase"
4793 func_append actioncmd
" --aux-dir=$auxdir"
4795 func_append actioncmd
" --with-tests"
4797 if test -n "$incobsolete"; then
4798 func_append actioncmd
" --with-obsolete"
4800 if test -n "$inc_cxx_tests"; then
4801 func_append actioncmd
" --with-c++-tests"
4803 if test -n "$inc_longrunning_tests"; then
4804 func_append actioncmd
" --with-longrunning-tests"
4806 if test -n "$inc_privileged_tests"; then
4807 func_append actioncmd
" --with-privileged-tests"
4809 if test -n "$inc_unportable_tests"; then
4810 func_append actioncmd
" --with-unportable-tests"
4812 if test -n "$inc_all_tests"; then
4813 func_append actioncmd
" --with-all-tests"
4815 for module
in $avoidlist; do
4816 func_append actioncmd
" --avoid=$module"
4818 if test -n "$lgpl"; then
4819 if test "$lgpl" = yes; then
4820 func_append actioncmd
" --lgpl"
4822 func_append actioncmd
" --lgpl=$lgpl"
4825 if test -n "$makefile_name"; then
4826 func_append actioncmd
" --makefile-name=$makefile_name"
4828 if test "$cond_dependencies" = true
; then
4829 func_append actioncmd
" --conditional-dependencies"
4831 func_append actioncmd
" --no-conditional-dependencies"
4833 if test "$libtool" = true
; then
4834 func_append actioncmd
" --libtool"
4836 func_append actioncmd
" --no-libtool"
4838 func_append actioncmd
" --macro-prefix=$macro_prefix"
4839 if test -n "$po_domain"; then
4840 func_append actioncmd
" --po-domain=$po_domain"
4842 if test -n "$witness_c_macro"; then
4843 func_append actioncmd
" --witness-c-macro=$witness_c_macro"
4845 if test -n "$vc_files"; then
4846 if test "$vc_files" = true
; then
4847 func_append actioncmd
" --vc-files"
4849 func_append actioncmd
" --no-vc-files"
4852 func_append actioncmd
" `echo $specified_modules`"
4854 # Determine include_guard_prefix.
4855 func_compute_include_guard_prefix
4857 # Default the makefile name to Makefile.am.
4858 if test -n "$makefile_name"; then
4859 makefile_am
=$makefile_name
4861 makefile_am
=Makefile.am
4864 # Create normal Makefile.ams.
4867 # Setup list of Makefile.am edits that are to be performed afterwards.
4868 # Some of these edits apply to files that we will generate; others are
4869 # under the responsibility of the developer.
4871 # func_note_Makefile_am_edit dir var value
4872 # remembers that ${dir}Makefile.am needs to be edited to that ${var} mentions
4874 func_note_Makefile_am_edit
()
4876 makefile_am_edits
=`expr $makefile_am_edits + 1`
4877 eval makefile_am_edit
${makefile_am_edits}_dir
=\"\
$1\"
4878 eval makefile_am_edit
${makefile_am_edits}_var
=\"\
$2\"
4879 eval makefile_am_edit
${makefile_am_edits}_val
=\"\
$3\"
4881 if test "$makefile_am" = Makefile.am
; then
4882 sourcebase_dir
=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'`
4883 sourcebase_base
=`basename "$sourcebase"`
4884 func_note_Makefile_am_edit
"$sourcebase_dir" SUBDIRS
"$sourcebase_base"
4886 if test -n "$pobase"; then
4887 pobase_dir
=`echo "$pobase" | sed -n -e 's,/[^/]*$,/,p'`
4888 pobase_base
=`basename "$pobase"`
4889 func_note_Makefile_am_edit
"$pobase_dir" SUBDIRS
"$pobase_base"
4892 if test "$makefile_am" = Makefile.am
; then
4893 testsbase_dir
=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'`
4894 testsbase_base
=`basename "$testsbase"`
4895 func_note_Makefile_am_edit
"$testsbase_dir" SUBDIRS
"$testsbase_base"
4898 func_note_Makefile_am_edit
"" ACLOCAL_AMFLAGS
"-I ${m4base}"
4900 # Find the first parent directory of $m4base that contains or will contain
4902 sed_last
='s,^.*/\([^/][^/]*\)//*$,\1/,
4904 sed_butlast
='s,[^/][^/]*//*$,,'
4905 dir1
="${m4base}/"; dir2
=""
4906 while test -n "$dir1" \
4907 && ! { test -f "${destdir}/${dir1}Makefile.am" \
4908 ||
test "${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
4909 ||
test "./${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
4911 && { test "${dir1}Makefile.am" = "$testsbase/$makefile_am" \
4912 ||
test "./${dir1}Makefile.am" = "$testsbase/$makefile_am"; }; }; }; do
4913 dir2
=`echo "$dir1" | sed -e "$sed_last"`"$dir2"
4914 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
4916 func_note_Makefile_am_edit
"$dir1" EXTRA_DIST
"${dir2}gnulib-cache.m4"
4919 # Create library makefile.
4920 func_dest_tmpfilename
$sourcebase/$makefile_am
4921 destfile
="$sourcebase/$makefile_am"
4922 modules
="$main_modules"
4923 func_emit_lib_Makefile_am
> "$tmpfile"
4924 if test -f "$destdir"/$sourcebase/$makefile_am; then
4925 if cmp -s "$destdir"/$sourcebase/$makefile_am "$tmpfile"; then
4929 echo "Updating $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
4930 mv -f "$destdir"/$sourcebase/$makefile_am "$destdir"/$sourcebase/$makefile_am~
4931 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
4933 echo "Update $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
4939 echo "Creating $sourcebase/$makefile_am"
4940 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
4942 echo "Create $sourcebase/$makefile_am"
4945 func_append added_files
"$sourcebase/$makefile_am$nl"
4948 # Create po/ directory.
4949 if test -n "$pobase"; then
4950 # Create po makefile and auxiliary files.
4951 for file in Makefile.
in.
in remove-potcdate.sin
; do
4952 func_dest_tmpfilename
$pobase/$file
4953 func_lookup_file build-aux
/po
/$file
4954 cat "$lookedup_file" > "$tmpfile"
4955 if test -f "$destdir"/$pobase/$file; then
4956 if cmp -s "$destdir"/$pobase/$file "$tmpfile"; then
4960 echo "Updating $pobase/$file (backup in $pobase/$file~)"
4961 mv -f "$destdir"/$pobase/$file "$destdir"/$pobase/$file~
4962 mv -f "$tmpfile" "$destdir"/$pobase/$file
4964 echo "Update $pobase/$file (backup in $pobase/$file~)"
4970 echo "Creating $pobase/$file"
4971 mv -f "$tmpfile" "$destdir"/$pobase/$file
4973 echo "Create $pobase/$file"
4976 func_append added_files
"$pobase/$file$nl"
4979 # Create po makefile parameterization, part 1.
4980 func_dest_tmpfilename
$pobase/Makevars
4981 func_emit_po_Makevars
> "$tmpfile"
4982 if test -f "$destdir"/$pobase/Makevars
; then
4983 if cmp -s "$destdir"/$pobase/Makevars
"$tmpfile"; then
4987 echo "Updating $pobase/Makevars (backup in $pobase/Makevars~)"
4988 mv -f "$destdir"/$pobase/Makevars
"$destdir"/$pobase/Makevars~
4989 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
4991 echo "Update $pobase/Makevars (backup in $pobase/Makevars~)"
4997 echo "Creating $pobase/Makevars"
4998 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
5000 echo "Create $pobase/Makevars"
5003 func_append added_files
"$pobase/Makevars$nl"
5005 # Create po makefile parameterization, part 2.
5006 func_dest_tmpfilename
$pobase/POTFILES.
in
5007 func_emit_po_POTFILES_in
> "$tmpfile"
5008 if test -f "$destdir"/$pobase/POTFILES.
in; then
5009 if cmp -s "$destdir"/$pobase/POTFILES.
in "$tmpfile"; then
5013 echo "Updating $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
5014 mv -f "$destdir"/$pobase/POTFILES.
in "$destdir"/$pobase/POTFILES.
in~
5015 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.
in
5017 echo "Update $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
5023 echo "Creating $pobase/POTFILES.in"
5024 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.
in
5026 echo "Create $pobase/POTFILES.in"
5029 func_append added_files
"$pobase/POTFILES.in$nl"
5032 TP_URL
="http://translationproject.org/latest/"
5033 TP_RSYNC_URI
="translationproject.org::tp/latest/"
5035 echo "Fetching gnulib PO files from $TP_URL"
5036 (cd "$destdir"/$pobase \
5037 && { # Prefer rsync over wget if it is available, since it consumes
5038 # less network bandwidth, due to compression.
5039 if type rsync
2>/dev
/null |
grep / > /dev
/null
; then
5040 rsync
-Lrtz "${TP_RSYNC_URI}gnulib/" .
5042 wget
--quiet -r -l1 -nd -np -A.po
"${TP_URL}gnulib"
5047 echo "Fetch gnulib PO files from $TP_URL"
5049 # Create po/LINGUAS.
5051 func_dest_tmpfilename
$pobase/LINGUAS
5052 (cd "$destdir"/$pobase \
5053 && { echo '# Set of available languages.'
5054 LC_ALL
=C
ls -1 *.po |
sed -e 's,\.po$,,'
5057 if test -f "$destdir"/$pobase/LINGUAS
; then
5058 if cmp -s "$destdir"/$pobase/LINGUAS
"$tmpfile"; then
5061 echo "Updating $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
5062 mv -f "$destdir"/$pobase/LINGUAS
"$destdir"/$pobase/LINGUAS~
5063 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
5066 echo "Creating $pobase/LINGUAS"
5067 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
5068 func_append added_files
"$pobase/LINGUAS$nl"
5071 if test -f "$destdir"/$pobase/LINGUAS
; then
5072 echo "Update $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
5074 echo "Create $pobase/LINGUAS"
5079 # Create m4/gnulib-cache.m4.
5080 func_dest_tmpfilename
$m4base/gnulib-cache.
m4
5082 func_emit_copyright_notice
5084 echo "# This file represents the specification of how gnulib-tool is used."
5085 echo "# It acts as a cache: It is written and read by gnulib-tool."
5086 echo "# In projects that use version control, this file is meant to be put under"
5087 echo "# version control, like the configure.ac and various Makefile.am files."
5090 echo "# Specification in the form of a command-line invocation:"
5093 echo "# Specification in the form of a few gnulib-tool.m4 macro invocations:"
5094 # Store the local_gnulib_dir relative to destdir.
5095 case "$local_gnulib_dir" in
5097 relative_local_gnulib_dir
="$local_gnulib_dir" ;;
5100 /*) relative_local_gnulib_dir
="$local_gnulib_dir" ;;
5102 # destdir, local_gnulib_dir are both relative.
5103 func_relativize
"$destdir" "$local_gnulib_dir"
5104 relative_local_gnulib_dir
="$reldir" ;;
5107 echo "gl_LOCAL_DIR([$relative_local_gnulib_dir])"
5109 echo "$specified_modules" |
sed -e 's/^/ /g'
5111 test -z "$incobsolete" ||
echo "gl_WITH_OBSOLETE"
5112 test -z "$inc_cxx_tests" ||
echo "gl_WITH_CXX_TESTS"
5113 test -z "$inc_longrunning_tests" ||
echo "gl_WITH_LONGRUNNING_TESTS"
5114 test -z "$inc_privileged_tests" ||
echo "gl_WITH_PRIVILEGED_TESTS"
5115 test -z "$inc_unportable_tests" ||
echo "gl_WITH_UNPORTABLE_TESTS"
5116 test -z "$inc_all_tests" ||
echo "gl_WITH_ALL_TESTS"
5117 echo "gl_AVOID([$avoidlist])"
5118 echo "gl_SOURCE_BASE([$sourcebase])"
5119 echo "gl_M4_BASE([$m4base])"
5120 echo "gl_PO_BASE([$pobase])"
5121 echo "gl_DOC_BASE([$docbase])"
5122 echo "gl_TESTS_BASE([$testsbase])"
5124 echo "gl_WITH_TESTS"
5126 echo "gl_LIB([$libname])"
5127 if test -n "$lgpl"; then
5128 if test "$lgpl" = yes; then
5131 echo "gl_LGPL([$lgpl])"
5134 echo "gl_MAKEFILE_NAME([$makefile_name])"
5135 if test "$cond_dependencies" = true
; then
5136 echo "gl_CONDITIONAL_DEPENDENCIES"
5138 if test "$libtool" = true
; then
5141 echo "gl_MACRO_PREFIX([$macro_prefix])"
5142 echo "gl_PO_DOMAIN([$po_domain])"
5143 echo "gl_WITNESS_C_DOMAIN([$witness_c_macro])"
5144 if test -n "$vc_files"; then
5145 echo "gl_VC_FILES([$vc_files])"
5148 if test -f "$destdir"/$m4base/gnulib-cache.
m4; then
5149 if cmp -s "$destdir"/$m4base/gnulib-cache.
m4 "$tmpfile"; then
5153 echo "Updating $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
5154 mv -f "$destdir"/$m4base/gnulib-cache.
m4 "$destdir"/$m4base/gnulib-cache.
m4~
5155 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.
m4
5157 echo "Update $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
5161 echo "# gnulib-cache.m4 ends here"
5168 echo "Creating $m4base/gnulib-cache.m4"
5169 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.
m4
5171 echo "Create $m4base/gnulib-cache.m4"
5177 # Create m4/gnulib-comp.m4.
5178 func_dest_tmpfilename
$m4base/gnulib-comp.
m4
5180 echo "# DO NOT EDIT! GENERATED AUTOMATICALLY!"
5181 func_emit_copyright_notice
5183 echo "# This file represents the compiled summary of the specification in"
5184 echo "# gnulib-cache.m4. It lists the computed macro invocations that need"
5185 echo "# to be invoked from configure.ac."
5186 echo "# In projects that use version control, this file can be treated like"
5187 echo "# other built files."
5190 echo "# This macro should be invoked from $configure_ac, in the section"
5191 echo "# \"Checks for programs\", right after AC_PROG_CC, and certainly before"
5192 echo "# any checks for libraries, header files, types and library functions."
5193 echo "AC_DEFUN([${macro_prefix}_EARLY],"
5195 echo " m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
5196 echo " m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
5197 echo " m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
5198 echo " m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
5199 echo " AC_REQUIRE([gl_PROG_AR_RANLIB])"
5200 if test -n "$uses_subdirs"; then
5201 echo " AC_REQUIRE([AM_PROG_CC_C_O])"
5203 for module
in $final_modules; do
5205 if test -n "$module"; then
5206 echo "# Code from module $module:"
5207 func_get_autoconf_early_snippet
"$module"
5210 |
sed -e '/^$/d;' -e 's/^/ /'
5213 echo "# This macro should be invoked from $configure_ac, in the section"
5214 echo "# \"Check for header files, types and library functions\"."
5215 echo "AC_DEFUN([${macro_prefix}_INIT],"
5217 if test "$libtool" = true
; then
5218 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
5219 echo " gl_cond_libtool=true"
5221 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
5222 echo " gl_cond_libtool=false"
5224 echo " gl_ltlibdeps="
5226 if test "$auxdir" != "build-aux"; then
5227 sed_replace_build_aux
='
5229 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
5230 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
5234 sed_replace_build_aux
="$sed_noop"
5236 echo " gl_m4_base='$m4base'"
5237 func_emit_initmacro_start
$macro_prefix
5238 echo " gl_source_base='$sourcebase'"
5239 if test -n "$witness_c_macro"; then
5240 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$witness_c_macro])"
5242 func_emit_autoconf_snippets
"$main_modules" func_verify_module true false true
5243 if test -n "$witness_c_macro"; then
5244 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
5246 echo " # End of code from modules"
5247 func_emit_initmacro_end
$macro_prefix
5248 echo " gltests_libdeps="
5249 echo " gltests_ltlibdeps="
5250 func_emit_initmacro_start
${macro_prefix}tests
5251 echo " gl_source_base='$testsbase'"
5252 # Define a tests witness macro that depends on the package.
5253 # PACKAGE is defined by AM_INIT_AUTOMAKE, PACKAGE_TARNAME is defined by AC_INIT.
5254 # See <http://lists.gnu.org/archive/html/automake/2009-05/msg00145.html>.
5255 echo "changequote(,)dnl"
5256 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"
5257 echo "changequote([, ])dnl"
5258 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
5259 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
5260 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
5261 func_emit_autoconf_snippets
"$testsrelated_modules" func_verify_module true true true
5262 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
5263 func_emit_initmacro_end
${macro_prefix}tests
5264 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
5265 # created using libtool, because libtool already handles the dependencies.
5266 if test "$libtool" != true
; then
5267 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
5268 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
5269 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
5270 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
5271 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
5273 if $use_libtests; then
5274 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
5275 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
5278 func_emit_initmacro_done
$macro_prefix $sourcebase
5279 func_emit_initmacro_done
${macro_prefix}tests
$testsbase
5281 echo "# This macro records the list of files which have been installed by"
5282 echo "# gnulib-tool and may be removed by future gnulib-tool invocations."
5283 echo "AC_DEFUN([${macro_prefix}_FILE_LIST], ["
5284 echo "$files" |
sed -e 's,^, ,'
5287 if test -f "$destdir"/$m4base/gnulib-comp.
m4; then
5288 if cmp -s "$destdir"/$m4base/gnulib-comp.
m4 "$tmpfile"; then
5292 echo "Updating $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
5293 mv -f "$destdir"/$m4base/gnulib-comp.
m4 "$destdir"/$m4base/gnulib-comp.
m4~
5294 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.
m4
5296 echo "Update $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
5300 echo "# gnulib-comp.m4 ends here"
5307 echo "Creating $m4base/gnulib-comp.m4"
5308 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.
m4
5310 echo "Create $m4base/gnulib-comp.m4"
5317 # Create tests makefile.
5318 func_dest_tmpfilename
$testsbase/$makefile_am
5319 destfile
="$testsbase/$makefile_am"
5320 modules
="$testsrelated_modules"
5321 func_emit_tests_Makefile_am
"${macro_prefix}tests_WITNESS" > "$tmpfile"
5322 if test -f "$destdir"/$testsbase/$makefile_am; then
5323 if cmp -s "$destdir"/$testsbase/$makefile_am "$tmpfile"; then
5327 echo "Updating $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
5328 mv -f "$destdir"/$testsbase/$makefile_am "$destdir"/$testsbase/$makefile_am~
5329 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
5331 echo "Update $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
5337 echo "Creating $testsbase/$makefile_am"
5338 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
5340 echo "Create $testsbase/$makefile_am"
5343 func_append added_files
"$testsbase/$makefile_am$nl"
5347 if test "$vc_files" != false
; then
5348 # Update the .cvsignore and .gitignore files.
5349 { echo "$added_files" |
sed -e '/^$/d' -e 's,\([^/]*\)$,|A|\1,'
5350 echo "$removed_files" |
sed -e '/^$/d' -e 's,\([^/]*\)$,|R|\1,'
5351 # Treat gnulib-comp.m4 like an added file, even if it already existed.
5352 echo "$m4base/|A|gnulib-comp.m4"
5353 } | LC_ALL
=C
sort -t'|' -k1,1 > "$tmp"/fileset-changes
5354 { # Rearrange file descriptors. Needed because "while ... done < ..."
5355 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5356 exec 5<&0 < "$tmp"/fileset-changes
5357 func_update_ignorelist
()
5360 if test "$ignore" = .gitignore
; then
5361 # In a .gitignore file, "foo" applies to the current directory and all
5362 # subdirectories, whereas "/foo" applies to the current directory only.
5365 doubly_escaped_anchor
='\\/'
5369 doubly_escaped_anchor
=''
5371 if test -f "$destdir/$dir$ignore"; then
5372 if test -n "$dir_added" ||
test -n "$dir_removed"; then
5373 sed -e "s|^$anchor||" < "$destdir/$dir$ignore" | LC_ALL
=C
sort > "$tmp"/ignore
5374 (echo "$dir_added" |
sed -e '/^$/d' | LC_ALL
=C
sort -u \
5375 | LC_ALL
=C
join -v 1 - "$tmp"/ignore
> "$tmp"/ignore-added
5376 echo "$dir_removed" |
sed -e '/^$/d' | LC_ALL
=C
sort -u \
5377 | LC_ALL
=C
join -v 1 - "$tmp"/ignore
> "$tmp"/ignore-removed
5379 if test -s "$tmp"/ignore-added ||
test -s "$tmp"/ignore-removed
; then
5381 echo "Updating $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
5382 mv -f "$destdir/$dir$ignore" "$destdir/$dir$ignore"~
5383 { sed -e 's,/,\\/,g' -e 's,^,/^,' -e 's,$,\$/d,' < "$tmp"/ignore-removed
5384 if test -n "$anchor"; then sed -e 's,/,\\/,g' -e "s,^,/^${doubly_escaped_anchor}," -e 's,$,$/d,' < "$tmp"/ignore-removed
; fi
5385 } > "$tmp"/sed-ignore-removed
5386 { cat "$destdir/$dir$ignore"~
5387 sed -e "s|^|$anchor|" < "$tmp"/ignore-added
5388 } |
sed -f "$tmp"/sed-ignore-removed \
5389 > "$destdir/$dir$ignore"
5391 echo "Update $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
5396 if test -n "$dir_added"; then
5398 echo "Creating $destdir/$dir$ignore"
5400 if test "$ignore" = .cvsignore
; then
5402 # Automake generates Makefile rules that create .dirstamp files.
5405 echo "$dir_added" |
sed -e '/^$/d' -e "s|^|$anchor|" | LC_ALL
=C
sort -u
5406 } > "$destdir/$dir$ignore"
5408 echo "Create $destdir/$dir$ignore"
5418 if test -d "$destdir/CVS" ||
test -d "$destdir/${dir}CVS" ||
test -f "$destdir/${dir}.cvsignore"; then
5419 func_update_ignorelist .cvsignore
5421 if test -d "$destdir/.git" ||
test -f "$destdir/${dir}.gitignore"; then
5422 func_update_ignorelist .gitignore
5429 # Why not ''read next_dir op file'' ? Because the dir column can be empty.
5430 next_dir
=`echo "$line" | sed -e 's,|.*,,'`
5431 op
=`echo "$line" | sed -e 's,^[^|]*|\([^|]*\)|.*$,\1,'`
5432 file=`echo "$line" | sed -e 's,^[^|]*|[^|]*|,,'`
5433 if test "$next_dir" != "$last_dir"; then
5434 func_done_dir
"$last_dir" "$last_dir_added" "$last_dir_removed"
5435 last_dir
="$next_dir"
5440 A
) func_append last_dir_added
"$file$nl";;
5441 R
) func_append last_dir_removed
"$file$nl";;
5444 func_done_dir
"$last_dir" "$last_dir_added" "$last_dir_removed"
5451 echo "You may need to add #include directives for the following .h files."
5452 # Intersect $specified_modules and $main_modules
5453 # (since $specified_modules is not necessarily of subset of $main_modules
5454 # - some may have been skipped through --avoid, and since the elements of
5455 # $main_modules but not in $specified_modules can go away without explicit
5456 # notice - through changes in the module dependencies).
5457 echo "$specified_modules" > "$tmp"/modules1
# a sorted list, one module per line
5458 echo "$main_modules" > "$tmp"/modules2
# also a sorted list, one module per line
5459 # First the #include <...> directives without #ifs, sorted for convenience,
5460 # then the #include "..." directives without #ifs, sorted for convenience,
5461 # then the #include directives that are surrounded by #ifs. Not sorted.
5462 for module
in `LC_ALL=C join "$tmp"/modules1 "$tmp"/modules2`; do
5463 include_directive
=`func_get_include_directive "$module"`
5464 case "$nl$include_directive" in
5466 echo "$include_directive" 1>&5
5469 echo "$include_directive" |
grep -v 'include "' 1>&6
5470 echo "$include_directive" |
grep 'include "' 1>&7
5473 done 5> "$tmp"/include-if
6> "$tmp"/include-angles
7> "$tmp"/include-quotes
5475 LC_ALL
=C
sort -u "$tmp"/include-angles
5476 LC_ALL
=C
sort -u "$tmp"/include-quotes
5477 cat "$tmp"/include-if
5478 ) |
sed -e '/^$/d' -e 's/^/ /'
5479 rm -f "$tmp"/include-angles
"$tmp"/include-quotes
"$tmp"/include-if
5481 for module
in $main_modules; do
5482 func_get_link_directive
"$module"
5484 | LC_ALL
=C
sort -u |
sed -e '/^$/d' -e 's/^/ /' > "$tmp"/link
5485 if test `wc -l < "$tmp"/link` != 0; then
5487 echo "You may need to use the following Makefile variables when linking."
5488 echo "Use them in <program>_LDADD when linking a program, or"
5489 echo "in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library."
5495 echo "Don't forget to"
5496 if test "$makefile_am" = Makefile.am
; then
5497 echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
5499 echo " - \"include $makefile_name\" from within \"$sourcebase/Makefile.am\","
5501 if test -n "$pobase"; then
5502 echo " - add \"$pobase/Makefile.in\" to AC_CONFIG_FILES in $configure_ac,"
5505 if test "$makefile_am" = Makefile.am
; then
5506 echo " - add \"$testsbase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
5508 echo " - \"include $makefile_name\" from within \"$testsbase/Makefile.am\","
5512 while test $edit != $makefile_am_edits; do
5513 edit
=`expr $edit + 1`
5514 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
5515 eval var
=\"\
$makefile_am_edit${edit}_var
\"
5516 eval val
=\"\
$makefile_am_edit${edit}_val
\"
5517 if test -n "$var"; then
5518 echo " - mention \"${val}\" in ${var} in ${dir}Makefile.am,"
5521 if grep '^ *AC_PROG_CC_STDC' "$configure_ac" > /dev
/null
; then
5522 position_early_after
=AC_PROG_CC_STDC
5524 if grep '^ *AC_PROG_CC_C99' "$configure_ac" > /dev
/null
; then
5525 position_early_after
=AC_PROG_CC_C99
5527 position_early_after
=AC_PROG_CC
5530 echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after $position_early_after,"
5531 echo " - invoke ${macro_prefix}_INIT in $configure_ac."
5534 # func_create_testdir testdir modules
5536 # - local_gnulib_dir from --local-dir
5537 # - modcache true or false, from --cache-modules/--no-cache-modules
5538 # - auxdir directory relative to destdir where to place build aux files
5539 # - inctests true if tests should be included, false otherwise
5540 # - incobsolete true if obsolete modules among dependencies should be
5541 # included, blank otherwise
5542 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
5544 # - excl_longrunning_tests true if long-runnings tests should be excluded,
5546 # - excl_privileged_tests true if tests that require root privileges should be
5547 # excluded, blank otherwise
5548 # - excl_unportable_tests true if tests that fail on some platforms should be
5549 # excluded, blank otherwise
5550 # - single_configure true if a single configure file should be generated,
5551 # false for a separate configure file for the tests
5552 # - avoidlist list of modules to avoid
5553 # - cond_dependencies true if --conditional-dependencies was given, false if
5554 # --no-conditional-dependencies was given, blank otherwise
5555 # - libtool true if --libtool was given, false if --no-libtool was
5556 # given, blank otherwise
5557 # - symbolic true if files should be symlinked, copied otherwise
5558 # - lsymbolic true if files from local_gnulib_dir should be symlinked,
5560 func_create_testdir
()
5564 if test -z "$modules"; then
5565 # All modules together.
5566 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
5567 # Except ftruncate, mountlist, which abort the configuration on mingw. FIXME.
5568 # Except lib-ignore, which leads to link errors when Sun C++ is used. FIXME.
5569 modules
=`func_all_modules`
5570 modules
=`for m in $modules; do case $m in config-h | ftruncate | mountlist | lib-ignore) ;; *) echo $m;; esac; done`
5572 specified_modules
="$modules"
5574 # Canonicalize the list of specified modules.
5575 specified_modules
=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
5577 # Unlike in func_import, here we want to include all kinds of tests for the
5578 # directly specified modules, but not for dependencies.
5579 inc_all_direct_tests
=true
5580 inc_all_indirect_tests
="$inc_all_tests"
5582 # Check that the license of every module is consistent with the license of
5584 saved_inctests
="$inctests"
5585 # When computing transitive closures, don't consider $module to depend on
5586 # $module-tests. Need this because tests are implicitly GPL and may depend
5587 # on GPL modules - therefore we don't want a warning in this case.
5589 for requested_module
in $specified_modules; do
5590 requested_license
=`func_get_license "$requested_module"`
5591 if test "$requested_license" != GPL
; then
5592 # Here we use func_modules_transitive_closure, not just
5593 # func_get_dependencies, so that we also detect weird situations like
5594 # an LGPL module which depends on a GPLed build tool module which depends
5596 modules
="$requested_module"
5597 func_modules_transitive_closure
5598 for module
in $modules; do
5599 license
=`func_get_license "$module"`
5601 'GPLed build tool') ;;
5602 'public domain' |
'unlimited' |
'unmodifiable license text') ;;
5604 case "$requested_license" in
5607 GPLv2
+ | LGPLv2
+) ;;
5608 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
5614 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
5620 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
5629 inctests
="$saved_inctests"
5631 # Subdirectory names.
5642 # Determine final module list.
5643 modules
="$specified_modules"
5644 func_modules_transitive_closure
5645 if test $verbose -ge 0; then
5646 func_show_module_list
5648 final_modules
="$modules"
5650 if $single_configure; then
5651 # Determine main module list and tests-related module list separately.
5652 func_modules_transitive_closure_separately
5655 if $single_configure; then
5656 # Determine whether a $testsbase/libtests.a is needed.
5657 func_determine_use_libtests
5660 # Add the dummy module if needed.
5661 if $single_configure; then
5662 func_modules_add_dummy_separately
5664 func_modules_add_dummy
5667 # Show banner notice of every module.
5668 if $single_configure; then
5669 modules
="$main_modules"
5675 # Determine final file list.
5676 if $single_configure; then
5677 func_modules_to_filelist_separately
5679 func_modules_to_filelist
5680 if test $verbose -ge 0; then
5682 echo "$files" |
sed -e 's/^/ /'
5685 # Add files for which the copy in gnulib is newer than the one that
5686 # "automake --add-missing --copy" would provide.
5687 files
="$files build-aux/config.guess"
5688 files
="$files build-aux/config.sub"
5689 files
=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
5691 rewritten
='%REWRITTEN%'
5692 sed_rewrite_files
="\
5693 s,^build-aux/,$rewritten$auxdir/,
5694 s,^doc/,$rewritten$docbase/,
5695 s,^lib/,$rewritten$sourcebase/,
5696 s,^m4/,$rewritten$m4base/,
5697 s,^tests/,$rewritten$testsbase/,
5698 s,^tests=lib/,$rewritten$testsbase/,
5702 # Create directories.
5703 for f
in $files; do echo $f; done \
5704 |
sed -e "$sed_rewrite_files" \
5705 |
sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
5706 | LC_ALL
=C
sort -u \
5708 { # Rearrange file descriptors. Needed because "while ... done < ..."
5709 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5710 exec 5<&0 < "$tmp"/dirs
5712 mkdir
-p "$testdir/$d"
5717 # Copy files or make symbolic links.
5719 for f
in $files; do echo $f; done \
5720 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_files" \
5723 { # Rearrange file descriptors. Needed because "while ... done < ..."
5724 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5725 exec 5<&0 < "$tmp"/files
5728 tests
=lib
/*) f
=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
5730 func_lookup_file
"$f"
5731 if test -n "$lookedup_tmp"; then
5732 cp -p "$lookedup_file" "$testdir/$g"
5734 ln "$lookedup_file" "$testdir/$g" 2>/dev
/null ||
5735 if { test -n "$symbolic" \
5736 ||
{ test -n "$lsymbolic" \
5737 && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; }; then
5738 func_ln
"$lookedup_file" "$testdir/$g"
5740 cp -p "$lookedup_file" "$testdir/$g"
5747 # Determine include_guard_prefix.
5748 func_compute_include_guard_prefix
5750 # Create Makefile.ams that are for testing.
5753 # No special edits are needed.
5756 # Create $sourcebase/Makefile.am.
5757 mkdir
-p "$testdir/$sourcebase"
5758 destfile
="$sourcebase/Makefile.am"
5759 if $single_configure; then
5760 modules
="$main_modules"
5762 func_emit_lib_Makefile_am
> "$testdir/$sourcebase/Makefile.am"
5763 any_uses_subdirs
="$uses_subdirs"
5765 # Create $m4base/Makefile.am.
5766 mkdir
-p "$testdir/$m4base"
5767 (echo "## Process this file with automake to produce Makefile.in."
5773 echo "EXTRA_DIST += "`echo "$f" | sed -e 's,^m4/,,'` ;;
5776 ) > "$testdir/$m4base/Makefile.am"
5778 subdirs
="$sourcebase $m4base"
5779 subdirs_with_configure_ac
=""
5781 if false
&& test -f "$testdir"/$m4base/gettext.
m4; then
5782 # Avoid stupid error message from automake:
5783 # "AM_GNU_GETTEXT used but `po' not in SUBDIRS"
5784 mkdir
-p "$testdir/po"
5785 (echo "## Process this file with automake to produce Makefile.in."
5786 ) > "$testdir/po/Makefile.am"
5787 func_append subdirs
" po"
5791 test -d "$testdir/$testsbase" || mkdir
"$testdir/$testsbase"
5792 if $single_configure; then
5793 # Create $testsbase/Makefile.am.
5794 destfile
="$testsbase/Makefile.am"
5795 modules
="$testsrelated_modules"
5796 func_emit_tests_Makefile_am
"${macro_prefix}tests_WITNESS" > "$testdir/$testsbase/Makefile.am"
5798 # Viewed from the $testsbase subdirectory, $auxdir is different.
5799 saved_auxdir
="$auxdir"
5800 auxdir
=`echo "$testsbase/" | sed -e 's%[^/][^/]*//*%../%g'`"$auxdir"
5801 # Create $testsbase/Makefile.am.
5803 destfile
="$testsbase/Makefile.am"
5804 func_emit_tests_Makefile_am
"" > "$testdir/$testsbase/Makefile.am"
5805 any_uses_subdirs
="$any_uses_subdirs$uses_subdirs"
5806 # Create $testsbase/configure.ac.
5807 (echo "# Process this file with autoconf to produce a configure script."
5808 echo "AC_INIT([dummy], [0])"
5809 echo "AC_CONFIG_AUX_DIR([$auxdir])"
5810 echo "AM_INIT_AUTOMAKE"
5812 echo "AC_CONFIG_HEADERS([config.h])"
5815 echo "AC_PROG_INSTALL"
5816 echo "AC_PROG_MAKE_SET"
5817 echo "gl_PROG_AR_RANLIB"
5819 if test -n "$uses_subdirs"; then
5820 echo "AM_PROG_CC_C_O"
5823 for module
in $modules; do
5825 if test -n "$module"; then
5827 gnumakefile | maintainer-makefile
)
5828 # These modules are meant to be used only in the top-level directory.
5831 func_get_autoconf_early_snippet
"$module"
5836 |
sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
5837 if test "$libtool" = true
; then
5838 echo "LT_INIT([win32-dll])"
5839 echo "LT_LANG([C++])"
5840 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
5841 echo "gl_cond_libtool=true"
5843 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
5844 echo "gl_cond_libtool=false"
5846 echo "gl_ltlibdeps="
5848 # Wrap the set of autoconf snippets into an autoconf macro that is then
5849 # invoked. This is needed because autoconf does not support AC_REQUIRE
5851 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
5852 # but we want the AC_REQUIRE to have its normal meaning (provide one
5853 # expansion of the required macro before the current point, and only one
5855 echo "AC_DEFUN([gl_INIT], ["
5856 sed_replace_build_aux
='
5858 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
5859 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
5862 echo "gl_m4_base='../$m4base'"
5863 func_emit_initmacro_start
$macro_prefix
5864 # We don't have explicit ordering constraints between the various
5865 # autoconf snippets. It's cleanest to put those of the library before
5866 # those of the tests.
5867 echo "gl_source_base='../$sourcebase'"
5868 func_emit_autoconf_snippets
"$modules" func_verify_nontests_module false false false
5869 echo "gl_source_base='.'"
5870 func_emit_autoconf_snippets
"$modules" func_verify_tests_module false false false
5871 func_emit_initmacro_end
$macro_prefix
5872 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
5873 # created using libtool, because libtool already handles the dependencies.
5874 if test "$libtool" != true
; then
5875 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
5876 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
5877 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
5878 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
5879 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
5882 func_emit_initmacro_done
$macro_prefix $sourcebase # FIXME use $sourcebase or $testsbase?
5886 # Usually $testsbase/config.h will be a superset of config.h. Verify this
5887 # by "merging" config.h into $testsbase/config.h; look out for gcc warnings.
5888 echo "AH_TOP([#include \"../config.h\"])"
5890 echo "AC_CONFIG_FILES([Makefile])"
5892 ) > "$testdir/$testsbase/configure.ac"
5893 auxdir
="$saved_auxdir"
5894 subdirs_with_configure_ac
="$subdirs_with_configure_ac $testsbase"
5896 func_append subdirs
" $testsbase"
5899 # Create Makefile.am.
5900 (echo "## Process this file with automake to produce Makefile.in."
5902 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
5904 echo "SUBDIRS = $subdirs"
5906 echo "ACLOCAL_AMFLAGS = -I $m4base"
5907 ) > "$testdir/Makefile.am"
5909 # Create configure.ac.
5910 (echo "# Process this file with autoconf to produce a configure script."
5911 echo "AC_INIT([dummy], [0])"
5912 if test "$auxdir" != "."; then
5913 echo "AC_CONFIG_AUX_DIR([$auxdir])"
5915 echo "AM_INIT_AUTOMAKE"
5917 echo "AC_CONFIG_HEADERS([config.h])"
5920 echo "AC_PROG_INSTALL"
5921 echo "AC_PROG_MAKE_SET"
5923 echo "# For autobuild."
5924 echo "AC_CANONICAL_BUILD"
5925 echo "AC_CANONICAL_HOST"
5927 echo "m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
5928 echo "m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
5929 echo "m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
5930 echo "m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
5932 echo "gl_PROG_AR_RANLIB"
5934 if test -n "$any_uses_subdirs"; then
5935 echo "AM_PROG_CC_C_O"
5938 for module
in $final_modules; do
5939 if $single_configure; then
5942 func_verify_nontests_module
5944 if test -n "$module"; then
5945 func_get_autoconf_early_snippet
"$module"
5948 |
sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
5949 if test "$libtool" = true
; then
5950 echo "LT_INIT([win32-dll])"
5951 echo "LT_LANG([C++])"
5952 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
5953 echo "gl_cond_libtool=true"
5955 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
5956 echo "gl_cond_libtool=false"
5958 echo "gl_ltlibdeps="
5960 # Wrap the set of autoconf snippets into an autoconf macro that is then
5961 # invoked. This is needed because autoconf does not support AC_REQUIRE
5963 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
5964 # but we want the AC_REQUIRE to have its normal meaning (provide one
5965 # expansion of the required macro before the current point, and only one
5967 echo "AC_DEFUN([gl_INIT], ["
5968 if test "$auxdir" != "build-aux"; then
5969 sed_replace_build_aux
='
5971 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
5972 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
5976 sed_replace_build_aux
="$sed_noop"
5978 echo "gl_m4_base='$m4base'"
5979 func_emit_initmacro_start
$macro_prefix
5980 echo "gl_source_base='$sourcebase'"
5981 if $single_configure; then
5982 func_emit_autoconf_snippets
"$main_modules" func_verify_module true false false
5984 func_emit_autoconf_snippets
"$modules" func_verify_nontests_module true false false
5986 func_emit_initmacro_end
$macro_prefix
5987 if $single_configure; then
5988 echo " gltests_libdeps="
5989 echo " gltests_ltlibdeps="
5990 func_emit_initmacro_start
${macro_prefix}tests
5991 echo " gl_source_base='$testsbase'"
5992 # Define a tests witness macro.
5993 echo " ${macro_prefix}tests_WITNESS=IN_GNULIB_TESTS"
5994 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
5995 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
5996 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
5997 func_emit_autoconf_snippets
"$testsrelated_modules" func_verify_module true false false
5998 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
5999 func_emit_initmacro_end
${macro_prefix}tests
6001 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
6002 # created using libtool, because libtool already handles the dependencies.
6003 if test "$libtool" != true
; then
6004 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
6005 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
6006 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
6007 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
6008 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
6010 if $single_configure; then
6011 if $use_libtests; then
6012 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
6013 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
6017 func_emit_initmacro_done
$macro_prefix $sourcebase
6018 if $single_configure; then
6019 func_emit_initmacro_done
${macro_prefix}tests
$testsbase
6024 if test -n "$subdirs_with_configure_ac"; then
6025 echo "AC_CONFIG_SUBDIRS(["`echo $subdirs_with_configure_ac`"])"
6027 makefiles
="Makefile"
6028 for d
in $subdirs; do
6029 # For subdirs that have a configure.ac by their own, it's the subdir's
6030 # configure.ac which creates the subdir's Makefile.am, not this one.
6031 case " $subdirs_with_configure_ac " in
6033 *) func_append makefiles
" $d/Makefile" ;;
6036 echo "AC_CONFIG_FILES([$makefiles])"
6038 ) > "$testdir/configure.ac"
6040 # Create autogenerated files.
6042 # Do not use "${AUTORECONF} --force --install", because it may invoke
6043 # autopoint, which brings in older versions of some of our .m4 files.
6044 if test -f $m4base/gettext.
m4; then
6045 func_execute_command
${AUTOPOINT} --force || func_exit
1
6046 for f
in $m4base/*.
m4~
; do
6048 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit
1
6052 if test "$libtool" = true
; then
6053 func_execute_command
${LIBTOOLIZE} --copy || func_exit
1
6055 func_execute_command
${ACLOCAL} -I $m4base || func_exit
1
6056 if ! test -d build-aux
; then
6057 func_execute_command mkdir build-aux || func_exit
1
6059 func_execute_command
${AUTOCONF} || func_exit
1
6060 func_execute_command
${AUTOHEADER} || func_exit
1
6061 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6063 if $inctests && ! $single_configure; then
6064 # Create autogenerated files.
6065 (cd "$testdir/$testsbase" || func_exit
1
6066 # Do not use "${AUTORECONF} --force --install", because it may invoke
6067 # autopoint, which brings in older versions of some of our .m4 files.
6068 if test -f ..
/$m4base/gettext.
m4; then
6069 func_execute_command
${AUTOPOINT} --force || func_exit
1
6070 for f
in ..
/$m4base/*.
m4~
; do
6072 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit
1
6076 func_execute_command
${ACLOCAL} -I ..
/$m4base || func_exit
1
6077 if ! test -d ..
/build-aux
; then
6078 func_execute_command mkdir ..
/build-aux
6080 func_execute_command
${AUTOCONF} || func_exit
1
6081 func_execute_command
${AUTOHEADER} || func_exit
1
6082 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6085 # Need to run configure and make once, to create built files that are to be
6086 # distributed (such as parse-datetime.c).
6087 sed_remove_make_variables
='s,[$]([A-Za-z0-9_]*),,g'
6088 # Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...".
6089 cleaned_files
=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \
6090 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
6091 cleaned_files
=`for file in $cleaned_files; do echo " $file "; done`
6092 # Extract the value of "BUILT_SOURCES += ...". Remove variable references
6093 # such $(FOO_H) because they don't refer to distributed files.
6094 built_sources
=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \
6095 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
6096 | sed -e "$sed_remove_make_variables"`
6097 distributed_built_sources
=`for file in $built_sources; do
6098 case "$cleaned_files" in
6103 tests_distributed_built_sources
=
6105 # Likewise for built files in the $testsbase directory.
6106 tests_cleaned_files
=`sed -e "$sed_remove_backslash_newline" < "$testdir/$testsbase/Makefile.am" \
6107 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
6108 tests_cleaned_files
=`for file in $tests_cleaned_files; do echo " $file "; done`
6109 tests_built_sources
=`sed -e "$sed_remove_backslash_newline" < "$testdir/$testsbase/Makefile.am" \
6110 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
6111 | sed -e "$sed_remove_make_variables"`
6112 tests_distributed_built_sources
=`for file in $tests_built_sources; do
6113 case "$tests_cleaned_files" in
6119 if test -n "$distributed_built_sources" ||
test -n "$tests_distributed_built_sources"; then
6121 .
/configure || func_exit
1
6122 if test -n "$distributed_built_sources"; then
6124 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
6125 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6130 if test -n "$tests_distributed_built_sources"; then
6132 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
6133 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6138 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6145 # func_create_megatestdir megatestdir allmodules
6147 # - local_gnulib_dir from --local-dir
6148 # - modcache true or false, from --cache-modules/--no-cache-modules
6149 # - auxdir directory relative to destdir where to place build aux files
6150 func_create_megatestdir
()
6154 if test -z "$allmodules"; then
6155 allmodules
=`func_all_modules`
6159 # First, all modules one by one.
6160 for onemodule
in $allmodules; do
6161 func_create_testdir
"$megatestdir/$onemodule" $onemodule
6162 func_append megasubdirs
"$onemodule "
6164 # Then, all modules all together.
6165 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
6166 allmodules
=`for m in $allmodules; do if test $m != config-h; then echo $m; fi; done`
6167 func_create_testdir
"$megatestdir/ALL" "$allmodules"
6168 func_append megasubdirs
"ALL"
6171 cvsdate
=`if test -f "$gnulib_dir/CVS/Entries"; then \
6172 vc_witness="$gnulib_dir/CVS/Entries"; \
6174 vc_witness="$gnulib_dir/.git/refs/heads/master"; \
6176 sh "$gnulib_dir/build-aux/mdate-sh" "$vc_witness" \
6177 | sed -e 's,January,01,' -e 's,Jan,01,' \
6178 -e 's,February,02,' -e 's,Feb,02,' \
6179 -e 's,March,03,' -e 's,Mar,03,' \
6180 -e 's,April,04,' -e 's,Apr,04,' \
6182 -e 's,June,06,' -e 's,Jun,06,' \
6183 -e 's,July,07,' -e 's,Jul,07,' \
6184 -e 's,August,08,' -e 's,Aug,08,' \
6185 -e 's,September,09,' -e 's,Sep,09,' \
6186 -e 's,October,10,' -e 's,Oct,10,' \
6187 -e 's,November,11,' -e 's,Nov,11,' \
6188 -e 's,December,12,' -e 's,Dec,12,' \
6189 -e 's,^,00,' -e 's,^[0-9]*\([0-9][0-9] \),\1,' \
6190 -e 's,^\([0-9]*\) \([0-9]*\) \([0-9]*\),\3\2\1,'`
6192 echo "CVSDATE=$cvsdate"
6193 echo ": \${MAKE=make}"
6194 echo "test -d logs || mkdir logs"
6195 echo "for module in $megasubdirs; do"
6196 echo " echo \"Working on module \$module...\""
6197 echo " safemodule=\`echo \$module | sed -e 's|/|-|g'\`"
6198 echo " (echo \"To: gnulib@autobuild.josefsson.org\""
6201 echo " : autobuild project... \$module"
6202 echo " : autobuild revision... cvs-\$CVSDATE-000000"
6203 echo " : autobuild timestamp... \`date \"+%Y%m%d-%H%M%S\"\`"
6204 echo " : autobuild hostname... \`hostname\`"
6205 echo " cd \$module && ./configure \$CONFIGURE_OPTIONS && \$MAKE && \$MAKE check && \$MAKE distclean"
6207 echo " ) 2>&1 | { if test -n \"\$AUTOBUILD_SUBST\"; then sed -e \"\$AUTOBUILD_SUBST\"; else cat; fi; } > logs/\$safemodule"
6209 ) > "$megatestdir/do-autobuild"
6210 chmod a
+x
"$megatestdir/do-autobuild"
6212 # Create Makefile.am.
6213 (echo "## Process this file with automake to produce Makefile.in."
6215 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
6217 echo "SUBDIRS = $megasubdirs"
6219 echo "EXTRA_DIST = do-autobuild"
6220 ) > "$megatestdir/Makefile.am"
6222 # Create configure.ac.
6223 (echo "# Process this file with autoconf to produce a configure script."
6224 echo "AC_INIT([dummy], [0])"
6225 if test "$auxdir" != "."; then
6226 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6228 echo "AM_INIT_AUTOMAKE"
6230 echo "AC_PROG_MAKE_SET"
6232 echo "AC_CONFIG_SUBDIRS([$megasubdirs])"
6233 echo "AC_CONFIG_FILES([Makefile])"
6235 ) > "$megatestdir/configure.ac"
6237 # Create autogenerated files.
6239 # Do not use "${AUTORECONF} --install", because autoreconf operates
6240 # recursively, but the subdirectories are already finished, therefore
6241 # calling autoreconf here would only waste lots of CPU time.
6242 func_execute_command
${ACLOCAL} || func_exit
1
6243 func_execute_command mkdir build-aux
6244 func_execute_command
${AUTOCONF} || func_exit
1
6245 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6251 func_fatal_error
"no mode specified" ;;
6258 # sed expression that converts a literal to a basic regular expression.
6259 # Needs to handle . [ \ * ^ $.
6260 sed_literal_to_basic_regex
='s/\\/\\\\/g
6266 if test -f "$gnulib_dir/$filename" \
6267 ||
{ test -n "$local_gnulib_dir" && test -f "$local_gnulib_dir/$filename"; }; then
6268 filename_anywhere_regex
=`echo "$filename" | sed -e "$sed_literal_to_basic_regex"`
6269 filename_line_regex
='^'"$filename_anywhere_regex"'$'
6272 (cd "$gnulib_dir" && find modules -type f -print | xargs -n 100 grep -l "$filename_line_regex" /dev/null | sed -e 's,^modules/,,')
6273 if test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules"; then
6274 (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$,,')
6277 | func_sanitize_modulelist \
6280 for module
in $module_candidates; do
6281 if func_get_filelist
$module |
grep "$filename_line_regex" > /dev
/null
; then
6286 func_warning
"file $filename does not exist"
6291 import | add-import | remove-import | update
)
6294 if test -z "$destdir"; then
6297 test -d "$destdir" \
6298 || func_fatal_error
"destination directory does not exist: $destdir"
6300 # Prefer configure.ac to configure.in.
6301 if test -f "$destdir"/configure.ac
; then
6302 configure_ac
="$destdir/configure.ac"
6304 if test -f "$destdir"/configure.
in; then
6305 configure_ac
="$destdir/configure.in"
6307 func_fatal_error
"cannot find $destdir/configure.ac - make sure you run gnulib-tool from within your package's directory"
6311 # Analyze configure.ac.
6313 guessed_libtool
=false
6318 /AC_CONFIG_AUX_DIR/ {
6319 s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^]"$`\\)]*\).*$,guessed_auxdir="\1",p
6321 /A[CM]_PROG_LIBTOOL/ {
6322 s,^.*$,guessed_libtool=true,p
6324 eval `sed -n -e "$my_sed_traces" < "$configure_ac"`
6326 if test -z "$auxdir"; then
6327 auxdir
="$guessed_auxdir"
6330 # Determine where to apply func_import.
6331 if test "$mode" = import
; then
6332 # Apply func_import to a particular gnulib directory.
6333 # The command line contains the complete specification; don't look at
6334 # the contents of gnulib-cache.m4.
6335 test -n "$supplied_libname" || supplied_libname
=true
6336 test -n "$sourcebase" || sourcebase
="lib"
6337 test -n "$m4base" || m4base
="m4"
6338 test -n "$docbase" || docbase
="doc"
6339 test -n "$testsbase" || testsbase
="tests"
6340 test -n "$macro_prefix" || macro_prefix
="gl"
6343 if test -n "$m4base"; then
6344 # Apply func_import to a particular gnulib directory.
6345 # Any number of additional modules can be given.
6346 if test ! -f "$destdir/$m4base"/gnulib-cache.
m4; then
6347 # First use of gnulib in the given m4base.
6348 test -n "$supplied_libname" || supplied_libname
=true
6349 test -n "$sourcebase" || sourcebase
="lib"
6350 test -n "$docbase" || docbase
="doc"
6351 test -n "$testsbase" || testsbase
="tests"
6352 test -n "$macro_prefix" || macro_prefix
="gl"
6356 # Apply func_import to all gnulib directories.
6357 # To get this list of directories, look at Makefile.am. (Not at
6358 # configure, because it may be omitted from version control. Also,
6359 # don't run "find $destdir -name gnulib-cache.m4", as it might be
6363 if test -f "$destdir"/Makefile.am
; then
6364 aclocal_amflags
=`sed -n -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/p' "$destdir"/Makefile.am`
6366 for arg
in $aclocal_amflags; do
6367 if test -n "$m4dir_is_next"; then
6368 # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
6372 if test -f "$destdir/$arg"/gnulib-cache.
m4; then
6373 func_append m4dirs
" $arg"
6374 m4dirs_count
=`expr $m4dirs_count + 1`
6380 if test "X$arg" = "X-I"; then
6388 # No Makefile.am! Oh well. Look at the last generated aclocal.m4.
6389 if test -f "$destdir"/aclocal.
m4; then
6390 sedexpr1
='s,^m4_include(\[\(.*\)])$,\1,p'
6391 sedexpr2
='s,^[^/]*$,.,'
6392 sedexpr3
='s,/[^/]*$,,'
6393 m4dirs
=`sed -n -e "$sedexpr1" aclocal.m4 | sed -e "$sedexpr2" -e "$sedexpr3" | LC_ALL=C sort -u`
6394 m4dirs
=`for arg in $m4dirs; do if test -f "$destdir/$arg"/gnulib-cache.m4; then echo $arg; fi; done`
6395 m4dirs_count
=`for arg in $m4dirs; do echo "$arg"; done | wc -l`
6398 if test $m4dirs_count = 0; then
6399 # First use of gnulib in a package.
6400 # Any number of additional modules can be given.
6401 test -n "$supplied_libname" || supplied_libname
=true
6402 test -n "$sourcebase" || sourcebase
="lib"
6404 test -n "$docbase" || docbase
="doc"
6405 test -n "$testsbase" || testsbase
="tests"
6406 test -n "$macro_prefix" || macro_prefix
="gl"
6409 if test $m4dirs_count = 1; then
6410 # There's only one use of gnulib here. Assume the user means it.
6411 # Any number of additional modules can be given.
6412 for m4base
in $m4dirs; do
6416 # Ambiguous - guess what the user meant.
6417 if test $# = 0; then
6418 # No further arguments. Guess the user wants to update all of them.
6419 for m4base
in $m4dirs; do
6420 # Perform func_import in a subshell, so that variable values
6422 # local_gnulib_dir, incobsolete, inc_cxx_tests,
6423 # inc_longrunning_tests, inc_privileged_tests,
6424 # inc_unportable_tests, inc_all_tests, avoidlist, sourcebase,
6425 # m4base, pobase, docbase, testsbase, inctests, libname, lgpl,
6426 # makefile_name, libtool, macro_prefix, po_domain,
6427 # witness_c_macro, vc_files
6428 # don't propagate from one directory to another.
6429 (func_import
) || func_exit
1
6433 func_fatal_error
"Ambiguity: to which directory should the modules be added? Please specify at least --m4-base=..."
6442 if test -z "$destdir"; then
6443 func_fatal_error
"please specify --dir option"
6446 test -d "$destdir" \
6447 || func_fatal_error
"could not create destination directory"
6448 test -n "$auxdir" || auxdir
="build-aux"
6449 func_create_testdir
"$destdir" "$*"
6452 create-megatestdir
)
6453 if test -z "$destdir"; then
6454 func_fatal_error
"please specify --dir option"
6456 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
6457 test -n "$auxdir" || auxdir
="build-aux"
6458 func_create_megatestdir
"$destdir" "$*"
6462 test -n "$destdir" || destdir
=testdir$$
6463 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
6464 test -n "$auxdir" || auxdir
="build-aux"
6465 func_create_testdir
"$destdir" "$*"
6469 ..
/configure || func_exit
1
6470 $MAKE || func_exit
1
6471 $MAKE check || func_exit
1
6472 $MAKE distclean || func_exit
1
6473 remaining
=`find . -type f -print`
6474 if test -n "$remaining"; then
6475 echo "Remaining files:" $remaining 1>&2
6476 echo "gnulib-tool: *** Stop." 1>&2
6485 test -n "$destdir" || destdir
=testdir$$
6486 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
6487 test -n "$auxdir" || auxdir
="build-aux"
6488 func_create_megatestdir
"$destdir" "$*"
6496 remaining
=`find . -type f -print`
6497 if test -n "$remaining"; then
6498 echo "Remaining files:" $remaining 1>&2
6499 echo "gnulib-tool: *** Stop." 1>&2
6507 extract-description
)
6511 if test -n "$module"; then
6512 func_get_description
"$module"
6521 if test -n "$module"; then
6522 func_get_comment
"$module"
6531 if test -n "$module"; then
6532 func_get_status
"$module"
6541 if test -n "$module"; then
6542 func_get_notice
"$module"
6547 extract-applicability
)
6551 if test -n "$module"; then
6552 func_get_applicability
"$module"
6561 if test -n "$module"; then
6562 func_get_filelist
"$module"
6567 extract-dependencies
)
6568 if test -n "$avoidlist"; then
6569 func_fatal_error
"cannot combine --avoid and --extract-dependencies"
6574 if test -n "$module"; then
6575 func_get_dependencies
"$module"
6580 extract-autoconf-snippet
)
6584 if test -n "$module"; then
6585 func_get_autoconf_snippet
"$module"
6590 extract-automake-snippet
)
6594 if test -n "$module"; then
6595 func_get_automake_snippet
"$module"
6600 extract-include-directive
)
6604 if test -n "$module"; then
6605 func_get_include_directive
"$module"
6610 extract-link-directive
)
6614 if test -n "$module"; then
6615 func_get_link_directive
"$module"
6624 if test -n "$module"; then
6625 func_get_license
"$module"
6630 extract-maintainer
)
6634 if test -n "$module"; then
6635 func_get_maintainer
"$module"
6640 extract-tests-module
)
6644 if test -n "$module"; then
6645 func_get_tests_module
"$module"
6651 # Verify the number of arguments.
6652 if test $# -lt 1 ||
test $# -gt 2; then
6653 func_fatal_error
"invalid number of arguments for --$mode"
6656 # The first argument is the file to be copied.
6658 # Verify the file exists.
6659 func_lookup_file
"$f"
6661 # The second argument is the destination; either a directory ot a file.
6662 # It defaults to the current directory.
6664 test -n "$dest" || dest
='.'
6665 test -n "$sourcebase" || sourcebase
="lib"
6666 test -n "$m4base" || m4base
="m4"
6667 test -n "$docbase" || docbase
="doc"
6668 test -n "$testsbase" || testsbase
="tests"
6669 test -n "$auxdir" || auxdir
="build-aux"
6670 rewritten
='%REWRITTEN%'
6671 sed_rewrite_files
="\
6672 s,^build-aux/,$rewritten$auxdir/,
6673 s,^doc/,$rewritten$docbase/,
6674 s,^lib/,$rewritten$sourcebase/,
6675 s,^m4/,$rewritten$m4base/,
6676 s,^tests/,$rewritten$testsbase/,
6679 if test -d "$dest"; then
6681 g
=`echo "$f" | sed -e "$sed_rewrite_files"`
6683 destdir
=`dirname "$dest"`
6684 g
=`basename "$dest"`
6687 # Create the directory for destfile.
6688 d
=`dirname "$destdir/$g"`
6690 if test -n "$d" && test ! -d "$d"; then
6691 mkdir
-p "$d" || func_fatal_error
"failed"
6695 func_dest_tmpfilename
"$g"
6696 cp "$lookedup_file" "$tmpfile" || func_fatal_error
"failed"
6697 already_present
=true
6698 if test -f "$destdir/$g"; then
6699 # The file already exists.
6703 # Don't protest if the file should be there but isn't: it happens
6704 # frequently that developers don't put autogenerated files under version
6712 func_fatal_error
"unknown operation mode --$mode" ;;
6716 # Undo the effect of the previous 'trap' command. Some shellology:
6717 # We cannot use "trap - 0 1 2 3 13 15", because Solaris sh would attempt to
6718 # execute the command "-". "trap '' ..." is fine only for signal 0 (= normal
6719 # exit); for the others we need to call 'exit' explicitly. The value of $? is
6720 # 128 + signal number and is set before the trap-registered command is run.
6722 trap 'func_exit $?' 1 2 3 13 15
6727 # indent-tabs-mode: nil
6728 # whitespace-check-buffer-indent: nil