annotate gnulib-tool @ 8890:576d3e4f31c2

Remember the presence of the --with-tests command-line option through "gnulib-tool --update".
author Bruno Haible <bruno@clisp.org>
date Mon, 28 May 2007 15:46:54 +0000
parents c00e30e9aba4
children bd8b65e64196
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 #! /bin/sh
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2 #
7771
c9ae009bb4e7 Indicate the presence of gnulib modules through C macros.
Bruno Haible <bruno@clisp.org>
parents: 7767
diff changeset
3 # Copyright (C) 2002-2007 Free Software Foundation, Inc.
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 #
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 # This program is free software; you can redistribute it and/or modify
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 # it under the terms of the GNU General Public License as published by
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 # the Free Software Foundation; either version 2, or (at your option)
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 # any later version.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 #
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 # This program is distributed in the hope that it will be useful,
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 # GNU General Public License for more details.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 #
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 # You should have received a copy of the GNU General Public License
6549
2f04f595e14e Ensure automatic ordering between gl_LOCK and gl_ARGP.
Bruno Haible <bruno@clisp.org>
parents: 6548
diff changeset
16 # along with this program; if not, write to the Free Software Foundation,
2f04f595e14e Ensure automatic ordering between gl_LOCK and gl_ARGP.
Bruno Haible <bruno@clisp.org>
parents: 6548
diff changeset
17 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 #
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 # This program is meant for authors or maintainers which want to import
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 # modules from gnulib into their packages.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 progname=$0
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 package=gnulib
8890
576d3e4f31c2 Remember the presence of the --with-tests command-line option through
Bruno Haible <bruno@clisp.org>
parents: 8672
diff changeset
25 cvsdatestamp='$Date: 2007-05-28 15:46:55 $'
4124
5b5f22d7530e (last_checkin_date): don't expand the $Date here.
Karl Berry <karl@freefriends.org>
parents: 4112
diff changeset
26 last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'`
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'`
7322
46d98b687a87 Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 7321
diff changeset
28 nl='
46d98b687a87 Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 7321
diff changeset
29 '
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 # You can set AUTOCONFPATH to empty if autoconf 2.57 is already in your PATH.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 AUTOCONFPATH=
5250
46a747db97f2 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 5237
diff changeset
33 #case $USER in
46a747db97f2 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 5237
diff changeset
34 # bruno )
46a747db97f2 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 5237
diff changeset
35 # AUTOCONFBINDIR=/packages/gnu-inst-autoconf/2.57/bin
46a747db97f2 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 5237
diff changeset
36 # AUTOCONFPATH="eval env PATH=${AUTOCONFBINDIR}:\$PATH "
46a747db97f2 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 5237
diff changeset
37 # ;;
46a747db97f2 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 5237
diff changeset
38 #esac
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39
6547
1a65fb7ddbbb Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 6546
diff changeset
40 # You can set AUTOMAKEPATH to empty if automake 1.9.x is already in your PATH.
1a65fb7ddbbb Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 6546
diff changeset
41 AUTOMAKEPATH=
1a65fb7ddbbb Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 6546
diff changeset
42
7485
0194db3ad154 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7484
diff changeset
43 # You can set GETTEXTPATH to empty if autopoint 0.15 is already in your PATH.
0194db3ad154 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7484
diff changeset
44 GETTEXTPATH=
0194db3ad154 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7484
diff changeset
45
6551
d37637700b4e Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 6550
diff changeset
46 # If you didn't set AUTOCONFPATH and AUTOMAKEPATH, you can also set the
7485
0194db3ad154 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7484
diff changeset
47 # variables AUTOCONF, AUTOHEADER, ACLOCAL, AUTOMAKE, AUTORECONF individually.
6551
d37637700b4e Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 6550
diff changeset
48 if test -z "${AUTOCONF}" || test -n "${AUTOCONFPATH}"; then
d37637700b4e Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 6550
diff changeset
49 AUTOCONF="${AUTOCONFPATH}autoconf"
d37637700b4e Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 6550
diff changeset
50 fi
7485
0194db3ad154 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7484
diff changeset
51 if test -z "${AUTOHEADER}" || test -n "${AUTOCONFPATH}"; then
0194db3ad154 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7484
diff changeset
52 AUTOHEADER="${AUTOCONFPATH}autoheader"
0194db3ad154 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7484
diff changeset
53 fi
6551
d37637700b4e Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 6550
diff changeset
54 if test -z "${ACLOCAL}" || test -n "${AUTOMAKEPATH}"; then
d37637700b4e Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 6550
diff changeset
55 ACLOCAL="${AUTOMAKEPATH}aclocal"
d37637700b4e Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 6550
diff changeset
56 fi
d37637700b4e Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 6550
diff changeset
57 if test -z "${AUTOMAKE}" || test -n "${AUTOMAKEPATH}"; then
d37637700b4e Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 6550
diff changeset
58 AUTOMAKE="${AUTOMAKEPATH}automake"
d37637700b4e Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 6550
diff changeset
59 fi
d37637700b4e Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 6550
diff changeset
60 if test -z "${AUTORECONF}" || test -n "${AUTOCONFPATH}"; then
d37637700b4e Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 6550
diff changeset
61 AUTORECONF="${AUTOCONFPATH}autoreconf"
d37637700b4e Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 6550
diff changeset
62 fi
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
63
7485
0194db3ad154 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7484
diff changeset
64 # If you didn't set GETTEXTPATH, you can also set the variable AUTOPOINT.
0194db3ad154 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7484
diff changeset
65 if test -z "${AUTOPOINT}" || test -n "${GETTEXTPATH}"; then
0194db3ad154 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7484
diff changeset
66 AUTOPOINT="${GETTEXTPATH}autopoint"
0194db3ad154 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7484
diff changeset
67 fi
0194db3ad154 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7484
diff changeset
68
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
69 # When using GNU sed, turn off as many GNU extensions as possible,
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
70 # to minimize the risk of accidentally using non-portable features.
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
71 # However, do this only for gnulib-tool itself, not for the code that
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
72 # gnulib-tool generates, since we don't want "sed --posix" to leak
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
73 # into makefiles.
7911
548a756cade0 Fix test whether sed is GNU sed supporting --posix.
Bruno Haible <bruno@clisp.org>
parents: 7896
diff changeset
74 if (alias) > /dev/null 2>&1 && echo | sed --posix -e d >/dev/null 2>&1; then
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
75 alias sed='sed --posix'
7737
19ff03763d73 Use "sed --posix" instead of "sed" when possible.
Bruno Haible <bruno@clisp.org>
parents: 7722
diff changeset
76 fi
19ff03763d73 Use "sed --posix" instead of "sed" when possible.
Bruno Haible <bruno@clisp.org>
parents: 7722
diff changeset
77
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
78 # func_usage
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
79 # outputs to stdout the --help usage message.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
80 func_usage ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
81 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
82 echo "\
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
83 Usage: gnulib-tool --list
5344
c2f5677fc6ed Initialize supplied_libname. Tweak usage message.
Bruno Haible <bruno@clisp.org>
parents: 5343
diff changeset
84 gnulib-tool --import [module1 ... moduleN]
6443
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
85 gnulib-tool --update
7484
57fe575409ae --create-testdir without module names now means to use nearly all modules.
Bruno Haible <bruno@clisp.org>
parents: 7421
diff changeset
86 gnulib-tool --create-testdir --dir=directory [module1 ... moduleN]
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
87 gnulib-tool --create-megatestdir --dir=directory [module1 ... moduleN]
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
88 gnulib-tool --test --dir=directory module1 ... moduleN
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
89 gnulib-tool --megatest --dir=directory [module1 ... moduleN]
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
90 gnulib-tool --extract-description module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
91 gnulib-tool --extract-filelist module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
92 gnulib-tool --extract-dependencies module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
93 gnulib-tool --extract-autoconf-snippet module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
94 gnulib-tool --extract-automake-snippet module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
95 gnulib-tool --extract-include-directive module
8055
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
96 gnulib-tool --extract-link-directive module
5251
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
97 gnulib-tool --extract-license module
4197
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
98 gnulib-tool --extract-maintainer module
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
99 gnulib-tool --extract-tests-module module
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
100
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
101 Operation modes:
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
102 --list print the available module names
6633
5118aa463328 * gnulib-tool (Usage): Fix --import, from
Simon Josefsson <simon@josefsson.org>
parents: 6614
diff changeset
103 --import import the given modules into the current package;
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
104 if no modules are specified, update the current
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
105 package from the current gnulib
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
106 --update update the current package, restore files omitted
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
107 from CVS
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
108 --create-testdir create a scratch package with the given modules
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
109 --create-megatestdir create a mega scratch package with the given modules
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
110 one by one and all together
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
111 --test test the combination of the given modules
4197
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
112 (recommended to use CC=\"gcc -Wall\" here)
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
113 --megatest test the given modules one by one and all together
4197
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
114 (recommended to use CC=\"gcc -Wall\" here)
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
115 --extract-description extract the description
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
116 --extract-filelist extract the list of files
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
117 --extract-dependencies extract the dependencies
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
118 --extract-autoconf-snippet extract the snippet for configure.ac
7222
06eec4eaf416 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 7216
diff changeset
119 --extract-automake-snippet extract the snippet for library makefile
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
120 --extract-include-directive extract the #include directive
8055
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
121 --extract-link-directive extract the linker directive
5251
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
122 --extract-license report the license terms of the source files
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
123 under lib/
4197
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
124 --extract-maintainer report the maintainer(s) inside gnulib
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
125 --extract-tests-module report the unit test module, if it exists
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
126
7069
0fb5ef99e00f Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 7068
diff changeset
127 General options:
7068
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
128 --dir=DIRECTORY Specify the target directory.
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
129 For --import, this specifies where your
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
130 configure.ac can be found. Defaults to current
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
131 directory.
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
132 --local-dir=DIRECTORY Specify a local override directory where to look
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
133 up files before looking in gnulib's directory.
7069
0fb5ef99e00f Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 7068
diff changeset
134
0fb5ef99e00f Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 7068
diff changeset
135 Options for --import:
7068
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
136 --lib=LIBRARY Specify the library name. Defaults to 'libgnu'.
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
137 --source-base=DIRECTORY
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
138 Directory relative to --dir where source code is
7069
0fb5ef99e00f Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 7068
diff changeset
139 placed (default \"lib\").
7068
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
140 --m4-base=DIRECTORY Directory relative to --dir where *.m4 macros are
7069
0fb5ef99e00f Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 7068
diff changeset
141 placed (default \"m4\").
0fb5ef99e00f Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 7068
diff changeset
142 --doc-base=DIRECTORY Directory relative to --dir where doc files are
0fb5ef99e00f Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 7068
diff changeset
143 placed (default \"doc\").
7068
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
144 --tests-base=DIRECTORY
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
145 Directory relative to --dir where unit tests are
7069
0fb5ef99e00f Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 7068
diff changeset
146 placed (default \"tests\").
7068
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
147 --aux-dir=DIRECTORY Directory relative to --dir where auxiliary build
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
148 tools are placed (default \"build-aux\").
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
149 --with-tests Include unit tests for the included modules.
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
150 --avoid=MODULE Avoid including the given MODULE. Useful if you
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
151 have code that provides equivalent functionality.
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
152 This option can be repeated.
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
153 --lgpl Abort if modules aren't available under the LGPL.
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
154 Also modify license template from GPL to LGPL.
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
155 --makefile-name=NAME Name of makefile in automake syntax in the
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
156 source-base and tests-base directories
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
157 (default \"Makefile.am\").
7069
0fb5ef99e00f Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 7068
diff changeset
158 --libtool Use libtool rules.
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
159 --no-libtool Don't use libtool rules.
7068
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
160 --macro-prefix=PREFIX Specify the prefix of the macros 'gl_EARLY' and
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
161 'gl_INIT'. Default is 'gl'.
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
162 --no-changelog don't update or create ChangeLog files
7069
0fb5ef99e00f Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 7068
diff changeset
163
0fb5ef99e00f Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 7068
diff changeset
164 Options for --import and --update:
6966
42730fffa002 help message tweaks
Karl Berry <karl@freefriends.org>
parents: 6955
diff changeset
165 --dry-run For --import, only print what would have been done.
42730fffa002 help message tweaks
Karl Berry <karl@freefriends.org>
parents: 6955
diff changeset
166 -s, --symbolic, --symlink Make symbolic links instead of copying files.
7643
d67f9dc6019d New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 7642
diff changeset
167 --local-symlink Make symbolic links instead of copying files, only
d67f9dc6019d New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 7642
diff changeset
168 for files from the local override directory.
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
169
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
170 Report bugs to <bug-gnulib@gnu.org>."
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
171 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
172
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
173 # func_version
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
174 # outputs to stdout the --version message.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
175 func_version ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
176 {
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
177 year=`echo "$last_checkin_date" | sed -e 's,/.*$,,'`
7347
d86464f614f7 * gnulib-tool (func_version): Create output all at once. This
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7335
diff changeset
178 echo "\
d86464f614f7 * gnulib-tool (func_version): Create output all at once. This
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7335
diff changeset
179 $progname (GNU $package) $version
d86464f614f7 * gnulib-tool (func_version): Create output all at once. This
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7335
diff changeset
180 Copyright (C) $year Free Software Foundation, Inc.
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
181 This is free software; see the source for copying conditions. There is NO
7347
d86464f614f7 * gnulib-tool (func_version): Create output all at once. This
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7335
diff changeset
182 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
d86464f614f7 * gnulib-tool (func_version): Create output all at once. This
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7335
diff changeset
183 Written by" "Bruno Haible" "and" "Simon Josefsson"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
184 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
185
6777
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
186 # func_emit_copyright_notice
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
187 # outputs to stdout a header for a generated file.
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
188 func_emit_copyright_notice ()
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
189 {
7771
c9ae009bb4e7 Indicate the presence of gnulib modules through C macros.
Bruno Haible <bruno@clisp.org>
parents: 7767
diff changeset
190 echo "# Copyright (C) 2004-2007 Free Software Foundation, Inc."
6777
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
191 echo "#"
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
192 echo "# This file is free software, distributed under the terms of the GNU"
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
193 echo "# General Public License. As a special exception to the GNU General"
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
194 echo "# Public License, this file may be distributed as part of a program"
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
195 echo "# that contains a configuration script generated by Autoconf, under"
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
196 echo "# the same distribution terms as the rest of that program."
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
197 echo "#"
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
198 echo "# Generated by gnulib-tool."
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
199 }
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
200
7332
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
201 # func_exit STATUS
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
202 # exit with status
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
203 func_exit ()
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
204 {
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
205 (exit $1); exit $1
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
206 }
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
207
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
208 # func_tmpdir
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
209 # creates a temporary directory.
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
210 # Sets variable
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
211 # - tmp pathname of freshly created temporary directory
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
212 func_tmpdir ()
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
213 {
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
214 # Use the environment variable TMPDIR, falling back to /tmp. This allows
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
215 # users to specify a different temporary directory, for example, if their
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
216 # /tmp is filled up or too small.
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
217 : ${TMPDIR=/tmp}
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
218 {
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
219 # Use the mktemp program if available. If not available, hide the error
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
220 # message.
6581
bc61a0c9a750 * gnulib-tool, build-aux/csharpcomp.sh.in: Do not pass `-q' to mktemp.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6570
diff changeset
221 tmp=`(umask 077 && mktemp -d "$TMPDIR/glXXXXXX") 2>/dev/null` &&
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
222 test -n "$tmp" && test -d "$tmp"
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
223 } ||
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
224 {
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
225 # Use a simple mkdir command. It is guaranteed to fail if the directory
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
226 # already exists. $RANDOM is bash specific and expands to empty in shells
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
227 # other than bash, ksh and zsh. Its use does not increase security;
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
228 # rather, it minimizes the probability of failure in a very cluttered /tmp
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
229 # directory.
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
230 tmp=$TMPDIR/gl$$-$RANDOM
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
231 (umask 077 && mkdir "$tmp")
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
232 } ||
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
233 {
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
234 echo "$0: cannot create a temporary directory in $TMPDIR" >&2
7332
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
235 func_exit 1
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
236 }
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
237 }
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
238
7323
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
239 # func_append var value
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
240 # appends the given value to the shell variable var.
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
241 if ( foo=bar; foo+=baz && test "$foo" = barbaz ) >/dev/null 2>&1; then
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
242 # Use bash's += operator. It reduces complexity of appending repeatedly to
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
243 # a single variable from O(n^2) to O(n).
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
244 func_append ()
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
245 {
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
246 eval "$1+=\"\$2\""
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
247 }
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
248 else
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
249 func_append ()
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
250 {
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
251 eval "$1=\"\$$1\$2\""
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
252 }
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
253 fi
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
254
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
255 # func_fatal_error message
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
256 # outputs to stderr a fatal error message, and terminates the program.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
257 func_fatal_error ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
258 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
259 echo "gnulib-tool: *** $1" 1>&2
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
260 echo "gnulib-tool: *** Stop." 1>&2
7332
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
261 func_exit 1
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
262 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
263
6248
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
264 # func_readlink SYMLINK
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
265 # outputs the target of the given symlink.
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
266 if (type -p readlink) > /dev/null 2>&1; then
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
267 func_readlink ()
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
268 {
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
269 # Use the readlink program from GNU coreutils.
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
270 readlink "$1"
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
271 }
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
272 else
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
273 func_readlink ()
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
274 {
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
275 # Use two sed invocations. A single sed -n -e 's,^.* -> \(.*\)$,\1,p'
6263
9750529a8cf5 Sort in a locale-independent way.
Bruno Haible <bruno@clisp.org>
parents: 6262
diff changeset
276 # would do the wrong thing if the link target contains " -> ".
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
277 LC_ALL=C ls -l "$1" | sed -e 's, -> ,#%%#,' | sed -n -e 's,^.*#%%#\(.*\)$,\1,p'
6248
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
278 }
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
279 fi
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
280
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
281 # func_relativize DIR1 DIR2
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
282 # computes a relative pathname RELDIR such that DIR1/RELDIR = DIR2.
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
283 # Input:
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
284 # - DIR1 relative pathname, relative to the current directory
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
285 # - DIR2 relative pathname, relative to the current directory
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
286 # Output:
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
287 # - reldir relative pathname of DIR2, relative to DIR1
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
288 func_relativize ()
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
289 {
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
290 dir0=`pwd`
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
291 dir1="$1"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
292 dir2="$2"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
293 sed_first='s,^\([^/]*\)/.*$,\1,'
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
294 sed_rest='s,^[^/]*/*,,'
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
295 sed_last='s,^.*/\([^/]*\)$,\1,'
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
296 sed_butlast='s,/*[^/]*$,,'
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
297 while test -n "$dir1"; do
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
298 first=`echo "$dir1" | sed -e "$sed_first"`
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
299 if test "$first" != "."; then
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
300 if test "$first" = ".."; then
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
301 dir2=`echo "$dir0" | sed -e "$sed_last"`/"$dir2"
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
302 dir0=`echo "$dir0" | sed -e "$sed_butlast"`
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
303 else
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
304 first2=`echo "$dir2" | sed -e "$sed_first"`
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
305 if test "$first2" = "$first"; then
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
306 dir2=`echo "$dir2" | sed -e "$sed_rest"`
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
307 else
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
308 dir2="../$dir2"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
309 fi
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
310 dir0="$dir0"/"$first"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
311 fi
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
312 fi
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
313 dir1=`echo "$dir1" | sed -e "$sed_rest"`
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
314 done
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
315 reldir="$dir2"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
316 }
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
317
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
318 # func_relconcat DIR1 DIR2
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
319 # computes a relative pathname DIR1/DIR2, with obvious simplifications.
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
320 # Input:
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
321 # - DIR1 relative pathname, relative to the current directory
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
322 # - DIR2 relative pathname, relative to DIR1
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
323 # Output:
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
324 # - relconcat DIR1/DIR2, relative to the current directory
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
325 func_relconcat ()
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
326 {
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
327 dir1="$1"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
328 dir2="$2"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
329 sed_first='s,^\([^/]*\)/.*$,\1,'
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
330 sed_rest='s,^[^/]*/*,,'
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
331 sed_last='s,^.*/\([^/]*\)$,\1,'
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
332 sed_butlast='s,/*[^/]*$,,'
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
333 while true; do
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
334 first=`echo "$dir2" | sed -e "$sed_first"`
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
335 if test "$first" = "."; then
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
336 dir2=`echo "$dir2" | sed -e "$sed_rest"`
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
337 if test -z "$dir2"; then
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
338 relconcat="$dir1"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
339 break
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
340 fi
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
341 else
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
342 last=`echo "$dir1" | sed -e "$sed_last"`
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
343 while test "$last" = "."; do
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
344 dir1=`echo "$dir1" | sed -e "$sed_butlast"`
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
345 last=`echo "$dir1" | sed -e "$sed_last"`
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
346 done
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
347 if test -z "$dir1"; then
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
348 relconcat="$dir2"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
349 break
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
350 fi
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
351 if test "$first" = ".."; then
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
352 if test "$last" = ".."; then
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
353 relconcat="$dir1/$dir2"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
354 break
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
355 fi
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
356 dir1=`echo "$dir1" | sed -e "$sed_butlast"`
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
357 dir2=`echo "$dir2" | sed -e "$sed_rest"`
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
358 if test -z "$dir1"; then
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
359 relconcat="$dir2"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
360 break
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
361 fi
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
362 if test -z "$dir2"; then
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
363 relconcat="$dir1"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
364 break
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
365 fi
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
366 else
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
367 relconcat="$dir1/$dir2"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
368 break
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
369 fi
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
370 fi
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
371 done
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
372 }
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
373
7642
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
374 # func_ln SRC DEST
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
375 # Like ln -s, except that SRC is given relative to the current directory (or
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
376 # absolute), not given relative to the directory of DEST.
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
377 func_ln ()
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
378 {
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
379 case "$1" in
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
380 /*)
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
381 ln -s "$1" "$2" ;;
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
382 *) # SRC is relative.
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
383 case "$2" in
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
384 /*)
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
385 ln -s "`pwd`/$1" "$2" ;;
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
386 *) # DEST is relative too.
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
387 ln_destdir=`echo "$2" | sed -e 's,[^/]*$,,'`
7642
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
388 test -n "$ln_destdir" || ln_destdir="."
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
389 func_relativize "$ln_destdir" "$1"
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
390 ln -s "$reldir" "$2"
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
391 ;;
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
392 esac
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
393 ;;
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
394 esac
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
395 }
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
396
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
397 # func_ln_if_changed SRC DEST
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
398 # Like func_ln, but avoids munging timestamps if the link is correct.
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
399 func_ln_if_changed ()
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
400 {
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
401 if test $# -ne 2; then
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
402 echo "usage: func_ln_if_changed SRC DEST" >&2
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
403 fi
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
404 ln_target=`func_readlink "$2"`
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
405 if test -L "$2" && test "$1" = "$ln_target"; then
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
406 :
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
407 else
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
408 rm -f "$2"
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
409 func_ln "$1" "$2"
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
410 fi
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
411 }
0878abcc59c9 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7641
diff changeset
412
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
413 # Command-line option processing.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
414 # Removes the OPTIONS from the arguments. Sets the variables:
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
415 # - mode list or import or create-testdir or create-megatestdir
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
416 # - destdir from --dir
7215
3869ca15e2bb Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 7214
diff changeset
417 # - local_gnulib_dir from --local-dir
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
418 # - libname, supplied_libname from --lib
5198
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
419 # - sourcebase from --source-base
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
420 # - m4base from --m4-base
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
421 # - docbase from --doc-base
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
422 # - testsbase from --tests-base
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
423 # - auxdir from --aux-dir
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
424 # - inctests true if --with-tests was given, blank otherwise
5981
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
425 # - avoidlist list of modules to avoid, from --avoid
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
426 # - lgpl true if --lgpl was given, blank otherwise
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
427 # - makefile_name from --makefile-name
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
428 # - libtool true if --libtool was given, false if --no-libtool was
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
429 # given, blank otherwise
6994
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
430 # - macro_prefix from --macro-prefix
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
431 # - autoconf_minversion minimum supported autoconf version
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
432 # - do_changelog false if --no-changelog was given, : otherwise
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
433 # - doit : if actions shall be executed, false if only to be printed
7643
d67f9dc6019d New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 7642
diff changeset
434 # - symbolic true if --symlink was given, blank otherwise
d67f9dc6019d New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 7642
diff changeset
435 # - lsymbolic true if --local-symlink was given, blank otherwise
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
436 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
437 mode=
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
438 destdir=
7215
3869ca15e2bb Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 7214
diff changeset
439 local_gnulib_dir=
5198
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
440 libname=libgnu
5344
c2f5677fc6ed Initialize supplied_libname. Tweak usage message.
Bruno Haible <bruno@clisp.org>
parents: 5343
diff changeset
441 supplied_libname=
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
442 sourcebase=
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
443 m4base=
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
444 docbase=
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
445 testsbase=
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
446 auxdir=
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
447 inctests=
5981
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
448 avoidlist=
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
449 lgpl=
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
450 makefile_name=
5198
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
451 libtool=
6176
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
452 macro_prefix=
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
453 do_changelog=:
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
454 doit=:
5799
ad9eff556694 2005-04-15 Simon Josefsson <jas@extundo.com>
Simon Josefsson <simon@josefsson.org>
parents: 5798
diff changeset
455 symbolic=
7643
d67f9dc6019d New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 7642
diff changeset
456 lsymbolic=
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
457
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
458 supplied_opts="$@"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
459
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
460 while test $# -gt 0; do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
461 case "$1" in
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
462 --list | --lis )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
463 mode=list
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
464 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
465 --import | --impor | --impo | --imp | --im | --i )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
466 mode=import
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
467 shift ;;
6443
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
468 --update | --updat | --upda | --upd | --up | --u )
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
469 mode=update
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
470 shift ;;
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
471 --create-testdir | --create-testdi | --create-testd | --create-test | --create-tes | --create-te | --create-t )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
472 mode=create-testdir
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
473 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
474 --create-megatestdir | --create-megatestdi | --create-megatestd | --create-megatest | --create-megates | --create-megate | --create-megat | --create-mega | --create-meg | --create-me | --create-m )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
475 mode=create-megatestdir
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
476 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
477 --test | --tes | --te | --t )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
478 mode=test
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
479 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
480 --megatest | --megates | --megate | --megat | --mega | --meg | --me | --m )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
481 mode=megatest
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
482 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
483 --extract-* )
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
484 mode=`echo "X$1" | sed -e 's/^X--//'`
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
485 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
486 --dir )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
487 shift
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
488 if test $# = 0; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
489 func_fatal_error "missing argument for --dir"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
490 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
491 destdir=$1
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
492 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
493 --dir=* )
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
494 destdir=`echo "X$1" | sed -e 's/^X--dir=//'`
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
495 shift ;;
7215
3869ca15e2bb Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 7214
diff changeset
496 --local-dir )
3869ca15e2bb Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 7214
diff changeset
497 shift
3869ca15e2bb Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 7214
diff changeset
498 if test $# = 0; then
3869ca15e2bb Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 7214
diff changeset
499 func_fatal_error "missing argument for --local-dir"
3869ca15e2bb Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 7214
diff changeset
500 fi
3869ca15e2bb Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 7214
diff changeset
501 local_gnulib_dir=$1
3869ca15e2bb Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 7214
diff changeset
502 shift ;;
3869ca15e2bb Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 7214
diff changeset
503 --local-dir=* )
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
504 local_gnulib_dir=`echo "X$1" | sed -e 's/^X--local-dir=//'`
7215
3869ca15e2bb Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 7214
diff changeset
505 shift ;;
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
506 --lib )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
507 shift
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
508 if test $# = 0; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
509 func_fatal_error "missing argument for --lib"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
510 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
511 libname=$1
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
512 supplied_libname=true
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
513 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
514 --lib=* )
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
515 libname=`echo "X$1" | sed -e 's/^X--lib=//'`
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
516 supplied_libname=true
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
517 shift ;;
5198
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
518 --source-base )
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
519 shift
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
520 if test $# = 0; then
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
521 func_fatal_error "missing argument for --source-base"
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
522 fi
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
523 sourcebase=$1
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
524 shift ;;
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
525 --source-base=* )
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
526 sourcebase=`echo "X$1" | sed -e 's/^X--source-base=//'`
5198
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
527 shift ;;
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
528 --m4-base )
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
529 shift
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
530 if test $# = 0; then
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
531 func_fatal_error "missing argument for --m4-base"
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
532 fi
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
533 m4base=$1
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
534 shift ;;
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
535 --m4-base=* )
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
536 m4base=`echo "X$1" | sed -e 's/^X--m4-base=//'`
5198
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
537 shift ;;
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
538 --doc-base )
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
539 shift
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
540 if test $# = 0; then
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
541 func_fatal_error "missing argument for --doc-base"
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
542 fi
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
543 docbase=$1
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
544 shift ;;
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
545 --doc-base=* )
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
546 docbase=`echo "X$1" | sed -e 's/^X--doc-base=//'`
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
547 shift ;;
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
548 --tests-base )
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
549 shift
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
550 if test $# = 0; then
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
551 func_fatal_error "missing argument for --tests-base"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
552 fi
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
553 testsbase=$1
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
554 shift ;;
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
555 --tests-base=* )
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
556 testsbase=`echo "X$1" | sed -e 's/^X--tests-base=//'`
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
557 shift ;;
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
558 --aux-dir )
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
559 shift
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
560 if test $# = 0; then
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
561 func_fatal_error "missing argument for --aux-dir"
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
562 fi
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
563 auxdir=$1
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
564 shift ;;
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
565 --aux-dir=* )
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
566 auxdir=`echo "X$1" | sed -e 's/^X--aux-dir=//'`
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
567 shift ;;
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
568 --with-tests )
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
569 inctests=true
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
570 shift ;;
5981
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
571 --avoid )
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
572 shift
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
573 if test $# = 0; then
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
574 func_fatal_error "missing argument for --avoid"
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
575 fi
7323
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
576 func_append avoidlist " $1"
5981
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
577 shift ;;
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
578 --avoid=* )
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
579 arg=`echo "X$1" | sed -e 's/^X--avoid=//'`
7327
6db875979695 * gnulib-tool (avoidlist): Fix typo that broke options like
Paul Eggert <eggert@cs.ucla.edu>
parents: 7326
diff changeset
580 func_append avoidlist " $arg"
5198
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
581 shift ;;
5262
97ed4b64d853 New parameter --lgpl, to asseert that modules are
Paul Eggert <eggert@cs.ucla.edu>
parents: 5255
diff changeset
582 --lgpl )
97ed4b64d853 New parameter --lgpl, to asseert that modules are
Paul Eggert <eggert@cs.ucla.edu>
parents: 5255
diff changeset
583 lgpl=true
97ed4b64d853 New parameter --lgpl, to asseert that modules are
Paul Eggert <eggert@cs.ucla.edu>
parents: 5255
diff changeset
584 shift ;;
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
585 --makefile-name )
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
586 shift
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
587 if test $# = 0; then
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
588 func_fatal_error "missing argument for --makefile-name"
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
589 fi
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
590 makefile_name="$1"
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
591 shift ;;
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
592 --makefile-name=* )
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
593 makefile_name=`echo "X$1" | sed -e 's/^X--makefile-name=//'`
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
594 shift ;;
5981
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
595 --libtool )
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
596 libtool=true
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
597 shift ;;
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
598 --no-libtool )
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
599 libtool=false
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
600 shift ;;
6176
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
601 --macro-prefix )
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
602 shift
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
603 if test $# = 0; then
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
604 func_fatal_error "missing argument for --macro-prefix"
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
605 fi
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
606 macro_prefix="$1"
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
607 shift ;;
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
608 --macro-prefix=* )
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
609 macro_prefix=`echo "X$1" | sed -e 's/^X--macro-prefix=//'`
6176
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
610 shift ;;
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
611 --no-changelog | --no-changelo | --no-changel | --no-change | --no-chang | --no-chan | --no-cha | --no-ch | --no-c )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
612 do_changelog=false
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
613 shift ;;
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
614 --dry-run )
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
615 doit=false
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
616 shift ;;
6443
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
617 -s | --symbolic | --symboli | --symbol | --symbo | --symb | --symlink | --symlin | --symli | --syml | --sym | --sy )
5799
ad9eff556694 2005-04-15 Simon Josefsson <jas@extundo.com>
Simon Josefsson <simon@josefsson.org>
parents: 5798
diff changeset
618 symbolic=true
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
619 shift ;;
7643
d67f9dc6019d New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 7642
diff changeset
620 --local-symlink | --local-symlin | --local-symli | --local-syml | --local-sym | --local-sy | --local-s )
d67f9dc6019d New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 7642
diff changeset
621 lsymbolic=true
d67f9dc6019d New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 7642
diff changeset
622 shift ;;
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
623 --help | --hel | --he | --h )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
624 func_usage
7332
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
625 func_exit $? ;;
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
626 --version | --versio | --versi | --vers | --ver | --ve | --v )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
627 func_version
7332
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
628 func_exit $? ;;
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
629 -- )
6264
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
630 # Stop option processing
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
631 shift
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
632 break ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
633 -* )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
634 echo "gnulib-tool: unknown option $1" 1>&2
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
635 echo "Try 'gnulib-tool --help' for more information." 1>&2
7332
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
636 func_exit 1 ;;
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
637 * )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
638 break ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
639 esac
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
640 done
6264
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
641
6443
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
642 if test "$mode" = update; then
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
643 if test $# != 0; then
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
644 echo "gnulib-tool: too many arguments in 'update' mode" 1>&2
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
645 echo "Try 'gnulib-tool --help' for more information." 1>&2
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
646 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
647 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
7332
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
648 func_exit 1
6443
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
649 fi
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
650 if test -n "$local_gnulib_dir" || test -n "$supplied_libname" \
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
651 || test -n "$sourcebase" || test -n "$m4base" \
6993
dc8f2a1ff75f Reorder tests in doc-base patch.
Bruno Haible <bruno@clisp.org>
parents: 6966
diff changeset
652 || test -n "$docbase" || test -n "$testsbase" || test -n "$auxdir" \
dc8f2a1ff75f Reorder tests in doc-base patch.
Bruno Haible <bruno@clisp.org>
parents: 6966
diff changeset
653 || test -n "$inctests" || test -n "$avoidlist" || test -n "$lgpl" \
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
654 || test -n "$makefile_name" || test -n "$macro_prefix"; then
6443
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
655 echo "gnulib-tool: invalid options for 'update' mode" 1>&2
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
656 echo "Try 'gnulib-tool --help' for more information." 1>&2
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
657 echo "If you really want to modify the gnulib configuration of your project," 1>&2
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
658 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
7332
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
659 func_exit 1
6443
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
660 fi
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
661 do_changelog=false
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
662 fi
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
663
7071
71c5caf223fc Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 7070
diff changeset
664 # Determine the minimum supported autoconf version from the project's
71c5caf223fc Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 7070
diff changeset
665 # configure.ac.
6994
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
666 DEFAULT_AUTOCONF_MINVERSION="2.59"
7078
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
667 autoconf_minversion=
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
668 configure_ac=
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
669 if { test "$mode" = import || test "$mode" = update; } && test -n "$destdir"; then
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
670 if test -f "$destdir"/configure.ac; then
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
671 configure_ac="$destdir/configure.ac"
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
672 else
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
673 if test -f "$destdir"/configure.in; then
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
674 configure_ac="$destdir/configure.in"
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
675 fi
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
676 fi
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
677 else
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
678 if test -f configure.ac; then
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
679 configure_ac="configure.ac"
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
680 else
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
681 if test -f configure.in; then
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
682 configure_ac="configure.in"
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
683 fi
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
684 fi
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
685 fi
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
686 if test -n "$configure_ac"; then
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
687 # Use sed, not autoconf --trace, to look for the AC_PREREQ invocation,
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
688 # because when some m4 files are omitted from a CVS repository,
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
689 # "autoconf --trace=AC_PREREQ" fails with an error message like this:
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
690 # m4: aclocal.m4:851: Cannot open m4/absolute-header.m4: No such file or directory
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
691 # autom4te: m4 failed with exit status: 1
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
692 prereqs=
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
693 my_sed_traces='
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
694 s,#.*$,,
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
695 s,^dnl .*$,,
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
696 s, dnl .*$,,
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
697 /AC_PREREQ/ {
7767
0339d0fb77b2 * gnulib-tool (SORT): Remove, since we no longer assume GNU sort.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7754
diff changeset
698 s,^.*AC_PREREQ([[ ]*\([^])]*\).*$,\1,p
7078
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
699 }'
7767
0339d0fb77b2 * gnulib-tool (SORT): Remove, since we no longer assume GNU sort.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7754
diff changeset
700 prereqs=`sed -n -e "$my_sed_traces" < "$configure_ac"`
7078
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
701 if test -n "$prereqs"; then
7767
0339d0fb77b2 * gnulib-tool (SORT): Remove, since we no longer assume GNU sort.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7754
diff changeset
702 autoconf_minversion=`
0339d0fb77b2 * gnulib-tool (SORT): Remove, since we no longer assume GNU sort.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7754
diff changeset
703 for version in $prereqs; do echo $version; done |
7781
b13928e41580 * gnulib-tool (autoconf_minversion): Take the maximum version number
Paul Eggert <eggert@cs.ucla.edu>
parents: 7777
diff changeset
704 LC_ALL=C sort -nru | sed 1q
7767
0339d0fb77b2 * gnulib-tool (SORT): Remove, since we no longer assume GNU sort.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7754
diff changeset
705 `
7078
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
706 fi
7071
71c5caf223fc Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 7070
diff changeset
707 fi
71c5caf223fc Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 7070
diff changeset
708 if test -z "$autoconf_minversion"; then
71c5caf223fc Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 7070
diff changeset
709 autoconf_minversion=$DEFAULT_AUTOCONF_MINVERSION
71c5caf223fc Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 7070
diff changeset
710 fi
6994
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
711 case "$autoconf_minversion" in
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
712 1.* | 2.[0-4]* | 2.5[0-8]*)
7071
71c5caf223fc Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 7070
diff changeset
713 func_fatal_error "minimum supported autoconf version is 2.59. Try adding AC_PREREQ([$DEFAULT_AUTOCONF_MINVERSION]) to your configure.ac." ;;
6994
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
714 esac
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
715
6264
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
716 # Remove trailing slashes from the directory names. This is necessary for
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
717 # m4base (to avoid an error in func_import) and optional for the others.
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
718 sed_trimtrailingslashes='s,\([^/]\)//*$,\1,'
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
719 case "$local_gnulib_dir" in
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
720 */ ) local_gnulib_dir=`echo "$local_gnulib_dir" | sed -e "$sed_trimtrailingslashes"` ;;
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
721 esac
6264
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
722 case "$sourcebase" in
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
723 */ ) sourcebase=`echo "$sourcebase" | sed -e "$sed_trimtrailingslashes"` ;;
6264
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
724 esac
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
725 case "$m4base" in
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
726 */ ) m4base=`echo "$m4base" | sed -e "$sed_trimtrailingslashes"` ;;
6264
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
727 esac
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
728 case "$docbase" in
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
729 */ ) docbase=`echo "$docbase" | sed -e "$sed_trimtrailingslashes"` ;;
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
730 esac
6264
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
731 case "$testsbase" in
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
732 */ ) testsbase=`echo "$testsbase" | sed -e "$sed_trimtrailingslashes"` ;;
6264
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
733 esac
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
734 case "$auxdir" in
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
735 */ ) auxdir=`echo "$auxdir" | sed -e "$sed_trimtrailingslashes"` ;;
6264
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
736 esac
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
737 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
738
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
739 case "$0" in
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
740 /*) self_abspathname="$0" ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
741 */*) self_abspathname=`pwd`/"$0" ;;
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
742 *) for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'`; do
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
743 if test -x "$d/$0" && test ! -d "$d/$0"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
744 self_abspathname="$d/$0"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
745 break
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
746 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
747 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
748 if test -z "$self_abspathname"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
749 func_fatal_error "could not locate the gnulib-tool program - how did you invoke it?"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
750 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
751 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
752 esac
4717
ed7cd4050365 Port gnulib-tool to Solaris 8.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4712
diff changeset
753 while test -h "$self_abspathname"; do
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
754 # Resolve symbolic link.
6248
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
755 linkval=`func_readlink "$self_abspathname"`
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
756 test -n "$linkval" || break
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
757 case "$linkval" in
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
758 /* ) self_abspathname="$linkval" ;;
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
759 * ) self_abspathname=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;;
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
760 esac
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
761 done
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
762 gnulib_dir=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
763
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
764 func_tmpdir
7332
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
765 trap 'exit_status=$?
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
766 if test "$signal" != 0; then
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
767 echo "caught signal $signal" >&2
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
768 fi
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
769 rm -rf "$tmp"
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
770 exit $exit_status' 0
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
771 for signal in 1 2 3 13 15; do
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
772 trap '{ signal='$signal'; func_exit 1; }' $signal
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
773 done
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
774 signal=0
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
775
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
776 # func_lookup_file file
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
777 # looks up a file in $local_gnulib_dir or $gnulib_dir, or combines it through
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
778 # 'patch'.
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
779 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
780 # - local_gnulib_dir from --local-dir
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
781 # Output:
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
782 # - lookedup_file name of the merged (combined) file
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
783 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
784 func_lookup_file ()
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
785 {
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
786 lkfile="$1"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
787 if test -n "$local_gnulib_dir" && test -f "$local_gnulib_dir/$lkfile"; then
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
788 lookedup_file="$local_gnulib_dir/$lkfile"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
789 lookedup_tmp=
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
790 else
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
791 if test -f "$gnulib_dir/$lkfile"; then
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
792 if test -n "$local_gnulib_dir" && test -f "$local_gnulib_dir/$lkfile.diff"; then
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
793 lkbase=`echo "$lkfile" | sed -e 's,^.*/,,'`
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
794 rm -f "$tmp/$lkbase"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
795 cp "$gnulib_dir/$lkfile" "$tmp/$lkbase"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
796 patch -s "$tmp/$lkbase" < "$local_gnulib_dir/$lkfile.diff" \
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
797 || func_fatal_error "patch file $local_gnulib_dir/$lkfile.diff didn't apply cleanly"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
798 lookedup_file="$tmp/$lkbase"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
799 lookedup_tmp=true
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
800 else
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
801 lookedup_file="$gnulib_dir/$lkfile"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
802 lookedup_tmp=
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
803 fi
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
804 else
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
805 func_fatal_error "file $gnulib_dir/$lkfile not found"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
806 fi
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
807 fi
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
808 }
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
809
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
810 # func_all_modules
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
811 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
812 # - local_gnulib_dir from --local-dir
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
813 func_all_modules ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
814 {
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
815 # Filter out metainformation files like README, which are not modules.
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
816 # Filter out unit test modules; they can be retrieved through
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
817 # --extract-tests-module if desired.
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
818 {
7805
2ee7433618fe Add support for subdirectories of the 'modules/' directory.
Bruno Haible <bruno@clisp.org>
parents: 7788
diff changeset
819 (cd "$gnulib_dir" && find modules -type f -print | sed -e 's,^modules/,,')
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
820 if test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules"; then
7805
2ee7433618fe Add support for subdirectories of the 'modules/' directory.
Bruno Haible <bruno@clisp.org>
parents: 7788
diff changeset
821 (cd "$local_gnulib_dir" && find modules -type f -print | sed -e 's,^modules/,,' -e 's,\.diff$,,')
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
822 fi
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
823 } \
7857
978cf3123a32 Exclude all files inside the CVS directory.
Bruno Haible <bruno@clisp.org>
parents: 7850
diff changeset
824 | sed -e '/^CVS\//d' -e '/\/CVS\//d' \
7850
4c8e2f42f969 * gnulib-tool (func_all_modules): Use POSIX conforming escaping
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7805
diff changeset
825 -e '/^ChangeLog$/d' -e '/\/ChangeLog$/d' \
4c8e2f42f969 * gnulib-tool (func_all_modules): Use POSIX conforming escaping
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7805
diff changeset
826 -e '/^COPYING$/d' -e '/\/COPYING$/d' \
4c8e2f42f969 * gnulib-tool (func_all_modules): Use POSIX conforming escaping
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7805
diff changeset
827 -e '/^README$/d' -e '/\/README$/d' \
7805
2ee7433618fe Add support for subdirectories of the 'modules/' directory.
Bruno Haible <bruno@clisp.org>
parents: 7788
diff changeset
828 -e '/^TEMPLATE$/d' \
8626
eb080a5d05de TEMPLATE-EXTENDED is not a module.
Bruno Haible <bruno@clisp.org>
parents: 8503
diff changeset
829 -e '/^TEMPLATE-EXTENDED$/d' \
7805
2ee7433618fe Add support for subdirectories of the 'modules/' directory.
Bruno Haible <bruno@clisp.org>
parents: 7788
diff changeset
830 -e '/^TEMPLATE-TESTS$/d' \
7858
08609b22ffd5 (func_all_modules): Exclude all .* files (e.g., Emacs .#* auto-save files).
Simon Josefsson <simon@josefsson.org>
parents: 7857
diff changeset
831 -e '/^\..*/d' \
7805
2ee7433618fe Add support for subdirectories of the 'modules/' directory.
Bruno Haible <bruno@clisp.org>
parents: 7788
diff changeset
832 -e '/~$/d' \
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
833 | sed -e '/-tests$/d' \
7319
1726cc39709b Use "sort -u" where it makes sense.
Bruno Haible <bruno@clisp.org>
parents: 7299
diff changeset
834 | LC_ALL=C sort -u
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
835 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
836
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
837 # func_verify_module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
838 # verifies a module name
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
839 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
840 # - local_gnulib_dir from --local-dir
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
841 # - module module name argument
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
842 func_verify_module ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
843 {
7168
56632b3512af Make it work also with Solaris /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 7142
diff changeset
844 if { test -f "$gnulib_dir/modules/$module" \
56632b3512af Make it work also with Solaris /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 7142
diff changeset
845 || { test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules" \
56632b3512af Make it work also with Solaris /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 7142
diff changeset
846 && test -f "$local_gnulib_dir/modules/$module"; }; } \
56632b3512af Make it work also with Solaris /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 7142
diff changeset
847 && test "CVS" != "$module" \
56632b3512af Make it work also with Solaris /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 7142
diff changeset
848 && test "ChangeLog" != "$module" \
56632b3512af Make it work also with Solaris /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 7142
diff changeset
849 && test "COPYING" != "$module" \
56632b3512af Make it work also with Solaris /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 7142
diff changeset
850 && test "README" != "$module" \
56632b3512af Make it work also with Solaris /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 7142
diff changeset
851 && test "TEMPLATE" != "$module" \
8626
eb080a5d05de TEMPLATE-EXTENDED is not a module.
Bruno Haible <bruno@clisp.org>
parents: 8503
diff changeset
852 && test "TEMPLATE-EXTENDED" != "$module" \
7168
56632b3512af Make it work also with Solaris /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 7142
diff changeset
853 && test "TEMPLATE-TESTS" != "$module"; then
56632b3512af Make it work also with Solaris /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 7142
diff changeset
854 # OK, $module is a correct module name.
7212
232ee448d272 Better error handling.
Bruno Haible <bruno@clisp.org>
parents: 7199
diff changeset
855 # Verify that building the module description with 'patch' succeeds.
232ee448d272 Better error handling.
Bruno Haible <bruno@clisp.org>
parents: 7199
diff changeset
856 func_lookup_file "modules/$module"
7168
56632b3512af Make it work also with Solaris /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 7142
diff changeset
857 else
4128
1346b5405a74 (func_verify_module): report module name $module
Karl Berry <karl@freefriends.org>
parents: 4126
diff changeset
858 echo "gnulib-tool: module $module doesn't exist" 1>&2
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
859 module=
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
860 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
861 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
862
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
863 # func_verify_nontests_module
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
864 # verifies a module name, excluding tests modules
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
865 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
866 # - local_gnulib_dir from --local-dir
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
867 # - module module name argument
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
868 func_verify_nontests_module ()
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
869 {
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
870 case "$module" in
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
871 *-tests ) module= ;;
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
872 * ) func_verify_module ;;
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
873 esac
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
874 }
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
875
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
876 # func_verify_tests_module
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
877 # verifies a module name, considering only tests modules
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
878 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
879 # - local_gnulib_dir from --local-dir
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
880 # - module module name argument
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
881 func_verify_tests_module ()
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
882 {
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
883 case "$module" in
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
884 *-tests ) func_verify_module ;;
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
885 * ) module= ;;
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
886 esac
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
887 }
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
888
6952
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
889 sed_extract_prog=':[ ]*$/ {
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
890 :a
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
891 n
6952
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
892 s/^Description:[ ]*$//
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
893 s/^Files:[ ]*$//
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
894 s/^Depends-on:[ ]*$//
8079
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
895 s/^configure\.ac-early:[ ]*$//
6952
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
896 s/^configure\.ac:[ ]*$//
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
897 s/^Makefile\.am:[ ]*$//
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
898 s/^Include:[ ]*$//
8055
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
899 s/^Link:[ ]*$//
6952
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
900 s/^License:[ ]*$//
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
901 s/^Maintainer:[ ]*$//
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
902 tb
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
903 p
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
904 ba
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
905 :b
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
906 }'
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
907
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
908 # func_get_description module
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
909 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
910 # - local_gnulib_dir from --local-dir
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
911 func_get_description ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
912 {
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
913 func_lookup_file "modules/$1"
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
914 sed -n -e "/^Description$sed_extract_prog" < "$lookedup_file"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
915 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
916
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
917 # func_get_filelist module
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
918 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
919 # - local_gnulib_dir from --local-dir
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
920 func_get_filelist ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
921 {
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
922 func_lookup_file "modules/$1"
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
923 sed -n -e "/^Files$sed_extract_prog" < "$lookedup_file"
7788
e3424061171f Back from an automatic module-indicator macro to a module-indicator macro
Bruno Haible <bruno@clisp.org>
parents: 7781
diff changeset
924 echo m4/gnulib-common.m4
6994
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
925 case "$autoconf_minversion" in
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
926 2.59)
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
927 #echo m4/onceonly.m4
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
928 echo m4/onceonly_2_57.m4
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
929 ;;
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
930 esac
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
931 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
932
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
933 # func_get_dependencies module
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
934 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
935 # - local_gnulib_dir from --local-dir
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
936 func_get_dependencies ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
937 {
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
938 # ${module}-tests always implicitly depends on ${module}.
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
939 echo "$1" | sed -n -e 's/-tests//p'
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
940 # Then the explicit dependencies listed in the module description.
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
941 func_lookup_file "modules/$1"
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
942 sed -n -e "/^Depends-on$sed_extract_prog" < "$lookedup_file"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
943 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
944
8079
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
945 # func_get_autoconf_early_snippet module
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
946 # Input:
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
947 # - local_gnulib_dir from --local-dir
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
948 func_get_autoconf_early_snippet ()
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
949 {
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
950 func_lookup_file "modules/$1"
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
951 sed -n -e "/^configure\.ac-early$sed_extract_prog" < "$lookedup_file"
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
952 }
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
953
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
954 # func_get_autoconf_snippet module
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
955 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
956 # - local_gnulib_dir from --local-dir
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
957 func_get_autoconf_snippet ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
958 {
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
959 func_lookup_file "modules/$1"
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
960 sed -n -e "/^configure\.ac$sed_extract_prog" < "$lookedup_file"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
961 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
962
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
963 # func_get_automake_snippet module
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
964 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
965 # - local_gnulib_dir from --local-dir
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
966 func_get_automake_snippet ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
967 {
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
968 func_lookup_file "modules/$1"
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
969 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
7497
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
970 case "$1" in
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
971 *-tests)
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
972 # *-tests module live in tests/, not lib/.
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
973 ;;
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
974 *)
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
975 # Synthesize an EXTRA_DIST augmentation.
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
976 sed_combine_lines='/\\$/{
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
977 :a
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
978 N
7599
352da45c182e Interpret a backslash-newline sequence in the Makefile.am snippet as a space.
Bruno Haible <bruno@clisp.org>
parents: 7591
diff changeset
979 s/\\\n/ /
7497
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
980 s/\\$/\\/
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
981 ta
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
982 }'
7754
ed8105720327 * modules/absolute-header: New module.
Eric Blake <ebb9@byu.net>
parents: 7752
diff changeset
983 sed_extract_mentioned_files='s/^lib_SOURCES[ ]*+=[ ]*//p'
7497
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
984 already_mentioned_files=` \
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
985 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file" \
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
986 | sed -e "$sed_combine_lines" \
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
987 | sed -n -e "$sed_extract_mentioned_files" | sed -e 's/#.*//'`
7497
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
988 all_files=`func_get_filelist $1`
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
989 lib_files=`for f in $all_files; do \
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
990 case $f in \
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
991 lib/*) echo $f ;; \
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
992 esac; \
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
993 done | sed -e 's,^lib/,,'`
7497
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
994 # Remove $already_mentioned_files from $lib_files.
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
995 echo "$lib_files" | LC_ALL=C sort -u > "$tmp"/lib-files
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
996 extra_files=`for f in $already_mentioned_files; do echo $f; done \
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
997 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/lib-files`
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
998 if test -n "$extra_files"; then
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
999 echo "EXTRA_DIST +=" $extra_files
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
1000 echo
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
1001 fi
7640
a4d97c9b97de Synthesize also an EXTRA_lib_SOURCES augmentation.
Bruno Haible <bruno@clisp.org>
parents: 7638
diff changeset
1002 # Synthesize also an EXTRA_lib_SOURCES augmentation.
a4d97c9b97de Synthesize also an EXTRA_lib_SOURCES augmentation.
Bruno Haible <bruno@clisp.org>
parents: 7638
diff changeset
1003 # This is necessary so that automake can generate the right list of
a4d97c9b97de Synthesize also an EXTRA_lib_SOURCES augmentation.
Bruno Haible <bruno@clisp.org>
parents: 7638
diff changeset
1004 # dependency rules.
a4d97c9b97de Synthesize also an EXTRA_lib_SOURCES augmentation.
Bruno Haible <bruno@clisp.org>
parents: 7638
diff changeset
1005 # A possible approach would be to use autom4te --trace of the redefined
a4d97c9b97de Synthesize also an EXTRA_lib_SOURCES augmentation.
Bruno Haible <bruno@clisp.org>
parents: 7638
diff changeset
1006 # AC_LIBOBJ and AC_REPLACE_FUNCS macros when creating the Makefile.am
a4d97c9b97de Synthesize also an EXTRA_lib_SOURCES augmentation.
Bruno Haible <bruno@clisp.org>
parents: 7638
diff changeset
1007 # (use autom4te --trace, not just grep, so that AC_LIBOBJ invocations
a4d97c9b97de Synthesize also an EXTRA_lib_SOURCES augmentation.
Bruno Haible <bruno@clisp.org>
parents: 7638
diff changeset
1008 # inside autoconf's built-in macros are not missed).
a4d97c9b97de Synthesize also an EXTRA_lib_SOURCES augmentation.
Bruno Haible <bruno@clisp.org>
parents: 7638
diff changeset
1009 # But it's simpler and more robust to do it here, based on the file list.
a4d97c9b97de Synthesize also an EXTRA_lib_SOURCES augmentation.
Bruno Haible <bruno@clisp.org>
parents: 7638
diff changeset
1010 # If some .c file exists and is not used with AC_LIBOBJ - for example,
a4d97c9b97de Synthesize also an EXTRA_lib_SOURCES augmentation.
Bruno Haible <bruno@clisp.org>
parents: 7638
diff changeset
1011 # a .c file is preprocessed into another .c file for BUILT_SOURCES -,
a4d97c9b97de Synthesize also an EXTRA_lib_SOURCES augmentation.
Bruno Haible <bruno@clisp.org>
parents: 7638
diff changeset
1012 # automake will generate a useless dependency; this is harmless.
8356
72f47158c694 Special handling for the 'relocatable-prog-wrapper' module.
Bruno Haible <bruno@clisp.org>
parents: 8079
diff changeset
1013 case "$1" in
72f47158c694 Special handling for the 'relocatable-prog-wrapper' module.
Bruno Haible <bruno@clisp.org>
parents: 8079
diff changeset
1014 relocatable-prog-wrapper) ;;
72f47158c694 Special handling for the 'relocatable-prog-wrapper' module.
Bruno Haible <bruno@clisp.org>
parents: 8079
diff changeset
1015 *)
72f47158c694 Special handling for the 'relocatable-prog-wrapper' module.
Bruno Haible <bruno@clisp.org>
parents: 8079
diff changeset
1016 sed_extract_c_files='/\.c$/p'
72f47158c694 Special handling for the 'relocatable-prog-wrapper' module.
Bruno Haible <bruno@clisp.org>
parents: 8079
diff changeset
1017 extra_files=`echo "$extra_files" | sed -n -e "$sed_extract_c_files"`
72f47158c694 Special handling for the 'relocatable-prog-wrapper' module.
Bruno Haible <bruno@clisp.org>
parents: 8079
diff changeset
1018 if test -n "$extra_files"; then
72f47158c694 Special handling for the 'relocatable-prog-wrapper' module.
Bruno Haible <bruno@clisp.org>
parents: 8079
diff changeset
1019 echo "EXTRA_lib_SOURCES +=" $extra_files
72f47158c694 Special handling for the 'relocatable-prog-wrapper' module.
Bruno Haible <bruno@clisp.org>
parents: 8079
diff changeset
1020 echo
72f47158c694 Special handling for the 'relocatable-prog-wrapper' module.
Bruno Haible <bruno@clisp.org>
parents: 8079
diff changeset
1021 fi
72f47158c694 Special handling for the 'relocatable-prog-wrapper' module.
Bruno Haible <bruno@clisp.org>
parents: 8079
diff changeset
1022 ;;
72f47158c694 Special handling for the 'relocatable-prog-wrapper' module.
Bruno Haible <bruno@clisp.org>
parents: 8079
diff changeset
1023 esac
7497
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
1024 ;;
6a764f23e302 gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 7486
diff changeset
1025 esac
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1026 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1027
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1028 # func_get_include_directive module
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
1029 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
1030 # - local_gnulib_dir from --local-dir
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1031 func_get_include_directive ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1032 {
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
1033 func_lookup_file "modules/$1"
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1034 sed -n -e "/^Include$sed_extract_prog" < "$lookedup_file" | \
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1035 sed -e 's/^\(["<]\)/#include \1/'
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1036 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1037
8055
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
1038 # func_get_link_directive module
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
1039 # Input:
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
1040 # - local_gnulib_dir from --local-dir
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
1041 func_get_link_directive ()
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
1042 {
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
1043 func_lookup_file "modules/$1"
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
1044 sed -n -e "/^Link$sed_extract_prog" < "$lookedup_file"
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
1045 }
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
1046
5251
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
1047 # func_get_license module
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
1048 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
1049 # - local_gnulib_dir from --local-dir
5251
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
1050 func_get_license ()
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
1051 {
7896
cd3ed2fae0bf Tests modules are under GPL now.
Bruno Haible <bruno@clisp.org>
parents: 7872
diff changeset
1052 func_lookup_file "modules/$1"
cd3ed2fae0bf Tests modules are under GPL now.
Bruno Haible <bruno@clisp.org>
parents: 7872
diff changeset
1053 { sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
cd3ed2fae0bf Tests modules are under GPL now.
Bruno Haible <bruno@clisp.org>
parents: 7872
diff changeset
1054 # The default is GPL.
cd3ed2fae0bf Tests modules are under GPL now.
Bruno Haible <bruno@clisp.org>
parents: 7872
diff changeset
1055 echo "GPL"
cd3ed2fae0bf Tests modules are under GPL now.
Bruno Haible <bruno@clisp.org>
parents: 7872
diff changeset
1056 } | sed -e 's,^ *$,,' | sed -e 1q
5251
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
1057 }
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
1058
4197
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
1059 # func_get_maintainer module
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
1060 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
1061 # - local_gnulib_dir from --local-dir
4197
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
1062 func_get_maintainer ()
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
1063 {
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
1064 func_lookup_file "modules/$1"
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1065 sed -n -e "/^Maintainer$sed_extract_prog" < "$lookedup_file"
4197
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
1066 }
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
1067
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1068 # func_get_tests_module module
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
1069 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
1070 # - local_gnulib_dir from --local-dir
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1071 func_get_tests_module ()
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1072 {
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1073 # The naming convention for tests modules is hardwired: ${module}-tests.
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
1074 if test -f "$gnulib_dir/modules/$1"-tests \
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
1075 || { test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules" \
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
1076 && test -f "$local_gnulib_dir/modules/$1"-tests; }; then
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1077 echo "$1"-tests
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1078 fi
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1079 }
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1080
5981
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
1081 # func_acceptable module
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
1082 # tests whether a module is acceptable.
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
1083 # Input:
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
1084 # - avoidlist list of modules to avoid
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
1085 func_acceptable ()
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
1086 {
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
1087 for avoid in $avoidlist; do
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
1088 if test "$avoid" = "$1"; then
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
1089 return 1
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
1090 fi
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
1091 done
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
1092 return 0
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
1093 }
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
1094
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1095 # func_modules_transitive_closure
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1096 # Input:
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
1097 # - local_gnulib_dir from --local-dir
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1098 # - modules list of specified modules
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1099 # - inctests true if tests should be included, blank otherwise
5981
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
1100 # - avoidlist list of modules to avoid
7320
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1101 # - tmp pathname of a temporary directory
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1102 # Output:
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1103 # - modules list of modules, including dependencies
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1104 func_modules_transitive_closure ()
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1105 {
7320
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1106 # In order to process every module only once (for speed), process an "input
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1107 # list" of modules, producing an "output list" of modules. During each round,
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1108 # more modules can be queued in the input list. Once a module on the input
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1109 # list has been processed, it is added to the "handled list", so we can avoid
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1110 # to process it again.
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1111 handledmodules=
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1112 inmodules="$modules"
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1113 outmodules=
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1114 while test -n "$inmodules"; do
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1115 inmodules_this_round="$inmodules"
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1116 inmodules= # Accumulator, queue for next round
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1117 for module in $inmodules_this_round; do
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1118 func_verify_module
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1119 if test -n "$module"; then
5981
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
1120 if func_acceptable $module; then
7323
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
1121 func_append outmodules " $module"
7320
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1122 deps=`func_get_dependencies $module`
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1123 # Duplicate dependencies are harmless, but Jim wants a warning.
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1124 duplicated_deps=`echo "$deps" | LC_ALL=C sort | LC_ALL=C uniq -d`
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1125 if test -n "$duplicated_deps"; then
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1126 echo "warning: module $module has duplicated dependencies: "`echo $duplicated_deps` 1>&2
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1127 fi
7323
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
1128 func_append inmodules " $deps"
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1129 if test -n "$inctests"; then
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1130 testsmodule=`func_get_tests_module $module`
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1131 if test -n "$testsmodule"; then
7323
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
1132 func_append inmodules " $testsmodule"
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1133 fi
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1134 fi
5981
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
1135 fi
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1136 fi
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1137 done
7320
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1138 handledmodules=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1139 # Remove $handledmodules from $inmodules.
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1140 for m in $inmodules; do echo $m; done | LC_ALL=C sort -u > "$tmp"/queued-modules
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1141 inmodules=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1142 done
7320
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1143 modules=`for m in $outmodules; do echo $m; done | LC_ALL=C sort -u`
9349ee4e633c Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 7319
diff changeset
1144 rm -f "$tmp"/queued-modules
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1145 }
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1146
6550
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1147 # func_modules_add_dummy
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1148 # Input:
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
1149 # - local_gnulib_dir from --local-dir
6550
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1150 # - modules list of modules, including dependencies
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1151 # Output:
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1152 # - modules list of modules, including 'dummy' if needed
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1153 func_modules_add_dummy ()
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1154 {
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1155 have_lib_SOURCES=
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1156 sed_remove_backslash_newline=':a
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1157 /\\$/{
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1158 s/\\$//
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1159 N
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1160 s/\n//
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1161 ba
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1162 }'
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1163 for module in $modules; do
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1164 func_verify_nontests_module
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1165 if test -n "$module"; then
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1166 # Extract the value of "lib_SOURCES += ...".
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1167 for file in `func_get_automake_snippet "$module" | sed -e "$sed_remove_backslash_newline" | sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'`; do
6550
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1168 # Ignore .h files since they are not compiled.
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1169 case "$file" in
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1170 *.h) ;;
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1171 *) have_lib_SOURCES=yes ;;
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1172 esac
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1173 done
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1174 fi
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1175 done
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1176 # Add the dummy module, to make sure the library will be non-empty.
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1177 if test -z "$have_lib_SOURCES"; then
8668
9c0fa5819ce3 2007-04-12 Simon Josefsson <simon@josefsson.org>
Simon Josefsson <simon@josefsson.org>
parents: 8626
diff changeset
1178 if func_acceptable "dummy"; then
9c0fa5819ce3 2007-04-12 Simon Josefsson <simon@josefsson.org>
Simon Josefsson <simon@josefsson.org>
parents: 8626
diff changeset
1179 func_append modules " dummy"
9c0fa5819ce3 2007-04-12 Simon Josefsson <simon@josefsson.org>
Simon Josefsson <simon@josefsson.org>
parents: 8626
diff changeset
1180 fi
6550
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1181 fi
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1182 }
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1183
5348
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1184 # func_modules_to_filelist
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1185 # Input:
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
1186 # - local_gnulib_dir from --local-dir
5348
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1187 # - modules list of modules, including dependencies
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1188 # Output:
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1189 # - files list of files
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1190 func_modules_to_filelist ()
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1191 {
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1192 files=
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1193 for module in $modules; do
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1194 func_verify_module
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1195 if test -n "$module"; then
7323
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
1196 fs=`func_get_filelist $module`
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
1197 func_append files " $fs"
5348
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1198 fi
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1199 done
7319
1726cc39709b Use "sort -u" where it makes sense.
Bruno Haible <bruno@clisp.org>
parents: 7299
diff changeset
1200 files=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
5348
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1201 }
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1202
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1203 # func_emit_lib_Makefile_am
7222
06eec4eaf416 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 7216
diff changeset
1204 # emits the contents of library makefile to standard output.
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1205 # Input:
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
1206 # - local_gnulib_dir from --local-dir
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1207 # - modules list of modules, including dependencies
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1208 # - libname library name
7644
3c0ece164bab Replace build-aux/ also in the Makefile snippet.
Bruno Haible <bruno@clisp.org>
parents: 7643
diff changeset
1209 # - auxdir directory relative to destdir where to place build aux files
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1210 # - makefile_name from --makefile-name
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1211 # - libtool true if libtool will be used, false or blank otherwise
7486
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1212 # - macro_prefix prefix of gl_LIBOBJS macros to use
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1213 # - actioncmd (optional) command that will reproduce this invocation
7981
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1214 # - for_test true if creating a package for testing, false otherwise
7641
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
1215 # Output:
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
1216 # - uses_subdirs nonempty if object files in subdirs exist
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1217 func_emit_lib_Makefile_am ()
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1218 {
7240
e9d3ace50303 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7239
diff changeset
1219 # When creating an includable Makefile.am snippet, augment variables with
e9d3ace50303 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7239
diff changeset
1220 # += instead of assigning them.
e9d3ace50303 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7239
diff changeset
1221 if test -n "$makefile_name"; then
e9d3ace50303 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7239
diff changeset
1222 assign='+='
e9d3ace50303 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7239
diff changeset
1223 else
e9d3ace50303 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7239
diff changeset
1224 assign='='
e9d3ace50303 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7239
diff changeset
1225 fi
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1226 if test "$libtool" = true; then
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1227 libext=la
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1228 perhapsLT=LT
7286
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
1229 sed_eliminate_LDFLAGS=
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1230 else
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1231 libext=a
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1232 perhapsLT=
7335
6a496bee90ff * gnulib-tool: Avoid space-tab.
Eric Blake <ebb9@byu.net>
parents: 7332
diff changeset
1233 sed_eliminate_LDFLAGS='/^lib_LDFLAGS[ ]*+=/d'
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1234 fi
7981
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1235 if $for_test; then
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1236 # When creating a package for testing: Attempt to provoke failures,
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1237 # especially link errors, already during "make" rather than during
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1238 # "make check", because "make check" is not possible in a cross-compiling
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1239 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1240 sed_transform_check_PROGRAMS='s,check_PROGRAMS,noinst_PROGRAMS,g'
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1241 else
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1242 sed_transform_check_PROGRAMS=
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1243 fi
7421
8bace4b08db5 Mark generated files as "DO NOT EDIT".
Bruno Haible <bruno@clisp.org>
parents: 7391
diff changeset
1244 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1245 echo "## Process this file with automake to produce Makefile.in."
6777
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
1246 func_emit_copyright_notice
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1247 if test -n "$actioncmd"; then
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1248 echo "# Reproduce by: $actioncmd"
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1249 fi
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1250 echo
7641
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
1251 uses_subdirs=
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
1252 {
7169
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1253 for module in $modules; do
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1254 func_verify_nontests_module
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1255 if test -n "$module"; then
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1256 {
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1257 func_get_automake_snippet "$module" |
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1258 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1259 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' |
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1260 sed -e "$sed_eliminate_LDFLAGS" |
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1261 sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' |
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1262 sed -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
7981
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1263 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' |
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1264 sed -e "$sed_transform_check_PROGRAMS"
7169
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1265 if test "$module" = 'alloca'; then
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1266 echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
7486
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1267 echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@"
7169
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1268 fi
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1269 } > amsnippet.tmp
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1270 # Skip the contents if its entirely empty.
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1271 if grep '[^ ]' amsnippet.tmp > /dev/null ; then
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1272 echo "## begin gnulib module $module"
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1273 echo
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1274 cat amsnippet.tmp
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1275 echo "## end gnulib module $module"
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1276 echo
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1277 fi
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1278 rm -f amsnippet.tmp
7641
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
1279 # Test whether there are some source files in subdirectories.
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
1280 for f in `func_get_filelist "$module"`; do
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
1281 case $f in
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
1282 lib/*/*.c) uses_subdirs=yes ;;
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
1283 esac
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
1284 done
7169
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1285 fi
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1286 done
7641
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
1287 } > allsnippets.tmp
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
1288 if test -z "$makefile_name"; then
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
1289 # If there are source files in subdirectories, prevent collision of the
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
1290 # object files (example: hash.c and libxml/hash.c).
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
1291 subdir_options=
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
1292 if test -n "$uses_subdirs"; then
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
1293 subdir_options=' subdir-objects'
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
1294 fi
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
1295 echo "AUTOMAKE_OPTIONS = 1.5 gnits${subdir_options}"
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
1296 fi
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
1297 echo
7246
4a748ab30907 * gnulib-tool (func_emit_lib_Makefile_am): Fix typos in
Paul Eggert <eggert@cs.ucla.edu>
parents: 7245
diff changeset
1298 if test -z "$makefile_name"; then
7240
e9d3ace50303 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7239
diff changeset
1299 echo "noinst_HEADERS ="
7701
c59b96cb52c7 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 7691
diff changeset
1300 echo "noinst_LIBRARIES ="
7691
33b654c2cba8 Initialize also noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 7660
diff changeset
1301 echo "noinst_LTLIBRARIES ="
7270
3d4ebfd658b2 A comment about automake-1.9b.
Bruno Haible <bruno@clisp.org>
parents: 7264
diff changeset
1302 # Automake versions < 1.9b create an empty pkgdatadir at installation time
3d4ebfd658b2 A comment about automake-1.9b.
Bruno Haible <bruno@clisp.org>
parents: 7264
diff changeset
1303 # if you specify pkgdata_DATA to empty. This is a workaround.
7240
e9d3ace50303 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7239
diff changeset
1304 if grep '^pkgdata_DATA *+=' allsnippets.tmp > /dev/null; then
e9d3ace50303 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7239
diff changeset
1305 echo "pkgdata_DATA ="
e9d3ace50303 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7239
diff changeset
1306 fi
e9d3ace50303 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7239
diff changeset
1307 echo "EXTRA_DIST ="
e9d3ace50303 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7239
diff changeset
1308 echo "BUILT_SOURCES ="
e9d3ace50303 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7239
diff changeset
1309 echo "SUFFIXES ="
7169
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1310 fi
7240
e9d3ace50303 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7239
diff changeset
1311 echo "MOSTLYCLEANFILES $assign core *.stackdump"
7246
4a748ab30907 * gnulib-tool (func_emit_lib_Makefile_am): Fix typos in
Paul Eggert <eggert@cs.ucla.edu>
parents: 7245
diff changeset
1312 if test -z "$makefile_name"; then
7240
e9d3ace50303 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7239
diff changeset
1313 echo "MOSTLYCLEANDIRS ="
e9d3ace50303 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7239
diff changeset
1314 echo "CLEANFILES ="
e9d3ace50303 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7239
diff changeset
1315 echo "DISTCLEANFILES ="
e9d3ace50303 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7239
diff changeset
1316 echo "MAINTAINERCLEANFILES ="
e9d3ace50303 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7239
diff changeset
1317 echo
e9d3ace50303 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7239
diff changeset
1318 echo "AM_CPPFLAGS ="
e9d3ace50303 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7239
diff changeset
1319 fi
6750
608add4e5b80 Support for packages that use "gettextize --intl". From Claudio Fontana.
Bruno Haible <bruno@clisp.org>
parents: 6745
diff changeset
1320 echo
8040
3905dae579b6 * gnulib-tool (func_emit_lib_Makefile_am, func_add_or_update)
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7981
diff changeset
1321 if LC_ALL=C grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *= *$libname\\.$libext\$" allsnippets.tmp > /dev/null; then
7701
c59b96cb52c7 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 7691
diff changeset
1322 # One of the snippets already specifies an installation location for the
c59b96cb52c7 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 7691
diff changeset
1323 # library. Don't confuse automake by saying it should not be installed.
c59b96cb52c7 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 7691
diff changeset
1324 :
c59b96cb52c7 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 7691
diff changeset
1325 else
c59b96cb52c7 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 7691
diff changeset
1326 # By default, the generated library should not be installed.
c59b96cb52c7 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 7691
diff changeset
1327 echo "noinst_${perhapsLT}LIBRARIES += $libname.$libext"
c59b96cb52c7 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 7691
diff changeset
1328 fi
c59b96cb52c7 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 7691
diff changeset
1329 echo
c59b96cb52c7 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 7691
diff changeset
1330 echo "${libname}_${libext}_SOURCES ="
c59b96cb52c7 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 7691
diff changeset
1331 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
c59b96cb52c7 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 7691
diff changeset
1332 # automake during its analyses looks for $(LIBOBJS), not for @LIBOBJS@.
c59b96cb52c7 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 7691
diff changeset
1333 echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
c59b96cb52c7 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 7691
diff changeset
1334 echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
c59b96cb52c7 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 7691
diff changeset
1335 echo "EXTRA_${libname}_${libext}_SOURCES ="
c59b96cb52c7 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 7691
diff changeset
1336 if test "$libtool" = true; then
c59b96cb52c7 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 7691
diff changeset
1337 echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)"
c59b96cb52c7 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 7691
diff changeset
1338 fi
c59b96cb52c7 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 7691
diff changeset
1339 echo
7644
3c0ece164bab Replace build-aux/ also in the Makefile snippet.
Bruno Haible <bruno@clisp.org>
parents: 7643
diff changeset
1340 cat allsnippets.tmp \
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1341 | sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
5357
8bce169f70cc Fix comments. Fix parse problem.
Simon Josefsson <simon@josefsson.org>
parents: 5356
diff changeset
1342 echo
7086
ba6d3c85213f Fix for "make -j 3".
Bruno Haible <bruno@clisp.org>
parents: 7079
diff changeset
1343 echo "mostlyclean-local: mostlyclean-generic"
7545
fade8d6feee3 Avoid syntax error from bash 2.00 ... 2.05.
Bruno Haible <bruno@clisp.org>
parents: 7533
diff changeset
1344 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
fade8d6feee3 Avoid syntax error from bash 2.00 ... 2.05.
Bruno Haible <bruno@clisp.org>
parents: 7533
diff changeset
1345 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
fade8d6feee3 Avoid syntax error from bash 2.00 ... 2.05.
Bruno Haible <bruno@clisp.org>
parents: 7533
diff changeset
1346 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
fade8d6feee3 Avoid syntax error from bash 2.00 ... 2.05.
Bruno Haible <bruno@clisp.org>
parents: 7533
diff changeset
1347 echo " fi; \\"
fade8d6feee3 Avoid syntax error from bash 2.00 ... 2.05.
Bruno Haible <bruno@clisp.org>
parents: 7533
diff changeset
1348 echo " done"
7169
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1349 rm -f allsnippets.tmp
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1350 }
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1351
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1352 # func_emit_tests_Makefile_am
7222
06eec4eaf416 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 7216
diff changeset
1353 # emits the contents of tests makefile to standard output.
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1354 # Input:
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
1355 # - local_gnulib_dir from --local-dir
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1356 # - modules list of modules, including dependencies
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1357 # - libname library name
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1358 # - makefile_name from --makefile-name
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1359 # - libtool true if libtool will be used, false or blank otherwise
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1360 # - sourcebase relative directory containing lib source code
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1361 # - m4base relative directory containing autoconf macros
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1362 # - testsbase relative directory containing unit test code
7981
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1363 # - for_test true if creating a package for testing, false otherwise
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1364 func_emit_tests_Makefile_am ()
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1365 {
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1366 if test "$libtool" = true; then
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1367 libext=la
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1368 else
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1369 libext=a
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1370 fi
7286
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
1371 if test "$libtool" = true; then
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
1372 libext=la
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
1373 sed_eliminate_LDFLAGS=
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
1374 else
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
1375 libext=a
7335
6a496bee90ff * gnulib-tool: Avoid space-tab.
Eric Blake <ebb9@byu.net>
parents: 7332
diff changeset
1376 sed_eliminate_LDFLAGS='/^lib_LDFLAGS[ ]*+=/d'
7286
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
1377 fi
7981
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1378 if $for_test; then
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1379 # When creating a package for testing: Attempt to provoke failures,
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1380 # especially link errors, already during "make" rather than during
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1381 # "make check", because "make check" is not possible in a cross-compiling
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1382 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1383 sed_transform_check_PROGRAMS='s,check_PROGRAMS,noinst_PROGRAMS,g'
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1384 else
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1385 sed_transform_check_PROGRAMS=
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1386 fi
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1387 testsbase_inverse=`echo "$testsbase" | sed -e 's,/$,,' | sed -e 's,[^/][^/]*,..,g'`
7421
8bace4b08db5 Mark generated files as "DO NOT EDIT".
Bruno Haible <bruno@clisp.org>
parents: 7391
diff changeset
1388 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1389 echo "## Process this file with automake to produce Makefile.in."
6777
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
1390 func_emit_copyright_notice
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1391 echo
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1392 # Generate dependencies here, since it eases the debugging of test failures.
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1393 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1394 echo
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1395 echo "ACLOCAL_AMFLAGS = -I ${testsbase_inverse}/${m4base}"
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1396 echo
7169
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1397 (
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1398 for module in $modules; do
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1399 func_verify_tests_module
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1400 if test -n "$module"; then
7286
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
1401 {
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
1402 func_get_automake_snippet "$module" |
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1403 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1404 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' |
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1405 sed -e "$sed_eliminate_LDFLAGS" |
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1406 sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' |
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1407 sed -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
7981
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1408 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' |
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1409 sed -e "$sed_transform_check_PROGRAMS"
7286
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
1410 } > amsnippet.tmp
7169
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1411 # Skip the contents if its entirely empty.
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1412 if grep '[^ ]' amsnippet.tmp > /dev/null ; then
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1413 echo "## begin gnulib module $module"
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1414 echo
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1415 cat amsnippet.tmp
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1416 echo "## end gnulib module $module"
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1417 echo
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1418 fi
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1419 rm -f amsnippet.tmp
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1420 fi
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1421 done
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1422 ) > allsnippets.tmp
6533
6bc4290ca85f Avoid an automake error regarding the 'gettext' module.
Bruno Haible <bruno@clisp.org>
parents: 6512
diff changeset
1423 # Nothing is being added to SUBDIRS; nevertheless the existence of this
6bc4290ca85f Avoid an automake error regarding the 'gettext' module.
Bruno Haible <bruno@clisp.org>
parents: 6512
diff changeset
1424 # variable is needed to avoid an error from automake:
6bc4290ca85f Avoid an automake error regarding the 'gettext' module.
Bruno Haible <bruno@clisp.org>
parents: 6512
diff changeset
1425 # "AM_GNU_GETTEXT used but SUBDIRS not defined"
6bc4290ca85f Avoid an automake error regarding the 'gettext' module.
Bruno Haible <bruno@clisp.org>
parents: 6512
diff changeset
1426 echo "SUBDIRS ="
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1427 echo "TESTS ="
6380
9bc99115d4d6 Small tweaks.
Bruno Haible <bruno@clisp.org>
parents: 6264
diff changeset
1428 echo "TESTS_ENVIRONMENT ="
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1429 echo "noinst_PROGRAMS ="
7981
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1430 if ! $for_test; then
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1431 echo "check_PROGRAMS ="
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
1432 fi
6548
060487c0b13c Initialize also noinst_HEADERS to empty.
Bruno Haible <bruno@clisp.org>
parents: 6547
diff changeset
1433 echo "noinst_HEADERS ="
7169
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1434 if grep '^pkgdata_DATA *+=' allsnippets.tmp > /dev/null; then
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1435 echo "pkgdata_DATA ="
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1436 fi
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1437 echo "EXTRA_DIST ="
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1438 echo "BUILT_SOURCES ="
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1439 echo "SUFFIXES ="
7079
ecd48b98b094 Clean core dumps.
Bruno Haible <bruno@clisp.org>
parents: 7078
diff changeset
1440 echo "MOSTLYCLEANFILES = core *.stackdump"
6862
ba1b5722df42 Invent MOSTLYCLEANDIRS.
Bruno Haible <bruno@clisp.org>
parents: 6777
diff changeset
1441 echo "MOSTLYCLEANDIRS ="
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1442 echo "CLEANFILES ="
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1443 echo "DISTCLEANFILES ="
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1444 echo "MAINTAINERCLEANFILES ="
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1445 echo
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1446 echo "AM_CPPFLAGS = \\"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1447 echo " -I. -I\$(srcdir) \\"
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1448 echo " -I${testsbase_inverse} -I\$(srcdir)/${testsbase_inverse} \\"
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1449 echo " -I${testsbase_inverse}/${sourcebase-lib} -I\$(srcdir)/${testsbase_inverse}/${sourcebase-lib}"
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1450 echo
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1451 echo "LDADD = ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext}"
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1452 echo
7169
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1453 cat allsnippets.tmp
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1454 echo "# Clean up after Solaris cc."
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1455 echo "clean-local:"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1456 echo " rm -rf SunWS_cache"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1457 echo
7086
ba6d3c85213f Fix for "make -j 3".
Bruno Haible <bruno@clisp.org>
parents: 7079
diff changeset
1458 echo "mostlyclean-local: mostlyclean-generic"
7545
fade8d6feee3 Avoid syntax error from bash 2.00 ... 2.05.
Bruno Haible <bruno@clisp.org>
parents: 7533
diff changeset
1459 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
fade8d6feee3 Avoid syntax error from bash 2.00 ... 2.05.
Bruno Haible <bruno@clisp.org>
parents: 7533
diff changeset
1460 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
fade8d6feee3 Avoid syntax error from bash 2.00 ... 2.05.
Bruno Haible <bruno@clisp.org>
parents: 7533
diff changeset
1461 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
fade8d6feee3 Avoid syntax error from bash 2.00 ... 2.05.
Bruno Haible <bruno@clisp.org>
parents: 7533
diff changeset
1462 echo " fi; \\"
fade8d6feee3 Avoid syntax error from bash 2.00 ... 2.05.
Bruno Haible <bruno@clisp.org>
parents: 7533
diff changeset
1463 echo " done"
7169
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1464 rm -f allsnippets.tmp
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1465 }
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1466
7486
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1467 # func_emit_initmacro_start
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1468 # emits the first few statements of the gl_INIT macro to standard output.
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1469 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1470 func_emit_initmacro_start ()
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1471 {
7646
33bd42644eec Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 7644
diff changeset
1472 # Overriding AC_LIBOBJ and AC_REPLACE_FUNCS has the effect of storing
33bd42644eec Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 7644
diff changeset
1473 # platform-dependent object files in ${macro_prefix}_LIBOBJS instead of
33bd42644eec Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 7644
diff changeset
1474 # LIBOBJS. The purpose is to allow several gnulib instantiations under
33bd42644eec Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 7644
diff changeset
1475 # a single configure.ac file. (AC_CONFIG_LIBOBJ_DIR does not allow this
33bd42644eec Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 7644
diff changeset
1476 # flexibility.)
33bd42644eec Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 7644
diff changeset
1477 # Furthermore it avoids an automake error like this when a Makefile.am
33bd42644eec Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 7644
diff changeset
1478 # that uses pieces of gnulib also uses $(LIBOBJ):
33bd42644eec Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 7644
diff changeset
1479 # automatically discovered file `error.c' should not be explicitly mentioned
7486
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1480 echo " m4_pushdef([AC_LIBOBJ], m4_defn([${macro_prefix}_LIBOBJ]))"
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1481 echo " m4_pushdef([AC_REPLACE_FUNCS], m4_defn([${macro_prefix}_REPLACE_FUNCS]))"
7646
33bd42644eec Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 7644
diff changeset
1482 # Overriding AC_LIBSOURCES has the same purpose of avoiding the automake
33bd42644eec Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 7644
diff changeset
1483 # error when a Makefile.am that uses pieces of gnulib also uses $(LIBOBJ):
33bd42644eec Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 7644
diff changeset
1484 # automatically discovered file `error.c' should not be explicitly mentioned
33bd42644eec Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 7644
diff changeset
1485 # We let automake know about the files to be distributed through the
33bd42644eec Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 7644
diff changeset
1486 # EXTRA_lib_SOURCES variable.
33bd42644eec Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 7644
diff changeset
1487 echo " m4_pushdef([AC_LIBSOURCES], m4_defn([${macro_prefix}_LIBSOURCES]))"
7486
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1488 }
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1489
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1490 # func_emit_initmacro_end
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1491 # emits the last few statements of the gl_INIT macro to standard output.
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1492 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1493 func_emit_initmacro_end ()
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1494 {
7646
33bd42644eec Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 7644
diff changeset
1495 echo " m4_popdef([AC_LIBSOURCES])"
7486
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1496 echo " m4_popdef([AC_REPLACE_FUNCS])"
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1497 echo " m4_popdef([AC_LIBOBJ])"
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1498 echo " AC_CONFIG_COMMANDS_PRE(["
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1499 echo " ${macro_prefix}_libobjs="
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1500 echo " ${macro_prefix}_ltlibobjs="
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1501 echo " if test -n \"\$${macro_prefix}_LIBOBJS\"; then"
7528
472795eea368 Remove duplicates from the gl_LIBOBJS list.
Bruno Haible <bruno@clisp.org>
parents: 7497
diff changeset
1502 echo " # Remove the extension."
472795eea368 Remove duplicates from the gl_LIBOBJS list.
Bruno Haible <bruno@clisp.org>
parents: 7497
diff changeset
1503 echo " sed_drop_objext='s/\\.o\$//;s/\\.obj\$//'"
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1504 echo " for i in \`for i in \$${macro_prefix}_LIBOBJS; do echo \"\$i\"; done | sed \"\$sed_drop_objext\" | sort | uniq\`; do"
7486
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1505 echo " ${macro_prefix}_libobjs=\"\$${macro_prefix}_libobjs \$i.\$ac_objext\""
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1506 echo " ${macro_prefix}_ltlibobjs=\"\$${macro_prefix}_ltlibobjs \$i.lo\""
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1507 echo " done"
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1508 echo " fi"
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1509 echo " AC_SUBST([${macro_prefix}_LIBOBJS], [\$${macro_prefix}_libobjs])"
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1510 echo " AC_SUBST([${macro_prefix}_LTLIBOBJS], [\$${macro_prefix}_ltlibobjs])"
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1511 echo " ])"
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1512 }
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1513
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1514 # func_emit_initmacro_done
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1515 # emits a few statements after the gl_INIT macro to standard output.
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1516 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1517 func_emit_initmacro_done ()
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1518 {
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1519 echo
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1520 echo "# Like AC_LIBOBJ, except that the module name goes"
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1521 echo "# into ${macro_prefix}_LIBOBJS instead of into LIBOBJS."
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1522 echo "AC_DEFUN([${macro_prefix}_LIBOBJ],"
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1523 echo " [${macro_prefix}_LIBOBJS=\"\$${macro_prefix}_LIBOBJS \$1.\$ac_objext\"])"
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1524 echo
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1525 echo "# Like AC_REPLACE_FUNCS, except that the module name goes"
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1526 echo "# into ${macro_prefix}_LIBOBJS instead of into LIBOBJS."
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1527 echo "AC_DEFUN([${macro_prefix}_REPLACE_FUNCS],"
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1528 echo " [AC_CHECK_FUNCS([\$1], , [${macro_prefix}_LIBOBJ(\$ac_func)])])"
7646
33bd42644eec Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 7644
diff changeset
1529 echo
33bd42644eec Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 7644
diff changeset
1530 echo "# Like AC_LIBSOURCES, except that it does nothing."
33bd42644eec Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 7644
diff changeset
1531 echo "# We rely on EXTRA_lib..._SOURCES instead."
33bd42644eec Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 7644
diff changeset
1532 echo "AC_DEFUN([${macro_prefix}_LIBSOURCES],"
33bd42644eec Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 7644
diff changeset
1533 echo " [])"
7486
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1534 }
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
1535
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1536 # func_import modules
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1537 # Uses also the variables
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1538 # - destdir target directory
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
1539 # - local_gnulib_dir from --local-dir
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1540 # - libname library name
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1541 # - sourcebase directory relative to destdir where to place source code
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1542 # - m4base directory relative to destdir where to place *.m4 macros
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
1543 # - docbase directory relative to destdir where to place doc files
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1544 # - testsbase directory relative to destdir where to place unit test code
6109
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
1545 # - auxdir directory relative to destdir where to place build aux files
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1546 # - inctests true if --with-tests was given, blank otherwise
5981
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
1547 # - avoidlist list of modules to avoid, from --avoid
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
1548 # - lgpl true if library's license shall be LGPL, blank otherwise
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1549 # - makefile_name from --makefile-name
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1550 # - libtool true if --libtool was given, false if --no-libtool was
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1551 # given, blank otherwise
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1552 # - guessed_libtool true if the configure.ac file uses libtool, false otherwise
6176
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
1553 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
6994
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
1554 # - autoconf_minversion minimum supported autoconf version
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1555 # - doit : if actions shall be executed, false if only to be printed
5799
ad9eff556694 2005-04-15 Simon Josefsson <jas@extundo.com>
Simon Josefsson <simon@josefsson.org>
parents: 5798
diff changeset
1556 # - symbolic true if files should be symlinked, copied otherwise
7643
d67f9dc6019d New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 7642
diff changeset
1557 # - lsymbolic true if files from local_gnulib_dir should be symlinked,
d67f9dc6019d New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 7642
diff changeset
1558 # copied otherwise
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1559 func_import ()
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1560 {
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1561 # Get the cached settings.
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1562 cached_local_gnulib_dir=
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1563 cached_specified_modules=
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1564 cached_avoidlist=
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1565 cached_sourcebase=
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1566 cached_m4base=
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
1567 cached_docbase=
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1568 cached_testsbase=
8890
576d3e4f31c2 Remember the presence of the --with-tests command-line option through
Bruno Haible <bruno@clisp.org>
parents: 8672
diff changeset
1569 cached_inctests=
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1570 cached_libname=
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1571 cached_lgpl=
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1572 cached_makefile_name=
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1573 cached_libtool=
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1574 cached_macro_prefix=
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1575 cached_files=
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1576 if test -f "$destdir"/$m4base/gnulib-cache.m4; then
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1577 cached_libtool=false
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1578 my_sed_traces='
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1579 s,#.*$,,
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1580 s,^dnl .*$,,
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1581 s, dnl .*$,,
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1582 /gl_LOCAL_DIR(/ {
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1583 s,^.*gl_LOCAL_DIR([[ ]*\([^])]*\).*$,cached_local_gnulib_dir="\1",p
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1584 }
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1585 /gl_MODULES(/ {
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1586 s,^.*gl_MODULES([[ ]*\([^])]*\).*$,cached_specified_modules="\1",p
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1587 }
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1588 /gl_AVOID(/ {
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1589 s,^.*gl_AVOID([[ ]*\([^])]*\).*$,cached_avoidlist="\1",p
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1590 }
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1591 /gl_SOURCE_BASE(/ {
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1592 s,^.*gl_SOURCE_BASE([[ ]*\([^])]*\).*$,cached_sourcebase="\1",p
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1593 }
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1594 /gl_M4_BASE(/ {
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1595 s,^.*gl_M4_BASE([[ ]*\([^])]*\).*$,cached_m4base="\1",p
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1596 }
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
1597 /gl_DOC_BASE(/ {
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
1598 s,^.*gl_DOC_BASE([[ ]*\([^])]*\).*$,cached_docbase="\1",p
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
1599 }
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1600 /gl_TESTS_BASE(/ {
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1601 s,^.*gl_TESTS_BASE([[ ]*\([^])]*\).*$,cached_testsbase="\1",p
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1602 }
8890
576d3e4f31c2 Remember the presence of the --with-tests command-line option through
Bruno Haible <bruno@clisp.org>
parents: 8672
diff changeset
1603 /gl_WITH_TESTS/ {
576d3e4f31c2 Remember the presence of the --with-tests command-line option through
Bruno Haible <bruno@clisp.org>
parents: 8672
diff changeset
1604 s,^.*$,cached_inctests=true,p
576d3e4f31c2 Remember the presence of the --with-tests command-line option through
Bruno Haible <bruno@clisp.org>
parents: 8672
diff changeset
1605 }
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1606 /gl_LIB(/ {
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1607 s,^.*gl_LIB([[ ]*\([^])]*\).*$,cached_libname="\1",p
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1608 }
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1609 /gl_LGPL/ {
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1610 s,^.*$,cached_lgpl=true,p
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1611 }
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1612 /gl_MAKEFILE_NAME(/ {
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1613 s,^.*gl_MAKEFILE_NAME([[ ]*\([^])]*\).*$,cached_makefile_name="\1",p
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1614 }
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1615 /gl_LIBTOOL/ {
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1616 s,^.*$,cached_libtool=true,p
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1617 }
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1618 /gl_MACRO_PREFIX(/ {
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1619 s,^.*gl_MACRO_PREFIX([[ ]*\([^])]*\).*$,cached_macro_prefix="\1",p
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1620 }'
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1621 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-cache.m4`
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1622 if test -f "$destdir"/$m4base/gnulib-comp.m4; then
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1623 my_sed_traces='
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1624 s,#.*$,,
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1625 s,^dnl .*$,,
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1626 s, dnl .*$,,
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1627 /AC_DEFUN(\['"${cached_macro_prefix}"'_FILE_LIST\], \[/ {
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1628 s,^.*$,cached_files=",p
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1629 n
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1630 ta
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1631 :a
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1632 s,^\]).*$,",
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1633 tb
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1634 p
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1635 n
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1636 ba
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1637 :b
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1638 p
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1639 }'
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1640 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-comp.m4`
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1641 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1642 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1643
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1644 # Merge the cached settings with the specified ones.
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1645 # The m4base must be the same as expected from the pathname.
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1646 if test -n "$cached_m4base" && test "$cached_m4base" != "$m4base"; then
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1647 func_fatal_error "$m4base/gnulib-cache.m4 is expected to contain gl_M4_BASE([$m4base])"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1648 fi
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1649 # The local_gnulib_dir defaults to the cached one. Recall that the cached one
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1650 # is relative to $destdir, whereas the one we use is relative to . or absolute.
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1651 if test -z "$local_gnulib_dir"; then
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1652 if test -n "$cached_local_gnulib_dir"; then
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1653 case "$destdir" in
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1654 /*)
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1655 local_gnulib_dir="$destdir/$cached_local_gnulib_dir" ;;
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1656 *)
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1657 case "$cached_local_gnulib_dir" in
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1658 /*)
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1659 local_gnulib_dir="$destdir/$cached_local_gnulib_dir" ;;
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1660 *)
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1661 func_relconcat "$destdir" "$cached_local_gnulib_dir"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1662 local_gnulib_dir="$relconcat" ;;
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1663 esac ;;
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1664 esac
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1665 fi
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1666 fi
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1667 # Append the cached and the specified module names. So that
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1668 # "gnulib-tool --import foo" means to add the module foo.
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1669 specified_modules="$cached_specified_modules $1"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1670 # Append the cached and the specified avoidlist. This is probably better
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1671 # than dropping the cached one when --avoid is specified at least once.
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1672 avoidlist=`echo $cached_avoidlist $avoidlist`
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1673 # The sourcebase defaults to the cached one.
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1674 if test -z "$sourcebase"; then
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1675 sourcebase="$cached_sourcebase"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1676 if test -z "$sourcebase"; then
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1677 func_fatal_error "missing --source-base option"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1678 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1679 fi
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
1680 # The docbase defaults to the cached one.
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
1681 if test -z "$docbase"; then
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
1682 docbase="$cached_docbase"
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
1683 if test -z "$docbase"; then
7076
0e471c8eb020 Tweak error message about missing --doc-base.
Bruno Haible <bruno@clisp.org>
parents: 7073
diff changeset
1684 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."
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
1685 fi
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
1686 fi
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1687 # The testsbase defaults to the cached one.
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1688 if test -z "$testsbase"; then
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1689 testsbase="$cached_testsbase"
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1690 if test -z "$testsbase"; then
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1691 func_fatal_error "missing --tests-base option"
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1692 fi
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1693 fi
8890
576d3e4f31c2 Remember the presence of the --with-tests command-line option through
Bruno Haible <bruno@clisp.org>
parents: 8672
diff changeset
1694 # Require the tests if specified either way.
576d3e4f31c2 Remember the presence of the --with-tests command-line option through
Bruno Haible <bruno@clisp.org>
parents: 8672
diff changeset
1695 if test -z "$inctests"; then
576d3e4f31c2 Remember the presence of the --with-tests command-line option through
Bruno Haible <bruno@clisp.org>
parents: 8672
diff changeset
1696 inctests="$cached_inctests"
576d3e4f31c2 Remember the presence of the --with-tests command-line option through
Bruno Haible <bruno@clisp.org>
parents: 8672
diff changeset
1697 fi
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1698 # The libname defaults to the cached one.
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
1699 if test -z "$supplied_libname"; then
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1700 libname="$cached_libname"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1701 if test -z "$libname"; then
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1702 func_fatal_error "missing --lib option"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1703 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1704 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1705 # Require LGPL if specified either way.
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1706 if test -z "$lgpl"; then
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1707 lgpl="$cached_lgpl"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1708 fi
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1709 # The makefile_name defaults to the cached one.
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1710 if test -z "$makefile_name"; then
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1711 makefile_name="$cached_makefile_name"
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1712 fi
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
1713 # Use libtool if specified either way, or if guessed.
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1714 if test -z "$libtool"; then
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
1715 if test -n "$cached_m4base"; then
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
1716 libtool="$cached_libtool"
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
1717 else
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
1718 libtool="$guessed_libtool"
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
1719 fi
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1720 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1721 # The macro_prefix defaults to the cached one.
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1722 if test -z "$macro_prefix"; then
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1723 macro_prefix="$cached_macro_prefix"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1724 if test -z "$macro_prefix"; then
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1725 func_fatal_error "missing --macro-prefix option"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1726 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1727 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1728
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1729 # Canonicalize the list of specified modules.
7319
1726cc39709b Use "sort -u" where it makes sense.
Bruno Haible <bruno@clisp.org>
parents: 7299
diff changeset
1730 specified_modules=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1731
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1732 # Determine final module list.
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1733 modules="$specified_modules"
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1734 func_modules_transitive_closure
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1735 echo "Module list with included dependencies:"
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1736 echo "$modules" | sed -e 's/^/ /'
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1737
6550
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1738 # Add the dummy module if needed.
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1739 func_modules_add_dummy
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1740
7235
3dbbe645b976 * MODULES.html.sh (Support for building documentation): Add gpl, lgpl.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7222
diff changeset
1741 # If --lgpl, verify that the licenses of modules are compatible.
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1742 if test -n "$lgpl"; then
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1743 for module in $modules; do
5346
40f5d74050d5 Use func_get_license.
Bruno Haible <bruno@clisp.org>
parents: 5345
diff changeset
1744 license=`func_get_license $module`
5963
6fb8c48c4dcd * gnulib-tool (func_import): Add support for 'public domain' license.
Paul Eggert <eggert@cs.ucla.edu>
parents: 5848
diff changeset
1745 case $license in
7235
3dbbe645b976 * MODULES.html.sh (Support for building documentation): Add gpl, lgpl.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7222
diff changeset
1746 LGPL | 'GPLed build tool') ;;
7245
138333fc7a90 Improve maintainability.
Bruno Haible <bruno@clisp.org>
parents: 7241
diff changeset
1747 'public domain' | 'unlimited' | 'unmodifiable license text') ;;
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1748 *) func_fatal_error "incompatible license on module $module: $license" ;;
5963
6fb8c48c4dcd * gnulib-tool (func_import): Add support for 'public domain' license.
Paul Eggert <eggert@cs.ucla.edu>
parents: 5848
diff changeset
1749 esac
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1750 done
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1751 fi
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1752
7199
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
1753 # Determine script to apply to imported library files.
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
1754 sed_transform_lib_file=
7245
138333fc7a90 Improve maintainability.
Bruno Haible <bruno@clisp.org>
parents: 7241
diff changeset
1755 for module in $modules; do
138333fc7a90 Improve maintainability.
Bruno Haible <bruno@clisp.org>
parents: 7241
diff changeset
1756 if test $module = config-h; then
7199
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
1757 # Assume config.h exists, and that -DHAVE_CONFIG_H is omitted.
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
1758 sed_transform_lib_file=$sed_transform_lib_file'
7245
138333fc7a90 Improve maintainability.
Bruno Haible <bruno@clisp.org>
parents: 7241
diff changeset
1759 s/^#ifdef[ ]*HAVE_CONFIG_H[ ]*$/#if 1/
138333fc7a90 Improve maintainability.
Bruno Haible <bruno@clisp.org>
parents: 7241
diff changeset
1760 '
138333fc7a90 Improve maintainability.
Bruno Haible <bruno@clisp.org>
parents: 7241
diff changeset
1761 break
138333fc7a90 Improve maintainability.
Bruno Haible <bruno@clisp.org>
parents: 7241
diff changeset
1762 fi
138333fc7a90 Improve maintainability.
Bruno Haible <bruno@clisp.org>
parents: 7241
diff changeset
1763 done
7199
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
1764 if test -n "$lgpl"; then
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
1765 # Update license.
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
1766 sed_transform_lib_file=$sed_transform_lib_file'
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
1767 s/GNU General/GNU Lesser General/g
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
1768 s/version 2\([ ,]\)/version 2.1\1/g
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
1769 '
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
1770 fi
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
1771
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1772 # Determine final file list.
5348
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1773 func_modules_to_filelist
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1774 echo "File list:"
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1775 echo "$files" | sed -e 's/^/ /'
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1776
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1777 test -n "$files" \
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1778 || func_fatal_error "refusing to do nothing"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1779
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1780 # Add m4/gnulib-tool.m4 to the file list. It is not part of any module.
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1781 new_files="$files m4/gnulib-tool.m4"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1782 old_files="$cached_files"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1783 if test -f "$destdir"/$m4base/gnulib-tool.m4; then
7323
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
1784 func_append old_files " m4/gnulib-tool.m4"
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1785 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1786
7605
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1787 sed_rewrite_old_files="\
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1788 s,^build-aux/,$auxdir/,
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1789 s,^doc/,$cached_docbase/,
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1790 s,^lib/,$cached_sourcebase/,
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1791 s,^m4/,$cached_m4base/,
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1792 s,^tests/,$cached_testsbase/,"
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1793 sed_rewrite_new_files="\
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1794 s,^build-aux/,$auxdir/,
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1795 s,^doc/,$docbase/,
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1796 s,^lib/,$sourcebase/,
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1797 s,^m4/,$m4base/,
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1798 s,^tests/,$testsbase/,"
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1799
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
1800 # Create directories.
7605
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1801 { echo "$sourcebase"
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1802 echo "$m4base"
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1803 docfiles=`echo "$files" | sed -n -e 's,^doc/,,p'`
7605
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1804 if test -n "$docfiles"; then
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1805 echo "$docbase"
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1806 fi
7605
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1807 if test -n "$inctests"; then
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1808 echo "$testsbase"
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
1809 fi
7605
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1810 echo "$auxdir"
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1811 for f in $files; do echo $f; done \
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1812 | sed -e "$sed_rewrite_new_files" \
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1813 | sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
7605
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1814 | LC_ALL=C sort -u
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1815 } > "$tmp"/dirs
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1816 { # Rearrange file descriptors. Needed because "while ... done < ..."
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1817 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1818 exec 5<&0 < "$tmp"/dirs
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1819 while read d; do
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1820 if test ! -d "$destdir/$d"; then
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1821 if $doit; then
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1822 echo "Creating directory $destdir/$d"
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1823 mkdir -p "$destdir/$d" || func_fatal_error "failed"
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1824 else
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1825 echo "Create directory $destdir/$d"
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1826 fi
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1827 fi
7605
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1828 done
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1829 exec 0<&5 5<&-
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
1830 }
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
1831
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1832 # func_dest_tmpfilename file
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1833 # determines the name of a temporary file (file is relative to destdir).
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1834 # Sets variable:
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1835 # - tmpfile absolute filename of the temporary file
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1836 func_dest_tmpfilename ()
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1837 {
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1838 if $doit; then
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1839 # Put the new contents of $file in a file in the same directory (needed
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1840 # to guarantee that an 'mv' to "$destdir/$file" works).
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1841 tmpfile="$destdir/$1.tmp"
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1842 else
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1843 # Put the new contents of $file in a file in a temporary directory
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1844 # (because the directory of "$file" might not exist).
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1845 tmpfile="$tmp"/`basename "$1"`.tmp
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1846 fi
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1847 }
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1848
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1849 # Copy files or make symbolic links. Remove obsolete files.
8451
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
1850 added_files=''
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
1851 removed_files=''
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1852 delimiter=' '
7321
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
1853 # Construct a table with 2 columns: rewritten-file-name original-file-name,
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
1854 # representing the files according to the last gnulib-tool invocation.
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
1855 for f in $old_files; do echo $f; done \
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1856 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_old_files" \
7321
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
1857 | LC_ALL=C sort \
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
1858 > "$tmp"/old-files
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
1859 # Construct a table with 2 columns: rewritten-file-name original-file-name,
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
1860 # representing the files after this gnulib-tool invocation.
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
1861 for f in $new_files; do echo $f; done \
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1862 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" \
7321
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
1863 | LC_ALL=C sort \
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
1864 > "$tmp"/new-files
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1865 # First the files that are in old-files, but not in new-files:
6595
0c67f1400c5b Fix portability problem to Solaris 9 sh.
Bruno Haible <bruno@clisp.org>
parents: 6581
diff changeset
1866 sed_take_first_column='s,'"$delimiter"'.*,,'
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1867 for g in `LC_ALL=C join -t"$delimiter" -v1 "$tmp"/old-files "$tmp"/new-files | sed -e "$sed_take_first_column"`; do
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1868 # Remove the file. Do nothing if the user already removed it.
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1869 if test -f "$destdir/$g"; then
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1870 if $doit; then
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1871 echo "Removing file $g (backup in ${g}~)"
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1872 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error "failed"
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1873 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1874 echo "Remove file $g (backup in ${g}~)"
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1875 fi
8451
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
1876 func_append removed_files "$g$nl"
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1877 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1878 done
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1879 # func_add_or_update handles a file that ought to be present afterwards.
7321
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
1880 # Uses parameters
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
1881 # - f the original file name
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
1882 # - g the rewritten file name
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
1883 # - already_present nonempty if the file already exists, empty otherwise
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1884 func_add_or_update ()
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1885 {
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1886 func_dest_tmpfilename "$g"
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
1887 func_lookup_file "$f"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
1888 cp "$lookedup_file" "$tmpfile" || func_fatal_error "failed"
7245
138333fc7a90 Improve maintainability.
Bruno Haible <bruno@clisp.org>
parents: 7241
diff changeset
1889 if test -n "$sed_transform_lib_file"; then
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1890 case "$f" in
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1891 lib/*)
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1892 sed -e "$sed_transform_lib_file" \
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
1893 < "$lookedup_file" > "$tmpfile" || func_fatal_error "failed"
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1894 ;;
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1895 esac
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
1896 fi
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1897 if test -f "$destdir/$g"; then
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1898 # The file already exists.
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1899 if cmp "$destdir/$g" "$tmpfile" > /dev/null; then
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1900 : # The file has not changed.
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1901 else
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1902 # Replace the file.
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1903 if $doit; then
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1904 if test -n "$already_present"; then
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1905 echo "Updating file $g (backup in ${g}~)"
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1906 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1907 echo "Replacing file $g (non-gnulib code backuped in ${g}~) !!"
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1908 fi
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1909 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error "failed"
7643
d67f9dc6019d New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 7642
diff changeset
1910 if { test -n "$symbolic" \
d67f9dc6019d New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 7642
diff changeset
1911 || { test -n "$lsymbolic" \
d67f9dc6019d New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 7642
diff changeset
1912 && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; } \
d67f9dc6019d New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 7642
diff changeset
1913 && test -z "$lookedup_tmp" \
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
1914 && cmp "$lookedup_file" "$tmpfile" > /dev/null; then
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
1915 func_ln_if_changed "$lookedup_file" "$destdir/$g"
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1916 else
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1917 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error "failed"
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1918 fi
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1919 else
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1920 if test -n "$already_present"; then
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1921 echo "Update file $g (backup in ${g}~)"
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1922 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1923 echo "Replace file $g (non-gnulib code backuped in ${g}~) !!"
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1924 fi
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1925 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1926 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1927 else
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1928 # Install the file.
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1929 # Don't protest if the file should be there but isn't: it happens
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1930 # frequently that developers don't put autogenerated files into CVS.
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1931 if $doit; then
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1932 echo "Copying file $g"
7643
d67f9dc6019d New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 7642
diff changeset
1933 if { test -n "$symbolic" \
d67f9dc6019d New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 7642
diff changeset
1934 || { test -n "$lsymbolic" \
d67f9dc6019d New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 7642
diff changeset
1935 && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; } \
d67f9dc6019d New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 7642
diff changeset
1936 && test -z "$lookedup_tmp" \
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
1937 && cmp "$lookedup_file" "$tmpfile" > /dev/null; then
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
1938 func_ln_if_changed "$lookedup_file" "$destdir/$g"
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1939 else
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1940 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error "failed"
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1941 fi
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1942 else
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1943 echo "Copy file $g"
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1944 fi
8451
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
1945 func_append added_files "$g$nl"
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1946 fi
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1947 rm -f "$tmpfile"
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1948 }
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1949 # Then the files that are in new-files, but not in old-files:
6595
0c67f1400c5b Fix portability problem to Solaris 9 sh.
Bruno Haible <bruno@clisp.org>
parents: 6581
diff changeset
1950 sed_take_last_column='s,^.*'"$delimiter"',,'
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1951 already_present=
7321
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
1952 LC_ALL=C join -t"$delimiter" -v2 "$tmp"/old-files "$tmp"/new-files \
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1953 | sed -e "$sed_take_last_column" \
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1954 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/added-files
7326
1ca1035630dd Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 7323
diff changeset
1955 { # Rearrange file descriptors. Needed because "while ... done < ..."
1ca1035630dd Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 7323
diff changeset
1956 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
7368
a7abebdb07f4 * gnulib-tool (func_import, func_create_testdir): Fix typos in
Eric Blake <ebb9@byu.net>
parents: 7350
diff changeset
1957 exec 5<&0 < "$tmp"/added-files
7326
1ca1035630dd Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 7323
diff changeset
1958 while read g f; do
1ca1035630dd Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 7323
diff changeset
1959 func_add_or_update
1ca1035630dd Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 7323
diff changeset
1960 done
7373
330a972d58f0 Tweak last patch, for symmetry.
Bruno Haible <bruno@clisp.org>
parents: 7368
diff changeset
1961 exec 0<&5 5<&-
7326
1ca1035630dd Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 7323
diff changeset
1962 }
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1963 # Then the files that are in new-files and in old-files:
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1964 already_present=true
7321
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
1965 LC_ALL=C join -t"$delimiter" "$tmp"/old-files "$tmp"/new-files \
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1966 | sed -e "$sed_take_last_column" \
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
1967 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/kept-files
7326
1ca1035630dd Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 7323
diff changeset
1968 { # Rearrange file descriptors. Needed because "while ... done < ..."
1ca1035630dd Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 7323
diff changeset
1969 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
7368
a7abebdb07f4 * gnulib-tool (func_import, func_create_testdir): Fix typos in
Eric Blake <ebb9@byu.net>
parents: 7350
diff changeset
1970 exec 5<&0 < "$tmp"/kept-files
7326
1ca1035630dd Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 7323
diff changeset
1971 while read g f; do
1ca1035630dd Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 7323
diff changeset
1972 func_add_or_update
1ca1035630dd Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 7323
diff changeset
1973 done
7373
330a972d58f0 Tweak last patch, for symmetry.
Bruno Haible <bruno@clisp.org>
parents: 7368
diff changeset
1974 exec 0<&5 5<&-
7326
1ca1035630dd Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 7323
diff changeset
1975 }
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1976
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1977 # Command-line invocation printed in a comment in generated gnulib-cache.m4.
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1978 actioncmd="gnulib-tool --import"
7323
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
1979 func_append actioncmd " --dir=$destdir"
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1980 if test -n "$local_gnulib_dir"; then
7323
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
1981 func_append actioncmd " --local-dir=$local_gnulib_dir"
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1982 fi
7323
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
1983 func_append actioncmd " --lib=$libname"
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
1984 func_append actioncmd " --source-base=$sourcebase"
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
1985 func_append actioncmd " --m4-base=$m4base"
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
1986 func_append actioncmd " --doc-base=$docbase"
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
1987 func_append actioncmd " --aux-dir=$auxdir"
8890
576d3e4f31c2 Remember the presence of the --with-tests command-line option through
Bruno Haible <bruno@clisp.org>
parents: 8672
diff changeset
1988 if test -n "$inctests"; then
576d3e4f31c2 Remember the presence of the --with-tests command-line option through
Bruno Haible <bruno@clisp.org>
parents: 8672
diff changeset
1989 func_append actioncmd " --with-tests"
576d3e4f31c2 Remember the presence of the --with-tests command-line option through
Bruno Haible <bruno@clisp.org>
parents: 8672
diff changeset
1990 fi
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1991 for module in $avoidlist; do
7323
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
1992 func_append actioncmd " --avoid=$module"
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1993 done
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1994 if test -n "$lgpl"; then
7323
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
1995 func_append actioncmd " --lgpl"
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1996 fi
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1997 if test -n "$makefile_name"; then
7600
42c51a6fef88 Fix typo in actioncmd. From Charles WIlson.
Bruno Haible <bruno@clisp.org>
parents: 7599
diff changeset
1998 func_append actioncmd " --makefile-name=$makefile_name"
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1999 fi
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
2000 if test "$libtool" = true; then
7323
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
2001 func_append actioncmd " --libtool"
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
2002 else
7323
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
2003 func_append actioncmd " --no-libtool"
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
2004 fi
7323
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
2005 func_append actioncmd " --macro-prefix=$macro_prefix"
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
2006 func_append actioncmd " `echo $specified_modules`"
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
2007
7222
06eec4eaf416 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 7216
diff changeset
2008 # Default the makefile name to Makefile.am.
06eec4eaf416 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 7216
diff changeset
2009 if test -n "$makefile_name"; then
06eec4eaf416 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 7216
diff changeset
2010 makefile_am=$makefile_name
06eec4eaf416 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 7216
diff changeset
2011 else
06eec4eaf416 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 7216
diff changeset
2012 makefile_am=Makefile.am
06eec4eaf416 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 7216
diff changeset
2013 fi
06eec4eaf416 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 7216
diff changeset
2014
7981
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
2015 # Create normal Makefile.ams.
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
2016 for_test=false
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
2017
7222
06eec4eaf416 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 7216
diff changeset
2018 # Create library makefile.
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2019 func_dest_tmpfilename $sourcebase/$makefile_am
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2020 func_emit_lib_Makefile_am > "$tmpfile"
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2021 if test -f "$destdir"/$sourcebase/$makefile_am; then
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2022 if cmp "$destdir"/$sourcebase/$makefile_am "$tmpfile" > /dev/null; then
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2023 rm -f "$tmpfile"
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2024 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2025 if $doit; then
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2026 echo "Updating $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2027 mv -f "$destdir"/$sourcebase/$makefile_am "$destdir"/$sourcebase/$makefile_am~
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2028 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2029 else
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2030 echo "Update $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2031 rm -f "$tmpfile"
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
2032 fi
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2033 fi
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2034 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2035 if $doit; then
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2036 echo "Creating $sourcebase/$makefile_am"
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2037 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2038 else
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2039 echo "Create $sourcebase/$makefile_am"
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2040 rm -f "$tmpfile"
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
2041 fi
8451
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2042 func_append added_files "$sourcebase/$makefile_am$nl"
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
2043 fi
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
2044
6180
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2045 # Create m4/gnulib-cache.m4.
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2046 func_dest_tmpfilename $m4base/gnulib-cache.m4
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
2047 (
6777
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
2048 func_emit_copyright_notice
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
2049 echo "#"
6180
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2050 echo "# This file represents the specification of how gnulib-tool is used."
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2051 echo "# It acts as a cache: It is written and read by gnulib-tool."
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2052 echo "# In projects using CVS, this file is meant to be stored in CVS,"
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2053 echo "# like the configure.ac and various Makefile.am files."
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2054 echo
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2055 echo
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2056 echo "# Specification in the form of a command-line invocation:"
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2057 echo "# $actioncmd"
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2058 echo
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2059 echo "# Specification in the form of a few gnulib-tool.m4 macro invocations:"
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
2060 # Store the local_gnulib_dir relative to destdir.
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
2061 case "$local_gnulib_dir" in
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
2062 "" | /*)
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
2063 relative_local_gnulib_dir="$local_gnulib_dir" ;;
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
2064 * )
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
2065 case "$destdir" in
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
2066 /*) relative_local_gnulib_dir="$local_gnulib_dir" ;;
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
2067 *)
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
2068 # destdir, local_gnulib_dir are both relative.
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
2069 func_relativize "$destdir" "$local_gnulib_dir"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
2070 relative_local_gnulib_dir="$reldir" ;;
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
2071 esac ;;
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
2072 esac
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
2073 echo "gl_LOCAL_DIR([$relative_local_gnulib_dir])"
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
2074 echo "gl_MODULES(["`echo $specified_modules`"])"
6180
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2075 echo "gl_AVOID([$avoidlist])"
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2076 echo "gl_SOURCE_BASE([$sourcebase])"
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2077 echo "gl_M4_BASE([$m4base])"
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
2078 echo "gl_DOC_BASE([$docbase])"
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
2079 echo "gl_TESTS_BASE([$testsbase])"
8890
576d3e4f31c2 Remember the presence of the --with-tests command-line option through
Bruno Haible <bruno@clisp.org>
parents: 8672
diff changeset
2080 test -z "$inctests" || echo "gl_WITH_TESTS"
6180
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2081 echo "gl_LIB([$libname])"
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2082 test -z "$lgpl" || echo "gl_LGPL"
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2083 echo "gl_MAKEFILE_NAME([$makefile_name])"
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
2084 if test "$libtool" = true; then
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
2085 echo "gl_LIBTOOL"
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
2086 fi
6180
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2087 echo "gl_MACRO_PREFIX([$macro_prefix])"
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2088 ) > "$tmpfile"
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2089 if test -f "$destdir"/$m4base/gnulib-cache.m4; then
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2090 if cmp "$destdir"/$m4base/gnulib-cache.m4 "$tmpfile" > /dev/null; then
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2091 rm -f "$tmpfile"
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2092 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2093 if $doit; then
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
2094 echo "Updating $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
2095 mv -f "$destdir"/$m4base/gnulib-cache.m4 "$destdir"/$m4base/gnulib-cache.m4~
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2096 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.m4
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2097 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2098 echo "Update $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
6249
564133adbd69 Comment out too much verbosity in --dry-run.
Bruno Haible <bruno@clisp.org>
parents: 6248
diff changeset
2099 if false; then
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2100 cat "$tmpfile"
6249
564133adbd69 Comment out too much verbosity in --dry-run.
Bruno Haible <bruno@clisp.org>
parents: 6248
diff changeset
2101 echo
564133adbd69 Comment out too much verbosity in --dry-run.
Bruno Haible <bruno@clisp.org>
parents: 6248
diff changeset
2102 echo "# gnulib-cache.m4 ends here"
564133adbd69 Comment out too much verbosity in --dry-run.
Bruno Haible <bruno@clisp.org>
parents: 6248
diff changeset
2103 fi
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2104 rm -f "$tmpfile"
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
2105 fi
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2106 fi
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2107 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2108 if $doit; then
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
2109 echo "Creating $m4base/gnulib-cache.m4"
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2110 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.m4
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2111 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2112 echo "Create $m4base/gnulib-cache.m4"
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2113 cat "$tmpfile"
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2114 rm -f "$tmpfile"
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
2115 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
2116 fi
6180
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2117
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2118 # Create m4/gnulib-comp.m4.
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2119 func_dest_tmpfilename $m4base/gnulib-comp.m4
6180
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2120 (
7421
8bace4b08db5 Mark generated files as "DO NOT EDIT".
Bruno Haible <bruno@clisp.org>
parents: 7391
diff changeset
2121 echo "# DO NOT EDIT! GENERATED AUTOMATICALLY!"
6777
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
2122 func_emit_copyright_notice
6180
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2123 echo "#"
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2124 echo "# This file represents the compiled summary of the specification in"
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2125 echo "# gnulib-cache.m4. It lists the computed macro invocations that need"
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2126 echo "# to be invoked from configure.ac."
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2127 echo "# In projects using CVS, this file can be treated like other built files."
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2128 echo
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
2129 echo
6160
2fb771c0af6b Emit more comments and advice.
Bruno Haible <bruno@clisp.org>
parents: 6159
diff changeset
2130 echo "# This macro should be invoked from $configure_ac, in the section"
2fb771c0af6b Emit more comments and advice.
Bruno Haible <bruno@clisp.org>
parents: 6159
diff changeset
2131 echo "# \"Checks for programs\", right after AC_PROG_CC, and certainly before"
2fb771c0af6b Emit more comments and advice.
Bruno Haible <bruno@clisp.org>
parents: 6159
diff changeset
2132 echo "# any checks for libraries, header files, types and library functions."
6176
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
2133 echo "AC_DEFUN([${macro_prefix}_EARLY],"
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
2134 echo "["
7105
641bac73140c * gnulib-tool (func_import): Detect unexpanded macros in gnulib
Eric Blake <ebb9@byu.net>
parents: 7090
diff changeset
2135 echo " m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
7486
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
2136 echo " m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
2137 echo " m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
2138 echo " m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
6512
f8abe8d41137 RANLIB is needed.
Bruno Haible <bruno@clisp.org>
parents: 6464
diff changeset
2139 echo " AC_REQUIRE([AC_PROG_RANLIB])"
7641
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
2140 if test -n "$uses_subdirs"; then
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
2141 echo " AC_REQUIRE([AM_PROG_CC_C_O])"
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
2142 fi
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2143 if grep AC_GNU_SOURCE "$destdir"/$m4base/*.m4 >/dev/null 2>/dev/null; then
6179
76e367ba26d3 Avoid multiple copies of AC_GNU_SOURCE in the configure file.
Bruno Haible <bruno@clisp.org>
parents: 6178
diff changeset
2144 echo " AC_REQUIRE([AC_GNU_SOURCE])"
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
2145 fi
8079
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
2146 for module in $modules; do
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
2147 func_verify_module
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
2148 if test -n "$module"; then
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
2149 func_get_autoconf_early_snippet "$module"
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
2150 fi
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
2151 done \
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
2152 | sed -e '/^$/d;' -e 's/^/ /'
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
2153 echo "])"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
2154 echo
6160
2fb771c0af6b Emit more comments and advice.
Bruno Haible <bruno@clisp.org>
parents: 6159
diff changeset
2155 echo "# This macro should be invoked from $configure_ac, in the section"
2fb771c0af6b Emit more comments and advice.
Bruno Haible <bruno@clisp.org>
parents: 6159
diff changeset
2156 echo "# \"Check for header files, types and library functions\"."
6176
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
2157 echo "AC_DEFUN([${macro_prefix}_INIT],"
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
2158 echo "["
7486
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
2159 func_emit_initmacro_start
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
2160 if test "$libtool" = true; then
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
2161 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
7286
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2162 echo " gl_cond_libtool=true"
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
2163 else
6512
f8abe8d41137 RANLIB is needed.
Bruno Haible <bruno@clisp.org>
parents: 6464
diff changeset
2164 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
7286
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2165 echo " gl_cond_libtool=false"
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2166 echo " gl_libdeps="
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2167 echo " gl_ltlibdeps="
6414
46d47c8fe734 * gnulib-tool: Define automake conditional GL_COND_LIBTOOL if
Simon Josefsson <simon@josefsson.org>
parents: 6389
diff changeset
2168 fi
7348
7d0519d18212 Pass to the gl_GETLOADAVG macro the $gl_source_base from gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents: 7347
diff changeset
2169 echo " gl_source_base='$sourcebase'"
6556
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2170 if test "$auxdir" != "build-aux"; then
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2171 sed_replace_build_aux='
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2172 :a
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2173 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2174 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2175 ba
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2176 }'
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2177 sed_replace_build_aux=`echo "$sed_replace_build_aux" | sed -e 1d -e 's/^ *//'`
6556
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2178 else
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2179 sed_replace_build_aux=
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2180 fi
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
2181 for module in $modules; do
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
2182 func_verify_module
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
2183 if test -n "$module"; then
6546
b32846b4d88d Replace build-aux when it occurs in the autoconf snippet.
Bruno Haible <bruno@clisp.org>
parents: 6533
diff changeset
2184 func_get_autoconf_snippet "$module" \
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2185 | sed -e '/^$/d;' -e 's/^/ /' \
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2186 -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./' \
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2187 -e "$sed_replace_build_aux"
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
2188 if test "$module" = 'alloca' && test "$libtool" = true; then
5356
144b29bba7b7 Provisions for defining LTALLOCA.
Bruno Haible <bruno@clisp.org>
parents: 5353
diff changeset
2189 echo 'changequote(,)dnl'
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2190 echo 'LTALLOCA=`echo "$ALLOCA" | sed '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
5356
144b29bba7b7 Provisions for defining LTALLOCA.
Bruno Haible <bruno@clisp.org>
parents: 5353
diff changeset
2191 echo 'changequote([, ])dnl'
6106
66bd85c8a9cd Proper autoconf macro argument quoting.
Bruno Haible <bruno@clisp.org>
parents: 6039
diff changeset
2192 echo 'AC_SUBST([LTALLOCA])'
5356
144b29bba7b7 Provisions for defining LTALLOCA.
Bruno Haible <bruno@clisp.org>
parents: 5353
diff changeset
2193 fi
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
2194 fi
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
2195 done
7286
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2196 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2197 # created using libtool, because libtool already handles the dependencies.
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2198 if test "$libtool" != true; then
8040
3905dae579b6 * gnulib-tool (func_emit_lib_Makefile_am, func_add_or_update)
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7981
diff changeset
2199 libname_upper=`echo "$libname" | LC_ALL=C tr 'a-z' 'A-Z'`
7286
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2200 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2201 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2202 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2203 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2204 fi
7486
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
2205 func_emit_initmacro_end
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
2206 echo "])"
7486
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
2207 func_emit_initmacro_done
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
2208 echo
6180
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2209 echo "# This macro records the list of files which have been installed by"
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2210 echo "# gnulib-tool and may be removed by future gnulib-tool invocations."
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2211 echo "AC_DEFUN([${macro_prefix}_FILE_LIST], ["
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2212 echo "$files" | sed -e 's,^, ,'
6180
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
2213 echo "])"
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2214 ) > "$tmpfile"
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2215 if test -f "$destdir"/$m4base/gnulib-comp.m4; then
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2216 if cmp "$destdir"/$m4base/gnulib-comp.m4 "$tmpfile" > /dev/null; then
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2217 rm -f "$tmpfile"
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2218 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2219 if $doit; then
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
2220 echo "Updating $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
2221 mv -f "$destdir"/$m4base/gnulib-comp.m4 "$destdir"/$m4base/gnulib-comp.m4~
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2222 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.m4
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2223 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2224 echo "Update $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
6249
564133adbd69 Comment out too much verbosity in --dry-run.
Bruno Haible <bruno@clisp.org>
parents: 6248
diff changeset
2225 if false; then
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2226 cat "$tmpfile"
6249
564133adbd69 Comment out too much verbosity in --dry-run.
Bruno Haible <bruno@clisp.org>
parents: 6248
diff changeset
2227 echo
564133adbd69 Comment out too much verbosity in --dry-run.
Bruno Haible <bruno@clisp.org>
parents: 6248
diff changeset
2228 echo "# gnulib-comp.m4 ends here"
564133adbd69 Comment out too much verbosity in --dry-run.
Bruno Haible <bruno@clisp.org>
parents: 6248
diff changeset
2229 fi
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2230 rm -f "$tmpfile"
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
2231 fi
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2232 fi
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2233 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2234 if $doit; then
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
2235 echo "Creating $m4base/gnulib-comp.m4"
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2236 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.m4
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2237 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
2238 echo "Create $m4base/gnulib-comp.m4"
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2239 cat "$tmpfile"
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2240 rm -f "$tmpfile"
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
2241 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
2242 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
2243
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
2244 if test -n "$inctests"; then
7222
06eec4eaf416 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 7216
diff changeset
2245 # Create tests makefile.
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2246 func_dest_tmpfilename $testsbase/$makefile_am
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2247 func_emit_tests_Makefile_am > "$tmpfile"
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2248 if test -f "$destdir"/$testsbase/$makefile_am; then
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2249 if cmp "$destdir"/$testsbase/$makefile_am "$tmpfile" > /dev/null; then
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2250 rm -f "$tmpfile"
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
2251 else
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
2252 if $doit; then
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2253 echo "Updating $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2254 mv -f "$destdir"/$testsbase/$makefile_am "$destdir"/$testsbase/$makefile_am~
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2255 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
2256 else
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2257 echo "Update $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2258 rm -f "$tmpfile"
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
2259 fi
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
2260 fi
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
2261 else
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
2262 if $doit; then
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2263 echo "Creating $testsbase/$makefile_am"
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2264 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
2265 else
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2266 echo "Create $testsbase/$makefile_am"
6745
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
2267 rm -f "$tmpfile"
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
2268 fi
8451
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2269 func_append added_files "$testsbase/$makefile_am$nl"
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
2270 fi
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
2271 fi
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
2272
8451
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2273 # Update the .cvsignore and .gitignore files.
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2274 { echo "$added_files" | sed -e '/^$/d' -e 's,\([^/]*\)$,|A|\1,'
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2275 echo "$removed_files" | sed -e '/^$/d' -e 's,\([^/]*\)$,|R|\1,'
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2276 } | LC_ALL=C sort -t'|' -k1,1 > "$tmp"/fileset-changes
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2277 { # Rearrange file descriptors. Needed because "while ... done < ..."
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2278 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2279 exec 5<&0 < "$tmp"/fileset-changes
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2280 func_update_ignorelist ()
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2281 {
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2282 ignore="$1"
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2283 if test -f "$destdir/$dir$ignore"; then
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2284 if test -n "$dir_added" || test -n "$dir_removed"; then
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2285 LC_ALL=C sort "$destdir/$dir$ignore" > "$tmp"/ignore
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2286 echo "$dir_added" | sed -e '/^$/d' | LC_ALL=C sort -u \
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2287 | LC_ALL=C join -v 2 "$tmp"/ignore - > "$tmp"/ignore-added
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2288 echo "$dir_removed" | sed -e '/^$/d' | LC_ALL=C sort -u \
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2289 | LC_ALL=C join -v 2 "$tmp"/ignore - > "$tmp"/ignore-removed
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2290 if test -s "$tmp"/ignore-added || test -s "$tmp"/ignore-removed; then
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2291 if $doit; then
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2292 echo "Updating $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2293 mv -f "$destdir/$dir$ignore" "$destdir/$dir$ignore"~
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2294 sed -e 's,^,/^,' -e 's,$,\$/d,' < "$tmp"/ignore-removed > "$tmp"/sed-ignore-removed
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2295 cat "$destdir/$dir$ignore"~ "$tmp"/ignore-added \
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2296 | sed -f "$tmp"/sed-ignore-removed \
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2297 > "$destdir/$dir$ignore"
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2298 else
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2299 echo "Update $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2300 fi
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2301 fi
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2302 fi
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2303 else
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2304 if test -n "$dir_added"; then
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2305 if $doit; then
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2306 echo "Creating $destdir/$dir$ignore"
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2307 echo "$dir_added" | sed -e '/^$/d' | LC_ALL=C sort -u > "$destdir/$dir$ignore"
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2308 else
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2309 echo "Create $destdir/$dir$ignore"
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2310 fi
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2311 fi
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2312 fi
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2313 }
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2314 func_done_dir ()
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2315 {
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2316 dir="$1"
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2317 dir_added="$2"
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2318 dir_removed="$3"
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2319 if test -d "$destdir/${dir}CVS" || test -f "$destdir/${dir}.cvsignore"; then
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2320 func_update_ignorelist .cvsignore
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2321 fi
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2322 if test -d "$destdir/.git" || test -f "$destdir/${dir}.gitignore"; then
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2323 func_update_ignorelist .gitignore
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2324 fi
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2325 }
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2326 last_dir=
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2327 last_dir_added=
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2328 last_dir_removed=
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2329 while read line; do
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2330 # Why not ''read next_dir op file'' ? Because the dir column can be empty.
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2331 next_dir=`echo "$line" | sed -e 's,|.*,,'`
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2332 op=`echo "$line" | sed -e 's,^[^|]*|\([^|]*\)|.*$,\1,'`
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2333 file=`echo "$line" | sed -e 's,^[^|]*|[^|]*|,,'`
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2334 if test "$next_dir" != "$last_dir"; then
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2335 func_done_dir "$last_dir" "$last_dir_added" "$last_dir_removed"
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2336 last_dir="$next_dir"
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2337 last_dir_added=
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2338 last_dir_removed=
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2339 fi
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2340 case $op in
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2341 A) func_append last_dir_added "$file$nl";;
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2342 R) func_append last_dir_removed "$file$nl";;
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2343 esac
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2344 done
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2345 func_done_dir "$last_dir" "$last_dir_added" "$last_dir_removed"
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2346 exec 0<&5 5<&-
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2347 }
ba5ed28cb276 Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 8432
diff changeset
2348
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
2349 echo "Finished."
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
2350 echo
5572
54000928a33d Print #include directives when --import'ing.
Simon Josefsson <simon@josefsson.org>
parents: 5527
diff changeset
2351 echo "You may need to add #include directives for the following .h files."
7721
ef2654457d79 Don't show the includes for modules that were not explicitly specified.
Bruno Haible <bruno@clisp.org>
parents: 7701
diff changeset
2352 # Intersect $specified_modules and $modules
ef2654457d79 Don't show the includes for modules that were not explicitly specified.
Bruno Haible <bruno@clisp.org>
parents: 7701
diff changeset
2353 # (since $specified_modules is not necessarily of subset of $modules - some
ef2654457d79 Don't show the includes for modules that were not explicitly specified.
Bruno Haible <bruno@clisp.org>
parents: 7701
diff changeset
2354 # may have been skipped through --avoid, and since the elements of $modules
ef2654457d79 Don't show the includes for modules that were not explicitly specified.
Bruno Haible <bruno@clisp.org>
parents: 7701
diff changeset
2355 # but not in $specified_modules can go away without explicit notice - through
ef2654457d79 Don't show the includes for modules that were not explicitly specified.
Bruno Haible <bruno@clisp.org>
parents: 7701
diff changeset
2356 # changes in the module dependencies).
ef2654457d79 Don't show the includes for modules that were not explicitly specified.
Bruno Haible <bruno@clisp.org>
parents: 7701
diff changeset
2357 echo "$specified_modules" > "$tmp"/modules1 # a sorted list, one module per line
ef2654457d79 Don't show the includes for modules that were not explicitly specified.
Bruno Haible <bruno@clisp.org>
parents: 7701
diff changeset
2358 echo "$modules" > "$tmp"/modules2 # also a sorted list, one module per line
7322
46d98b687a87 Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 7321
diff changeset
2359 # First the #include <...> directives without #ifs, sorted for convenience,
46d98b687a87 Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 7321
diff changeset
2360 # then the #include "..." directives without #ifs, sorted for convenience,
46d98b687a87 Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 7321
diff changeset
2361 # then the #include directives that are surrounded by #ifs. Not sorted.
7722
504e81510ee5 Fix 'join' invocation.
Bruno Haible <bruno@clisp.org>
parents: 7721
diff changeset
2362 for module in `LC_ALL=C join "$tmp"/modules1 "$tmp"/modules2`; do
7322
46d98b687a87 Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 7321
diff changeset
2363 include_directive=`func_get_include_directive "$module"`
46d98b687a87 Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 7321
diff changeset
2364 case "$nl$include_directive" in
46d98b687a87 Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 7321
diff changeset
2365 *"$nl#if"*)
46d98b687a87 Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 7321
diff changeset
2366 echo "$include_directive" 1>&5
46d98b687a87 Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 7321
diff changeset
2367 ;;
46d98b687a87 Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 7321
diff changeset
2368 *)
46d98b687a87 Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 7321
diff changeset
2369 echo "$include_directive" | grep -v 'include "' 1>&6
46d98b687a87 Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 7321
diff changeset
2370 echo "$include_directive" | grep 'include "' 1>&7
46d98b687a87 Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 7321
diff changeset
2371 ;;
46d98b687a87 Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 7321
diff changeset
2372 esac
46d98b687a87 Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 7321
diff changeset
2373 done 5> "$tmp"/include-if 6> "$tmp"/include-angles 7> "$tmp"/include-quotes
6756
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
2374 (
7322
46d98b687a87 Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 7321
diff changeset
2375 LC_ALL=C sort -u "$tmp"/include-angles
46d98b687a87 Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 7321
diff changeset
2376 LC_ALL=C sort -u "$tmp"/include-quotes
46d98b687a87 Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 7321
diff changeset
2377 cat "$tmp"/include-if
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2378 ) | sed -e '/^$/d' -e 's/^/ /'
7322
46d98b687a87 Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 7321
diff changeset
2379 rm -f "$tmp"/include-angles "$tmp"/include-quotes "$tmp"/include-if
46d98b687a87 Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 7321
diff changeset
2380
8055
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
2381 for module in $modules; do
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
2382 func_get_link_directive "$module"
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
2383 done \
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
2384 | LC_ALL=C sort -u | sed -e '/^$/d' -e 's/^/ /' > "$tmp"/link
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
2385 if test `wc -l < "$tmp"/link` != 0; then
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
2386 echo
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
2387 echo "You may need to use the following Makefile variables when linking."
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
2388 echo "Use them in <program>_LDADD when linking a program, or"
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
2389 echo "in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library."
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
2390 cat "$tmp"/link
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
2391 fi
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
2392 rm -f "$tmp"/link
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
2393
5572
54000928a33d Print #include directives when --import'ing.
Simon Josefsson <simon@josefsson.org>
parents: 5527
diff changeset
2394 echo
6160
2fb771c0af6b Emit more comments and advice.
Bruno Haible <bruno@clisp.org>
parents: 6159
diff changeset
2395 echo "Don't forget to"
7222
06eec4eaf416 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 7216
diff changeset
2396 if test "$makefile_am" = Makefile.am; then
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2397 echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2398 else
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2399 echo " - \"include $makefile_name\" from within \"$sourcebase/Makefile.am\","
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2400 fi
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
2401 if test -n "$inctests"; then
7222
06eec4eaf416 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 7216
diff changeset
2402 if test "$makefile_am" = Makefile.am; then
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2403 echo " - add \"$testsbase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2404 else
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2405 echo " - \"include $makefile_name\" from within \"$testsbase/Makefile.am\","
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2406 fi
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
2407 fi
7222
06eec4eaf416 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 7216
diff changeset
2408 if test "$makefile_am" = Makefile.am; then
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2409 sourcebase_dir=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'`
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2410 sourcebase_base=`basename "$sourcebase"`
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2411 echo " - mention \"${sourcebase_base}\" in SUBDIRS in ${sourcebase_dir}Makefile.am,"
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2412 fi
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
2413 if test -n "$inctests"; then
7222
06eec4eaf416 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 7216
diff changeset
2414 if test "$makefile_am" = Makefile.am; then
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2415 testsbase_dir=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'`
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2416 testsbase_base=`basename "$testsbase"`
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2417 echo " - mention \"${testsbase_base}\" in SUBDIRS in ${testsbase_dir}Makefile.am,"
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
2418 fi
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
2419 fi
6160
2fb771c0af6b Emit more comments and advice.
Bruno Haible <bruno@clisp.org>
parents: 6159
diff changeset
2420 echo " - mention \"-I ${m4base}\" in ACLOCAL_AMFLAGS in Makefile.am,"
6176
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
2421 echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after AC_PROG_CC,"
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
2422 echo " - invoke ${macro_prefix}_INIT in $configure_ac."
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
2423 }
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
2424
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2425 # func_create_testdir testdir modules
6109
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
2426 # Input:
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
2427 # - local_gnulib_dir from --local-dir
6109
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
2428 # - auxdir directory relative to destdir where to place build aux files
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2429 func_create_testdir ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2430 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2431 testdir="$1"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2432 modules="$2"
7484
57fe575409ae --create-testdir without module names now means to use nearly all modules.
Bruno Haible <bruno@clisp.org>
parents: 7421
diff changeset
2433 if test -z "$modules"; then
57fe575409ae --create-testdir without module names now means to use nearly all modules.
Bruno Haible <bruno@clisp.org>
parents: 7421
diff changeset
2434 # All modules together.
57fe575409ae --create-testdir without module names now means to use nearly all modules.
Bruno Haible <bruno@clisp.org>
parents: 7421
diff changeset
2435 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
57fe575409ae --create-testdir without module names now means to use nearly all modules.
Bruno Haible <bruno@clisp.org>
parents: 7421
diff changeset
2436 # Except fnmatch-posix, which conflicts with fnmatch-gnu. FIXME.
7533
029a26ecb19a Don't include ftruncate and mountlist by default.
Bruno Haible <bruno@clisp.org>
parents: 7530
diff changeset
2437 # Except ftruncate, mountlist, which abort the configuration on mingw. FIXME.
7484
57fe575409ae --create-testdir without module names now means to use nearly all modules.
Bruno Haible <bruno@clisp.org>
parents: 7421
diff changeset
2438 modules=`func_all_modules`
7533
029a26ecb19a Don't include ftruncate and mountlist by default.
Bruno Haible <bruno@clisp.org>
parents: 7530
diff changeset
2439 modules=`for m in $modules; do case $m in config-h | fnmatch-posix | ftruncate | mountlist) ;; *) echo $m;; esac; done`
7484
57fe575409ae --create-testdir without module names now means to use nearly all modules.
Bruno Haible <bruno@clisp.org>
parents: 7421
diff changeset
2440 fi
7319
1726cc39709b Use "sort -u" where it makes sense.
Bruno Haible <bruno@clisp.org>
parents: 7299
diff changeset
2441 modules=`for m in $modules; do echo $m; done | LC_ALL=C sort -u`
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2442
7660
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2443 # Check that the license of every module is consistent with the license of
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2444 # its dependencies.
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2445 saved_modules="$modules"
7896
cd3ed2fae0bf Tests modules are under GPL now.
Bruno Haible <bruno@clisp.org>
parents: 7872
diff changeset
2446 saved_inctests="$inctests"
cd3ed2fae0bf Tests modules are under GPL now.
Bruno Haible <bruno@clisp.org>
parents: 7872
diff changeset
2447 # When computing transitive closures, don't consider $module to depend on
cd3ed2fae0bf Tests modules are under GPL now.
Bruno Haible <bruno@clisp.org>
parents: 7872
diff changeset
2448 # $module-tests. Need this becauses tests are implicitly GPL and may depend
cd3ed2fae0bf Tests modules are under GPL now.
Bruno Haible <bruno@clisp.org>
parents: 7872
diff changeset
2449 # on GPL modules - therefore we don't want a warning in this case.
cd3ed2fae0bf Tests modules are under GPL now.
Bruno Haible <bruno@clisp.org>
parents: 7872
diff changeset
2450 inctests=""
7660
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2451 for requested_module in $saved_modules; do
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2452 requested_license=`func_get_license "$requested_module"`
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2453 if test "$requested_license" != GPL; then
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2454 # Here we use func_modules_transitive_closure, not just
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2455 # func_get_dependencies, so that we also detect weird situations like
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2456 # an LGPL module which depends on a GPLed build tool module which depends
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2457 # on a GPL module.
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2458 modules="$requested_module"
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2459 func_modules_transitive_closure
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2460 for module in $modules; do
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2461 license=`func_get_license "$module"`
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2462 case $license in
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2463 LGPL | 'GPLed build tool') ;;
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2464 'public domain' | 'unlimited' | 'unmodifiable license text') ;;
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2465 *) echo "warning: module $requested_module depends on a module with an incompatible license: $module" 1>&2 ;;
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2466 esac
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2467 done
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2468 fi
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2469 done
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2470 modules="$saved_modules"
7896
cd3ed2fae0bf Tests modules are under GPL now.
Bruno Haible <bruno@clisp.org>
parents: 7872
diff changeset
2471 inctests="$saved_inctests"
7660
7aa6fbd6b3b7 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7647
diff changeset
2472
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2473 # Subdirectory names.
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2474 sourcebase=gllib
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2475 m4base=glm4
7321
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
2476 docbase=gldoc
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2477 testsbase=gltests
7486
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
2478 macro_prefix=gl
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2479
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2480 # Determine final module list.
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
2481 func_modules_transitive_closure
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2482 echo "Module list with included dependencies:"
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2483 echo "$modules" | sed -e 's/^/ /'
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2484
6550
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
2485 # Add the dummy module if needed.
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
2486 func_modules_add_dummy
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
2487
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2488 # Determine final file list.
5348
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
2489 func_modules_to_filelist
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2490 echo "File list:"
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2491 echo "$files" | sed -e 's/^/ /'
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2492
7321
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
2493 sed_rewrite_files="\
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
2494 s,^build-aux/,$auxdir/,
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
2495 s,^doc/,$docbase/,
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
2496 s,^lib/,$sourcebase/,
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
2497 s,^m4/,$m4base/,
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
2498 s,^tests/,$testsbase/,"
7605
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
2499
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
2500 # Create directories.
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
2501 for f in $files; do echo $f; done \
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2502 | sed -e "$sed_rewrite_files" \
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2503 | sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
7605
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
2504 | LC_ALL=C sort -u \
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
2505 > "$tmp"/dirs
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
2506 { # Rearrange file descriptors. Needed because "while ... done < ..."
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
2507 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
2508 exec 5<&0 < "$tmp"/dirs
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
2509 while read d; do
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
2510 mkdir -p "$testdir/$d"
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
2511 done
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
2512 exec 0<&5 5<&-
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
2513 }
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
2514
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
2515 # Copy files or make symbolic links.
ae17dea0254d Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7600
diff changeset
2516 delimiter=' '
7321
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
2517 for f in $files; do echo $f; done \
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2518 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_files" \
7321
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
2519 | LC_ALL=C sort \
3bf1b669d1e1 Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 7320
diff changeset
2520 > "$tmp"/files
7326
1ca1035630dd Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 7323
diff changeset
2521 { # Rearrange file descriptors. Needed because "while ... done < ..."
1ca1035630dd Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 7323
diff changeset
2522 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
7368
a7abebdb07f4 * gnulib-tool (func_import, func_create_testdir): Fix typos in
Eric Blake <ebb9@byu.net>
parents: 7350
diff changeset
2523 exec 5<&0 < "$tmp"/files
7326
1ca1035630dd Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 7323
diff changeset
2524 while read g f; do
1ca1035630dd Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 7323
diff changeset
2525 func_lookup_file "$f"
1ca1035630dd Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 7323
diff changeset
2526 if test -n "$lookedup_tmp"; then
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
2527 cp -p "$lookedup_file" "$testdir/$g"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
2528 else
7326
1ca1035630dd Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 7323
diff changeset
2529 ln "$lookedup_file" "$testdir/$g" 2>/dev/null ||
7643
d67f9dc6019d New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 7642
diff changeset
2530 if { test -n "$symbolic" \
d67f9dc6019d New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 7642
diff changeset
2531 || { test -n "$lsymbolic" \
d67f9dc6019d New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 7642
diff changeset
2532 && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; }; then
d67f9dc6019d New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 7642
diff changeset
2533 func_ln "$lookedup_file" "$testdir/$g"
d67f9dc6019d New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 7642
diff changeset
2534 else
7326
1ca1035630dd Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 7323
diff changeset
2535 cp -p "$lookedup_file" "$testdir/$g"
1ca1035630dd Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 7323
diff changeset
2536 fi
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
2537 fi
7326
1ca1035630dd Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 7323
diff changeset
2538 done
7373
330a972d58f0 Tweak last patch, for symmetry.
Bruno Haible <bruno@clisp.org>
parents: 7368
diff changeset
2539 exec 0<&5 5<&-
7326
1ca1035630dd Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 7323
diff changeset
2540 }
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2541
7981
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
2542 # Create Makefile.ams that are for testing.
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
2543 for_test=true
41421349e26b In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 7911
diff changeset
2544
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2545 # Create $sourcebase/Makefile.am.
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2546 mkdir -p "$testdir/$sourcebase"
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2547 func_emit_lib_Makefile_am > "$testdir/$sourcebase/Makefile.am"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2548
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2549 # Create $m4base/Makefile.am.
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2550 mkdir -p "$testdir/$m4base"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2551 (echo "## Process this file with automake to produce Makefile.in."
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2552 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2553 echo "EXTRA_DIST ="
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2554 for f in $files; do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2555 case "$f" in
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2556 m4/* )
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2557 echo "EXTRA_DIST += "`echo "$f" | sed -e 's,^m4/,,'` ;;
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2558 esac
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2559 done
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2560 ) > "$testdir/$m4base/Makefile.am"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2561
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2562 subdirs="$sourcebase $m4base"
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2563 subdirs_with_configure_ac=""
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2564
7485
0194db3ad154 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7484
diff changeset
2565 if false && test -f "$testdir"/$m4base/gettext.m4; then
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2566 # Avoid stupid error message from automake:
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2567 # "AM_GNU_GETTEXT used but `po' not in SUBDIRS"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2568 mkdir -p "$testdir/po"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2569 (echo "## Process this file with automake to produce Makefile.in."
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2570 ) > "$testdir/po/Makefile.am"
7323
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
2571 func_append subdirs " po"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2572 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2573
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2574 if test -n "$inctests"; then
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2575 test -d "$testdir/$testsbase" || mkdir "$testdir/$testsbase"
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2576 # Create $testsbase/Makefile.am.
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2577 func_emit_tests_Makefile_am > "$testdir/$testsbase/Makefile.am"
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2578 # Create $testsbase/configure.ac.
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2579 (echo "# Process this file with autoconf to produce a configure script."
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2580 echo "AC_INIT([dummy], [0])"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2581 echo "AC_CONFIG_AUX_DIR([../$auxdir])"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2582 echo "AM_INIT_AUTOMAKE"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2583 echo
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2584 echo "AM_CONFIG_HEADER([config.h])"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2585 echo
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2586 echo "AC_PROG_CC"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2587 echo "AC_PROG_INSTALL"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2588 echo "AC_PROG_MAKE_SET"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2589 echo "AC_PROG_RANLIB"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2590 echo
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2591 if grep AC_GNU_SOURCE "$testdir/$m4base"/*.m4 >/dev/null 2>/dev/null; then
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2592 echo "AC_GNU_SOURCE"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2593 echo
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2594 fi
8079
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
2595 for module in $modules; do
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
2596 func_verify_module
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
2597 if test -n "$module"; then
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
2598 func_get_autoconf_early_snippet "$module"
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
2599 fi
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
2600 done \
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
2601 | sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
2602 if test "$libtool" = true; then
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
2603 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
7286
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2604 echo "gl_cond_libtool=true"
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
2605 else
6418
e0a8b9b05999 Proper autoconf macro argument quoting.
Bruno Haible <bruno@clisp.org>
parents: 6414
diff changeset
2606 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
7286
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2607 echo "gl_cond_libtool=false"
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2608 echo "gl_libdeps="
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2609 echo "gl_ltlibdeps="
6414
46d47c8fe734 * gnulib-tool: Define automake conditional GL_COND_LIBTOOL if
Simon Josefsson <simon@josefsson.org>
parents: 6389
diff changeset
2610 fi
7090
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2611 # Wrap the set of autoconf snippets into an autoconf macro that is then
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2612 # invoked. This is needed because autoconf does not support AC_REQUIRE
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2613 # at the top level:
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2614 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2615 # but we want the AC_REQUIRE to have its normal meaning (provide one
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2616 # expansion of the required macro before the current point, and only one
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2617 # expansion total).
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2618 echo "AC_DEFUN([gl_INIT], ["
7486
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
2619 func_emit_initmacro_start
7638
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2620 sed_replace_build_aux='
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2621 :a
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2622 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2623 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:../'"$auxdir"'/\2)|
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2624 ba
7638
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2625 }'
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2626 sed_replace_build_aux=`echo "$sed_replace_build_aux" | sed -e 1d -e 's/^ *//'`
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2627 # We don't have explicit ordering constraints between the various
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2628 # autoconf snippets. It's cleanest to put those of the library before
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2629 # those of the tests.
7647
c26d75cebcfa Fix --create-testdir --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 7646
diff changeset
2630 echo "gl_source_base='../$sourcebase'"
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2631 for module in $modules; do
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2632 func_verify_nontests_module
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2633 if test -n "$module"; then
6546
b32846b4d88d Replace build-aux when it occurs in the autoconf snippet.
Bruno Haible <bruno@clisp.org>
parents: 6533
diff changeset
2634 func_get_autoconf_snippet "$module" \
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2635 | sed -e "$sed_replace_build_aux"
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2636 fi
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2637 done
7647
c26d75cebcfa Fix --create-testdir --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 7646
diff changeset
2638 echo "gl_source_base='.'"
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2639 for module in $modules; do
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2640 func_verify_tests_module
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2641 if test -n "$module"; then
6546
b32846b4d88d Replace build-aux when it occurs in the autoconf snippet.
Bruno Haible <bruno@clisp.org>
parents: 6533
diff changeset
2642 func_get_autoconf_snippet "$module" \
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2643 | sed -e "$sed_replace_build_aux"
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2644 fi
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2645 done
7286
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2646 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2647 # created using libtool, because libtool already handles the dependencies.
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2648 if test "$libtool" != true; then
8040
3905dae579b6 * gnulib-tool (func_emit_lib_Makefile_am, func_add_or_update)
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7981
diff changeset
2649 libname_upper=`echo "$libname" | LC_ALL=C tr 'a-z' 'A-Z'`
7286
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2650 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2651 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2652 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2653 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2654 fi
7486
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
2655 func_emit_initmacro_end
7090
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2656 echo "])"
7486
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
2657 func_emit_initmacro_done
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
2658 echo
7090
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2659 echo "gl_INIT"
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2660 echo
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2661 # Usually $testsbase/config.h will be a superset of config.h. Verify this
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2662 # by "merging" config.h into $testsbase/config.h; look out for gcc warnings.
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2663 echo "AH_TOP([#include \"../config.h\"])"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2664 echo
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2665 echo "AC_OUTPUT([Makefile])"
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2666 ) > "$testdir/$testsbase/configure.ac"
7323
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
2667 func_append subdirs " $testsbase"
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2668 subdirs_with_configure_ac="$subdirs_with_configure_ac $testsbase"
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2669 fi
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2670
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2671 # Create Makefile.am.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2672 (echo "## Process this file with automake to produce Makefile.in."
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2673 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2674 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2675 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2676 echo "SUBDIRS = $subdirs"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2677 echo
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2678 echo "ACLOCAL_AMFLAGS = -I $m4base"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2679 ) > "$testdir/Makefile.am"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2680
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2681 # Create configure.ac.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2682 (echo "# Process this file with autoconf to produce a configure script."
6106
66bd85c8a9cd Proper autoconf macro argument quoting.
Bruno Haible <bruno@clisp.org>
parents: 6039
diff changeset
2683 echo "AC_INIT([dummy], [0])"
6109
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
2684 if test "$auxdir" != "."; then
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
2685 echo "AC_CONFIG_AUX_DIR([$auxdir])"
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
2686 fi
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2687 echo "AM_INIT_AUTOMAKE"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2688 echo
6106
66bd85c8a9cd Proper autoconf macro argument quoting.
Bruno Haible <bruno@clisp.org>
parents: 6039
diff changeset
2689 echo "AM_CONFIG_HEADER([config.h])"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2690 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2691 echo "AC_PROG_CC"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2692 echo "AC_PROG_INSTALL"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2693 echo "AC_PROG_MAKE_SET"
7106
b9fff044578d Apply last patch also to --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7105
diff changeset
2694 echo
7777
b33956fbd953 2007-01-03 Simon Josefsson <simon@josefsson.org>
Simon Josefsson <simon@josefsson.org>
parents: 7771
diff changeset
2695 echo "# For autobuild."
b33956fbd953 2007-01-03 Simon Josefsson <simon@josefsson.org>
Simon Josefsson <simon@josefsson.org>
parents: 7771
diff changeset
2696 echo "AC_CANONICAL_BUILD"
b33956fbd953 2007-01-03 Simon Josefsson <simon@josefsson.org>
Simon Josefsson <simon@josefsson.org>
parents: 7771
diff changeset
2697 echo "AC_CANONICAL_HOST"
b33956fbd953 2007-01-03 Simon Josefsson <simon@josefsson.org>
Simon Josefsson <simon@josefsson.org>
parents: 7771
diff changeset
2698 echo
7106
b9fff044578d Apply last patch also to --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7105
diff changeset
2699 echo "m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
7486
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
2700 echo "m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
2701 echo "m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
2702 echo "m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
7106
b9fff044578d Apply last patch also to --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7105
diff changeset
2703 echo
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2704 echo "AC_PROG_RANLIB"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2705 echo
7641
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
2706 if test -n "$uses_subdirs"; then
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
2707 echo "AM_PROG_CC_C_O"
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
2708 echo
d6fbdb213b01 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 7640
diff changeset
2709 fi
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2710 if grep AC_GNU_SOURCE "$testdir/$m4base"/*.m4 >/dev/null 2>/dev/null; then
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2711 echo "AC_GNU_SOURCE"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2712 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2713 fi
8079
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
2714 for module in $modules; do
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
2715 func_verify_nontests_module
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
2716 if test -n "$module"; then
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
2717 func_get_autoconf_early_snippet "$module"
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
2718 fi
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
2719 done \
0951beec5b89 New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 8055
diff changeset
2720 | sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
2721 if test "$libtool" = true; then
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
2722 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
7286
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2723 echo "gl_cond_libtool=true"
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
2724 else
6418
e0a8b9b05999 Proper autoconf macro argument quoting.
Bruno Haible <bruno@clisp.org>
parents: 6414
diff changeset
2725 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
7286
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2726 echo "gl_cond_libtool=false"
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2727 echo "gl_libdeps="
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2728 echo "gl_ltlibdeps="
6414
46d47c8fe734 * gnulib-tool: Define automake conditional GL_COND_LIBTOOL if
Simon Josefsson <simon@josefsson.org>
parents: 6389
diff changeset
2729 fi
7348
7d0519d18212 Pass to the gl_GETLOADAVG macro the $gl_source_base from gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents: 7347
diff changeset
2730 echo "gl_source_base='$sourcebase'"
7090
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2731 # Wrap the set of autoconf snippets into an autoconf macro that is then
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2732 # invoked. This is needed because autoconf does not support AC_REQUIRE
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2733 # at the top level:
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2734 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2735 # but we want the AC_REQUIRE to have its normal meaning (provide one
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2736 # expansion of the required macro before the current point, and only one
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2737 # expansion total).
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2738 echo "AC_DEFUN([gl_INIT], ["
7486
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
2739 func_emit_initmacro_start
6556
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2740 if test "$auxdir" != "build-aux"; then
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2741 sed_replace_build_aux='
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2742 :a
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2743 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2744 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2745 ba
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2746 }'
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2747 sed_replace_build_aux=`echo "$sed_replace_build_aux" | sed -e 1d -e 's/^ *//'`
6556
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2748 else
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2749 sed_replace_build_aux=
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2750 fi
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2751 for module in $modules; do
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2752 func_verify_nontests_module
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2753 if test -n "$module"; then
6546
b32846b4d88d Replace build-aux when it occurs in the autoconf snippet.
Bruno Haible <bruno@clisp.org>
parents: 6533
diff changeset
2754 func_get_autoconf_snippet "$module" \
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2755 | sed -e "$sed_replace_build_aux"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2756 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2757 done
7286
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2758 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2759 # created using libtool, because libtool already handles the dependencies.
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2760 if test "$libtool" != true; then
8040
3905dae579b6 * gnulib-tool (func_emit_lib_Makefile_am, func_add_or_update)
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7981
diff changeset
2761 libname_upper=`echo "$libname" | LC_ALL=C tr 'a-z' 'A-Z'`
7286
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2762 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2763 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2764 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2765 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
727bb5526bad For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 7270
diff changeset
2766 fi
7486
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
2767 func_emit_initmacro_end
7090
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2768 echo "])"
7486
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
2769 func_emit_initmacro_done
46b72819ef52 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 7485
diff changeset
2770 echo
7090
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2771 echo "gl_INIT"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2772 echo
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2773 if test -n "$subdirs_with_configure_ac"; then
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2774 echo "AC_CONFIG_SUBDIRS(["`echo $subdirs_with_configure_ac`"])"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2775 fi
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2776 makefiles="Makefile"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2777 for d in $subdirs; do
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2778 # For subdirs that have a configure.ac by their own, it's the subdir's
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2779 # configure.ac which creates the subdir's Makefile.am, not this one.
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2780 case " $subdirs_with_configure_ac " in
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2781 *" $d "*) ;;
7323
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
2782 *) func_append makefiles " $d/Makefile" ;;
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2783 esac
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2784 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2785 echo "AC_OUTPUT([$makefiles])"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2786 ) > "$testdir/configure.ac"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2787
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2788 # Create autogenerated files.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2789 (cd "$testdir"
7485
0194db3ad154 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7484
diff changeset
2790 # Do not use "${AUTORECONF} --force --install", because it may invoke
0194db3ad154 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7484
diff changeset
2791 # autopoint, which brings in older versions of some of our .m4 files.
0194db3ad154 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7484
diff changeset
2792 if test -f $m4base/gettext.m4; then
0194db3ad154 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7484
diff changeset
2793 echo "executing ${AUTOPOINT} --force"
7638
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2794 ${AUTOPOINT} --force || func_exit 1
7485
0194db3ad154 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7484
diff changeset
2795 for f in $m4base/*.m4~; do
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2796 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit 1
7485
0194db3ad154 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7484
diff changeset
2797 done
0194db3ad154 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7484
diff changeset
2798 fi
7638
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2799 echo "executing ${ACLOCAL} -I $m4base"
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2800 ${ACLOCAL} -I $m4base || func_exit 1
7485
0194db3ad154 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7484
diff changeset
2801 if ! test -d build-aux; then
0194db3ad154 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7484
diff changeset
2802 echo "executing mkdir build-aux"
7638
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2803 mkdir build-aux || func_exit 1
7485
0194db3ad154 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7484
diff changeset
2804 fi
7638
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2805 echo "executing ${AUTOCONF}"
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2806 ${AUTOCONF} || func_exit 1
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2807 echo "executing ${AUTOHEADER}"
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2808 ${AUTOHEADER} || func_exit 1
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2809 echo "executing ${AUTOMAKE} --add-missing --copy"
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2810 ${AUTOMAKE} --add-missing --copy || func_exit 1
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2811 ) || func_exit 1
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2812 if test -n "$inctests"; then
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2813 # Create autogenerated files.
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2814 (cd "$testdir/$testsbase" || func_exit 1
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2815 # Do not use "${AUTORECONF} --force --install", because it may invoke
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2816 # autopoint, which brings in older versions of some of our .m4 files.
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2817 if test -f ../$m4base/gettext.m4; then
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2818 echo "executing ${AUTOPOINT} --force"
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2819 ${AUTOPOINT} --force || func_exit 1
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2820 for f in ../$m4base/*.m4~; do
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
2821 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit 1
7638
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2822 done
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2823 fi
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2824 echo "executing ${ACLOCAL} -I ../$m4base"
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2825 ${ACLOCAL} -I ../$m4base || func_exit 1
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2826 if ! test -d ../build-aux; then
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2827 echo "executing mkdir ../build-aux"
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2828 mkdir ../build-aux
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2829 fi
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2830 echo "executing ${AUTOCONF}"
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2831 ${AUTOCONF} || func_exit 1
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2832 echo "executing ${AUTOHEADER}"
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2833 ${AUTOHEADER} || func_exit 1
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2834 echo "executing ${AUTOMAKE} --add-missing --copy"
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2835 ${AUTOMAKE} --add-missing --copy || func_exit 1
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2836 ) || func_exit 1
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2837 fi
7866
58d9bcb3d6c4 Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 7858
diff changeset
2838 # Need to run configure and make once, to create built files that are to be
58d9bcb3d6c4 Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 7858
diff changeset
2839 # distributed (such as getdate.c).
8410
bf7fdc3211a4 Avoiding the "./configure && make && make distclean" did not work most of the
Bruno Haible <bruno@clisp.org>
parents: 8356
diff changeset
2840 # Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...".
7866
58d9bcb3d6c4 Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 7858
diff changeset
2841 cleaned_files=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \
8503
7c0e7f4f1ac1 * gnulib-tool: Rearrange space-tab sequences, since some editors
Eric Blake <ebb9@byu.net>
parents: 8451
diff changeset
2842 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
8410
bf7fdc3211a4 Avoiding the "./configure && make && make distclean" did not work most of the
Bruno Haible <bruno@clisp.org>
parents: 8356
diff changeset
2843 cleaned_files=`for file in $cleaned_files; do echo " $file "; done`
7866
58d9bcb3d6c4 Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 7858
diff changeset
2844 # Extract the value of "BUILT_SOURCES += ...". Remove variable references
58d9bcb3d6c4 Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 7858
diff changeset
2845 # such $(FOO_H) because they don't refer to distributed files.
58d9bcb3d6c4 Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 7858
diff changeset
2846 sed_remove_make_variables='s,[$]([A-Za-z0-9_]*),,g'
58d9bcb3d6c4 Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 7858
diff changeset
2847 built_sources=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \
8503
7c0e7f4f1ac1 * gnulib-tool: Rearrange space-tab sequences, since some editors
Eric Blake <ebb9@byu.net>
parents: 8451
diff changeset
2848 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
7866
58d9bcb3d6c4 Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 7858
diff changeset
2849 | sed -e "$sed_remove_make_variables"`
58d9bcb3d6c4 Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 7858
diff changeset
2850 distributed_built_sources=`for file in $built_sources; do
58d9bcb3d6c4 Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 7858
diff changeset
2851 case "$cleaned_files" in
58d9bcb3d6c4 Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 7858
diff changeset
2852 *" "$file" "*) ;;
58d9bcb3d6c4 Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 7858
diff changeset
2853 *) echo $file ;;
58d9bcb3d6c4 Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 7858
diff changeset
2854 esac;
58d9bcb3d6c4 Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 7858
diff changeset
2855 done`
58d9bcb3d6c4 Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 7858
diff changeset
2856 if test -n "$distributed_built_sources"; then
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2857 (cd "$testdir"
7638
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2858 ./configure || func_exit 1
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2859 cd "$sourcebase"
6389
c1766dccfd4f Simplification, from Stepan Kasal.
Bruno Haible <bruno@clisp.org>
parents: 6380
diff changeset
2860 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
7638
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2861 make built_sources || func_exit 1
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2862 cd ..
7638
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2863 make distclean || func_exit 1
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2864 ) || func_exit 1
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2865 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2866 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2867
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2868 # func_create_megatestdir megatestdir allmodules
6109
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
2869 # Input:
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
2870 # - local_gnulib_dir from --local-dir
6109
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
2871 # - auxdir directory relative to destdir where to place build aux files
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2872 func_create_megatestdir ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2873 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2874 megatestdir="$1"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2875 allmodules="$2"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2876 if test -z "$allmodules"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2877 allmodules=`func_all_modules`
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2878 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2879
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2880 megasubdirs=
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2881 # First, all modules one by one.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2882 for onemodule in $allmodules; do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2883 func_create_testdir "$megatestdir/$onemodule" $onemodule
7323
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
2884 func_append megasubdirs "$onemodule "
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2885 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2886 # Then, all modules all together.
7350
6c5c8c8b93a3 Don't include the config-h module in megatestdir.
Bruno Haible <bruno@clisp.org>
parents: 7348
diff changeset
2887 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2888 # Except fnmatch-posix, which conflicts with fnmatch-gnu. FIXME.
7350
6c5c8c8b93a3 Don't include the config-h module in megatestdir.
Bruno Haible <bruno@clisp.org>
parents: 7348
diff changeset
2889 allmodules=`for m in $allmodules; do if test $m != config-h && test $m != fnmatch-posix; then echo $m; fi; done`
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2890 func_create_testdir "$megatestdir/ALL" "$allmodules"
7323
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
2891 func_append megasubdirs "ALL"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2892
8416
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2893 # Create autobuild.
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2894 cvsdate=`sh "$gnulib_dir/build-aux/mdate-sh" "$gnulib_dir/CVS/Entries" \
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2895 | sed -e 's,January,01,' -e 's,Jan,01,' \
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2896 -e 's,February,02,' -e 's,Feb,02,' \
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2897 -e 's,March,03,' -e 's,Mar,03,' \
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2898 -e 's,April,04,' -e 's,Apr,04,' \
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2899 -e 's,May,05,' \
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2900 -e 's,June,06,' -e 's,Jun,06,' \
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2901 -e 's,July,07,' -e 's,Jul,07,' \
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2902 -e 's,August,08,' -e 's,Aug,08,' \
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2903 -e 's,September,09,' -e 's,Sep,09,' \
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2904 -e 's,October,10,' -e 's,Oct,10,' \
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2905 -e 's,November,11,' -e 's,Nov,11,' \
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2906 -e 's,December,12,' -e 's,Dec,12,' \
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2907 | sed -e 's,^,00,' | sed -e 's,^[0-9]*\([0-9][0-9] \),\1,' \
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2908 | sed -e 's,^\([0-9]*\) \([0-9]*\) \([0-9]*\),\3\2\1,'`
8418
6840759b4ce2 Start the autobuild script with /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 8416
diff changeset
2909 (echo '#!/bin/sh'
6840759b4ce2 Start the autobuild script with /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 8416
diff changeset
2910 echo "CVSDATE=$cvsdate"
8416
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2911 echo "test -d logs || mkdir logs"
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2912 echo "for module in $megasubdirs; do"
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2913 echo " echo \"Working on module \$module...\""
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2914 echo " safemodule=\`echo \$module | sed -e 's|/|-|g'\`"
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2915 echo " (echo \"To: gnulib@autobuild.josefsson.org\""
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2916 echo " echo"
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2917 echo " set -x"
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2918 echo " : autobuild project... \$module"
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2919 echo " : autobuild revision... cvs-\$CVSDATE-000000"
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2920 echo " : autobuild timestamp... \`date \"+%Y%m%d-%H%M%S\"\`"
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2921 echo " : autobuild hostname... \`hostname\`"
8432
2c533460124b Request a "make distclean" after successful "make check", to save disk space.
Bruno Haible <bruno@clisp.org>
parents: 8419
diff changeset
2922 echo " cd \$module && ./configure \$CONFIGURE_OPTIONS && make && make check && make distclean"
8416
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2923 echo " echo rc=\$?"
8419
d5e85ac6458c Avoid using sed -e "", not supported by AIX sed.
Bruno Haible <bruno@clisp.org>
parents: 8418
diff changeset
2924 echo " ) 2>&1 | { if test -n \"\$AUTOBUILD_SUBST\"; then sed -e \"\$AUTOBUILD_SUBST\"; else cat; fi; } > logs/\$safemodule"
8416
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2925 echo "done"
8672
c00e30e9aba4 2007-04-12 Simon Josefsson <simon@josefsson.org>
Simon Josefsson <simon@josefsson.org>
parents: 8668
diff changeset
2926 ) > "$megatestdir/do-autobuild"
c00e30e9aba4 2007-04-12 Simon Josefsson <simon@josefsson.org>
Simon Josefsson <simon@josefsson.org>
parents: 8668
diff changeset
2927 chmod a+x "$megatestdir/do-autobuild"
8416
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2928
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2929 # Create Makefile.am.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2930 (echo "## Process this file with automake to produce Makefile.in."
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2931 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2932 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2933 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2934 echo "SUBDIRS = $megasubdirs"
8416
0bf5cb89a6b9 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 8410
diff changeset
2935 echo
8672
c00e30e9aba4 2007-04-12 Simon Josefsson <simon@josefsson.org>
Simon Josefsson <simon@josefsson.org>
parents: 8668
diff changeset
2936 echo "EXTRA_DIST = do-autobuild"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2937 ) > "$megatestdir/Makefile.am"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2938
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2939 # Create configure.ac.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2940 (echo "# Process this file with autoconf to produce a configure script."
6106
66bd85c8a9cd Proper autoconf macro argument quoting.
Bruno Haible <bruno@clisp.org>
parents: 6039
diff changeset
2941 echo "AC_INIT([dummy], [0])"
6109
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
2942 if test "$auxdir" != "."; then
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
2943 echo "AC_CONFIG_AUX_DIR([$auxdir])"
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
2944 fi
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2945 echo "AM_INIT_AUTOMAKE"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2946 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2947 echo "AC_PROG_MAKE_SET"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2948 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2949 echo "AC_CONFIG_SUBDIRS([$megasubdirs])"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2950 echo "AC_OUTPUT([Makefile])"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2951 ) > "$megatestdir/configure.ac"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2952
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2953 # Create autogenerated files.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2954 (cd "$megatestdir"
6547
1a65fb7ddbbb Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 6546
diff changeset
2955 # Do not use "${AUTORECONF} --install", because autoreconf operates
1a65fb7ddbbb Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 6546
diff changeset
2956 # recursively, but the subdirectories are already finished, therefore
1a65fb7ddbbb Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 6546
diff changeset
2957 # calling autoreconf here would only waste lots of CPU time.
1a65fb7ddbbb Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 6546
diff changeset
2958 echo "executing ${ACLOCAL}"
7638
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2959 ${ACLOCAL} || func_exit 1
6547
1a65fb7ddbbb Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 6546
diff changeset
2960 echo "executing mkdir build-aux"
1a65fb7ddbbb Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 6546
diff changeset
2961 mkdir build-aux
1a65fb7ddbbb Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 6546
diff changeset
2962 echo "executing ${AUTOCONF}"
7638
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2963 ${AUTOCONF} || func_exit 1
6547
1a65fb7ddbbb Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 6546
diff changeset
2964 echo "executing ${AUTOMAKE} --add-missing --copy"
7638
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2965 ${AUTOMAKE} --add-missing --copy || func_exit 1
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
2966 ) || func_exit 1
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2967 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2968
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2969 case $mode in
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2970 "" )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2971 func_fatal_error "no mode specified" ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2972
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2973 list )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2974 func_all_modules
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2975 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2976
6443
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
2977 import | update )
6940
ca8592ba8eba * gnulib-tool (func_get_filelist): Don't echo m4/onceonly_2_57.m4,
Paul Eggert <eggert@cs.ucla.edu>
parents: 6862
diff changeset
2978
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
2979 # Where to import.
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
2980 if test -z "$destdir"; then
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
2981 destdir=.
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
2982 fi
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
2983 test -d "$destdir" \
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
2984 || func_fatal_error "destination directory does not exist: $destdir"
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
2985
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2986 # Prefer configure.ac to configure.in.
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2987 if test -f "$destdir"/configure.ac; then
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2988 configure_ac="$destdir/configure.ac"
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2989 else
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2990 if test -f "$destdir"/configure.in; then
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2991 configure_ac="$destdir/configure.in"
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2992 else
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2993 func_fatal_error "cannot find $destdir/configure.ac"
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2994 fi
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2995 fi
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2996
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2997 # Analyze configure.ac.
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2998 guessed_auxdir="."
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
2999 guessed_libtool=false
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3000 my_sed_traces='
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3001 s,#.*$,,
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3002 s,^dnl .*$,,
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3003 s, dnl .*$,,
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3004 /AC_CONFIG_AUX_DIR/ {
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3005 s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^])]*\).*$,guessed_auxdir="\1",p
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
3006 }
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3007 /A[CM]_PROG_LIBTOOL/ {
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3008 s,^.*$,guessed_libtool=true,p
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3009 }'
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
3010 eval `sed -n -e "$my_sed_traces" < "$configure_ac"`
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
3011
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3012 if test -z "$auxdir"; then
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3013 auxdir="$guessed_auxdir"
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
3014 fi
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
3015
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3016 # Determine where to apply func_import.
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3017 if test -n "$m4base"; then
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3018 # Apply func_import to a particular gnulib directory.
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3019 # Any number of additional modules can be given.
6204
104bcb14d247 Provide defaults where needed.
Bruno Haible <bruno@clisp.org>
parents: 6199
diff changeset
3020 if test ! -f "$destdir/$m4base"/gnulib-cache.m4; then
104bcb14d247 Provide defaults where needed.
Bruno Haible <bruno@clisp.org>
parents: 6199
diff changeset
3021 # First use of gnulib in the given m4base.
104bcb14d247 Provide defaults where needed.
Bruno Haible <bruno@clisp.org>
parents: 6199
diff changeset
3022 test -n "$supplied_libname" || supplied_libname=true
104bcb14d247 Provide defaults where needed.
Bruno Haible <bruno@clisp.org>
parents: 6199
diff changeset
3023 test -n "$sourcebase" || sourcebase="lib"
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
3024 test -n "$docbase" || docbase="doc"
6262
bef30dac846f Provide a default for --tests-base.
Bruno Haible <bruno@clisp.org>
parents: 6250
diff changeset
3025 test -n "$testsbase" || testsbase="tests"
6204
104bcb14d247 Provide defaults where needed.
Bruno Haible <bruno@clisp.org>
parents: 6199
diff changeset
3026 test -n "$macro_prefix" || macro_prefix="gl"
104bcb14d247 Provide defaults where needed.
Bruno Haible <bruno@clisp.org>
parents: 6199
diff changeset
3027 fi
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3028 func_import "$*"
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3029 else
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3030 # Apply func_import to all gnulib directories.
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3031 # To get this list of directories, look at Makefile.am. (Not at
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3032 # configure, because it may be omitted from CVS. Also, don't run
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3033 # "find $destdir -name gnulib-cache.m4", as it might be too expensive.)
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3034 m4dirs=
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3035 m4dirs_count=0
7072
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3036 if test -f "$destdir"/Makefile.am; then
8040
3905dae579b6 * gnulib-tool (func_emit_lib_Makefile_am, func_add_or_update)
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7981
diff changeset
3037 aclocal_amflags=`sed -n 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/p' "$destdir"/Makefile.am`
7072
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3038 m4dir_is_next=
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3039 for arg in $aclocal_amflags; do
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3040 if test -n "$m4dir_is_next"; then
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3041 # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3042 case "$arg" in
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3043 /*) ;;
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3044 *)
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3045 if test -f "$destdir/$arg"/gnulib-cache.m4; then
7323
7ca0e325d5db Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 7322
diff changeset
3046 func_append m4dirs " $arg"
7072
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3047 m4dirs_count=`expr $m4dirs_count + 1`
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3048 fi
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3049 ;;
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3050 esac
8040
3905dae579b6 * gnulib-tool (func_emit_lib_Makefile_am, func_add_or_update)
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7981
diff changeset
3051 m4dir_is_next=
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3052 else
7072
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3053 if test "X$arg" = "X-I"; then
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3054 m4dir_is_next=yes
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3055 else
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3056 m4dir_is_next=
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3057 fi
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3058 fi
7072
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3059 done
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3060 else
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3061 # No Makefile.am! Oh well. Look at the last generated aclocal.m4.
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3062 if test -f "$destdir"/aclocal.m4; then
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3063 sedexpr1='s,^m4_include(\[\(.*\)])$,\1,p'
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3064 sedexpr2='s,^[^/]*$,.,'
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3065 sedexpr3='s,/[^/]*$,,'
7752
fc2ff707c74b * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7737
diff changeset
3066 m4dirs=`sed -n -e "$sedexpr1" aclocal.m4 | sed -e "$sedexpr2" -e "$sedexpr3" | LC_ALL=C sort -u`
7072
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3067 m4dirs_count=`echo "$m4dirs" | wc -l`
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3068 fi
7072
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
3069 fi
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3070 if test $m4dirs_count = 0; then
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3071 # First use of gnulib in a package.
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3072 # Any number of additional modules can be given.
6190
605b7cac11f2 Don't complain about missing options in the first-use case.
Bruno Haible <bruno@clisp.org>
parents: 6189
diff changeset
3073 test -n "$supplied_libname" || supplied_libname=true
605b7cac11f2 Don't complain about missing options in the first-use case.
Bruno Haible <bruno@clisp.org>
parents: 6189
diff changeset
3074 test -n "$sourcebase" || sourcebase="lib"
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3075 m4base="m4"
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
3076 test -n "$docbase" || docbase="doc"
6262
bef30dac846f Provide a default for --tests-base.
Bruno Haible <bruno@clisp.org>
parents: 6250
diff changeset
3077 test -n "$testsbase" || testsbase="tests"
6190
605b7cac11f2 Don't complain about missing options in the first-use case.
Bruno Haible <bruno@clisp.org>
parents: 6189
diff changeset
3078 test -n "$macro_prefix" || macro_prefix="gl"
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3079 func_import "$*"
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3080 else
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3081 if test $m4dirs_count = 1; then
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3082 # There's only one use of gnulib here. Assume the user means it.
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3083 # Any number of additional modules can be given.
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3084 for m4base in $m4dirs; do
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3085 func_import "$*"
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3086 done
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3087 else
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3088 # Ambiguous - guess what the user meant.
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3089 if test $# = 0; then
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3090 # No further arguments. Guess the user wants to update all of them.
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3091 for m4base in $m4dirs; do
7239
e6f5fe9992ff Fix problem when calling "gnulib-tool --update" on multiple directories.
Bruno Haible <bruno@clisp.org>
parents: 7235
diff changeset
3092 # Perform func_import in a subshell, so that variable values
e6f5fe9992ff Fix problem when calling "gnulib-tool --update" on multiple directories.
Bruno Haible <bruno@clisp.org>
parents: 7235
diff changeset
3093 # such as
e6f5fe9992ff Fix problem when calling "gnulib-tool --update" on multiple directories.
Bruno Haible <bruno@clisp.org>
parents: 7235
diff changeset
3094 # local_gnulib_dir, avoidlist, sourcebase, m4base, docbase,
8890
576d3e4f31c2 Remember the presence of the --with-tests command-line option through
Bruno Haible <bruno@clisp.org>
parents: 8672
diff changeset
3095 # testsbase, inctests, libname, lgpl, makefile_name, libtool,
576d3e4f31c2 Remember the presence of the --with-tests command-line option through
Bruno Haible <bruno@clisp.org>
parents: 8672
diff changeset
3096 # macro_prefix
7239
e6f5fe9992ff Fix problem when calling "gnulib-tool --update" on multiple directories.
Bruno Haible <bruno@clisp.org>
parents: 7235
diff changeset
3097 # don't propagate from one directory to another.
7332
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
3098 (func_import) || func_exit 1
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3099 done
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3100 else
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3101 # Really ambiguous.
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3102 func_fatal_error "Ambiguity: to which directory should the modules be added? Please specify at least --m4-base=..."
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3103 fi
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3104 fi
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
3105 fi
6178
3830993b4c7a Rename some variables.
Bruno Haible <bruno@clisp.org>
parents: 6177
diff changeset
3106 fi
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
3107 ;;
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3108
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3109 create-testdir )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3110 if test -z "$destdir"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3111 func_fatal_error "please specify --dir option"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3112 fi
4126
e8caa337b4e1 (create-testdir): don't complain if destdir
Karl Berry <karl@freefriends.org>
parents: 4124
diff changeset
3113 mkdir "$destdir"
e8caa337b4e1 (create-testdir): don't complain if destdir
Karl Berry <karl@freefriends.org>
parents: 4124
diff changeset
3114 test -d "$destdir" \
e8caa337b4e1 (create-testdir): don't complain if destdir
Karl Berry <karl@freefriends.org>
parents: 4124
diff changeset
3115 || func_fatal_error "could not create destination directory"
6109
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
3116 test -n "$auxdir" || auxdir="build-aux"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3117 func_create_testdir "$destdir" "$*"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3118 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3119
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3120 create-megatestdir )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3121 if test -z "$destdir"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3122 func_fatal_error "please specify --dir option"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3123 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3124 mkdir "$destdir" || func_fatal_error "could not create destination directory"
6109
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
3125 test -n "$auxdir" || auxdir="build-aux"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3126 func_create_megatestdir "$destdir" "$*"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3127 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3128
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3129 test )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3130 test -n "$destdir" || destdir=testdir$$
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3131 mkdir "$destdir" || func_fatal_error "could not create destination directory"
6109
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
3132 test -n "$auxdir" || auxdir="build-aux"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3133 func_create_testdir "$destdir" "$*"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3134 cd "$destdir"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3135 mkdir build
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3136 cd build
7638
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
3137 ../configure || func_exit 1
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
3138 make || func_exit 1
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
3139 make check || func_exit 1
581c011e05d6 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7605
diff changeset
3140 make distclean || func_exit 1
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3141 remaining=`find . -type f -print`
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3142 if test -n "$remaining"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3143 echo "Remaining files:" $remaining 1>&2
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3144 echo "gnulib-tool: *** Stop." 1>&2
7332
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
3145 func_exit 1
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3146 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3147 cd ..
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3148 cd ..
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3149 rm -rf "$destdir"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3150 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3151
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3152 megatest )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3153 test -n "$destdir" || destdir=testdir$$
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3154 mkdir "$destdir" || func_fatal_error "could not create destination directory"
6109
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
3155 test -n "$auxdir" || auxdir="build-aux"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3156 func_create_megatestdir "$destdir" "$*"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3157 cd "$destdir"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3158 mkdir build
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3159 cd build
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3160 ../configure
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3161 make
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3162 make check
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3163 make distclean
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3164 remaining=`find . -type f -print`
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3165 if test -n "$remaining"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3166 echo "Remaining files:" $remaining 1>&2
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3167 echo "gnulib-tool: *** Stop." 1>&2
7332
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
3168 func_exit 1
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3169 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3170 cd ..
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3171 cd ..
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3172 rm -rf "$destdir"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3173 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3174
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3175 extract-description )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3176 for module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3177 do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3178 func_verify_module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3179 if test -n "$module"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3180 func_get_description "$module"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3181 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3182 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3183 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3184
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3185 extract-filelist )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3186 for module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3187 do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3188 func_verify_module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3189 if test -n "$module"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3190 func_get_filelist "$module"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3191 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3192 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3193 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3194
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3195 extract-dependencies )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3196 for module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3197 do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3198 func_verify_module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3199 if test -n "$module"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3200 func_get_dependencies "$module"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3201 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3202 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3203 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3204
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3205 extract-autoconf-snippet )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3206 for module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3207 do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3208 func_verify_module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3209 if test -n "$module"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3210 func_get_autoconf_snippet "$module"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3211 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3212 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3213 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3214
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3215 extract-automake-snippet )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3216 for module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3217 do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3218 func_verify_module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3219 if test -n "$module"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3220 func_get_automake_snippet "$module"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3221 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3222 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3223 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3224
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3225 extract-include-directive )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3226 for module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3227 do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3228 func_verify_module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3229 if test -n "$module"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3230 func_get_include_directive "$module"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3231 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3232 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3233 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3234
8055
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
3235 extract-link-directive )
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
3236 for module
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
3237 do
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
3238 func_verify_module
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
3239 if test -n "$module"; then
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
3240 func_get_link_directive "$module"
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
3241 fi
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
3242 done
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
3243 ;;
5c79d44f739d New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 8040
diff changeset
3244
5251
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
3245 extract-license )
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
3246 for module
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
3247 do
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
3248 func_verify_module
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
3249 if test -n "$module"; then
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
3250 func_get_license "$module"
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
3251 fi
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
3252 done
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
3253 ;;
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
3254
4197
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
3255 extract-maintainer )
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
3256 for module
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
3257 do
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
3258 func_verify_module
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
3259 if test -n "$module"; then
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
3260 func_get_maintainer "$module"
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
3261 fi
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
3262 done
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
3263 ;;
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
3264
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
3265 extract-tests-module )
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
3266 for module
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
3267 do
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
3268 func_verify_module
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
3269 if test -n "$module"; then
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
3270 func_get_tests_module "$module"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
3271 fi
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
3272 done
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
3273 ;;
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
3274
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3275 * )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3276 func_fatal_error "unknown operation mode --$mode" ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3277 esac
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3278
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
3279 rm -rf "$tmp"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
3280 # Undo the effect of the previous 'trap' command. Some shellology:
7332
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
3281 # We cannot use "trap - 0 1 2 3 13 15", because Solaris sh would attempt to
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
3282 # execute the command "-". "trap '' ..." is fine only for signal 0 (= normal
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
3283 # exit); for the others we need to call 'exit' explicitly. The value of $? is
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
3284 # 128 + signal number and is set before the trap-registered command is run.
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
3285 trap '' 0
7332
dd6e80d0c89e * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 7327
diff changeset
3286 trap 'func_exit $?' 1 2 3 13 15
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
3287
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3288 exit 0
7241
aed440dca701 * gnulib-tool: Don't let emacs change spaces to TAB.
Eric Blake <ebb9@byu.net>
parents: 7240
diff changeset
3289
aed440dca701 * gnulib-tool: Don't let emacs change spaces to TAB.
Eric Blake <ebb9@byu.net>
parents: 7240
diff changeset
3290 # Local Variables:
aed440dca701 * gnulib-tool: Don't let emacs change spaces to TAB.
Eric Blake <ebb9@byu.net>
parents: 7240
diff changeset
3291 # indent-tabs-mode: nil
aed440dca701 * gnulib-tool: Don't let emacs change spaces to TAB.
Eric Blake <ebb9@byu.net>
parents: 7240
diff changeset
3292 # whitespace-check-buffer-indent: nil
aed440dca701 * gnulib-tool: Don't let emacs change spaces to TAB.
Eric Blake <ebb9@byu.net>
parents: 7240
diff changeset
3293 # End: