annotate gnulib-tool @ 7216:91df49e70c77

New option --makefile-name.
author Bruno Haible <bruno@clisp.org>
date Mon, 28 Aug 2006 15:22:55 +0000
parents 3869ca15e2bb
children 06eec4eaf416
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 #
6512
f8abe8d41137 RANLIB is needed.
Bruno Haible <bruno@clisp.org>
parents: 6464
diff changeset
3 # Copyright (C) 2002-2006 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
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
25 cvsdatestamp='$Date: 2006-08-28 15:22: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'`
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 # 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
30 AUTOCONFPATH=
5250
46a747db97f2 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 5237
diff changeset
31 #case $USER in
46a747db97f2 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 5237
diff changeset
32 # bruno )
46a747db97f2 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 5237
diff changeset
33 # AUTOCONFBINDIR=/packages/gnu-inst-autoconf/2.57/bin
46a747db97f2 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 5237
diff changeset
34 # AUTOCONFPATH="eval env PATH=${AUTOCONFBINDIR}:\$PATH "
46a747db97f2 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 5237
diff changeset
35 # ;;
46a747db97f2 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 5237
diff changeset
36 #esac
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37
6547
1a65fb7ddbbb Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 6546
diff changeset
38 # 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
39 AUTOMAKEPATH=
1a65fb7ddbbb Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 6546
diff changeset
40
6551
d37637700b4e Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 6550
diff changeset
41 # If you didn't set AUTOCONFPATH and AUTOMAKEPATH, you can also set the
d37637700b4e Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 6550
diff changeset
42 # variables AUTOCONF, ACLOCAL, AUTOMAKE, AUTORECONF individually.
d37637700b4e Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 6550
diff changeset
43 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
44 AUTOCONF="${AUTOCONFPATH}autoconf"
d37637700b4e Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 6550
diff changeset
45 fi
d37637700b4e Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 6550
diff changeset
46 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
47 ACLOCAL="${AUTOMAKEPATH}aclocal"
d37637700b4e Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 6550
diff changeset
48 fi
d37637700b4e Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 6550
diff changeset
49 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
50 AUTOMAKE="${AUTOMAKEPATH}automake"
d37637700b4e Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 6550
diff changeset
51 fi
d37637700b4e Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 6550
diff changeset
52 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
53 AUTORECONF="${AUTOCONFPATH}autoreconf"
d37637700b4e Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 6550
diff changeset
54 fi
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55
7071
71c5caf223fc Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 7070
diff changeset
56 # GNU sort is needed. Set SORT to its location (not needed if it's called
71c5caf223fc Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 7070
diff changeset
57 # 'sort' and already in the PATH).
71c5caf223fc Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 7070
diff changeset
58 if test -z "$SORT"; then
71c5caf223fc Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 7070
diff changeset
59 SORT=sort
71c5caf223fc Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 7070
diff changeset
60 fi
71c5caf223fc Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 7070
diff changeset
61
7199
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
62 nl='
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
63 '
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
64
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
65 # func_usage
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
66 # outputs to stdout the --help usage message.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
67 func_usage ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
68 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
69 echo "\
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
70 Usage: gnulib-tool --list
5344
c2f5677fc6ed Initialize supplied_libname. Tweak usage message.
Bruno Haible <bruno@clisp.org>
parents: 5343
diff changeset
71 gnulib-tool --import [module1 ... moduleN]
6443
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
72 gnulib-tool --update
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
73 gnulib-tool --create-testdir --dir=directory module1 ... moduleN
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
74 gnulib-tool --create-megatestdir --dir=directory [module1 ... moduleN]
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
75 gnulib-tool --test --dir=directory module1 ... moduleN
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
76 gnulib-tool --megatest --dir=directory [module1 ... moduleN]
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
77 gnulib-tool --extract-description module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
78 gnulib-tool --extract-filelist module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
79 gnulib-tool --extract-dependencies module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
80 gnulib-tool --extract-autoconf-snippet module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
81 gnulib-tool --extract-automake-snippet module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
82 gnulib-tool --extract-include-directive module
5251
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
83 gnulib-tool --extract-license module
4197
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
84 gnulib-tool --extract-maintainer module
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
85 gnulib-tool --extract-tests-module module
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
86
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
87 Operation modes:
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
88 --list print the available module names
6633
5118aa463328 * gnulib-tool (Usage): Fix --import, from
Simon Josefsson <simon@josefsson.org>
parents: 6614
diff changeset
89 --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
90 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
91 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
92 --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
93 from CVS
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
94 --create-testdir create a scratch package with the given modules
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
95 --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
96 one by one and all together
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
97 --test test the combination of the given modules
4197
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
98 (recommended to use CC=\"gcc -Wall\" here)
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
99 --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
100 (recommended to use CC=\"gcc -Wall\" here)
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
101 --extract-description extract the description
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
102 --extract-filelist extract the list of files
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
103 --extract-dependencies extract the dependencies
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
104 --extract-autoconf-snippet extract the snippet for configure.ac
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
105 --extract-automake-snippet extract the snippet for lib/Makefile.am
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
106 --extract-include-directive extract the #include directive
5251
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
107 --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
108 under lib/
4197
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
109 --extract-maintainer report the maintainer(s) inside gnulib
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
110 --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
111
7069
0fb5ef99e00f Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 7068
diff changeset
112 General options:
7068
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
113 --dir=DIRECTORY Specify the target directory.
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
114 For --import, this specifies where your
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
115 configure.ac can be found. Defaults to current
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
116 directory.
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
117 --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
118 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
119
0fb5ef99e00f Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 7068
diff changeset
120 Options for --import:
7068
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
121 --lib=LIBRARY Specify the library name. Defaults to 'libgnu'.
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
122 --source-base=DIRECTORY
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
123 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
124 placed (default \"lib\").
7068
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
125 --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
126 placed (default \"m4\").
0fb5ef99e00f Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 7068
diff changeset
127 --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
128 placed (default \"doc\").
7068
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
129 --tests-base=DIRECTORY
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
130 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
131 placed (default \"tests\").
7068
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
132 --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
133 tools are placed (default \"build-aux\").
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
134 --with-tests Include unit tests for the included modules.
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
135 --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
136 have code that provides equivalent functionality.
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
137 This option can be repeated.
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
138 --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
139 Also modify license template from GPL to LGPL.
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
140 --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
141 source-base and tests-base directories
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
142 (default \"Makefile.am\").
7069
0fb5ef99e00f Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 7068
diff changeset
143 --libtool Use libtool rules.
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
144 --no-libtool Don't use libtool rules.
7068
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
145 --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
146 'gl_INIT'. Default is 'gl'.
ec1cfcfd352a Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 7067
diff changeset
147 --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
148
0fb5ef99e00f Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 7068
diff changeset
149 Options for --import and --update:
6966
42730fffa002 help message tweaks
Karl Berry <karl@freefriends.org>
parents: 6955
diff changeset
150 --dry-run For --import, only print what would have been done.
42730fffa002 help message tweaks
Karl Berry <karl@freefriends.org>
parents: 6955
diff changeset
151 -s, --symbolic, --symlink Make symbolic links instead of copying files.
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
152
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
153 Report bugs to <bug-gnulib@gnu.org>."
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
154 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
155
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
156 # func_version
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
157 # outputs to stdout the --version message.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
158 func_version ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
159 {
6777
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
160 year=`echo "$last_checkin_date" | sed -e 's,/.*$,,'`
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
161 echo "$progname (GNU $package) $version"
6777
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
162 echo "Copyright (C) $year Free Software Foundation, Inc.
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
163 This is free software; see the source for copying conditions. There is NO
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
164 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
6111
4bc400780d6a Update copyright year and authors.
Bruno Haible <bruno@clisp.org>
parents: 6110
diff changeset
165 echo "Written by" "Bruno Haible" "and" "Simon Josefsson"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
166 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
167
6777
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
168 # func_emit_copyright_notice
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
169 # 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
170 func_emit_copyright_notice ()
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
171 {
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
172 echo "# Copyright (C) 2004-2006 Free Software Foundation, Inc."
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
173 echo "#"
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
174 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
175 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
176 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
177 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
178 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
179 echo "#"
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
180 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
181 }
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
182
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
183 # func_tmpdir
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
184 # creates a temporary directory.
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
185 # Sets variable
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
186 # - 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
187 func_tmpdir ()
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
188 {
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
189 # 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
190 # 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
191 # /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
192 : ${TMPDIR=/tmp}
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
193 {
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
194 # 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
195 # 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
196 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
197 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
198 } ||
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
199 {
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
200 # 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
201 # 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
202 # 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
203 # 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
204 # directory.
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
205 tmp=$TMPDIR/gl$$-$RANDOM
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
206 (umask 077 && mkdir "$tmp")
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
207 } ||
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
208 {
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
209 echo "$0: cannot create a temporary directory in $TMPDIR" >&2
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
210 { (exit 1); exit 1; }
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
211 }
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
212 }
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
213
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
214 # func_fatal_error message
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
215 # 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
216 func_fatal_error ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
217 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
218 echo "gnulib-tool: *** $1" 1>&2
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
219 echo "gnulib-tool: *** Stop." 1>&2
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
220 exit 1
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
221 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
222
6248
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
223 # func_readlink SYMLINK
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
224 # outputs the target of the given symlink.
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
225 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
226 func_readlink ()
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
227 {
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
228 # Use the readlink program from GNU coreutils.
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
229 readlink "$1"
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
230 }
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
231 else
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
232 func_readlink ()
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
233 {
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
234 # 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
235 # would do the wrong thing if the link target contains " -> ".
6248
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
236 LC_ALL=C ls -l "$1" | sed -e 's, -> ,#%%#,' | sed -n -e 's,^.*#%%#\(.*\)$,\1,p'
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
237 }
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
238 fi
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
239
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
240 # func_ln_if_changed SRC DEST
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
241 # Like ln -s, but avoids munging timestamps if the link is correct.
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
242 func_ln_if_changed ()
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
243 {
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
244 if test $# -ne 2; then
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
245 echo "usage: func_ln_if_changed SRC DEST" >&2
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
246 fi
6248
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
247 if test -L "$2" && test "$1" = "`func_readlink "$2"`"; then
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
248 :
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
249 else
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
250 rm -f "$2"
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
251 ln -s "$1" "$2"
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
252 fi
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
253 }
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
254
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
255 # func_relativize DIR1 DIR2
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
256 # 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
257 # Input:
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
258 # - 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
259 # - 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
260 # Output:
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
261 # - 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
262 func_relativize ()
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
263 {
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
264 dir0=`pwd`
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
265 dir1="$1"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
266 dir2="$2"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
267 sed_first='s,^\([^/]*\)/.*$,\1,'
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
268 sed_rest='s,^[^/]*/*,,'
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
269 sed_last='s,^.*/\([^/]*\)$,\1,'
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
270 sed_butlast='s,/*[^/]*$,,'
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
271 while test -n "$dir1"; do
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
272 first=`echo "$dir1" | sed -e "$sed_first"`
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
273 if test "$first" != "."; then
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
274 if test "$first" = ".."; then
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
275 dir2=`echo "$dir0" | sed -e "$sed_last"`/"$dir2"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
276 dir0=`echo "$dir0" | sed -e "$sed_butlast"`
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
277 else
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
278 first2=`echo "$dir2" | sed -e "$sed_first"`
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
279 if test "$first2" = "$first"; then
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
280 dir2=`echo "$dir2" | sed -e "$sed_rest"`
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
281 else
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
282 dir2="../$dir2"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
283 fi
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
284 dir0="$dir0"/"$first"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
285 fi
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
286 fi
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
287 dir1=`echo "$dir1" | sed -e "$sed_rest"`
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
288 done
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
289 reldir="$dir2"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
290 }
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
291
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
292 # func_relconcat DIR1 DIR2
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
293 # 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
294 # Input:
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
295 # - 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
296 # - 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
297 # Output:
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
298 # - 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
299 func_relconcat ()
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
300 {
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
301 dir1="$1"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
302 dir2="$2"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
303 sed_first='s,^\([^/]*\)/.*$,\1,'
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
304 sed_rest='s,^[^/]*/*,,'
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
305 sed_last='s,^.*/\([^/]*\)$,\1,'
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
306 sed_butlast='s,/*[^/]*$,,'
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
307 while true; do
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
308 first=`echo "$dir2" | sed -e "$sed_first"`
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
309 if test "$first" = "."; then
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
310 dir2=`echo "$dir2" | sed -e "$sed_rest"`
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
311 if test -z "$dir2"; then
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
312 relconcat="$dir1"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
313 break
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
314 fi
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
315 else
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
316 last=`echo "$dir1" | sed -e "$sed_last"`
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
317 while test "$last" = "."; do
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
318 dir1=`echo "$dir1" | sed -e "$sed_butlast"`
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
319 last=`echo "$dir1" | sed -e "$sed_last"`
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
320 done
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
321 if test -z "$dir1"; then
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
322 relconcat="$dir2"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
323 break
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
324 fi
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
325 if test "$first" = ".."; then
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
326 if test "$last" = ".."; then
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
327 relconcat="$dir1/$dir2"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
328 break
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
329 fi
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
330 dir1=`echo "$dir1" | sed -e "$sed_butlast"`
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
331 dir2=`echo "$dir2" | sed -e "$sed_rest"`
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
332 if test -z "$dir1"; then
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
333 relconcat="$dir2"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
334 break
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
335 fi
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
336 if test -z "$dir2"; then
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
337 relconcat="$dir1"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
338 break
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
339 fi
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
340 else
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
341 relconcat="$dir1/$dir2"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
342 break
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
343 fi
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
344 fi
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
345 done
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
346 }
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
347
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
348 # Command-line option processing.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
349 # Removes the OPTIONS from the arguments. Sets the variables:
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
350 # - mode list or import or create-testdir or create-megatestdir
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
351 # - destdir from --dir
7215
3869ca15e2bb Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 7214
diff changeset
352 # - 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
353 # - libname, supplied_libname from --lib
5198
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
354 # - sourcebase from --source-base
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
355 # - m4base from --m4-base
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
356 # - docbase from --doc-base
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
357 # - testsbase from --tests-base
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
358 # - auxdir from --aux-dir
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
359 # - inctests true if --with-tests was given, blank otherwise
5981
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
360 # - avoidlist list of modules to avoid, from --avoid
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
361 # - lgpl true if --lgpl was given, blank otherwise
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
362 # - makefile_name from --makefile-name
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
363 # - 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
364 # given, blank otherwise
6994
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
365 # - 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
366 # - autoconf_minversion minimum supported autoconf version
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
367 # - 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
368 # - doit : if actions shall be executed, false if only to be printed
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
369 # - symbolic true if --symbolic was given, blank otherwise
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
370 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
371 mode=
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
372 destdir=
7215
3869ca15e2bb Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 7214
diff changeset
373 local_gnulib_dir=
5198
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
374 libname=libgnu
5344
c2f5677fc6ed Initialize supplied_libname. Tweak usage message.
Bruno Haible <bruno@clisp.org>
parents: 5343
diff changeset
375 supplied_libname=
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
376 sourcebase=
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
377 m4base=
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
378 docbase=
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
379 testsbase=
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
380 auxdir=
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
381 inctests=
5981
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
382 avoidlist=
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
383 lgpl=
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
384 makefile_name=
5198
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
385 libtool=
6176
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
386 macro_prefix=
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
387 do_changelog=:
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
388 doit=:
5799
ad9eff556694 2005-04-15 Simon Josefsson <jas@extundo.com>
Simon Josefsson <simon@josefsson.org>
parents: 5798
diff changeset
389 symbolic=
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
390
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
391 supplied_opts="$@"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
392
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
393 while test $# -gt 0; do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
394 case "$1" in
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
395 --list | --lis )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
396 mode=list
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
397 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
398 --import | --impor | --impo | --imp | --im | --i )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
399 mode=import
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
400 shift ;;
6443
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
401 --update | --updat | --upda | --upd | --up | --u )
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
402 mode=update
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
403 shift ;;
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
404 --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
405 mode=create-testdir
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
406 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
407 --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
408 mode=create-megatestdir
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
409 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
410 --test | --tes | --te | --t )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
411 mode=test
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
412 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
413 --megatest | --megates | --megate | --megat | --mega | --meg | --me | --m )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
414 mode=megatest
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
415 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
416 --extract-* )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
417 mode=`echo "X$1" | sed -e 's/^X--//'`
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
418 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
419 --dir )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
420 shift
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
421 if test $# = 0; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
422 func_fatal_error "missing argument for --dir"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
423 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
424 destdir=$1
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
425 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
426 --dir=* )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
427 destdir=`echo "X$1" | sed -e 's/^X--dir=//'`
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
428 shift ;;
7215
3869ca15e2bb Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 7214
diff changeset
429 --local-dir )
3869ca15e2bb Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 7214
diff changeset
430 shift
3869ca15e2bb Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 7214
diff changeset
431 if test $# = 0; then
3869ca15e2bb Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 7214
diff changeset
432 func_fatal_error "missing argument for --local-dir"
3869ca15e2bb Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 7214
diff changeset
433 fi
3869ca15e2bb Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 7214
diff changeset
434 local_gnulib_dir=$1
3869ca15e2bb Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 7214
diff changeset
435 shift ;;
3869ca15e2bb Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 7214
diff changeset
436 --local-dir=* )
3869ca15e2bb Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 7214
diff changeset
437 local_gnulib_dir=`echo "X$1" | sed -e 's/^X--local-dir=//'`
3869ca15e2bb Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 7214
diff changeset
438 shift ;;
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
439 --lib )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
440 shift
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
441 if test $# = 0; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
442 func_fatal_error "missing argument for --lib"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
443 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
444 libname=$1
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
445 supplied_libname=true
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
446 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
447 --lib=* )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
448 libname=`echo "X$1" | sed -e 's/^X--lib=//'`
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
449 supplied_libname=true
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
450 shift ;;
5198
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
451 --source-base )
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
452 shift
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
453 if test $# = 0; then
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
454 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
455 fi
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
456 sourcebase=$1
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
457 shift ;;
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
458 --source-base=* )
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
459 sourcebase=`echo "X$1" | sed -e 's/^X--source-base=//'`
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
460 shift ;;
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
461 --m4-base )
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
462 shift
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
463 if test $# = 0; then
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
464 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
465 fi
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
466 m4base=$1
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
467 shift ;;
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
468 --m4-base=* )
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
469 m4base=`echo "X$1" | sed -e 's/^X--m4-base=//'`
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
470 shift ;;
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
471 --doc-base )
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
472 shift
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
473 if test $# = 0; then
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
474 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
475 fi
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
476 docbase=$1
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
477 shift ;;
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
478 --doc-base=* )
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
479 docbase=`echo "X$1" | sed -e 's/^X--doc-base=//'`
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
480 shift ;;
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
481 --tests-base )
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
482 shift
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
483 if test $# = 0; then
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
484 func_fatal_error "missing argument for --tests-base"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
485 fi
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
486 testsbase=$1
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
487 shift ;;
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
488 --tests-base=* )
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
489 testsbase=`echo "X$1" | sed -e 's/^X--tests-base=//'`
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
490 shift ;;
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
491 --aux-dir )
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
492 shift
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
493 if test $# = 0; then
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
494 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
495 fi
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
496 auxdir=$1
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
497 shift ;;
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
498 --aux-dir=* )
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
499 auxdir=`echo "X$1" | sed -e 's/^X--aux-dir=//'`
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
500 shift ;;
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
501 --with-tests )
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
502 inctests=true
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
503 shift ;;
5981
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
504 --avoid )
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
505 shift
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
506 if test $# = 0; then
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
507 func_fatal_error "missing argument for --avoid"
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
508 fi
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
509 avoidlist="$avoidlist $1"
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
510 shift ;;
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
511 --avoid=* )
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
512 avoidlist="$avoidlist "`echo "X$1" | sed -e 's/^X--avoid=//'`
5198
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
513 shift ;;
5262
97ed4b64d853 New parameter --lgpl, to asseert that modules are
Paul Eggert <eggert@cs.ucla.edu>
parents: 5255
diff changeset
514 --lgpl )
97ed4b64d853 New parameter --lgpl, to asseert that modules are
Paul Eggert <eggert@cs.ucla.edu>
parents: 5255
diff changeset
515 lgpl=true
97ed4b64d853 New parameter --lgpl, to asseert that modules are
Paul Eggert <eggert@cs.ucla.edu>
parents: 5255
diff changeset
516 shift ;;
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
517 --makefile-name )
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
518 shift
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
519 if test $# = 0; then
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
520 func_fatal_error "missing argument for --makefile-name"
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
521 fi
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
522 makefile_name="$1"
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
523 shift ;;
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
524 --makefile-name=* )
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
525 makefile_name=`echo "X$1" | sed -e 's/^X--makefile-name=//'`
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
526 shift ;;
5981
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
527 --libtool )
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
528 libtool=true
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
529 shift ;;
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
530 --no-libtool )
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
531 libtool=false
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
532 shift ;;
6176
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
533 --macro-prefix )
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
534 shift
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
535 if test $# = 0; then
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
536 func_fatal_error "missing argument for --macro-prefix"
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
537 fi
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
538 macro_prefix="$1"
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
539 shift ;;
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
540 --macro-prefix=* )
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
541 macro_prefix=`echo "X$1" | sed -e 's/^X--macro-prefix=//'`
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
542 shift ;;
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
543 --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
544 do_changelog=false
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
545 shift ;;
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
546 --dry-run )
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
547 doit=false
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
548 shift ;;
6443
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
549 -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
550 symbolic=true
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
551 shift ;;
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
552 --help | --hel | --he | --h )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
553 func_usage
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
554 exit 0 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
555 --version | --versio | --versi | --vers | --ver | --ve | --v )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
556 func_version
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
557 exit 0 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
558 -- )
6264
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
559 # Stop option processing
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
560 shift
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
561 break ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
562 -* )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
563 echo "gnulib-tool: unknown option $1" 1>&2
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
564 echo "Try 'gnulib-tool --help' for more information." 1>&2
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
565 exit 1 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
566 * )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
567 break ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
568 esac
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
569 done
6264
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
570
6443
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
571 if test "$mode" = update; then
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
572 if test $# != 0; then
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
573 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
574 echo "Try 'gnulib-tool --help' for more information." 1>&2
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
575 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
576 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
577 exit 1
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
578 fi
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
579 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
580 || test -n "$sourcebase" || test -n "$m4base" \
6993
dc8f2a1ff75f Reorder tests in doc-base patch.
Bruno Haible <bruno@clisp.org>
parents: 6966
diff changeset
581 || 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
582 || test -n "$inctests" || test -n "$avoidlist" || test -n "$lgpl" \
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
583 || test -n "$makefile_name" || test -n "$macro_prefix"; then
6443
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
584 echo "gnulib-tool: invalid options for 'update' mode" 1>&2
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
585 echo "Try 'gnulib-tool --help' for more information." 1>&2
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
586 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
587 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
588 exit 1
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
589 fi
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
590 do_changelog=false
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
591 fi
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
592
7071
71c5caf223fc Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 7070
diff changeset
593 # 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
594 # configure.ac.
6994
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
595 DEFAULT_AUTOCONF_MINVERSION="2.59"
7078
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
596 autoconf_minversion=
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
597 configure_ac=
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
598 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
599 if test -f "$destdir"/configure.ac; then
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
600 configure_ac="$destdir/configure.ac"
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
601 else
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
602 if test -f "$destdir"/configure.in; then
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
603 configure_ac="$destdir/configure.in"
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
604 fi
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
605 fi
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
606 else
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
607 if test -f configure.ac; then
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
608 configure_ac="configure.ac"
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
609 else
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
610 if test -f configure.in; then
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
611 configure_ac="configure.in"
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
612 fi
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
613 fi
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
614 fi
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
615 if test -n "$configure_ac"; then
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
616 # 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
617 # 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
618 # "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
619 # 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
620 # autom4te: m4 failed with exit status: 1
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
621 prereqs=
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
622 my_sed_traces='
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
623 s,#.*$,,
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
624 s,^dnl .*$,,
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
625 s, dnl .*$,,
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
626 /AC_PREREQ/ {
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
627 s,^.*AC_PREREQ([[ ]*\([^])]*\).*$,prereqs="$prereqs \1",p
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
628 }'
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
629 eval `sed -n -e "$my_sed_traces" < "$configure_ac"`
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
630 if test -n "$prereqs"; then
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
631 autoconf_minversion=`for version in $prereqs; do echo $version; done | $SORT -g | uniq | tail -1`
a060dfddc867 Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 7077
diff changeset
632 fi
7071
71c5caf223fc Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 7070
diff changeset
633 fi
71c5caf223fc Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 7070
diff changeset
634 if test -z "$autoconf_minversion"; then
71c5caf223fc Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 7070
diff changeset
635 autoconf_minversion=$DEFAULT_AUTOCONF_MINVERSION
71c5caf223fc Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 7070
diff changeset
636 fi
6994
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
637 case "$autoconf_minversion" in
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
638 1.* | 2.[0-4]* | 2.5[0-8]*)
7071
71c5caf223fc Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 7070
diff changeset
639 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
640 esac
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
641
6264
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
642 # 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
643 # 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
644 sed_trimtrailingslashes='s,\([^/]\)//*$,\1,'
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
645 case "$local_gnulib_dir" in
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
646 */ ) sourcebase=`echo "$local_gnulib_dir" | sed -e "$sed_trimtrailingslashes"` ;;
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
647 esac
6264
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
648 case "$sourcebase" in
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
649 */ ) sourcebase=`echo "$sourcebase" | sed -e "$sed_trimtrailingslashes"` ;;
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
650 esac
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
651 case "$m4base" in
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
652 */ ) m4base=`echo "$m4base" | sed -e "$sed_trimtrailingslashes"` ;;
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
653 esac
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
654 case "$docbase" in
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
655 */ ) docbase=`echo "$docbase" | sed -e "$sed_trimtrailingslashes"` ;;
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
656 esac
6264
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
657 case "$testsbase" in
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
658 */ ) testsbase=`echo "$testsbase" | sed -e "$sed_trimtrailingslashes"` ;;
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
659 esac
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
660 case "$auxdir" in
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
661 */ ) auxdir=`echo "$auxdir" | sed -e "$sed_trimtrailingslashes"` ;;
eaa3b6787ec9 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 6263
diff changeset
662 esac
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
663 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
664
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
665 case "$0" in
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
666 /*) self_abspathname="$0" ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
667 */*) self_abspathname=`pwd`/"$0" ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
668 *) for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'`; do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
669 if test -x "$d/$0" && test ! -d "$d/$0"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
670 self_abspathname="$d/$0"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
671 break
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
672 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
673 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
674 if test -z "$self_abspathname"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
675 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
676 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
677 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
678 esac
4717
ed7cd4050365 Port gnulib-tool to Solaris 8.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4712
diff changeset
679 while test -h "$self_abspathname"; do
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
680 # Resolve symbolic link.
6248
ba937772eda4 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 6247
diff changeset
681 linkval=`func_readlink "$self_abspathname"`
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
682 test -n "$linkval" || break
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
683 case "$linkval" in
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
684 /* ) self_abspathname="$linkval" ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
685 * ) self_abspathname=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
686 esac
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
687 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
688 gnulib_dir=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
689
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
690 func_tmpdir
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
691 trap 'rm -rf "$tmp"' 0 1 2 3 15
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
692
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
693 # func_lookup_file file
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
694 # 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
695 # 'patch'.
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
696 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
697 # - 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
698 # Output:
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
699 # - 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
700 # - 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
701 func_lookup_file ()
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
702 {
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
703 lkfile="$1"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
704 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
705 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
706 lookedup_tmp=
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
707 else
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
708 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
709 if test -n "$local_gnulib_dir" && test -f "$local_gnulib_dir/$lkfile.diff"; then
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
710 lkbase=`echo "$lkfile" | sed -e 's,^.*/,,'`
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
711 rm -f "$tmp/$lkbase"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
712 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
713 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
714 || 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
715 lookedup_file="$tmp/$lkbase"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
716 lookedup_tmp=true
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
717 else
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
718 lookedup_file="$gnulib_dir/$lkfile"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
719 lookedup_tmp=
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
720 fi
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
721 else
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
722 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
723 fi
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
724 fi
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
725 }
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
726
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
727 # func_all_modules
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
728 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
729 # - local_gnulib_dir from --local-dir
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
730 func_all_modules ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
731 {
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
732 # 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
733 # 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
734 # --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
735 {
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
736 (cd "$gnulib_dir/modules" && ls -1)
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
737 if test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules"; then
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
738 (cd "$local_gnulib_dir/modules" && ls -1 | sed -e 's,\.diff$,,')
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
739 fi
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
740 } \
7142
f846a8f5a5a4 COPYING is not a module.
Bruno Haible <bruno@clisp.org>
parents: 7106
diff changeset
741 | sed -e '/^CVS$/d' -e '/^ChangeLog$/d' -e '/^COPYING$/d' -e '/^README$/d' -e '/^TEMPLATE$/d' -e '/^TEMPLATE-TESTS$/d' -e '/~$/d' \
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
742 | sed -e '/-tests$/d' \
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
743 | LC_ALL=C sort \
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
744 | LC_ALL=C uniq
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
745 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
746
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
747 # func_verify_module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
748 # verifies a module name
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
749 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
750 # - local_gnulib_dir from --local-dir
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
751 # - module module name argument
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
752 func_verify_module ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
753 {
7168
56632b3512af Make it work also with Solaris /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 7142
diff changeset
754 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
755 || { 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
756 && 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
757 && test "CVS" != "$module" \
56632b3512af Make it work also with Solaris /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 7142
diff changeset
758 && test "ChangeLog" != "$module" \
56632b3512af Make it work also with Solaris /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 7142
diff changeset
759 && test "COPYING" != "$module" \
56632b3512af Make it work also with Solaris /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 7142
diff changeset
760 && test "README" != "$module" \
56632b3512af Make it work also with Solaris /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 7142
diff changeset
761 && test "TEMPLATE" != "$module" \
56632b3512af Make it work also with Solaris /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 7142
diff changeset
762 && test "TEMPLATE-TESTS" != "$module"; then
56632b3512af Make it work also with Solaris /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 7142
diff changeset
763 # OK, $module is a correct module name.
7212
232ee448d272 Better error handling.
Bruno Haible <bruno@clisp.org>
parents: 7199
diff changeset
764 # Verify that building the module description with 'patch' succeeds.
232ee448d272 Better error handling.
Bruno Haible <bruno@clisp.org>
parents: 7199
diff changeset
765 func_lookup_file "modules/$module"
7168
56632b3512af Make it work also with Solaris /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 7142
diff changeset
766 else
4128
1346b5405a74 (func_verify_module): report module name $module
Karl Berry <karl@freefriends.org>
parents: 4126
diff changeset
767 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
768 module=
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
769 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
770 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
771
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
772 # func_verify_nontests_module
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
773 # verifies a module name, excluding tests modules
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
774 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
775 # - local_gnulib_dir from --local-dir
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
776 # - module module name argument
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
777 func_verify_nontests_module ()
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
778 {
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
779 case "$module" in
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
780 *-tests ) module= ;;
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
781 * ) func_verify_module ;;
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
782 esac
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
783 }
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
784
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
785 # func_verify_tests_module
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
786 # 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
787 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
788 # - local_gnulib_dir from --local-dir
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
789 # - module module name argument
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
790 func_verify_tests_module ()
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
791 {
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
792 case "$module" in
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
793 *-tests ) func_verify_module ;;
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
794 * ) module= ;;
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
795 esac
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
796 }
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
797
6952
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
798 sed_extract_prog=':[ ]*$/ {
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
799 :a
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
800 n
6952
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
801 s/^Description:[ ]*$//
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
802 s/^Files:[ ]*$//
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
803 s/^Depends-on:[ ]*$//
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
804 s/^configure\.ac:[ ]*$//
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
805 s/^Makefile\.am:[ ]*$//
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
806 s/^Include:[ ]*$//
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
807 s/^License:[ ]*$//
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
808 s/^Maintainer:[ ]*$//
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
809 tb
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
810 p
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
811 ba
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
812 :b
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
813 }'
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
814
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
815 # func_get_description module
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
816 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
817 # - local_gnulib_dir from --local-dir
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
818 func_get_description ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
819 {
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
820 func_lookup_file "modules/$1"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
821 sed -n -e "/^Description$sed_extract_prog" < "$lookedup_file"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
822 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
823
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
824 # func_get_filelist module
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
825 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
826 # - local_gnulib_dir from --local-dir
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
827 func_get_filelist ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
828 {
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
829 func_lookup_file "modules/$1"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
830 sed -n -e "/^Files$sed_extract_prog" < "$lookedup_file"
6994
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
831 case "$autoconf_minversion" in
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
832 2.59)
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
833 #echo m4/onceonly.m4
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
834 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
835 ;;
3484a8772427 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 6993
diff changeset
836 esac
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
837 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
838
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
839 # func_get_dependencies module
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
840 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
841 # - local_gnulib_dir from --local-dir
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
842 func_get_dependencies ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
843 {
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
844 # ${module}-tests always implicitly depends on ${module}.
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
845 echo "$1" | sed -n -e 's/-tests//p'
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
846 # 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
847 func_lookup_file "modules/$1"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
848 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
849 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
850
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
851 # func_get_autoconf_snippet module
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
852 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
853 # - local_gnulib_dir from --local-dir
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
854 func_get_autoconf_snippet ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
855 {
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
856 func_lookup_file "modules/$1"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
857 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
858 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
859
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
860 # func_get_automake_snippet module
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
861 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
862 # - local_gnulib_dir from --local-dir
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
863 func_get_automake_snippet ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
864 {
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
865 func_lookup_file "modules/$1"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
866 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
867 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
868
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
869 # func_get_include_directive module
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
870 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
871 # - local_gnulib_dir from --local-dir
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
872 func_get_include_directive ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
873 {
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
874 func_lookup_file "modules/$1"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
875 sed -n -e "/^Include$sed_extract_prog" < "$lookedup_file" | \
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
876 sed -e 's/^\(["<]\)/#include \1/'
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
877 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
878
5251
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
879 # func_get_license module
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
880 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
881 # - local_gnulib_dir from --local-dir
5251
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
882 func_get_license ()
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
883 {
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
884 func_lookup_file "modules/$1"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
885 sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
5251
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
886 }
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
887
4197
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
888 # func_get_maintainer module
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
889 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
890 # - local_gnulib_dir from --local-dir
4197
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
891 func_get_maintainer ()
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
892 {
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
893 func_lookup_file "modules/$1"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
894 sed -n -e "/^Maintainer$sed_extract_prog" < "$lookedup_file"
4197
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
895 }
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
896
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
897 # func_get_tests_module module
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
898 # Input:
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
899 # - local_gnulib_dir from --local-dir
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
900 func_get_tests_module ()
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
901 {
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
902 # 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
903 if test -f "$gnulib_dir/modules/$1"-tests \
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
904 || { 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
905 && 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
906 echo "$1"-tests
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
907 fi
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
908 }
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
909
5981
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
910 # func_acceptable module
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
911 # tests whether a module is acceptable.
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
912 # Input:
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
913 # - avoidlist list of modules to avoid
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
914 func_acceptable ()
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
915 {
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
916 for avoid in $avoidlist; do
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
917 if test "$avoid" = "$1"; then
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
918 return 1
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
919 fi
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
920 done
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
921 return 0
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
922 }
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
923
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
924 # func_modules_transitive_closure
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
925 # Input:
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
926 # - 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
927 # - modules list of specified modules
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
928 # - inctests true if tests should be included, blank otherwise
5981
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
929 # - avoidlist list of modules to avoid
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
930 # Output:
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
931 # - 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
932 func_modules_transitive_closure ()
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
933 {
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
934 while true; do
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
935 xmodules=
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
936 for module in $modules; do
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
937 func_verify_module
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
938 if test -n "$module"; then
5981
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
939 # Duplicate dependencies are harmless, but Jim wants a warning.
6263
9750529a8cf5 Sort in a locale-independent way.
Bruno Haible <bruno@clisp.org>
parents: 6262
diff changeset
940 duplicated_deps=`func_get_dependencies $module | LC_ALL=C sort | LC_ALL=C uniq -d`
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
941 if test -n "$duplicated_deps"; then
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
942 echo "warning: module $module has duplicated dependencies: "`echo $duplicated_deps` 1>&2
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
943 fi
5981
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
944 if func_acceptable $module; then
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
945 xmodules="$xmodules $module"
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
946 for depmodule in `func_get_dependencies $module`; do
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
947 if func_acceptable $depmodule; then
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
948 xmodules="$xmodules $depmodule"
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
949 fi
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
950 done
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
951 if test -n "$inctests"; then
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
952 testsmodule=`func_get_tests_module $module`
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
953 if test -n "$testsmodule"; then
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
954 if func_acceptable $testsmodule; then
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
955 xmodules="$xmodules $testsmodule"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
956 for depmodule in `func_get_dependencies $testsmodule`; do
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
957 if func_acceptable $depmodule; then
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
958 xmodules="$xmodules $depmodule"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
959 fi
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
960 done
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
961 fi
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
962 fi
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
963 fi
5981
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
964 fi
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
965 fi
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
966 done
6263
9750529a8cf5 Sort in a locale-independent way.
Bruno Haible <bruno@clisp.org>
parents: 6262
diff changeset
967 xmodules=`for m in $xmodules; do echo $m; done | LC_ALL=C sort | LC_ALL=C uniq`
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
968 if test "$xmodules" = "$modules"; then
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
969 break
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
970 fi
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
971 modules="$xmodules"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
972 done
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
973 }
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
974
6550
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
975 # func_modules_add_dummy
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
976 # Input:
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
977 # - 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
978 # - 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
979 # Output:
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
980 # - 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
981 func_modules_add_dummy ()
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
982 {
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
983 have_lib_SOURCES=
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
984 sed_remove_backslash_newline=':a
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
985 /\\$/{
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
986 s/\\$//
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
987 N
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
988 s/\n//
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
989 ba
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
990 }'
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
991 for module in $modules; do
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
992 func_verify_nontests_module
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
993 if test -n "$module"; then
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
994 # Extract the value of "lib_SOURCES += ...".
6952
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
995 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
996 # 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
997 case "$file" in
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
998 *.h) ;;
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
999 *) have_lib_SOURCES=yes ;;
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1000 esac
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1001 done
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1002 fi
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1003 done
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1004 # 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
1005 if test -z "$have_lib_SOURCES"; then
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1006 modules="$modules dummy"
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1007 fi
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1008 }
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1009
5348
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1010 # func_modules_to_filelist
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1011 # Input:
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
1012 # - 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
1013 # - 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
1014 # Output:
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1015 # - files list of files
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1016 func_modules_to_filelist ()
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1017 {
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1018 files=
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1019 for module in $modules; do
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1020 func_verify_module
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1021 if test -n "$module"; then
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1022 files="$files "`func_get_filelist $module`
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1023 fi
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1024 done
6263
9750529a8cf5 Sort in a locale-independent way.
Bruno Haible <bruno@clisp.org>
parents: 6262
diff changeset
1025 files=`for f in $files; do echo $f; done | LC_ALL=C sort | LC_ALL=C uniq`
5348
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1026 }
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1027
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1028 # 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
1029 # emits the contents of lib/Makefile.am to standard output.
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1030 # Input:
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
1031 # - 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
1032 # - 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
1033 # - libname library name
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1034 # - makefile_name from --makefile-name
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1035 # - libtool true if libtool will be used, false or blank otherwise
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1036 # - actioncmd (optional) command that will reproduce this invocation
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1037 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
1038 {
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1039 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
1040 libext=la
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1041 perhapsLT=LT
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1042 else
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1043 libext=a
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1044 perhapsLT=
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1045 fi
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1046 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
1047 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
1048 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
1049 echo "# Reproduce by: $actioncmd"
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1050 fi
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1051 echo
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1052 # No need to generate dependencies since the sources are in gnulib, not here.
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1053 echo "AUTOMAKE_OPTIONS = 1.5 gnits no-dependencies"
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1054 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
1055 (
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1056 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
1057 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
1058 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
1059 {
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1060 func_get_automake_snippet "$module" |
7182
f03a51e31a89 Make it possible to use lib_LTLIBRARIES in a snippet.
Bruno Haible <bruno@clisp.org>
parents: 7171
diff changeset
1061 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
f03a51e31a89 Make it possible to use lib_LTLIBRARIES in a snippet.
Bruno Haible <bruno@clisp.org>
parents: 7171
diff changeset
1062 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' |
f03a51e31a89 Make it possible to use lib_LTLIBRARIES in a snippet.
Bruno Haible <bruno@clisp.org>
parents: 7171
diff changeset
1063 sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' |
f03a51e31a89 Make it possible to use lib_LTLIBRARIES in a snippet.
Bruno Haible <bruno@clisp.org>
parents: 7171
diff changeset
1064 sed -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
f03a51e31a89 Make it possible to use lib_LTLIBRARIES in a snippet.
Bruno Haible <bruno@clisp.org>
parents: 7171
diff changeset
1065 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g'
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
1066 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
1067 echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1068 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
1069 } > 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
1070 # 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
1071 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
1072 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
1073 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
1074 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
1075 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
1076 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
1077 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
1078 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
1079 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
1080 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
1081 ) > allsnippets.tmp
7171
bc1c94eecdb1 Make it possible to install the generated library.
Bruno Haible <bruno@clisp.org>
parents: 7169
diff changeset
1082 if grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *= *$libname\\.$libext\$" allsnippets.tmp > /dev/null; then
bc1c94eecdb1 Make it possible to install the generated library.
Bruno Haible <bruno@clisp.org>
parents: 7169
diff changeset
1083 # One of the snippets already specifies an installation location for the
bc1c94eecdb1 Make it possible to install the generated library.
Bruno Haible <bruno@clisp.org>
parents: 7169
diff changeset
1084 # library. Don't confuse automake by saying it should not be installed.
bc1c94eecdb1 Make it possible to install the generated library.
Bruno Haible <bruno@clisp.org>
parents: 7169
diff changeset
1085 :
bc1c94eecdb1 Make it possible to install the generated library.
Bruno Haible <bruno@clisp.org>
parents: 7169
diff changeset
1086 else
bc1c94eecdb1 Make it possible to install the generated library.
Bruno Haible <bruno@clisp.org>
parents: 7169
diff changeset
1087 # By default, the generated library should not be installed.
bc1c94eecdb1 Make it possible to install the generated library.
Bruno Haible <bruno@clisp.org>
parents: 7169
diff changeset
1088 echo "noinst_${perhapsLT}LIBRARIES = $libname.$libext"
bc1c94eecdb1 Make it possible to install the generated library.
Bruno Haible <bruno@clisp.org>
parents: 7169
diff changeset
1089 fi
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1090 echo
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1091 echo "${libname}_${libext}_SOURCES ="
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1092 echo "${libname}_${libext}_LIBADD = @${perhapsLT}LIBOBJS@"
6548
060487c0b13c Initialize also noinst_HEADERS to empty.
Bruno Haible <bruno@clisp.org>
parents: 6547
diff changeset
1093 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
1094 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
1095 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
1096 fi
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1097 echo "EXTRA_DIST ="
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1098 echo "BUILT_SOURCES ="
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1099 echo "SUFFIXES ="
7079
ecd48b98b094 Clean core dumps.
Bruno Haible <bruno@clisp.org>
parents: 7078
diff changeset
1100 echo "MOSTLYCLEANFILES = core *.stackdump"
6862
ba1b5722df42 Invent MOSTLYCLEANDIRS.
Bruno Haible <bruno@clisp.org>
parents: 6777
diff changeset
1101 echo "MOSTLYCLEANDIRS ="
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1102 echo "CLEANFILES ="
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1103 echo "DISTCLEANFILES ="
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1104 echo "MAINTAINERCLEANFILES ="
5352
f1f20fc1ff2f Emit separators in lib/Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 5351
diff changeset
1105 echo
6750
608add4e5b80 Support for packages that use "gettextize --intl". From Claudio Fontana.
Bruno Haible <bruno@clisp.org>
parents: 6745
diff changeset
1106 echo "AM_CPPFLAGS ="
608add4e5b80 Support for packages that use "gettextize --intl". From Claudio Fontana.
Bruno Haible <bruno@clisp.org>
parents: 6745
diff changeset
1107 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
1108 cat allsnippets.tmp
5357
8bce169f70cc Fix comments. Fix parse problem.
Simon Josefsson <simon@josefsson.org>
parents: 5356
diff changeset
1109 echo
7086
ba6d3c85213f Fix for "make -j 3".
Bruno Haible <bruno@clisp.org>
parents: 7079
diff changeset
1110 echo "mostlyclean-local: mostlyclean-generic"
6862
ba1b5722df42 Invent MOSTLYCLEANDIRS.
Bruno Haible <bruno@clisp.org>
parents: 6777
diff changeset
1111 echo " @test -z \"\$(MOSTLYCLEANDIRS)\" || \\"
ba1b5722df42 Invent MOSTLYCLEANDIRS.
Bruno Haible <bruno@clisp.org>
parents: 6777
diff changeset
1112 echo " for dir in \$(MOSTLYCLEANDIRS); do \\"
ba1b5722df42 Invent MOSTLYCLEANDIRS.
Bruno Haible <bruno@clisp.org>
parents: 6777
diff changeset
1113 echo " if test -d \$\$dir; then \\"
ba1b5722df42 Invent MOSTLYCLEANDIRS.
Bruno Haible <bruno@clisp.org>
parents: 6777
diff changeset
1114 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
ba1b5722df42 Invent MOSTLYCLEANDIRS.
Bruno Haible <bruno@clisp.org>
parents: 6777
diff changeset
1115 echo " fi; \\"
ba1b5722df42 Invent MOSTLYCLEANDIRS.
Bruno Haible <bruno@clisp.org>
parents: 6777
diff changeset
1116 echo " done"
ba1b5722df42 Invent MOSTLYCLEANDIRS.
Bruno Haible <bruno@clisp.org>
parents: 6777
diff changeset
1117 echo
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1118 echo "# ${makefile_name-Makefile.am} ends here"
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
1119 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
1120 }
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1121
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1122 # func_emit_tests_Makefile_am
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1123 # emits the contents of tests/Makefile.am to standard output.
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1124 # Input:
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
1125 # - local_gnulib_dir from --local-dir
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1126 # - modules list of modules, including dependencies
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1127 # - libname library name
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1128 # - makefile_name from --makefile-name
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1129 # - 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
1130 # - sourcebase relative directory containing lib source code
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1131 # - m4base relative directory containing autoconf macros
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1132 # - testsbase relative directory containing unit test code
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1133 func_emit_tests_Makefile_am ()
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1134 {
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1135 if test "$libtool" = true; then
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1136 libext=la
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1137 else
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1138 libext=a
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1139 fi
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1140 testsbase_inverse=`echo "$testsbase" | sed -e 's,/$,,' | sed -e 's,[^/][^/]*,..,g'`
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1141 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
1142 func_emit_copyright_notice
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1143 echo
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1144 # 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
1145 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1146 echo
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1147 echo "ACLOCAL_AMFLAGS = -I ${testsbase_inverse}/${m4base}"
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1148 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
1149 (
cb505deddb22 Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 7168
diff changeset
1150 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
1151 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
1152 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
1153 func_get_automake_snippet "$module" > 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
1154 # 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
1155 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
1156 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
1157 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
1158 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
1159 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
1160 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
1161 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
1162 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
1163 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
1164 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
1165 ) > allsnippets.tmp
6533
6bc4290ca85f Avoid an automake error regarding the 'gettext' module.
Bruno Haible <bruno@clisp.org>
parents: 6512
diff changeset
1166 # 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
1167 # 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
1168 # "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
1169 echo "SUBDIRS ="
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1170 echo "TESTS ="
6380
9bc99115d4d6 Small tweaks.
Bruno Haible <bruno@clisp.org>
parents: 6264
diff changeset
1171 echo "TESTS_ENVIRONMENT ="
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1172 echo "noinst_PROGRAMS ="
6570
c965a389db71 Simplify my *-tests modules.
Simon Josefsson <simon@josefsson.org>
parents: 6556
diff changeset
1173 echo "check_PROGRAMS ="
6548
060487c0b13c Initialize also noinst_HEADERS to empty.
Bruno Haible <bruno@clisp.org>
parents: 6547
diff changeset
1174 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
1175 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
1176 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
1177 fi
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1178 echo "EXTRA_DIST ="
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1179 echo "BUILT_SOURCES ="
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1180 echo "SUFFIXES ="
7079
ecd48b98b094 Clean core dumps.
Bruno Haible <bruno@clisp.org>
parents: 7078
diff changeset
1181 echo "MOSTLYCLEANFILES = core *.stackdump"
6862
ba1b5722df42 Invent MOSTLYCLEANDIRS.
Bruno Haible <bruno@clisp.org>
parents: 6777
diff changeset
1182 echo "MOSTLYCLEANDIRS ="
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1183 echo "CLEANFILES ="
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1184 echo "DISTCLEANFILES ="
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1185 echo "MAINTAINERCLEANFILES ="
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1186 echo
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1187 echo "AM_CPPFLAGS = \\"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1188 echo " -I. -I\$(srcdir) \\"
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1189 echo " -I${testsbase_inverse} -I\$(srcdir)/${testsbase_inverse} \\"
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1190 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
1191 echo
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1192 echo "LDADD = ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext}"
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1193 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
1194 cat allsnippets.tmp
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1195 echo "# Clean up after Solaris cc."
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1196 echo "clean-local:"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1197 echo " rm -rf SunWS_cache"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1198 echo
7086
ba6d3c85213f Fix for "make -j 3".
Bruno Haible <bruno@clisp.org>
parents: 7079
diff changeset
1199 echo "mostlyclean-local: mostlyclean-generic"
6862
ba1b5722df42 Invent MOSTLYCLEANDIRS.
Bruno Haible <bruno@clisp.org>
parents: 6777
diff changeset
1200 echo " @test -z \"\$(MOSTLYCLEANDIRS)\" || \\"
ba1b5722df42 Invent MOSTLYCLEANDIRS.
Bruno Haible <bruno@clisp.org>
parents: 6777
diff changeset
1201 echo " for dir in \$(MOSTLYCLEANDIRS); do \\"
ba1b5722df42 Invent MOSTLYCLEANDIRS.
Bruno Haible <bruno@clisp.org>
parents: 6777
diff changeset
1202 echo " if test -d \$\$dir; then \\"
ba1b5722df42 Invent MOSTLYCLEANDIRS.
Bruno Haible <bruno@clisp.org>
parents: 6777
diff changeset
1203 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
ba1b5722df42 Invent MOSTLYCLEANDIRS.
Bruno Haible <bruno@clisp.org>
parents: 6777
diff changeset
1204 echo " fi; \\"
ba1b5722df42 Invent MOSTLYCLEANDIRS.
Bruno Haible <bruno@clisp.org>
parents: 6777
diff changeset
1205 echo " done"
ba1b5722df42 Invent MOSTLYCLEANDIRS.
Bruno Haible <bruno@clisp.org>
parents: 6777
diff changeset
1206 echo
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1207 echo "# ${makefile_name-Makefile.am} ends here"
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
1208 rm -f allsnippets.tmp
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1209 }
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
1210
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1211 # func_import modules
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1212 # Uses also the variables
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1213 # - destdir target directory
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
1214 # - 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
1215 # - libname library name
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1216 # - 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
1217 # - 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
1218 # - 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
1219 # - 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
1220 # - 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
1221 # - inctests true if --with-tests was given, blank otherwise
5981
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
1222 # - avoidlist list of modules to avoid, from --avoid
09850e201e79 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 5963
diff changeset
1223 # - 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
1224 # - makefile_name from --makefile-name
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1225 # - 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
1226 # given, blank otherwise
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1227 # - 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
1228 # - 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
1229 # - autoconf_minversion minimum supported autoconf version
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1230 # - 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
1231 # - symbolic true if files should be symlinked, copied otherwise
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1232 func_import ()
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1233 {
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1234 # Get the cached settings.
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1235 cached_local_gnulib_dir=
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1236 cached_specified_modules=
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1237 cached_avoidlist=
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1238 cached_sourcebase=
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1239 cached_m4base=
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
1240 cached_docbase=
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1241 cached_testsbase=
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1242 cached_libname=
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1243 cached_lgpl=
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1244 cached_makefile_name=
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1245 cached_libtool=
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1246 cached_macro_prefix=
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1247 cached_files=
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1248 if test -f "$destdir"/$m4base/gnulib-cache.m4; then
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1249 cached_libtool=false
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1250 my_sed_traces='
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1251 s,#.*$,,
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1252 s,^dnl .*$,,
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1253 s, dnl .*$,,
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1254 /gl_LOCAL_DIR(/ {
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1255 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
1256 }
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1257 /gl_MODULES(/ {
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1258 s,^.*gl_MODULES([[ ]*\([^])]*\).*$,cached_specified_modules="\1",p
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1259 }
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1260 /gl_AVOID(/ {
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1261 s,^.*gl_AVOID([[ ]*\([^])]*\).*$,cached_avoidlist="\1",p
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1262 }
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1263 /gl_SOURCE_BASE(/ {
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1264 s,^.*gl_SOURCE_BASE([[ ]*\([^])]*\).*$,cached_sourcebase="\1",p
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1265 }
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1266 /gl_M4_BASE(/ {
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1267 s,^.*gl_M4_BASE([[ ]*\([^])]*\).*$,cached_m4base="\1",p
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1268 }
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
1269 /gl_DOC_BASE(/ {
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
1270 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
1271 }
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1272 /gl_TESTS_BASE(/ {
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1273 s,^.*gl_TESTS_BASE([[ ]*\([^])]*\).*$,cached_testsbase="\1",p
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1274 }
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1275 /gl_LIB(/ {
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1276 s,^.*gl_LIB([[ ]*\([^])]*\).*$,cached_libname="\1",p
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1277 }
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1278 /gl_LGPL/ {
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1279 s,^.*$,cached_lgpl=true,p
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1280 }
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1281 /gl_MAKEFILE_NAME(/ {
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1282 s,^.*gl_MAKEFILE_NAME([[ ]*\([^])]*\).*$,cached_makefile_name="\1",p
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1283 }
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1284 /gl_LIBTOOL/ {
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1285 s,^.*$,cached_libtool=true,p
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1286 }
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1287 /gl_MACRO_PREFIX(/ {
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1288 s,^.*gl_MACRO_PREFIX([[ ]*\([^])]*\).*$,cached_macro_prefix="\1",p
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1289 }'
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1290 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-cache.m4`
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1291 if test -f "$destdir"/$m4base/gnulib-comp.m4; then
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1292 my_sed_traces='
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1293 s,#.*$,,
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1294 s,^dnl .*$,,
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1295 s, dnl .*$,,
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1296 /AC_DEFUN(\['"${cached_macro_prefix}"'_FILE_LIST\], \[/ {
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1297 s,^.*$,cached_files=",p
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1298 n
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1299 ta
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1300 :a
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1301 s,^\]).*$,",
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1302 tb
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1303 p
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1304 n
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1305 ba
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1306 :b
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1307 p
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1308 }'
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1309 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-comp.m4`
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1310 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1311 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1312
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1313 # Merge the cached settings with the specified ones.
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1314 # 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
1315 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
1316 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
1317 fi
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1318 # 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
1319 # 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
1320 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
1321 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
1322 case "$destdir" in
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1323 /*)
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1324 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
1325 *)
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1326 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
1327 /*)
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1328 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
1329 *)
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1330 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
1331 local_gnulib_dir="$relconcat" ;;
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1332 esac ;;
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1333 esac
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1334 fi
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1335 fi
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1336 # 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
1337 # "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
1338 specified_modules="$cached_specified_modules $1"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1339 # 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
1340 # 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
1341 avoidlist=`echo $cached_avoidlist $avoidlist`
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1342 # The sourcebase defaults to the cached one.
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1343 if test -z "$sourcebase"; then
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1344 sourcebase="$cached_sourcebase"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1345 if test -z "$sourcebase"; then
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1346 func_fatal_error "missing --source-base option"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1347 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1348 fi
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
1349 # 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
1350 if test -z "$docbase"; then
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
1351 docbase="$cached_docbase"
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
1352 if test -z "$docbase"; then
7076
0e471c8eb020 Tweak error message about missing --doc-base.
Bruno Haible <bruno@clisp.org>
parents: 7073
diff changeset
1353 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
1354 fi
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
1355 fi
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1356 # The testsbase defaults to the cached one.
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1357 if test -z "$testsbase"; then
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1358 testsbase="$cached_testsbase"
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1359 if test -z "$testsbase"; then
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1360 func_fatal_error "missing --tests-base option"
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1361 fi
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1362 fi
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1363 # 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
1364 if test -z "$supplied_libname"; then
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1365 libname="$cached_libname"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1366 if test -z "$libname"; then
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1367 func_fatal_error "missing --lib option"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1368 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1369 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1370 # Require LGPL if specified either way.
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1371 if test -z "$lgpl"; then
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1372 lgpl="$cached_lgpl"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1373 fi
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1374 # The makefile_name defaults to the cached one.
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1375 if test -z "$makefile_name"; then
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1376 makefile_name="$cached_makefile_name"
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1377 fi
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
1378 # 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
1379 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
1380 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
1381 libtool="$cached_libtool"
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
1382 else
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
1383 libtool="$guessed_libtool"
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
1384 fi
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1385 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1386 # The macro_prefix defaults to the cached one.
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1387 if test -z "$macro_prefix"; then
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1388 macro_prefix="$cached_macro_prefix"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1389 if test -z "$macro_prefix"; then
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1390 func_fatal_error "missing --macro-prefix option"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1391 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1392 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1393
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1394 # Canonicalize the list of specified modules.
6263
9750529a8cf5 Sort in a locale-independent way.
Bruno Haible <bruno@clisp.org>
parents: 6262
diff changeset
1395 specified_modules=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort | LC_ALL=C uniq`
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1396
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1397 # Determine final module list.
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1398 modules="$specified_modules"
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1399 func_modules_transitive_closure
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1400 echo "Module list with included dependencies:"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1401 echo "$modules" | sed -e 's/^/ /'
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1402
6550
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1403 # 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
1404 func_modules_add_dummy
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1405
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1406 # If --lgpl, check the license of modules are compatible.
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1407 if test -n "$lgpl"; then
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1408 for module in $modules; do
5346
40f5d74050d5 Use func_get_license.
Bruno Haible <bruno@clisp.org>
parents: 5345
diff changeset
1409 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
1410 case $license in
6464
d4112cb80f32 Accept GPLed build tool modules when --lgpl is given.
Bruno Haible <bruno@clisp.org>
parents: 6443
diff changeset
1411 LGPL | 'GPLed build tool' | 'public domain' | 'unlimited') ;;
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1412 *) 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
1413 esac
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1414 done
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1415 fi
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1416
7199
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
1417 # 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
1418 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
1419 case $nl$modules$nl in
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
1420 *"${nl}config-h$nl"*)
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
1421 # 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
1422 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
1423 s/^#ifdef[ ]*HAVE_CONFIG_H[ ]*$/#if 1/
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
1424 ' ;;
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
1425 esac
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
1426 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
1427 # 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
1428 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
1429 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
1430 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
1431 '
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
1432 fi
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
1433
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1434 # Determine final file list.
5348
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1435 func_modules_to_filelist
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1436 echo "File list:"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1437 echo "$files" | sed -e 's/^/ /'
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1438
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1439 test -n "$files" \
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1440 || 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
1441
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1442 # 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
1443 new_files="$files m4/gnulib-tool.m4"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1444 old_files="$cached_files"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1445 if test -f "$destdir"/$m4base/gnulib-tool.m4; then
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1446 old_files="$old_files m4/gnulib-tool.m4"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1447 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1448
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
1449 # Create directories.
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1450 if test ! -d "$destdir/$sourcebase"; then
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1451 if $doit; then
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1452 echo "Creating directory $destdir/$sourcebase"
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1453 mkdir "$destdir/$sourcebase" || func_fatal_error "failed"
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1454 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1455 echo "Create directory $destdir/$sourcebase"
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1456 fi
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1457 fi
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1458 if test ! -d "$destdir/$m4base"; then
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1459 if $doit; then
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1460 echo "Creating directory $destdir/$m4base"
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1461 mkdir "$destdir/$m4base" || func_fatal_error "failed"
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1462 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1463 echo "Create directory $destdir/$m4base"
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1464 fi
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1465 fi
7070
a733c0af6d39 Avoid creating an empty doc directory.
Bruno Haible <bruno@clisp.org>
parents: 7069
diff changeset
1466 docfiles=`echo "$files" | sed -n -e 's,^doc/,,p'`
a733c0af6d39 Avoid creating an empty doc directory.
Bruno Haible <bruno@clisp.org>
parents: 7069
diff changeset
1467 if test -n "$docfiles"; then
a733c0af6d39 Avoid creating an empty doc directory.
Bruno Haible <bruno@clisp.org>
parents: 7069
diff changeset
1468 if test ! -d "$destdir/$docbase"; then
a733c0af6d39 Avoid creating an empty doc directory.
Bruno Haible <bruno@clisp.org>
parents: 7069
diff changeset
1469 if $doit; then
a733c0af6d39 Avoid creating an empty doc directory.
Bruno Haible <bruno@clisp.org>
parents: 7069
diff changeset
1470 echo "Creating directory $destdir/$docbase"
a733c0af6d39 Avoid creating an empty doc directory.
Bruno Haible <bruno@clisp.org>
parents: 7069
diff changeset
1471 mkdir "$destdir/$docbase" || func_fatal_error "failed"
a733c0af6d39 Avoid creating an empty doc directory.
Bruno Haible <bruno@clisp.org>
parents: 7069
diff changeset
1472 else
a733c0af6d39 Avoid creating an empty doc directory.
Bruno Haible <bruno@clisp.org>
parents: 7069
diff changeset
1473 echo "Create directory $destdir/$docbase"
a733c0af6d39 Avoid creating an empty doc directory.
Bruno Haible <bruno@clisp.org>
parents: 7069
diff changeset
1474 fi
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
1475 fi
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
1476 fi
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1477 if test -n "$inctests"; then
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1478 if test ! -d "$destdir/$testsbase"; then
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1479 if $doit; then
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1480 echo "Creating directory $destdir/$testsbase"
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1481 mkdir "$destdir/$testsbase" || func_fatal_error "failed"
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1482 else
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1483 echo "Create directory $destdir/$testsbase"
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1484 fi
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1485 fi
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1486 fi
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1487 if test ! -d "$destdir/$auxdir"; then
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1488 if $doit; then
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1489 echo "Creating directory $destdir/$auxdir"
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1490 mkdir "$destdir/$auxdir" || func_fatal_error "failed"
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1491 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1492 echo "Create directory $destdir/$auxdir"
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1493 fi
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1494 fi
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
1495
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
1496 # 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
1497 # 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
1498 # 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
1499 # - 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
1500 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
1501 {
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1502 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
1503 # 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
1504 # 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
1505 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
1506 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
1507 # 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
1508 # (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
1509 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
1510 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
1511 }
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1512
aca74c06bca0 Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 6633
diff changeset
1513 # Copy files or make symbolic links. Remove obsolete files.
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1514 delimiter=' '
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1515 for f in $old_files; do
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1516 case "$f" in
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1517 build-aux/*) g=`echo "$f" | sed -e "s,^build-aux/,$auxdir/,"` ;;
6952
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
1518 doc/*) g=`echo "$f" | sed -e "s,^doc/,$cached_docbase/,"` ;;
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1519 lib/*) g=`echo "$f" | sed -e "s,^lib/,$cached_sourcebase/,"` ;;
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1520 m4/*) g=`echo "$f" | sed -e "s,^m4/,$cached_m4base/,"` ;;
6425
d33210bfaeae * gnulib-tool: Fix --tests-base.
Simon Josefsson <simon@josefsson.org>
parents: 6418
diff changeset
1521 tests/*) g=`echo "$f" | sed -e "s,^tests/,$cached_testsbase/,"` ;;
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1522 *) g="$f" ;;
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1523 esac
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1524 echo "$g""$delimiter""$f"
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1525 done | LC_ALL=C sort > "$tmp"/old-files
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1526 for f in $new_files; do
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1527 case "$f" in
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1528 build-aux/*) g=`echo "$f" | sed -e "s,^build-aux/,$auxdir/,"` ;;
6952
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
1529 doc/*) g=`echo "$f" | sed -e "s,^doc/,$docbase/,"` ;;
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1530 lib/*) g=`echo "$f" | sed -e "s,^lib/,$sourcebase/,"` ;;
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1531 m4/*) g=`echo "$f" | sed -e "s,^m4/,$m4base/,"` ;;
6425
d33210bfaeae * gnulib-tool: Fix --tests-base.
Simon Josefsson <simon@josefsson.org>
parents: 6418
diff changeset
1532 tests/*) g=`echo "$f" | sed -e "s,^tests/,$testsbase/,"` ;;
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1533 *) g="$f" ;;
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1534 esac
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1535 echo "$g""$delimiter""$f"
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1536 done | LC_ALL=C sort > "$tmp"/new-files
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1537 # 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
1538 sed_take_first_column='s,'"$delimiter"'.*,,'
0c67f1400c5b Fix portability problem to Solaris 9 sh.
Bruno Haible <bruno@clisp.org>
parents: 6581
diff changeset
1539 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
1540 # 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
1541 if test -f "$destdir/$g"; then
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1542 if $doit; then
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1543 echo "Removing file $g (backup in ${g}~)"
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1544 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
1545 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1546 echo "Remove file $g (backup in ${g}~)"
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1547 fi
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1548 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1549 done
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1550 # func_add_or_update handles a file that ought to be present afterwards.
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1551 # Uses parameters f, g, already_present.
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1552 func_add_or_update ()
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1553 {
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
1554 func_dest_tmpfilename "$g"
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
1555 func_lookup_file "$f"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
1556 cp "$lookedup_file" "$tmpfile" || func_fatal_error "failed"
7199
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
1557 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
1558 case "$f" in
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1559 lib/*)
7199
85ef7b18536b New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 7195
diff changeset
1560 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
1561 < "$lookedup_file" > "$tmpfile" || func_fatal_error "failed"
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1562 ;;
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1563 esac
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
1564 fi
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1565 if test -f "$destdir/$g"; then
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1566 # 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
1567 if cmp "$destdir/$g" "$tmpfile" > /dev/null; then
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1568 : # The file has not changed.
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1569 else
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1570 # Replace the file.
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1571 if $doit; then
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1572 if test -n "$already_present"; then
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1573 echo "Updating file $g (backup in ${g}~)"
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1574 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1575 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
1576 fi
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1577 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error "failed"
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
1578 if test -n "$symbolic" && test -z "$lookedup_tmp" \
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
1579 && 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
1580 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
1581 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
1582 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
1583 fi
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1584 else
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1585 if test -n "$already_present"; then
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1586 echo "Update file $g (backup in ${g}~)"
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1587 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1588 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
1589 fi
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1590 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1591 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1592 else
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1593 # Install the file.
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1594 # 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
1595 # 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
1596 if $doit; then
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1597 echo "Copying file $g"
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
1598 if test -n "$symbolic" && test -z "$lookedup_tmp" \
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
1599 && 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
1600 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
1601 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
1602 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
1603 fi
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1604 else
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1605 echo "Copy file $g"
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1606 fi
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1607 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
1608 rm -f "$tmpfile"
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1609 }
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1610 # 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
1611 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
1612 already_present=
6595
0c67f1400c5b Fix portability problem to Solaris 9 sh.
Bruno Haible <bruno@clisp.org>
parents: 6581
diff changeset
1613 for f in `LC_ALL=C join -t"$delimiter" -v2 "$tmp"/old-files "$tmp"/new-files | sed -e "$sed_take_last_column"`; do
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1614 case "$f" in
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1615 build-aux/*) g=`echo "$f" | sed -e "s,^build-aux/,$auxdir/,"` ;;
6952
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
1616 doc/*) g=`echo "$f" | sed -e "s,^doc/,$docbase/,"` ;;
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1617 lib/*) g=`echo "$f" | sed -e "s,^lib/,$sourcebase/,"` ;;
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1618 m4/*) g=`echo "$f" | sed -e "s,^m4/,$m4base/,"` ;;
6425
d33210bfaeae * gnulib-tool: Fix --tests-base.
Simon Josefsson <simon@josefsson.org>
parents: 6418
diff changeset
1619 tests/*) g=`echo "$f" | sed -e "s,^tests/,$testsbase/,"` ;;
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1620 *) g="$f" ;;
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1621 esac
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1622 func_add_or_update
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1623 done
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1624 # 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
1625 already_present=true
6595
0c67f1400c5b Fix portability problem to Solaris 9 sh.
Bruno Haible <bruno@clisp.org>
parents: 6581
diff changeset
1626 for f in `LC_ALL=C join -t"$delimiter" "$tmp"/old-files "$tmp"/new-files | sed -e "$sed_take_last_column"`; do
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1627 case "$f" in
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1628 build-aux/*) g=`echo "$f" | sed -e "s,^build-aux/,$auxdir/,"` ;;
6952
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
1629 doc/*) g=`echo "$f" | sed -e "s,^doc/,$docbase/,"` ;;
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1630 lib/*) g=`echo "$f" | sed -e "s,^lib/,$sourcebase/,"` ;;
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1631 m4/*) g=`echo "$f" | sed -e "s,^m4/,$m4base/,"` ;;
6425
d33210bfaeae * gnulib-tool: Fix --tests-base.
Simon Josefsson <simon@josefsson.org>
parents: 6418
diff changeset
1632 tests/*) g=`echo "$f" | sed -e "s,^tests/,$testsbase/,"` ;;
6245
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1633 *) g="$f" ;;
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1634 esac
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1635 func_add_or_update
07b16a28510d Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 6213
diff changeset
1636 done
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1637
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1638 # 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
1639 actioncmd="gnulib-tool --import"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1640 actioncmd="$actioncmd --dir=$destdir"
7213
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1641 if test -n "$local_gnulib_dir"; then
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1642 actioncmd="$actioncmd --local-dir=$local_gnulib_dir"
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1643 fi
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1644 actioncmd="$actioncmd --lib=$libname"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1645 actioncmd="$actioncmd --source-base=$sourcebase"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1646 actioncmd="$actioncmd --m4-base=$m4base"
6952
b1f02ed7eeab * modules/fdl: New module, to install doc/fdl.texi.
Eric Blake <ebb9@byu.net>
parents: 6940
diff changeset
1647 actioncmd="$actioncmd --doc-base=$docbase"
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1648 actioncmd="$actioncmd --aux-dir=$auxdir"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1649 for module in $avoidlist; do
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1650 actioncmd="$actioncmd --avoid=$module"
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1651 done
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1652 if test -n "$lgpl"; then
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1653 actioncmd="$actioncmd --lgpl"
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1654 fi
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1655 if test -n "$makefile_name"; then
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1656 actioncmd="$actioncmd --makefile_name=$makefile_name"
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1657 fi
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1658 if test "$libtool" = true; then
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1659 actioncmd="$actioncmd --libtool"
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1660 else
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1661 actioncmd="$actioncmd --no-libtool"
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1662 fi
6208
c72d8c259348 2005-09-03 Simon Josefsson <jas@extundo.com>
Simon Josefsson <simon@josefsson.org>
parents: 6204
diff changeset
1663 actioncmd="$actioncmd --macro-prefix=$macro_prefix"
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1664 actioncmd="$actioncmd `echo $specified_modules`"
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1665
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1666 # Create lib/Makefile.am.
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1667 makefile_am=${makefile_name-Makefile.am}
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1668 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
1669 func_emit_lib_Makefile_am > "$tmpfile"
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1670 if test -f "$destdir"/$sourcebase/$makefile_am; then
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1671 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
1672 rm -f "$tmpfile"
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1673 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1674 if $doit; then
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1675 echo "Updating $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1676 mv -f "$destdir"/$sourcebase/$makefile_am "$destdir"/$sourcebase/$makefile_am~
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1677 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1678 else
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1679 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
1680 rm -f "$tmpfile"
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1681 fi
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1682 fi
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1683 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1684 if $doit; then
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1685 echo "Creating $sourcebase/$makefile_am"
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1686 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1687 else
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1688 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
1689 rm -f "$tmpfile"
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1690 fi
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
1691 fi
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1692
6180
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
1693 # 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
1694 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
1695 (
6777
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
1696 func_emit_copyright_notice
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1697 echo "#"
6180
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
1698 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
1699 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
1700 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
1701 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
1702 echo
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
1703 echo
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
1704 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
1705 echo "# $actioncmd"
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
1706 echo
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
1707 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
1708 # 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
1709 case "$local_gnulib_dir" in
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1710 "" | /*)
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1711 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
1712 * )
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1713 case "$destdir" in
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1714 /*) 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
1715 *)
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1716 # 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
1717 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
1718 relative_local_gnulib_dir="$reldir" ;;
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1719 esac ;;
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1720 esac
0f2957c42e86 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 7212
diff changeset
1721 echo "gl_LOCAL_DIR([$relative_local_gnulib_dir])"
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1722 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
1723 echo "gl_AVOID([$avoidlist])"
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
1724 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
1725 echo "gl_M4_BASE([$m4base])"
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
1726 echo "gl_DOC_BASE([$docbase])"
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1727 echo "gl_TESTS_BASE([$testsbase])"
6180
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
1728 echo "gl_LIB([$libname])"
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
1729 test -z "$lgpl" || echo "gl_LGPL"
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1730 echo "gl_MAKEFILE_NAME([$makefile_name])"
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1731 if test "$libtool" = true; then
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1732 echo "gl_LIBTOOL"
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1733 fi
6180
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
1734 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
1735 ) > "$tmpfile"
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1736 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
1737 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
1738 rm -f "$tmpfile"
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1739 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1740 if $doit; then
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1741 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
1742 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
1743 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
1744 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1745 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
1746 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
1747 cat "$tmpfile"
6249
564133adbd69 Comment out too much verbosity in --dry-run.
Bruno Haible <bruno@clisp.org>
parents: 6248
diff changeset
1748 echo
564133adbd69 Comment out too much verbosity in --dry-run.
Bruno Haible <bruno@clisp.org>
parents: 6248
diff changeset
1749 echo "# gnulib-cache.m4 ends here"
564133adbd69 Comment out too much verbosity in --dry-run.
Bruno Haible <bruno@clisp.org>
parents: 6248
diff changeset
1750 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
1751 rm -f "$tmpfile"
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1752 fi
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1753 fi
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1754 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1755 if $doit; then
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1756 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
1757 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
1758 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1759 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
1760 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
1761 rm -f "$tmpfile"
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1762 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1763 fi
6180
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
1764
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
1765 # 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
1766 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
1767 (
6777
d9b10884dc69 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 6765
diff changeset
1768 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
1769 echo "#"
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
1770 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
1771 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
1772 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
1773 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
1774 echo
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1775 echo
6160
2fb771c0af6b Emit more comments and advice.
Bruno Haible <bruno@clisp.org>
parents: 6159
diff changeset
1776 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
1777 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
1778 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
1779 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
1780 echo "["
7105
641bac73140c * gnulib-tool (func_import): Detect unexpanded macros in gnulib
Eric Blake <ebb9@byu.net>
parents: 7090
diff changeset
1781 echo " m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
641bac73140c * gnulib-tool (func_import): Detect unexpanded macros in gnulib
Eric Blake <ebb9@byu.net>
parents: 7090
diff changeset
1782 echo " m4_pattern_allow([^gl_ES$])dnl a valid locale name"
6512
f8abe8d41137 RANLIB is needed.
Bruno Haible <bruno@clisp.org>
parents: 6464
diff changeset
1783 echo " AC_REQUIRE([AC_PROG_RANLIB])"
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
1784 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
1785 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
1786 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
1787 if grep gl_USE_SYSTEM_EXTENSIONS "$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
1788 echo " AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])"
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1789 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
1790 if grep gl_LOCK "$destdir"/$m4base/*.m4 >/dev/null 2>/dev/null; then
7187
89a978aa0b12 Separate the "early" and the "normal" part of the macro.
Bruno Haible <bruno@clisp.org>
parents: 7182
diff changeset
1791 echo " AC_REQUIRE([gl_LOCK_EARLY])"
6549
2f04f595e14e Ensure automatic ordering between gl_LOCK and gl_ARGP.
Bruno Haible <bruno@clisp.org>
parents: 6548
diff changeset
1792 fi
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1793 echo "])"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1794 echo
6160
2fb771c0af6b Emit more comments and advice.
Bruno Haible <bruno@clisp.org>
parents: 6159
diff changeset
1795 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
1796 echo "# \"Check for header files, types and library functions\"."
6176
1a1e2f878f04 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 6175
diff changeset
1797 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
1798 echo "["
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1799 if test "$libtool" = true; then
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1800 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1801 else
6512
f8abe8d41137 RANLIB is needed.
Bruno Haible <bruno@clisp.org>
parents: 6464
diff changeset
1802 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
6414
46d47c8fe734 * gnulib-tool: Define automake conditional GL_COND_LIBTOOL if
Simon Josefsson <simon@josefsson.org>
parents: 6389
diff changeset
1803 fi
6556
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
1804 if test "$auxdir" != "build-aux"; then
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
1805 sed_replace_build_aux='
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
1806 :a
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
1807 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
1808 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
1809 ba
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
1810 }'
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
1811 sed_replace_build_aux=`echo "$sed_replace_build_aux" | sed -e 1d -e 's/^ *//'`
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
1812 else
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
1813 sed_replace_build_aux=
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
1814 fi
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1815 for module in $modules; do
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1816 func_verify_module
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1817 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
1818 func_get_autoconf_snippet "$module" \
b32846b4d88d Replace build-aux when it occurs in the autoconf snippet.
Bruno Haible <bruno@clisp.org>
parents: 6533
diff changeset
1819 | sed -e '/^$/d;' -e 's/^/ /' \
b32846b4d88d Replace build-aux when it occurs in the autoconf snippet.
Bruno Haible <bruno@clisp.org>
parents: 6533
diff changeset
1820 -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./' \
b32846b4d88d Replace build-aux when it occurs in the autoconf snippet.
Bruno Haible <bruno@clisp.org>
parents: 6533
diff changeset
1821 -e "$sed_replace_build_aux"
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
1822 if test "$module" = 'alloca' && test "$libtool" = true; then
5356
144b29bba7b7 Provisions for defining LTALLOCA.
Bruno Haible <bruno@clisp.org>
parents: 5353
diff changeset
1823 echo 'changequote(,)dnl'
144b29bba7b7 Provisions for defining LTALLOCA.
Bruno Haible <bruno@clisp.org>
parents: 5353
diff changeset
1824 echo 'LTALLOCA=`echo "$ALLOCA" | sed '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
144b29bba7b7 Provisions for defining LTALLOCA.
Bruno Haible <bruno@clisp.org>
parents: 5353
diff changeset
1825 echo 'changequote([, ])dnl'
6106
66bd85c8a9cd Proper autoconf macro argument quoting.
Bruno Haible <bruno@clisp.org>
parents: 6039
diff changeset
1826 echo 'AC_SUBST([LTALLOCA])'
5356
144b29bba7b7 Provisions for defining LTALLOCA.
Bruno Haible <bruno@clisp.org>
parents: 5353
diff changeset
1827 fi
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1828 fi
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1829 done
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1830 echo "])"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1831 echo
6180
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
1832 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
1833 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
1834 echo "AC_DEFUN([${macro_prefix}_FILE_LIST], ["
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
1835 echo "$files" | sed -e 's,^, ,'
a0904de304e5 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 6179
diff changeset
1836 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
1837 ) > "$tmpfile"
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1838 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
1839 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
1840 rm -f "$tmpfile"
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1841 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1842 if $doit; then
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1843 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
1844 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
1845 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
1846 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1847 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
1848 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
1849 cat "$tmpfile"
6249
564133adbd69 Comment out too much verbosity in --dry-run.
Bruno Haible <bruno@clisp.org>
parents: 6248
diff changeset
1850 echo
564133adbd69 Comment out too much verbosity in --dry-run.
Bruno Haible <bruno@clisp.org>
parents: 6248
diff changeset
1851 echo "# gnulib-comp.m4 ends here"
564133adbd69 Comment out too much verbosity in --dry-run.
Bruno Haible <bruno@clisp.org>
parents: 6248
diff changeset
1852 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
1853 rm -f "$tmpfile"
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1854 fi
6246
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1855 fi
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1856 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1857 if $doit; then
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1858 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
1859 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
1860 else
7c089b3b2200 Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 6245
diff changeset
1861 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
1862 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
1863 rm -f "$tmpfile"
6181
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1864 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1865 fi
95b89dc3f638 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 6180
diff changeset
1866
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1867 if test -n "$inctests"; then
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1868 # Create tests/Makefile.am.
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1869 makefile_am=${makefile_name-Makefile.am}
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1870 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
1871 func_emit_tests_Makefile_am > "$tmpfile"
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1872 if test -f "$destdir"/$testsbase/$makefile_am; then
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1873 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
1874 rm -f "$tmpfile"
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1875 else
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1876 if $doit; then
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1877 echo "Updating $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1878 mv -f "$destdir"/$testsbase/$makefile_am "$destdir"/$testsbase/$makefile_am~
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1879 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1880 else
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1881 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
1882 rm -f "$tmpfile"
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1883 fi
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1884 fi
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1885 else
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1886 if $doit; then
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1887 echo "Creating $testsbase/$makefile_am"
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1888 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1889 else
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1890 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
1891 rm -f "$tmpfile"
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1892 fi
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1893 fi
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1894 fi
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1895
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1896 echo "Finished."
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1897 echo
5572
54000928a33d Print #include directives when --import'ing.
Simon Josefsson <simon@josefsson.org>
parents: 5527
diff changeset
1898 echo "You may need to add #include directives for the following .h files."
6756
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1899 (
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1900 # First the #include <...> directives without #ifs, sorted for convenience.
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1901 for module in $modules; do
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1902 if func_get_include_directive "$module" | grep '^#if' >/dev/null; then
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1903 :
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1904 else
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1905 func_get_include_directive "$module" | grep -v 'include "'
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1906 fi
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1907 done | LC_ALL=C sort -u
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1908 # Then the #include "..." directives without #ifs, sorted for convenience.
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1909 for module in $modules; do
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1910 if func_get_include_directive "$module" | grep '^#if' >/dev/null; then
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1911 :
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1912 else
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1913 func_get_include_directive "$module" | grep 'include "'
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1914 fi
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1915 done | LC_ALL=C sort -u
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1916 # Then the #include directives that are surrounded by #ifs. Not sorted.
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1917 for module in $modules; do
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1918 if func_get_include_directive "$module" | grep '^#if' >/dev/null; then
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1919 func_get_include_directive "$module"
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1920 fi
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1921 done
4d481eff340f Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 6750
diff changeset
1922 ) | sed -e '/^$/d;' -e 's/^/ /'
5572
54000928a33d Print #include directives when --import'ing.
Simon Josefsson <simon@josefsson.org>
parents: 5527
diff changeset
1923 echo
6160
2fb771c0af6b Emit more comments and advice.
Bruno Haible <bruno@clisp.org>
parents: 6159
diff changeset
1924 echo "Don't forget to"
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1925 if test "${makefile_name-Makefile.am}" = Makefile.am; then
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1926 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
1927 else
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1928 echo " - \"include $makefile_name\" from within \"$sourcebase/Makefile.am\","
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1929 fi
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1930 if test -n "$inctests"; then
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1931 if test "${makefile_name-Makefile.am}" = Makefile.am; then
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1932 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
1933 else
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1934 echo " - \"include $makefile_name\" from within \"$testsbase/Makefile.am\","
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1935 fi
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1936 fi
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1937 if test "${makefile_name-Makefile.am}" = Makefile.am; then
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1938 sourcebase_dir=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'`
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1939 sourcebase_base=`basename "$sourcebase"`
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1940 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
1941 fi
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1942 if test -n "$inctests"; then
7216
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1943 if test "${makefile_name-Makefile.am}" = Makefile.am; then
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1944 testsbase_dir=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'`
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1945 testsbase_base=`basename "$testsbase"`
91df49e70c77 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 7215
diff changeset
1946 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
1947 fi
6250
2c772fe1e1d0 Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 6249
diff changeset
1948 fi
6160
2fb771c0af6b Emit more comments and advice.
Bruno Haible <bruno@clisp.org>
parents: 6159
diff changeset
1949 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
1950 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
1951 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
1952 }
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
1953
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1954 # func_create_testdir testdir modules
6109
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
1955 # Input:
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
1956 # - local_gnulib_dir from --local-dir
6109
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
1957 # - 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
1958 func_create_testdir ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1959 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1960 testdir="$1"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1961 modules="$2"
6263
9750529a8cf5 Sort in a locale-independent way.
Bruno Haible <bruno@clisp.org>
parents: 6262
diff changeset
1962 modules=`for m in $modules; do echo $m; done | LC_ALL=C sort | LC_ALL=C uniq`
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1963
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
1964 # Subdirectory names.
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
1965 sourcebase=gllib
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
1966 m4base=glm4
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
1967 testsbase=gltests
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
1968
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1969 # Determine final module list.
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
1970 func_modules_transitive_closure
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1971 echo "Module list with included dependencies:"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1972 echo "$modules" | sed -e 's/^/ /'
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1973
6550
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1974 # 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
1975 func_modules_add_dummy
3bb57675fc1b Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 6549
diff changeset
1976
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1977 # Determine final file list.
5348
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
1978 func_modules_to_filelist
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1979 echo "File list:"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1980 echo "$files" | sed -e 's/^/ /'
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1981
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1982 # Create directories.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1983 for d in `echo "$files" | sed -n -e 's,^\(.*\)/[^/]*,\1,p'`; do
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
1984 case "$d" in
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
1985 build-aux) mkdir -p "$testdir/$auxdir" ;;
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
1986 lib) mkdir -p "$testdir/$sourcebase" ;;
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
1987 m4) mkdir -p "$testdir/$m4base" ;;
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
1988 tests) mkdir -p "$testdir/$testsbase" ;;
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
1989 *) mkdir -p "$testdir/$d" ;;
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
1990 esac
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1991 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1992
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
1993 # Copy files or make symbolic links.
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1994 for f in $files; do
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
1995 func_lookup_file "$f"
4175
ace040a2b821 Files meant for the AUX_DIR are now in the config subdirectory.
Bruno Haible <bruno@clisp.org>
parents: 4171
diff changeset
1996 case "$f" in
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
1997 build-aux/*) g=`echo "$f" | sed -e "s,^build-aux/,$auxdir/,"` ;;
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
1998 lib/*) g=`echo "$f" | sed -e "s,^lib/,$sourcebase/,"` ;;
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
1999 m4/*) g=`echo "$f" | sed -e "s,^m4/,$m4base/,"` ;;
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2000 tests/*) g=`echo "$f" | sed -e "s,^tests/,$testsbase/,"` ;;
4175
ace040a2b821 Files meant for the AUX_DIR are now in the config subdirectory.
Bruno Haible <bruno@clisp.org>
parents: 4171
diff changeset
2001 *) g="$f" ;;
ace040a2b821 Files meant for the AUX_DIR are now in the config subdirectory.
Bruno Haible <bruno@clisp.org>
parents: 4171
diff changeset
2002 esac
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
2003 if test -n "$lookedup_tmp"; then
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
2004 cp -p "$lookedup_file" "$testdir/$g"
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
2005 else
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
2006 ln "$lookedup_file" "$testdir/$g" 2>/dev/null ||
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
2007 if test -z "$symbolic"; then
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
2008 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
2009 else
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
2010 ln -s "$lookedup_file" "$testdir/$g"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
2011 fi
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
2012 fi
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2013 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2014
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2015 # Create $sourcebase/Makefile.am.
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2016 mkdir -p "$testdir/$sourcebase"
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2017 func_emit_lib_Makefile_am > "$testdir/$sourcebase/Makefile.am"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2018
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2019 # Create $m4base/Makefile.am.
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2020 mkdir -p "$testdir/$m4base"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2021 (echo "## Process this file with automake to produce Makefile.in."
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2022 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2023 echo "EXTRA_DIST ="
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2024 for f in $files; do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2025 case "$f" in
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2026 m4/* )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2027 echo "EXTRA_DIST += "`echo "$f" | sed -e 's,^m4/,,'` ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2028 esac
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2029 done
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2030 ) > "$testdir/$m4base/Makefile.am"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2031
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2032 subdirs="$sourcebase $m4base"
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2033 subdirs_with_configure_ac=""
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2034
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2035 if test -f "$testdir"/$m4base/gettext.m4; then
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2036 # Avoid stupid error message from automake:
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2037 # "AM_GNU_GETTEXT used but `po' not in SUBDIRS"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2038 mkdir -p "$testdir/po"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2039 (echo "## Process this file with automake to produce Makefile.in."
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2040 ) > "$testdir/po/Makefile.am"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2041 subdirs="$subdirs po"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2042 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2043
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2044 if test -n "$inctests"; then
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2045 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
2046 # Create $testsbase/Makefile.am.
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2047 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
2048 # Create $testsbase/configure.ac.
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2049 (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
2050 echo "AC_INIT([dummy], [0])"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2051 echo "AC_CONFIG_AUX_DIR([../$auxdir])"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2052 echo "AM_INIT_AUTOMAKE"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2053 echo
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2054 echo "AM_CONFIG_HEADER([config.h])"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2055 echo
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2056 echo "AC_PROG_CC"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2057 echo "AC_PROG_INSTALL"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2058 echo "AC_PROG_MAKE_SET"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2059 echo "AC_PROG_RANLIB"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2060 echo
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2061 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
2062 echo "AC_GNU_SOURCE"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2063 echo
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2064 fi
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2065 if grep gl_USE_SYSTEM_EXTENSIONS "$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
2066 echo "gl_USE_SYSTEM_EXTENSIONS"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2067 echo
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2068 fi
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2069 if grep gl_LOCK "$testdir/$m4base"/*.m4 >/dev/null 2>/dev/null; then
7187
89a978aa0b12 Separate the "early" and the "normal" part of the macro.
Bruno Haible <bruno@clisp.org>
parents: 7182
diff changeset
2070 echo "gl_LOCK_EARLY"
6549
2f04f595e14e Ensure automatic ordering between gl_LOCK and gl_ARGP.
Bruno Haible <bruno@clisp.org>
parents: 6548
diff changeset
2071 echo
2f04f595e14e Ensure automatic ordering between gl_LOCK and gl_ARGP.
Bruno Haible <bruno@clisp.org>
parents: 6548
diff changeset
2072 fi
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
2073 if test "$libtool" = true; then
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
2074 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
2075 else
6418
e0a8b9b05999 Proper autoconf macro argument quoting.
Bruno Haible <bruno@clisp.org>
parents: 6414
diff changeset
2076 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
6414
46d47c8fe734 * gnulib-tool: Define automake conditional GL_COND_LIBTOOL if
Simon Josefsson <simon@josefsson.org>
parents: 6389
diff changeset
2077 fi
7090
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2078 # 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
2079 # 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
2080 # at the top level:
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2081 # 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
2082 # 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
2083 # 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
2084 # expansion total).
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2085 echo "AC_DEFUN([gl_INIT], ["
6556
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2086 if test "$auxdir" != "build-aux"; then
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2087 sed_replace_build_aux='
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2088 :a
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2089 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2090 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
2091 ba
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2092 }'
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2093 sed_replace_build_aux=`echo "$sed_replace_build_aux" | sed -e 1d -e 's/^ *//'`
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2094 else
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2095 sed_replace_build_aux=
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2096 fi
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2097 # 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
2098 # 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
2099 # those of the tests.
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2100 for module in $modules; do
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2101 func_verify_nontests_module
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2102 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
2103 func_get_autoconf_snippet "$module" \
b32846b4d88d Replace build-aux when it occurs in the autoconf snippet.
Bruno Haible <bruno@clisp.org>
parents: 6533
diff changeset
2104 | sed -e "$sed_replace_build_aux"
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2105 fi
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2106 done
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2107 for module in $modules; do
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2108 func_verify_tests_module
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2109 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
2110 func_get_autoconf_snippet "$module" \
b32846b4d88d Replace build-aux when it occurs in the autoconf snippet.
Bruno Haible <bruno@clisp.org>
parents: 6533
diff changeset
2111 | sed -e "$sed_replace_build_aux"
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2112 fi
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2113 done
7090
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2114 echo "])"
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2115 echo "gl_INIT"
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2116 echo
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2117 # 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
2118 # 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
2119 echo "AH_TOP([#include \"../config.h\"])"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2120 echo
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2121 echo "AC_OUTPUT([Makefile])"
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2122 ) > "$testdir/$testsbase/configure.ac"
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2123 subdirs="$subdirs $testsbase"
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2124 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
2125 fi
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2126
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2127 # Create Makefile.am.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2128 (echo "## Process this file with automake to produce Makefile.in."
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2129 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2130 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2131 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2132 echo "SUBDIRS = $subdirs"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2133 echo
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2134 echo "ACLOCAL_AMFLAGS = -I $m4base"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2135 ) > "$testdir/Makefile.am"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2136
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2137 # Create configure.ac.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2138 (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
2139 echo "AC_INIT([dummy], [0])"
6109
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
2140 if test "$auxdir" != "."; then
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
2141 echo "AC_CONFIG_AUX_DIR([$auxdir])"
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
2142 fi
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2143 echo "AM_INIT_AUTOMAKE"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2144 echo
6106
66bd85c8a9cd Proper autoconf macro argument quoting.
Bruno Haible <bruno@clisp.org>
parents: 6039
diff changeset
2145 echo "AM_CONFIG_HEADER([config.h])"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2146 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2147 echo "AC_PROG_CC"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2148 echo "AC_PROG_INSTALL"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2149 echo "AC_PROG_MAKE_SET"
7106
b9fff044578d Apply last patch also to --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7105
diff changeset
2150 echo
b9fff044578d Apply last patch also to --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7105
diff changeset
2151 echo "m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
b9fff044578d Apply last patch also to --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7105
diff changeset
2152 echo "m4_pattern_allow([^gl_ES$])dnl a valid locale name"
b9fff044578d Apply last patch also to --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 7105
diff changeset
2153 echo
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2154 echo "AC_PROG_RANLIB"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2155 echo
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2156 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
2157 echo "AC_GNU_SOURCE"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2158 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2159 fi
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2160 if grep gl_USE_SYSTEM_EXTENSIONS "$testdir/$m4base"/*.m4 >/dev/null 2>/dev/null; then
4586
eb1b4acf2e86 Avoid autoconf/autoheader warning
Bruno Haible <bruno@clisp.org>
parents: 4325
diff changeset
2161 echo "gl_USE_SYSTEM_EXTENSIONS"
eb1b4acf2e86 Avoid autoconf/autoheader warning
Bruno Haible <bruno@clisp.org>
parents: 4325
diff changeset
2162 echo
eb1b4acf2e86 Avoid autoconf/autoheader warning
Bruno Haible <bruno@clisp.org>
parents: 4325
diff changeset
2163 fi
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2164 if grep gl_LOCK "$testdir/$m4base"/*.m4 >/dev/null 2>/dev/null; then
7187
89a978aa0b12 Separate the "early" and the "normal" part of the macro.
Bruno Haible <bruno@clisp.org>
parents: 7182
diff changeset
2165 echo "gl_LOCK_EARLY"
6549
2f04f595e14e Ensure automatic ordering between gl_LOCK and gl_ARGP.
Bruno Haible <bruno@clisp.org>
parents: 6548
diff changeset
2166 echo
2f04f595e14e Ensure automatic ordering between gl_LOCK and gl_ARGP.
Bruno Haible <bruno@clisp.org>
parents: 6548
diff changeset
2167 fi
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
2168 if test "$libtool" = true; then
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
2169 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
2170 else
6418
e0a8b9b05999 Proper autoconf macro argument quoting.
Bruno Haible <bruno@clisp.org>
parents: 6414
diff changeset
2171 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
6414
46d47c8fe734 * gnulib-tool: Define automake conditional GL_COND_LIBTOOL if
Simon Josefsson <simon@josefsson.org>
parents: 6389
diff changeset
2172 fi
7090
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2173 # 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
2174 # 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
2175 # at the top level:
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2176 # 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
2177 # 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
2178 # 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
2179 # expansion total).
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2180 echo "AC_DEFUN([gl_INIT], ["
6556
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2181 if test "$auxdir" != "build-aux"; then
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2182 sed_replace_build_aux='
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2183 :a
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2184 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2185 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
2186 ba
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2187 }'
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2188 sed_replace_build_aux=`echo "$sed_replace_build_aux" | sed -e 1d -e 's/^ *//'`
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2189 else
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2190 sed_replace_build_aux=
85c3c00fcec1 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 6551
diff changeset
2191 fi
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2192 for module in $modules; do
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2193 func_verify_nontests_module
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2194 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
2195 func_get_autoconf_snippet "$module" \
b32846b4d88d Replace build-aux when it occurs in the autoconf snippet.
Bruno Haible <bruno@clisp.org>
parents: 6533
diff changeset
2196 | sed -e "$sed_replace_build_aux"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2197 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2198 done
7090
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2199 echo "])"
dfc92f94c781 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 7089
diff changeset
2200 echo "gl_INIT"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2201 echo
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2202 if test -n "$subdirs_with_configure_ac"; then
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2203 echo "AC_CONFIG_SUBDIRS(["`echo $subdirs_with_configure_ac`"])"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2204 fi
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2205 makefiles="Makefile"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2206 for d in $subdirs; do
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2207 # 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
2208 # 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
2209 case " $subdirs_with_configure_ac " in
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2210 *" $d "*) ;;
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2211 *) makefiles="$makefiles $d/Makefile" ;;
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2212 esac
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2213 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2214 echo "AC_OUTPUT([$makefiles])"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2215 ) > "$testdir/configure.ac"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2216
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2217 # Create autogenerated files.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2218 (cd "$testdir"
5237
bd85db908172 Replace various ad-hoc automake/autoconf/aclocal
Paul Eggert <eggert@cs.ucla.edu>
parents: 5202
diff changeset
2219 echo "executing ${AUTORECONF} --force --install"
bd85db908172 Replace various ad-hoc automake/autoconf/aclocal
Paul Eggert <eggert@cs.ucla.edu>
parents: 5202
diff changeset
2220 ${AUTORECONF} --force --install
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2221 )
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2222 if grep '^BUILT_SOURCES *+=' "$testdir/$sourcebase/Makefile.am" > /dev/null; then
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2223 (cd "$testdir"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2224 ./configure
7195
e4a459055e78 Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 7187
diff changeset
2225 cd "$sourcebase"
6389
c1766dccfd4f Simplification, from Stepan Kasal.
Bruno Haible <bruno@clisp.org>
parents: 6380
diff changeset
2226 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
c1766dccfd4f Simplification, from Stepan Kasal.
Bruno Haible <bruno@clisp.org>
parents: 6380
diff changeset
2227 make built_sources
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2228 cd ..
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2229 make distclean
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2230 )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2231 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2232 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2233
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2234 # func_create_megatestdir megatestdir allmodules
6109
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
2235 # Input:
7214
eb43edab28c3 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 7213
diff changeset
2236 # - local_gnulib_dir from --local-dir
6109
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
2237 # - 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
2238 func_create_megatestdir ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2239 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2240 megatestdir="$1"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2241 allmodules="$2"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2242 if test -z "$allmodules"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2243 allmodules=`func_all_modules`
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2244 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2245
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2246 megasubdirs=
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2247 # First, all modules one by one.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2248 for onemodule in $allmodules; do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2249 func_create_testdir "$megatestdir/$onemodule" $onemodule
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2250 megasubdirs="${megasubdirs}$onemodule "
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2251 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2252 # Then, all modules all together.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2253 # Except fnmatch-posix, which conflicts with fnmatch-gnu. FIXME.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2254 allmodules=`for m in $allmodules; do if test $m != fnmatch-posix; then echo $m; fi; done`
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2255 func_create_testdir "$megatestdir/ALL" "$allmodules"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2256 megasubdirs="${megasubdirs}ALL"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2257
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2258 # Create Makefile.am.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2259 (echo "## Process this file with automake to produce Makefile.in."
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2260 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2261 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2262 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2263 echo "SUBDIRS = $megasubdirs"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2264 ) > "$megatestdir/Makefile.am"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2265
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2266 # Create configure.ac.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2267 (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
2268 echo "AC_INIT([dummy], [0])"
6109
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
2269 if test "$auxdir" != "."; then
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
2270 echo "AC_CONFIG_AUX_DIR([$auxdir])"
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
2271 fi
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2272 echo "AM_INIT_AUTOMAKE"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2273 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2274 echo "AC_PROG_MAKE_SET"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2275 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2276 echo "AC_CONFIG_SUBDIRS([$megasubdirs])"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2277 echo "AC_OUTPUT([Makefile])"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2278 ) > "$megatestdir/configure.ac"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2279
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2280 # Create autogenerated files.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2281 (cd "$megatestdir"
6547
1a65fb7ddbbb Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 6546
diff changeset
2282 # 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
2283 # 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
2284 # 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
2285 echo "executing ${ACLOCAL}"
1a65fb7ddbbb Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 6546
diff changeset
2286 ${ACLOCAL}
1a65fb7ddbbb Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 6546
diff changeset
2287 echo "executing mkdir build-aux"
1a65fb7ddbbb Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 6546
diff changeset
2288 mkdir build-aux
1a65fb7ddbbb Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 6546
diff changeset
2289 echo "executing ${AUTOCONF}"
1a65fb7ddbbb Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 6546
diff changeset
2290 ${AUTOCONF}
1a65fb7ddbbb Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 6546
diff changeset
2291 echo "executing ${AUTOMAKE} --add-missing --copy"
1a65fb7ddbbb Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 6546
diff changeset
2292 ${AUTOMAKE} --add-missing --copy
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2293 )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2294 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2295
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2296 case $mode in
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2297 "" )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2298 func_fatal_error "no mode specified" ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2299
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2300 list )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2301 func_all_modules
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2302 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2303
6443
1a35941d29ab Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 6425
diff changeset
2304 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
2305
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
2306 # Where to import.
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
2307 if test -z "$destdir"; then
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
2308 destdir=.
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
2309 fi
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
2310 test -d "$destdir" \
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
2311 || 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
2312
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2313 # 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
2314 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
2315 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
2316 else
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2317 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
2318 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
2319 else
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2320 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
2321 fi
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2322 fi
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2323
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2324 # Analyze configure.ac.
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2325 guessed_auxdir="."
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 7076
diff changeset
2326 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
2327 my_sed_traces='
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2328 s,#.*$,,
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2329 s,^dnl .*$,,
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2330 s, dnl .*$,,
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2331 /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
2332 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
2333 }
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2334 /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
2335 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
2336 }'
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2337 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
2338
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2339 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
2340 auxdir="$guessed_auxdir"
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
2341 fi
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
2342
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2343 # 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
2344 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
2345 # 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
2346 # Any number of additional modules can be given.
6204
104bcb14d247 Provide defaults where needed.
Bruno Haible <bruno@clisp.org>
parents: 6199
diff changeset
2347 if test ! -f "$destdir/$m4base"/gnulib-cache.m4; then
104bcb14d247 Provide defaults where needed.
Bruno Haible <bruno@clisp.org>
parents: 6199
diff changeset
2348 # First use of gnulib in the given m4base.
104bcb14d247 Provide defaults where needed.
Bruno Haible <bruno@clisp.org>
parents: 6199
diff changeset
2349 test -n "$supplied_libname" || supplied_libname=true
104bcb14d247 Provide defaults where needed.
Bruno Haible <bruno@clisp.org>
parents: 6199
diff changeset
2350 test -n "$sourcebase" || sourcebase="lib"
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
2351 test -n "$docbase" || docbase="doc"
6262
bef30dac846f Provide a default for --tests-base.
Bruno Haible <bruno@clisp.org>
parents: 6250
diff changeset
2352 test -n "$testsbase" || testsbase="tests"
6204
104bcb14d247 Provide defaults where needed.
Bruno Haible <bruno@clisp.org>
parents: 6199
diff changeset
2353 test -n "$macro_prefix" || macro_prefix="gl"
104bcb14d247 Provide defaults where needed.
Bruno Haible <bruno@clisp.org>
parents: 6199
diff changeset
2354 fi
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2355 func_import "$*"
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2356 else
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2357 # 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
2358 # 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
2359 # 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
2360 # "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
2361 m4dirs=
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2362 m4dirs_count=0
7072
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2363 if test -f "$destdir"/Makefile.am; then
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2364 aclocal_amflags=`grep '^ACLOCAL_AMFLAGS[ ]*=' "$destdir"/Makefile.am | sed -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/'`
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2365 m4dir_is_next=
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2366 for arg in $aclocal_amflags; do
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2367 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
2368 # 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
2369 case "$arg" in
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2370 /*) ;;
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2371 *)
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2372 if test -f "$destdir/$arg"/gnulib-cache.m4; then
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2373 m4dirs="$m4dirs $arg"
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2374 m4dirs_count=`expr $m4dirs_count + 1`
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2375 fi
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2376 ;;
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2377 esac
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2378 else
7072
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2379 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
2380 m4dir_is_next=yes
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2381 else
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2382 m4dir_is_next=
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2383 fi
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2384 fi
7072
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2385 done
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2386 else
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2387 # 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
2388 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
2389 sedexpr1='s,^m4_include(\[\(.*\)])$,\1,p'
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2390 sedexpr2='s,^[^/]*$,.,'
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2391 sedexpr3='s,/[^/]*$,,'
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2392 m4dirs=`sed -n -e "$sedexpr1" aclocal.m4 | sed -e "$sedexpr2" -e "$sedexpr3" | LC_ALL=C sort | LC_ALL=C uniq`
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2393 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
2394 fi
7072
a1e9235fc6ff Support projects without a top-level Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 7071
diff changeset
2395 fi
6183
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2396 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
2397 # 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
2398 # 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
2399 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
2400 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
2401 m4base="m4"
6955
7715890c929a * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 6952
diff changeset
2402 test -n "$docbase" || docbase="doc"
6262
bef30dac846f Provide a default for --tests-base.
Bruno Haible <bruno@clisp.org>
parents: 6250
diff changeset
2403 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
2404 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
2405 func_import "$*"
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2406 else
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2407 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
2408 # 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
2409 # 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
2410 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
2411 func_import "$*"
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2412 done
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2413 else
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2414 # 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
2415 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
2416 # 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
2417 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
2418 func_import
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2419 done
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2420 else
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2421 # Really ambiguous.
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2422 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
2423 fi
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2424 fi
d12635ef6eb5 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 6182
diff changeset
2425 fi
6178
3830993b4c7a Rename some variables.
Bruno Haible <bruno@clisp.org>
parents: 6177
diff changeset
2426 fi
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
2427 ;;
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2428
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2429 create-testdir )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2430 if test -z "$destdir"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2431 func_fatal_error "please specify --dir option"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2432 fi
4126
e8caa337b4e1 (create-testdir): don't complain if destdir
Karl Berry <karl@freefriends.org>
parents: 4124
diff changeset
2433 mkdir "$destdir"
e8caa337b4e1 (create-testdir): don't complain if destdir
Karl Berry <karl@freefriends.org>
parents: 4124
diff changeset
2434 test -d "$destdir" \
e8caa337b4e1 (create-testdir): don't complain if destdir
Karl Berry <karl@freefriends.org>
parents: 4124
diff changeset
2435 || func_fatal_error "could not create destination directory"
6109
a52f596fdf00 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 6108
diff changeset
2436 test -n "$auxdir" || auxdir="build-aux"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2437 func_create_testdir "$destdir" "$*"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2438 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2439
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2440 create-megatestdir )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2441 if test -z "$destdir"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2442 func_fatal_error "please specify --dir option"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2443 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2444 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
2445 test -n "$auxdir" || auxdir="build-aux"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2446 func_create_megatestdir "$destdir" "$*"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2447 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2448
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2449 test )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2450 test -n "$destdir" || destdir=testdir$$
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2451 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
2452 test -n "$auxdir" || auxdir="build-aux"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2453 func_create_testdir "$destdir" "$*"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2454 cd "$destdir"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2455 mkdir build
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2456 cd build
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2457 ../configure
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2458 make
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2459 make check
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2460 make distclean
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2461 remaining=`find . -type f -print`
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2462 if test -n "$remaining"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2463 echo "Remaining files:" $remaining 1>&2
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2464 echo "gnulib-tool: *** Stop." 1>&2
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2465 exit 1
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2466 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2467 cd ..
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2468 cd ..
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2469 rm -rf "$destdir"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2470 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2471
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2472 megatest )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2473 test -n "$destdir" || destdir=testdir$$
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2474 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
2475 test -n "$auxdir" || auxdir="build-aux"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2476 func_create_megatestdir "$destdir" "$*"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2477 cd "$destdir"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2478 mkdir build
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2479 cd build
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2480 ../configure
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2481 make
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2482 make check
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2483 make distclean
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2484 remaining=`find . -type f -print`
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2485 if test -n "$remaining"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2486 echo "Remaining files:" $remaining 1>&2
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2487 echo "gnulib-tool: *** Stop." 1>&2
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2488 exit 1
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2489 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2490 cd ..
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2491 cd ..
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2492 rm -rf "$destdir"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2493 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2494
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2495 extract-description )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2496 for module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2497 do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2498 func_verify_module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2499 if test -n "$module"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2500 func_get_description "$module"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2501 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2502 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2503 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2504
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2505 extract-filelist )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2506 for module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2507 do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2508 func_verify_module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2509 if test -n "$module"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2510 func_get_filelist "$module"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2511 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2512 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2513 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2514
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2515 extract-dependencies )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2516 for module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2517 do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2518 func_verify_module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2519 if test -n "$module"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2520 func_get_dependencies "$module"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2521 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2522 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2523 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2524
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2525 extract-autoconf-snippet )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2526 for module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2527 do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2528 func_verify_module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2529 if test -n "$module"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2530 func_get_autoconf_snippet "$module"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2531 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2532 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2533 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2534
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2535 extract-automake-snippet )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2536 for module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2537 do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2538 func_verify_module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2539 if test -n "$module"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2540 func_get_automake_snippet "$module"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2541 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2542 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2543 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2544
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2545 extract-include-directive )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2546 for module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2547 do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2548 func_verify_module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2549 if test -n "$module"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2550 func_get_include_directive "$module"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2551 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2552 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2553 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2554
5251
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
2555 extract-license )
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
2556 for module
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
2557 do
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
2558 func_verify_module
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
2559 if test -n "$module"; then
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
2560 func_get_license "$module"
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
2561 fi
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
2562 done
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
2563 ;;
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
2564
4197
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
2565 extract-maintainer )
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
2566 for module
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
2567 do
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
2568 func_verify_module
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
2569 if test -n "$module"; then
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
2570 func_get_maintainer "$module"
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
2571 fi
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
2572 done
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
2573 ;;
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
2574
6113
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2575 extract-tests-module )
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2576 for module
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2577 do
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2578 func_verify_module
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2579 if test -n "$module"; then
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2580 func_get_tests_module "$module"
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2581 fi
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2582 done
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2583 ;;
dac0e048bd40 Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 6111
diff changeset
2584
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2585 * )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2586 func_fatal_error "unknown operation mode --$mode" ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2587 esac
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2588
7073
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
2589 rm -rf "$tmp"
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
2590 # Undo the effect of the previous 'trap' command. Some shellology:
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
2591 # We cannot use "trap - 0 1 2 3 15", because Solaris sh would attempt to
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
2592 # 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
2593 # 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
2594 # 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
2595 trap '' 0
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
2596 trap 'exit $?' 1 2 3 15
eb23418a908e Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 7072
diff changeset
2597
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2598 exit 0