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 (pass --with-tests to include the unit tests)
168 --create-megatestdir create a mega scratch package with the given modules
169 one by one and all together
170 (pass --with-tests to include the unit tests)
171 --test test the combination of the given modules
172 (pass --with-tests to include the unit tests)
173 (recommended to use CC=\"gcc -Wall\" here)
174 --megatest test the given modules one by one and all together
175 (pass --with-tests to include the unit tests)
176 (recommended to use CC=\"gcc -Wall\" here)
177 --extract-description extract the description
178 --extract-comment extract the comment
179 --extract-status extract the status (obsolete etc.)
180 --extract-notice extract the notice or banner
181 --extract-applicability extract the applicability
182 --extract-filelist extract the list of files
183 --extract-dependencies extract the dependencies
184 --extract-autoconf-snippet extract the snippet for configure.ac
185 --extract-automake-snippet extract the snippet for library makefile
186 --extract-include-directive extract the #include directive
187 --extract-link-directive extract the linker directive
188 --extract-license report the license terms of the source files
190 --extract-maintainer report the maintainer(s) inside gnulib
191 --extract-tests-module report the unit test module, if it exists
192 --copy-file copy a file that is not part of any module
196 --dir=DIRECTORY Specify the target directory.
197 For --import, this specifies where your
198 configure.ac can be found. Defaults to current
200 --local-dir=DIRECTORY Specify a local override directory where to look
201 up files before looking in gnulib's directory.
202 --cache-modules Enable module caching optimization.
203 --no-cache-modules Disable module caching optimization.
204 --verbose Increase verbosity. May be repeated.
205 --quiet Decrease verbosity. May be repeated.
207 Options for --import, --add/remove-import, --update:
209 --dry-run Only print what would have been done.
211 Options for --import, --add/remove-import,
212 --create-[mega]testdir, --[mega]test:
214 --with-tests Include unit tests for the included modules.
215 --with-obsolete Include obsolete modules when they occur among the
216 dependencies. By default, dependencies to obsolete
218 --with-c++-tests Include even unit tests for C++ interoperability.
219 --with-longrunning-tests
220 Include even unit tests that are long-runners.
221 --with-privileged-tests
222 Include even unit tests that require root
224 --with-unportable-tests
225 Include even unit tests that fail on some platforms.
226 --with-all-tests Include all kinds of problematic unit tests.
227 --avoid=MODULE Avoid including the given MODULE. Useful if you
228 have code that provides equivalent functionality.
229 This option can be repeated.
230 --conditional-dependencies
231 Support conditional dependencies (may save configure
232 time and object code).
233 --no-conditional-dependencies
234 Don't use conditional dependencies.
235 --libtool Use libtool rules.
236 --no-libtool Don't use libtool rules.
238 Options for --import, --add/remove-import:
240 --lib=LIBRARY Specify the library name. Defaults to 'libgnu'.
241 --source-base=DIRECTORY
242 Directory relative to --dir where source code is
243 placed (default \"lib\").
244 --m4-base=DIRECTORY Directory relative to --dir where *.m4 macros are
245 placed (default \"m4\").
246 --po-base=DIRECTORY Directory relative to --dir where *.po files are
247 placed (default \"po\").
248 --doc-base=DIRECTORY Directory relative to --dir where doc files are
249 placed (default \"doc\").
250 --tests-base=DIRECTORY
251 Directory relative to --dir where unit tests are
252 placed (default \"tests\").
253 --aux-dir=DIRECTORY Directory relative to --dir where auxiliary build
254 tools are placed (default comes from configure.ac).
255 --lgpl[=2|=3] Abort if modules aren't available under the LGPL.
256 Also modify license template from GPL to LGPL.
257 The version number of the LGPL can be specified;
258 the default is currently LGPLv3.
259 --makefile-name=NAME Name of makefile in automake syntax in the
260 source-base and tests-base directories
261 (default \"Makefile.am\").
262 --macro-prefix=PREFIX Specify the prefix of the macros 'gl_EARLY' and
263 'gl_INIT'. Default is 'gl'.
264 --po-domain=NAME Specify the prefix of the i18n domain. Usually use
265 the package name. A suffix '-gnulib' is appended.
266 --witness-c-macro=NAME Specify the C macro that is defined when the
267 sources in this directory are compiled or used.
268 --vc-files Update version control related files.
269 --no-vc-files Don't update version control related files
270 (.gitignore and/or .cvsignore).
271 --no-changelog Don't update or create ChangeLog files.
273 Options for --create-[mega]testdir, --[mega]test:
275 --without-c++-tests Exclude unit tests for C++ interoperability.
276 --without-longrunning-tests
277 Exclude unit tests that are long-runners.
278 --without-privileged-tests
279 Exclude unit tests that require root privileges.
280 --without-unportable-tests
281 Exclude unit tests that fail on some platforms.
282 --single-configure Generate a single configure file, not a separate
283 configure file for the tests directory.
285 Options for --import, --add/remove-import, --update,
286 --create-[mega]testdir, --[mega]test:
288 -s, --symbolic, --symlink Make symbolic links instead of copying files.
289 --local-symlink Make symbolic links instead of copying files, only
290 for files from the local override directory.
292 Options for --import, --add/remove-import, --update:
294 -S, --more-symlinks Make symbolic links instead of copying files, and
295 don't replace copyright notices.
297 Report bugs to <bug-gnulib@gnu.org>."
301 # outputs to stdout the --version message.
305 if test -d "$gnulib_dir"/.git \
306 && (git
--version) >/dev
/null
2>/dev
/null \
307 && (date --version) >/dev
/null
2>/dev
/null
; then
308 # gnulib checked out from git.
309 sed_extract_first_date
='/^Date/{
313 date=`cd "$gnulib_dir" && git log ChangeLog | sed -n -e "$sed_extract_first_date"`
314 # Turn "Fri Mar 21 07:16:51 2008 -0600" into "Mar 21 2008 07:16:51 -0600".
315 sed_year_before_time
='s/^[^ ]* \([^ ]*\) \([0-9]*\) \([0-9:]*\) \([0-9]*\) /\1 \2 \4 \3 /'
316 date=`echo "$date" | sed -e "$sed_year_before_time"`
317 # Use GNU date to compute the time in GMT.
318 date=`date -d "$date" -u +"%Y-%m-%d %H:%M:%S"`
319 version
=' '`cd "$gnulib_dir" && ./build-aux/git-version-gen /dev/null | sed -e 's/-dirty/-modified/'`
321 if test -d "$gnulib_dir"/CVS \
322 && (cvs
--version) >/dev
/null
2>/dev
/null
; then
323 # gnulib checked out from CVS.
324 sed_extract_first_date
='/^date: /{
325 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
328 date=`cd "$gnulib_dir" && cvs log -N ChangeLog 2>/dev/null | sed -n -e "$sed_extract_first_date"`
330 # gnulib copy without versioning information.
331 date=`sed -e 's/ .*//;q' "$gnulib_dir"/ChangeLog`
335 year
=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed -e 's,^.* ,,'`
337 gnulib-tool (GNU $package $date)$version
338 Copyright (C) $year Free Software Foundation, Inc.
339 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
340 This is free software: you are free to change and redistribute it.
341 There is NO WARRANTY, to the extent permitted by law.
343 Written by" "Bruno Haible" "and" "Simon Josefsson"
346 # func_emit_copyright_notice
347 # outputs to stdout a header for a generated file.
348 func_emit_copyright_notice
()
350 sed -n -e '/Copyright/ {
353 }' < "$self_abspathname"
355 echo "# This file is free software; you can redistribute it and/or modify"
356 echo "# it under the terms of the GNU General Public License as published by"
357 echo "# the Free Software Foundation; either version 3 of the License, or"
358 echo "# (at your option) any later version."
360 echo "# This file is distributed in the hope that it will be useful,"
361 echo "# but WITHOUT ANY WARRANTY; without even the implied warranty of"
362 echo "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
363 echo "# GNU General Public License for more details."
365 echo "# You should have received a copy of the GNU General Public License"
366 echo "# along with this file. If not, see <http://www.gnu.org/licenses/>."
368 echo "# As a special exception to the GNU General Public License,"
369 echo "# this file may be distributed as part of a program that"
370 echo "# contains a configuration script generated by Autoconf, under"
371 echo "# the same distribution terms as the rest of that program."
373 echo "# Generated by gnulib-tool."
377 # exits with a given status.
378 # This function needs to be used, rather than 'exit', when a 'trap' handler is
379 # in effect that refers to $?.
386 # locates the directory where the gnulib repository lives
388 # - progname name of this program
390 # - self_abspathname absolute pathname of gnulib-tool
391 # - gnulib_dir absolute pathname of gnulib repository
395 /*) self_abspathname
="$progname" ;;
396 */*) self_abspathname
=`pwd`/"$progname" ;;
399 # Iterate through the elements of $PATH.
400 # We use IFS=: instead of
401 # for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'`
402 # because the latter does not work when some PATH element contains spaces.
403 # We use a canonicalized $pathx instead of $PATH, because empty PATH
404 # elements are by definition equivalent to '.', however field splitting
405 # according to IFS=: loses empty fields in many shells:
406 # - /bin/sh on OSF/1 and Solaris loses all empty fields (at the
407 # beginning, at the end, and in the middle),
408 # - /bin/sh on IRIX and /bin/ksh on IRIX and OSF/1 lose empty fields
409 # at the beginning and at the end,
410 # - GNU bash, /bin/sh on AIX and HP-UX, and /bin/ksh on AIX, HP-UX,
411 # Solaris lose empty fields at the end.
412 # The 'case' statement is an optimization, to avoid evaluating the
413 # explicit canonicalization command when $PATH contains no empty fields.
415 if test "${PATH_SEPARATOR+set}" != set; then
416 # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
417 # contains only /bin. Note that ksh looks also at the FPATH variable,
418 # so we have to set that as well for the test.
420 (PATH
='/bin;/bin'; FPATH
=$PATH; sh
-c :) >/dev
/null
2>&1 \
421 && { (PATH
='/bin:/bin'; FPATH
=$PATH; sh
-c :) >/dev
/null
2>&1 \
422 || PATH_SEPARATOR
=';'
425 if test "$PATH_SEPARATOR" = ";"; then
426 # On Windows, programs are searched in "." before $PATH.
429 # On Unix, we have to convert empty PATH elements to ".".
433 pathx
=`echo ":$PATH:" | sed -e 's/:::*/:.:/g' -e 's/^://' -e 's/:\$//'`
438 IFS
="$PATH_SEPARATOR"
442 if test -x "$d/$progname" && test ! -d "$d/$progname"; then
443 self_abspathname
="$d/$progname"
448 if test -z "$self_abspathname"; then
449 func_fatal_error
"could not locate the gnulib-tool program - how did you invoke it?"
453 while test -h "$self_abspathname"; do
454 # Resolve symbolic link.
455 linkval
=`func_readlink "$self_abspathname"`
456 test -n "$linkval" ||
break
458 /* ) self_abspathname
="$linkval" ;;
459 * ) self_abspathname
=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;;
462 gnulib_dir
=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
466 # creates a temporary directory.
468 # - progname name of this program
470 # - tmp pathname of freshly created temporary directory
473 # Use the environment variable TMPDIR, falling back to /tmp. This allows
474 # users to specify a different temporary directory, for example, if their
475 # /tmp is filled up or too small.
478 # Use the mktemp program if available. If not available, hide the error
480 tmp
=`(umask 077 && mktemp -d "$TMPDIR/glXXXXXX") 2>/dev/null` &&
481 test -n "$tmp" && test -d "$tmp"
484 # Use a simple mkdir command. It is guaranteed to fail if the directory
485 # already exists. $RANDOM is bash specific and expands to empty in shells
486 # other than bash, ksh and zsh. Its use does not increase security;
487 # rather, it minimizes the probability of failure in a very cluttered /tmp
489 tmp
=$TMPDIR/gl$$
-$RANDOM
490 (umask 077 && mkdir
"$tmp")
493 echo "$progname: cannot create a temporary directory in $TMPDIR" >&2
498 # func_append var value
499 # appends the given value to the shell variable var.
500 if ( foo
=bar
; foo
+=baz
&& test "$foo" = barbaz
) >/dev
/null
2>&1; then
501 # Use bash's += operator. It reduces complexity of appending repeatedly to
502 # a single variable from O(n^2) to O(n).
507 fast_func_append
=true
511 eval "$1=\"\$$1\$2\""
513 fast_func_append
=false
516 # func_remove_prefix var prefix
517 # removes the given prefix from the value of the shell variable var.
518 # var should be the name of a shell variable.
519 # Its value should not contain a newline and not start or end with whitespace.
520 # prefix should not contain the characters "$`\{}[]^|.
521 if ( foo
=bar
; eval 'test "${foo#b}" = ar' ) >/dev
/null
2>&1; then
522 func_remove_prefix
()
526 fast_func_remove_prefix
=true
528 func_remove_prefix
()
530 eval "value=\"\$$1\""
534 sed_escape_dots
='s/\([.]\)/\\\1/g'
535 prefix
=`echo "$prefix" | sed -e "$sed_escape_dots"`
538 value
=`echo "$value" | sed -e "s|^${prefix}||"`
539 eval "$1=\"\$value\""
541 fast_func_remove_prefix
=false
544 # func_remove_suffix var suffix
545 # removes the given suffix from the value of the shell variable var.
546 # var should be the name of a shell variable.
547 # Its value should not contain a newline and not start or end with whitespace.
548 # suffix should not contain the characters "$`\{}[]^|.
549 if ( foo
=bar
; eval 'test "${foo%r}" = ba' ) >/dev
/null
2>&1; then
550 func_remove_suffix
()
554 fast_func_remove_suffix
=true
556 func_remove_suffix
()
558 eval "value=\"\$$1\""
562 sed_escape_dots
='s/\([.]\)/\\\1/g'
563 suffix
=`echo "$suffix" | sed -e "$sed_escape_dots"`
566 value
=`echo "$value" | sed -e "s|${suffix}\$||"`
567 eval "$1=\"\$value\""
569 fast_func_remove_suffix
=false
572 # func_fatal_error message
573 # outputs to stderr a fatal error message, and terminates the program.
575 # - progname name of this program
578 echo "$progname: *** $1" 1>&2
579 echo "$progname: *** Stop." 1>&2
583 # func_warning message
584 # Outputs to stderr a warning message,
587 echo "gnulib-tool: warning: $1" 1>&2
590 # func_readlink SYMLINK
591 # outputs the target of the given symlink.
592 if (type -p readlink
) > /dev
/null
2>&1; then
595 # Use the readlink program from GNU coreutils.
601 # Use two sed invocations. A single sed -n -e 's,^.* -> \(.*\)$,\1,p'
602 # would do the wrong thing if the link target contains " -> ".
603 LC_ALL
=C
ls -l "$1" |
sed -e 's, -> ,#%%#,' |
sed -n -e 's,^.*#%%#\(.*\)$,\1,p'
607 # func_relativize DIR1 DIR2
608 # computes a relative pathname RELDIR such that DIR1/RELDIR = DIR2.
610 # - DIR1 relative pathname, relative to the current directory
611 # - DIR2 relative pathname, relative to the current directory
613 # - reldir relative pathname of DIR2, relative to DIR1
619 sed_first
='s,^\([^/]*\)/.*$,\1,'
620 sed_rest
='s,^[^/]*/*,,'
621 sed_last
='s,^.*/\([^/]*\)$,\1,'
622 sed_butlast
='s,/*[^/]*$,,'
623 while test -n "$dir1"; do
624 first
=`echo "$dir1" | sed -e "$sed_first"`
625 if test "$first" != "."; then
626 if test "$first" = ".."; then
627 dir2
=`echo "$dir0" | sed -e "$sed_last"`/"$dir2"
628 dir0
=`echo "$dir0" | sed -e "$sed_butlast"`
630 first2
=`echo "$dir2" | sed -e "$sed_first"`
631 if test "$first2" = "$first"; then
632 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
636 dir0
="$dir0"/"$first"
639 dir1
=`echo "$dir1" | sed -e "$sed_rest"`
644 # func_relconcat DIR1 DIR2
645 # computes a relative pathname DIR1/DIR2, with obvious simplifications.
647 # - DIR1 relative pathname, relative to the current directory
648 # - DIR2 relative pathname, relative to DIR1
650 # - relconcat DIR1/DIR2, relative to the current directory
655 sed_first
='s,^\([^/]*\)/.*$,\1,'
656 sed_rest
='s,^[^/]*/*,,'
657 sed_last
='s,^.*/\([^/]*\)$,\1,'
658 sed_butlast
='s,/*[^/]*$,,'
660 first
=`echo "$dir2" | sed -e "$sed_first"`
661 if test "$first" = "."; then
662 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
663 if test -z "$dir2"; then
668 last
=`echo "$dir1" | sed -e "$sed_last"`
669 while test "$last" = "."; do
670 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
671 last
=`echo "$dir1" | sed -e "$sed_last"`
673 if test -z "$dir1"; then
677 if test "$first" = ".."; then
678 if test "$last" = ".."; then
679 relconcat
="$dir1/$dir2"
682 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
683 dir2
=`echo "$dir2" | sed -e "$sed_rest"`
684 if test -z "$dir1"; then
688 if test -z "$dir2"; then
693 relconcat
="$dir1/$dir2"
701 # Like ln -s, except that SRC is given relative to the current directory (or
702 # absolute), not given relative to the directory of DEST.
708 *) # SRC is relative.
711 ln -s "`pwd`/$1" "$2" ;;
712 *) # DEST is relative too.
713 ln_destdir
=`echo "$2" | sed -e 's,[^/]*$,,'`
714 test -n "$ln_destdir" || ln_destdir
="."
715 func_relativize
"$ln_destdir" "$1"
723 # func_ln_if_changed SRC DEST
724 # Like func_ln, but avoids munging timestamps if the link is correct.
725 func_ln_if_changed
()
727 if test $# -ne 2; then
728 echo "usage: func_ln_if_changed SRC DEST" >&2
730 ln_target
=`func_readlink "$2"`
731 if test -h "$2" && test "$1" = "$ln_target"; then
739 # Ensure an 'echo' command that
740 # 1. does not interpret backslashes and
741 # 2. does not print an error message "broken pipe" when writing into a pipe
744 # Test cases for problem 1:
745 # echo '\n' | wc -l prints 1 when OK, 2 when KO
746 # echo '\t' | grep t > /dev/null has return code 0 when OK, 1 when KO
747 # Test cases for problem 2:
748 # echo hi | true frequently prints
749 # "bash: echo: write error: Broken pipe"
750 # to standard error in bash 3.2.
752 # Problem 1 is a weird heritage from SVR4. BSD got it right (except that
753 # BSD echo interprets '-n' as an option, which is also not desirable).
754 # Nowadays the problem occurs in 4 situations:
755 # - in bash, when the shell option xpg_echo is set (bash >= 2.04)
756 # or when it was built with --enable-usg-echo-default (bash >= 2.0)
757 # or when it was built with DEFAULT_ECHO_TO_USG (bash < 2.0),
758 # - in zsh, when sh-emulation is not set,
759 # - in ksh (e.g. AIX /bin/sh and Solaris /usr/xpg4/bin/sh are ksh instances,
760 # and HP-UX /bin/sh and IRIX /bin/sh behave similarly),
761 # - in Solaris /bin/sh and OSF/1 /bin/sh.
762 # We try the following workarounds:
763 # - for all: respawn using $CONFIG_SHELL if that is set and works.
764 # - for bash >= 2.04: unset the shell option xpg_echo.
765 # - for bash >= 2.0: define echo to a function that uses the printf built-in.
766 # - for bash < 2.0: define echo to a function that uses cat of a here document.
767 # - for zsh: turn sh-emulation on.
768 # - for ksh: alias echo to 'print -r'.
769 # - for ksh: alias echo to a function that uses cat of a here document.
770 # - for Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh and rely on
771 # the ksh workaround.
772 # - otherwise: respawn using /bin/sh and rely on the workarounds.
773 # When respawning, we pass --no-reexec as first argument, so as to avoid
774 # turning this script into a fork bomb in unlucky situations.
776 # Problem 2 is specific to bash 3.2 and affects the 'echo' built-in, but not
777 # the 'printf' built-in. See
778 # <http://lists.gnu.org/archive/html/bug-bash/2008-12/msg00050.html>
779 # <http://lists.gnu.org/archive/html/bug-gnulib/2010-02/msg00154.html>
780 # The workaround is: define echo to a function that uses the printf built-in.
782 if echo '\t' |
grep t
> /dev
/null
; then
783 have_echo
=yes # Lucky!
785 # Try the workarounds.
786 # Respawn using $CONFIG_SHELL if that is set and works.
787 if test -z "$have_echo" \
788 && test "X$1" != "X--no-reexec" \
789 && test -n "$CONFIG_SHELL" \
790 && test -f "$CONFIG_SHELL" \
791 && $CONFIG_SHELL -c "echo '\\t' | grep t > /dev/null"; then
792 exec $CONFIG_SHELL "$0" --no-reexec "$@"
795 # For bash >= 2.04: unset the shell option xpg_echo.
796 if test -z "$have_echo" \
797 && test -n "$BASH_VERSION" \
798 && (shopt -o xpg_echo
; echo '\t' |
grep t
> /dev
/null
) 2>/dev
/null
; then
802 # For bash >= 2.0: define echo to a function that uses the printf built-in.
803 # For bash < 2.0: define echo to a function that uses cat of a here document.
804 # (There is no win in using 'printf' over 'cat' if it is not a shell built-in.)
805 # Also handle problem 2, specific to bash 3.2, here.
806 if { test -z "$have_echo" \
807 ||
case "$BASH_VERSION" in 3.2*) true
;; *) false
;; esac; \
809 && test -n "$BASH_VERSION"; then \
810 if type printf 2>/dev
/null |
grep / > /dev
/null
; then
811 # 'printf' is not a shell built-in.
819 # 'printf' is a shell built-in.
825 if echo '\t' |
grep t
> /dev
/null
; then
829 # For zsh: turn sh-emulation on.
830 if test -z "$have_echo" \
831 && test -n "$ZSH_VERSION" \
832 && (emulate sh
) >/dev
/null
2>&1; then
835 # For ksh: alias echo to 'print -r'.
836 if test -z "$have_echo" \
837 && (type print
) >/dev
/null
2>&1; then
838 # A 'print' command exists.
839 if type print
2>/dev
/null |
grep / > /dev
/null
; then
842 # 'print' is a shell built-in.
843 if (print
-r '\told' |
grep told
> /dev
/null
) 2>/dev
/null
; then
844 # 'print' is the ksh shell built-in.
845 alias echo='print -r'
849 if test -z "$have_echo" \
850 && echo '\t' |
grep t
> /dev
/null
; then
853 # For ksh: alias echo to a function that uses cat of a here document.
854 # The ksh manual page says:
855 # "Aliasing is performed when scripts are read, not while they are executed.
856 # Therefore, for an alias to take effect, the alias definition command has
857 # to be executed before the command which references the alias is read."
858 # Because of this, we have to play strange tricks with have_echo, to ensure
859 # that the top-level statement containing the test starts after the 'alias'
861 if test -z "$have_echo"; then
868 if (alias echo=bsd_echo
) 2>/dev
/null
; then
869 alias echo=bsd_echo
2>/dev
/null
872 if test -z "$have_echo" \
873 && echo '\t' |
grep t
> /dev
/null
; then
876 if test -z "$have_echo"; then
877 if (alias echo=bsd_echo
) 2>/dev
/null
; then
878 unalias echo 2>/dev
/null
881 # For Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh.
882 if test -z "$have_echo" \
883 && test "X$1" != "X--no-reexec" \
884 && test -f /bin
/ksh
; then
885 exec /bin
/ksh
"$0" --no-reexec "$@"
888 # Otherwise: respawn using /bin/sh.
889 if test -z "$have_echo" \
890 && test "X$1" != "X--no-reexec" \
891 && test -f /bin
/sh
; then
892 exec /bin
/sh
"$0" --no-reexec "$@"
895 if test -z "$have_echo"; then
896 func_fatal_error
"Shell does not support 'echo' correctly. Please install GNU bash and set the environment variable CONFIG_SHELL to point to it."
898 if echo '\t' |
grep t
> /dev
/null
; then
901 func_fatal_error
"Shell does not support 'echo' correctly. Workaround does not work. Please report this as a bug to bug-gnulib@gnu.org."
903 if test "X$1" = "X--no-reexec"; then
907 # Command-line option processing.
908 # Removes the OPTIONS from the arguments. Sets the variables:
909 # - mode list or import or add-import or remove-import or update
910 # or create-testdir or create-megatestdir
911 # - destdir from --dir
912 # - local_gnulib_dir from --local-dir
913 # - modcache true or false, from --cache-modules/--no-cache-modules
914 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
915 # - libname, supplied_libname from --lib
916 # - sourcebase from --source-base
917 # - m4base from --m4-base
918 # - pobase from --po-base
919 # - docbase from --doc-base
920 # - testsbase from --tests-base
921 # - auxdir from --aux-dir
922 # - inctests true if --with-tests was given, blank otherwise
923 # - incobsolete true if --with-obsolete was given, blank otherwise
924 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
925 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
927 # - inc_privileged_tests true if --with-privileged-tests was given, blank
929 # - inc_unportable_tests true if --with-unportable-tests was given, blank
931 # - inc_all_tests true if --with-all-tests was given, blank otherwise
932 # - excl_cxx_tests true if --without-c++-tests was given, blank otherwise
933 # - excl_longrunning_tests true if --without-longrunning-tests was given,
935 # - excl_privileged_tests true if --without-privileged-tests was given, blank
937 # - excl_unportable_tests true if --without-unportable-tests was given, blank
939 # - single_configure true if --single-configure was given, false otherwise
940 # - avoidlist list of modules to avoid, from --avoid
941 # - cond_dependencies true if --conditional-dependencies was given, false if
942 # --no-conditional-dependencies was given, blank otherwise
943 # - lgpl yes or a number if --lgpl was given, blank otherwise
944 # - makefile_name from --makefile-name
945 # - libtool true if --libtool was given, false if --no-libtool was
946 # given, blank otherwise
947 # - macro_prefix from --macro-prefix
948 # - po_domain from --po-domain
949 # - witness_c_macro from --witness-c-macro
950 # - vc_files true if --vc-files was given, false if --no-vc-files was
951 # given, blank otherwise
952 # - autoconf_minversion minimum supported autoconf version
953 # - do_changelog false if --no-changelog was given, : otherwise
954 # - doit : if actions shall be executed, false if only to be printed
955 # - symbolic true if --symlink or --more-symlinks was given, blank
957 # - lsymbolic true if --local-symlink was given, blank otherwise
958 # - do_copyrights blank if --more-symlinks was given, true otherwise
976 inc_longrunning_tests
=
977 inc_privileged_tests
=
978 inc_unportable_tests
=
981 excl_longrunning_tests
=
982 excl_privileged_tests
=
983 excl_unportable_tests
=
984 single_configure
=false
1002 while test $# -gt 0; do
1007 --find |
--fin |
--fi |
--f )
1010 --import |
--impor |
--impo |
--imp |
--im |
--i )
1013 --add-import |
--add-impor |
--add-impo |
--add-imp |
--add-im |
--add-i |
--add- |
--add |
--ad )
1016 --remove-import |
--remove-impor |
--remove-impo |
--remove-imp |
--remove-im |
--remove-i |
--remove- |
--remove |
--remov |
--remo |
--rem |
--re |
--r )
1019 --update |
--updat |
--upda |
--upd |
--up |
--u )
1022 --create-testdir |
--create-testdi |
--create-testd |
--create-test |
--create-tes |
--create-te |
--create-t )
1025 --create-megatestdir |
--create-megatestdi |
--create-megatestd |
--create-megatest |
--create-megates |
--create-megate |
--create-megat |
--create-mega |
--create-meg |
--create-me |
--create-m )
1026 mode
=create-megatestdir
1028 --test |
--tes |
--te |
--t )
1031 --megatest |
--megates |
--megate |
--megat |
--mega |
--meg |
--me |
--m )
1035 mode
=`echo "X$1" | sed -e 's/^X--//'`
1037 --copy-file |
--copy-fil |
--copy-fi |
--copy-f |
--copy- |
--copy |
--cop )
1042 if test $# = 0; then
1043 func_fatal_error
"missing argument for --dir"
1048 destdir
=`echo "X$1" | sed -e 's/^X--dir=//'`
1052 if test $# = 0; then
1053 func_fatal_error
"missing argument for --local-dir"
1058 local_gnulib_dir
=`echo "X$1" | sed -e 's/^X--local-dir=//'`
1060 --cache-modules |
--cache-module |
--cache-modul |
--cache-modu |
--cache-mod |
--cache-mo |
--cache-m |
--cache- |
--cache |
--cach |
--cac |
--ca )
1063 --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 )
1066 --verbose |
--verbos |
--verbo |
--verb )
1067 verbose
=`expr $verbose + 1`
1069 --quiet |
--quie |
--qui |
--qu |
--q )
1070 verbose
=`expr $verbose - 1`
1074 if test $# = 0; then
1075 func_fatal_error
"missing argument for --lib"
1078 supplied_libname
=true
1081 libname
=`echo "X$1" | sed -e 's/^X--lib=//'`
1082 supplied_libname
=true
1086 if test $# = 0; then
1087 func_fatal_error
"missing argument for --source-base"
1092 sourcebase
=`echo "X$1" | sed -e 's/^X--source-base=//'`
1096 if test $# = 0; then
1097 func_fatal_error
"missing argument for --m4-base"
1102 m4base
=`echo "X$1" | sed -e 's/^X--m4-base=//'`
1106 if test $# = 0; then
1107 func_fatal_error
"missing argument for --po-base"
1112 pobase
=`echo "X$1" | sed -e 's/^X--po-base=//'`
1116 if test $# = 0; then
1117 func_fatal_error
"missing argument for --doc-base"
1122 docbase
=`echo "X$1" | sed -e 's/^X--doc-base=//'`
1126 if test $# = 0; then
1127 func_fatal_error
"missing argument for --tests-base"
1132 testsbase
=`echo "X$1" | sed -e 's/^X--tests-base=//'`
1136 if test $# = 0; then
1137 func_fatal_error
"missing argument for --aux-dir"
1142 auxdir
=`echo "X$1" | sed -e 's/^X--aux-dir=//'`
1144 --with-tests |
--with-test |
--with-tes |
--with-te |
--with-t)
1147 --with-obsolete |
--with-obsolet |
--with-obsole |
--with-obsol |
--with-obso |
--with-obs |
--with-ob |
--with-o)
1150 --with-c++-tests |
--with-c++-test |
--with-c++-tes |
--with-c++-te |
--with-c++-t |
--with-c++- |
--with-c++ |
--with-c+ |
--with-c)
1153 --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)
1154 inc_longrunning_tests
=true
1156 --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)
1157 inc_privileged_tests
=true
1159 --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)
1160 inc_unportable_tests
=true
1162 --with-all-tests |
--with-all-test |
--with-all-tes |
--with-all-te |
--with-all-t |
--with-all- |
--with-all |
--with-al |
--with-a)
1165 --without-c++-tests |
--without-c++-test |
--without-c++-tes |
--without-c++-te |
--without-c++-t |
--without-c++- |
--without-c++ |
--without-c+ |
--without-c)
1168 --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)
1169 excl_longrunning_tests
=true
1171 --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)
1172 excl_privileged_tests
=true
1174 --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)
1175 excl_unportable_tests
=true
1177 --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)
1178 single_configure
=true
1182 if test $# = 0; then
1183 func_fatal_error
"missing argument for --avoid"
1185 func_append avoidlist
" $1"
1188 arg
=`echo "X$1" | sed -e 's/^X--avoid=//'`
1189 func_append avoidlist
" $arg"
1191 --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)
1192 cond_dependencies
=true
1194 --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)
1195 cond_dependencies
=false
1201 arg
=`echo "X$1" | sed -e 's/^X--lgpl=//'`
1204 *) func_fatal_error
"invalid LGPL version number for --lgpl" ;;
1210 if test $# = 0; then
1211 func_fatal_error
"missing argument for --makefile-name"
1216 makefile_name
=`echo "X$1" | sed -e 's/^X--makefile-name=//'`
1226 if test $# = 0; then
1227 func_fatal_error
"missing argument for --macro-prefix"
1232 macro_prefix
=`echo "X$1" | sed -e 's/^X--macro-prefix=//'`
1236 if test $# = 0; then
1237 func_fatal_error
"missing argument for --po-domain"
1242 po_domain
=`echo "X$1" | sed -e 's/^X--po-domain=//'`
1246 if test $# = 0; then
1247 func_fatal_error
"missing argument for --witness-c-macro"
1249 witness_c_macro
="$1"
1251 --witness-c-macro=* )
1252 witness_c_macro
=`echo "X$1" | sed -e 's/^X--witness-c-macro=//'`
1260 --no-changelog |
--no-changelo |
--no-changel |
--no-change |
--no-chang |
--no-chan |
--no-cha |
--no-ch )
1266 -s |
--symbolic |
--symboli |
--symbol |
--symbo |
--symb |
--symlink |
--symlin |
--symli |
--syml |
--sym |
--sy )
1269 --local-symlink |
--local-symlin |
--local-symli |
--local-syml |
--local-sym |
--local-sy |
--local-s )
1272 -S |
--more-symlinks |
--more-symlink |
--more-symlin |
--more-symli |
--more-syml |
--more-sym |
--more-sy |
--more-s |
--more- |
--more |
--mor |
--mo )
1276 --help |
--hel |
--he |
--h )
1279 --version |
--versio |
--versi |
--vers )
1283 # Stop option processing
1287 echo "gnulib-tool: unknown option $1" 1>&2
1288 echo "Try 'gnulib-tool --help' for more information." 1>&2
1295 if case "$mode" in import | add-import | remove-import
) true
;; *) false
;; esac; then
1296 if test -n "$excl_cxx_tests" ||
test -n "$excl_longrunning_tests" \
1297 ||
test -n "$excl_privileged_tests" ||
test -n "$excl_unportable_tests" \
1298 ||
test "$single_configure" != false
; then
1299 echo "gnulib-tool: invalid options for '$mode' mode" 1>&2
1300 echo "Try 'gnulib-tool --help' for more information." 1>&2
1304 # This code helps migrating from --import to --add-import or --update. It can
1305 # be removed on 2012-01-01.
1306 if test "$mode" = import
&& test $# = 0; then
1307 echo "gnulib-tool: cowardly refusing to erase the module list." 1>&2
1308 echo "The meaning of the option '--import' has changed." 1>&2
1309 echo "See the documentation at" 1>&2
1310 echo "<http://www.gnu.org/software/gnulib/manual/html_node/Modified-imports.html>." 1>&2
1311 echo "For updating to a newer version of gnulib, use" 1>&2
1312 echo " gnulib-tool --add-import" 1>&2
1313 echo "For restoring files that were omitted from version control, use" 1>&2
1314 echo " gnulib-tool --update" 1>&2
1317 if test "$mode" = update
; then
1318 if test $# != 0; then
1319 echo "gnulib-tool: too many arguments in 'update' mode" 1>&2
1320 echo "Try 'gnulib-tool --help' for more information." 1>&2
1321 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1322 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1325 if test -n "$local_gnulib_dir" ||
test -n "$supplied_libname" \
1326 ||
test -n "$sourcebase" ||
test -n "$m4base" ||
test -n "$pobase" \
1327 ||
test -n "$docbase" ||
test -n "$testsbase" ||
test -n "$auxdir" \
1328 ||
test -n "$inctests" ||
test -n "$incobsolete" \
1329 ||
test -n "$inc_cxx_tests" ||
test -n "$inc_longrunning_tests" \
1330 ||
test -n "$inc_privileged_tests" ||
test -n "$inc_unportable_tests" \
1331 ||
test -n "$inc_all_tests" \
1332 ||
test -n "$excl_cxx_tests" ||
test -n "$excl_longrunning_tests" \
1333 ||
test -n "$excl_privileged_tests" ||
test -n "$excl_unportable_tests" \
1334 ||
test -n "$avoidlist" ||
test -n "$lgpl" ||
test -n "$makefile_name" \
1335 ||
test -n "$macro_prefix" ||
test -n "$po_domain" \
1336 ||
test -n "$witness_c_macro" ||
test -n "$vc_files"; then
1337 echo "gnulib-tool: invalid options for 'update' mode" 1>&2
1338 echo "Try 'gnulib-tool --help' for more information." 1>&2
1339 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1340 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1345 if test -n "$pobase" && test -z "$po_domain"; then
1346 echo "gnulib-tool: together with --po-base, you need to specify --po-domain" 1>&2
1347 echo "Try 'gnulib-tool --help' for more information." 1>&2
1350 if test -z "$pobase" && test -n "$po_domain"; then
1351 func_warning
"--po-domain has no effect without a --po-base option"
1353 if test "$cond_dependencies" = true
&& test -n "$inctests"; then
1354 echo "gnulib-tool: option --conditional-dependencies is not supported with --with-tests" 1>&2
1358 # Determine the minimum supported autoconf version from the project's
1360 DEFAULT_AUTOCONF_MINVERSION
="2.59"
1361 autoconf_minversion
=
1363 if case "$mode" in import | add-import | remove-import | update
) true
;; *) false
;; esac \
1364 && test -n "$destdir"; then
1365 if test -f "$destdir"/configure.ac
; then
1366 configure_ac
="$destdir/configure.ac"
1368 if test -f "$destdir"/configure.
in; then
1369 configure_ac
="$destdir/configure.in"
1373 if test -f configure.ac
; then
1374 configure_ac
="configure.ac"
1376 if test -f configure.
in; then
1377 configure_ac
="configure.in"
1381 if test -n "$configure_ac"; then
1382 # Use sed, not autoconf --trace, to look for the AC_PREREQ invocation,
1383 # because when some m4 files are omitted from a version control repository,
1384 # "autoconf --trace=AC_PREREQ" fails with an error message like this:
1385 # m4: aclocal.m4:851: Cannot open m4/absolute-header.m4: No such file or directory
1386 # autom4te: m4 failed with exit status: 1
1393 s,^.*AC_PREREQ([[ ]*\([^])]*\).*$,\1,p
1395 prereqs
=`sed -n -e "$my_sed_traces" < "$configure_ac"`
1396 if test -n "$prereqs"; then
1397 autoconf_minversion
=`
1398 for version in $prereqs; do echo $version; done |
1399 LC_ALL=C sort -nru | sed -e 1q
1403 if test -z "$autoconf_minversion"; then
1404 autoconf_minversion
=$DEFAULT_AUTOCONF_MINVERSION
1406 case "$autoconf_minversion" in
1407 1.
* |
2.
[0-4]* |
2.5[0-8]*)
1408 func_fatal_error
"minimum supported autoconf version is 2.59. Try adding AC_PREREQ([$DEFAULT_AUTOCONF_MINVERSION]) to your configure.ac." ;;
1411 # Remove trailing slashes from the directory names. This is necessary for
1412 # m4base (to avoid an error in func_import) and optional for the others.
1413 sed_trimtrailingslashes
='s,\([^/]\)//*$,\1,'
1414 case "$local_gnulib_dir" in
1415 */ ) local_gnulib_dir
=`echo "$local_gnulib_dir" | sed -e "$sed_trimtrailingslashes"` ;;
1417 case "$sourcebase" in
1418 */ ) sourcebase
=`echo "$sourcebase" | sed -e "$sed_trimtrailingslashes"` ;;
1421 */ ) m4base
=`echo "$m4base" | sed -e "$sed_trimtrailingslashes"` ;;
1424 */ ) pobase
=`echo "$pobase" | sed -e "$sed_trimtrailingslashes"` ;;
1427 */ ) docbase
=`echo "$docbase" | sed -e "$sed_trimtrailingslashes"` ;;
1429 case "$testsbase" in
1430 */ ) testsbase
=`echo "$testsbase" | sed -e "$sed_trimtrailingslashes"` ;;
1433 */ ) auxdir
=`echo "$auxdir" | sed -e "$sed_trimtrailingslashes"` ;;
1439 trap 'exit_status=$?
1440 if test "$signal" != 0; then
1441 echo "caught signal $signal" >&2
1444 exit $exit_status' 0
1445 for signal
in 1 2 3 13 15; do
1446 trap '{ signal='$signal'; func_exit 1; }' $signal
1450 # Note: The 'eval' silences stderr output in dash.
1451 if (declare -A x
&& { x
[f
/2]='foo'; x
[f
/3]='bar'; eval test '${x[f/2]}' = foo
; }) 2>/dev
/null
; then
1452 # Zsh 4 and Bash 4 have associative arrays.
1453 have_associative
=true
1455 # For other shells, use 'eval' with computed shell variable names.
1456 have_associative
=false
1459 # func_lookup_file file
1460 # looks up a file in $local_gnulib_dir or $gnulib_dir, or combines it through
1463 # - local_gnulib_dir from --local-dir
1465 # - lookedup_file name of the merged (combined) file
1466 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
1470 if test -n "$local_gnulib_dir" && test -f "$local_gnulib_dir/$lkfile"; then
1471 lookedup_file
="$local_gnulib_dir/$lkfile"
1474 if test -f "$gnulib_dir/$lkfile"; then
1475 if test -n "$local_gnulib_dir" && test -f "$local_gnulib_dir/$lkfile.diff"; then
1476 lkbase
=`echo "$lkfile" | sed -e 's,^.*/,,'`
1477 rm -f "$tmp/$lkbase"
1478 cp "$gnulib_dir/$lkfile" "$tmp/$lkbase"
1479 patch -s "$tmp/$lkbase" < "$local_gnulib_dir/$lkfile.diff" \
1480 || func_fatal_error
"patch file $local_gnulib_dir/$lkfile.diff didn't apply cleanly"
1481 lookedup_file
="$tmp/$lkbase"
1484 lookedup_file
="$gnulib_dir/$lkfile"
1488 func_fatal_error
"file $gnulib_dir/$lkfile not found"
1493 # func_sanitize_modulelist
1494 # receives a list of possible module names on standard input, one per line.
1495 # It removes those which are just file names unrelated to modules, and outputs
1496 # the resulting list to standard output, one per line.
1497 func_sanitize_modulelist
()
1499 sed -e '/^CVS\//d' -e '/\/CVS\//d' \
1500 -e '/^ChangeLog$/d' -e '/\/ChangeLog$/d' \
1501 -e '/^COPYING$/d' -e '/\/COPYING$/d' \
1502 -e '/^README$/d' -e '/\/README$/d' \
1503 -e '/^TEMPLATE$/d' \
1504 -e '/^TEMPLATE-EXTENDED$/d' \
1505 -e '/^TEMPLATE-TESTS$/d' \
1512 # - local_gnulib_dir from --local-dir
1515 # Filter out metainformation files like README, which are not modules.
1516 # Filter out unit test modules; they can be retrieved through
1517 # --extract-tests-module if desired.
1519 (cd "$gnulib_dir" && find modules
-type f
-print |
sed -e 's,^modules/,,')
1520 if test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules"; then
1521 (cd "$local_gnulib_dir" && find modules
-type f
-print |
sed -e 's,^modules/,,' -e 's,\.diff$,,')
1524 | func_sanitize_modulelist \
1525 |
sed -e '/-tests$/d' \
1529 # func_exists_module module
1530 # tests whether a module, given by name, exists
1532 # - local_gnulib_dir from --local-dir
1533 func_exists_module
()
1535 { test -f "$gnulib_dir/modules/$1" \
1536 ||
{ test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules" \
1537 && test -f "$local_gnulib_dir/modules/$1"; }; } \
1538 && test "CVS" != "$1" \
1539 && test "ChangeLog" != "$1" \
1540 && test "COPYING" != "$1" \
1541 && test "README" != "$1" \
1542 && test "TEMPLATE" != "$1" \
1543 && test "TEMPLATE-EXTENDED" != "$1" \
1544 && test "TEMPLATE-TESTS" != "$1"
1547 # func_verify_module
1548 # verifies a module name
1550 # - local_gnulib_dir from --local-dir
1551 # - module module name argument
1552 func_verify_module
()
1554 if func_exists_module
"$module"; then
1555 # OK, $module is a correct module name.
1556 # Verify that building the module description with 'patch' succeeds.
1557 func_lookup_file
"modules/$module"
1559 func_warning
"module $module doesn't exist"
1564 # func_verify_nontests_module
1565 # verifies a module name, excluding tests modules
1567 # - local_gnulib_dir from --local-dir
1568 # - module module name argument
1569 func_verify_nontests_module
()
1572 *-tests ) module
= ;;
1573 * ) func_verify_module
;;
1577 # func_verify_tests_module
1578 # verifies a module name, considering only tests modules
1580 # - local_gnulib_dir from --local-dir
1581 # - module module name argument
1582 func_verify_tests_module
()
1585 *-tests ) func_verify_module
;;
1590 # Suffix of a sed expression that extracts a particular field from a
1591 # module description.
1592 # A field starts with a line that contains a keyword, such as 'Description',
1593 # followed by a colon and optional whitespace. All following lines, up to
1594 # the next field (or end of file if there is none) form the contents of the
1596 # An absent field is equivalent to a field with empty contents.
1597 # NOTE: Keep this in sync with sed_extract_cache_prog below!
1598 sed_extract_prog
=':[ ]*$/ {
1601 s/^Description:[ ]*$//
1605 s/^Applicability:[ ]*$//
1607 s/^Depends-on:[ ]*$//
1608 s/^configure\.ac-early:[ ]*$//
1609 s/^configure\.ac:[ ]*$//
1610 s/^Makefile\.am:[ ]*$//
1614 s/^Maintainer:[ ]*$//
1621 # Piece of a sed expression that converts a field header line to a shell
1623 # NOTE: Keep this in sync with sed_extract_prog above!
1624 sed_extract_field_header
='
1625 s/^Description:[ ]*$/description/
1626 s/^Comment:[ ]*$/comment/
1627 s/^Status:[ ]*$/status/
1628 s/^Notice:[ ]*$/notice/
1629 s/^Applicability:[ ]*$/applicability/
1630 s/^Files:[ ]*$/files/
1631 s/^Depends-on:[ ]*$/dependson/
1632 s/^configure\.ac-early:[ ]*$/configureac_early/
1633 s/^configure\.ac:[ ]*$/configureac/
1634 s/^Makefile\.am:[ ]*$/makefile/
1635 s/^Include:[ ]*$/include/
1637 s/^License:[ ]*$/license/
1638 s/^Maintainer:[ ]*$/maintainer/'
1642 if $have_associative; then
1644 # Declare the associative arrays.
1645 declare -A modcache_cached
1646 sed_to_declare_statement
='s|^.*/\([a-zA-Z0-9_]*\)/$|declare -A modcache_\1|p'
1647 declare_script
=`echo "$sed_extract_field_header" | sed -n -e "$sed_to_declare_statement"`
1648 eval "$declare_script"
1652 # func_cache_var module
1653 # computes the cache variable name corresponding to $module.
1654 # Note: This computation can map different module names to the same
1655 # cachevar (such as 'foo-bar', 'foo_bar', or 'foo/bar'); the caller has
1656 # to protect against this case.
1658 # - cachevar a shell variable name
1659 if (f
=foo
; eval echo '${f//o/e}') < /dev
/null
2>/dev
/null |
grep fee
>/dev
/null
; then
1660 # Bash 2.0 and newer, ksh, and zsh support the syntax
1661 # ${param//pattern/replacement}
1662 # as a shorthand for
1663 # `echo "$param" | sed -e "s/pattern/replacement/g"`.
1664 # Note: The 'eval' is necessary for dash and NetBSD /bin/sh.
1665 eval 'func_cache_var ()
1667 cachevar=c_${1//[!a-zA-Z0-9_]/_}
1674 cachevar
=c_
`echo "$1" | LC_ALL=C sed -e 's/[^a-zA-Z0-9_]/_/g'` ;;
1683 # func_init_sed_convert_to_cache_statements
1685 # - modcachevar_assignment
1687 # - sed_convert_to_cache_statements
1688 func_init_sed_convert_to_cache_statements
()
1690 # 'sed' script that turns a module description into shell script
1691 # assignments, suitable to be eval'ed. All active characters are escaped.
1694 # Some module's description
1699 # modcache_description[$1]=\
1700 # 'Some module'"'"'s description
1702 # modcache_files[$1]=\
1705 # c_MODULE_description_set=set; c_MODULE_description=\
1706 # 'Some module'"'"'s description
1708 # c_MODULE_files_set=set; c_MODULE_files=\
1710 # The script consists of two parts:
1711 # 1) Ignore the lines before the first field header.
1712 # 2) A loop, treating non-field-header lines by escaping single quotes
1713 # and adding a closing quote in the last line,
1714 sed_convert_to_cache_statements
="
1716 # Here we have not yet seen a field header.
1718 # See if the current line contains a field header.
1721 ${sed_extract_field_header}
1724 # No field header. Ignore the line.
1726 # Read the next line. Upon EOF, just exit.
1731 # The current line contains a field header.
1733 # Turn it into the beginning of an assignment.
1734 s/^\\(.*\\)\$/${modcachevar_assignment}\\\\/
1736 # Move it to the hold space. Don't print it yet,
1737 # because we want no assignment if the field is empty.
1740 # Read the next line.
1741 # Upon EOF, the field was empty. Print no assignment. Just exit.
1744 # See if the current line contains a field header.
1747 ${sed_extract_field_header}
1748 # If it is, the previous field was empty. Print no assignment.
1751 # Not a field header.
1753 # Print the previous line, held in the hold space.
1758 # Transform single quotes.
1761 # Prepend a single quote.
1766 # Move it to the hold space.
1769 # Read the next line.
1776 # See if the current line contains a field header.
1779 ${sed_extract_field_header}
1782 # Print the previous line, held in the hold space.
1787 # Transform single quotes.
1794 # Print the previous line, held in the hold space, with a single quote
1795 # to end the assignment.
1805 # Print the previous line, held in the hold space, with a single quote
1806 # to end the assignment.
1813 if ! $sed_comments; then
1815 sed_convert_to_cache_statements
=`echo "$sed_convert_to_cache_statements" \
1816 | sed -e 's/^ *//' -e 's/^#.*//'`
1820 if $have_associative; then
1821 # sed_convert_to_cache_statements does not depend on the module.
1822 modcachevar_assignment
='modcache_\1[$1]='
1823 func_init_sed_convert_to_cache_statements
1826 # func_cache_lookup_module module
1828 # looks up a module, like 'func_lookup_file modules/$module', and stores all
1829 # of its relevant data in a cache in the memory of the processing shell. If
1830 # already cached, it does not look it up again, thus saving file access time.
1832 # - module non-empty string
1833 # Output if $have_associative:
1834 # - modcache_cached[$module] set to yes
1835 # - modcache_description[$module] ==
1836 # - modcache_status[$module] \ set to the field's value, minus the
1837 # - ... / final newline,
1838 # - modcache_maintainer[$module] == or unset if the field's value is empty
1839 # Output if ! $have_associative:
1840 # - cachevar a shell variable name
1841 # - ${cachevar}_cached set to $module
1842 # - ${cachevar}_description ==
1843 # - ${cachevar}_status \ set to the field's value, minus the
1844 # - ... / final newline,
1845 # - ${cachevar}_maintainer == or unset if the field's value is empty
1846 # - ${cachevar}_description_set ==
1847 # - ${cachevar}_status_set \ set to non-empty if the field's value
1848 # - ... / is non-empty,
1849 # - ${cachevar}_maintainer_set == or unset if the field's value is empty
1850 func_cache_lookup_module
()
1852 if $have_associative; then
1853 eval 'cached=${modcache_cached[$1]}'
1856 eval "cached=\"\$${cachevar}_cached\""
1858 if test -z "$cached"; then
1859 # Not found in cache. Look it up on the file system.
1860 func_lookup_file
"modules/$1"
1861 if $have_associative; then
1862 eval 'modcache_cached[$1]=yes'
1864 eval "${cachevar}_cached=\"\$1\""
1866 if ! $have_associative; then
1867 # sed_convert_to_cache_statements depends on the module.
1868 modcachevar_assignment
="${cachevar}"'_\1_set=set; '"${cachevar}"'_\1='
1869 func_init_sed_convert_to_cache_statements
1871 cache_statements
=`LC_ALL=C sed -n -e "$sed_convert_to_cache_statements" < "$lookedup_file"`
1872 eval "$cache_statements"
1874 if ! $have_associative; then
1875 if test "$1" != "$cached"; then
1876 func_fatal_error
"cache variable collision between $1 and $cached"
1884 # func_get_description module
1886 # - local_gnulib_dir from --local-dir
1887 # - modcache true or false, from --cache-modules/--no-cache-modules
1888 func_get_description
()
1890 if ! $modcache; then
1891 func_lookup_file
"modules/$1"
1892 sed -n -e "/^Description$sed_extract_prog" < "$lookedup_file"
1894 func_cache_lookup_module
"$1"
1895 # Output the field's value, including the final newline (if any).
1896 if $have_associative; then
1897 if eval 'test -n "${modcache_description[$1]+set}"'; then
1898 eval 'echo "${modcache_description[$1]}"'
1901 eval "field_set=\"\$${cachevar}_description_set\""
1902 if test -n "$field_set"; then
1903 eval "field_value=\"\$${cachevar}_description\""
1904 echo "${field_value}"
1910 # func_get_comment module
1912 # - local_gnulib_dir from --local-dir
1913 # - modcache true or false, from --cache-modules/--no-cache-modules
1916 if ! $modcache; then
1917 func_lookup_file
"modules/$1"
1918 sed -n -e "/^Comment$sed_extract_prog" < "$lookedup_file"
1920 func_cache_lookup_module
"$1"
1921 # Output the field's value, including the final newline (if any).
1922 if $have_associative; then
1923 if eval 'test -n "${modcache_comment[$1]+set}"'; then
1924 eval 'echo "${modcache_comment[$1]}"'
1927 eval "field_set=\"\$${cachevar}_comment_set\""
1928 if test -n "$field_set"; then
1929 eval "field_value=\"\$${cachevar}_comment\""
1930 echo "${field_value}"
1936 # func_get_status module
1938 # - local_gnulib_dir from --local-dir
1939 # - modcache true or false, from --cache-modules/--no-cache-modules
1942 if ! $modcache; then
1943 func_lookup_file
"modules/$1"
1944 sed -n -e "/^Status$sed_extract_prog" < "$lookedup_file"
1946 func_cache_lookup_module
"$1"
1947 # Output the field's value, including the final newline (if any).
1948 if $have_associative; then
1949 if eval 'test -n "${modcache_status[$1]+set}"'; then
1950 eval 'echo "${modcache_status[$1]}"'
1953 eval "field_set=\"\$${cachevar}_status_set\""
1954 if test -n "$field_set"; then
1955 eval "field_value=\"\$${cachevar}_status\""
1956 echo "${field_value}"
1962 # func_get_notice module
1964 # - local_gnulib_dir from --local-dir
1965 # - modcache true or false, from --cache-modules/--no-cache-modules
1968 if ! $modcache; then
1969 func_lookup_file
"modules/$1"
1970 sed -n -e "/^Notice$sed_extract_prog" < "$lookedup_file"
1972 func_cache_lookup_module
"$1"
1973 # Output the field's value, including the final newline (if any).
1974 if $have_associative; then
1975 if eval 'test -n "${modcache_notice[$1]+set}"'; then
1976 eval 'echo "${modcache_notice[$1]}"'
1979 eval "field_set=\"\$${cachevar}_notice_set\""
1980 if test -n "$field_set"; then
1981 eval "field_value=\"\$${cachevar}_notice\""
1982 echo "${field_value}"
1988 # func_get_applicability module
1990 # - local_gnulib_dir from --local-dir
1991 # - modcache true or false, from --cache-modules/--no-cache-modules
1992 # The expected result (on stdout) is either 'main', or 'tests', or 'all'.
1993 func_get_applicability
()
1995 if ! $modcache; then
1996 func_lookup_file
"modules/$1"
1997 my_applicability
=`sed -n -e "/^Applicability$sed_extract_prog" < "$lookedup_file"`
1999 func_cache_lookup_module
"$1"
2000 # Get the field's value, without the final newline.
2001 if $have_associative; then
2002 eval 'my_applicability="${modcache_applicability[$1]}"'
2004 eval "my_applicability=\"\$${cachevar}_applicability\""
2007 if test -n "$my_applicability"; then
2008 echo $my_applicability
2010 # The default is 'main' or 'tests', depending on the module's name.
2012 *-tests) echo "tests";;
2018 # func_get_filelist module
2020 # - local_gnulib_dir from --local-dir
2021 # - modcache true or false, from --cache-modules/--no-cache-modules
2022 func_get_filelist
()
2024 if ! $modcache; then
2025 func_lookup_file
"modules/$1"
2026 sed -n -e "/^Files$sed_extract_prog" < "$lookedup_file"
2028 func_cache_lookup_module
"$1"
2029 # Output the field's value, including the final newline (if any).
2030 if $have_associative; then
2031 if eval 'test -n "${modcache_files[$1]+set}"'; then
2032 eval 'echo "${modcache_files[$1]}"'
2035 eval "field_set=\"\$${cachevar}_files_set\""
2036 if test -n "$field_set"; then
2037 eval "field_value=\"\$${cachevar}_files\""
2038 echo "${field_value}"
2043 echo m
4/gnulib-common.
m4
2044 case "$autoconf_minversion" in
2051 # func_filter_filelist outputvar separator filelist prefix suffix removed_prefix removed_suffix [added_prefix [added_suffix]]
2052 # stores in outputvar the filtered and processed filelist. Filtering: Only the
2053 # elements starting with prefix and ending with suffix are considered.
2054 # Processing: removed_prefix and removed_suffix are removed from each element,
2055 # added_prefix and added_suffix are added to each element.
2056 # prefix, suffix should not contain shell-special characters.
2057 # removed_prefix, removed_suffix should not contain the characters "$`\{}[]^|.
2058 # added_prefix, added_suffix should not contain the characters \|&.
2059 func_filter_filelist
()
2061 if test "$2" != "$nl" \
2062 ||
{ $fast_func_append \
2063 && { test -z "$6" ||
$fast_func_remove_prefix; } \
2064 && { test -z "$7" ||
$fast_func_remove_suffix; }; \
2068 # Do not quote possibly-empty parameters in case patterns,
2069 # AIX and HP-UX ksh won't match them if they are empty.
2072 if test -n "$6"; then
2073 func_remove_prefix fff
"$6"
2075 if test -n "$7"; then
2076 func_remove_suffix fff
"$7"
2079 if test -z "$ffflist"; then
2082 func_append ffflist
"$2${fff}"
2088 sed_fff_filter
="s|^$6\(.*\)$7\$|$8\\1$9|"
2089 ffflist
=`for fff in $3; do
2091 $4*$5) echo "$fff" ;;
2093 done | sed -e "$sed_fff_filter"`
2095 eval "$1=\"\$ffflist\""
2098 # func_get_dependencies module
2100 # - local_gnulib_dir from --local-dir
2101 # - modcache true or false, from --cache-modules/--no-cache-modules
2102 func_get_dependencies
()
2104 # ${module}-tests implicitly depends on ${module}, if that module exists.
2108 func_remove_suffix fgd1
'-tests'
2109 if func_exists_module
"$fgd1"; then
2114 # Then the explicit dependencies listed in the module description.
2115 { if ! $modcache; then
2116 func_lookup_file
"modules/$1"
2117 sed -n -e "/^Depends-on$sed_extract_prog" < "$lookedup_file"
2119 func_cache_lookup_module
"$1"
2120 # Output the field's value, including the final newline (if any).
2121 if $have_associative; then
2122 if eval 'test -n "${modcache_dependson[$1]+set}"'; then
2123 eval 'echo "${modcache_dependson[$1]}"'
2126 eval "field_set=\"\$${cachevar}_dependson_set\""
2127 if test -n "$field_set"; then
2128 eval "field_value=\"\$${cachevar}_dependson\""
2129 echo "${field_value}"
2137 # func_get_autoconf_early_snippet module
2139 # - local_gnulib_dir from --local-dir
2140 # - modcache true or false, from --cache-modules/--no-cache-modules
2141 func_get_autoconf_early_snippet
()
2143 if ! $modcache; then
2144 func_lookup_file
"modules/$1"
2145 sed -n -e "/^configure\.ac-early$sed_extract_prog" < "$lookedup_file"
2147 func_cache_lookup_module
"$1"
2148 # Output the field's value, including the final newline (if any).
2149 if $have_associative; then
2150 if eval 'test -n "${modcache_configureac_early[$1]+set}"'; then
2151 eval 'echo "${modcache_configureac_early[$1]}"'
2154 eval "field_set=\"\$${cachevar}_configureac_early_set\""
2155 if test -n "$field_set"; then
2156 eval "field_value=\"\$${cachevar}_configureac_early\""
2157 echo "${field_value}"
2163 # func_get_autoconf_snippet module
2165 # - local_gnulib_dir from --local-dir
2166 # - modcache true or false, from --cache-modules/--no-cache-modules
2167 func_get_autoconf_snippet
()
2169 if ! $modcache; then
2170 func_lookup_file
"modules/$1"
2171 sed -n -e "/^configure\.ac$sed_extract_prog" < "$lookedup_file"
2173 func_cache_lookup_module
"$1"
2174 # Output the field's value, including the final newline (if any).
2175 if $have_associative; then
2176 if eval 'test -n "${modcache_configureac[$1]+set}"'; then
2177 eval 'echo "${modcache_configureac[$1]}"'
2180 eval "field_set=\"\$${cachevar}_configureac_set\""
2181 if test -n "$field_set"; then
2182 eval "field_value=\"\$${cachevar}_configureac\""
2183 echo "${field_value}"
2189 # func_get_automake_snippet_conditional module
2190 # returns the part of the Makefile.am snippet that can be put inside Automake
2193 # - local_gnulib_dir from --local-dir
2194 # - modcache true or false, from --cache-modules/--no-cache-modules
2195 func_get_automake_snippet_conditional
()
2197 if ! $modcache; then
2198 func_lookup_file
"modules/$1"
2199 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
2201 func_cache_lookup_module
"$1"
2202 # Output the field's value, including the final newline (if any).
2203 if $have_associative; then
2204 if eval 'test -n "${modcache_makefile[$1]+set}"'; then
2205 eval 'echo "${modcache_makefile[$1]}"'
2208 eval "field_set=\"\$${cachevar}_makefile_set\""
2209 if test -n "$field_set"; then
2210 eval "field_value=\"\$${cachevar}_makefile\""
2211 echo "${field_value}"
2217 # func_get_automake_snippet_unconditional module
2218 # returns the part of the Makefile.am snippet that must stay outside of
2219 # Automake conditionals.
2221 # - local_gnulib_dir from --local-dir
2222 # - modcache true or false, from --cache-modules/--no-cache-modules
2223 func_get_automake_snippet_unconditional
()
2227 # *-tests module live in tests/, not lib/.
2228 # Synthesize an EXTRA_DIST augmentation.
2229 all_files
=`func_get_filelist $1`
2230 func_filter_filelist tests_files
" " "$all_files" 'tests/' '' 'tests/' ''
2231 extra_files
="$tests_files"
2232 if test -n "$extra_files"; then
2233 echo "EXTRA_DIST +=" $extra_files
2238 # Synthesize an EXTRA_DIST augmentation.
2239 sed_combine_lines
='/\\$/{
2246 sed_extract_mentioned_files
='s/^lib_SOURCES[ ]*+=[ ]*//p'
2247 already_mentioned_files
=` \
2248 { if ! $modcache; then
2249 func_lookup_file "modules/$1"
2250 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
2252 func_cache_lookup_module "$1"
2253 if $have_associative; then
2254 if eval 'test -n "${modcache_makefile[$1]+set}"'; then
2255 eval 'echo "${modcache_makefile[$1]}"'
2258 eval 'field_set="$'"${cachevar}"'_makefile_set"'
2259 if test -n "$field_set"; then
2260 eval 'field_value="$'"${cachevar}"'_makefile"'
2261 echo "${field_value}"
2266 | sed -e "$sed_combine_lines" \
2267 | sed -n -e "$sed_extract_mentioned_files" | sed -e 's/#.*//'`
2268 all_files
=`func_get_filelist $1`
2269 func_filter_filelist lib_files
"$nl" "$all_files" 'lib/' '' 'lib/' ''
2270 # Remove $already_mentioned_files from $lib_files.
2271 echo "$lib_files" | LC_ALL
=C
sort -u > "$tmp"/lib-files
2272 extra_files
=`for f in $already_mentioned_files; do echo $f; done \
2273 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/lib-files`
2274 if test -n "$extra_files"; then
2275 echo "EXTRA_DIST +=" $extra_files
2278 # Synthesize also an EXTRA_lib_SOURCES augmentation.
2279 # This is necessary so that automake can generate the right list of
2281 # A possible approach would be to use autom4te --trace of the redefined
2282 # AC_LIBOBJ and AC_REPLACE_FUNCS macros when creating the Makefile.am
2283 # (use autom4te --trace, not just grep, so that AC_LIBOBJ invocations
2284 # inside autoconf's built-in macros are not missed).
2285 # But it's simpler and more robust to do it here, based on the file list.
2286 # If some .c file exists and is not used with AC_LIBOBJ - for example,
2287 # a .c file is preprocessed into another .c file for BUILT_SOURCES -,
2288 # automake will generate a useless dependency; this is harmless.
2290 relocatable-prog-wrapper
) ;;
2293 func_filter_filelist extra_files
"$nl" "$extra_files" '' '.c' '' ''
2294 if test -n "$extra_files"; then
2295 echo "EXTRA_lib_SOURCES +=" $extra_files
2300 # Synthesize an EXTRA_DIST augmentation also for the files in build-aux/.
2301 func_filter_filelist buildaux_files
"$nl" "$all_files" 'build-aux/' '' 'build-aux/' ''
2302 if test -n "$buildaux_files"; then
2303 sed_prepend_auxdir
='s,^,$(top_srcdir)/'"$auxdir"'/,'
2304 echo "EXTRA_DIST += "`echo "$buildaux_files" | sed -e "$sed_prepend_auxdir"`
2307 # Synthesize an EXTRA_DIST augmentation also for the files from top/.
2308 func_filter_filelist top_files
"$nl" "$all_files" 'top/' '' 'top/' ''
2309 if test -n "$top_files"; then
2310 sed_prepend_topdir
='s,^,$(top_srcdir)/,'
2311 echo "EXTRA_DIST += "`echo "$top_files" | sed -e "$sed_prepend_topdir"`
2318 # func_get_automake_snippet module
2320 # - local_gnulib_dir from --local-dir
2321 # - modcache true or false, from --cache-modules/--no-cache-modules
2322 func_get_automake_snippet
()
2324 func_get_automake_snippet_conditional
"$1"
2325 func_get_automake_snippet_unconditional
"$1"
2328 # func_get_include_directive module
2330 # - local_gnulib_dir from --local-dir
2331 # - modcache true or false, from --cache-modules/--no-cache-modules
2332 func_get_include_directive
()
2335 if ! $modcache; then
2336 func_lookup_file
"modules/$1"
2337 sed -n -e "/^Include$sed_extract_prog" < "$lookedup_file"
2339 func_cache_lookup_module
"$1"
2340 # Output the field's value, including the final newline (if any).
2341 if $have_associative; then
2342 if eval 'test -n "${modcache_include[$1]+set}"'; then
2343 eval 'echo "${modcache_include[$1]}"'
2346 eval "field_set=\"\$${cachevar}_include_set\""
2347 if test -n "$field_set"; then
2348 eval "field_value=\"\$${cachevar}_include\""
2349 echo "${field_value}"
2353 } |
sed -e 's/^\(["<]\)/#include \1/'
2356 # func_get_link_directive module
2358 # - local_gnulib_dir from --local-dir
2359 # - modcache true or false, from --cache-modules/--no-cache-modules
2360 func_get_link_directive
()
2362 if ! $modcache; then
2363 func_lookup_file
"modules/$1"
2364 sed -n -e "/^Link$sed_extract_prog" < "$lookedup_file"
2366 func_cache_lookup_module
"$1"
2367 # Output the field's value, including the final newline (if any).
2368 if $have_associative; then
2369 if eval 'test -n "${modcache_link[$1]+set}"'; then
2370 eval 'echo "${modcache_link[$1]}"'
2373 eval "field_set=\"\$${cachevar}_link_set\""
2374 if test -n "$field_set"; then
2375 eval "field_value=\"\$${cachevar}_link\""
2376 echo "${field_value}"
2382 # func_get_license_raw module
2384 # - local_gnulib_dir from --local-dir
2385 # - modcache true or false, from --cache-modules/--no-cache-modules
2386 func_get_license_raw
()
2388 if ! $modcache; then
2389 func_lookup_file
"modules/$1"
2390 sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
2392 func_cache_lookup_module
"$1"
2393 # Output the field's value, including the final newline (if any).
2394 if $have_associative; then
2395 if eval 'test -n "${modcache_license[$1]+set}"'; then
2396 eval 'echo "${modcache_license[$1]}"'
2399 eval "field_set=\"\$${cachevar}_license_set\""
2400 if test -n "$field_set"; then
2401 eval "field_value=\"\$${cachevar}_license\""
2402 echo "${field_value}"
2408 # func_get_license module
2410 # - local_gnulib_dir from --local-dir
2411 # - modcache true or false, from --cache-modules/--no-cache-modules
2414 # Warn if the License field is missing.
2418 license
=`func_get_license_raw "$1"`
2419 if test -z "$license"; then
2420 func_warning
"module $1 lacks a License"
2425 func_get_license_raw
"$1"
2426 # The default is GPL.
2428 } |
sed -e 's,^ *$,,' |
sed -e 1q
2431 # func_get_maintainer module
2433 # - local_gnulib_dir from --local-dir
2434 # - modcache true or false, from --cache-modules/--no-cache-modules
2435 func_get_maintainer
()
2437 if ! $modcache; then
2438 func_lookup_file
"modules/$1"
2439 sed -n -e "/^Maintainer$sed_extract_prog" < "$lookedup_file"
2441 func_cache_lookup_module
"$1"
2442 # Output the field's value, including the final newline (if any).
2443 if $have_associative; then
2444 if eval 'test -n "${modcache_maintainer[$1]+set}"'; then
2445 eval 'echo "${modcache_maintainer[$1]}"'
2448 eval "field_set=\"\$${cachevar}_maintainer_set\""
2449 if test -n "$field_set"; then
2450 eval "field_value=\"\$${cachevar}_maintainer\""
2451 echo "${field_value}"
2457 # func_get_tests_module module
2459 # - local_gnulib_dir from --local-dir
2460 func_get_tests_module
()
2462 # The naming convention for tests modules is hardwired: ${module}-tests.
2463 if test -f "$gnulib_dir/modules/$1"-tests \
2464 ||
{ test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules" \
2465 && test -f "$local_gnulib_dir/modules/$1"-tests; }; then
2470 # func_acceptable module
2471 # tests whether a module is acceptable.
2473 # - avoidlist list of modules to avoid
2476 for avoid
in $avoidlist; do
2477 if test "$avoid" = "$1"; then
2484 # sed expression to keep the first 32 characters of each line.
2485 sed_first_32_chars
='s/^\(................................\).*/\1/'
2487 # func_module_shellfunc_name module
2488 # computes the shell function name that will contain the m4 macros for the module.
2490 # - macro_prefix prefix to use
2492 # - shellfunc shell function name
2493 func_module_shellfunc_name
()
2497 shellfunc
=func_
${macro_prefix}_gnulib_m4code_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2499 shellfunc
=func_
${macro_prefix}_gnulib_m4code_
$1 ;;
2503 # func_module_shellvar_name module
2504 # computes the shell variable name the will be set to true once the m4 macros
2505 # for the module have been executed.
2507 # - shellvar shell variable name
2508 func_module_shellvar_name
()
2512 shellvar
=${macro_prefix}_gnulib_enabled_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2514 shellvar
=${macro_prefix}_gnulib_enabled_
$1 ;;
2518 # func_module_conditional_name module
2519 # computes the automake conditional name for the module.
2521 # - conditional name of automake conditional
2522 func_module_conditional_name
()
2526 conditional
=${macro_prefix}_GNULIB_ENABLED_
`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2528 conditional
=${macro_prefix}_GNULIB_ENABLED_
$1 ;;
2532 # func_uncond_add_module B
2533 # notes the presence of B as an unconditional module.
2535 # func_conddep_add_module A B cond
2536 # notes the presence of a conditional dependency from module A to module B,
2537 # subject to the condition that A is enabled and cond is true.
2539 # func_cond_module_p B
2540 # tests whether module B is conditional.
2542 # func_cond_module_condition A B
2543 # returns the condition when B should be enabled as a dependency of A, once the
2544 # m4 code for A has been executed.
2545 # Output: - condition
2547 if $have_associative; then
2548 declare -A conddep_isuncond
2549 declare -A conddep_dependers
2550 declare -A conddep_condition
2551 func_uncond_add_module
()
2553 eval 'conddep_isuncond[$1]=true'
2554 eval 'unset conddep_dependers[$1]'
2556 func_conddep_add_module
()
2558 eval 'isuncond="${conddep_isuncond[$2]}"'
2559 if test -z "$isuncond"; then
2560 # No unconditional dependency to B known at this point.
2561 eval 'conddep_dependers[$2]="${conddep_dependers[$2]} $1"'
2562 eval 'conddep_condition[$1---$2]="$3"'
2565 func_cond_module_p
()
2567 eval 'previous_dependers="${conddep_dependers[$1]}"'
2568 test -n "$previous_dependers"
2570 func_cond_module_condition
()
2572 eval 'condition="${conddep_condition[$1---$2]}"'
2575 func_uncond_add_module
()
2579 suffix
=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2583 eval 'conddep_isuncond_'"$suffix"'=true'
2584 eval 'unset conddep_dependers_'"$suffix"
2586 func_conddep_add_module
()
2590 suffix
=`echo "$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2594 eval 'isuncond="${conddep_isuncond_'"$suffix"'}"'
2595 if test -z "$isuncond"; then
2596 eval 'conddep_dependers_'"$suffix"'="${conddep_dependers_'"$suffix"'} $1"'
2597 suffix
=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
2598 eval 'conddep_condition_'"$suffix"'="$3"'
2601 func_cond_module_p
()
2605 suffix
=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
2609 eval 'previous_dependers="${conddep_dependers_'"$suffix"'}"'
2610 test -n "$previous_dependers"
2612 func_cond_module_condition
()
2614 suffix
=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
2615 eval 'condition="${conddep_condition_'"$suffix"'}"'
2619 sed_dependencies_without_conditions
='s/ *\[.*//'
2621 # func_modules_transitive_closure
2623 # - local_gnulib_dir from --local-dir
2624 # - modcache true or false, from --cache-modules/--no-cache-modules
2625 # - modules list of specified modules
2626 # - inctests true if tests should be included, blank otherwise
2627 # - incobsolete true if obsolete modules among dependencies should be
2628 # included, blank otherwise
2629 # - inc_cxx_tests true if C++ interoperability tests should be included,
2631 # - inc_longrunning_tests true if long-runnings tests should be included,
2633 # - inc_privileged_tests true if tests that require root privileges should be
2634 # included, blank otherwise
2635 # - inc_unportable_tests true if tests that fail on some platforms should be
2636 # included, blank otherwise
2637 # - inc_all_direct_tests true if all kinds of problematic unit tests among
2638 # the unit tests of the specified modules should be
2639 # included, blank otherwise
2640 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
2641 # the unit tests of the dependencies should be
2642 # included, blank otherwise
2643 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
2645 # - excl_longrunning_tests true if long-runnings tests should be excluded,
2647 # - excl_privileged_tests true if tests that require root privileges should be
2648 # excluded, blank otherwise
2649 # - excl_unportable_tests true if tests that fail on some platforms should be
2650 # excluded, blank otherwise
2651 # - avoidlist list of modules to avoid
2652 # - cond_dependencies true if conditional dependencies shall be supported,
2654 # - tmp pathname of a temporary directory
2656 # - modules list of modules, including dependencies
2657 # - conddep_dependers, conddep_condition information about conditionally
2659 func_modules_transitive_closure
()
2661 sed_escape_dependency
='s|\([/.]\)|\\\1|g'
2662 # In order to process every module only once (for speed), process an "input
2663 # list" of modules, producing an "output list" of modules. During each round,
2664 # more modules can be queued in the input list. Once a module on the input
2665 # list has been processed, it is added to the "handled list", so we can avoid
2666 # to process it again.
2668 inmodules
="$modules"
2670 fmtc_inc_all_tests
="$inc_all_direct_tests"
2671 if test "$cond_dependencies" = true
; then
2672 for module
in $inmodules; do
2674 if test -n "$module"; then
2675 if func_acceptable
$module; then
2676 func_uncond_add_module
$module
2681 while test -n "$inmodules"; do
2682 inmodules_this_round
="$inmodules"
2683 inmodules
= # Accumulator, queue for next round
2684 for module
in $inmodules_this_round; do
2686 if test -n "$module"; then
2687 if func_acceptable
$module; then
2688 func_append outmodules
" $module"
2689 if test "$cond_dependencies" = true
; then
2690 if func_get_automake_snippet_conditional
$module |
grep '^if ' > /dev
/null
; then
2691 # A module whose Makefile.am snippet contains a reference to an
2692 # automake conditional. If we were to use it conditionally, we
2693 # would get an error
2694 # configure: error: conditional "..." was never defined.
2695 # because automake 1.11.1 does not handle nested conditionals
2696 # correctly. As a workaround, make the module unconditional.
2697 func_uncond_add_module
$module
2699 if func_cond_module_p
$module; then
2705 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
2706 # Duplicate dependencies are harmless, but Jim wants a warning.
2707 duplicated_deps
=`echo "$deps" | LC_ALL=C sort | LC_ALL=C uniq -d`
2708 if test -n "$duplicated_deps"; then
2709 func_warning
"module $module has duplicated dependencies: "`echo $duplicated_deps`
2711 if test -n "$inctests"; then
2712 testsmodule
=`func_get_tests_module $module`
2713 if test -n "$testsmodule"; then
2714 deps
="$deps $testsmodule"
2717 for dep
in $deps; do
2718 # Determine whether to include the dependency or tests module.
2720 for word
in `func_get_status $dep`; do
2723 test -n "$incobsolete" \
2727 test -z "$excl_cxx_tests" \
2729 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_cxx_tests" \
2733 test -z "$excl_longrunning_tests" \
2735 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_longrunning_tests" \
2739 test -z "$excl_privileged_tests" \
2741 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_privileged_tests" \
2745 test -z "$excl_unportable_tests" \
2747 test -n "$fmtc_inc_all_tests" ||
test -n "$inc_unportable_tests" \
2751 test -n "$fmtc_inc_all_tests" \
2756 if $inc && func_acceptable
"$dep"; then
2757 func_append inmodules
" $dep"
2758 if test "$cond_dependencies" = true
; then
2759 escaped_dep
=`echo "$dep" | sed -e "$sed_escape_dependency"`
2760 sed_extract_condition1
='/^ *'"$escaped_dep"' *$/{
2763 sed_extract_condition2
='/^ *'"$escaped_dep"' *\[.*\] *$/{
2764 s/^ *'"$escaped_dep"' *\[\(.*\)\] *$/\1/p
2766 condition
=`func_get_dependencies $module | sed -n -e "$sed_extract_condition1" -e "$sed_extract_condition2"`
2767 if test "$condition" = true
; then
2770 if test -n "$condition"; then
2771 func_conddep_add_module
"$module" "$dep" "$condition"
2773 if $conditional; then
2774 func_conddep_add_module
"$module" "$dep" true
2776 func_uncond_add_module
"$dep"
2785 handledmodules
=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
2786 # Remove $handledmodules from $inmodules.
2787 for m
in $inmodules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/queued-modules
2788 inmodules
=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
2789 fmtc_inc_all_tests
="$inc_all_indirect_tests"
2791 modules
=`for m in $outmodules; do echo $m; done | LC_ALL=C sort -u`
2792 rm -f "$tmp"/queued-modules
2795 # func_show_module_list
2797 # - specified_modules list of specified modules (one per line, sorted)
2798 # - modules complete list of modules (one per line, sorted)
2799 # - tmp pathname of a temporary directory
2800 func_show_module_list
()
2806 # Assume xterm compatible escape sequences.
2807 bold_on
=`printf '\x1b[1m'`
2808 bold_off
=`printf '\x1b[0m'`
2813 echo "Module list with included dependencies (indented):"
2814 echo "$specified_modules" |
sed -e '/^$/d' -e 's/$/| /' > "$tmp"/specified-modules
2815 echo "$modules" |
sed -e '/^$/d' \
2816 | LC_ALL
=C
join -t '|' -a2 "$tmp"/specified-modules
- \
2817 |
sed -e 's/^\(.*\)|.*/|\1/' -e 's/^/ /' -e 's/^ |\(.*\)$/ '"${bold_on}"'\1'"${bold_off}"'/'
2820 # func_modules_transitive_closure_separately
2821 # Determine main module list and tests-related module list separately.
2822 # The main module list is the transitive closure of the specified modules,
2823 # ignoring tests modules. Its lib/* sources go into $sourcebase/. If --lgpl
2824 # is specified, it will consist only of LGPLed source.
2825 # The tests-related module list is the transitive closure of the specified
2826 # modules, including tests modules, minus the main module list excluding
2827 # modules of applicability 'all'. Its lib/* sources (brought in through
2828 # dependencies of *-tests modules) go into $testsbase/. It may contain GPLed
2829 # source, even if --lgpl is specified.
2831 # - local_gnulib_dir from --local-dir
2832 # - modcache true or false, from --cache-modules/--no-cache-modules
2833 # - specified_modules list of specified modules
2834 # - inctests true if tests should be included, blank otherwise
2835 # - incobsolete true if obsolete modules among dependencies should be
2836 # included, blank otherwise
2837 # - inc_cxx_tests true if C++ interoperability tests should be included,
2839 # - inc_longrunning_tests true if long-runnings tests should be included,
2841 # - inc_privileged_tests true if tests that require root privileges should be
2842 # included, blank otherwise
2843 # - inc_unportable_tests true if tests that fail on some platforms should be
2844 # included, blank otherwise
2845 # - inc_all_direct_tests true if all kinds of problematic unit tests among
2846 # the unit tests of the specified modules should be
2847 # included, blank otherwise
2848 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
2849 # the unit tests of the dependencies should be
2850 # included, blank otherwise
2851 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
2853 # - excl_longrunning_tests true if long-runnings tests should be excluded,
2855 # - excl_privileged_tests true if tests that require root privileges should be
2856 # excluded, blank otherwise
2857 # - excl_unportable_tests true if tests that fail on some platforms should be
2858 # excluded, blank otherwise
2859 # - avoidlist list of modules to avoid
2860 # - cond_dependencies true if conditional dependencies shall be supported,
2862 # - tmp pathname of a temporary directory
2864 # - main_modules list of modules, including dependencies
2865 # - testsrelated_modules list of tests-related modules, including dependencies
2866 # - conddep_dependers, conddep_condition information about conditionally
2868 func_modules_transitive_closure_separately
()
2870 # Determine main module list.
2871 saved_inctests
="$inctests"
2873 modules
="$specified_modules"
2874 func_modules_transitive_closure
2875 main_modules
="$modules"
2876 inctests
="$saved_inctests"
2877 if test $verbose -ge 1; then
2878 echo "Main module list:"
2879 echo "$main_modules" |
sed -e 's/^/ /'
2881 # Determine tests-related module list.
2882 echo "$final_modules" | LC_ALL
=C
sort -u > "$tmp"/final-modules
2883 testsrelated_modules
=`for module in $main_modules; do
2884 if test \`func_get_applicability
$module\
` = main; then
2888 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/final-modules`
2889 if test $verbose -ge 1; then
2890 echo "Tests-related module list:"
2891 echo "$testsrelated_modules" |
sed -e 's/^/ /'
2895 # func_determine_use_libtests
2896 # Determines whether a $testsbase/libtests.a is needed.
2898 # - local_gnulib_dir from --local-dir
2899 # - modcache true or false, from --cache-modules/--no-cache-modules
2900 # - testsrelated_modules list of tests-related modules, including dependencies
2902 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
2903 func_determine_use_libtests
()
2906 for module
in $testsrelated_modules; do
2907 func_verify_nontests_module
2908 if test -n "$module"; then
2909 all_files
=`func_get_filelist $module`
2910 # Test whether some file in $all_files lies in lib/.
2911 for f
in $all_files; do
2923 # func_modules_add_dummy
2925 # - local_gnulib_dir from --local-dir
2926 # - modcache true or false, from --cache-modules/--no-cache-modules
2927 # - modules list of modules, including dependencies
2929 # - modules list of modules, including 'dummy' if needed
2930 func_modules_add_dummy
()
2932 # Determine whether any module provides a lib_SOURCES augmentation.
2934 sed_remove_backslash_newline
=':a
2941 for module
in $modules; do
2942 func_verify_nontests_module
2943 if test -n "$module"; then
2944 # Extract the value of "lib_SOURCES += ...".
2945 for file in `func_get_automake_snippet "$module" | sed -e "$sed_remove_backslash_newline" | sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'`; do
2946 # Ignore .h files since they are not compiled.
2950 have_lib_SOURCES
=yes
2957 # Add the dummy module, to make sure the library will be non-empty.
2958 if test -z "$have_lib_SOURCES"; then
2959 if func_acceptable
"dummy"; then
2960 func_append modules
" dummy"
2965 # func_modules_add_dummy_separately
2967 # - local_gnulib_dir from --local-dir
2968 # - modcache true or false, from --cache-modules/--no-cache-modules
2969 # - main_modules list of modules, including dependencies
2970 # - testsrelated_modules list of tests-related modules, including dependencies
2971 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
2973 # - main_modules list of modules, including 'dummy' if needed
2974 # - testsrelated_modules list of tests-related modules, including 'dummy' if
2976 func_modules_add_dummy_separately
()
2978 # Add the dummy module to the main module list if needed.
2979 modules
="$main_modules"
2980 func_modules_add_dummy
2981 main_modules
="$modules"
2983 # Add the dummy module to the tests-related module list if needed.
2984 if $use_libtests; then
2985 modules
="$testsrelated_modules"
2986 func_modules_add_dummy
2987 testsrelated_modules
="$modules"
2991 # func_modules_notice
2993 # - local_gnulib_dir from --local-dir
2994 # - modcache true or false, from --cache-modules/--no-cache-modules
2995 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
2996 # - modules list of modules, including dependencies
2997 func_modules_notice
()
2999 if test $verbose -ge -1; then
3000 for module
in $modules; do
3002 if test -n "$module"; then
3003 msg
=`func_get_notice $module`
3004 if test -n "$msg"; then
3005 echo "Notice from module $module:"
3006 echo "$msg" |
sed -e 's/^/ /'
3013 # func_modules_to_filelist
3015 # - local_gnulib_dir from --local-dir
3016 # - modcache true or false, from --cache-modules/--no-cache-modules
3017 # - modules list of modules, including dependencies
3019 # - files list of files
3020 func_modules_to_filelist
()
3023 for module
in $modules; do
3025 if test -n "$module"; then
3026 fs
=`func_get_filelist $module`
3027 func_append files
" $fs"
3030 files
=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
3033 # func_modules_to_filelist_separately
3034 # Determine the final file lists.
3035 # They must be computed separately, because files in lib/* go into
3036 # $sourcebase/ if they are in the main file list but into $testsbase/
3037 # if they are in the tests-related file list. Furthermore lib/dummy.c
3040 # - local_gnulib_dir from --local-dir
3041 # - modcache true or false, from --cache-modules/--no-cache-modules
3042 # - main_modules list of modules, including dependencies
3043 # - testsrelated_modules list of tests-related modules, including dependencies
3044 func_modules_to_filelist_separately
()
3046 # Determine final main file list.
3047 modules
="$main_modules"
3048 func_modules_to_filelist
3050 # Determine final tests-related file list.
3051 modules
="$testsrelated_modules"
3052 func_modules_to_filelist
3053 testsrelated_files
=`echo "$files" | sed -e 's,^lib/,tests=lib/,'`
3054 # Merge both file lists.
3055 sed_remove_empty_lines
='/^$/d'
3056 files
=`{ echo "$main_files"; echo "$testsrelated_files"; } | sed -e "$sed_remove_empty_lines" | LC_ALL=C sort -u`
3057 if test $verbose -ge 0; then
3059 sed_prettyprint_files
='s,^tests=lib/\(.*\)$,lib/\1 -> tests/\1,'
3060 echo "$files" |
sed -e "$sed_prettyprint_files" -e 's/^/ /'
3064 # func_compute_include_guard_prefix
3065 # Determine include_guard_prefix.
3067 # - macro_prefix prefix of gl_LIBOBJS macros to use
3069 # - include_guard_prefix replacement for ${gl_include_guard_prefix}
3070 # - sed_replace_include_guard_prefix
3071 # sed expression for resolving ${gl_include_guard_prefix}
3072 func_compute_include_guard_prefix
()
3074 if test "$macro_prefix" = gl
; then
3075 include_guard_prefix
='GL'
3077 include_guard_prefix
='GL_'`echo "$macro_prefix" | LC_ALL=C tr '[a-z]' '[A-Z]'`
3079 sed_replace_include_guard_prefix
='s/\${gl_include_guard_prefix}/'"${include_guard_prefix}"'/g'
3082 # func_execute_command command [args...]
3083 # Executes a command.
3084 # Uses also the variables
3085 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
3086 func_execute_command
()
3088 if test $verbose -ge 0; then
3092 # Commands like automake produce output to stderr even when they succeed.
3093 # Turn this output off if the command succeeds.
3094 "$@" > "$tmp"/cmdout
2>&1
3096 if test $cmdret = 0; then
3100 cat "$tmp"/cmdout
1>&2
3107 # func_dest_tmpfilename file
3108 # determines the name of a temporary file (file is relative to destdir).
3110 # - destdir target directory
3111 # - doit : if actions shall be executed, false if only to be printed
3112 # - tmp pathname of a temporary directory
3114 # - tmpfile absolute filename of the temporary file
3115 func_dest_tmpfilename
()
3118 # Put the new contents of $file in a file in the same directory (needed
3119 # to guarantee that an 'mv' to "$destdir/$file" works).
3120 tmpfile
="$destdir/$1.tmp"
3122 # Put the new contents of $file in a file in a temporary directory
3123 # (because the directory of "$file" might not exist).
3124 tmpfile
="$tmp"/`basename "$1"`.tmp
3129 # copies a file from gnulib into the destination directory. The destination
3130 # is known to not exist.
3132 # - destdir target directory
3133 # - local_gnulib_dir from --local-dir
3134 # - modcache true or false, from --cache-modules/--no-cache-modules
3135 # - f the original file name
3136 # - lookedup_file name of the merged (combined) file
3137 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
3138 # - g the rewritten file name
3139 # - tmpfile absolute filename of the temporary file
3140 # - doit : if actions shall be executed, false if only to be printed
3141 # - symbolic true if files should be symlinked, copied otherwise
3142 # - lsymbolic true if files from local_gnulib_dir should be symlinked,
3147 echo "Copying file $g"
3148 if { test -n "$symbolic" \
3149 ||
{ test -n "$lsymbolic" \
3150 && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; } \
3151 && test -z "$lookedup_tmp" \
3152 && cmp "$lookedup_file" "$tmpfile" > /dev
/null
; then
3153 func_ln_if_changed
"$lookedup_file" "$destdir/$g"
3155 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error
"failed"
3163 # copies a file from gnulib into the destination directory. The destination
3164 # is known to exist.
3166 # - destdir target directory
3167 # - local_gnulib_dir from --local-dir
3168 # - modcache true or false, from --cache-modules/--no-cache-modules
3169 # - f the original file name
3170 # - lookedup_file name of the merged (combined) file
3171 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
3172 # - g the rewritten file name
3173 # - tmpfile absolute filename of the temporary file
3174 # - doit : if actions shall be executed, false if only to be printed
3175 # - symbolic true if files should be symlinked, copied otherwise
3176 # - lsymbolic true if files from local_gnulib_dir should be symlinked,
3178 # - already_present nonempty if the file should already exist, empty otherwise
3181 if cmp "$destdir/$g" "$tmpfile" > /dev
/null
; then
3182 : # The file has not changed.
3186 if test -n "$already_present"; then
3187 echo "Updating file $g (backup in ${g}~)"
3189 echo "Replacing file $g (non-gnulib code backed up in ${g}~) !!"
3191 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error
"failed"
3192 if { test -n "$symbolic" \
3193 ||
{ test -n "$lsymbolic" \
3194 && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; } \
3195 && test -z "$lookedup_tmp" \
3196 && cmp "$lookedup_file" "$tmpfile" > /dev
/null
; then
3197 func_ln_if_changed
"$lookedup_file" "$destdir/$g"
3199 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error
"failed"
3202 if test -n "$already_present"; then
3203 echo "Update file $g (backup in ${g}~)"
3205 echo "Replace file $g (non-gnulib code backed up in ${g}~) !!"
3211 # func_emit_lib_Makefile_am
3212 # emits the contents of library makefile to standard output.
3214 # - local_gnulib_dir from --local-dir
3215 # - modcache true or false, from --cache-modules/--no-cache-modules
3216 # - modules list of modules, including dependencies
3217 # - libname library name
3218 # - pobase directory relative to destdir where to place *.po files
3219 # - auxdir directory relative to destdir where to place build aux files
3220 # - makefile_name from --makefile-name
3221 # - libtool true if libtool will be used, false or blank otherwise
3222 # - macro_prefix prefix of gl_LIBOBJS macros to use
3223 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
3224 # - witness_c_macro from --witness-c-macro
3225 # - actioncmd (optional) command that will reproduce this invocation
3226 # - for_test true if creating a package for testing, false otherwise
3227 # - sed_replace_include_guard_prefix
3228 # sed expression for resolving ${gl_include_guard_prefix}
3229 # - destfile filename relative to destdir of makefile being generated
3231 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val}
3232 # list of edits to be done to Makefile.am variables
3234 # - uses_subdirs nonempty if object files in subdirs exist
3235 func_emit_lib_Makefile_am
()
3237 # When creating an includable Makefile.am snippet, augment variables with
3238 # += instead of assigning them.
3239 if test -n "$makefile_name"; then
3244 if test "$libtool" = true
; then
3247 sed_eliminate_LDFLAGS
="$sed_noop"
3251 sed_eliminate_LDFLAGS
='/^lib_LDFLAGS[ ]*+=/d'
3254 # When creating a package for testing: Attempt to provoke failures,
3255 # especially link errors, already during "make" rather than during
3256 # "make check", because "make check" is not possible in a cross-compiling
3257 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
3258 sed_transform_check_PROGRAMS
='s,check_PROGRAMS,noinst_PROGRAMS,g'
3260 sed_transform_check_PROGRAMS
="$sed_noop"
3262 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3263 echo "## Process this file with automake to produce Makefile.in."
3264 func_emit_copyright_notice
3265 if test -n "$actioncmd"; then
3266 # The maximum line length (excluding the terminating newline) of any file
3267 # that is to be preprocessed by config.status is 3070. config.status uses
3268 # awk, and the HP-UX 11.00 awk fails if a line has length >= 3071;
3269 # similarly, the IRIX 6.5 awk fails if a line has length >= 3072.
3270 len
=`echo "$actioncmd" | wc -c`
3271 if test -n "$len" && test "$len" -le 3000; then
3272 echo "# Reproduce by: $actioncmd"
3278 for module
in $modules; do
3279 func_verify_nontests_module
3280 if test -n "$module"; then
3282 func_get_automake_snippet_conditional
"$module" |
3284 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
3285 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
3286 -e "$sed_eliminate_LDFLAGS" \
3287 -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' \
3288 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
3289 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
3290 -e "$sed_transform_check_PROGRAMS" \
3291 -e "$sed_replace_include_guard_prefix"
3292 if test "$module" = 'alloca'; then
3293 echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
3294 echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@"
3296 } > "$tmp"/amsnippet1
3298 func_get_automake_snippet_unconditional
"$module" |
3299 LC_ALL
=C
sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g'
3300 } > "$tmp"/amsnippet2
3301 # Skip the contents if it's entirely empty.
3302 if grep '[^ ]' "$tmp"/amsnippet1
"$tmp"/amsnippet2
> /dev
/null
; then
3303 echo "## begin gnulib module $module"
3305 if test "$cond_dependencies" = true
; then
3306 if func_cond_module_p
"$module"; then
3307 func_module_conditional_name
"$module"
3308 echo "if $conditional"
3311 cat "$tmp"/amsnippet1
3312 if test "$cond_dependencies" = true
; then
3313 if func_cond_module_p
"$module"; then
3317 cat "$tmp"/amsnippet2
3318 echo "## end gnulib module $module"
3321 rm -f "$tmp"/amsnippet1
"$tmp"/amsnippet2
3322 # Test whether there are some source files in subdirectories.
3323 for f
in `func_get_filelist "$module"`; do
3333 } > "$tmp"/allsnippets
3334 if test -z "$makefile_name"; then
3335 # If there are source files in subdirectories, prevent collision of the
3336 # object files (example: hash.c and libxml/hash.c).
3338 if test -n "$uses_subdirs"; then
3339 subdir_options
=' subdir-objects'
3341 echo "AUTOMAKE_OPTIONS = 1.5 gnits${subdir_options}"
3344 if test -z "$makefile_name"; then
3346 echo "noinst_HEADERS ="
3347 echo "noinst_LIBRARIES ="
3348 echo "noinst_LTLIBRARIES ="
3349 # Automake versions < 1.9b create an empty pkgdatadir at installation time
3350 # if you specify pkgdata_DATA to empty. This is a workaround.
3351 if grep '^pkgdata_DATA *+=' "$tmp"/allsnippets
> /dev
/null
; then
3352 echo "pkgdata_DATA ="
3355 echo "BUILT_SOURCES ="
3358 echo "MOSTLYCLEANFILES $assign core *.stackdump"
3359 if test -z "$makefile_name"; then
3360 echo "MOSTLYCLEANDIRS ="
3362 echo "DISTCLEANFILES ="
3363 echo "MAINTAINERCLEANFILES ="
3365 # Execute edits that apply to the Makefile.am being generated.
3367 while test $edit != $makefile_am_edits; do
3368 edit
=`expr $edit + 1`
3369 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
3370 eval var
=\"\
$makefile_am_edit${edit}_var
\"
3371 eval val
=\"\
$makefile_am_edit${edit}_val
\"
3372 if test -n "$var"; then
3373 if test "${dir}Makefile.am" = "$destfile" ||
test "./${dir}Makefile.am" = "$destfile"; then
3374 echo "${var} += ${val}"
3375 eval "makefile_am_edit${edit}_var="
3379 if test -n "$witness_c_macro"; then
3380 cppflags_part1
=" -D$witness_c_macro=1"
3385 cppflags_part2
=" -DGNULIB_STRICT_CHECKING=1"
3389 if test -z "$makefile_name"; then
3391 echo "AM_CPPFLAGS =$cppflags_part1$cppflags_part2"
3394 if test -n "$cppflags_part1$cppflags_part2"; then
3396 echo "AM_CPPFLAGS +=$cppflags_part1$cppflags_part2"
3400 if LC_ALL
=C
grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$tmp"/allsnippets
> /dev
/null \
3401 ||
{ test -n "$makefile_name" \
3402 && test -f "$sourcebase/Makefile.am" \
3403 && LC_ALL
=C
grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$sourcebase/Makefile.am" > /dev
/null
; \
3405 # One of the snippets or the user's Makefile.am already specifies an
3406 # installation location for the library. Don't confuse automake by saying
3407 # it should not be installed.
3410 # By default, the generated library should not be installed.
3411 echo "noinst_${perhapsLT}LIBRARIES += $libname.$libext"
3414 echo "${libname}_${libext}_SOURCES ="
3415 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
3416 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
3417 echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
3418 echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
3419 echo "EXTRA_${libname}_${libext}_SOURCES ="
3420 if test "$libtool" = true
; then
3421 echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)"
3422 echo "${libname}_${libext}_LDFLAGS += -no-undefined"
3423 # Synthesize an ${libname}_${libext}_LDFLAGS augmentation by combining
3424 # the link dependencies of all modules.
3425 for module
in $modules; do
3426 func_verify_nontests_module
3427 if test -n "$module"; then
3428 func_get_link_directive
"$module"
3431 | LC_ALL
=C
sed -e '/^$/d' -e 's/ when linking with libtool.*//' \
3432 | LC_ALL
=C
sort -u \
3433 | LC_ALL
=C
sed -e 's/^/'"${libname}_${libext}"'_LDFLAGS += /'
3436 if test -n "$pobase"; then
3437 echo "AM_CPPFLAGS += -DDEFAULT_TEXT_DOMAIN=\\\"${po_domain}-gnulib\\\""
3440 cat "$tmp"/allsnippets \
3441 |
sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
3443 echo "mostlyclean-local: mostlyclean-generic"
3444 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
3445 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
3446 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
3450 rm -f "$tmp"/allsnippets
3453 # func_emit_po_Makevars
3454 # emits the contents of po/ makefile parameterization to standard output.
3456 # - local_gnulib_dir from --local-dir
3457 # - modcache true or false, from --cache-modules/--no-cache-modules
3458 # - sourcebase directory relative to destdir where to place source code
3459 # - pobase directory relative to destdir where to place *.po files
3460 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
3461 func_emit_po_Makevars
()
3463 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3464 func_emit_copyright_notice
3466 echo "# Usually the message domain is the same as the package name."
3467 echo "# But here it has a '-gnulib' suffix."
3468 echo "DOMAIN = ${po_domain}-gnulib"
3470 echo "# These two variables depend on the location of this directory."
3471 echo "subdir = ${pobase}"
3472 echo "top_builddir = "`echo "$pobase" | sed -e 's,//*,/,g' -e 's,[^/][^/]*,..,g'`
3475 # These options get passed to xgettext.
3476 XGETTEXT_OPTIONS
= \
3477 --keyword=_
--flag=_
:1:pass-c-format \
3478 --keyword=N_
--flag=N_
:1:pass-c-format \
3479 --keyword='proper_name:1,"This is a proper name. See the gettext manual, section Names."' \
3480 --keyword='proper_name_utf8:1,"This is a proper name. See the gettext manual, section Names."' \
3481 --flag=error
:3:c-format
--flag=error_at_line
:5:c-format
3483 # This is the copyright holder that gets inserted into the header of the
3484 # $(DOMAIN).pot file. gnulib is copyrighted by the FSF.
3485 COPYRIGHT_HOLDER
= Free Software Foundation
, Inc.
3487 # This is the email address or URL to which the translators shall report
3488 # bugs in the untranslated strings:
3489 # - Strings which are not entire sentences, see the maintainer guidelines
3490 # in the GNU gettext documentation, section 'Preparing Strings'.
3491 # - Strings which use unclear terms or require additional context to be
3493 # - Strings which make invalid assumptions about notation of date, time or
3495 # - Pluralisation problems.
3496 # - Incorrect English spelling.
3497 # - Incorrect formatting.
3498 # It can be your email address, or a mailing list address where translators
3499 # can write to without being subscribed, or the URL of a web page through
3500 # which the translators can contact you.
3501 MSGID_BUGS_ADDRESS
= bug-gnulib@gnu.org
3503 # This is the list of locale categories, beyond LC_MESSAGES, for which the
3504 # message catalogs shall be used. It is usually empty.
3505 EXTRA_LOCALE_CATEGORIES
=
3507 # This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
3508 # context. Possible values are "yes" and "no". Set this to yes if the
3509 # package uses functions taking also a message context, like pgettext(), or
3510 # if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
3515 # func_emit_po_POTFILES_in
3516 # emits the file list to be passed to xgettext to standard output.
3518 # - local_gnulib_dir from --local-dir
3519 # - modcache true or false, from --cache-modules/--no-cache-modules
3520 # - sourcebase directory relative to destdir where to place source code
3521 # - files list of new files
3522 func_emit_po_POTFILES_in
()
3524 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3525 func_emit_copyright_notice
3527 echo "# List of files which contain translatable strings."
3528 echo "$files" |
sed -n -e "s,^lib/,$sourcebase/,p"
3531 # func_emit_tests_Makefile_am witness_macro
3532 # emits the contents of tests makefile to standard output.
3534 # - local_gnulib_dir from --local-dir
3535 # - modcache true or false, from --cache-modules/--no-cache-modules
3536 # - modules list of modules, including dependencies
3537 # - libname library name
3538 # - auxdir directory relative to destdir where to place build aux files
3539 # - makefile_name from --makefile-name
3540 # - libtool true if libtool will be used, false or blank otherwise
3541 # - sourcebase relative directory containing lib source code
3542 # - m4base relative directory containing autoconf macros
3543 # - testsbase relative directory containing unit test code
3544 # - macro_prefix prefix of gl_LIBOBJS macros to use
3545 # - witness_c_macro from --witness-c-macro
3546 # - for_test true if creating a package for testing, false otherwise
3547 # - single_configure true if a single configure file should be generated,
3548 # false for a separate configure file for the tests
3549 # - use_libtests true if a libtests.a should be built, false otherwise
3550 # - sed_replace_include_guard_prefix
3551 # sed expression for resolving ${gl_include_guard_prefix}
3552 # - destfile filename relative to destdir of makefile being generated
3554 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val}
3555 # list of edits to be done to Makefile.am variables
3557 # - uses_subdirs nonempty if object files in subdirs exist
3558 func_emit_tests_Makefile_am
()
3561 if test "$libtool" = true
; then
3563 sed_eliminate_LDFLAGS
="$sed_noop"
3566 sed_eliminate_LDFLAGS
='/^lib_LDFLAGS[ ]*+=/d'
3569 # When creating a package for testing: Attempt to provoke failures,
3570 # especially link errors, already during "make" rather than during
3571 # "make check", because "make check" is not possible in a cross-compiling
3572 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
3573 sed_transform_check_PROGRAMS
='s,check_PROGRAMS,noinst_PROGRAMS,g'
3575 sed_transform_check_PROGRAMS
="$sed_noop"
3577 testsbase_inverse
=`echo "$testsbase" | sed -e 's,/$,,' | sed -e 's,[^/][^/]*,..,g'`
3578 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
3579 echo "## Process this file with automake to produce Makefile.in."
3580 func_emit_copyright_notice
3584 for module
in $modules; do
3585 if $for_test && ! $single_configure; then
3586 func_verify_tests_module
3590 if test -n "$module"; then
3592 func_get_automake_snippet
"$module" |
3594 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
3595 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
3596 -e "$sed_eliminate_LDFLAGS" \
3597 -e 's,lib_\([A-Z][A-Z]*\),libtests_a_\1,g' \
3598 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
3599 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
3600 -e "$sed_transform_check_PROGRAMS" \
3601 -e "$sed_replace_include_guard_prefix"
3602 if $use_libtests && test "$module" = 'alloca'; then
3603 echo "libtests_a_LIBADD += @${perhapsLT}ALLOCA@"
3604 echo "libtests_a_DEPENDENCIES += @${perhapsLT}ALLOCA@"
3606 } > "$tmp"/amsnippet
3607 # Skip the contents if it's entirely empty.
3608 if grep '[^ ]' "$tmp"/amsnippet
> /dev
/null
; then
3609 # Mention long-running tests at the end.
3611 for word
in `func_get_status "$module"`; do
3612 if test "$word" = 'longrunning-test'; then
3617 { echo "## begin gnulib module $module"
3619 cat "$tmp"/amsnippet
3620 echo "## end gnulib module $module"
3624 rm -f "$tmp"/amsnippet
3625 # Test whether there are some source files in subdirectories.
3626 for f
in `func_get_filelist "$module"`; do
3628 lib
/*/*.c |
tests
/*/*.c
)
3636 } 3> "$tmp"/main_snippets
4> "$tmp"/longrunning_snippets
3637 # Generate dependencies here, since it eases the debugging of test failures.
3638 # If there are source files in subdirectories, prevent collision of the
3639 # object files (example: hash.c and libxml/hash.c).
3641 if test -n "$uses_subdirs"; then
3642 subdir_options
=' subdir-objects'
3644 echo "AUTOMAKE_OPTIONS = 1.5 foreign${subdir_options}"
3646 if $for_test && ! $single_configure; then
3647 echo "ACLOCAL_AMFLAGS = -I ${testsbase_inverse}/${m4base}"
3650 # Nothing is being added to SUBDIRS; nevertheless the existence of this
3651 # variable is needed to avoid an error from automake:
3652 # "AM_GNU_GETTEXT used but SUBDIRS not defined"
3655 echo "XFAIL_TESTS ="
3656 echo "TESTS_ENVIRONMENT ="
3657 echo "noinst_PROGRAMS ="
3658 if ! $for_test; then
3659 echo "check_PROGRAMS ="
3661 echo "noinst_HEADERS ="
3662 echo "noinst_LIBRARIES ="
3663 if $use_libtests; then
3665 echo "noinst_LIBRARIES += libtests.a"
3667 echo "check_LIBRARIES = libtests.a"
3670 # Automake versions < 1.9b create an empty pkgdatadir at installation time
3671 # if you specify pkgdata_DATA to empty. This is a workaround.
3672 if grep '^pkgdata_DATA *+=' "$tmp"/main_snippets
"$tmp"/longrunning_snippets
> /dev
/null
; then
3673 echo "pkgdata_DATA ="
3676 echo "BUILT_SOURCES ="
3678 echo "MOSTLYCLEANFILES = core *.stackdump"
3679 echo "MOSTLYCLEANDIRS ="
3681 echo "DISTCLEANFILES ="
3682 echo "MAINTAINERCLEANFILES ="
3683 # Execute edits that apply to the Makefile.am being generated.
3685 while test $edit != $makefile_am_edits; do
3686 edit
=`expr $edit + 1`
3687 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
3688 eval var
=\"\
$makefile_am_edit${edit}_var
\"
3689 eval val
=\"\
$makefile_am_edit${edit}_val
\"
3690 if test -n "$var"; then
3691 if test "${dir}Makefile.am" = "$destfile" ||
test "./${dir}Makefile.am" = "$destfile"; then
3692 echo "${var} += ${val}"
3693 eval "makefile_am_edit${edit}_var="
3698 echo "AM_CPPFLAGS = \\"
3700 echo " -DGNULIB_STRICT_CHECKING=1 \\"
3702 if test -n "$witness_c_macro"; then
3703 echo " -D$witness_c_macro=1 \\"
3705 if test -n "${witness_macro}"; then
3706 echo " -D@${witness_macro}@=1 \\"
3708 echo " -I. -I\$(srcdir) \\"
3709 echo " -I${testsbase_inverse} -I\$(srcdir)/${testsbase_inverse} \\"
3710 echo " -I${testsbase_inverse}/${sourcebase-lib} -I\$(srcdir)/${testsbase_inverse}/${sourcebase-lib}"
3712 local_ldadd_before
=''
3713 local_ldadd_after
=''
3714 if $use_libtests; then
3715 # All test programs need to be linked with libtests.a.
3716 # It needs to be passed to the linker before ${libname}.${libext}, since
3717 # the tests-related modules depend on the main modules.
3718 # It also needs to be passed to the linker after ${libname}.${libext}
3719 # because the latter might contain incomplete modules (such as the 'error'
3720 # module whose dependency to 'progname' is voluntarily omitted).
3721 # The LIBTESTS_LIBDEPS can be passed to the linker once or twice, it does
3723 local_ldadd_before
=' libtests.a'
3724 local_ldadd_after
=' libtests.a $(LIBTESTS_LIBDEPS)'
3726 echo "LDADD =${local_ldadd_before} ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext}${local_ldadd_after}"
3728 if $use_libtests; then
3729 echo "libtests_a_SOURCES ="
3730 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
3731 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
3732 echo "libtests_a_LIBADD = \$(${macro_prefix}tests_LIBOBJS)"
3733 echo "libtests_a_DEPENDENCIES = \$(${macro_prefix}tests_LIBOBJS)"
3734 echo "EXTRA_libtests_a_SOURCES ="
3735 # The circular dependency in LDADD requires this.
3736 echo "AM_LIBTOOLFLAGS = --preserve-dup-deps"
3739 # Many test scripts use ${EXEEXT} or ${srcdir}.
3740 # EXEEXT is defined by AC_PROG_CC through autoconf.
3741 # srcdir is defined by autoconf and automake.
3742 echo "TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='\$(srcdir)'"
3744 cat "$tmp"/main_snippets
"$tmp"/longrunning_snippets \
3745 |
sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
3746 echo "# Clean up after Solaris cc."
3748 echo " rm -rf SunWS_cache"
3750 echo "mostlyclean-local: mostlyclean-generic"
3751 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
3752 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
3753 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
3757 rm -f "$tmp"/main_snippets
"$tmp"/longrunning_snippets
3760 # func_emit_initmacro_start macro_prefix
3761 # emits the first few statements of the gl_INIT macro to standard output.
3762 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
3763 func_emit_initmacro_start
()
3765 macro_prefix_arg
="$1"
3766 # Overriding AC_LIBOBJ and AC_REPLACE_FUNCS has the effect of storing
3767 # platform-dependent object files in ${macro_prefix_arg}_LIBOBJS instead of
3768 # LIBOBJS. The purpose is to allow several gnulib instantiations under
3769 # a single configure.ac file. (AC_CONFIG_LIBOBJ_DIR does not allow this
3771 # Furthermore it avoids an automake error like this when a Makefile.am
3772 # that uses pieces of gnulib also uses $(LIBOBJ):
3773 # automatically discovered file `error.c' should not be explicitly mentioned
3774 echo " m4_pushdef([AC_LIBOBJ], m4_defn([${macro_prefix_arg}_LIBOBJ]))"
3775 echo " m4_pushdef([AC_REPLACE_FUNCS], m4_defn([${macro_prefix_arg}_REPLACE_FUNCS]))"
3776 # Overriding AC_LIBSOURCES has the same purpose of avoiding the automake
3777 # error when a Makefile.am that uses pieces of gnulib also uses $(LIBOBJ):
3778 # automatically discovered file `error.c' should not be explicitly mentioned
3779 # We let automake know about the files to be distributed through the
3780 # EXTRA_lib_SOURCES variable.
3781 echo " m4_pushdef([AC_LIBSOURCES], m4_defn([${macro_prefix_arg}_LIBSOURCES]))"
3782 # Create data variables for checking the presence of files that are mentioned
3783 # as AC_LIBSOURCES arguments. These are m4 variables, not shell variables,
3784 # because we want the check to happen when the configure file is created,
3785 # not when it is run. ${macro_prefix_arg}_LIBSOURCES_LIST is the list of
3786 # files to check for. ${macro_prefix_arg}_LIBSOURCES_DIR is the subdirectory
3787 # in which to expect them.
3788 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_LIST], [])"
3789 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_DIR], [])"
3793 # func_emit_initmacro_end macro_prefix
3794 # emits the last few statements of the gl_INIT macro to standard output.
3795 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
3796 func_emit_initmacro_end
()
3798 macro_prefix_arg
="$1"
3799 # Check the presence of files that are mentioned as AC_LIBSOURCES arguments.
3800 # The check is performed only when autoconf is run from the directory where
3801 # the configure.ac resides; if it is run from a different directory, the
3803 echo " m4_ifval(${macro_prefix_arg}_LIBSOURCES_LIST, ["
3804 echo " m4_syscmd([test ! -d ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[ ||"
3805 echo " for gl_file in ]${macro_prefix_arg}_LIBSOURCES_LIST[ ; do"
3806 echo " if test ! -r ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file ; then"
3807 echo " echo \"missing file ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file\" >&2"
3811 echo " m4_if(m4_sysval, [0], [],"
3812 echo " [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])"
3814 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_DIR])"
3815 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_LIST])"
3816 echo " m4_popdef([AC_LIBSOURCES])"
3817 echo " m4_popdef([AC_REPLACE_FUNCS])"
3818 echo " m4_popdef([AC_LIBOBJ])"
3819 echo " AC_CONFIG_COMMANDS_PRE(["
3820 echo " ${macro_prefix_arg}_libobjs="
3821 echo " ${macro_prefix_arg}_ltlibobjs="
3822 echo " if test -n \"\$${macro_prefix_arg}_LIBOBJS\"; then"
3823 echo " # Remove the extension."
3824 echo " sed_drop_objext='s/\\.o\$//;s/\\.obj\$//'"
3825 echo " for i in \`for i in \$${macro_prefix_arg}_LIBOBJS; do echo \"\$i\"; done | sed -e \"\$sed_drop_objext\" | sort | uniq\`; do"
3826 echo " ${macro_prefix_arg}_libobjs=\"\$${macro_prefix_arg}_libobjs \$i.\$ac_objext\""
3827 echo " ${macro_prefix_arg}_ltlibobjs=\"\$${macro_prefix_arg}_ltlibobjs \$i.lo\""
3830 echo " AC_SUBST([${macro_prefix_arg}_LIBOBJS], [\$${macro_prefix_arg}_libobjs])"
3831 echo " AC_SUBST([${macro_prefix_arg}_LTLIBOBJS], [\$${macro_prefix_arg}_ltlibobjs])"
3835 # func_emit_initmacro_done macro_prefix sourcebase
3836 # emits a few statements after the gl_INIT macro to standard output.
3837 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
3838 # - sourcebase directory relative to destdir where to place source code
3839 func_emit_initmacro_done
()
3841 macro_prefix_arg
="$1"
3844 echo "# Like AC_LIBOBJ, except that the module name goes"
3845 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
3846 echo "AC_DEFUN([${macro_prefix_arg}_LIBOBJ], ["
3847 echo " AS_LITERAL_IF([\$1], [${macro_prefix_arg}_LIBSOURCES([\$1.c])])dnl"
3848 echo " ${macro_prefix_arg}_LIBOBJS=\"\$${macro_prefix_arg}_LIBOBJS \$1.\$ac_objext\""
3851 echo "# Like AC_REPLACE_FUNCS, except that the module name goes"
3852 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
3853 echo "AC_DEFUN([${macro_prefix_arg}_REPLACE_FUNCS], ["
3854 echo " m4_foreach_w([gl_NAME], [\$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl"
3855 echo " AC_CHECK_FUNCS([\$1], , [${macro_prefix_arg}_LIBOBJ(\$ac_func)])"
3858 echo "# Like AC_LIBSOURCES, except the directory where the source file is"
3859 echo "# expected is derived from the gnulib-tool parameterization,"
3860 echo "# and alloca is special cased (for the alloca-opt module)."
3861 echo "# We could also entirely rely on EXTRA_lib..._SOURCES."
3862 echo "AC_DEFUN([${macro_prefix_arg}_LIBSOURCES], ["
3863 echo " m4_foreach([_gl_NAME], [\$1], ["
3864 echo " m4_if(_gl_NAME, [alloca.c], [], ["
3865 echo " m4_define([${macro_prefix_arg}_LIBSOURCES_DIR], [$sourcebase_arg])"
3866 echo " m4_append([${macro_prefix_arg}_LIBSOURCES_LIST], _gl_NAME, [ ])"
3872 # func_emit_autoconf_snippet indentation
3873 # emits the autoconf snippet of a module.
3875 # - local_gnulib_dir from --local-dir
3876 # - modcache true or false, from --cache-modules/--no-cache-modules
3877 # - sed_replace_build_aux sed expression that replaces reference to build-aux
3878 # - sed_replace_include_guard_prefix
3879 # sed expression for resolving ${gl_include_guard_prefix}
3880 # - module the module name
3881 # - toplevel true or false. 'false' means a subordinate use of
3883 # - disable_libtool true or false. It tells whether to disable libtool
3884 # handling even if it has been specified through the
3885 # command line options.
3886 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
3888 # - indentation spaces to prepend on each line
3889 func_emit_autoconf_snippet
()
3891 if { case $module in
3892 gnumakefile | maintainer-makefile
)
3893 # These modules are meant to be used only in the top-level directory.
3899 func_get_autoconf_snippet
"$module" \
3900 |
sed -e '/^$/d;' -e "s/^/$indentation/" \
3901 -e "$sed_replace_build_aux" \
3902 -e "$sed_replace_include_guard_prefix" \
3903 |
{ if $disable_libtool; then
3904 sed -e 's/\$gl_cond_libtool/false/g' \
3905 -e 's/gl_libdeps/gltests_libdeps/g' \
3906 -e 's/gl_ltlibdeps/gltests_ltlibdeps/g'
3911 |
{ if $disable_gettext; then
3912 sed -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./'
3917 if test "$module" = 'alloca' && test "$libtool" = true
&& ! $disable_libtool; then
3918 echo 'changequote(,)dnl'
3919 echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
3920 echo 'changequote([, ])dnl'
3921 echo 'AC_SUBST([LTALLOCA])'
3926 # func_emit_autoconf_snippets modules verifier toplevel disable_libtool disable_gettext
3927 # collects and emit the autoconf snippets of a set of modules.
3929 # - local_gnulib_dir from --local-dir
3930 # - modcache true or false, from --cache-modules/--no-cache-modules
3931 # - sed_replace_build_aux sed expression that replaces reference to build-aux
3932 # - sed_replace_include_guard_prefix
3933 # sed expression for resolving ${gl_include_guard_prefix}
3934 # - modules the list of modules.
3935 # - verifier one of func_verify_module, func_verify_nontests_module,
3936 # func_verify_tests_module. It selects the subset of
3937 # $modules to consider.
3938 # - toplevel true or false. 'false' means a subordinate use of
3940 # - disable_libtool true or false. It tells whether to disable libtool
3941 # handling even if it has been specified through the
3942 # command line options.
3943 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
3945 func_emit_autoconf_snippets
()
3949 disable_libtool
="$4"
3950 disable_gettext
="$5"
3951 if test "$cond_dependencies" = true
; then
3952 for m
in $modules; do echo $m; done | LC_ALL
=C
sort -u > "$tmp"/modules
3953 # Emit the autoconf code for the unconditional modules.
3954 for module
in $1; do
3956 if test -n "$module"; then
3957 if func_cond_module_p
"$module"; then
3960 func_emit_autoconf_snippet
" "
3964 # Initialize the shell variables indicating that the modules are enabled.
3965 for module
in $1; do
3967 if test -n "$module"; then
3968 if func_cond_module_p
"$module"; then
3969 func_module_shellvar_name
"$module"
3970 echo " $shellvar=false"
3974 # Emit the autoconf code for the conditional modules, each in a separate
3975 # function. This makes it possible to support cycles among conditional
3977 for module
in $1; do
3979 if test -n "$module"; then
3980 if func_cond_module_p
"$module"; then
3981 func_module_shellfunc_name
"$module"
3982 func_module_shellvar_name
"$module"
3983 echo " $shellfunc ()"
3985 echo " if ! \$$shellvar; then"
3986 func_emit_autoconf_snippet
" "
3987 echo " $shellvar=true"
3988 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
3989 # Intersect $deps with the modules list $1.
3990 deps
=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
3991 for dep
in $deps; do
3992 if func_cond_module_p
"$dep"; then
3993 func_module_shellfunc_name
"$dep"
3994 func_cond_module_condition
"$module" "$dep"
3995 if test "$condition" != true
; then
3996 echo " if $condition; then"
4003 # The autoconf code for $dep has already been emitted above and
4004 # therefore is already executed when this function is run.
4013 # Emit the dependencies from the unconditional to the conditional modules.
4014 for module
in $1; do
4016 if test -n "$module"; then
4017 if func_cond_module_p
"$module"; then
4020 deps
=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
4021 # Intersect $deps with the modules list $1.
4022 deps
=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
4023 for dep
in $deps; do
4024 if func_cond_module_p
"$dep"; then
4025 func_module_shellfunc_name
"$dep"
4026 func_cond_module_condition
"$module" "$dep"
4027 if test "$condition" != true
; then
4028 echo " if $condition; then"
4035 # The autoconf code for $dep has already been emitted above and
4036 # therefore is already executed when this code is run.
4043 # Define the Automake conditionals.
4044 echo " m4_pattern_allow([^${macro_prefix}_GNULIB_ENABLED_])"
4045 for module
in $1; do
4047 if test -n "$module"; then
4048 if func_cond_module_p
"$module"; then
4049 func_module_conditional_name
"$module"
4050 func_module_shellvar_name
"$module"
4051 echo " AM_CONDITIONAL([$conditional], [\$$shellvar])"
4056 # Ignore the conditions, and enable all modules unconditionally.
4057 for module
in $1; do
4059 if test -n "$module"; then
4060 func_emit_autoconf_snippet
" "
4066 # func_import modules
4067 # Uses also the variables
4068 # - mode import or add-import or remove-import or update
4069 # - destdir target directory
4070 # - local_gnulib_dir from --local-dir
4071 # - modcache true or false, from --cache-modules/--no-cache-modules
4072 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
4073 # - libname library name
4074 # - supplied_libname true if --lib was given, blank otherwise
4075 # - sourcebase directory relative to destdir where to place source code
4076 # - m4base directory relative to destdir where to place *.m4 macros
4077 # - pobase directory relative to destdir where to place *.po files
4078 # - docbase directory relative to destdir where to place doc files
4079 # - testsbase directory relative to destdir where to place unit test code
4080 # - auxdir directory relative to destdir where to place build aux files
4081 # - inctests true if --with-tests was given, blank otherwise
4082 # - incobsolete true if --with-obsolete was given, blank otherwise
4083 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
4084 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
4086 # - inc_privileged_tests true if --with-privileged-tests was given, blank
4088 # - inc_unportable_tests true if --with-unportable-tests was given, blank
4090 # - inc_all_tests true if --with-all-tests was given, blank otherwise
4091 # - avoidlist list of modules to avoid, from --avoid
4092 # - cond_dependencies true if --conditional-dependencies was given, false if
4093 # --no-conditional-dependencies was given, blank otherwise
4094 # - lgpl yes or a number if library's license shall be LGPL,
4096 # - makefile_name from --makefile-name
4097 # - libtool true if --libtool was given, false if --no-libtool was
4098 # given, blank otherwise
4099 # - guessed_libtool true if the configure.ac file uses libtool, false otherwise
4100 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
4101 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
4102 # - witness_c_macro from --witness-c-macro
4103 # - vc_files true if --vc-files was given, false if --no-vc-files was
4104 # given, blank otherwise
4105 # - autoconf_minversion minimum supported autoconf version
4106 # - doit : if actions shall be executed, false if only to be printed
4107 # - symbolic true if files should be symlinked, copied otherwise
4108 # - lsymbolic true if files from local_gnulib_dir should be symlinked,
4110 # - do_copyrights true if copyright notices in files should be replaced,
4114 # Get the cached settings.
4115 # In 'import' mode, we read them only for the purpose of knowing the old
4116 # installed file list, and don't use them as defaults.
4117 cached_local_gnulib_dir
=
4118 cached_specified_modules
=
4120 cached_inc_cxx_tests
=
4121 cached_inc_longrunning_tests
=
4122 cached_inc_privileged_tests
=
4123 cached_inc_unportable_tests
=
4124 cached_inc_all_tests
=
4134 cached_makefile_name
=
4135 cached_cond_dependencies
=
4137 cached_macro_prefix
=
4139 cached_witness_c_macro
=
4142 if test -f "$destdir"/$m4base/gnulib-cache.
m4; then
4143 cached_libtool
=false
4149 s,^.*gl_LOCAL_DIR([[ ]*\([^]"$`\\)]*\).*$,cached_local_gnulib_dir="\1",p
4159 s,^.*gl_MODULES([[ ]*\([^]"$`\\)]*\).*$,cached_specified_modules="\1",p
4161 /gl_WITH_OBSOLETE/ {
4162 s,^.*$,cached_incobsolete=true,p
4164 /gl_WITH_CXX_TESTS/ {
4165 s,^.*$,cached_inc_cxx_tests=true,p
4167 /gl_WITH_LONGRUNNING_TESTS/ {
4168 s,^.*$,cached_inc_longrunning_tests=true,p
4170 /gl_WITH_PRIVILEGED_TESTS/ {
4171 s,^.*$,cached_inc_privileged_tests=true,p
4173 /gl_WITH_UNPORTABLE_TESTS/ {
4174 s,^.*$,cached_inc_unportable_tests=true,p
4176 /gl_WITH_ALL_TESTS/ {
4177 s,^.*$,cached_inc_all_tests=true,p
4180 s,^.*gl_AVOID([[ ]*\([^]"$`\\)]*\).*$,cached_avoidlist="\1",p
4183 s,^.*gl_SOURCE_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_sourcebase="\1",p
4186 s,^.*gl_M4_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_m4base="\1",p
4189 s,^.*gl_PO_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_pobase="\1",p
4192 s,^.*gl_DOC_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_docbase="\1",p
4195 s,^.*gl_TESTS_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_testsbase="\1",p
4198 s,^.*$,cached_inctests=true,p
4201 s,^.*gl_LIB([[ ]*\([^]"$`\\)]*\).*$,cached_libname="\1",p
4204 s,^.*gl_LGPL([[ ]*\([^]"$`\\)]*\).*$,cached_lgpl="\1",p
4207 s,^.*$,cached_lgpl=yes,p
4209 /gl_MAKEFILE_NAME(/ {
4210 s,^.*gl_MAKEFILE_NAME([[ ]*\([^]"$`\\)]*\).*$,cached_makefile_name="\1",p
4212 /gl_CONDITIONAL_DEPENDENCIES/ {
4213 s,^.*$,cached_cond_dependencies=true,p
4216 s,^.*$,cached_libtool=true,p
4218 /gl_MACRO_PREFIX(/ {
4219 s,^.*gl_MACRO_PREFIX([[ ]*\([^]"$`\\)]*\).*$,cached_macro_prefix="\1",p
4222 s,^.*gl_PO_DOMAIN([[ ]*\([^]"$`\\)]*\).*$,cached_po_domain="\1",p
4224 /gl_WITNESS_C_MACRO(/ {
4225 s,^.*gl_WITNESS_C_MACRO([[ ]*\([^]"$`\\)]*\).*$,cached_witness_c_macro="\1",p
4228 s,^.*gl_VC_FILES([[ ]*\([^]"$`\\)]*\).*$,cached_vc_files="\1",p
4230 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-cache.m4`
4231 if test -f "$destdir"/$m4base/gnulib-comp.
m4; then
4236 /AC_DEFUN(\['"${cached_macro_prefix}"'_FILE_LIST\], \[/ {
4237 s,^.*$,cached_files=",p
4250 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-comp.m4`
4254 if test "$mode" = import
; then
4255 # In 'import' mode, the new set of specified modules overrides the cached
4256 # set of modules. Ignore the cached settings.
4257 specified_modules
="$1"
4259 # Merge the cached settings with the specified ones.
4260 # The m4base must be the same as expected from the pathname.
4261 if test -n "$cached_m4base" && test "$cached_m4base" != "$m4base"; then
4262 func_fatal_error
"$m4base/gnulib-cache.m4 is expected to contain gl_M4_BASE([$m4base])"
4264 # The local_gnulib_dir defaults to the cached one. Recall that the cached one
4265 # is relative to $destdir, whereas the one we use is relative to . or absolute.
4266 if test -z "$local_gnulib_dir"; then
4267 if test -n "$cached_local_gnulib_dir"; then
4270 local_gnulib_dir
="$destdir/$cached_local_gnulib_dir" ;;
4272 case "$cached_local_gnulib_dir" in
4274 local_gnulib_dir
="$destdir/$cached_local_gnulib_dir" ;;
4276 func_relconcat
"$destdir" "$cached_local_gnulib_dir"
4277 local_gnulib_dir
="$relconcat" ;;
4284 # Append the cached and the specified module names. So that
4285 # "gnulib-tool --add-import foo" means to add the module foo.
4286 specified_modules
="$cached_specified_modules $1"
4289 # Take the cached module names, minus the specified module names.
4291 if $have_associative; then
4292 # Use an associative array, for O(N) worst-case run time.
4293 declare -A to_remove
4295 eval 'to_remove[$m]=yes'
4297 for module
in $cached_specified_modules; do
4298 if eval 'test -z "${to_remove[$module]}"'; then
4299 func_append specified_modules
"$module "
4303 # This loop has O(N²) worst-case run time.
4304 for module
in $cached_specified_modules; do
4307 if test "$m" = "$module"; then
4312 if test -z "$to_remove"; then
4313 func_append specified_modules
"$module "
4319 # Take the cached module names. There are no specified module names.
4320 specified_modules
="$cached_specified_modules"
4323 # Included obsolete modules among the dependencies if specified either way.
4324 if test -z "$incobsolete"; then
4325 incobsolete
="$cached_incobsolete"
4327 # Included special kinds of tests modules among the dependencies if specified
4329 if test -z "$inc_cxx_tests"; then
4330 inc_cxx_tests
="$cached_inc_cxx_tests"
4332 if test -z "$inc_longrunning_tests"; then
4333 inc_longrunning_tests
="$cached_inc_longrunning_tests"
4335 if test -z "$inc_privileged_tests"; then
4336 inc_privileged_tests
="$cached_inc_privileged_tests"
4338 if test -z "$inc_unportable_tests"; then
4339 inc_unportable_tests
="$cached_inc_unportable_tests"
4341 if test -z "$inc_all_tests"; then
4342 inc_all_tests
="$cached_inc_all_tests"
4344 # Append the cached and the specified avoidlist. This is probably better
4345 # than dropping the cached one when --avoid is specified at least once.
4346 avoidlist
=`for m in $cached_avoidlist $avoidlist; do echo $m; done | LC_ALL=C sort -u`
4347 avoidlist
=`echo $avoidlist`
4349 # The sourcebase defaults to the cached one.
4350 if test -z "$sourcebase"; then
4351 sourcebase
="$cached_sourcebase"
4352 if test -z "$sourcebase"; then
4353 func_fatal_error
"missing --source-base option"
4356 # The pobase defaults to the cached one.
4357 if test -z "$pobase"; then
4358 pobase
="$cached_pobase"
4360 # The docbase defaults to the cached one.
4361 if test -z "$docbase"; then
4362 docbase
="$cached_docbase"
4363 if test -z "$docbase"; then
4364 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."
4367 # The testsbase defaults to the cached one.
4368 if test -z "$testsbase"; then
4369 testsbase
="$cached_testsbase"
4370 if test -z "$testsbase"; then
4371 func_fatal_error
"missing --tests-base option"
4374 # Require the tests if specified either way.
4375 if test -z "$inctests"; then
4376 inctests
="$cached_inctests"
4378 # The libname defaults to the cached one.
4379 if test -z "$supplied_libname"; then
4380 libname
="$cached_libname"
4381 if test -z "$libname"; then
4382 func_fatal_error
"missing --lib option"
4385 # Require LGPL if specified either way.
4386 if test -z "$lgpl"; then
4389 # The makefile_name defaults to the cached one.
4390 if test -z "$makefile_name"; then
4391 makefile_name
="$cached_makefile_name"
4393 # Use conditional dependencies if specified either way.
4394 if test -z "$cond_dependencies"; then
4395 cond_dependencies
="$cached_cond_dependencies"
4397 # Use libtool if specified either way, or if guessed.
4398 if test -z "$libtool"; then
4399 if test -n "$cached_m4base"; then
4400 libtool
="$cached_libtool"
4402 libtool
="$guessed_libtool"
4405 # The macro_prefix defaults to the cached one.
4406 if test -z "$macro_prefix"; then
4407 macro_prefix
="$cached_macro_prefix"
4408 if test -z "$macro_prefix"; then
4409 func_fatal_error
"missing --macro-prefix option"
4412 # The po_domain defaults to the cached one.
4413 if test -z "$po_domain"; then
4414 po_domain
="$cached_po_domain"
4416 # The witness_c_macro defaults to the cached one.
4417 if test -z "$witness_c_macro"; then
4418 witness_c_macro
="$cached_witness_c_macro"
4420 # The vc_files defaults to the cached one.
4421 if test -z "$vc_files"; then
4422 vc_files
="$cached_vc_files"
4424 # Ensure constraints.
4425 if test "$cond_dependencies" = true
&& test -n "$inctests"; then
4426 echo "gnulib-tool: option --conditional-dependencies is not supported with --with-tests" 1>&2
4430 # --without-*-tests options are not supported here.
4432 excl_longrunning_tests
=
4433 excl_privileged_tests
=
4434 excl_unportable_tests
=
4436 # Canonicalize the list of specified modules.
4437 specified_modules
=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
4439 # Include all kinds of tests modules if --with-all-tests was specified.
4440 inc_all_direct_tests
="$inc_all_tests"
4441 inc_all_indirect_tests
="$inc_all_tests"
4443 # Determine final module list.
4444 modules
="$specified_modules"
4445 func_modules_transitive_closure
4446 if test $verbose -ge 0; then
4447 func_show_module_list
4449 final_modules
="$modules"
4451 # Determine main module list and tests-related module list separately.
4452 func_modules_transitive_closure_separately
4454 # Determine whether a $testsbase/libtests.a is needed.
4455 func_determine_use_libtests
4457 # Add the dummy module to the main module list or to the tests-related module
4459 func_modules_add_dummy_separately
4461 # If --lgpl, verify that the licenses of modules are compatible.
4462 if test -n "$lgpl"; then
4463 license_incompatibilities
=
4464 for module
in $main_modules; do
4465 license
=`func_get_license $module`
4467 'GPLed build tool') ;;
4468 'public domain' |
'unlimited' |
'unmodifiable license text') ;;
4473 LGPL | LGPLv2
+ | LGPLv3
+) ;;
4474 *) func_append license_incompatibilities
"$module $license$nl" ;;
4480 *) func_append license_incompatibilities
"$module $license$nl" ;;
4483 *) func_fatal_error
"invalid value lgpl=$lgpl" ;;
4488 if test -n "$license_incompatibilities"; then
4489 # Format the license incompatibilities as a table.
4490 sed_expand_column1_width50_indent17
='s,^\([^ ]*\) ,\1 ,
4491 s,^\(.................................................[^ ]*\) *, \1 ,'
4492 license_incompatibilities
=`echo "$license_incompatibilities" | sed -e "$sed_expand_column1_width50_indent17"`
4493 func_fatal_error
"incompatible license on modules:$nl$license_incompatibilities"
4497 # Show banner notice of every module.
4498 modules
="$main_modules"
4501 # Determine script to apply to imported library files.
4502 sed_transform_lib_file
=
4503 for module
in $main_modules; do
4504 if test $module = config-h
; then
4505 # Assume config.h exists, and that -DHAVE_CONFIG_H is omitted.
4506 sed_transform_lib_file
=$sed_transform_lib_file'
4507 s/^#ifdef[ ]*HAVE_CONFIG_H[ ]*$/#if 1/
4512 sed_transform_main_lib_file
="$sed_transform_lib_file"
4513 if test -n "$do_copyrights"; then
4514 if test -n "$lgpl"; then
4518 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
4519 s/GNU General/GNU Lesser General/g
4520 s/General Public License/Lesser General Public License/g
4521 s/Lesser Lesser General Public License/Lesser General Public License/g
4525 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
4526 s/GNU General/GNU Lesser General/g
4527 s/General Public License/Lesser General Public License/g
4528 s/Lesser Lesser General Public License/Lesser General Public License/g
4530 s/version [23]\([ ,]\)/version 2.1\1/g
4533 *) func_fatal_error
"invalid value lgpl=$lgpl" ;;
4537 sed_transform_main_lib_file
=$sed_transform_main_lib_file'
4538 s/GNU Lesser General/GNU General/g
4539 s/Lesser General Public License/General Public License/g
4541 s/GNU Library General/GNU General/g
4542 s/Library General Public License/General Public License/g
4544 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
4549 # Determine script to apply to auxiliary files that go into $auxdir/.
4550 sed_transform_build_aux_file
=
4551 if test -n "$do_copyrights"; then
4553 sed_transform_build_aux_file
=$sed_transform_build_aux_file'
4554 s/GNU Lesser General/GNU General/g
4555 s/Lesser General Public License/General Public License/g
4557 s/GNU Library General/GNU General/g
4558 s/Library General Public License/General Public License/g
4560 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
4564 # Determine script to apply to library files that go into $testsbase/.
4565 sed_transform_testsrelated_lib_file
="$sed_transform_lib_file"
4566 if test -n "$do_copyrights"; then
4568 sed_transform_testsrelated_lib_file
=$sed_transform_testsrelated_lib_file'
4569 s/GNU Lesser General/GNU General/g
4570 s/Lesser General Public License/General Public License/g
4572 s/GNU Library General/GNU General/g
4573 s/Library General Public License/General Public License/g
4575 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
4579 # Determine the final file lists.
4580 func_modules_to_filelist_separately
4583 || func_fatal_error
"refusing to do nothing"
4585 # Add m4/gnulib-tool.m4 to the file list. It is not part of any module.
4586 new_files
="$files m4/gnulib-tool.m4"
4587 old_files
="$cached_files"
4588 if test -f "$destdir"/$m4base/gnulib-tool.
m4; then
4589 func_append old_files
" m4/gnulib-tool.m4"
4592 rewritten
='%REWRITTEN%'
4593 sed_rewrite_old_files
="\
4594 s,^build-aux/,$rewritten$auxdir/,
4595 s,^doc/,$rewritten$cached_docbase/,
4596 s,^lib/,$rewritten$cached_sourcebase/,
4597 s,^m4/,$rewritten$cached_m4base/,
4598 s,^tests/,$rewritten$cached_testsbase/,
4599 s,^tests=lib/,$rewritten$cached_testsbase/,
4602 sed_rewrite_new_files
="\
4603 s,^build-aux/,$rewritten$auxdir/,
4604 s,^doc/,$rewritten$docbase/,
4605 s,^lib/,$rewritten$sourcebase/,
4606 s,^m4/,$rewritten$m4base/,
4607 s,^tests/,$rewritten$testsbase/,
4608 s,^tests=lib/,$rewritten$testsbase/,
4612 # Create directories.
4613 { echo "$sourcebase"
4615 if test -n "$pobase"; then
4618 docfiles
=`echo "$files" | sed -n -e 's,^doc/,,p'`
4619 if test -n "$docfiles"; then
4622 if test -n "$inctests"; then
4626 for f
in $files; do echo $f; done \
4627 |
sed -e "$sed_rewrite_new_files" \
4628 |
sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
4631 { # Rearrange file descriptors. Needed because "while ... done < ..."
4632 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
4633 exec 5<&0 < "$tmp"/dirs
4635 if test ! -d "$destdir/$d"; then
4637 echo "Creating directory $destdir/$d"
4638 mkdir
-p "$destdir/$d" || func_fatal_error
"failed"
4640 echo "Create directory $destdir/$d"
4647 # Copy files or make symbolic links. Remove obsolete files.
4651 # Construct a table with 2 columns: rewritten-file-name original-file-name,
4652 # representing the files according to the last gnulib-tool invocation.
4653 for f
in $old_files; do echo $f; done \
4654 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_old_files" \
4657 # Construct a table with 2 columns: rewritten-file-name original-file-name,
4658 # representing the files after this gnulib-tool invocation.
4659 for f
in $new_files; do echo $f; done \
4660 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" \
4663 # First the files that are in old-files, but not in new-files:
4664 sed_take_first_column
='s,'"$delimiter"'.*,,'
4665 for g
in `LC_ALL=C join -t"$delimiter" -v1 "$tmp"/old-files "$tmp"/new-files | sed -e "$sed_take_first_column"`; do
4666 # Remove the file. Do nothing if the user already removed it.
4667 if test -f "$destdir/$g" ||
test -h "$destdir/$g"; then
4669 echo "Removing file $g (backup in ${g}~)"
4670 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error
"failed"
4672 echo "Remove file $g (backup in ${g}~)"
4674 func_append removed_files
"$g$nl"
4677 # func_add_or_update handles a file that ought to be present afterwards.
4679 # - f the original file name
4680 # - g the rewritten file name
4681 # - already_present nonempty if the file should already exist, empty
4683 func_add_or_update
()
4687 tests
=lib
/*) f
=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
4689 func_dest_tmpfilename
"$g"
4690 func_lookup_file
"$f"
4691 cp "$lookedup_file" "$tmpfile" || func_fatal_error
"failed"
4692 if test -n "$sed_transform_main_lib_file"; then
4695 sed -e "$sed_transform_main_lib_file" \
4696 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
4700 if test -n "$sed_transform_build_aux_file"; then
4703 sed -e "$sed_transform_build_aux_file" \
4704 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
4708 if test -n "$sed_transform_testsrelated_lib_file"; then
4711 sed -e "$sed_transform_testsrelated_lib_file" \
4712 < "$lookedup_file" > "$tmpfile" || func_fatal_error
"failed"
4716 if test -f "$destdir/$g"; then
4717 # The file already exists.
4721 # Don't protest if the file should be there but isn't: it happens
4722 # frequently that developers don't put autogenerated files under version control.
4724 func_append added_files
"$g$nl"
4728 # Then the files that are in new-files, but not in old-files:
4729 sed_take_last_column
='s,^.*'"$delimiter"',,'
4731 LC_ALL
=C
join -t"$delimiter" -v2 "$tmp"/old-files
"$tmp"/new-files \
4732 |
sed -e "$sed_take_last_column" \
4733 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/added-files
4734 { # Rearrange file descriptors. Needed because "while ... done < ..."
4735 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
4736 exec 5<&0 < "$tmp"/added-files
4742 # Then the files that are in new-files and in old-files:
4743 already_present
=true
4744 LC_ALL
=C
join -t"$delimiter" "$tmp"/old-files
"$tmp"/new-files \
4745 |
sed -e "$sed_take_last_column" \
4746 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/kept-files
4747 { # Rearrange file descriptors. Needed because "while ... done < ..."
4748 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
4749 exec 5<&0 < "$tmp"/kept-files
4756 # Command-line invocation printed in a comment in generated gnulib-cache.m4.
4757 actioncmd
="gnulib-tool --import"
4758 func_append actioncmd
" --dir=$destdir"
4759 if test -n "$local_gnulib_dir"; then
4760 func_append actioncmd
" --local-dir=$local_gnulib_dir"
4762 func_append actioncmd
" --lib=$libname"
4763 func_append actioncmd
" --source-base=$sourcebase"
4764 func_append actioncmd
" --m4-base=$m4base"
4765 if test -n "$pobase"; then
4766 func_append actioncmd
" --po-base=$pobase"
4768 func_append actioncmd
" --doc-base=$docbase"
4769 func_append actioncmd
" --tests-base=$testsbase"
4770 func_append actioncmd
" --aux-dir=$auxdir"
4771 if test -n "$inctests"; then
4772 func_append actioncmd
" --with-tests"
4774 if test -n "$incobsolete"; then
4775 func_append actioncmd
" --with-obsolete"
4777 if test -n "$inc_cxx_tests"; then
4778 func_append actioncmd
" --with-c++-tests"
4780 if test -n "$inc_longrunning_tests"; then
4781 func_append actioncmd
" --with-longrunning-tests"
4783 if test -n "$inc_privileged_tests"; then
4784 func_append actioncmd
" --with-privileged-tests"
4786 if test -n "$inc_unportable_tests"; then
4787 func_append actioncmd
" --with-unportable-tests"
4789 if test -n "$inc_all_tests"; then
4790 func_append actioncmd
" --with-all-tests"
4792 for module
in $avoidlist; do
4793 func_append actioncmd
" --avoid=$module"
4795 if test -n "$lgpl"; then
4796 if test "$lgpl" = yes; then
4797 func_append actioncmd
" --lgpl"
4799 func_append actioncmd
" --lgpl=$lgpl"
4802 if test -n "$makefile_name"; then
4803 func_append actioncmd
" --makefile-name=$makefile_name"
4805 if test "$cond_dependencies" = true
; then
4806 func_append actioncmd
" --conditional-dependencies"
4808 func_append actioncmd
" --no-conditional-dependencies"
4810 if test "$libtool" = true
; then
4811 func_append actioncmd
" --libtool"
4813 func_append actioncmd
" --no-libtool"
4815 func_append actioncmd
" --macro-prefix=$macro_prefix"
4816 if test -n "$po_domain"; then
4817 func_append actioncmd
" --po-domain=$po_domain"
4819 if test -n "$witness_c_macro"; then
4820 func_append actioncmd
" --witness-c-macro=$witness_c_macro"
4822 if test -n "$vc_files"; then
4823 if test "$vc_files" = true
; then
4824 func_append actioncmd
" --vc-files"
4826 func_append actioncmd
" --no-vc-files"
4829 func_append actioncmd
" `echo $specified_modules`"
4831 # Determine include_guard_prefix.
4832 func_compute_include_guard_prefix
4834 # Default the makefile name to Makefile.am.
4835 if test -n "$makefile_name"; then
4836 makefile_am
=$makefile_name
4838 makefile_am
=Makefile.am
4841 # Create normal Makefile.ams.
4844 # Setup list of Makefile.am edits that are to be performed afterwards.
4845 # Some of these edits apply to files that we will generate; others are
4846 # under the responsibility of the developer.
4848 # func_note_Makefile_am_edit dir var value
4849 # remembers that ${dir}Makefile.am needs to be edited to that ${var} mentions
4851 func_note_Makefile_am_edit
()
4853 makefile_am_edits
=`expr $makefile_am_edits + 1`
4854 eval makefile_am_edit
${makefile_am_edits}_dir
=\"\
$1\"
4855 eval makefile_am_edit
${makefile_am_edits}_var
=\"\
$2\"
4856 eval makefile_am_edit
${makefile_am_edits}_val
=\"\
$3\"
4858 if test "$makefile_am" = Makefile.am
; then
4859 sourcebase_dir
=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'`
4860 sourcebase_base
=`basename "$sourcebase"`
4861 func_note_Makefile_am_edit
"$sourcebase_dir" SUBDIRS
"$sourcebase_base"
4863 if test -n "$pobase"; then
4864 pobase_dir
=`echo "$pobase" | sed -n -e 's,/[^/]*$,/,p'`
4865 pobase_base
=`basename "$pobase"`
4866 func_note_Makefile_am_edit
"$pobase_dir" SUBDIRS
"$pobase_base"
4868 if test -n "$inctests"; then
4869 if test "$makefile_am" = Makefile.am
; then
4870 testsbase_dir
=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'`
4871 testsbase_base
=`basename "$testsbase"`
4872 func_note_Makefile_am_edit
"$testsbase_dir" SUBDIRS
"$testsbase_base"
4875 func_note_Makefile_am_edit
"" ACLOCAL_AMFLAGS
"-I ${m4base}"
4877 # Find the first parent directory of $m4base that contains or will contain
4879 sed_last
='s,^.*/\([^/][^/]*\)//*$,\1/,
4881 sed_butlast
='s,[^/][^/]*//*$,,'
4882 dir1
="${m4base}/"; dir2
=""
4883 while test -n "$dir1" \
4884 && ! { test -f "${destdir}/${dir1}Makefile.am" \
4885 ||
test "${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
4886 ||
test "./${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
4887 ||
{ test -n "$inctests" \
4888 && { test "${dir1}Makefile.am" = "$testsbase/$makefile_am" \
4889 ||
test "./${dir1}Makefile.am" = "$testsbase/$makefile_am"; }; }; }; do
4890 dir2
=`echo "$dir1" | sed -e "$sed_last"`"$dir2"
4891 dir1
=`echo "$dir1" | sed -e "$sed_butlast"`
4893 func_note_Makefile_am_edit
"$dir1" EXTRA_DIST
"${dir2}gnulib-cache.m4"
4896 # Create library makefile.
4897 func_dest_tmpfilename
$sourcebase/$makefile_am
4898 destfile
="$sourcebase/$makefile_am"
4899 modules
="$main_modules"
4900 func_emit_lib_Makefile_am
> "$tmpfile"
4901 if test -f "$destdir"/$sourcebase/$makefile_am; then
4902 if cmp "$destdir"/$sourcebase/$makefile_am "$tmpfile" > /dev
/null
; then
4906 echo "Updating $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
4907 mv -f "$destdir"/$sourcebase/$makefile_am "$destdir"/$sourcebase/$makefile_am~
4908 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
4910 echo "Update $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
4916 echo "Creating $sourcebase/$makefile_am"
4917 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
4919 echo "Create $sourcebase/$makefile_am"
4922 func_append added_files
"$sourcebase/$makefile_am$nl"
4925 # Create po/ directory.
4926 if test -n "$pobase"; then
4927 # Create po makefile and auxiliary files.
4928 for file in Makefile.
in.
in remove-potcdate.sin
; do
4929 func_dest_tmpfilename
$pobase/$file
4930 func_lookup_file build-aux
/po
/$file
4931 cat "$lookedup_file" > "$tmpfile"
4932 if test -f "$destdir"/$pobase/$file; then
4933 if cmp "$destdir"/$pobase/$file "$tmpfile" > /dev
/null
; then
4937 echo "Updating $pobase/$file (backup in $pobase/$file~)"
4938 mv -f "$destdir"/$pobase/$file "$destdir"/$pobase/$file~
4939 mv -f "$tmpfile" "$destdir"/$pobase/$file
4941 echo "Update $pobase/$file (backup in $pobase/$file~)"
4947 echo "Creating $pobase/$file"
4948 mv -f "$tmpfile" "$destdir"/$pobase/$file
4950 echo "Create $pobase/$file"
4953 func_append added_files
"$pobase/$file$nl"
4956 # Create po makefile parameterization, part 1.
4957 func_dest_tmpfilename
$pobase/Makevars
4958 func_emit_po_Makevars
> "$tmpfile"
4959 if test -f "$destdir"/$pobase/Makevars
; then
4960 if cmp "$destdir"/$pobase/Makevars
"$tmpfile" > /dev
/null
; then
4964 echo "Updating $pobase/Makevars (backup in $pobase/Makevars~)"
4965 mv -f "$destdir"/$pobase/Makevars
"$destdir"/$pobase/Makevars~
4966 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
4968 echo "Update $pobase/Makevars (backup in $pobase/Makevars~)"
4974 echo "Creating $pobase/Makevars"
4975 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
4977 echo "Create $pobase/Makevars"
4980 func_append added_files
"$pobase/Makevars$nl"
4982 # Create po makefile parameterization, part 2.
4983 func_dest_tmpfilename
$pobase/POTFILES.
in
4984 func_emit_po_POTFILES_in
> "$tmpfile"
4985 if test -f "$destdir"/$pobase/POTFILES.
in; then
4986 if cmp "$destdir"/$pobase/POTFILES.
in "$tmpfile" > /dev
/null
; then
4990 echo "Updating $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
4991 mv -f "$destdir"/$pobase/POTFILES.
in "$destdir"/$pobase/POTFILES.
in~
4992 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.
in
4994 echo "Update $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
5000 echo "Creating $pobase/POTFILES.in"
5001 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.
in
5003 echo "Create $pobase/POTFILES.in"
5006 func_append added_files
"$pobase/POTFILES.in$nl"
5009 TP_URL
="http://translationproject.org/latest/"
5010 TP_RSYNC_URI
="translationproject.org::tp/latest/"
5012 echo "Fetching gnulib PO files from $TP_URL"
5013 (cd "$destdir"/$pobase \
5014 && { # Prefer rsync over wget if it is available, since it consumes
5015 # less network bandwidth, due to compression.
5016 if type rsync
2>/dev
/null |
grep / > /dev
/null
; then
5017 rsync
-Lrtz "${TP_RSYNC_URI}gnulib/" .
5019 wget
--quiet -r -l1 -nd -np -A.po
"${TP_URL}gnulib"
5024 echo "Fetch gnulib PO files from $TP_URL"
5026 # Create po/LINGUAS.
5028 func_dest_tmpfilename
$pobase/LINGUAS
5029 (cd "$destdir"/$pobase \
5030 && { echo '# Set of available languages.'
5031 LC_ALL
=C
ls -1 *.po |
sed -e 's,\.po$,,'
5034 if test -f "$destdir"/$pobase/LINGUAS
; then
5035 if cmp "$destdir"/$pobase/LINGUAS
"$tmpfile" > /dev
/null
; then
5038 echo "Updating $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
5039 mv -f "$destdir"/$pobase/LINGUAS
"$destdir"/$pobase/LINGUAS~
5040 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
5043 echo "Creating $pobase/LINGUAS"
5044 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
5045 func_append added_files
"$pobase/LINGUAS$nl"
5048 if test -f "$destdir"/$pobase/LINGUAS
; then
5049 echo "Update $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
5051 echo "Create $pobase/LINGUAS"
5056 # Create m4/gnulib-cache.m4.
5057 func_dest_tmpfilename
$m4base/gnulib-cache.
m4
5059 func_emit_copyright_notice
5061 echo "# This file represents the specification of how gnulib-tool is used."
5062 echo "# It acts as a cache: It is written and read by gnulib-tool."
5063 echo "# In projects that use version control, this file is meant to be put under"
5064 echo "# version control, like the configure.ac and various Makefile.am files."
5067 echo "# Specification in the form of a command-line invocation:"
5070 echo "# Specification in the form of a few gnulib-tool.m4 macro invocations:"
5071 # Store the local_gnulib_dir relative to destdir.
5072 case "$local_gnulib_dir" in
5074 relative_local_gnulib_dir
="$local_gnulib_dir" ;;
5077 /*) relative_local_gnulib_dir
="$local_gnulib_dir" ;;
5079 # destdir, local_gnulib_dir are both relative.
5080 func_relativize
"$destdir" "$local_gnulib_dir"
5081 relative_local_gnulib_dir
="$reldir" ;;
5084 echo "gl_LOCAL_DIR([$relative_local_gnulib_dir])"
5086 echo "$specified_modules" |
sed -e 's/^/ /g'
5088 test -z "$incobsolete" ||
echo "gl_WITH_OBSOLETE"
5089 test -z "$inc_cxx_tests" ||
echo "gl_WITH_CXX_TESTS"
5090 test -z "$inc_longrunning_tests" ||
echo "gl_WITH_LONGRUNNING_TESTS"
5091 test -z "$inc_privileged_tests" ||
echo "gl_WITH_PRIVILEGED_TESTS"
5092 test -z "$inc_unportable_tests" ||
echo "gl_WITH_UNPORTABLE_TESTS"
5093 test -z "$inc_all_tests" ||
echo "gl_WITH_ALL_TESTS"
5094 echo "gl_AVOID([$avoidlist])"
5095 echo "gl_SOURCE_BASE([$sourcebase])"
5096 echo "gl_M4_BASE([$m4base])"
5097 echo "gl_PO_BASE([$pobase])"
5098 echo "gl_DOC_BASE([$docbase])"
5099 echo "gl_TESTS_BASE([$testsbase])"
5100 test -z "$inctests" ||
echo "gl_WITH_TESTS"
5101 echo "gl_LIB([$libname])"
5102 if test -n "$lgpl"; then
5103 if test "$lgpl" = yes; then
5106 echo "gl_LGPL([$lgpl])"
5109 echo "gl_MAKEFILE_NAME([$makefile_name])"
5110 if test "$cond_dependencies" = true
; then
5111 echo "gl_CONDITIONAL_DEPENDENCIES"
5113 if test "$libtool" = true
; then
5116 echo "gl_MACRO_PREFIX([$macro_prefix])"
5117 echo "gl_PO_DOMAIN([$po_domain])"
5118 echo "gl_WITNESS_C_DOMAIN([$witness_c_macro])"
5119 if test -n "$vc_files"; then
5120 echo "gl_VC_FILES([$vc_files])"
5123 if test -f "$destdir"/$m4base/gnulib-cache.
m4; then
5124 if cmp "$destdir"/$m4base/gnulib-cache.
m4 "$tmpfile" > /dev
/null
; then
5128 echo "Updating $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
5129 mv -f "$destdir"/$m4base/gnulib-cache.
m4 "$destdir"/$m4base/gnulib-cache.
m4~
5130 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.
m4
5132 echo "Update $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
5136 echo "# gnulib-cache.m4 ends here"
5143 echo "Creating $m4base/gnulib-cache.m4"
5144 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.
m4
5146 echo "Create $m4base/gnulib-cache.m4"
5152 # Create m4/gnulib-comp.m4.
5153 func_dest_tmpfilename
$m4base/gnulib-comp.
m4
5155 echo "# DO NOT EDIT! GENERATED AUTOMATICALLY!"
5156 func_emit_copyright_notice
5158 echo "# This file represents the compiled summary of the specification in"
5159 echo "# gnulib-cache.m4. It lists the computed macro invocations that need"
5160 echo "# to be invoked from configure.ac."
5161 echo "# In projects that use version control, this file can be treated like"
5162 echo "# other built files."
5165 echo "# This macro should be invoked from $configure_ac, in the section"
5166 echo "# \"Checks for programs\", right after AC_PROG_CC, and certainly before"
5167 echo "# any checks for libraries, header files, types and library functions."
5168 echo "AC_DEFUN([${macro_prefix}_EARLY],"
5170 echo " m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
5171 echo " m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
5172 echo " m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
5173 echo " m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
5174 echo " AC_REQUIRE([gl_PROG_AR_RANLIB])"
5175 if test -n "$uses_subdirs"; then
5176 echo " AC_REQUIRE([AM_PROG_CC_C_O])"
5178 for module
in $final_modules; do
5180 if test -n "$module"; then
5181 echo "# Code from module $module:"
5182 func_get_autoconf_early_snippet
"$module"
5185 |
sed -e '/^$/d;' -e 's/^/ /'
5188 echo "# This macro should be invoked from $configure_ac, in the section"
5189 echo "# \"Check for header files, types and library functions\"."
5190 echo "AC_DEFUN([${macro_prefix}_INIT],"
5192 if test "$libtool" = true
; then
5193 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
5194 echo " gl_cond_libtool=true"
5196 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
5197 echo " gl_cond_libtool=false"
5199 echo " gl_ltlibdeps="
5201 if test "$auxdir" != "build-aux"; then
5202 sed_replace_build_aux
='
5204 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
5205 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
5209 sed_replace_build_aux
="$sed_noop"
5211 echo " gl_m4_base='$m4base'"
5212 func_emit_initmacro_start
$macro_prefix
5213 echo " gl_source_base='$sourcebase'"
5214 if test -n "$witness_c_macro"; then
5215 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$witness_c_macro])"
5217 func_emit_autoconf_snippets
"$main_modules" func_verify_module true false true
5218 if test -n "$witness_c_macro"; then
5219 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
5221 echo " # End of code from modules"
5222 func_emit_initmacro_end
$macro_prefix
5223 echo " gltests_libdeps="
5224 echo " gltests_ltlibdeps="
5225 func_emit_initmacro_start
${macro_prefix}tests
5226 echo " gl_source_base='$testsbase'"
5227 # Define a tests witness macro that depends on the package.
5228 # PACKAGE is defined by AM_INIT_AUTOMAKE, PACKAGE_TARNAME is defined by AC_INIT.
5229 # See <http://lists.gnu.org/archive/html/automake/2009-05/msg00145.html>.
5230 echo "changequote(,)dnl"
5231 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"
5232 echo "changequote([, ])dnl"
5233 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
5234 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
5235 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
5236 func_emit_autoconf_snippets
"$testsrelated_modules" func_verify_module true true true
5237 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
5238 func_emit_initmacro_end
${macro_prefix}tests
5239 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
5240 # created using libtool, because libtool already handles the dependencies.
5241 if test "$libtool" != true
; then
5242 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
5243 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
5244 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
5245 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
5246 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
5248 if $use_libtests; then
5249 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
5250 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
5253 func_emit_initmacro_done
$macro_prefix $sourcebase
5254 func_emit_initmacro_done
${macro_prefix}tests
$testsbase
5256 echo "# This macro records the list of files which have been installed by"
5257 echo "# gnulib-tool and may be removed by future gnulib-tool invocations."
5258 echo "AC_DEFUN([${macro_prefix}_FILE_LIST], ["
5259 echo "$files" |
sed -e 's,^, ,'
5262 if test -f "$destdir"/$m4base/gnulib-comp.
m4; then
5263 if cmp "$destdir"/$m4base/gnulib-comp.
m4 "$tmpfile" > /dev
/null
; then
5267 echo "Updating $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
5268 mv -f "$destdir"/$m4base/gnulib-comp.
m4 "$destdir"/$m4base/gnulib-comp.
m4~
5269 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.
m4
5271 echo "Update $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
5275 echo "# gnulib-comp.m4 ends here"
5282 echo "Creating $m4base/gnulib-comp.m4"
5283 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.
m4
5285 echo "Create $m4base/gnulib-comp.m4"
5291 if test -n "$inctests"; then
5292 # Create tests makefile.
5293 func_dest_tmpfilename
$testsbase/$makefile_am
5294 destfile
="$testsbase/$makefile_am"
5295 modules
="$testsrelated_modules"
5296 func_emit_tests_Makefile_am
"${macro_prefix}tests_WITNESS" > "$tmpfile"
5297 if test -f "$destdir"/$testsbase/$makefile_am; then
5298 if cmp "$destdir"/$testsbase/$makefile_am "$tmpfile" > /dev
/null
; then
5302 echo "Updating $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
5303 mv -f "$destdir"/$testsbase/$makefile_am "$destdir"/$testsbase/$makefile_am~
5304 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
5306 echo "Update $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
5312 echo "Creating $testsbase/$makefile_am"
5313 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
5315 echo "Create $testsbase/$makefile_am"
5318 func_append added_files
"$testsbase/$makefile_am$nl"
5322 if test "$vc_files" != false
; then
5323 # Update the .cvsignore and .gitignore files.
5324 { echo "$added_files" |
sed -e '/^$/d' -e 's,\([^/]*\)$,|A|\1,'
5325 echo "$removed_files" |
sed -e '/^$/d' -e 's,\([^/]*\)$,|R|\1,'
5326 # Treat gnulib-comp.m4 like an added file, even if it already existed.
5327 echo "$m4base/|A|gnulib-comp.m4"
5328 } | LC_ALL
=C
sort -t'|' -k1,1 > "$tmp"/fileset-changes
5329 { # Rearrange file descriptors. Needed because "while ... done < ..."
5330 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5331 exec 5<&0 < "$tmp"/fileset-changes
5332 func_update_ignorelist
()
5335 if test "$ignore" = .gitignore
; then
5336 # In a .gitignore file, "foo" applies to the current directory and all
5337 # subdirectories, whereas "/foo" applies to the current directory only.
5340 doubly_escaped_anchor
='\\/'
5344 doubly_escaped_anchor
=''
5346 if test -f "$destdir/$dir$ignore"; then
5347 if test -n "$dir_added" ||
test -n "$dir_removed"; then
5348 sed -e "s|^$anchor||" < "$destdir/$dir$ignore" | LC_ALL
=C
sort > "$tmp"/ignore
5349 (echo "$dir_added" |
sed -e '/^$/d' | LC_ALL
=C
sort -u \
5350 | LC_ALL
=C
join -v 1 - "$tmp"/ignore
> "$tmp"/ignore-added
5351 echo "$dir_removed" |
sed -e '/^$/d' | LC_ALL
=C
sort -u \
5352 | LC_ALL
=C
join -v 1 - "$tmp"/ignore
> "$tmp"/ignore-removed
5354 if test -s "$tmp"/ignore-added ||
test -s "$tmp"/ignore-removed
; then
5356 echo "Updating $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
5357 mv -f "$destdir/$dir$ignore" "$destdir/$dir$ignore"~
5358 { sed -e 's,/,\\/,g' -e 's,^,/^,' -e 's,$,\$/d,' < "$tmp"/ignore-removed
5359 if test -n "$anchor"; then sed -e 's,/,\\/,g' -e "s,^,/^${doubly_escaped_anchor}," -e 's,$,$/d,' < "$tmp"/ignore-removed
; fi
5360 } > "$tmp"/sed-ignore-removed
5361 { cat "$destdir/$dir$ignore"~
5362 sed -e "s|^|$anchor|" < "$tmp"/ignore-added
5363 } |
sed -f "$tmp"/sed-ignore-removed \
5364 > "$destdir/$dir$ignore"
5366 echo "Update $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
5371 if test -n "$dir_added"; then
5373 echo "Creating $destdir/$dir$ignore"
5375 if test "$ignore" = .cvsignore
; then
5377 # Automake generates Makefile rules that create .dirstamp files.
5380 echo "$dir_added" |
sed -e '/^$/d' -e "s|^|$anchor|" | LC_ALL
=C
sort -u
5381 } > "$destdir/$dir$ignore"
5383 echo "Create $destdir/$dir$ignore"
5393 if test -d "$destdir/CVS" ||
test -d "$destdir/${dir}CVS" ||
test -f "$destdir/${dir}.cvsignore"; then
5394 func_update_ignorelist .cvsignore
5396 if test -d "$destdir/.git" ||
test -f "$destdir/${dir}.gitignore"; then
5397 func_update_ignorelist .gitignore
5404 # Why not ''read next_dir op file'' ? Because the dir column can be empty.
5405 next_dir
=`echo "$line" | sed -e 's,|.*,,'`
5406 op
=`echo "$line" | sed -e 's,^[^|]*|\([^|]*\)|.*$,\1,'`
5407 file=`echo "$line" | sed -e 's,^[^|]*|[^|]*|,,'`
5408 if test "$next_dir" != "$last_dir"; then
5409 func_done_dir
"$last_dir" "$last_dir_added" "$last_dir_removed"
5410 last_dir
="$next_dir"
5415 A
) func_append last_dir_added
"$file$nl";;
5416 R
) func_append last_dir_removed
"$file$nl";;
5419 func_done_dir
"$last_dir" "$last_dir_added" "$last_dir_removed"
5426 echo "You may need to add #include directives for the following .h files."
5427 # Intersect $specified_modules and $main_modules
5428 # (since $specified_modules is not necessarily of subset of $main_modules
5429 # - some may have been skipped through --avoid, and since the elements of
5430 # $main_modules but not in $specified_modules can go away without explicit
5431 # notice - through changes in the module dependencies).
5432 echo "$specified_modules" > "$tmp"/modules1
# a sorted list, one module per line
5433 echo "$main_modules" > "$tmp"/modules2
# also a sorted list, one module per line
5434 # First the #include <...> directives without #ifs, sorted for convenience,
5435 # then the #include "..." directives without #ifs, sorted for convenience,
5436 # then the #include directives that are surrounded by #ifs. Not sorted.
5437 for module
in `LC_ALL=C join "$tmp"/modules1 "$tmp"/modules2`; do
5438 include_directive
=`func_get_include_directive "$module"`
5439 case "$nl$include_directive" in
5441 echo "$include_directive" 1>&5
5444 echo "$include_directive" |
grep -v 'include "' 1>&6
5445 echo "$include_directive" |
grep 'include "' 1>&7
5448 done 5> "$tmp"/include-if
6> "$tmp"/include-angles
7> "$tmp"/include-quotes
5450 LC_ALL
=C
sort -u "$tmp"/include-angles
5451 LC_ALL
=C
sort -u "$tmp"/include-quotes
5452 cat "$tmp"/include-if
5453 ) |
sed -e '/^$/d' -e 's/^/ /'
5454 rm -f "$tmp"/include-angles
"$tmp"/include-quotes
"$tmp"/include-if
5456 for module
in $main_modules; do
5457 func_get_link_directive
"$module"
5459 | LC_ALL
=C
sort -u |
sed -e '/^$/d' -e 's/^/ /' > "$tmp"/link
5460 if test `wc -l < "$tmp"/link` != 0; then
5462 echo "You may need to use the following Makefile variables when linking."
5463 echo "Use them in <program>_LDADD when linking a program, or"
5464 echo "in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library."
5470 echo "Don't forget to"
5471 if test "$makefile_am" = Makefile.am
; then
5472 echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
5474 echo " - \"include $makefile_name\" from within \"$sourcebase/Makefile.am\","
5476 if test -n "$pobase"; then
5477 echo " - add \"$pobase/Makefile.in\" to AC_CONFIG_FILES in $configure_ac,"
5479 if test -n "$inctests"; then
5480 if test "$makefile_am" = Makefile.am
; then
5481 echo " - add \"$testsbase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
5483 echo " - \"include $makefile_name\" from within \"$testsbase/Makefile.am\","
5487 while test $edit != $makefile_am_edits; do
5488 edit
=`expr $edit + 1`
5489 eval dir
=\"\
$makefile_am_edit${edit}_dir
\"
5490 eval var
=\"\
$makefile_am_edit${edit}_var
\"
5491 eval val
=\"\
$makefile_am_edit${edit}_val
\"
5492 if test -n "$var"; then
5493 echo " - mention \"${val}\" in ${var} in ${dir}Makefile.am,"
5496 if grep '^ *AC_PROG_CC_STDC' "$configure_ac" > /dev
/null
; then
5497 position_early_after
=AC_PROG_CC_STDC
5499 if grep '^ *AC_PROG_CC_C99' "$configure_ac" > /dev
/null
; then
5500 position_early_after
=AC_PROG_CC_C99
5502 position_early_after
=AC_PROG_CC
5505 echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after $position_early_after,"
5506 echo " - invoke ${macro_prefix}_INIT in $configure_ac."
5509 # func_create_testdir testdir modules
5511 # - local_gnulib_dir from --local-dir
5512 # - modcache true or false, from --cache-modules/--no-cache-modules
5513 # - auxdir directory relative to destdir where to place build aux files
5514 # - inctests true if tests should be included, blank otherwise
5515 # - incobsolete true if obsolete modules among dependencies should be
5516 # included, blank otherwise
5517 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
5519 # - excl_longrunning_tests true if long-runnings tests should be excluded,
5521 # - excl_privileged_tests true if tests that require root privileges should be
5522 # excluded, blank otherwise
5523 # - excl_unportable_tests true if tests that fail on some platforms should be
5524 # excluded, blank otherwise
5525 # - single_configure true if a single configure file should be generated,
5526 # false for a separate configure file for the tests
5527 # - avoidlist list of modules to avoid
5528 # - cond_dependencies true if --conditional-dependencies was given, false if
5529 # --no-conditional-dependencies was given, blank otherwise
5530 # - libtool true if --libtool was given, false if --no-libtool was
5531 # given, blank otherwise
5532 # - symbolic true if files should be symlinked, copied otherwise
5533 # - lsymbolic true if files from local_gnulib_dir should be symlinked,
5535 func_create_testdir
()
5539 if test -z "$modules"; then
5540 # All modules together.
5541 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
5542 # Except ftruncate, mountlist, which abort the configuration on mingw. FIXME.
5543 # Except lib-ignore, which leads to link errors when Sun C++ is used. FIXME.
5544 modules
=`func_all_modules`
5545 modules
=`for m in $modules; do case $m in config-h | ftruncate | mountlist | lib-ignore) ;; *) echo $m;; esac; done`
5547 specified_modules
="$modules"
5549 # Canonicalize the list of specified modules.
5550 specified_modules
=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
5552 # Unlike in func_import, here we want to include all kinds of tests for the
5553 # directly specified modules, but not for dependencies.
5554 inc_all_direct_tests
=true
5555 inc_all_indirect_tests
="$inc_all_tests"
5557 # Check that the license of every module is consistent with the license of
5559 saved_inctests
="$inctests"
5560 # When computing transitive closures, don't consider $module to depend on
5561 # $module-tests. Need this becauses tests are implicitly GPL and may depend
5562 # on GPL modules - therefore we don't want a warning in this case.
5564 for requested_module
in $specified_modules; do
5565 requested_license
=`func_get_license "$requested_module"`
5566 if test "$requested_license" != GPL
; then
5567 # Here we use func_modules_transitive_closure, not just
5568 # func_get_dependencies, so that we also detect weird situations like
5569 # an LGPL module which depends on a GPLed build tool module which depends
5571 modules
="$requested_module"
5572 func_modules_transitive_closure
5573 for module
in $modules; do
5574 license
=`func_get_license "$module"`
5576 'GPLed build tool') ;;
5577 'public domain' |
'unlimited' |
'unmodifiable license text') ;;
5579 case "$requested_license" in
5582 GPLv2
+ | LGPLv2
+) ;;
5583 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
5589 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
5595 *) func_warning
"module $requested_module depends on a module with an incompatible license: $module" ;;
5604 inctests
="$saved_inctests"
5606 # Subdirectory names.
5617 # Determine final module list.
5618 modules
="$specified_modules"
5619 func_modules_transitive_closure
5620 if test $verbose -ge 0; then
5621 func_show_module_list
5623 final_modules
="$modules"
5625 if $single_configure; then
5626 # Determine main module list and tests-related module list separately.
5627 func_modules_transitive_closure_separately
5630 if $single_configure; then
5631 # Determine whether a $testsbase/libtests.a is needed.
5632 func_determine_use_libtests
5635 # Add the dummy module if needed.
5636 if $single_configure; then
5637 func_modules_add_dummy_separately
5639 func_modules_add_dummy
5642 # Show banner notice of every module.
5643 if $single_configure; then
5644 modules
="$main_modules"
5650 # Determine final file list.
5651 if $single_configure; then
5652 func_modules_to_filelist_separately
5654 func_modules_to_filelist
5655 if test $verbose -ge 0; then
5657 echo "$files" |
sed -e 's/^/ /'
5660 # Add files for which the copy in gnulib is newer than the one that
5661 # "automake --add-missing --copy" would provide.
5662 files
="$files build-aux/config.guess"
5663 files
="$files build-aux/config.sub"
5664 files
=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
5666 rewritten
='%REWRITTEN%'
5667 sed_rewrite_files
="\
5668 s,^build-aux/,$rewritten$auxdir/,
5669 s,^doc/,$rewritten$docbase/,
5670 s,^lib/,$rewritten$sourcebase/,
5671 s,^m4/,$rewritten$m4base/,
5672 s,^tests/,$rewritten$testsbase/,
5673 s,^tests=lib/,$rewritten$testsbase/,
5677 # Create directories.
5678 for f
in $files; do echo $f; done \
5679 |
sed -e "$sed_rewrite_files" \
5680 |
sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
5681 | LC_ALL
=C
sort -u \
5683 { # Rearrange file descriptors. Needed because "while ... done < ..."
5684 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5685 exec 5<&0 < "$tmp"/dirs
5687 mkdir
-p "$testdir/$d"
5692 # Copy files or make symbolic links.
5694 for f
in $files; do echo $f; done \
5695 |
sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_files" \
5698 { # Rearrange file descriptors. Needed because "while ... done < ..."
5699 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5700 exec 5<&0 < "$tmp"/files
5703 tests
=lib
/*) f
=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
5705 func_lookup_file
"$f"
5706 if test -n "$lookedup_tmp"; then
5707 cp -p "$lookedup_file" "$testdir/$g"
5709 ln "$lookedup_file" "$testdir/$g" 2>/dev
/null ||
5710 if { test -n "$symbolic" \
5711 ||
{ test -n "$lsymbolic" \
5712 && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; }; then
5713 func_ln
"$lookedup_file" "$testdir/$g"
5715 cp -p "$lookedup_file" "$testdir/$g"
5722 # Determine include_guard_prefix.
5723 func_compute_include_guard_prefix
5725 # Create Makefile.ams that are for testing.
5728 # No special edits are needed.
5731 # Create $sourcebase/Makefile.am.
5732 mkdir
-p "$testdir/$sourcebase"
5733 destfile
="$sourcebase/Makefile.am"
5734 if $single_configure; then
5735 modules
="$main_modules"
5737 func_emit_lib_Makefile_am
> "$testdir/$sourcebase/Makefile.am"
5738 any_uses_subdirs
="$uses_subdirs"
5740 # Create $m4base/Makefile.am.
5741 mkdir
-p "$testdir/$m4base"
5742 (echo "## Process this file with automake to produce Makefile.in."
5748 echo "EXTRA_DIST += "`echo "$f" | sed -e 's,^m4/,,'` ;;
5751 ) > "$testdir/$m4base/Makefile.am"
5753 subdirs
="$sourcebase $m4base"
5754 subdirs_with_configure_ac
=""
5756 if false
&& test -f "$testdir"/$m4base/gettext.
m4; then
5757 # Avoid stupid error message from automake:
5758 # "AM_GNU_GETTEXT used but `po' not in SUBDIRS"
5759 mkdir
-p "$testdir/po"
5760 (echo "## Process this file with automake to produce Makefile.in."
5761 ) > "$testdir/po/Makefile.am"
5762 func_append subdirs
" po"
5765 if test -n "$inctests"; then
5766 test -d "$testdir/$testsbase" || mkdir
"$testdir/$testsbase"
5767 if $single_configure; then
5768 # Create $testsbase/Makefile.am.
5769 destfile
="$testsbase/Makefile.am"
5770 modules
="$testsrelated_modules"
5771 func_emit_tests_Makefile_am
"${macro_prefix}tests_WITNESS" > "$testdir/$testsbase/Makefile.am"
5773 # Viewed from the $testsbase subdirectory, $auxdir is different.
5774 saved_auxdir
="$auxdir"
5775 auxdir
=`echo "$testsbase/" | sed -e 's%[^/][^/]*//*%../%g'`"$auxdir"
5776 # Create $testsbase/Makefile.am.
5778 destfile
="$testsbase/Makefile.am"
5779 func_emit_tests_Makefile_am
"" > "$testdir/$testsbase/Makefile.am"
5780 any_uses_subdirs
="$any_uses_subdirs$uses_subdirs"
5781 # Create $testsbase/configure.ac.
5782 (echo "# Process this file with autoconf to produce a configure script."
5783 echo "AC_INIT([dummy], [0])"
5784 echo "AC_CONFIG_AUX_DIR([$auxdir])"
5785 echo "AM_INIT_AUTOMAKE"
5787 echo "AC_CONFIG_HEADERS([config.h])"
5790 echo "AC_PROG_INSTALL"
5791 echo "AC_PROG_MAKE_SET"
5792 echo "gl_PROG_AR_RANLIB"
5794 if test -n "$uses_subdirs"; then
5795 echo "AM_PROG_CC_C_O"
5798 for module
in $modules; do
5800 if test -n "$module"; then
5802 gnumakefile | maintainer-makefile
)
5803 # These modules are meant to be used only in the top-level directory.
5806 func_get_autoconf_early_snippet
"$module"
5811 |
sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
5812 if test "$libtool" = true
; then
5813 echo "LT_INIT([win32-dll])"
5814 echo "LT_LANG([C++])"
5815 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
5816 echo "gl_cond_libtool=true"
5818 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
5819 echo "gl_cond_libtool=false"
5821 echo "gl_ltlibdeps="
5823 # Wrap the set of autoconf snippets into an autoconf macro that is then
5824 # invoked. This is needed because autoconf does not support AC_REQUIRE
5826 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
5827 # but we want the AC_REQUIRE to have its normal meaning (provide one
5828 # expansion of the required macro before the current point, and only one
5830 echo "AC_DEFUN([gl_INIT], ["
5831 sed_replace_build_aux
='
5833 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
5834 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
5837 echo "gl_m4_base='../$m4base'"
5838 func_emit_initmacro_start
$macro_prefix
5839 # We don't have explicit ordering constraints between the various
5840 # autoconf snippets. It's cleanest to put those of the library before
5841 # those of the tests.
5842 echo "gl_source_base='../$sourcebase'"
5843 func_emit_autoconf_snippets
"$modules" func_verify_nontests_module false false false
5844 echo "gl_source_base='.'"
5845 func_emit_autoconf_snippets
"$modules" func_verify_tests_module false false false
5846 func_emit_initmacro_end
$macro_prefix
5847 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
5848 # created using libtool, because libtool already handles the dependencies.
5849 if test "$libtool" != true
; then
5850 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
5851 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
5852 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
5853 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
5854 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
5857 func_emit_initmacro_done
$macro_prefix $sourcebase # FIXME use $sourcebase or $testsbase?
5861 # Usually $testsbase/config.h will be a superset of config.h. Verify this
5862 # by "merging" config.h into $testsbase/config.h; look out for gcc warnings.
5863 echo "AH_TOP([#include \"../config.h\"])"
5865 echo "AC_CONFIG_FILES([Makefile])"
5867 ) > "$testdir/$testsbase/configure.ac"
5868 auxdir
="$saved_auxdir"
5869 subdirs_with_configure_ac
="$subdirs_with_configure_ac $testsbase"
5871 func_append subdirs
" $testsbase"
5874 # Create Makefile.am.
5875 (echo "## Process this file with automake to produce Makefile.in."
5877 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
5879 echo "SUBDIRS = $subdirs"
5881 echo "ACLOCAL_AMFLAGS = -I $m4base"
5882 ) > "$testdir/Makefile.am"
5884 # Create configure.ac.
5885 (echo "# Process this file with autoconf to produce a configure script."
5886 echo "AC_INIT([dummy], [0])"
5887 if test "$auxdir" != "."; then
5888 echo "AC_CONFIG_AUX_DIR([$auxdir])"
5890 echo "AM_INIT_AUTOMAKE"
5892 echo "AC_CONFIG_HEADERS([config.h])"
5895 echo "AC_PROG_INSTALL"
5896 echo "AC_PROG_MAKE_SET"
5898 echo "# For autobuild."
5899 echo "AC_CANONICAL_BUILD"
5900 echo "AC_CANONICAL_HOST"
5902 echo "m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
5903 echo "m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
5904 echo "m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
5905 echo "m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
5907 echo "gl_PROG_AR_RANLIB"
5909 if test -n "$any_uses_subdirs"; then
5910 echo "AM_PROG_CC_C_O"
5913 for module
in $final_modules; do
5914 if $single_configure; then
5917 func_verify_nontests_module
5919 if test -n "$module"; then
5920 func_get_autoconf_early_snippet
"$module"
5923 |
sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
5924 if test "$libtool" = true
; then
5925 echo "LT_INIT([win32-dll])"
5926 echo "LT_LANG([C++])"
5927 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
5928 echo "gl_cond_libtool=true"
5930 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
5931 echo "gl_cond_libtool=false"
5933 echo "gl_ltlibdeps="
5935 # Wrap the set of autoconf snippets into an autoconf macro that is then
5936 # invoked. This is needed because autoconf does not support AC_REQUIRE
5938 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
5939 # but we want the AC_REQUIRE to have its normal meaning (provide one
5940 # expansion of the required macro before the current point, and only one
5942 echo "AC_DEFUN([gl_INIT], ["
5943 if test "$auxdir" != "build-aux"; then
5944 sed_replace_build_aux
='
5946 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
5947 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
5951 sed_replace_build_aux
="$sed_noop"
5953 echo "gl_m4_base='$m4base'"
5954 func_emit_initmacro_start
$macro_prefix
5955 echo "gl_source_base='$sourcebase'"
5956 if $single_configure; then
5957 func_emit_autoconf_snippets
"$main_modules" func_verify_module true false false
5959 func_emit_autoconf_snippets
"$modules" func_verify_nontests_module true false false
5961 func_emit_initmacro_end
$macro_prefix
5962 if $single_configure; then
5963 echo " gltests_libdeps="
5964 echo " gltests_ltlibdeps="
5965 func_emit_initmacro_start
${macro_prefix}tests
5966 echo " gl_source_base='$testsbase'"
5967 # Define a tests witness macro.
5968 echo " ${macro_prefix}tests_WITNESS=IN_GNULIB_TESTS"
5969 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
5970 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
5971 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
5972 func_emit_autoconf_snippets
"$testsrelated_modules" func_verify_module true false false
5973 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
5974 func_emit_initmacro_end
${macro_prefix}tests
5976 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
5977 # created using libtool, because libtool already handles the dependencies.
5978 if test "$libtool" != true
; then
5979 libname_upper
=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
5980 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
5981 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
5982 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
5983 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
5985 if $single_configure; then
5986 if $use_libtests; then
5987 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
5988 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
5992 func_emit_initmacro_done
$macro_prefix $sourcebase
5993 if $single_configure; then
5994 func_emit_initmacro_done
${macro_prefix}tests
$testsbase
5999 if test -n "$subdirs_with_configure_ac"; then
6000 echo "AC_CONFIG_SUBDIRS(["`echo $subdirs_with_configure_ac`"])"
6002 makefiles
="Makefile"
6003 for d
in $subdirs; do
6004 # For subdirs that have a configure.ac by their own, it's the subdir's
6005 # configure.ac which creates the subdir's Makefile.am, not this one.
6006 case " $subdirs_with_configure_ac " in
6008 *) func_append makefiles
" $d/Makefile" ;;
6011 echo "AC_CONFIG_FILES([$makefiles])"
6013 ) > "$testdir/configure.ac"
6015 # Create autogenerated files.
6017 # Do not use "${AUTORECONF} --force --install", because it may invoke
6018 # autopoint, which brings in older versions of some of our .m4 files.
6019 if test -f $m4base/gettext.
m4; then
6020 func_execute_command
${AUTOPOINT} --force || func_exit
1
6021 for f
in $m4base/*.
m4~
; do
6023 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit
1
6027 if test "$libtool" = true
; then
6028 func_execute_command
${LIBTOOLIZE} --copy || func_exit
1
6030 func_execute_command
${ACLOCAL} -I $m4base || func_exit
1
6031 if ! test -d build-aux
; then
6032 func_execute_command mkdir build-aux || func_exit
1
6034 func_execute_command
${AUTOCONF} || func_exit
1
6035 func_execute_command
${AUTOHEADER} || func_exit
1
6036 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6038 if test -n "$inctests" && ! $single_configure; then
6039 # Create autogenerated files.
6040 (cd "$testdir/$testsbase" || func_exit
1
6041 # Do not use "${AUTORECONF} --force --install", because it may invoke
6042 # autopoint, which brings in older versions of some of our .m4 files.
6043 if test -f ..
/$m4base/gettext.
m4; then
6044 func_execute_command
${AUTOPOINT} --force || func_exit
1
6045 for f
in ..
/$m4base/*.
m4~
; do
6047 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit
1
6051 func_execute_command
${ACLOCAL} -I ..
/$m4base || func_exit
1
6052 if ! test -d ..
/build-aux
; then
6053 func_execute_command mkdir ..
/build-aux
6055 func_execute_command
${AUTOCONF} || func_exit
1
6056 func_execute_command
${AUTOHEADER} || func_exit
1
6057 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6060 # Need to run configure and make once, to create built files that are to be
6061 # distributed (such as parse-datetime.c).
6062 sed_remove_make_variables
='s,[$]([A-Za-z0-9_]*),,g'
6063 # Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...".
6064 cleaned_files
=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \
6065 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
6066 cleaned_files
=`for file in $cleaned_files; do echo " $file "; done`
6067 # Extract the value of "BUILT_SOURCES += ...". Remove variable references
6068 # such $(FOO_H) because they don't refer to distributed files.
6069 built_sources
=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \
6070 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
6071 | sed -e "$sed_remove_make_variables"`
6072 distributed_built_sources
=`for file in $built_sources; do
6073 case "$cleaned_files" in
6078 tests_distributed_built_sources
=
6079 if test -n "$inctests"; then
6080 # Likewise for built files in the $testsbase directory.
6081 tests_cleaned_files
=`sed -e "$sed_remove_backslash_newline" < "$testdir/$testsbase/Makefile.am" \
6082 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
6083 tests_cleaned_files
=`for file in $tests_cleaned_files; do echo " $file "; done`
6084 tests_built_sources
=`sed -e "$sed_remove_backslash_newline" < "$testdir/$testsbase/Makefile.am" \
6085 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
6086 | sed -e "$sed_remove_make_variables"`
6087 tests_distributed_built_sources
=`for file in $tests_built_sources; do
6088 case "$tests_cleaned_files" in
6094 if test -n "$distributed_built_sources" ||
test -n "$tests_distributed_built_sources"; then
6096 .
/configure || func_exit
1
6097 if test -n "$distributed_built_sources"; then
6099 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
6100 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6105 if test -n "$tests_distributed_built_sources"; then
6107 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
6108 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6113 $MAKE AUTOCONF
="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
6120 # func_create_megatestdir megatestdir allmodules
6122 # - local_gnulib_dir from --local-dir
6123 # - modcache true or false, from --cache-modules/--no-cache-modules
6124 # - auxdir directory relative to destdir where to place build aux files
6125 func_create_megatestdir
()
6129 if test -z "$allmodules"; then
6130 allmodules
=`func_all_modules`
6134 # First, all modules one by one.
6135 for onemodule
in $allmodules; do
6136 func_create_testdir
"$megatestdir/$onemodule" $onemodule
6137 func_append megasubdirs
"$onemodule "
6139 # Then, all modules all together.
6140 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
6141 allmodules
=`for m in $allmodules; do if test $m != config-h; then echo $m; fi; done`
6142 func_create_testdir
"$megatestdir/ALL" "$allmodules"
6143 func_append megasubdirs
"ALL"
6146 cvsdate
=`if test -f "$gnulib_dir/CVS/Entries"; then \
6147 vc_witness="$gnulib_dir/CVS/Entries"; \
6149 vc_witness="$gnulib_dir/.git/refs/heads/master"; \
6151 sh "$gnulib_dir/build-aux/mdate-sh" "$vc_witness" \
6152 | sed -e 's,January,01,' -e 's,Jan,01,' \
6153 -e 's,February,02,' -e 's,Feb,02,' \
6154 -e 's,March,03,' -e 's,Mar,03,' \
6155 -e 's,April,04,' -e 's,Apr,04,' \
6157 -e 's,June,06,' -e 's,Jun,06,' \
6158 -e 's,July,07,' -e 's,Jul,07,' \
6159 -e 's,August,08,' -e 's,Aug,08,' \
6160 -e 's,September,09,' -e 's,Sep,09,' \
6161 -e 's,October,10,' -e 's,Oct,10,' \
6162 -e 's,November,11,' -e 's,Nov,11,' \
6163 -e 's,December,12,' -e 's,Dec,12,' \
6164 -e 's,^,00,' -e 's,^[0-9]*\([0-9][0-9] \),\1,' \
6165 -e 's,^\([0-9]*\) \([0-9]*\) \([0-9]*\),\3\2\1,'`
6167 echo "CVSDATE=$cvsdate"
6168 echo ": \${MAKE=make}"
6169 echo "test -d logs || mkdir logs"
6170 echo "for module in $megasubdirs; do"
6171 echo " echo \"Working on module \$module...\""
6172 echo " safemodule=\`echo \$module | sed -e 's|/|-|g'\`"
6173 echo " (echo \"To: gnulib@autobuild.josefsson.org\""
6176 echo " : autobuild project... \$module"
6177 echo " : autobuild revision... cvs-\$CVSDATE-000000"
6178 echo " : autobuild timestamp... \`date \"+%Y%m%d-%H%M%S\"\`"
6179 echo " : autobuild hostname... \`hostname\`"
6180 echo " cd \$module && ./configure \$CONFIGURE_OPTIONS && \$MAKE && \$MAKE check && \$MAKE distclean"
6182 echo " ) 2>&1 | { if test -n \"\$AUTOBUILD_SUBST\"; then sed -e \"\$AUTOBUILD_SUBST\"; else cat; fi; } > logs/\$safemodule"
6184 ) > "$megatestdir/do-autobuild"
6185 chmod a
+x
"$megatestdir/do-autobuild"
6187 # Create Makefile.am.
6188 (echo "## Process this file with automake to produce Makefile.in."
6190 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
6192 echo "SUBDIRS = $megasubdirs"
6194 echo "EXTRA_DIST = do-autobuild"
6195 ) > "$megatestdir/Makefile.am"
6197 # Create configure.ac.
6198 (echo "# Process this file with autoconf to produce a configure script."
6199 echo "AC_INIT([dummy], [0])"
6200 if test "$auxdir" != "."; then
6201 echo "AC_CONFIG_AUX_DIR([$auxdir])"
6203 echo "AM_INIT_AUTOMAKE"
6205 echo "AC_PROG_MAKE_SET"
6207 echo "AC_CONFIG_SUBDIRS([$megasubdirs])"
6208 echo "AC_CONFIG_FILES([Makefile])"
6210 ) > "$megatestdir/configure.ac"
6212 # Create autogenerated files.
6214 # Do not use "${AUTORECONF} --install", because autoreconf operates
6215 # recursively, but the subdirectories are already finished, therefore
6216 # calling autoreconf here would only waste lots of CPU time.
6217 func_execute_command
${ACLOCAL} || func_exit
1
6218 func_execute_command mkdir build-aux
6219 func_execute_command
${AUTOCONF} || func_exit
1
6220 func_execute_command
${AUTOMAKE} --add-missing --copy || func_exit
1
6226 func_fatal_error
"no mode specified" ;;
6233 # sed expression that converts a literal to a basic regular expression.
6234 # Needs to handle . [ \ * ^ $.
6235 sed_literal_to_basic_regex
='s/\\/\\\\/g
6241 if test -f "$gnulib_dir/$filename" \
6242 ||
{ test -n "$local_gnulib_dir" && test -f "$local_gnulib_dir/$filename"; }; then
6243 filename_anywhere_regex
=`echo "$filename" | sed -e "$sed_literal_to_basic_regex"`
6244 filename_line_regex
='^'"$filename_anywhere_regex"'$'
6247 (cd "$gnulib_dir" && find modules -type f -print | xargs -n 100 grep -l "$filename_line_regex" /dev/null | sed -e 's,^modules/,,')
6248 if test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules"; then
6249 (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$,,')
6252 | func_sanitize_modulelist \
6255 for module
in $module_candidates; do
6256 if func_get_filelist
$module |
grep "$filename_line_regex" > /dev
/null
; then
6261 func_warning
"file $filename does not exist"
6266 import | add-import | remove-import | update
)
6269 if test -z "$destdir"; then
6272 test -d "$destdir" \
6273 || func_fatal_error
"destination directory does not exist: $destdir"
6275 # Prefer configure.ac to configure.in.
6276 if test -f "$destdir"/configure.ac
; then
6277 configure_ac
="$destdir/configure.ac"
6279 if test -f "$destdir"/configure.
in; then
6280 configure_ac
="$destdir/configure.in"
6282 func_fatal_error
"cannot find $destdir/configure.ac - make sure you run gnulib-tool from within your package's directory"
6286 # Analyze configure.ac.
6288 guessed_libtool
=false
6293 /AC_CONFIG_AUX_DIR/ {
6294 s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^]"$`\\)]*\).*$,guessed_auxdir="\1",p
6296 /A[CM]_PROG_LIBTOOL/ {
6297 s,^.*$,guessed_libtool=true,p
6299 eval `sed -n -e "$my_sed_traces" < "$configure_ac"`
6301 if test -z "$auxdir"; then
6302 auxdir
="$guessed_auxdir"
6305 # Determine where to apply func_import.
6306 if test "$mode" = import
; then
6307 # Apply func_import to a particular gnulib directory.
6308 # The command line contains the complete specification; don't look at
6309 # the contents of gnulib-cache.m4.
6310 test -n "$supplied_libname" || supplied_libname
=true
6311 test -n "$sourcebase" || sourcebase
="lib"
6312 test -n "$m4base" || m4base
="m4"
6313 test -n "$docbase" || docbase
="doc"
6314 test -n "$testsbase" || testsbase
="tests"
6315 test -n "$macro_prefix" || macro_prefix
="gl"
6318 if test -n "$m4base"; then
6319 # Apply func_import to a particular gnulib directory.
6320 # Any number of additional modules can be given.
6321 if test ! -f "$destdir/$m4base"/gnulib-cache.
m4; then
6322 # First use of gnulib in the given m4base.
6323 test -n "$supplied_libname" || supplied_libname
=true
6324 test -n "$sourcebase" || sourcebase
="lib"
6325 test -n "$docbase" || docbase
="doc"
6326 test -n "$testsbase" || testsbase
="tests"
6327 test -n "$macro_prefix" || macro_prefix
="gl"
6331 # Apply func_import to all gnulib directories.
6332 # To get this list of directories, look at Makefile.am. (Not at
6333 # configure, because it may be omitted from version control. Also,
6334 # don't run "find $destdir -name gnulib-cache.m4", as it might be
6338 if test -f "$destdir"/Makefile.am
; then
6339 aclocal_amflags
=`sed -n -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/p' "$destdir"/Makefile.am`
6341 for arg
in $aclocal_amflags; do
6342 if test -n "$m4dir_is_next"; then
6343 # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
6347 if test -f "$destdir/$arg"/gnulib-cache.
m4; then
6348 func_append m4dirs
" $arg"
6349 m4dirs_count
=`expr $m4dirs_count + 1`
6355 if test "X$arg" = "X-I"; then
6363 # No Makefile.am! Oh well. Look at the last generated aclocal.m4.
6364 if test -f "$destdir"/aclocal.
m4; then
6365 sedexpr1
='s,^m4_include(\[\(.*\)])$,\1,p'
6366 sedexpr2
='s,^[^/]*$,.,'
6367 sedexpr3
='s,/[^/]*$,,'
6368 m4dirs
=`sed -n -e "$sedexpr1" aclocal.m4 | sed -e "$sedexpr2" -e "$sedexpr3" | LC_ALL=C sort -u`
6369 m4dirs
=`for arg in $m4dirs; do if test -f "$destdir/$arg"/gnulib-cache.m4; then echo $arg; fi; done`
6370 m4dirs_count
=`for arg in $m4dirs; do echo "$arg"; done | wc -l`
6373 if test $m4dirs_count = 0; then
6374 # First use of gnulib in a package.
6375 # Any number of additional modules can be given.
6376 test -n "$supplied_libname" || supplied_libname
=true
6377 test -n "$sourcebase" || sourcebase
="lib"
6379 test -n "$docbase" || docbase
="doc"
6380 test -n "$testsbase" || testsbase
="tests"
6381 test -n "$macro_prefix" || macro_prefix
="gl"
6384 if test $m4dirs_count = 1; then
6385 # There's only one use of gnulib here. Assume the user means it.
6386 # Any number of additional modules can be given.
6387 for m4base
in $m4dirs; do
6391 # Ambiguous - guess what the user meant.
6392 if test $# = 0; then
6393 # No further arguments. Guess the user wants to update all of them.
6394 for m4base
in $m4dirs; do
6395 # Perform func_import in a subshell, so that variable values
6397 # local_gnulib_dir, incobsolete, inc_cxx_tests,
6398 # inc_longrunning_tests, inc_privileged_tests,
6399 # inc_unportable_tests, inc_all_tests, avoidlist, sourcebase,
6400 # m4base, pobase, docbase, testsbase, inctests, libname, lgpl,
6401 # makefile_name, libtool, macro_prefix, po_domain,
6402 # witness_c_macro, vc_files
6403 # don't propagate from one directory to another.
6404 (func_import
) || func_exit
1
6408 func_fatal_error
"Ambiguity: to which directory should the modules be added? Please specify at least --m4-base=..."
6417 if test -z "$destdir"; then
6418 func_fatal_error
"please specify --dir option"
6421 test -d "$destdir" \
6422 || func_fatal_error
"could not create destination directory"
6423 test -n "$auxdir" || auxdir
="build-aux"
6424 func_create_testdir
"$destdir" "$*"
6427 create-megatestdir
)
6428 if test -z "$destdir"; then
6429 func_fatal_error
"please specify --dir option"
6431 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
6432 test -n "$auxdir" || auxdir
="build-aux"
6433 func_create_megatestdir
"$destdir" "$*"
6437 test -n "$destdir" || destdir
=testdir$$
6438 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
6439 test -n "$auxdir" || auxdir
="build-aux"
6440 func_create_testdir
"$destdir" "$*"
6444 ..
/configure || func_exit
1
6445 $MAKE || func_exit
1
6446 $MAKE check || func_exit
1
6447 $MAKE distclean || func_exit
1
6448 remaining
=`find . -type f -print`
6449 if test -n "$remaining"; then
6450 echo "Remaining files:" $remaining 1>&2
6451 echo "gnulib-tool: *** Stop." 1>&2
6460 test -n "$destdir" || destdir
=testdir$$
6461 mkdir
"$destdir" || func_fatal_error
"could not create destination directory"
6462 test -n "$auxdir" || auxdir
="build-aux"
6463 func_create_megatestdir
"$destdir" "$*"
6471 remaining
=`find . -type f -print`
6472 if test -n "$remaining"; then
6473 echo "Remaining files:" $remaining 1>&2
6474 echo "gnulib-tool: *** Stop." 1>&2
6482 extract-description
)
6486 if test -n "$module"; then
6487 func_get_description
"$module"
6496 if test -n "$module"; then
6497 func_get_comment
"$module"
6506 if test -n "$module"; then
6507 func_get_status
"$module"
6516 if test -n "$module"; then
6517 func_get_notice
"$module"
6522 extract-applicability
)
6526 if test -n "$module"; then
6527 func_get_applicability
"$module"
6536 if test -n "$module"; then
6537 func_get_filelist
"$module"
6542 extract-dependencies
)
6543 if test -n "$avoidlist"; then
6544 func_fatal_error
"cannot combine --avoid and --extract-dependencies"
6549 if test -n "$module"; then
6550 func_get_dependencies
"$module"
6555 extract-autoconf-snippet
)
6559 if test -n "$module"; then
6560 func_get_autoconf_snippet
"$module"
6565 extract-automake-snippet
)
6569 if test -n "$module"; then
6570 func_get_automake_snippet
"$module"
6575 extract-include-directive
)
6579 if test -n "$module"; then
6580 func_get_include_directive
"$module"
6585 extract-link-directive
)
6589 if test -n "$module"; then
6590 func_get_link_directive
"$module"
6599 if test -n "$module"; then
6600 func_get_license
"$module"
6605 extract-maintainer
)
6609 if test -n "$module"; then
6610 func_get_maintainer
"$module"
6615 extract-tests-module
)
6619 if test -n "$module"; then
6620 func_get_tests_module
"$module"
6626 # Verify the number of arguments.
6627 if test $# -lt 1 ||
test $# -gt 2; then
6628 func_fatal_error
"invalid number of arguments for --$mode"
6631 # The first argument is the file to be copied.
6633 # Verify the file exists.
6634 func_lookup_file
"$f"
6636 # The second argument is the destination; either a directory ot a file.
6637 # It defaults to the current directory.
6639 test -n "$dest" || dest
='.'
6640 test -n "$sourcebase" || sourcebase
="lib"
6641 test -n "$m4base" || m4base
="m4"
6642 test -n "$docbase" || docbase
="doc"
6643 test -n "$testsbase" || testsbase
="tests"
6644 test -n "$auxdir" || auxdir
="build-aux"
6645 rewritten
='%REWRITTEN%'
6646 sed_rewrite_files
="\
6647 s,^build-aux/,$rewritten$auxdir/,
6648 s,^doc/,$rewritten$docbase/,
6649 s,^lib/,$rewritten$sourcebase/,
6650 s,^m4/,$rewritten$m4base/,
6651 s,^tests/,$rewritten$testsbase/,
6654 if test -d "$dest"; then
6656 g
=`echo "$f" | sed -e "$sed_rewrite_files"`
6658 destdir
=`dirname "$dest"`
6659 g
=`basename "$dest"`
6662 # Create the directory for destfile.
6663 d
=`dirname "$destdir/$g"`
6665 if test -n "$d" && test ! -d "$d"; then
6666 mkdir
-p "$d" || func_fatal_error
"failed"
6670 func_dest_tmpfilename
"$g"
6671 cp "$lookedup_file" "$tmpfile" || func_fatal_error
"failed"
6672 already_present
=true
6673 if test -f "$destdir/$g"; then
6674 # The file already exists.
6678 # Don't protest if the file should be there but isn't: it happens
6679 # frequently that developers don't put autogenerated files under version
6687 func_fatal_error
"unknown operation mode --$mode" ;;
6691 # Undo the effect of the previous 'trap' command. Some shellology:
6692 # We cannot use "trap - 0 1 2 3 13 15", because Solaris sh would attempt to
6693 # execute the command "-". "trap '' ..." is fine only for signal 0 (= normal
6694 # exit); for the others we need to call 'exit' explicitly. The value of $? is
6695 # 128 + signal number and is set before the trap-registered command is run.
6697 trap 'func_exit $?' 1 2 3 13 15
6702 # indent-tabs-mode: nil
6703 # whitespace-check-buffer-indent: nil