annotate gnulib-tool @ 39193:6feb46ed08f6

gnulib-tool: Make --conditional-dependencies work better. Reported by Dmitry Selyutin <ghostman.sd@gmail.com>. * gnulib-tool (Options): Don't reject the combination of --conditional-dependencies with --with-tests. (func_emit_autoconf_snippets): Add argument referenceable_modules. Don't reference $modules. (func_import, func_create_testdir): Pass it.
author Bruno Haible <bruno@clisp.org>
date Fri, 29 Dec 2017 00:29:23 +0100
parents 55dc3d465b51
children 10eb9086bea0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 #! /bin/sh
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2 #
38305
66a613c135a8 version-etc: new year
Paul Eggert <eggert@cs.ucla.edu>
parents: 38224
diff changeset
3 # Copyright (C) 2002-2017 Free Software Foundation, Inc.
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 #
29000
49d1cc4454bf Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 28975
diff changeset
5 # This program is free software: you can redistribute it and/or modify
23803
4339ab66270d 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
29000
49d1cc4454bf Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 28975
diff changeset
7 # the Free Software Foundation; either version 3 of the License, or
49d1cc4454bf Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 28975
diff changeset
8 # (at your option) any later version.
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 #
4339ab66270d 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,
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 # GNU General Public License for more details.
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 #
4339ab66270d 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
38844
a8586d5e30d2 all: prefer https: URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 38818
diff changeset
16 # along with this program. If not, see <https://www.gnu.org/licenses/>.
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 #
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 # This program is meant for authors or maintainers which want to import
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 # modules from gnulib into their packages.
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 progname=$0
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 package=gnulib
27013
cf27fa57df2e Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 27012
diff changeset
24 nl='
cf27fa57df2e Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 27012
diff changeset
25 '
28696
9dd6cf2c070c * gnulib-tool (IFS): Initialize early, so we don't set it to
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 28694
diff changeset
26 IFS=" "" $nl"
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 # You can set AUTOCONFPATH to empty if autoconf 2.57 is already in your PATH.
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 AUTOCONFPATH=
24941
e3b5556c4173 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 24928
diff changeset
30 #case $USER in
e3b5556c4173 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 24928
diff changeset
31 # bruno )
e3b5556c4173 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 24928
diff changeset
32 # AUTOCONFBINDIR=/packages/gnu-inst-autoconf/2.57/bin
e3b5556c4173 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 24928
diff changeset
33 # AUTOCONFPATH="eval env PATH=${AUTOCONFBINDIR}:\$PATH "
e3b5556c4173 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 24928
diff changeset
34 # ;;
e3b5556c4173 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 24928
diff changeset
35 #esac
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36
26238
51a51b4ff67f Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 26237
diff changeset
37 # You can set AUTOMAKEPATH to empty if automake 1.9.x is already in your PATH.
51a51b4ff67f Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 26237
diff changeset
38 AUTOMAKEPATH=
51a51b4ff67f Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 26237
diff changeset
39
27176
75068ae47af5 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 27175
diff changeset
40 # You can set GETTEXTPATH to empty if autopoint 0.15 is already in your PATH.
75068ae47af5 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 27175
diff changeset
41 GETTEXTPATH=
75068ae47af5 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 27175
diff changeset
42
32669
bfda6e39f11c gnulib-tool: Add support for --libtool in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32614
diff changeset
43 # You can set LIBTOOLPATH to empty if libtoolize 2.x is already in your PATH.
bfda6e39f11c gnulib-tool: Add support for --libtool in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32614
diff changeset
44 LIBTOOLPATH=
bfda6e39f11c gnulib-tool: Add support for --libtool in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32614
diff changeset
45
26242
5fb45567aba9 Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 26241
diff changeset
46 # If you didn't set AUTOCONFPATH and AUTOMAKEPATH, you can also set the
27176
75068ae47af5 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 27175
diff changeset
47 # variables AUTOCONF, AUTOHEADER, ACLOCAL, AUTOMAKE, AUTORECONF individually.
26242
5fb45567aba9 Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 26241
diff changeset
48 if test -z "${AUTOCONF}" || test -n "${AUTOCONFPATH}"; then
5fb45567aba9 Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 26241
diff changeset
49 AUTOCONF="${AUTOCONFPATH}autoconf"
5fb45567aba9 Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 26241
diff changeset
50 fi
27176
75068ae47af5 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 27175
diff changeset
51 if test -z "${AUTOHEADER}" || test -n "${AUTOCONFPATH}"; then
75068ae47af5 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 27175
diff changeset
52 AUTOHEADER="${AUTOCONFPATH}autoheader"
75068ae47af5 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 27175
diff changeset
53 fi
26242
5fb45567aba9 Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 26241
diff changeset
54 if test -z "${ACLOCAL}" || test -n "${AUTOMAKEPATH}"; then
5fb45567aba9 Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 26241
diff changeset
55 ACLOCAL="${AUTOMAKEPATH}aclocal"
5fb45567aba9 Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 26241
diff changeset
56 fi
5fb45567aba9 Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 26241
diff changeset
57 if test -z "${AUTOMAKE}" || test -n "${AUTOMAKEPATH}"; then
5fb45567aba9 Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 26241
diff changeset
58 AUTOMAKE="${AUTOMAKEPATH}automake"
5fb45567aba9 Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 26241
diff changeset
59 fi
5fb45567aba9 Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 26241
diff changeset
60 if test -z "${AUTORECONF}" || test -n "${AUTOCONFPATH}"; then
5fb45567aba9 Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 26241
diff changeset
61 AUTORECONF="${AUTOCONFPATH}autoreconf"
5fb45567aba9 Make the AUTOCONF etc. commands overridable by the user.
Bruno Haible <bruno@clisp.org>
parents: 26241
diff changeset
62 fi
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
63
27176
75068ae47af5 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 27175
diff changeset
64 # If you didn't set GETTEXTPATH, you can also set the variable AUTOPOINT.
75068ae47af5 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 27175
diff changeset
65 if test -z "${AUTOPOINT}" || test -n "${GETTEXTPATH}"; then
75068ae47af5 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 27175
diff changeset
66 AUTOPOINT="${GETTEXTPATH}autopoint"
75068ae47af5 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 27175
diff changeset
67 fi
75068ae47af5 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 27175
diff changeset
68
32669
bfda6e39f11c gnulib-tool: Add support for --libtool in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32614
diff changeset
69 # If you didn't set LIBTOOLPATH, you can also set the variable LIBTOOLIZE.
bfda6e39f11c gnulib-tool: Add support for --libtool in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32614
diff changeset
70 if test -z "${LIBTOOLIZE}" || test -n "${LIBTOOLPATH}"; then
32670
6a498f488e23 gnulib-tool (LIBTOOLPATH): Fix cut'n'paste bug.
Simon Josefsson <simon@josefsson.org>
parents: 32669
diff changeset
71 LIBTOOLIZE="${LIBTOOLPATH}libtoolize"
32669
bfda6e39f11c gnulib-tool: Add support for --libtool in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32614
diff changeset
72 fi
bfda6e39f11c gnulib-tool: Add support for --libtool in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32614
diff changeset
73
31095
9b202fc78b1b gnulib-tool: execute $MAKE not make
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 31094
diff changeset
74 # You can set MAKE.
9b202fc78b1b gnulib-tool: execute $MAKE not make
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 31094
diff changeset
75 if test -z "${MAKE}"; then
9b202fc78b1b gnulib-tool: execute $MAKE not make
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 31094
diff changeset
76 MAKE=make
9b202fc78b1b gnulib-tool: execute $MAKE not make
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 31094
diff changeset
77 fi
9b202fc78b1b gnulib-tool: execute $MAKE not make
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 31094
diff changeset
78
30940
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
79 # When using GNU sed, turn off as many GNU extensions as possible,
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
80 # to minimize the risk of accidentally using non-portable features.
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
81 # However, do this only for gnulib-tool itself, not for the code that
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
82 # gnulib-tool generates, since we don't want "sed --posix" to leak
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
83 # into makefiles. And do it only for sed versions 4.2 or newer,
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
84 # because "sed --posix" is buggy in GNU sed 4.1.5, see
39154
55dc3d465b51 maint: shorten https://lists.gnu.org/archive/html/... links
Jim Meyering <meyering@fb.com>
parents: 38925
diff changeset
85 # <https://lists.gnu.org/r/bug-gnulib/2009-02/msg00225.html>.
30940
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
86 if (alias) > /dev/null 2>&1 \
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
87 && echo | sed --posix -e d >/dev/null 2>&1 \
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
88 && case `sed --version | sed -e 's/^[^0-9]*//' -e 1q` in \
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
89 [1-3]* | 4.[01]*) false;; \
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
90 *) true;; \
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
91 esac \
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
92 ; then
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
93 # Define sed as an alias.
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
94 # It is not always possible to use aliases. Aliases are guaranteed to work
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
95 # if the executing shell is bash and either it is invoked as /bin/sh or
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
96 # is a version >= 2.0, supporting shopt. This is the common case.
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
97 # Two other approaches (use of a variable $sed or of a function func_sed
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
98 # instead of an alias) require massive, fragile code changes.
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
99 # An other approach (use of function sed) requires `which sed` - but
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
100 # 'which' is hard to emulate, due to missing "test -x" on some platforms.
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
101 if test -n "$BASH_VERSION"; then
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
102 shopt -s expand_aliases >/dev/null 2>&1
28904
0139a456afff Try harder to enable the alias for 'sed'.
Bruno Haible <bruno@clisp.org>
parents: 28880
diff changeset
103 fi
30940
35e9431a5519 Re-enable the use of "sed --posix" with sed >= 4.2.
Bruno Haible <bruno@clisp.org>
parents: 30923
diff changeset
104 alias sed='sed --posix'
27428
d6a065bf8abf Use "sed --posix" instead of "sed" when possible.
Bruno Haible <bruno@clisp.org>
parents: 27413
diff changeset
105 fi
d6a065bf8abf Use "sed --posix" instead of "sed" when possible.
Bruno Haible <bruno@clisp.org>
parents: 27413
diff changeset
106
30091
1d280945b2f7 Make gnulib-tool work with native 'sed' on AIX.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 30071
diff changeset
107 # sed_noop is a sed expression that does nothing.
30092
457166e4c518 Oops, typo in comment.
Bruno Haible <bruno@clisp.org>
parents: 30091
diff changeset
108 # An empty expression does not work with the native 'sed' on AIX 6.1.
30091
1d280945b2f7 Make gnulib-tool work with native 'sed' on AIX.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 30071
diff changeset
109 sed_noop='s,x,x,'
1d280945b2f7 Make gnulib-tool work with native 'sed' on AIX.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 30071
diff changeset
110
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
111 # sed_comments is true or false, depending whether 'sed' supports comments.
33253
5ac12988e19f Fix gnulib-tool sed script de-commentation for AIX sed.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 33111
diff changeset
112 # AIX 5.3 sed barfs over indented comments.
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
113 if echo fo | sed -e 's/f/g/
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
114 # s/o/u/
33253
5ac12988e19f Fix gnulib-tool sed script de-commentation for AIX sed.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 33111
diff changeset
115 # indented comment
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
116 s/o/e/' 2>/dev/null | grep ge > /dev/null; then
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
117 sed_comments=true
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
118 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
119 sed_comments=false
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
120 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
121
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
122 # func_usage
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
123 # outputs to stdout the --help usage message.
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
124 func_usage ()
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
125 {
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
126 echo "\
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
127 Usage: gnulib-tool --list
34076
ccbb46c08424 gnulib-tool: remove use of bold display in help screen
Stefano Lattarini <stefano.lattarini@gmail.com>
parents: 34014
diff changeset
128 gnulib-tool --find filename
25035
9556749e9999 Initialize supplied_libname. Tweak usage message.
Bruno Haible <bruno@clisp.org>
parents: 25034
diff changeset
129 gnulib-tool --import [module1 ... moduleN]
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
130 gnulib-tool --add-import [module1 ... moduleN]
34076
ccbb46c08424 gnulib-tool: remove use of bold display in help screen
Stefano Lattarini <stefano.lattarini@gmail.com>
parents: 34014
diff changeset
131 gnulib-tool --remove-import [module1 ... moduleN]
26134
6c0e449aa51e Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 26116
diff changeset
132 gnulib-tool --update
27175
fc8ac5fcad48 --create-testdir without module names now means to use nearly all modules.
Bruno Haible <bruno@clisp.org>
parents: 27112
diff changeset
133 gnulib-tool --create-testdir --dir=directory [module1 ... moduleN]
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
134 gnulib-tool --create-megatestdir --dir=directory [module1 ... moduleN]
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
135 gnulib-tool --test --dir=directory module1 ... moduleN
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
136 gnulib-tool --megatest --dir=directory [module1 ... moduleN]
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
137 gnulib-tool --extract-description module
32761
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
138 gnulib-tool --extract-comment module
30434
46e6cd35a028 Modules now have a 'status' attribute.
Bruno Haible <bruno@clisp.org>
parents: 30423
diff changeset
139 gnulib-tool --extract-status module
28880
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
140 gnulib-tool --extract-notice module
32151
ec3aec36193f New module attribute 'Applicability'.
Bruno Haible <bruno@clisp.org>
parents: 32108
diff changeset
141 gnulib-tool --extract-applicability module
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
142 gnulib-tool --extract-filelist module
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
143 gnulib-tool --extract-dependencies module
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
144 gnulib-tool --extract-autoconf-snippet module
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
145 gnulib-tool --extract-automake-snippet module
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
146 gnulib-tool --extract-include-directive module
27746
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
147 gnulib-tool --extract-link-directive module
24942
c85b8fccd94e Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 24941
diff changeset
148 gnulib-tool --extract-license module
23888
811702529909 Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 23866
diff changeset
149 gnulib-tool --extract-maintainer module
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
150 gnulib-tool --extract-tests-module module
31152
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
151 gnulib-tool --copy-file file [destination]
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
152
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
153 Operation modes:
33396
83dac15e88be gnulib-tool: Fix --help output.
Bruno Haible <bruno@clisp.org>
parents: 33351
diff changeset
154
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
155 --list print the available module names
34076
ccbb46c08424 gnulib-tool: remove use of bold display in help screen
Stefano Lattarini <stefano.lattarini@gmail.com>
parents: 34014
diff changeset
156 --find find the modules which contain the specified file
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
157 --import import the given modules into the current package
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
158 --add-import augment the list of imports from gnulib into the
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
159 current package, by adding the given modules;
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
160 if no modules are specified, update the current
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
161 package from the current gnulib
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
162 --remove-import reduce the list of imports from gnulib into the
34076
ccbb46c08424 gnulib-tool: remove use of bold display in help screen
Stefano Lattarini <stefano.lattarini@gmail.com>
parents: 34014
diff changeset
163 current package, by removing the given modules
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
164 --update update the current package, restore files omitted
33327
445a26f3384a gnulib-tool: Don't talk about CVS any more.
Bruno Haible <bruno@clisp.org>
parents: 33325
diff changeset
165 from version control
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
166 --create-testdir create a scratch package with the given modules
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
167 --create-megatestdir create a mega scratch package with the given modules
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
168 one by one and all together
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
169 --test test the combination of the given modules
23888
811702529909 Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 23866
diff changeset
170 (recommended to use CC=\"gcc -Wall\" here)
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
171 --megatest test the given modules one by one and all together
23888
811702529909 Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 23866
diff changeset
172 (recommended to use CC=\"gcc -Wall\" here)
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
173 --extract-description extract the description
32761
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
174 --extract-comment extract the comment
32771
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
175 --extract-status extract the status (obsolete etc.)
28880
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
176 --extract-notice extract the notice or banner
32760
0481e0014afb Addendum to 2010-02-07 commit.
Bruno Haible <bruno@clisp.org>
parents: 32758
diff changeset
177 --extract-applicability extract the applicability
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
178 --extract-filelist extract the list of files
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
179 --extract-dependencies extract the dependencies
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
180 --extract-autoconf-snippet extract the snippet for configure.ac
26913
2f6d41ced306 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 26907
diff changeset
181 --extract-automake-snippet extract the snippet for library makefile
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
182 --extract-include-directive extract the #include directive
27746
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
183 --extract-link-directive extract the linker directive
24942
c85b8fccd94e Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 24941
diff changeset
184 --extract-license report the license terms of the source files
c85b8fccd94e Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 24941
diff changeset
185 under lib/
23888
811702529909 Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 23866
diff changeset
186 --extract-maintainer report the maintainer(s) inside gnulib
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
187 --extract-tests-module report the unit test module, if it exists
31152
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
188 --copy-file copy a file that is not part of any module
36068
78076b269155 gnulib-tool: Improve usage message.
Bruno Haible <bruno@clisp.org>
parents: 36061
diff changeset
189 --help Show this help text.
78076b269155 gnulib-tool: Improve usage message.
Bruno Haible <bruno@clisp.org>
parents: 36061
diff changeset
190 --version Show version and authorship information.
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
191
26760
3f8d2afbbaea Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 26759
diff changeset
192 General options:
33396
83dac15e88be gnulib-tool: Fix --help output.
Bruno Haible <bruno@clisp.org>
parents: 33351
diff changeset
193
26759
aa8886954b98 Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 26758
diff changeset
194 --dir=DIRECTORY Specify the target directory.
aa8886954b98 Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 26758
diff changeset
195 For --import, this specifies where your
aa8886954b98 Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 26758
diff changeset
196 configure.ac can be found. Defaults to current
aa8886954b98 Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 26758
diff changeset
197 directory.
26764
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
198 --local-dir=DIRECTORY Specify a local override directory where to look
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
199 up files before looking in gnulib's directory.
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
200 --cache-modules Enable module caching optimization.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
201 --no-cache-modules Disable module caching optimization.
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
202 --verbose Increase verbosity. May be repeated.
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
203 --quiet Decrease verbosity. May be repeated.
26760
3f8d2afbbaea Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 26759
diff changeset
204
33396
83dac15e88be gnulib-tool: Fix --help output.
Bruno Haible <bruno@clisp.org>
parents: 33351
diff changeset
205 Options for --import, --add/remove-import, --update:
83dac15e88be gnulib-tool: Fix --help output.
Bruno Haible <bruno@clisp.org>
parents: 33351
diff changeset
206
32677
7030d03d6c13 Clarify which options are available for --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32674
diff changeset
207 --dry-run Only print what would have been done.
7030d03d6c13 Clarify which options are available for --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32674
diff changeset
208
36622
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
209 Options for --import, --add/remove-import:
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
210
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
211 --with-tests Include unit tests for the included modules.
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
212
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
213 Options for --create-[mega]testdir, --[mega]test:
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
214
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
215 --without-tests Don't include unit tests for the included modules.
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
216
33396
83dac15e88be gnulib-tool: Fix --help output.
Bruno Haible <bruno@clisp.org>
parents: 33351
diff changeset
217 Options for --import, --add/remove-import,
83dac15e88be gnulib-tool: Fix --help output.
Bruno Haible <bruno@clisp.org>
parents: 33351
diff changeset
218 --create-[mega]testdir, --[mega]test:
83dac15e88be gnulib-tool: Fix --help output.
Bruno Haible <bruno@clisp.org>
parents: 33351
diff changeset
219
32677
7030d03d6c13 Clarify which options are available for --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32674
diff changeset
220 --with-obsolete Include obsolete modules when they occur among the
7030d03d6c13 Clarify which options are available for --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32674
diff changeset
221 dependencies. By default, dependencies to obsolete
7030d03d6c13 Clarify which options are available for --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32674
diff changeset
222 modules are ignored.
32955
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
223 --with-c++-tests Include even unit tests for C++ interoperability.
36622
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
224 --without-c++-tests Exclude unit tests for C++ interoperability.
32955
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
225 --with-longrunning-tests
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
226 Include even unit tests that are long-runners.
36622
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
227 --without-longrunning-tests
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
228 Exclude unit tests that are long-runners.
32955
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
229 --with-privileged-tests
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
230 Include even unit tests that require root
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
231 privileges.
36622
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
232 --without-privileged-tests
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
233 Exclude unit tests that require root privileges.
32955
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
234 --with-unportable-tests
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
235 Include even unit tests that fail on some platforms.
36622
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
236 --without-unportable-tests
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
237 Exclude unit tests that fail on some platforms.
32955
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
238 --with-all-tests Include all kinds of problematic unit tests.
32677
7030d03d6c13 Clarify which options are available for --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32674
diff changeset
239 --avoid=MODULE Avoid including the given MODULE. Useful if you
7030d03d6c13 Clarify which options are available for --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32674
diff changeset
240 have code that provides equivalent functionality.
7030d03d6c13 Clarify which options are available for --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32674
diff changeset
241 This option can be repeated.
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
242 --conditional-dependencies
34524
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
243 Support conditional dependencies (may save configure
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
244 time and object code).
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
245 --no-conditional-dependencies
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
246 Don't use conditional dependencies.
32677
7030d03d6c13 Clarify which options are available for --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32674
diff changeset
247 --libtool Use libtool rules.
7030d03d6c13 Clarify which options are available for --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32674
diff changeset
248 --no-libtool Don't use libtool rules.
7030d03d6c13 Clarify which options are available for --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32674
diff changeset
249
33396
83dac15e88be gnulib-tool: Fix --help output.
Bruno Haible <bruno@clisp.org>
parents: 33351
diff changeset
250 Options for --import, --add/remove-import:
83dac15e88be gnulib-tool: Fix --help output.
Bruno Haible <bruno@clisp.org>
parents: 33351
diff changeset
251
26759
aa8886954b98 Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 26758
diff changeset
252 --lib=LIBRARY Specify the library name. Defaults to 'libgnu'.
aa8886954b98 Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 26758
diff changeset
253 --source-base=DIRECTORY
aa8886954b98 Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 26758
diff changeset
254 Directory relative to --dir where source code is
26760
3f8d2afbbaea Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 26759
diff changeset
255 placed (default \"lib\").
26759
aa8886954b98 Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 26758
diff changeset
256 --m4-base=DIRECTORY Directory relative to --dir where *.m4 macros are
26760
3f8d2afbbaea Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 26759
diff changeset
257 placed (default \"m4\").
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
258 --po-base=DIRECTORY Directory relative to --dir where *.po files are
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
259 placed (default \"po\").
26760
3f8d2afbbaea Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 26759
diff changeset
260 --doc-base=DIRECTORY Directory relative to --dir where doc files are
3f8d2afbbaea Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 26759
diff changeset
261 placed (default \"doc\").
26759
aa8886954b98 Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 26758
diff changeset
262 --tests-base=DIRECTORY
aa8886954b98 Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 26758
diff changeset
263 Directory relative to --dir where unit tests are
26760
3f8d2afbbaea Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 26759
diff changeset
264 placed (default \"tests\").
26759
aa8886954b98 Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 26758
diff changeset
265 --aux-dir=DIRECTORY Directory relative to --dir where auxiliary build
33396
83dac15e88be gnulib-tool: Fix --help output.
Bruno Haible <bruno@clisp.org>
parents: 33351
diff changeset
266 tools are placed (default comes from configure.ac).
38408
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
267 --gnu-make Output for GNU Make instead of for the default
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
268 Automake
38181
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
269 --lgpl[=2|=3orGPLv2|=3]
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
270 Abort if modules aren't available under the LGPL.
26759
aa8886954b98 Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 26758
diff changeset
271 Also modify license template from GPL to LGPL.
29108
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
272 The version number of the LGPL can be specified;
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
273 the default is currently LGPLv3.
38408
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
274 --makefile-name=NAME Name of makefile in the source-base and tests-base
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
275 directories (default \"Makefile.am\", or
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
276 \"Makefile.in\" if --gnu-make).
26759
aa8886954b98 Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 26758
diff changeset
277 --macro-prefix=PREFIX Specify the prefix of the macros 'gl_EARLY' and
aa8886954b98 Revert the --help output reordering.
Bruno Haible <bruno@clisp.org>
parents: 26758
diff changeset
278 'gl_INIT'. Default is 'gl'.
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
279 --po-domain=NAME Specify the prefix of the i18n domain. Usually use
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
280 the package name. A suffix '-gnulib' is appended.
34585
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
281 --witness-c-macro=NAME Specify the C macro that is defined when the
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
282 sources in this directory are compiled or used.
29501
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
283 --vc-files Update version control related files.
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
284 --no-vc-files Don't update version control related files
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
285 (.gitignore and/or .cvsignore).
26760
3f8d2afbbaea Split the --help output into several paragraphs.
Bruno Haible <bruno@clisp.org>
parents: 26759
diff changeset
286
32954
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
287 Options for --create-[mega]testdir, --[mega]test:
33396
83dac15e88be gnulib-tool: Fix --help output.
Bruno Haible <bruno@clisp.org>
parents: 33351
diff changeset
288
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
289 --single-configure Generate a single configure file, not a separate
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
290 configure file for the tests directory.
32954
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
291
33396
83dac15e88be gnulib-tool: Fix --help output.
Bruno Haible <bruno@clisp.org>
parents: 33351
diff changeset
292 Options for --import, --add/remove-import, --update,
83dac15e88be gnulib-tool: Fix --help output.
Bruno Haible <bruno@clisp.org>
parents: 33351
diff changeset
293 --create-[mega]testdir, --[mega]test:
83dac15e88be gnulib-tool: Fix --help output.
Bruno Haible <bruno@clisp.org>
parents: 33351
diff changeset
294
26657
421f1d3e1429 help message tweaks
Karl Berry <karl@freefriends.org>
parents: 26646
diff changeset
295 -s, --symbolic, --symlink Make symbolic links instead of copying files.
27334
4c79ad403923 New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 27333
diff changeset
296 --local-symlink Make symbolic links instead of copying files, only
4c79ad403923 New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 27333
diff changeset
297 for files from the local override directory.
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
298 -h, --hardlink Make hard links instead of copying files.
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
299 --local-hardlink Make hard links instead of copying files, only
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
300 for files from the local override directory.
32677
7030d03d6c13 Clarify which options are available for --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32674
diff changeset
301
33396
83dac15e88be gnulib-tool: Fix --help output.
Bruno Haible <bruno@clisp.org>
parents: 33351
diff changeset
302 Options for --import, --add/remove-import, --update:
83dac15e88be gnulib-tool: Fix --help output.
Bruno Haible <bruno@clisp.org>
parents: 33351
diff changeset
303
28787
34d74d564f68 New gnulib-tool option --more-symlinks.
Bruno Haible <bruno@clisp.org>
parents: 28781
diff changeset
304 -S, --more-symlinks Make symbolic links instead of copying files, and
34d74d564f68 New gnulib-tool option --more-symlinks.
Bruno Haible <bruno@clisp.org>
parents: 28781
diff changeset
305 don't replace copyright notices.
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
306 -H, --more-hardlinks Make hard links instead of copying files, and
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
307 don't replace copyright notices.
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
308
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
309 Report bugs to <bug-gnulib@gnu.org>."
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
310 }
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
311
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
312 # func_version
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
313 # outputs to stdout the --version message.
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
314 func_version ()
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
315 {
29484
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
316 func_gnulib_dir
29496
239c15a18c7e Tweak "gnulib --version" output.
Bruno Haible <bruno@clisp.org>
parents: 29495
diff changeset
317 if test -d "$gnulib_dir"/.git \
239c15a18c7e Tweak "gnulib --version" output.
Bruno Haible <bruno@clisp.org>
parents: 29495
diff changeset
318 && (git --version) >/dev/null 2>/dev/null \
239c15a18c7e Tweak "gnulib --version" output.
Bruno Haible <bruno@clisp.org>
parents: 29495
diff changeset
319 && (date --version) >/dev/null 2>/dev/null; then
239c15a18c7e Tweak "gnulib --version" output.
Bruno Haible <bruno@clisp.org>
parents: 29495
diff changeset
320 # gnulib checked out from git.
239c15a18c7e Tweak "gnulib --version" output.
Bruno Haible <bruno@clisp.org>
parents: 29495
diff changeset
321 sed_extract_first_date='/^Date/{
239c15a18c7e Tweak "gnulib --version" output.
Bruno Haible <bruno@clisp.org>
parents: 29495
diff changeset
322 s/^Date:[ ]*//p
239c15a18c7e Tweak "gnulib --version" output.
Bruno Haible <bruno@clisp.org>
parents: 29495
diff changeset
323 q
239c15a18c7e Tweak "gnulib --version" output.
Bruno Haible <bruno@clisp.org>
parents: 29495
diff changeset
324 }'
239c15a18c7e Tweak "gnulib --version" output.
Bruno Haible <bruno@clisp.org>
parents: 29495
diff changeset
325 date=`cd "$gnulib_dir" && git log ChangeLog | sed -n -e "$sed_extract_first_date"`
239c15a18c7e Tweak "gnulib --version" output.
Bruno Haible <bruno@clisp.org>
parents: 29495
diff changeset
326 # Turn "Fri Mar 21 07:16:51 2008 -0600" into "Mar 21 2008 07:16:51 -0600".
239c15a18c7e Tweak "gnulib --version" output.
Bruno Haible <bruno@clisp.org>
parents: 29495
diff changeset
327 sed_year_before_time='s/^[^ ]* \([^ ]*\) \([0-9]*\) \([0-9:]*\) \([0-9]*\) /\1 \2 \4 \3 /'
239c15a18c7e Tweak "gnulib --version" output.
Bruno Haible <bruno@clisp.org>
parents: 29495
diff changeset
328 date=`echo "$date" | sed -e "$sed_year_before_time"`
239c15a18c7e Tweak "gnulib --version" output.
Bruno Haible <bruno@clisp.org>
parents: 29495
diff changeset
329 # Use GNU date to compute the time in GMT.
239c15a18c7e Tweak "gnulib --version" output.
Bruno Haible <bruno@clisp.org>
parents: 29495
diff changeset
330 date=`date -d "$date" -u +"%Y-%m-%d %H:%M:%S"`
30186
c77350457755 Make "gnulib-tool --version" work from any directory.
Bruno Haible <bruno@clisp.org>
parents: 30170
diff changeset
331 version=' '`cd "$gnulib_dir" && ./build-aux/git-version-gen /dev/null | sed -e 's/-dirty/-modified/'`
29496
239c15a18c7e Tweak "gnulib --version" output.
Bruno Haible <bruno@clisp.org>
parents: 29495
diff changeset
332 else
37069
ad409ab5c454 Assume gnulib is checked out from Git, not CVS
Stefano Lattarini <stefano.lattarini@gmail.com>
parents: 36960
diff changeset
333 # gnulib copy without versioning information.
ad409ab5c454 Assume gnulib is checked out from Git, not CVS
Stefano Lattarini <stefano.lattarini@gmail.com>
parents: 36960
diff changeset
334 date=`sed -e 's/ .*//;q' "$gnulib_dir"/ChangeLog`
29496
239c15a18c7e Tweak "gnulib --version" output.
Bruno Haible <bruno@clisp.org>
parents: 29495
diff changeset
335 version=
239c15a18c7e Tweak "gnulib --version" output.
Bruno Haible <bruno@clisp.org>
parents: 29495
diff changeset
336 fi
32108
5419be2f034e Use sed with option -e.
Bruno Haible <bruno@clisp.org>
parents: 32001
diff changeset
337 year=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed -e 's,^.* ,,'`
27038
3f4b822af037 * gnulib-tool (func_version): Create output all at once. This
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27026
diff changeset
338 echo "\
29496
239c15a18c7e Tweak "gnulib --version" output.
Bruno Haible <bruno@clisp.org>
parents: 29495
diff changeset
339 gnulib-tool (GNU $package $date)$version
27038
3f4b822af037 * gnulib-tool (func_version): Create output all at once. This
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27026
diff changeset
340 Copyright (C) $year Free Software Foundation, Inc.
38844
a8586d5e30d2 all: prefer https: URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 38818
diff changeset
341 License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
29484
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
342 This is free software: you are free to change and redistribute it.
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
343 There is NO WARRANTY, to the extent permitted by law.
36493
a42f50eaad00 gnulib-tool: Fix list of authors.
Bruno Haible <bruno@clisp.org>
parents: 36405
diff changeset
344 "
a42f50eaad00 gnulib-tool: Fix list of authors.
Bruno Haible <bruno@clisp.org>
parents: 36405
diff changeset
345 printf "Written by %s, %s, and %s.\n" "Bruno Haible" "Paul Eggert" "Simon Josefsson"
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
346 }
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
347
26468
1b01766ac7a3 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 26456
diff changeset
348 # func_emit_copyright_notice
1b01766ac7a3 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 26456
diff changeset
349 # outputs to stdout a header for a generated file.
1b01766ac7a3 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 26456
diff changeset
350 func_emit_copyright_notice ()
1b01766ac7a3 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 26456
diff changeset
351 {
32108
5419be2f034e Use sed with option -e.
Bruno Haible <bruno@clisp.org>
parents: 32001
diff changeset
352 sed -n -e '/Copyright/ {
5419be2f034e Use sed with option -e.
Bruno Haible <bruno@clisp.org>
parents: 32001
diff changeset
353 p
5419be2f034e Use sed with option -e.
Bruno Haible <bruno@clisp.org>
parents: 32001
diff changeset
354 q
5419be2f034e Use sed with option -e.
Bruno Haible <bruno@clisp.org>
parents: 32001
diff changeset
355 }' < "$self_abspathname"
26468
1b01766ac7a3 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 26456
diff changeset
356 echo "#"
35481
1ec53f99f327 gnulib: use more-standard license notice wording
Paul Eggert <eggert@cs.ucla.edu>
parents: 35173
diff changeset
357 echo "# This file is free software; you can redistribute it and/or modify"
1ec53f99f327 gnulib: use more-standard license notice wording
Paul Eggert <eggert@cs.ucla.edu>
parents: 35173
diff changeset
358 echo "# it under the terms of the GNU General Public License as published by"
1ec53f99f327 gnulib: use more-standard license notice wording
Paul Eggert <eggert@cs.ucla.edu>
parents: 35173
diff changeset
359 echo "# the Free Software Foundation; either version 3 of the License, or"
1ec53f99f327 gnulib: use more-standard license notice wording
Paul Eggert <eggert@cs.ucla.edu>
parents: 35173
diff changeset
360 echo "# (at your option) any later version."
1ec53f99f327 gnulib: use more-standard license notice wording
Paul Eggert <eggert@cs.ucla.edu>
parents: 35173
diff changeset
361 echo "#"
1ec53f99f327 gnulib: use more-standard license notice wording
Paul Eggert <eggert@cs.ucla.edu>
parents: 35173
diff changeset
362 echo "# This file is distributed in the hope that it will be useful,"
1ec53f99f327 gnulib: use more-standard license notice wording
Paul Eggert <eggert@cs.ucla.edu>
parents: 35173
diff changeset
363 echo "# but WITHOUT ANY WARRANTY; without even the implied warranty of"
1ec53f99f327 gnulib: use more-standard license notice wording
Paul Eggert <eggert@cs.ucla.edu>
parents: 35173
diff changeset
364 echo "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
1ec53f99f327 gnulib: use more-standard license notice wording
Paul Eggert <eggert@cs.ucla.edu>
parents: 35173
diff changeset
365 echo "# GNU General Public License for more details."
1ec53f99f327 gnulib: use more-standard license notice wording
Paul Eggert <eggert@cs.ucla.edu>
parents: 35173
diff changeset
366 echo "#"
1ec53f99f327 gnulib: use more-standard license notice wording
Paul Eggert <eggert@cs.ucla.edu>
parents: 35173
diff changeset
367 echo "# You should have received a copy of the GNU General Public License"
38844
a8586d5e30d2 all: prefer https: URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 38818
diff changeset
368 echo "# along with this file. If not, see <https://www.gnu.org/licenses/>."
35481
1ec53f99f327 gnulib: use more-standard license notice wording
Paul Eggert <eggert@cs.ucla.edu>
parents: 35173
diff changeset
369 echo "#"
1ec53f99f327 gnulib: use more-standard license notice wording
Paul Eggert <eggert@cs.ucla.edu>
parents: 35173
diff changeset
370 echo "# As a special exception to the GNU General Public License,"
1ec53f99f327 gnulib: use more-standard license notice wording
Paul Eggert <eggert@cs.ucla.edu>
parents: 35173
diff changeset
371 echo "# this file may be distributed as part of a program that"
1ec53f99f327 gnulib: use more-standard license notice wording
Paul Eggert <eggert@cs.ucla.edu>
parents: 35173
diff changeset
372 echo "# contains a configuration script generated by Autoconf, under"
26468
1b01766ac7a3 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 26456
diff changeset
373 echo "# the same distribution terms as the rest of that program."
1b01766ac7a3 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 26456
diff changeset
374 echo "#"
1b01766ac7a3 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 26456
diff changeset
375 echo "# Generated by gnulib-tool."
1b01766ac7a3 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 26456
diff changeset
376 }
1b01766ac7a3 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 26456
diff changeset
377
27023
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
378 # func_exit STATUS
30144
af53cd7d366f Update comment.
Bruno Haible <bruno@clisp.org>
parents: 30092
diff changeset
379 # exits with a given status.
af53cd7d366f Update comment.
Bruno Haible <bruno@clisp.org>
parents: 30092
diff changeset
380 # This function needs to be used, rather than 'exit', when a 'trap' handler is
af53cd7d366f Update comment.
Bruno Haible <bruno@clisp.org>
parents: 30092
diff changeset
381 # in effect that refers to $?.
27023
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
382 func_exit ()
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
383 {
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
384 (exit $1); exit $1
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
385 }
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
386
29484
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
387 # func_gnulib_dir
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
388 # locates the directory where the gnulib repository lives
30192
5cefa8b0f3d9 Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents: 30186
diff changeset
389 # Input:
5cefa8b0f3d9 Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents: 30186
diff changeset
390 # - progname name of this program
29484
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
391 # Sets variables
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
392 # - self_abspathname absolute pathname of gnulib-tool
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
393 # - gnulib_dir absolute pathname of gnulib repository
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
394 func_gnulib_dir ()
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
395 {
30192
5cefa8b0f3d9 Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents: 30186
diff changeset
396 case "$progname" in
37492
27eff69becc8 gnulib-tool: recognize x:* as an absolute path
KO Myung-Hun <komh78@gmail.com>
parents: 37434
diff changeset
397 /* | ?:*) self_abspathname="$progname" ;;
30192
5cefa8b0f3d9 Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents: 30186
diff changeset
398 */*) self_abspathname=`pwd`/"$progname" ;;
29484
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
399 *)
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
400 # Look in $PATH.
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
401 # Iterate through the elements of $PATH.
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
402 # We use IFS=: instead of
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
403 # for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'`
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
404 # because the latter does not work when some PATH element contains spaces.
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
405 # We use a canonicalized $pathx instead of $PATH, because empty PATH
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
406 # elements are by definition equivalent to '.', however field splitting
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
407 # according to IFS=: loses empty fields in many shells:
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
408 # - /bin/sh on OSF/1 and Solaris loses all empty fields (at the
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
409 # beginning, at the end, and in the middle),
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
410 # - /bin/sh on IRIX and /bin/ksh on IRIX and OSF/1 lose empty fields
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
411 # at the beginning and at the end,
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
412 # - GNU bash, /bin/sh on AIX and HP-UX, and /bin/ksh on AIX, HP-UX,
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
413 # Solaris lose empty fields at the end.
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
414 # The 'case' statement is an optimization, to avoid evaluating the
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
415 # explicit canonicalization command when $PATH contains no empty fields.
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
416 self_abspathname=
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
417 if test "$PATH_SEPARATOR" = ";"; then
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
418 # On Windows, programs are searched in "." before $PATH.
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
419 pathx=".;$PATH"
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
420 else
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
421 # On Unix, we have to convert empty PATH elements to ".".
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
422 pathx="$PATH"
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
423 case :$PATH: in
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
424 *::*)
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
425 pathx=`echo ":$PATH:" | sed -e 's/:::*/:.:/g' -e 's/^://' -e 's/:\$//'`
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
426 ;;
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
427 esac
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
428 fi
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
429 save_IFS="$IFS"
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
430 IFS="$PATH_SEPARATOR"
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
431 for d in $pathx; do
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
432 IFS="$save_IFS"
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
433 test -z "$d" && d=.
30192
5cefa8b0f3d9 Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents: 30186
diff changeset
434 if test -x "$d/$progname" && test ! -d "$d/$progname"; then
5cefa8b0f3d9 Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents: 30186
diff changeset
435 self_abspathname="$d/$progname"
29484
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
436 break
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
437 fi
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
438 done
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
439 IFS="$save_IFS"
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
440 if test -z "$self_abspathname"; then
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
441 func_fatal_error "could not locate the gnulib-tool program - how did you invoke it?"
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
442 fi
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
443 ;;
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
444 esac
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
445 while test -h "$self_abspathname"; do
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
446 # Resolve symbolic link.
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
447 linkval=`func_readlink "$self_abspathname"`
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
448 test -n "$linkval" || break
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
449 case "$linkval" in
37492
27eff69becc8 gnulib-tool: recognize x:* as an absolute path
KO Myung-Hun <komh78@gmail.com>
parents: 37434
diff changeset
450 /* | ?:* ) self_abspathname="$linkval" ;;
29484
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
451 * ) self_abspathname=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;;
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
452 esac
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
453 done
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
454 gnulib_dir=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
455 }
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
456
25936
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
457 # func_tmpdir
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
458 # creates a temporary directory.
30192
5cefa8b0f3d9 Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents: 30186
diff changeset
459 # Input:
5cefa8b0f3d9 Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents: 30186
diff changeset
460 # - progname name of this program
25936
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
461 # Sets variable
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
462 # - tmp pathname of freshly created temporary directory
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
463 func_tmpdir ()
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
464 {
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
465 # Use the environment variable TMPDIR, falling back to /tmp. This allows
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
466 # users to specify a different temporary directory, for example, if their
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
467 # /tmp is filled up or too small.
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
468 : ${TMPDIR=/tmp}
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
469 {
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
470 # Use the mktemp program if available. If not available, hide the error
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
471 # message.
26272
6f8625d103fe * gnulib-tool, build-aux/csharpcomp.sh.in: Do not pass `-q' to mktemp.
Paul Eggert <eggert@cs.ucla.edu>
parents: 26261
diff changeset
472 tmp=`(umask 077 && mktemp -d "$TMPDIR/glXXXXXX") 2>/dev/null` &&
25936
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
473 test -n "$tmp" && test -d "$tmp"
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
474 } ||
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
475 {
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
476 # Use a simple mkdir command. It is guaranteed to fail if the directory
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
477 # already exists. $RANDOM is bash specific and expands to empty in shells
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
478 # other than bash, ksh and zsh. Its use does not increase security;
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
479 # rather, it minimizes the probability of failure in a very cluttered /tmp
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
480 # directory.
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
481 tmp=$TMPDIR/gl$$-$RANDOM
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
482 (umask 077 && mkdir "$tmp")
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
483 } ||
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
484 {
30192
5cefa8b0f3d9 Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents: 30186
diff changeset
485 echo "$progname: cannot create a temporary directory in $TMPDIR" >&2
27023
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
486 func_exit 1
25936
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
487 }
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
488 }
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
489
27014
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
490 # func_append var value
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
491 # appends the given value to the shell variable var.
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
492 if ( foo=bar; foo+=baz && test "$foo" = barbaz ) >/dev/null 2>&1; then
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
493 # Use bash's += operator. It reduces complexity of appending repeatedly to
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
494 # a single variable from O(n^2) to O(n).
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
495 func_append ()
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
496 {
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
497 eval "$1+=\"\$2\""
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
498 }
30680
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
499 fast_func_append=true
27014
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
500 else
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
501 func_append ()
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
502 {
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
503 eval "$1=\"\$$1\$2\""
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
504 }
30680
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
505 fast_func_append=false
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
506 fi
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
507
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
508 # func_remove_prefix var prefix
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
509 # removes the given prefix from the value of the shell variable var.
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
510 # var should be the name of a shell variable.
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
511 # Its value should not contain a newline and not start or end with whitespace.
30728
fd3fea84193c Improve func_remove_prefix, func_remove_suffix.
Bruno Haible <bruno@clisp.org>
parents: 30684
diff changeset
512 # prefix should not contain the characters "$`\{}[]^|.
30680
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
513 if ( foo=bar; eval 'test "${foo#b}" = ar' ) >/dev/null 2>&1; then
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
514 func_remove_prefix ()
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
515 {
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
516 eval "$1=\${$1#\$2}"
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
517 }
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
518 fast_func_remove_prefix=true
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
519 else
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
520 func_remove_prefix ()
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
521 {
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
522 eval "value=\"\$$1\""
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
523 prefix="$2"
30728
fd3fea84193c Improve func_remove_prefix, func_remove_suffix.
Bruno Haible <bruno@clisp.org>
parents: 30684
diff changeset
524 case "$prefix" in
fd3fea84193c Improve func_remove_prefix, func_remove_suffix.
Bruno Haible <bruno@clisp.org>
parents: 30684
diff changeset
525 *.*)
fd3fea84193c Improve func_remove_prefix, func_remove_suffix.
Bruno Haible <bruno@clisp.org>
parents: 30684
diff changeset
526 sed_escape_dots='s/\([.]\)/\\\1/g'
fd3fea84193c Improve func_remove_prefix, func_remove_suffix.
Bruno Haible <bruno@clisp.org>
parents: 30684
diff changeset
527 prefix=`echo "$prefix" | sed -e "$sed_escape_dots"`
fd3fea84193c Improve func_remove_prefix, func_remove_suffix.
Bruno Haible <bruno@clisp.org>
parents: 30684
diff changeset
528 ;;
fd3fea84193c Improve func_remove_prefix, func_remove_suffix.
Bruno Haible <bruno@clisp.org>
parents: 30684
diff changeset
529 esac
30680
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
530 value=`echo "$value" | sed -e "s|^${prefix}||"`
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
531 eval "$1=\"\$value\""
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
532 }
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
533 fast_func_remove_prefix=false
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
534 fi
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
535
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
536 # Determine whether we should use ':' or ';' as PATH_SEPARATOR.
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
537 func_determine_path_separator ()
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
538 {
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
539 if test "${PATH_SEPARATOR+set}" != set; then
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
540 # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
541 # contains only /bin. Note that ksh looks also at the FPATH variable,
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
542 # so we have to set that as well for the test.
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
543 PATH_SEPARATOR=:
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
544 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
545 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
546 || PATH_SEPARATOR=';'
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
547 }
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
548 fi
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
549 }
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
550
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
551 # func_path_prepend pathvar directory
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
552 # puts directory before pathvar, delimiting directories by PATH_SEPARATOR.
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
553 # Newly added directory into pathvar has the highest priority.
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
554 func_path_prepend ()
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
555 {
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
556 if eval "test -n \"\$$1\""; then
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
557 eval "$1=\$2\$PATH_SEPARATOR\$$1"
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
558 else
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
559 eval "$1=\$2"
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
560 fi
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
561 }
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
562
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
563 # func_path_append pathvar directory
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
564 # Similar to func_path_prepend except that the newest directory has the lowest
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
565 # priority.
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
566 func_path_append ()
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
567 {
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
568 if eval "test -n \"\$$1\""; then
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
569 func_append "$1" "$PATH_SEPARATOR$2"
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
570 else
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
571 eval "$1=\$2"
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
572 fi
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
573 }
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
574
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
575 # func_path_foreach_inner
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
576 # helper for func_path_foreach because we need new 'args' array
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
577 # Input:
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
578 # - fpf_dir directory from local_gnulib_path
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
579 # - fpf_cb callback to be run for fpf_dir
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
580 func_path_foreach_inner ()
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
581 {
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
582 set %start% "$@"
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
583 for _fpf_arg
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
584 do
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
585 case $_fpf_arg in
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
586 %start%)
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
587 set dummy
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
588 ;;
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
589 %dir%)
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
590 set "$@" "$fpf_dir"
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
591 ;;
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
592 *)
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
593 set "$@" "$_fpf_arg"
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
594 ;;
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
595 esac
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
596 done
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
597 shift
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
598
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
599 "$fpf_cb" "$@"
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
600 }
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
601
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
602 # func_path_foreach path method args
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
603 # Execute method for each directory in path. The method will be called
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
604 # like `method args` while any argument '%dir%' within args will be replaced
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
605 # with processed directory from path.
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
606 func_path_foreach ()
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
607 {
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
608 fpf_save_IFS=$IFS
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
609 fpf_dirs=$1 ; shift
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
610 fpf_cb=$1 ; shift
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
611 fpf_rc=false
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
612
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
613 IFS=$PATH_SEPARATOR
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
614 for fpf_dir in $fpf_dirs
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
615 do
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
616 func_path_foreach_inner "$@" && fpf_rc=:
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
617 done
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
618 IFS=$fpf_save_IFS
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
619 $fpf_rc
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
620 }
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
621
30680
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
622 # func_remove_suffix var suffix
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
623 # removes the given suffix from the value of the shell variable var.
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
624 # var should be the name of a shell variable.
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
625 # Its value should not contain a newline and not start or end with whitespace.
30728
fd3fea84193c Improve func_remove_prefix, func_remove_suffix.
Bruno Haible <bruno@clisp.org>
parents: 30684
diff changeset
626 # suffix should not contain the characters "$`\{}[]^|.
30680
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
627 if ( foo=bar; eval 'test "${foo%r}" = ba' ) >/dev/null 2>&1; then
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
628 func_remove_suffix ()
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
629 {
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
630 eval "$1=\${$1%\$2}"
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
631 }
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
632 fast_func_remove_suffix=true
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
633 else
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
634 func_remove_suffix ()
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
635 {
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
636 eval "value=\"\$$1\""
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
637 suffix="$2"
30728
fd3fea84193c Improve func_remove_prefix, func_remove_suffix.
Bruno Haible <bruno@clisp.org>
parents: 30684
diff changeset
638 case "$suffix" in
fd3fea84193c Improve func_remove_prefix, func_remove_suffix.
Bruno Haible <bruno@clisp.org>
parents: 30684
diff changeset
639 *.*)
fd3fea84193c Improve func_remove_prefix, func_remove_suffix.
Bruno Haible <bruno@clisp.org>
parents: 30684
diff changeset
640 sed_escape_dots='s/\([.]\)/\\\1/g'
fd3fea84193c Improve func_remove_prefix, func_remove_suffix.
Bruno Haible <bruno@clisp.org>
parents: 30684
diff changeset
641 suffix=`echo "$suffix" | sed -e "$sed_escape_dots"`
fd3fea84193c Improve func_remove_prefix, func_remove_suffix.
Bruno Haible <bruno@clisp.org>
parents: 30684
diff changeset
642 ;;
fd3fea84193c Improve func_remove_prefix, func_remove_suffix.
Bruno Haible <bruno@clisp.org>
parents: 30684
diff changeset
643 esac
30680
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
644 value=`echo "$value" | sed -e "s|${suffix}\$||"`
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
645 eval "$1=\"\$value\""
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
646 }
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
647 fast_func_remove_suffix=false
27014
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
648 fi
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
649
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
650 # func_fatal_error message
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
651 # outputs to stderr a fatal error message, and terminates the program.
30192
5cefa8b0f3d9 Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents: 30186
diff changeset
652 # Input:
5cefa8b0f3d9 Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents: 30186
diff changeset
653 # - progname name of this program
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
654 func_fatal_error ()
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
655 {
30192
5cefa8b0f3d9 Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents: 30186
diff changeset
656 echo "$progname: *** $1" 1>&2
5cefa8b0f3d9 Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents: 30186
diff changeset
657 echo "$progname: *** Stop." 1>&2
27023
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
658 func_exit 1
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
659 }
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
660
32510
bd082c7777d7 gnulib-tool: Make warning diagnostics consistent.
Bruno Haible <bruno@clisp.org>
parents: 32466
diff changeset
661 # func_warning message
bd082c7777d7 gnulib-tool: Make warning diagnostics consistent.
Bruno Haible <bruno@clisp.org>
parents: 32466
diff changeset
662 # Outputs to stderr a warning message,
bd082c7777d7 gnulib-tool: Make warning diagnostics consistent.
Bruno Haible <bruno@clisp.org>
parents: 32466
diff changeset
663 func_warning ()
bd082c7777d7 gnulib-tool: Make warning diagnostics consistent.
Bruno Haible <bruno@clisp.org>
parents: 32466
diff changeset
664 {
bd082c7777d7 gnulib-tool: Make warning diagnostics consistent.
Bruno Haible <bruno@clisp.org>
parents: 32466
diff changeset
665 echo "gnulib-tool: warning: $1" 1>&2
bd082c7777d7 gnulib-tool: Make warning diagnostics consistent.
Bruno Haible <bruno@clisp.org>
parents: 32466
diff changeset
666 }
bd082c7777d7 gnulib-tool: Make warning diagnostics consistent.
Bruno Haible <bruno@clisp.org>
parents: 32466
diff changeset
667
25939
bace2574e5f7 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 25938
diff changeset
668 # func_readlink SYMLINK
bace2574e5f7 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 25938
diff changeset
669 # outputs the target of the given symlink.
36616
8d0f5cc18e94 Do use readlink if available
Bernd Jendrissek <bernd.jendrissek@gmail.com>
parents: 36499
diff changeset
670 if (type readlink) > /dev/null 2>&1; then
25939
bace2574e5f7 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 25938
diff changeset
671 func_readlink ()
bace2574e5f7 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 25938
diff changeset
672 {
bace2574e5f7 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 25938
diff changeset
673 # Use the readlink program from GNU coreutils.
bace2574e5f7 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 25938
diff changeset
674 readlink "$1"
bace2574e5f7 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 25938
diff changeset
675 }
bace2574e5f7 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 25938
diff changeset
676 else
bace2574e5f7 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 25938
diff changeset
677 func_readlink ()
bace2574e5f7 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 25938
diff changeset
678 {
bace2574e5f7 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 25938
diff changeset
679 # Use two sed invocations. A single sed -n -e 's,^.* -> \(.*\)$,\1,p'
25954
b67eab38d878 Sort in a locale-independent way.
Bruno Haible <bruno@clisp.org>
parents: 25953
diff changeset
680 # would do the wrong thing if the link target contains " -> ".
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
681 LC_ALL=C ls -l "$1" | sed -e 's, -> ,#%%#,' | sed -n -e 's,^.*#%%#\(.*\)$,\1,p'
25939
bace2574e5f7 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 25938
diff changeset
682 }
bace2574e5f7 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 25938
diff changeset
683 fi
bace2574e5f7 Portability fix: readlink is not portable.
Bruno Haible <bruno@clisp.org>
parents: 25938
diff changeset
684
26904
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
685 # func_relativize DIR1 DIR2
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
686 # computes a relative pathname RELDIR such that DIR1/RELDIR = DIR2.
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
687 # Input:
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
688 # - DIR1 relative pathname, relative to the current directory
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
689 # - DIR2 relative pathname, relative to the current directory
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
690 # Output:
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
691 # - reldir relative pathname of DIR2, relative to DIR1
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
692 func_relativize ()
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
693 {
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
694 dir0=`pwd`
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
695 dir1="$1"
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
696 dir2="$2"
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
697 sed_first='s,^\([^/]*\)/.*$,\1,'
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
698 sed_rest='s,^[^/]*/*,,'
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
699 sed_last='s,^.*/\([^/]*\)$,\1,'
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
700 sed_butlast='s,/*[^/]*$,,'
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
701 while test -n "$dir1"; do
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
702 first=`echo "$dir1" | sed -e "$sed_first"`
26904
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
703 if test "$first" != "."; then
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
704 if test "$first" = ".."; then
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
705 dir2=`echo "$dir0" | sed -e "$sed_last"`/"$dir2"
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
706 dir0=`echo "$dir0" | sed -e "$sed_butlast"`
26904
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
707 else
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
708 first2=`echo "$dir2" | sed -e "$sed_first"`
26904
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
709 if test "$first2" = "$first"; then
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
710 dir2=`echo "$dir2" | sed -e "$sed_rest"`
26904
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
711 else
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
712 dir2="../$dir2"
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
713 fi
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
714 dir0="$dir0"/"$first"
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
715 fi
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
716 fi
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
717 dir1=`echo "$dir1" | sed -e "$sed_rest"`
26904
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
718 done
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
719 reldir="$dir2"
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
720 }
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
721
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
722 # func_relconcat DIR1 DIR2
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
723 # computes a relative pathname DIR1/DIR2, with obvious simplifications.
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
724 # Input:
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
725 # - DIR1 relative pathname, relative to the current directory
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
726 # - DIR2 relative pathname, relative to DIR1
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
727 # Output:
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
728 # - relconcat DIR1/DIR2, relative to the current directory
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
729 func_relconcat ()
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
730 {
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
731 dir1="$1"
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
732 dir2="$2"
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
733 sed_first='s,^\([^/]*\)/.*$,\1,'
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
734 sed_rest='s,^[^/]*/*,,'
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
735 sed_last='s,^.*/\([^/]*\)$,\1,'
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
736 sed_butlast='s,/*[^/]*$,,'
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
737 while true; do
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
738 first=`echo "$dir2" | sed -e "$sed_first"`
26904
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
739 if test "$first" = "."; then
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
740 dir2=`echo "$dir2" | sed -e "$sed_rest"`
26904
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
741 if test -z "$dir2"; then
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
742 relconcat="$dir1"
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
743 break
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
744 fi
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
745 else
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
746 last=`echo "$dir1" | sed -e "$sed_last"`
26904
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
747 while test "$last" = "."; do
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
748 dir1=`echo "$dir1" | sed -e "$sed_butlast"`
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
749 last=`echo "$dir1" | sed -e "$sed_last"`
26904
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
750 done
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
751 if test -z "$dir1"; then
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
752 relconcat="$dir2"
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
753 break
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
754 fi
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
755 if test "$first" = ".."; then
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
756 if test "$last" = ".."; then
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
757 relconcat="$dir1/$dir2"
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
758 break
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
759 fi
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
760 dir1=`echo "$dir1" | sed -e "$sed_butlast"`
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
761 dir2=`echo "$dir2" | sed -e "$sed_rest"`
26904
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
762 if test -z "$dir1"; then
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
763 relconcat="$dir2"
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
764 break
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
765 fi
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
766 if test -z "$dir2"; then
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
767 relconcat="$dir1"
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
768 break
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
769 fi
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
770 else
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
771 relconcat="$dir1/$dir2"
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
772 break
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
773 fi
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
774 fi
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
775 done
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
776 }
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
777
37894
6612cc9c916e gnulib-tool: don't assume ln -s works
Paul Eggert <eggert@cs.ucla.edu>
parents: 37869
diff changeset
778 # func_ln_s SRC DEST
6612cc9c916e gnulib-tool: don't assume ln -s works
Paul Eggert <eggert@cs.ucla.edu>
parents: 37869
diff changeset
779 # Like ln -s, except use cp -p if ln -s fails.
6612cc9c916e gnulib-tool: don't assume ln -s works
Paul Eggert <eggert@cs.ucla.edu>
parents: 37869
diff changeset
780 func_ln_s ()
6612cc9c916e gnulib-tool: don't assume ln -s works
Paul Eggert <eggert@cs.ucla.edu>
parents: 37869
diff changeset
781 {
6612cc9c916e gnulib-tool: don't assume ln -s works
Paul Eggert <eggert@cs.ucla.edu>
parents: 37869
diff changeset
782 ln -s "$1" "$2" || {
6612cc9c916e gnulib-tool: don't assume ln -s works
Paul Eggert <eggert@cs.ucla.edu>
parents: 37869
diff changeset
783 echo "$progname: ln -s failed; falling back on cp -p" >&2
6612cc9c916e gnulib-tool: don't assume ln -s works
Paul Eggert <eggert@cs.ucla.edu>
parents: 37869
diff changeset
784
6612cc9c916e gnulib-tool: don't assume ln -s works
Paul Eggert <eggert@cs.ucla.edu>
parents: 37869
diff changeset
785 case "$1" in
6612cc9c916e gnulib-tool: don't assume ln -s works
Paul Eggert <eggert@cs.ucla.edu>
parents: 37869
diff changeset
786 /* | ?:*) # SRC is absolute.
38630
1cef44d96f1c gnulib-tool: Fix bug in func_ln_s, from 2016-01-15.
Bruno Haible <bruno@clisp.org>
parents: 38616
diff changeset
787 cp_src="$1" ;;
37894
6612cc9c916e gnulib-tool: don't assume ln -s works
Paul Eggert <eggert@cs.ucla.edu>
parents: 37869
diff changeset
788 *) # SRC is relative to the directory of DEST.
38630
1cef44d96f1c gnulib-tool: Fix bug in func_ln_s, from 2016-01-15.
Bruno Haible <bruno@clisp.org>
parents: 38616
diff changeset
789 case "$2" in
1cef44d96f1c gnulib-tool: Fix bug in func_ln_s, from 2016-01-15.
Bruno Haible <bruno@clisp.org>
parents: 38616
diff changeset
790 */*) cp_src="${2%/*}/$1" ;;
1cef44d96f1c gnulib-tool: Fix bug in func_ln_s, from 2016-01-15.
Bruno Haible <bruno@clisp.org>
parents: 38616
diff changeset
791 *) cp_src="$1" ;;
1cef44d96f1c gnulib-tool: Fix bug in func_ln_s, from 2016-01-15.
Bruno Haible <bruno@clisp.org>
parents: 38616
diff changeset
792 esac
1cef44d96f1c gnulib-tool: Fix bug in func_ln_s, from 2016-01-15.
Bruno Haible <bruno@clisp.org>
parents: 38616
diff changeset
793 ;;
37894
6612cc9c916e gnulib-tool: don't assume ln -s works
Paul Eggert <eggert@cs.ucla.edu>
parents: 37869
diff changeset
794 esac
6612cc9c916e gnulib-tool: don't assume ln -s works
Paul Eggert <eggert@cs.ucla.edu>
parents: 37869
diff changeset
795
6612cc9c916e gnulib-tool: don't assume ln -s works
Paul Eggert <eggert@cs.ucla.edu>
parents: 37869
diff changeset
796 cp -p "$cp_src" "$2"
6612cc9c916e gnulib-tool: don't assume ln -s works
Paul Eggert <eggert@cs.ucla.edu>
parents: 37869
diff changeset
797 }
6612cc9c916e gnulib-tool: don't assume ln -s works
Paul Eggert <eggert@cs.ucla.edu>
parents: 37869
diff changeset
798 }
6612cc9c916e gnulib-tool: don't assume ln -s works
Paul Eggert <eggert@cs.ucla.edu>
parents: 37869
diff changeset
799
38631
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
800 # func_symlink_target SRC DEST
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
801 # Determines LINK_TARGET such that "ln -s LINK_TARGET DEST" will create a
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
802 # symbolic link DEST that points to SRC.
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
803 # Output:
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
804 # - link_target link target, relative to the directory of DEST
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
805 func_symlink_target ()
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
806 {
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
807 case "$1" in
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
808 /* | ?:*)
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
809 link_target="$1" ;;
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
810 *) # SRC is relative.
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
811 case "$2" in
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
812 /* | ?:*)
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
813 link_target="`pwd`/$1" ;;
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
814 *) # DEST is relative too.
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
815 ln_destdir=`echo "$2" | sed -e 's,[^/]*$,,'`
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
816 test -n "$ln_destdir" || ln_destdir="."
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
817 func_relativize "$ln_destdir" "$1"
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
818 link_target="$reldir"
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
819 ;;
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
820 esac
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
821 ;;
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
822 esac
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
823 }
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
824
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
825 # func_symlink SRC DEST
37894
6612cc9c916e gnulib-tool: don't assume ln -s works
Paul Eggert <eggert@cs.ucla.edu>
parents: 37869
diff changeset
826 # Like func_ln_s, except that SRC is given relative to the current directory (or
27333
c273e0333252 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 27332
diff changeset
827 # absolute), not given relative to the directory of DEST.
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
828 func_symlink ()
27333
c273e0333252 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 27332
diff changeset
829 {
38631
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
830 func_symlink_target "$1" "$2"
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
831 func_ln_s "$link_target" "$2"
27333
c273e0333252 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 27332
diff changeset
832 }
c273e0333252 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 27332
diff changeset
833
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
834 # func_symlink_if_changed SRC DEST
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
835 # Like func_symlink, but avoids munging timestamps if the link is correct.
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
836 # SRC is given relative to the current directory (or absolute).
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
837 func_symlink_if_changed ()
27333
c273e0333252 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 27332
diff changeset
838 {
c273e0333252 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 27332
diff changeset
839 if test $# -ne 2; then
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
840 echo "usage: func_symlink_if_changed SRC DEST" >&2
27333
c273e0333252 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 27332
diff changeset
841 fi
38631
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
842 func_symlink_target "$1" "$2"
27333
c273e0333252 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 27332
diff changeset
843 ln_target=`func_readlink "$2"`
38631
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
844 if test -h "$2" && test "$link_target" = "$ln_target"; then
27333
c273e0333252 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 27332
diff changeset
845 :
c273e0333252 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 27332
diff changeset
846 else
c273e0333252 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 27332
diff changeset
847 rm -f "$2"
38631
a67cd41fd724 gnulib-tool: Fix bug in func_symlink_if_changed, from 2006-11-13.
Bruno Haible <bruno@clisp.org>
parents: 38630
diff changeset
848 func_ln_s "$link_target" "$2"
27333
c273e0333252 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 27332
diff changeset
849 fi
c273e0333252 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 27332
diff changeset
850 }
c273e0333252 Fix the symlinks installed by the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 27332
diff changeset
851
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
852 # func_hardlink SRC DEST
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
853 # Like ln, except use cp -p if ln fails.
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
854 # SRC is given relative to the current directory (or absolute).
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
855 func_hardlink ()
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
856 {
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
857 ln "$1" "$2" || {
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
858 echo "$progname: ln failed; falling back on cp -p" >&2
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
859 cp -p "$1" "$2"
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
860 }
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
861 }
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
862
32573
67183b4dcf8d Typo in comment.
Bruno Haible <bruno@clisp.org>
parents: 32572
diff changeset
863 # Ensure an 'echo' command that
32572
f0df2aa3fc0f Really work around around "broken pipe" error message from bash 3.2.
Bruno Haible <bruno@clisp.org>
parents: 32568
diff changeset
864 # 1. does not interpret backslashes and
f0df2aa3fc0f Really work around around "broken pipe" error message from bash 3.2.
Bruno Haible <bruno@clisp.org>
parents: 32568
diff changeset
865 # 2. does not print an error message "broken pipe" when writing into a pipe
f0df2aa3fc0f Really work around around "broken pipe" error message from bash 3.2.
Bruno Haible <bruno@clisp.org>
parents: 32568
diff changeset
866 # with no writers.
f0df2aa3fc0f Really work around around "broken pipe" error message from bash 3.2.
Bruno Haible <bruno@clisp.org>
parents: 32568
diff changeset
867 #
f0df2aa3fc0f Really work around around "broken pipe" error message from bash 3.2.
Bruno Haible <bruno@clisp.org>
parents: 32568
diff changeset
868 # Test cases for problem 1:
28694
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
869 # echo '\n' | wc -l prints 1 when OK, 2 when KO
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
870 # echo '\t' | grep t > /dev/null has return code 0 when OK, 1 when KO
32572
f0df2aa3fc0f Really work around around "broken pipe" error message from bash 3.2.
Bruno Haible <bruno@clisp.org>
parents: 32568
diff changeset
871 # Test cases for problem 2:
f0df2aa3fc0f Really work around around "broken pipe" error message from bash 3.2.
Bruno Haible <bruno@clisp.org>
parents: 32568
diff changeset
872 # echo hi | true frequently prints
f0df2aa3fc0f Really work around around "broken pipe" error message from bash 3.2.
Bruno Haible <bruno@clisp.org>
parents: 32568
diff changeset
873 # "bash: echo: write error: Broken pipe"
f0df2aa3fc0f Really work around around "broken pipe" error message from bash 3.2.
Bruno Haible <bruno@clisp.org>
parents: 32568
diff changeset
874 # to standard error in bash 3.2.
f0df2aa3fc0f Really work around around "broken pipe" error message from bash 3.2.
Bruno Haible <bruno@clisp.org>
parents: 32568
diff changeset
875 #
f0df2aa3fc0f Really work around around "broken pipe" error message from bash 3.2.
Bruno Haible <bruno@clisp.org>
parents: 32568
diff changeset
876 # Problem 1 is a weird heritage from SVR4. BSD got it right (except that
28697
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
877 # BSD echo interprets '-n' as an option, which is also not desirable).
28694
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
878 # Nowadays the problem occurs in 4 situations:
28697
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
879 # - in bash, when the shell option xpg_echo is set (bash >= 2.04)
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
880 # or when it was built with --enable-usg-echo-default (bash >= 2.0)
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
881 # or when it was built with DEFAULT_ECHO_TO_USG (bash < 2.0),
28694
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
882 # - in zsh, when sh-emulation is not set,
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
883 # - in ksh (e.g. AIX /bin/sh and Solaris /usr/xpg4/bin/sh are ksh instances,
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
884 # and HP-UX /bin/sh and IRIX /bin/sh behave similarly),
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
885 # - in Solaris /bin/sh and OSF/1 /bin/sh.
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
886 # We try the following workarounds:
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
887 # - for all: respawn using $CONFIG_SHELL if that is set and works.
28697
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
888 # - for bash >= 2.04: unset the shell option xpg_echo.
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
889 # - for bash >= 2.0: define echo to a function that uses the printf built-in.
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
890 # - for bash < 2.0: define echo to a function that uses cat of a here document.
28694
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
891 # - for zsh: turn sh-emulation on.
28699
739a9544170c Make use of ksh's 'print' built-in.
Bruno Haible <bruno@clisp.org>
parents: 28698
diff changeset
892 # - for ksh: alias echo to 'print -r'.
28694
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
893 # - for ksh: alias echo to a function that uses cat of a here document.
28699
739a9544170c Make use of ksh's 'print' built-in.
Bruno Haible <bruno@clisp.org>
parents: 28698
diff changeset
894 # - for Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh and rely on
739a9544170c Make use of ksh's 'print' built-in.
Bruno Haible <bruno@clisp.org>
parents: 28698
diff changeset
895 # the ksh workaround.
28694
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
896 # - otherwise: respawn using /bin/sh and rely on the workarounds.
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
897 # When respawning, we pass --no-reexec as first argument, so as to avoid
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
898 # turning this script into a fork bomb in unlucky situations.
32572
f0df2aa3fc0f Really work around around "broken pipe" error message from bash 3.2.
Bruno Haible <bruno@clisp.org>
parents: 32568
diff changeset
899 #
f0df2aa3fc0f Really work around around "broken pipe" error message from bash 3.2.
Bruno Haible <bruno@clisp.org>
parents: 32568
diff changeset
900 # Problem 2 is specific to bash 3.2 and affects the 'echo' built-in, but not
f0df2aa3fc0f Really work around around "broken pipe" error message from bash 3.2.
Bruno Haible <bruno@clisp.org>
parents: 32568
diff changeset
901 # the 'printf' built-in. See
39154
55dc3d465b51 maint: shorten https://lists.gnu.org/archive/html/... links
Jim Meyering <meyering@fb.com>
parents: 38925
diff changeset
902 # <https://lists.gnu.org/r/bug-bash/2008-12/msg00050.html>
55dc3d465b51 maint: shorten https://lists.gnu.org/archive/html/... links
Jim Meyering <meyering@fb.com>
parents: 38925
diff changeset
903 # <https://lists.gnu.org/r/bug-gnulib/2010-02/msg00154.html>
32572
f0df2aa3fc0f Really work around around "broken pipe" error message from bash 3.2.
Bruno Haible <bruno@clisp.org>
parents: 32568
diff changeset
904 # The workaround is: define echo to a function that uses the printf built-in.
28694
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
905 have_echo=
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
906 if echo '\t' | grep t > /dev/null; then
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
907 have_echo=yes # Lucky!
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
908 fi
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
909 # Try the workarounds.
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
910 # Respawn using $CONFIG_SHELL if that is set and works.
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
911 if test -z "$have_echo" \
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
912 && test "X$1" != "X--no-reexec" \
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
913 && test -n "$CONFIG_SHELL" \
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
914 && test -f "$CONFIG_SHELL" \
31610
fd8235285d5c Fix test whether $CONFIG_SHELL has a working 'echo' command.
Stefano Lattarini <stefano.lattarini@gmail.com>
parents: 31428
diff changeset
915 && $CONFIG_SHELL -c "echo '\\t' | grep t > /dev/null"; then
28694
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
916 exec $CONFIG_SHELL "$0" --no-reexec "$@"
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
917 exit 127
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
918 fi
28697
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
919 # For bash >= 2.04: unset the shell option xpg_echo.
28694
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
920 if test -z "$have_echo" \
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
921 && test -n "$BASH_VERSION" \
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
922 && (shopt -o xpg_echo; echo '\t' | grep t > /dev/null) 2>/dev/null; then
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
923 shopt -o xpg_echo
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
924 have_echo=yes
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
925 fi
28697
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
926 # For bash >= 2.0: define echo to a function that uses the printf built-in.
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
927 # For bash < 2.0: define echo to a function that uses cat of a here document.
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
928 # (There is no win in using 'printf' over 'cat' if it is not a shell built-in.)
32594
d0d4e097677f Fix breakage of gnulib-tool with ksh, introduced on 2010-02-21.
Bruno Haible <bruno@clisp.org>
parents: 32573
diff changeset
929 # Also handle problem 2, specific to bash 3.2, here.
d0d4e097677f Fix breakage of gnulib-tool with ksh, introduced on 2010-02-21.
Bruno Haible <bruno@clisp.org>
parents: 32573
diff changeset
930 if { test -z "$have_echo" \
d0d4e097677f Fix breakage of gnulib-tool with ksh, introduced on 2010-02-21.
Bruno Haible <bruno@clisp.org>
parents: 32573
diff changeset
931 || case "$BASH_VERSION" in 3.2*) true;; *) false;; esac; \
d0d4e097677f Fix breakage of gnulib-tool with ksh, introduced on 2010-02-21.
Bruno Haible <bruno@clisp.org>
parents: 32573
diff changeset
932 } \
28697
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
933 && test -n "$BASH_VERSION"; then \
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
934 if type printf 2>/dev/null | grep / > /dev/null; then
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
935 # 'printf' is not a shell built-in.
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
936 echo ()
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
937 {
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
938 cat <<EOF
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
939 $*
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
940 EOF
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
941 }
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
942 else
28698
4393b4eecced Tweak comment.
Bruno Haible <bruno@clisp.org>
parents: 28697
diff changeset
943 # 'printf' is a shell built-in.
28697
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
944 echo ()
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
945 {
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
946 printf '%s\n' "$*"
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
947 }
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
948 fi
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
949 if echo '\t' | grep t > /dev/null; then
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
950 have_echo=yes
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
951 fi
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
952 fi
28694
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
953 # For zsh: turn sh-emulation on.
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
954 if test -z "$have_echo" \
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
955 && test -n "$ZSH_VERSION" \
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
956 && (emulate sh) >/dev/null 2>&1; then
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
957 emulate sh
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
958 fi
28699
739a9544170c Make use of ksh's 'print' built-in.
Bruno Haible <bruno@clisp.org>
parents: 28698
diff changeset
959 # For ksh: alias echo to 'print -r'.
739a9544170c Make use of ksh's 'print' built-in.
Bruno Haible <bruno@clisp.org>
parents: 28698
diff changeset
960 if test -z "$have_echo" \
739a9544170c Make use of ksh's 'print' built-in.
Bruno Haible <bruno@clisp.org>
parents: 28698
diff changeset
961 && (type print) >/dev/null 2>&1; then
739a9544170c Make use of ksh's 'print' built-in.
Bruno Haible <bruno@clisp.org>
parents: 28698
diff changeset
962 # A 'print' command exists.
739a9544170c Make use of ksh's 'print' built-in.
Bruno Haible <bruno@clisp.org>
parents: 28698
diff changeset
963 if type print 2>/dev/null | grep / > /dev/null; then
739a9544170c Make use of ksh's 'print' built-in.
Bruno Haible <bruno@clisp.org>
parents: 28698
diff changeset
964 :
739a9544170c Make use of ksh's 'print' built-in.
Bruno Haible <bruno@clisp.org>
parents: 28698
diff changeset
965 else
739a9544170c Make use of ksh's 'print' built-in.
Bruno Haible <bruno@clisp.org>
parents: 28698
diff changeset
966 # 'print' is a shell built-in.
739a9544170c Make use of ksh's 'print' built-in.
Bruno Haible <bruno@clisp.org>
parents: 28698
diff changeset
967 if (print -r '\told' | grep told > /dev/null) 2>/dev/null; then
739a9544170c Make use of ksh's 'print' built-in.
Bruno Haible <bruno@clisp.org>
parents: 28698
diff changeset
968 # 'print' is the ksh shell built-in.
739a9544170c Make use of ksh's 'print' built-in.
Bruno Haible <bruno@clisp.org>
parents: 28698
diff changeset
969 alias echo='print -r'
739a9544170c Make use of ksh's 'print' built-in.
Bruno Haible <bruno@clisp.org>
parents: 28698
diff changeset
970 fi
739a9544170c Make use of ksh's 'print' built-in.
Bruno Haible <bruno@clisp.org>
parents: 28698
diff changeset
971 fi
739a9544170c Make use of ksh's 'print' built-in.
Bruno Haible <bruno@clisp.org>
parents: 28698
diff changeset
972 fi
739a9544170c Make use of ksh's 'print' built-in.
Bruno Haible <bruno@clisp.org>
parents: 28698
diff changeset
973 if test -z "$have_echo" \
739a9544170c Make use of ksh's 'print' built-in.
Bruno Haible <bruno@clisp.org>
parents: 28698
diff changeset
974 && echo '\t' | grep t > /dev/null; then
739a9544170c Make use of ksh's 'print' built-in.
Bruno Haible <bruno@clisp.org>
parents: 28698
diff changeset
975 have_echo=yes
739a9544170c Make use of ksh's 'print' built-in.
Bruno Haible <bruno@clisp.org>
parents: 28698
diff changeset
976 fi
28694
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
977 # For ksh: alias echo to a function that uses cat of a here document.
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
978 # The ksh manual page says:
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
979 # "Aliasing is performed when scripts are read, not while they are executed.
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
980 # Therefore, for an alias to take effect, the alias definition command has
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
981 # to be executed before the command which references the alias is read."
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
982 # Because of this, we have to play strange tricks with have_echo, to ensure
28697
eeb1884e91fb Add better support for bash versions < 2.04.
Bruno Haible <bruno@clisp.org>
parents: 28696
diff changeset
983 # that the top-level statement containing the test starts after the 'alias'
28694
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
984 # command.
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
985 if test -z "$have_echo"; then
33349
c0fbe0be289d gnulib-tool: Avoid stderr output on IRIX related to 'alias', 'unalias'.
Bruno Haible <bruno@clisp.org>
parents: 33341
diff changeset
986 bsd_echo ()
28694
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
987 {
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
988 cat <<EOF
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
989 $*
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
990 EOF
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
991 }
33349
c0fbe0be289d gnulib-tool: Avoid stderr output on IRIX related to 'alias', 'unalias'.
Bruno Haible <bruno@clisp.org>
parents: 33341
diff changeset
992 if (alias echo=bsd_echo) 2>/dev/null; then
c0fbe0be289d gnulib-tool: Avoid stderr output on IRIX related to 'alias', 'unalias'.
Bruno Haible <bruno@clisp.org>
parents: 33341
diff changeset
993 alias echo=bsd_echo 2>/dev/null
c0fbe0be289d gnulib-tool: Avoid stderr output on IRIX related to 'alias', 'unalias'.
Bruno Haible <bruno@clisp.org>
parents: 33341
diff changeset
994 fi
28694
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
995 fi
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
996 if test -z "$have_echo" \
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
997 && echo '\t' | grep t > /dev/null; then
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
998 have_echo=yes
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
999 fi
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1000 if test -z "$have_echo"; then
33349
c0fbe0be289d gnulib-tool: Avoid stderr output on IRIX related to 'alias', 'unalias'.
Bruno Haible <bruno@clisp.org>
parents: 33341
diff changeset
1001 if (alias echo=bsd_echo) 2>/dev/null; then
c0fbe0be289d gnulib-tool: Avoid stderr output on IRIX related to 'alias', 'unalias'.
Bruno Haible <bruno@clisp.org>
parents: 33341
diff changeset
1002 unalias echo 2>/dev/null
c0fbe0be289d gnulib-tool: Avoid stderr output on IRIX related to 'alias', 'unalias'.
Bruno Haible <bruno@clisp.org>
parents: 33341
diff changeset
1003 fi
28694
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1004 fi
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1005 # For Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh.
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1006 if test -z "$have_echo" \
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1007 && test "X$1" != "X--no-reexec" \
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1008 && test -f /bin/ksh; then
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1009 exec /bin/ksh "$0" --no-reexec "$@"
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1010 exit 127
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1011 fi
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1012 # Otherwise: respawn using /bin/sh.
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1013 if test -z "$have_echo" \
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1014 && test "X$1" != "X--no-reexec" \
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1015 && test -f /bin/sh; then
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1016 exec /bin/sh "$0" --no-reexec "$@"
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1017 exit 127
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1018 fi
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1019 if test -z "$have_echo"; then
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1020 func_fatal_error "Shell does not support 'echo' correctly. Please install GNU bash and set the environment variable CONFIG_SHELL to point to it."
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1021 fi
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1022 if echo '\t' | grep t > /dev/null; then
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1023 : # Works fine now.
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1024 else
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1025 func_fatal_error "Shell does not support 'echo' correctly. Workaround does not work. Please report this as a bug to bug-gnulib@gnu.org."
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1026 fi
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1027 if test "X$1" = "X--no-reexec"; then
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1028 shift
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1029 fi
21b73f2cd61e Ensure a POSIX:2001 compliant 'echo' command.
Bruno Haible <bruno@clisp.org>
parents: 28692
diff changeset
1030
37221
336fcfecc05e gnulib-tool: protect against CDPATH
Jim Meyering <meyering@fb.com>
parents: 37076
diff changeset
1031 # Unset CDPATH. Otherwise, output from 'cd dir' can surprise callers.
336fcfecc05e gnulib-tool: protect against CDPATH
Jim Meyering <meyering@fb.com>
parents: 37076
diff changeset
1032 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
336fcfecc05e gnulib-tool: protect against CDPATH
Jim Meyering <meyering@fb.com>
parents: 37076
diff changeset
1033
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1034 # Determine the path separator early because the following option parsing code
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1035 # requires that.
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1036 func_determine_path_separator
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1037
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1038 # Command-line option processing.
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1039 # Removes the OPTIONS from the arguments. Sets the variables:
36622
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
1040 # - mode one of: list, find, import, add-import, remove-import,
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
1041 # update, create-testdir, create-megatestdir, test, megatest,
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
1042 # copy-file
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1043 # - destdir from --dir
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1044 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1045 # - modcache true or false, from --cache-modules/--no-cache-modules
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
1046 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
1047 # - libname, supplied_libname from --lib
24889
359ba837e33f Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 24408
diff changeset
1048 # - sourcebase from --source-base
359ba837e33f Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 24408
diff changeset
1049 # - m4base from --m4-base
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1050 # - pobase from --po-base
26646
17ce792d4851 * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 26643
diff changeset
1051 # - docbase from --doc-base
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1052 # - testsbase from --tests-base
25489
078dc4f32daa 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 25376
diff changeset
1053 # - auxdir from --aux-dir
36622
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
1054 # - inctests true if --with-tests was given, false if --without-tests
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
1055 # was given, blank otherwise
30435
e8c5a9d6f576 New option --with-obsolete.
Bruno Haible <bruno@clisp.org>
parents: 30434
diff changeset
1056 # - incobsolete true if --with-obsolete was given, blank otherwise
32771
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1057 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1058 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1059 # otherwise
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1060 # - inc_privileged_tests true if --with-privileged-tests was given, blank
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1061 # otherwise
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1062 # - inc_unportable_tests true if --with-unportable-tests was given, blank
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1063 # otherwise
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1064 # - inc_all_tests true if --with-all-tests was given, blank otherwise
32954
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1065 # - excl_cxx_tests true if --without-c++-tests was given, blank otherwise
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1066 # - excl_longrunning_tests true if --without-longrunning-tests was given,
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1067 # blank otherwise
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1068 # - excl_privileged_tests true if --without-privileged-tests was given, blank
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1069 # otherwise
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1070 # - excl_unportable_tests true if --without-unportable-tests was given, blank
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1071 # otherwise
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
1072 # - single_configure true if --single-configure was given, false otherwise
25672
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
1073 # - avoidlist list of modules to avoid, from --avoid
34524
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
1074 # - cond_dependencies true if --conditional-dependencies was given, false if
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
1075 # --no-conditional-dependencies was given, blank otherwise
29108
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
1076 # - lgpl yes or a number if --lgpl was given, blank otherwise
38408
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
1077 # - gnu_make true if --gnu-make was given, false otherwise
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
1078 # - makefile_name from --makefile-name
26768
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
1079 # - libtool true if --libtool was given, false if --no-libtool was
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
1080 # given, blank otherwise
26685
c53bd2f2f3a1 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 26684
diff changeset
1081 # - macro_prefix from --macro-prefix
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1082 # - po_domain from --po-domain
34585
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
1083 # - witness_c_macro from --witness-c-macro
29501
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
1084 # - vc_files true if --vc-files was given, false if --no-vc-files was
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
1085 # given, blank otherwise
26685
c53bd2f2f3a1 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 26684
diff changeset
1086 # - autoconf_minversion minimum supported autoconf version
25937
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
1087 # - doit : if actions shall be executed, false if only to be printed
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1088 # - copymode symlink if --symlink or --more-symlinks was given,
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1089 # hardlink if --hardlink or --more-hardlinks was given,
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1090 # blank otherwise
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1091 # - lcopymode symlink if --local-symlink was given,
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1092 # hardlink if --local-hardlink was given,
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1093 # blank otherwise
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1094 # - do_copyrights blank if --more-symlinks or --more-hardlinks was given,
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1095 # true otherwise
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1096 {
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1097 mode=
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1098 destdir=
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1099 local_gnulib_path=
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1100 modcache=true
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
1101 verbose=0
24889
359ba837e33f Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 24408
diff changeset
1102 libname=libgnu
25035
9556749e9999 Initialize supplied_libname. Tweak usage message.
Bruno Haible <bruno@clisp.org>
parents: 25034
diff changeset
1103 supplied_libname=
24893
34b357ffb87e Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 24889
diff changeset
1104 sourcebase=
34b357ffb87e Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 24889
diff changeset
1105 m4base=
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1106 pobase=
26646
17ce792d4851 * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 26643
diff changeset
1107 docbase=
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1108 testsbase=
25489
078dc4f32daa 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 25376
diff changeset
1109 auxdir=
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1110 inctests=
30435
e8c5a9d6f576 New option --with-obsolete.
Bruno Haible <bruno@clisp.org>
parents: 30434
diff changeset
1111 incobsolete=
32771
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1112 inc_cxx_tests=
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1113 inc_longrunning_tests=
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1114 inc_privileged_tests=
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1115 inc_unportable_tests=
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1116 inc_all_tests=
32954
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1117 excl_cxx_tests=
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1118 excl_longrunning_tests=
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1119 excl_privileged_tests=
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1120 excl_unportable_tests=
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
1121 single_configure=false
25672
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
1122 avoidlist=
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
1123 cond_dependencies=
25672
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
1124 lgpl=
38408
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
1125 gnu_make=false
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
1126 makefile_name=
24889
359ba837e33f Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 24408
diff changeset
1127 libtool=
25867
88c19369f481 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 25866
diff changeset
1128 macro_prefix=
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1129 po_domain=
34585
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
1130 witness_c_macro=
29501
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
1131 vc_files=
25937
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
1132 doit=:
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1133 copymode=
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1134 lcopymode=
28787
34d74d564f68 New gnulib-tool option --more-symlinks.
Bruno Haible <bruno@clisp.org>
parents: 28781
diff changeset
1135 do_copyrights=true
24893
34b357ffb87e Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 24889
diff changeset
1136
34b357ffb87e Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 24889
diff changeset
1137 supplied_opts="$@"
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1138
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1139 while test $# -gt 0; do
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1140 case "$1" in
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1141 --list | --lis )
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1142 mode=list
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1143 shift ;;
32567
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
1144 --find | --fin | --fi | --f )
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
1145 mode=find
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
1146 shift ;;
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1147 --import | --impor | --impo | --imp | --im | --i )
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1148 mode=import
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1149 shift ;;
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
1150 --add-import | --add-impor | --add-impo | --add-imp | --add-im | --add-i | --add- | --add | --ad )
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
1151 mode=add-import
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
1152 shift ;;
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
1153 --remove-import | --remove-impor | --remove-impo | --remove-imp | --remove-im | --remove-i | --remove- | --remove | --remov | --remo | --rem | --re | --r )
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
1154 mode=remove-import
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
1155 shift ;;
26134
6c0e449aa51e Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 26116
diff changeset
1156 --update | --updat | --upda | --upd | --up | --u )
6c0e449aa51e Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 26116
diff changeset
1157 mode=update
6c0e449aa51e Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 26116
diff changeset
1158 shift ;;
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1159 --create-testdir | --create-testdi | --create-testd | --create-test | --create-tes | --create-te | --create-t )
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1160 mode=create-testdir
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1161 shift ;;
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1162 --create-megatestdir | --create-megatestdi | --create-megatestd | --create-megatest | --create-megates | --create-megate | --create-megat | --create-mega | --create-meg | --create-me | --create-m )
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1163 mode=create-megatestdir
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1164 shift ;;
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1165 --test | --tes | --te | --t )
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1166 mode=test
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1167 shift ;;
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1168 --megatest | --megates | --megate | --megat | --mega | --meg | --me | --m )
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1169 mode=megatest
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1170 shift ;;
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1171 --extract-* )
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
1172 mode=`echo "X$1" | sed -e 's/^X--//'`
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1173 shift ;;
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
1174 --copy-file | --copy-fil | --copy-fi | --copy-f | --copy- | --copy | --cop )
31152
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
1175 mode=copy-file
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
1176 shift ;;
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1177 --dir )
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1178 shift
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1179 if test $# = 0; then
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1180 func_fatal_error "missing argument for --dir"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1181 fi
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1182 destdir=$1
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1183 shift ;;
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1184 --dir=* )
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
1185 destdir=`echo "X$1" | sed -e 's/^X--dir=//'`
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1186 shift ;;
26906
c660fe41b7f6 Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 26905
diff changeset
1187 --local-dir )
c660fe41b7f6 Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 26905
diff changeset
1188 shift
c660fe41b7f6 Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 26905
diff changeset
1189 if test $# = 0; then
c660fe41b7f6 Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 26905
diff changeset
1190 func_fatal_error "missing argument for --local-dir"
c660fe41b7f6 Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 26905
diff changeset
1191 fi
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1192 func_path_prepend local_gnulib_path "$1"
26906
c660fe41b7f6 Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 26905
diff changeset
1193 shift ;;
c660fe41b7f6 Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 26905
diff changeset
1194 --local-dir=* )
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1195 local_dir=`echo "X$1" | sed -e 's/^X--local-dir=//'`
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1196 func_path_prepend local_gnulib_path "$local_dir"
26906
c660fe41b7f6 Reorder some statements.
Bruno Haible <bruno@clisp.org>
parents: 26905
diff changeset
1197 shift ;;
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1198 --cache-modules | --cache-module | --cache-modul | --cache-modu | --cache-mod | --cache-mo | --cache-m | --cache- | --cache | --cach | --cac | --ca )
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1199 modcache=true
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1200 shift ;;
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1201 --no-cache-modules | --no-cache-module | --no-cache-modul | --no-cache-modu | --no-cache-mod | --no-cache-mo | --no-cache-m | --no-cache- | --no-cache | --no-cach | --no-cac | --no-ca )
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1202 modcache=false
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1203 shift ;;
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
1204 --verbose | --verbos | --verbo | --verb )
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
1205 verbose=`expr $verbose + 1`
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
1206 shift ;;
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
1207 --quiet | --quie | --qui | --qu | --q )
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
1208 verbose=`expr $verbose - 1`
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
1209 shift ;;
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1210 --lib )
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1211 shift
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1212 if test $# = 0; then
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1213 func_fatal_error "missing argument for --lib"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1214 fi
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1215 libname=$1
25034
e16b271da962 Untabify.
Bruno Haible <bruno@clisp.org>
parents: 25003
diff changeset
1216 supplied_libname=true
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1217 shift ;;
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1218 --lib=* )
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
1219 libname=`echo "X$1" | sed -e 's/^X--lib=//'`
25034
e16b271da962 Untabify.
Bruno Haible <bruno@clisp.org>
parents: 25003
diff changeset
1220 supplied_libname=true
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1221 shift ;;
24889
359ba837e33f Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 24408
diff changeset
1222 --source-base )
359ba837e33f Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 24408
diff changeset
1223 shift
359ba837e33f Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 24408
diff changeset
1224 if test $# = 0; then
359ba837e33f Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 24408
diff changeset
1225 func_fatal_error "missing argument for --source-base"
359ba837e33f Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 24408
diff changeset
1226 fi
359ba837e33f Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 24408
diff changeset
1227 sourcebase=$1
359ba837e33f Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 24408
diff changeset
1228 shift ;;
359ba837e33f Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 24408
diff changeset
1229 --source-base=* )
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
1230 sourcebase=`echo "X$1" | sed -e 's/^X--source-base=//'`
24889
359ba837e33f Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 24408
diff changeset
1231 shift ;;
359ba837e33f Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 24408
diff changeset
1232 --m4-base )
359ba837e33f Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 24408
diff changeset
1233 shift
359ba837e33f Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 24408
diff changeset
1234 if test $# = 0; then
359ba837e33f Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 24408
diff changeset
1235 func_fatal_error "missing argument for --m4-base"
359ba837e33f Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 24408
diff changeset
1236 fi
359ba837e33f Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 24408
diff changeset
1237 m4base=$1
359ba837e33f Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 24408
diff changeset
1238 shift ;;
359ba837e33f Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 24408
diff changeset
1239 --m4-base=* )
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
1240 m4base=`echo "X$1" | sed -e 's/^X--m4-base=//'`
24889
359ba837e33f Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 24408
diff changeset
1241 shift ;;
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1242 --po-base )
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1243 shift
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1244 if test $# = 0; then
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1245 func_fatal_error "missing argument for --po-base"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1246 fi
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1247 pobase=$1
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1248 shift ;;
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1249 --po-base=* )
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1250 pobase=`echo "X$1" | sed -e 's/^X--po-base=//'`
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1251 shift ;;
26646
17ce792d4851 * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 26643
diff changeset
1252 --doc-base )
17ce792d4851 * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 26643
diff changeset
1253 shift
17ce792d4851 * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 26643
diff changeset
1254 if test $# = 0; then
17ce792d4851 * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 26643
diff changeset
1255 func_fatal_error "missing argument for --doc-base"
17ce792d4851 * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 26643
diff changeset
1256 fi
17ce792d4851 * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 26643
diff changeset
1257 docbase=$1
17ce792d4851 * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 26643
diff changeset
1258 shift ;;
17ce792d4851 * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 26643
diff changeset
1259 --doc-base=* )
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
1260 docbase=`echo "X$1" | sed -e 's/^X--doc-base=//'`
26646
17ce792d4851 * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 26643
diff changeset
1261 shift ;;
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1262 --tests-base )
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1263 shift
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1264 if test $# = 0; then
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1265 func_fatal_error "missing argument for --tests-base"
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1266 fi
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1267 testsbase=$1
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1268 shift ;;
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1269 --tests-base=* )
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
1270 testsbase=`echo "X$1" | sed -e 's/^X--tests-base=//'`
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1271 shift ;;
25489
078dc4f32daa 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 25376
diff changeset
1272 --aux-dir )
078dc4f32daa 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 25376
diff changeset
1273 shift
078dc4f32daa 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 25376
diff changeset
1274 if test $# = 0; then
078dc4f32daa 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 25376
diff changeset
1275 func_fatal_error "missing argument for --aux-dir"
078dc4f32daa 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 25376
diff changeset
1276 fi
078dc4f32daa 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 25376
diff changeset
1277 auxdir=$1
078dc4f32daa 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 25376
diff changeset
1278 shift ;;
078dc4f32daa 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 25376
diff changeset
1279 --aux-dir=* )
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
1280 auxdir=`echo "X$1" | sed -e 's/^X--aux-dir=//'`
25489
078dc4f32daa 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 25376
diff changeset
1281 shift ;;
32771
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1282 --with-tests | --with-test | --with-tes | --with-te | --with-t)
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1283 inctests=true
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1284 shift ;;
32771
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1285 --with-obsolete | --with-obsolet | --with-obsole | --with-obsol | --with-obso | --with-obs | --with-ob | --with-o)
30435
e8c5a9d6f576 New option --with-obsolete.
Bruno Haible <bruno@clisp.org>
parents: 30434
diff changeset
1286 incobsolete=true
e8c5a9d6f576 New option --with-obsolete.
Bruno Haible <bruno@clisp.org>
parents: 30434
diff changeset
1287 shift ;;
32771
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1288 --with-c++-tests | --with-c++-test | --with-c++-tes | --with-c++-te | --with-c++-t | --with-c++- | --with-c++ | --with-c+ | --with-c)
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1289 inc_cxx_tests=true
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1290 shift ;;
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1291 --with-longrunning-tests | --with-longrunning-test | --with-longrunning-tes | --with-longrunning-te | --with-longrunning-t | --with-longrunning- | --with-longrunning | --with-longrunnin | --with-longrunni | --with-longrunn | --with-longrun | --with-longru | --with-longr | --with-long | --with-lon | --with-lo | --with-l)
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1292 inc_longrunning_tests=true
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1293 shift ;;
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1294 --with-privileged-tests | --with-privileged-test | --with-privileged-tes | --with-privileged-te | --with-privileged-t | --with-privileged- | --with-privileged | --with-privilege | --with-privileg | --with-privile | --with-privil | --with-privi | --with-priv | --with-pri | --with-pr | --with-p)
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1295 inc_privileged_tests=true
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1296 shift ;;
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1297 --with-unportable-tests | --with-unportable-test | --with-unportable-tes | --with-unportable-te | --with-unportable-t | --with-unportable- | --with-unportable | --with-unportabl | --with-unportab | --with-unporta | --with-unport | --with-unpor | --with-unpo | --with-unp | --with-un | --with-u)
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1298 inc_unportable_tests=true
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1299 shift ;;
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1300 --with-all-tests | --with-all-test | --with-all-tes | --with-all-te | --with-all-t | --with-all- | --with-all | --with-al | --with-a)
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1301 inc_all_tests=true
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1302 shift ;;
36622
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
1303 --without-tests | --without-test | --without-tes | --without-te | --without-t)
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
1304 inctests=false
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
1305 shift ;;
32954
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1306 --without-c++-tests | --without-c++-test | --without-c++-tes | --without-c++-te | --without-c++-t | --without-c++- | --without-c++ | --without-c+ | --without-c)
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1307 excl_cxx_tests=true
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1308 shift ;;
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1309 --without-longrunning-tests | --without-longrunning-test | --without-longrunning-tes | --without-longrunning-te | --without-longrunning-t | --without-longrunning- | --without-longrunning | --without-longrunnin | --without-longrunni | --without-longrunn | --without-longrun | --without-longru | --without-longr | --without-long | --without-lon | --without-lo | --without-l)
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1310 excl_longrunning_tests=true
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1311 shift ;;
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1312 --without-privileged-tests | --without-privileged-test | --without-privileged-tes | --without-privileged-te | --without-privileged-t | --without-privileged- | --without-privileged | --without-privilege | --without-privileg | --without-privile | --without-privil | --without-privi | --without-priv | --without-pri | --without-pr | --without-p)
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1313 excl_privileged_tests=true
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1314 shift ;;
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1315 --without-unportable-tests | --without-unportable-test | --without-unportable-tes | --without-unportable-te | --without-unportable-t | --without-unportable- | --without-unportable | --without-unportabl | --without-unportab | --without-unporta | --without-unport | --without-unpor | --without-unpo | --without-unp | --without-un | --without-u)
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1316 excl_unportable_tests=true
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1317 shift ;;
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
1318 --single-configure | --single-configur | --single-configu | --single-config | --single-confi | --single-conf | --single-con | --single-con | --single-co | --single-c | --single- | --single | --singl | --sing | --sin | --si)
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
1319 single_configure=true
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
1320 shift ;;
25672
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
1321 --avoid )
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
1322 shift
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
1323 if test $# = 0; then
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
1324 func_fatal_error "missing argument for --avoid"
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
1325 fi
27014
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
1326 func_append avoidlist " $1"
25672
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
1327 shift ;;
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
1328 --avoid=* )
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
1329 arg=`echo "X$1" | sed -e 's/^X--avoid=//'`
27018
b8a84e698e9b * gnulib-tool (avoidlist): Fix typo that broke options like
Paul Eggert <eggert@cs.ucla.edu>
parents: 27017
diff changeset
1330 func_append avoidlist " $arg"
24889
359ba837e33f Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 24408
diff changeset
1331 shift ;;
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
1332 --conditional-dependencies | --conditional-dependencie | --conditional-dependenci | --conditional-dependenc | --conditional-dependen | --conditional-depende | --conditional-depend | --conditional-depen | --conditional-depe | --conditional-dep | --conditional-de | --conditional-d | --conditional- | --conditional | --conditiona | --condition | --conditio | --conditi | --condit | --condi | --cond | --con)
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
1333 cond_dependencies=true
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
1334 shift ;;
34524
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
1335 --no-conditional-dependencies | --no-conditional-dependencie | --no-conditional-dependenci | --no-conditional-dependenc | --no-conditional-dependen | --no-conditional-depende | --no-conditional-depend | --no-conditional-depen | --no-conditional-depe | --no-conditional-dep | --no-conditional-de | --no-conditional-d | --no-conditional- | --no-conditional | --no-conditiona | --no-condition | --no-conditio | --no-conditi | --no-condit | --no-condi | --no-cond | --no-con | --no-co)
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
1336 cond_dependencies=false
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
1337 shift ;;
24953
9f70d7b69887 New parameter --lgpl, to asseert that modules are
Paul Eggert <eggert@cs.ucla.edu>
parents: 24946
diff changeset
1338 --lgpl )
29108
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
1339 lgpl=yes
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
1340 shift ;;
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
1341 --lgpl=* )
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
1342 arg=`echo "X$1" | sed -e 's/^X--lgpl=//'`
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
1343 case "$arg" in
38181
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
1344 2 | 3orGPLv2 | 3) ;;
29108
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
1345 *) func_fatal_error "invalid LGPL version number for --lgpl" ;;
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
1346 esac
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
1347 lgpl=$arg
24953
9f70d7b69887 New parameter --lgpl, to asseert that modules are
Paul Eggert <eggert@cs.ucla.edu>
parents: 24946
diff changeset
1348 shift ;;
38408
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
1349 --gnu-make )
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
1350 gnu_make=true
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
1351 shift ;;
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
1352 --makefile-name )
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
1353 shift
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
1354 if test $# = 0; then
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
1355 func_fatal_error "missing argument for --makefile-name"
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
1356 fi
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
1357 makefile_name="$1"
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
1358 shift ;;
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
1359 --makefile-name=* )
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
1360 makefile_name=`echo "X$1" | sed -e 's/^X--makefile-name=//'`
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
1361 shift ;;
25672
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
1362 --libtool )
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
1363 libtool=true
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
1364 shift ;;
26768
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
1365 --no-libtool )
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
1366 libtool=false
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
1367 shift ;;
25867
88c19369f481 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 25866
diff changeset
1368 --macro-prefix )
88c19369f481 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 25866
diff changeset
1369 shift
88c19369f481 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 25866
diff changeset
1370 if test $# = 0; then
88c19369f481 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 25866
diff changeset
1371 func_fatal_error "missing argument for --macro-prefix"
88c19369f481 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 25866
diff changeset
1372 fi
88c19369f481 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 25866
diff changeset
1373 macro_prefix="$1"
88c19369f481 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 25866
diff changeset
1374 shift ;;
88c19369f481 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 25866
diff changeset
1375 --macro-prefix=* )
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
1376 macro_prefix=`echo "X$1" | sed -e 's/^X--macro-prefix=//'`
25867
88c19369f481 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 25866
diff changeset
1377 shift ;;
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1378 --po-domain )
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1379 shift
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1380 if test $# = 0; then
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1381 func_fatal_error "missing argument for --po-domain"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1382 fi
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1383 po_domain="$1"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1384 shift ;;
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1385 --po-domain=* )
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1386 po_domain=`echo "X$1" | sed -e 's/^X--po-domain=//'`
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1387 shift ;;
34585
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
1388 --witness-c-macro )
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
1389 shift
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
1390 if test $# = 0; then
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
1391 func_fatal_error "missing argument for --witness-c-macro"
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
1392 fi
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
1393 witness_c_macro="$1"
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
1394 shift ;;
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
1395 --witness-c-macro=* )
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
1396 witness_c_macro=`echo "X$1" | sed -e 's/^X--witness-c-macro=//'`
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
1397 shift ;;
29501
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
1398 --vc-files )
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
1399 vc_files=true
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
1400 shift ;;
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
1401 --no-vc-files )
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
1402 vc_files=false
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
1403 shift ;;
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
1404 --no-changelog | --no-changelo | --no-changel | --no-change | --no-chang | --no-chan | --no-cha | --no-ch )
36756
3c46d35e88a9 gnulib-tool: Remove no-op option --no-changelog.
Bruno Haible <bruno@clisp.org>
parents: 36738
diff changeset
1405 # A no-op for backward compatibility.
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1406 shift ;;
24893
34b357ffb87e Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 24889
diff changeset
1407 --dry-run )
25937
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
1408 doit=false
24893
34b357ffb87e Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 24889
diff changeset
1409 shift ;;
26134
6c0e449aa51e Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 26116
diff changeset
1410 -s | --symbolic | --symboli | --symbol | --symbo | --symb | --symlink | --symlin | --symli | --syml | --sym | --sy )
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1411 copymode=symlink
25489
078dc4f32daa 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 25376
diff changeset
1412 shift ;;
27334
4c79ad403923 New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 27333
diff changeset
1413 --local-symlink | --local-symlin | --local-symli | --local-syml | --local-sym | --local-sy | --local-s )
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1414 lcopymode=symlink
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1415 shift ;;
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1416 -h | --hardlink | --hardlin | --hardli | --hardl | --hard | --har | --ha )
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1417 copymode=hardlink
27334
4c79ad403923 New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 27333
diff changeset
1418 shift ;;
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1419 --local-hardlink | --local-hardlin | --local-hardli | --local-hardl | --local-hard | --local-har | --local-ha | --local-h )
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1420 lcopymode=hardlink
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1421 shift ;;
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1422 -S | --more-symlinks | --more-symlink | --more-symlin | --more-symli | --more-syml | --more-sym | --more-sy | --more-s )
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1423 copymode=symlink
28787
34d74d564f68 New gnulib-tool option --more-symlinks.
Bruno Haible <bruno@clisp.org>
parents: 28781
diff changeset
1424 do_copyrights=
34d74d564f68 New gnulib-tool option --more-symlinks.
Bruno Haible <bruno@clisp.org>
parents: 28781
diff changeset
1425 shift ;;
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1426 -H | --more-hardlinks | --more-hardlink | --more-hardlin | --more-hardli | --more-hardl | --more-hard | --more-har | --more-ha | --more-h )
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1427 copymode=hardlink
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1428 do_copyrights=
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1429 shift ;;
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
1430 --help | --hel | --he )
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1431 func_usage
27023
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
1432 func_exit $? ;;
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
1433 --version | --versio | --versi | --vers )
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1434 func_version
27023
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
1435 func_exit $? ;;
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1436 -- )
25955
3f89c40b0ce2 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 25954
diff changeset
1437 # Stop option processing
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1438 shift
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1439 break ;;
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1440 -* )
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1441 echo "gnulib-tool: unknown option $1" 1>&2
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1442 echo "Try 'gnulib-tool --help' for more information." 1>&2
27023
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
1443 func_exit 1 ;;
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1444 * )
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1445 break ;;
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1446 esac
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1447 done
25955
3f89c40b0ce2 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 25954
diff changeset
1448
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
1449 if case "$mode" in import | add-import | remove-import) true;; *) false;; esac; then
32954
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1450 if test -n "$excl_cxx_tests" || test -n "$excl_longrunning_tests" \
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
1451 || test -n "$excl_privileged_tests" || test -n "$excl_unportable_tests" \
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
1452 || test "$single_configure" != false; then
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
1453 echo "gnulib-tool: invalid options for '$mode' mode" 1>&2
32954
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1454 echo "Try 'gnulib-tool --help' for more information." 1>&2
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1455 func_exit 1
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1456 fi
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1457 fi
26134
6c0e449aa51e Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 26116
diff changeset
1458 if test "$mode" = update; then
6c0e449aa51e Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 26116
diff changeset
1459 if test $# != 0; then
6c0e449aa51e Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 26116
diff changeset
1460 echo "gnulib-tool: too many arguments in 'update' mode" 1>&2
6c0e449aa51e Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 26116
diff changeset
1461 echo "Try 'gnulib-tool --help' for more information." 1>&2
6c0e449aa51e Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 26116
diff changeset
1462 echo "If you really want to modify the gnulib configuration of your project," 1>&2
6c0e449aa51e Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 26116
diff changeset
1463 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
27023
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
1464 func_exit 1
26134
6c0e449aa51e Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 26116
diff changeset
1465 fi
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1466 if test -n "$local_gnulib_path" || test -n "$supplied_libname" \
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1467 || test -n "$sourcebase" || test -n "$m4base" || test -n "$pobase" \
26684
914db7270e3a Reorder tests in doc-base patch.
Bruno Haible <bruno@clisp.org>
parents: 26657
diff changeset
1468 || test -n "$docbase" || test -n "$testsbase" || test -n "$auxdir" \
30435
e8c5a9d6f576 New option --with-obsolete.
Bruno Haible <bruno@clisp.org>
parents: 30434
diff changeset
1469 || test -n "$inctests" || test -n "$incobsolete" \
32771
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1470 || test -n "$inc_cxx_tests" || test -n "$inc_longrunning_tests" \
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1471 || test -n "$inc_privileged_tests" || test -n "$inc_unportable_tests" \
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
1472 || test -n "$inc_all_tests" \
32954
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1473 || test -n "$excl_cxx_tests" || test -n "$excl_longrunning_tests" \
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
1474 || test -n "$excl_privileged_tests" || test -n "$excl_unportable_tests" \
30435
e8c5a9d6f576 New option --with-obsolete.
Bruno Haible <bruno@clisp.org>
parents: 30434
diff changeset
1475 || test -n "$avoidlist" || test -n "$lgpl" || test -n "$makefile_name" \
e8c5a9d6f576 New option --with-obsolete.
Bruno Haible <bruno@clisp.org>
parents: 30434
diff changeset
1476 || test -n "$macro_prefix" || test -n "$po_domain" \
34585
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
1477 || test -n "$witness_c_macro" || test -n "$vc_files"; then
26134
6c0e449aa51e Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 26116
diff changeset
1478 echo "gnulib-tool: invalid options for 'update' mode" 1>&2
6c0e449aa51e Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 26116
diff changeset
1479 echo "Try 'gnulib-tool --help' for more information." 1>&2
6c0e449aa51e Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 26116
diff changeset
1480 echo "If you really want to modify the gnulib configuration of your project," 1>&2
6c0e449aa51e Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 26116
diff changeset
1481 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
27023
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
1482 func_exit 1
26134
6c0e449aa51e Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 26116
diff changeset
1483 fi
6c0e449aa51e Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 26116
diff changeset
1484 fi
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1485 if test -n "$pobase" && test -z "$po_domain"; then
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1486 echo "gnulib-tool: together with --po-base, you need to specify --po-domain" 1>&2
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1487 echo "Try 'gnulib-tool --help' for more information." 1>&2
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1488 func_exit 1
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1489 fi
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1490 if test -z "$pobase" && test -n "$po_domain"; then
32510
bd082c7777d7 gnulib-tool: Make warning diagnostics consistent.
Bruno Haible <bruno@clisp.org>
parents: 32466
diff changeset
1491 func_warning "--po-domain has no effect without a --po-base option"
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1492 fi
36622
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
1493 # Canonicalize the inctests variable.
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
1494 case "$mode" in
36695
fb2d43f9b5ff gnulib-tool: Fix handling of inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36623
diff changeset
1495 import | add-import | remove-import | update)
36622
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
1496 if test -z "$inctests"; then
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
1497 inctests=false
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
1498 fi
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
1499 ;;
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
1500 create-testdir | create-megatestdir | test | megatest)
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
1501 if test -z "$inctests"; then
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
1502 inctests=true
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
1503 fi
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
1504 ;;
3774b571d060 gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
Bruno Haible <bruno@clisp.org>
parents: 36616
diff changeset
1505 esac
36623
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
1506 # Now the only possible values of "$inctests" are true and false
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
1507 # (or blank but then it is irrelevant).
26134
6c0e449aa51e Implement the --update option.
Bruno Haible <bruno@clisp.org>
parents: 26116
diff changeset
1508
26762
646faf35c326 Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 26761
diff changeset
1509 # Determine the minimum supported autoconf version from the project's
646faf35c326 Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 26761
diff changeset
1510 # configure.ac.
26685
c53bd2f2f3a1 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 26684
diff changeset
1511 DEFAULT_AUTOCONF_MINVERSION="2.59"
26769
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1512 autoconf_minversion=
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1513 configure_ac=
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
1514 if case "$mode" in import | add-import | remove-import | update) true;; *) false;; esac \
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
1515 && test -n "$destdir"; then
26769
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1516 if test -f "$destdir"/configure.ac; then
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1517 configure_ac="$destdir/configure.ac"
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1518 else
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1519 if test -f "$destdir"/configure.in; then
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1520 configure_ac="$destdir/configure.in"
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1521 fi
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1522 fi
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1523 else
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1524 if test -f configure.ac; then
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1525 configure_ac="configure.ac"
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1526 else
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1527 if test -f configure.in; then
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1528 configure_ac="configure.in"
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1529 fi
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1530 fi
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1531 fi
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1532 if test -n "$configure_ac"; then
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1533 # Use sed, not autoconf --trace, to look for the AC_PREREQ invocation,
33327
445a26f3384a gnulib-tool: Don't talk about CVS any more.
Bruno Haible <bruno@clisp.org>
parents: 33325
diff changeset
1534 # because when some m4 files are omitted from a version control repository,
26769
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1535 # "autoconf --trace=AC_PREREQ" fails with an error message like this:
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1536 # m4: aclocal.m4:851: Cannot open m4/absolute-header.m4: No such file or directory
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1537 # autom4te: m4 failed with exit status: 1
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1538 prereqs=
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1539 my_sed_traces='
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1540 s,#.*$,,
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1541 s,^dnl .*$,,
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1542 s, dnl .*$,,
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1543 /AC_PREREQ/ {
27458
3d5d7fa25e57 * gnulib-tool (SORT): Remove, since we no longer assume GNU sort.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27445
diff changeset
1544 s,^.*AC_PREREQ([[ ]*\([^])]*\).*$,\1,p
26769
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1545 }'
27458
3d5d7fa25e57 * gnulib-tool (SORT): Remove, since we no longer assume GNU sort.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27445
diff changeset
1546 prereqs=`sed -n -e "$my_sed_traces" < "$configure_ac"`
26769
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1547 if test -n "$prereqs"; then
27458
3d5d7fa25e57 * gnulib-tool (SORT): Remove, since we no longer assume GNU sort.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27445
diff changeset
1548 autoconf_minversion=`
3d5d7fa25e57 * gnulib-tool (SORT): Remove, since we no longer assume GNU sort.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27445
diff changeset
1549 for version in $prereqs; do echo $version; done |
32108
5419be2f034e Use sed with option -e.
Bruno Haible <bruno@clisp.org>
parents: 32001
diff changeset
1550 LC_ALL=C sort -nru | sed -e 1q
27458
3d5d7fa25e57 * gnulib-tool (SORT): Remove, since we no longer assume GNU sort.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27445
diff changeset
1551 `
26769
b0baacb93d0f Improve autoconf_minversion detection.
Bruno Haible <bruno@clisp.org>
parents: 26768
diff changeset
1552 fi
26762
646faf35c326 Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 26761
diff changeset
1553 fi
646faf35c326 Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 26761
diff changeset
1554 if test -z "$autoconf_minversion"; then
646faf35c326 Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 26761
diff changeset
1555 autoconf_minversion=$DEFAULT_AUTOCONF_MINVERSION
646faf35c326 Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 26761
diff changeset
1556 fi
26685
c53bd2f2f3a1 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 26684
diff changeset
1557 case "$autoconf_minversion" in
c53bd2f2f3a1 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 26684
diff changeset
1558 1.* | 2.[0-4]* | 2.5[0-8]*)
26762
646faf35c326 Remove the --assume-autoconf option.
Bruno Haible <bruno@clisp.org>
parents: 26761
diff changeset
1559 func_fatal_error "minimum supported autoconf version is 2.59. Try adding AC_PREREQ([$DEFAULT_AUTOCONF_MINVERSION]) to your configure.ac." ;;
26685
c53bd2f2f3a1 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 26684
diff changeset
1560 esac
c53bd2f2f3a1 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 26684
diff changeset
1561
25955
3f89c40b0ce2 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 25954
diff changeset
1562 # Remove trailing slashes from the directory names. This is necessary for
3f89c40b0ce2 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 25954
diff changeset
1563 # m4base (to avoid an error in func_import) and optional for the others.
3f89c40b0ce2 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 25954
diff changeset
1564 sed_trimtrailingslashes='s,\([^/]\)//*$,\1,'
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1565 old_local_gnulib_path=$local_gnulib_path
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1566 save_IFS=$IFS
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1567 IFS=:
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1568 local_gnulib_path=
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1569 for dir in $old_local_gnulib_path
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1570 do
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1571 case "$dir" in
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1572 */ ) dir=`echo "$dir" | sed -e "$sed_trimtrailingslashes"` ;;
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1573 esac
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1574 func_path_append local_gnulib_path "$dir"
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1575 done
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1576 IFS=$save_IFS
25955
3f89c40b0ce2 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 25954
diff changeset
1577 case "$sourcebase" in
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
1578 */ ) sourcebase=`echo "$sourcebase" | sed -e "$sed_trimtrailingslashes"` ;;
25955
3f89c40b0ce2 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 25954
diff changeset
1579 esac
3f89c40b0ce2 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 25954
diff changeset
1580 case "$m4base" in
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
1581 */ ) m4base=`echo "$m4base" | sed -e "$sed_trimtrailingslashes"` ;;
25955
3f89c40b0ce2 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 25954
diff changeset
1582 esac
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1583 case "$pobase" in
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1584 */ ) pobase=`echo "$pobase" | sed -e "$sed_trimtrailingslashes"` ;;
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
1585 esac
26646
17ce792d4851 * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 26643
diff changeset
1586 case "$docbase" in
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
1587 */ ) docbase=`echo "$docbase" | sed -e "$sed_trimtrailingslashes"` ;;
26646
17ce792d4851 * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 26643
diff changeset
1588 esac
25955
3f89c40b0ce2 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 25954
diff changeset
1589 case "$testsbase" in
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
1590 */ ) testsbase=`echo "$testsbase" | sed -e "$sed_trimtrailingslashes"` ;;
25955
3f89c40b0ce2 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 25954
diff changeset
1591 esac
3f89c40b0ce2 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 25954
diff changeset
1592 case "$auxdir" in
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
1593 */ ) auxdir=`echo "$auxdir" | sed -e "$sed_trimtrailingslashes"` ;;
25955
3f89c40b0ce2 Ignore trailing slashes in --m4-base value etc.
Bruno Haible <bruno@clisp.org>
parents: 25954
diff changeset
1594 esac
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1595 }
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1596
29484
17fcd480e992 Fix 'gnulib-tool --version' output to work with git.
Eric Blake <ebb9@byu.net>
parents: 29232
diff changeset
1597 func_gnulib_dir
26764
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1598 func_tmpdir
27023
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
1599 trap 'exit_status=$?
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
1600 if test "$signal" != 0; then
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
1601 echo "caught signal $signal" >&2
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
1602 fi
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
1603 rm -rf "$tmp"
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
1604 exit $exit_status' 0
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
1605 for signal in 1 2 3 13 15; do
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
1606 trap '{ signal='$signal'; func_exit 1; }' $signal
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
1607 done
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
1608 signal=0
26764
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1609
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
1610 # Note: The 'eval' silences stderr output in dash.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
1611 if (declare -A x && { x[f/2]='foo'; x[f/3]='bar'; eval test '${x[f/2]}' = foo; }) 2>/dev/null; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
1612 # Zsh 4 and Bash 4 have associative arrays.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
1613 have_associative=true
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
1614 else
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
1615 # For other shells, use 'eval' with computed shell variable names.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
1616 have_associative=false
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
1617 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
1618
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1619 # func_lookup_local_file_cb dir file
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1620 # return true and set func_lookup_local_file_result if the file 'dir/file'
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1621 # exists
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1622 func_lookup_local_file_cb ()
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1623 {
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1624 test -n "$func_lookup_local_file_result" && return 1 # already found?
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1625 test -f "$1/$2" || return 1
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1626 func_lookup_local_file_result=$1/$2
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1627 :
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1628 }
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1629
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1630 # func_lookup_local_file file
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1631 # looks up a file in $local_gnulib_path.
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1632 # Input:
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1633 # - local_gnulib_path from --local-dir
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1634 # Output:
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1635 # - func_lookup_local_file_result name of the file, valid only when the
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1636 # function succeeded.
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1637 func_lookup_local_file ()
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1638 {
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1639 func_lookup_local_file_result=
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1640 func_path_foreach "$local_gnulib_path" func_lookup_local_file_cb %dir% "$1"
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1641 }
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1642
26764
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1643 # func_lookup_file file
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1644 # looks up a file in $local_gnulib_path or $gnulib_dir, or combines it through
26764
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1645 # 'patch'.
26905
51014f869494 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 26904
diff changeset
1646 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1647 # - local_gnulib_path from --local-dir
26764
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1648 # Output:
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1649 # - lookedup_file name of the merged (combined) file
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1650 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1651 func_lookup_file ()
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1652 {
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1653 lkfile="$1"
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1654 if func_lookup_local_file "$lkfile"; then
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1655 lookedup_file=$func_lookup_local_file_result
26764
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1656 lookedup_tmp=
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1657 else
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1658 if test -f "$gnulib_dir/$lkfile"; then
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1659 if func_lookup_local_file "$lkfile.diff"; then
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
1660 lkbase=`echo "$lkfile" | sed -e 's,^.*/,,'`
26764
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1661 rm -f "$tmp/$lkbase"
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1662 cp "$gnulib_dir/$lkfile" "$tmp/$lkbase"
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1663 patch -s "$tmp/$lkbase" < "$func_lookup_local_file_result" >&2 \
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1664 || func_fatal_error "patch file $func_lookup_local_file_result didn't apply cleanly"
26764
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1665 lookedup_file="$tmp/$lkbase"
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1666 lookedup_tmp=true
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1667 else
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1668 lookedup_file="$gnulib_dir/$lkfile"
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1669 lookedup_tmp=
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1670 fi
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1671 else
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1672 func_fatal_error "file $gnulib_dir/$lkfile not found"
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1673 fi
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1674 fi
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1675 }
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1676
32567
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
1677 # func_sanitize_modulelist
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
1678 # receives a list of possible module names on standard input, one per line.
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
1679 # It removes those which are just file names unrelated to modules, and outputs
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
1680 # the resulting list to standard output, one per line.
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
1681 func_sanitize_modulelist ()
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
1682 {
37069
ad409ab5c454 Assume gnulib is checked out from Git, not CVS
Stefano Lattarini <stefano.lattarini@gmail.com>
parents: 36960
diff changeset
1683 sed -e '/^ChangeLog$/d' -e '/\/ChangeLog$/d' \
32567
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
1684 -e '/^COPYING$/d' -e '/\/COPYING$/d' \
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
1685 -e '/^README$/d' -e '/\/README$/d' \
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
1686 -e '/^TEMPLATE$/d' \
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
1687 -e '/^TEMPLATE-EXTENDED$/d' \
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
1688 -e '/^TEMPLATE-TESTS$/d' \
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
1689 -e '/^\..*/d' \
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
1690 -e '/~$/d'
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
1691 }
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
1692
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1693
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1694 # func_modules_in_dir dir
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1695 # outputs all module files in dir to standard output.
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1696 func_modules_in_dir ()
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1697 {
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1698 (test -d "$1" && cd "$1" && find modules -type f -print)
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1699 }
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1700
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1701 # func_all_modules
26905
51014f869494 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 26904
diff changeset
1702 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1703 # - local_gnulib_path from --local-dir
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1704 func_all_modules ()
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1705 {
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1706 # Filter out metainformation files like README, which are not modules.
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1707 # Filter out unit test modules; they can be retrieved through
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1708 # --extract-tests-module if desired.
26764
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1709 {
27496
537ce2842b76 Add support for subdirectories of the 'modules/' directory.
Bruno Haible <bruno@clisp.org>
parents: 27479
diff changeset
1710 (cd "$gnulib_dir" && find modules -type f -print | sed -e 's,^modules/,,')
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1711 func_path_foreach "$local_gnulib_path" func_modules_in_dir %dir% | sed -e 's,^modules/,,' -e 's,\.diff$,,'
26764
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
1712 } \
32567
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
1713 | func_sanitize_modulelist \
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
1714 | sed -e '/-tests$/d' \
27010
ad308cf77878 Use "sort -u" where it makes sense.
Bruno Haible <bruno@clisp.org>
parents: 26990
diff changeset
1715 | LC_ALL=C sort -u
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1716 }
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1717
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1718 # func_exists_local_module dir module
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1719 # returns true if module exists in dir
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1720 func_exists_local_module ()
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1721 {
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1722 test -d "$1/modules" && test -f "$1/modules/$2";
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1723 }
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1724
32772
8bb2d1989472 gnulib-tool: Allow 'foo-tests' module even if there is no module 'foo'.
Bruno Haible <bruno@clisp.org>
parents: 32771
diff changeset
1725 # func_exists_module module
8bb2d1989472 gnulib-tool: Allow 'foo-tests' module even if there is no module 'foo'.
Bruno Haible <bruno@clisp.org>
parents: 32771
diff changeset
1726 # tests whether a module, given by name, exists
8bb2d1989472 gnulib-tool: Allow 'foo-tests' module even if there is no module 'foo'.
Bruno Haible <bruno@clisp.org>
parents: 32771
diff changeset
1727 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1728 # - local_gnulib_path from --local-dir
32772
8bb2d1989472 gnulib-tool: Allow 'foo-tests' module even if there is no module 'foo'.
Bruno Haible <bruno@clisp.org>
parents: 32771
diff changeset
1729 func_exists_module ()
8bb2d1989472 gnulib-tool: Allow 'foo-tests' module even if there is no module 'foo'.
Bruno Haible <bruno@clisp.org>
parents: 32771
diff changeset
1730 {
8bb2d1989472 gnulib-tool: Allow 'foo-tests' module even if there is no module 'foo'.
Bruno Haible <bruno@clisp.org>
parents: 32771
diff changeset
1731 { test -f "$gnulib_dir/modules/$1" \
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1732 || func_path_foreach "$local_gnulib_path" func_exists_local_module %dir% "$1" ; } \
32772
8bb2d1989472 gnulib-tool: Allow 'foo-tests' module even if there is no module 'foo'.
Bruno Haible <bruno@clisp.org>
parents: 32771
diff changeset
1733 && test "ChangeLog" != "$1" \
8bb2d1989472 gnulib-tool: Allow 'foo-tests' module even if there is no module 'foo'.
Bruno Haible <bruno@clisp.org>
parents: 32771
diff changeset
1734 && test "COPYING" != "$1" \
8bb2d1989472 gnulib-tool: Allow 'foo-tests' module even if there is no module 'foo'.
Bruno Haible <bruno@clisp.org>
parents: 32771
diff changeset
1735 && test "README" != "$1" \
8bb2d1989472 gnulib-tool: Allow 'foo-tests' module even if there is no module 'foo'.
Bruno Haible <bruno@clisp.org>
parents: 32771
diff changeset
1736 && test "TEMPLATE" != "$1" \
8bb2d1989472 gnulib-tool: Allow 'foo-tests' module even if there is no module 'foo'.
Bruno Haible <bruno@clisp.org>
parents: 32771
diff changeset
1737 && test "TEMPLATE-EXTENDED" != "$1" \
8bb2d1989472 gnulib-tool: Allow 'foo-tests' module even if there is no module 'foo'.
Bruno Haible <bruno@clisp.org>
parents: 32771
diff changeset
1738 && test "TEMPLATE-TESTS" != "$1"
8bb2d1989472 gnulib-tool: Allow 'foo-tests' module even if there is no module 'foo'.
Bruno Haible <bruno@clisp.org>
parents: 32771
diff changeset
1739 }
8bb2d1989472 gnulib-tool: Allow 'foo-tests' module even if there is no module 'foo'.
Bruno Haible <bruno@clisp.org>
parents: 32771
diff changeset
1740
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1741 # func_verify_module
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1742 # verifies a module name
26905
51014f869494 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 26904
diff changeset
1743 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1744 # - local_gnulib_path from --local-dir
26905
51014f869494 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 26904
diff changeset
1745 # - module module name argument
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1746 func_verify_module ()
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1747 {
32772
8bb2d1989472 gnulib-tool: Allow 'foo-tests' module even if there is no module 'foo'.
Bruno Haible <bruno@clisp.org>
parents: 32771
diff changeset
1748 if func_exists_module "$module"; then
26859
c831ece348c5 Make it work also with Solaris /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 26833
diff changeset
1749 # OK, $module is a correct module name.
26903
037500198f6e Better error handling.
Bruno Haible <bruno@clisp.org>
parents: 26890
diff changeset
1750 # Verify that building the module description with 'patch' succeeds.
037500198f6e Better error handling.
Bruno Haible <bruno@clisp.org>
parents: 26890
diff changeset
1751 func_lookup_file "modules/$module"
26859
c831ece348c5 Make it work also with Solaris /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 26833
diff changeset
1752 else
32510
bd082c7777d7 gnulib-tool: Make warning diagnostics consistent.
Bruno Haible <bruno@clisp.org>
parents: 32466
diff changeset
1753 func_warning "module $module doesn't exist"
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1754 module=
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1755 fi
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1756 }
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1757
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1758 # func_verify_nontests_module
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1759 # verifies a module name, excluding tests modules
26905
51014f869494 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 26904
diff changeset
1760 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1761 # - local_gnulib_path from --local-dir
26905
51014f869494 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 26904
diff changeset
1762 # - module module name argument
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1763 func_verify_nontests_module ()
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1764 {
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1765 case "$module" in
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1766 *-tests ) module= ;;
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1767 * ) func_verify_module ;;
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1768 esac
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1769 }
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1770
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1771 # func_verify_tests_module
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1772 # verifies a module name, considering only tests modules
26905
51014f869494 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 26904
diff changeset
1773 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
1774 # - local_gnulib_path from --local-dir
26905
51014f869494 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 26904
diff changeset
1775 # - module module name argument
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1776 func_verify_tests_module ()
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1777 {
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1778 case "$module" in
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1779 *-tests ) func_verify_module ;;
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1780 * ) module= ;;
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1781 esac
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1782 }
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
1783
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1784 # Suffix of a sed expression that extracts a particular field from a
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1785 # module description.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1786 # A field starts with a line that contains a keyword, such as 'Description',
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1787 # followed by a colon and optional whitespace. All following lines, up to
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1788 # the next field (or end of file if there is none) form the contents of the
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1789 # field.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1790 # An absent field is equivalent to a field with empty contents.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1791 # NOTE: Keep this in sync with sed_extract_cache_prog below!
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
1792 sed_extract_prog=':[ ]*$/ {
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
1793 :a
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
1794 n
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
1795 s/^Description:[ ]*$//
32761
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
1796 s/^Comment:[ ]*$//
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
1797 s/^Status:[ ]*$//
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
1798 s/^Notice:[ ]*$//
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
1799 s/^Applicability:[ ]*$//
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
1800 s/^Files:[ ]*$//
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
1801 s/^Depends-on:[ ]*$//
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
1802 s/^configure\.ac-early:[ ]*$//
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
1803 s/^configure\.ac:[ ]*$//
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
1804 s/^Makefile\.am:[ ]*$//
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
1805 s/^Include:[ ]*$//
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
1806 s/^Link:[ ]*$//
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
1807 s/^License:[ ]*$//
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
1808 s/^Maintainer:[ ]*$//
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
1809 tb
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
1810 p
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
1811 ba
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
1812 :b
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
1813 }'
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
1814
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1815 # Piece of a sed expression that converts a field header line to a shell
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1816 # variable name,
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1817 # NOTE: Keep this in sync with sed_extract_prog above!
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1818 sed_extract_field_header='
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1819 s/^Description:[ ]*$/description/
32761
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
1820 s/^Comment:[ ]*$/comment/
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1821 s/^Status:[ ]*$/status/
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1822 s/^Notice:[ ]*$/notice/
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1823 s/^Applicability:[ ]*$/applicability/
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1824 s/^Files:[ ]*$/files/
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1825 s/^Depends-on:[ ]*$/dependson/
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1826 s/^configure\.ac-early:[ ]*$/configureac_early/
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1827 s/^configure\.ac:[ ]*$/configureac/
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1828 s/^Makefile\.am:[ ]*$/makefile/
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1829 s/^Include:[ ]*$/include/
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1830 s/^Link:[ ]*$/link/
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1831 s/^License:[ ]*$/license/
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1832 s/^Maintainer:[ ]*$/maintainer/'
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1833
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1834 if $modcache; then
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1835
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1836 if $have_associative; then
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1837
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1838 # Declare the associative arrays.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1839 declare -A modcache_cached
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1840 sed_to_declare_statement='s|^.*/\([a-zA-Z0-9_]*\)/$|declare -A modcache_\1|p'
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1841 declare_script=`echo "$sed_extract_field_header" | sed -n -e "$sed_to_declare_statement"`
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1842 eval "$declare_script"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1843
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1844 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1845
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1846 # func_cache_var module
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1847 # computes the cache variable name corresponding to $module.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1848 # Note: This computation can map different module names to the same
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1849 # cachevar (such as 'foo-bar', 'foo_bar', or 'foo/bar'); the caller has
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1850 # to protect against this case.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1851 # Output:
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1852 # - cachevar a shell variable name
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1853 if (f=foo; eval echo '${f//o/e}') < /dev/null 2>/dev/null | grep fee >/dev/null; then
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1854 # Bash 2.0 and newer, ksh, and zsh support the syntax
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1855 # ${param//pattern/replacement}
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1856 # as a shorthand for
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1857 # `echo "$param" | sed -e "s/pattern/replacement/g"`.
33351
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
1858 # Note: The 'eval' is necessary for dash and NetBSD /bin/sh.
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
1859 eval 'func_cache_var ()
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1860 {
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1861 cachevar=c_${1//[!a-zA-Z0-9_]/_}
33351
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
1862 }'
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1863 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1864 func_cache_var ()
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1865 {
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1866 case $1 in
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1867 *[!a-zA-Z0-9_]*)
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1868 cachevar=c_`echo "$1" | LC_ALL=C sed -e 's/[^a-zA-Z0-9_]/_/g'` ;;
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1869 *)
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1870 cachevar=c_$1 ;;
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1871 esac
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1872 }
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1873 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1874
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1875 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1876
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1877 # func_init_sed_convert_to_cache_statements
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1878 # Input:
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1879 # - modcachevar_assignment
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1880 # Output:
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1881 # - sed_convert_to_cache_statements
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1882 func_init_sed_convert_to_cache_statements ()
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1883 {
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1884 # 'sed' script that turns a module description into shell script
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1885 # assignments, suitable to be eval'ed. All active characters are escaped.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1886 # This script turns
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1887 # Description:
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1888 # Some module's description
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1889 #
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1890 # Files:
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1891 # lib/file.h
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1892 # into:
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1893 # modcache_description[$1]=\
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1894 # 'Some module'"'"'s description
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1895 # '
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1896 # modcache_files[$1]=\
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1897 # 'lib/file.h'
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1898 # or:
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1899 # c_MODULE_description_set=set; c_MODULE_description=\
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1900 # 'Some module'"'"'s description
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1901 # '
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1902 # c_MODULE_files_set=set; c_MODULE_files=\
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1903 # 'lib/file.h'
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1904 # The script consists of two parts:
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1905 # 1) Ignore the lines before the first field header.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1906 # 2) A loop, treating non-field-header lines by escaping single quotes
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1907 # and adding a closing quote in the last line,
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1908 sed_convert_to_cache_statements="
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1909 :llla
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1910 # Here we have not yet seen a field header.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1911
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1912 # See if the current line contains a field header.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1913 t llla1
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1914 :llla1
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1915 ${sed_extract_field_header}
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1916 t lllb
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1917
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1918 # No field header. Ignore the line.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1919
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1920 # Read the next line. Upon EOF, just exit.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1921 n
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1922 b llla
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1923
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1924 :lllb
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1925 # The current line contains a field header.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1926
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1927 # Turn it into the beginning of an assignment.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1928 s/^\\(.*\\)\$/${modcachevar_assignment}\\\\/
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1929
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1930 # Move it to the hold space. Don't print it yet,
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1931 # because we want no assignment if the field is empty.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1932 h
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1933
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1934 # Read the next line.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1935 # Upon EOF, the field was empty. Print no assignment. Just exit.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1936 n
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1937
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1938 # See if the current line contains a field header.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1939 t lllb1
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1940 :lllb1
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1941 ${sed_extract_field_header}
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1942 # If it is, the previous field was empty. Print no assignment.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1943 t lllb
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1944
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1945 # Not a field header.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1946
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1947 # Print the previous line, held in the hold space.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1948 x
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1949 p
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1950 x
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1951
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1952 # Transform single quotes.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1953 s/'/'\"'\"'/g
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1954
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1955 # Prepend a single quote.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1956 s/^/'/
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1957
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1958 :lllc
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1959
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1960 # Move it to the hold space.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1961 h
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1962
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1963 # Read the next line.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1964 # Upon EOF, branch.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1965 \${
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1966 b llle
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1967 }
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1968 n
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1969
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1970 # See if the current line contains a field header.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1971 t lllc1
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1972 :lllc1
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1973 ${sed_extract_field_header}
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1974 t llld
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1975
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1976 # Print the previous line, held in the hold space.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1977 x
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1978 p
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1979 x
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1980
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1981 # Transform single quotes.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1982 s/'/'\"'\"'/g
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1983
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1984 b lllc
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1985
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1986 :llld
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1987 # A field header.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1988 # Print the previous line, held in the hold space, with a single quote
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1989 # to end the assignment.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1990 x
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1991 s/\$/'/
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1992 p
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1993 x
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1994
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1995 b lllb
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1996
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1997 :llle
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1998 # EOF seen.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
1999 # Print the previous line, held in the hold space, with a single quote
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2000 # to end the assignment.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2001 x
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2002 s/\$/'/
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2003 p
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2004 # Exit.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2005 n
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2006 "
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2007 if ! $sed_comments; then
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2008 # Remove comments.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2009 sed_convert_to_cache_statements=`echo "$sed_convert_to_cache_statements" \
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2010 | sed -e 's/^ *//' -e 's/^#.*//'`
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2011 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2012 }
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2013
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2014 if $have_associative; then
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2015 # sed_convert_to_cache_statements does not depend on the module.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2016 modcachevar_assignment='modcache_\1[$1]='
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2017 func_init_sed_convert_to_cache_statements
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2018 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2019
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2020 # func_cache_lookup_module module
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2021 #
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2022 # looks up a module, like 'func_lookup_file modules/$module', and stores all
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2023 # of its relevant data in a cache in the memory of the processing shell. If
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2024 # already cached, it does not look it up again, thus saving file access time.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2025 # Parameters:
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2026 # - module non-empty string
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2027 # Output if $have_associative:
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2028 # - modcache_cached[$module] set to yes
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2029 # - modcache_description[$module] ==
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2030 # - modcache_status[$module] \ set to the field's value, minus the
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2031 # - ... / final newline,
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2032 # - modcache_maintainer[$module] == or unset if the field's value is empty
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2033 # Output if ! $have_associative:
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2034 # - cachevar a shell variable name
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2035 # - ${cachevar}_cached set to $module
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2036 # - ${cachevar}_description ==
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2037 # - ${cachevar}_status \ set to the field's value, minus the
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2038 # - ... / final newline,
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2039 # - ${cachevar}_maintainer == or unset if the field's value is empty
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2040 # - ${cachevar}_description_set ==
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2041 # - ${cachevar}_status_set \ set to non-empty if the field's value
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2042 # - ... / is non-empty,
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2043 # - ${cachevar}_maintainer_set == or unset if the field's value is empty
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2044 func_cache_lookup_module ()
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2045 {
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2046 if $have_associative; then
33351
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2047 eval 'cached=${modcache_cached[$1]}'
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2048 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2049 func_cache_var "$1"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2050 eval "cached=\"\$${cachevar}_cached\""
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2051 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2052 if test -z "$cached"; then
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2053 # Not found in cache. Look it up on the file system.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2054 func_lookup_file "modules/$1"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2055 if $have_associative; then
33351
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2056 eval 'modcache_cached[$1]=yes'
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2057 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2058 eval "${cachevar}_cached=\"\$1\""
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2059 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2060 if ! $have_associative; then
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2061 # sed_convert_to_cache_statements depends on the module.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2062 modcachevar_assignment="${cachevar}"'_\1_set=set; '"${cachevar}"'_\1='
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2063 func_init_sed_convert_to_cache_statements
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2064 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2065 cache_statements=`LC_ALL=C sed -n -e "$sed_convert_to_cache_statements" < "$lookedup_file"`
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2066 eval "$cache_statements"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2067 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2068 if ! $have_associative; then
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2069 if test "$1" != "$cached"; then
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2070 func_fatal_error "cache variable collision between $1 and $cached"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2071 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2072 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2073 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2074 }
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2075
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2076 fi
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2077
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2078 # func_get_description module
26905
51014f869494 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 26904
diff changeset
2079 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
2080 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2081 # - modcache true or false, from --cache-modules/--no-cache-modules
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2082 func_get_description ()
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2083 {
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2084 if ! $modcache; then
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2085 func_lookup_file "modules/$1"
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2086 sed -n -e "/^Description$sed_extract_prog" < "$lookedup_file"
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2087 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2088 func_cache_lookup_module "$1"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2089 # Output the field's value, including the final newline (if any).
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2090 if $have_associative; then
33351
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2091 if eval 'test -n "${modcache_description[$1]+set}"'; then
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2092 eval 'echo "${modcache_description[$1]}"'
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2093 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2094 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2095 eval "field_set=\"\$${cachevar}_description_set\""
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2096 if test -n "$field_set"; then
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2097 eval "field_value=\"\$${cachevar}_description\""
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2098 echo "${field_value}"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2099 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2100 fi
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2101 fi
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2102 }
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2103
32761
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
2104 # func_get_comment module
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
2105 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
2106 # - local_gnulib_path from --local-dir
32761
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
2107 # - modcache true or false, from --cache-modules/--no-cache-modules
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
2108 func_get_comment ()
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
2109 {
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
2110 if ! $modcache; then
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
2111 func_lookup_file "modules/$1"
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
2112 sed -n -e "/^Comment$sed_extract_prog" < "$lookedup_file"
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
2113 else
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
2114 func_cache_lookup_module "$1"
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
2115 # Output the field's value, including the final newline (if any).
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
2116 if $have_associative; then
33351
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2117 if eval 'test -n "${modcache_comment[$1]+set}"'; then
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2118 eval 'echo "${modcache_comment[$1]}"'
32761
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
2119 fi
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
2120 else
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
2121 eval "field_set=\"\$${cachevar}_comment_set\""
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
2122 if test -n "$field_set"; then
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
2123 eval "field_value=\"\$${cachevar}_comment\""
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
2124 echo "${field_value}"
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
2125 fi
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
2126 fi
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
2127 fi
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
2128 }
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
2129
30434
46e6cd35a028 Modules now have a 'status' attribute.
Bruno Haible <bruno@clisp.org>
parents: 30423
diff changeset
2130 # func_get_status module
46e6cd35a028 Modules now have a 'status' attribute.
Bruno Haible <bruno@clisp.org>
parents: 30423
diff changeset
2131 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
2132 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2133 # - modcache true or false, from --cache-modules/--no-cache-modules
30434
46e6cd35a028 Modules now have a 'status' attribute.
Bruno Haible <bruno@clisp.org>
parents: 30423
diff changeset
2134 func_get_status ()
46e6cd35a028 Modules now have a 'status' attribute.
Bruno Haible <bruno@clisp.org>
parents: 30423
diff changeset
2135 {
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2136 if ! $modcache; then
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2137 func_lookup_file "modules/$1"
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2138 sed -n -e "/^Status$sed_extract_prog" < "$lookedup_file"
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2139 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2140 func_cache_lookup_module "$1"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2141 # Output the field's value, including the final newline (if any).
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2142 if $have_associative; then
33351
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2143 if eval 'test -n "${modcache_status[$1]+set}"'; then
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2144 eval 'echo "${modcache_status[$1]}"'
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2145 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2146 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2147 eval "field_set=\"\$${cachevar}_status_set\""
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2148 if test -n "$field_set"; then
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2149 eval "field_value=\"\$${cachevar}_status\""
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2150 echo "${field_value}"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2151 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2152 fi
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2153 fi
30434
46e6cd35a028 Modules now have a 'status' attribute.
Bruno Haible <bruno@clisp.org>
parents: 30423
diff changeset
2154 }
46e6cd35a028 Modules now have a 'status' attribute.
Bruno Haible <bruno@clisp.org>
parents: 30423
diff changeset
2155
28880
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
2156 # func_get_notice module
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
2157 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
2158 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2159 # - modcache true or false, from --cache-modules/--no-cache-modules
28880
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
2160 func_get_notice ()
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
2161 {
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2162 if ! $modcache; then
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2163 func_lookup_file "modules/$1"
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2164 sed -n -e "/^Notice$sed_extract_prog" < "$lookedup_file"
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2165 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2166 func_cache_lookup_module "$1"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2167 # Output the field's value, including the final newline (if any).
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2168 if $have_associative; then
33351
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2169 if eval 'test -n "${modcache_notice[$1]+set}"'; then
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2170 eval 'echo "${modcache_notice[$1]}"'
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2171 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2172 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2173 eval "field_set=\"\$${cachevar}_notice_set\""
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2174 if test -n "$field_set"; then
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2175 eval "field_value=\"\$${cachevar}_notice\""
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2176 echo "${field_value}"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2177 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2178 fi
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2179 fi
28880
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
2180 }
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
2181
32151
ec3aec36193f New module attribute 'Applicability'.
Bruno Haible <bruno@clisp.org>
parents: 32108
diff changeset
2182 # func_get_applicability module
ec3aec36193f New module attribute 'Applicability'.
Bruno Haible <bruno@clisp.org>
parents: 32108
diff changeset
2183 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
2184 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2185 # - modcache true or false, from --cache-modules/--no-cache-modules
32151
ec3aec36193f New module attribute 'Applicability'.
Bruno Haible <bruno@clisp.org>
parents: 32108
diff changeset
2186 # The expected result (on stdout) is either 'main', or 'tests', or 'all'.
ec3aec36193f New module attribute 'Applicability'.
Bruno Haible <bruno@clisp.org>
parents: 32108
diff changeset
2187 func_get_applicability ()
ec3aec36193f New module attribute 'Applicability'.
Bruno Haible <bruno@clisp.org>
parents: 32108
diff changeset
2188 {
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2189 if ! $modcache; then
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2190 func_lookup_file "modules/$1"
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2191 my_applicability=`sed -n -e "/^Applicability$sed_extract_prog" < "$lookedup_file"`
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2192 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2193 func_cache_lookup_module "$1"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2194 # Get the field's value, without the final newline.
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2195 if $have_associative; then
33351
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2196 eval 'my_applicability="${modcache_applicability[$1]}"'
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2197 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2198 eval "my_applicability=\"\$${cachevar}_applicability\""
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2199 fi
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2200 fi
32545
0bacfb8a6cb1 gnulib-tool: cache module metainformation.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32510
diff changeset
2201 if test -n "$my_applicability"; then
0bacfb8a6cb1 gnulib-tool: cache module metainformation.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32510
diff changeset
2202 echo $my_applicability
0bacfb8a6cb1 gnulib-tool: cache module metainformation.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32510
diff changeset
2203 else
32151
ec3aec36193f New module attribute 'Applicability'.
Bruno Haible <bruno@clisp.org>
parents: 32108
diff changeset
2204 # The default is 'main' or 'tests', depending on the module's name.
32545
0bacfb8a6cb1 gnulib-tool: cache module metainformation.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32510
diff changeset
2205 case $1 in
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2206 *-tests) echo "tests";;
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2207 *) echo "main";;
32151
ec3aec36193f New module attribute 'Applicability'.
Bruno Haible <bruno@clisp.org>
parents: 32108
diff changeset
2208 esac
32545
0bacfb8a6cb1 gnulib-tool: cache module metainformation.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32510
diff changeset
2209 fi
32151
ec3aec36193f New module attribute 'Applicability'.
Bruno Haible <bruno@clisp.org>
parents: 32108
diff changeset
2210 }
ec3aec36193f New module attribute 'Applicability'.
Bruno Haible <bruno@clisp.org>
parents: 32108
diff changeset
2211
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2212 # func_get_filelist module
26905
51014f869494 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 26904
diff changeset
2213 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
2214 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2215 # - modcache true or false, from --cache-modules/--no-cache-modules
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2216 func_get_filelist ()
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2217 {
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2218 if ! $modcache; then
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2219 func_lookup_file "modules/$1"
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2220 sed -n -e "/^Files$sed_extract_prog" < "$lookedup_file"
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2221 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2222 func_cache_lookup_module "$1"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2223 # Output the field's value, including the final newline (if any).
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2224 if $have_associative; then
33351
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2225 if eval 'test -n "${modcache_files[$1]+set}"'; then
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2226 eval 'echo "${modcache_files[$1]}"'
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2227 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2228 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2229 eval "field_set=\"\$${cachevar}_files_set\""
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2230 if test -n "$field_set"; then
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2231 eval "field_value=\"\$${cachevar}_files\""
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2232 echo "${field_value}"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2233 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2234 fi
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2235 fi
30785
f5df0b12691d Backport improved autoconf semantics of AC_DEFUN_ONCE.
Eric Blake <ebb9@byu.net>
parents: 30756
diff changeset
2236 echo m4/00gnulib.m4
27479
7f2aa61d3e5d Back from an automatic module-indicator macro to a module-indicator macro
Bruno Haible <bruno@clisp.org>
parents: 27472
diff changeset
2237 echo m4/gnulib-common.m4
26685
c53bd2f2f3a1 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 26684
diff changeset
2238 case "$autoconf_minversion" in
c53bd2f2f3a1 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 26684
diff changeset
2239 2.59)
29570
9c231eaf6239 Avoid some more autoconf warnings.
Eric Blake <ebb9@byu.net>
parents: 29566
diff changeset
2240 echo m4/onceonly.m4
26685
c53bd2f2f3a1 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 26684
diff changeset
2241 ;;
c53bd2f2f3a1 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 26684
diff changeset
2242 esac
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2243 }
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2244
30680
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2245 # func_filter_filelist outputvar separator filelist prefix suffix removed_prefix removed_suffix [added_prefix [added_suffix]]
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2246 # stores in outputvar the filtered and processed filelist. Filtering: Only the
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2247 # elements starting with prefix and ending with suffix are considered.
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2248 # Processing: removed_prefix and removed_suffix are removed from each element,
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2249 # added_prefix and added_suffix are added to each element.
32434
7d6c9a787547 gnulib-tool: fix filelist for AIX, HP-UX ksh.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32432
diff changeset
2250 # prefix, suffix should not contain shell-special characters.
30728
fd3fea84193c Improve func_remove_prefix, func_remove_suffix.
Bruno Haible <bruno@clisp.org>
parents: 30684
diff changeset
2251 # removed_prefix, removed_suffix should not contain the characters "$`\{}[]^|.
31112
112fd76a32dc Fix comment for func_filter_filelist.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 31095
diff changeset
2252 # added_prefix, added_suffix should not contain the characters \|&.
30680
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2253 func_filter_filelist ()
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2254 {
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2255 if test "$2" != "$nl" \
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2256 || { $fast_func_append \
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2257 && { test -z "$6" || $fast_func_remove_prefix; } \
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2258 && { test -z "$7" || $fast_func_remove_suffix; }; \
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2259 }; then
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2260 ffflist=
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2261 for fff in $3; do
32434
7d6c9a787547 gnulib-tool: fix filelist for AIX, HP-UX ksh.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32432
diff changeset
2262 # Do not quote possibly-empty parameters in case patterns,
7d6c9a787547 gnulib-tool: fix filelist for AIX, HP-UX ksh.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32432
diff changeset
2263 # AIX and HP-UX ksh won't match them if they are empty.
30680
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2264 case "$fff" in
32434
7d6c9a787547 gnulib-tool: fix filelist for AIX, HP-UX ksh.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32432
diff changeset
2265 $4*$5)
30680
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2266 if test -n "$6"; then
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2267 func_remove_prefix fff "$6"
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2268 fi
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2269 if test -n "$7"; then
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2270 func_remove_suffix fff "$7"
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2271 fi
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2272 fff="$8${fff}$9"
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2273 if test -z "$ffflist"; then
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2274 ffflist="${fff}"
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2275 else
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2276 func_append ffflist "$2${fff}"
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2277 fi
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2278 ;;
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2279 esac
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2280 done
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2281 else
30684
ecdda6906d23 gnulib-tool: fix sed-based filtering
Jim Meyering <meyering@redhat.com>
parents: 30680
diff changeset
2282 sed_fff_filter="s|^$6\(.*\)$7\$|$8\\1$9|"
30680
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2283 ffflist=`for fff in $3; do
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2284 case "$fff" in
32434
7d6c9a787547 gnulib-tool: fix filelist for AIX, HP-UX ksh.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32432
diff changeset
2285 $4*$5) echo "$fff" ;;
30680
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2286 esac
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2287 done | sed -e "$sed_fff_filter"`
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2288 fi
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2289 eval "$1=\"\$ffflist\""
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2290 }
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2291
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2292 # func_get_dependencies module
26905
51014f869494 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 26904
diff changeset
2293 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
2294 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2295 # - modcache true or false, from --cache-modules/--no-cache-modules
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2296 func_get_dependencies ()
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2297 {
32772
8bb2d1989472 gnulib-tool: Allow 'foo-tests' module even if there is no module 'foo'.
Bruno Haible <bruno@clisp.org>
parents: 32771
diff changeset
2298 # ${module}-tests implicitly depends on ${module}, if that module exists.
30680
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2299 case "$1" in
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2300 *-tests)
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2301 fgd1="$1"
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2302 func_remove_suffix fgd1 '-tests'
32772
8bb2d1989472 gnulib-tool: Allow 'foo-tests' module even if there is no module 'foo'.
Bruno Haible <bruno@clisp.org>
parents: 32771
diff changeset
2303 if func_exists_module "$fgd1"; then
8bb2d1989472 gnulib-tool: Allow 'foo-tests' module even if there is no module 'foo'.
Bruno Haible <bruno@clisp.org>
parents: 32771
diff changeset
2304 echo "$fgd1"
8bb2d1989472 gnulib-tool: Allow 'foo-tests' module even if there is no module 'foo'.
Bruno Haible <bruno@clisp.org>
parents: 32771
diff changeset
2305 fi
30680
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2306 ;;
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2307 esac
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
2308 # Then the explicit dependencies listed in the module description.
34599
c1d47788b7a4 gnulib-tool: Allow comments in the 'Depends-on' section.
Bruno Haible <bruno@clisp.org>
parents: 34585
diff changeset
2309 { if ! $modcache; then
c1d47788b7a4 gnulib-tool: Allow comments in the 'Depends-on' section.
Bruno Haible <bruno@clisp.org>
parents: 34585
diff changeset
2310 func_lookup_file "modules/$1"
c1d47788b7a4 gnulib-tool: Allow comments in the 'Depends-on' section.
Bruno Haible <bruno@clisp.org>
parents: 34585
diff changeset
2311 sed -n -e "/^Depends-on$sed_extract_prog" < "$lookedup_file"
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2312 else
34599
c1d47788b7a4 gnulib-tool: Allow comments in the 'Depends-on' section.
Bruno Haible <bruno@clisp.org>
parents: 34585
diff changeset
2313 func_cache_lookup_module "$1"
c1d47788b7a4 gnulib-tool: Allow comments in the 'Depends-on' section.
Bruno Haible <bruno@clisp.org>
parents: 34585
diff changeset
2314 # Output the field's value, including the final newline (if any).
c1d47788b7a4 gnulib-tool: Allow comments in the 'Depends-on' section.
Bruno Haible <bruno@clisp.org>
parents: 34585
diff changeset
2315 if $have_associative; then
c1d47788b7a4 gnulib-tool: Allow comments in the 'Depends-on' section.
Bruno Haible <bruno@clisp.org>
parents: 34585
diff changeset
2316 if eval 'test -n "${modcache_dependson[$1]+set}"'; then
c1d47788b7a4 gnulib-tool: Allow comments in the 'Depends-on' section.
Bruno Haible <bruno@clisp.org>
parents: 34585
diff changeset
2317 eval 'echo "${modcache_dependson[$1]}"'
c1d47788b7a4 gnulib-tool: Allow comments in the 'Depends-on' section.
Bruno Haible <bruno@clisp.org>
parents: 34585
diff changeset
2318 fi
c1d47788b7a4 gnulib-tool: Allow comments in the 'Depends-on' section.
Bruno Haible <bruno@clisp.org>
parents: 34585
diff changeset
2319 else
c1d47788b7a4 gnulib-tool: Allow comments in the 'Depends-on' section.
Bruno Haible <bruno@clisp.org>
parents: 34585
diff changeset
2320 eval "field_set=\"\$${cachevar}_dependson_set\""
c1d47788b7a4 gnulib-tool: Allow comments in the 'Depends-on' section.
Bruno Haible <bruno@clisp.org>
parents: 34585
diff changeset
2321 if test -n "$field_set"; then
c1d47788b7a4 gnulib-tool: Allow comments in the 'Depends-on' section.
Bruno Haible <bruno@clisp.org>
parents: 34585
diff changeset
2322 eval "field_value=\"\$${cachevar}_dependson\""
c1d47788b7a4 gnulib-tool: Allow comments in the 'Depends-on' section.
Bruno Haible <bruno@clisp.org>
parents: 34585
diff changeset
2323 echo "${field_value}"
c1d47788b7a4 gnulib-tool: Allow comments in the 'Depends-on' section.
Bruno Haible <bruno@clisp.org>
parents: 34585
diff changeset
2324 fi
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2325 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2326 fi
34599
c1d47788b7a4 gnulib-tool: Allow comments in the 'Depends-on' section.
Bruno Haible <bruno@clisp.org>
parents: 34585
diff changeset
2327 } \
c1d47788b7a4 gnulib-tool: Allow comments in the 'Depends-on' section.
Bruno Haible <bruno@clisp.org>
parents: 34585
diff changeset
2328 | sed -e '/^#/d'
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2329 }
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2330
27770
77fe2b3ddd5c New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 27746
diff changeset
2331 # func_get_autoconf_early_snippet module
77fe2b3ddd5c New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 27746
diff changeset
2332 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
2333 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2334 # - modcache true or false, from --cache-modules/--no-cache-modules
27770
77fe2b3ddd5c New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 27746
diff changeset
2335 func_get_autoconf_early_snippet ()
77fe2b3ddd5c New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 27746
diff changeset
2336 {
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2337 if ! $modcache; then
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2338 func_lookup_file "modules/$1"
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2339 sed -n -e "/^configure\.ac-early$sed_extract_prog" < "$lookedup_file"
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2340 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2341 func_cache_lookup_module "$1"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2342 # Output the field's value, including the final newline (if any).
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2343 if $have_associative; then
33351
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2344 if eval 'test -n "${modcache_configureac_early[$1]+set}"'; then
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2345 eval 'echo "${modcache_configureac_early[$1]}"'
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2346 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2347 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2348 eval "field_set=\"\$${cachevar}_configureac_early_set\""
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2349 if test -n "$field_set"; then
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2350 eval "field_value=\"\$${cachevar}_configureac_early\""
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2351 echo "${field_value}"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2352 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2353 fi
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2354 fi
27770
77fe2b3ddd5c New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 27746
diff changeset
2355 }
77fe2b3ddd5c New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 27746
diff changeset
2356
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2357 # func_get_autoconf_snippet module
26905
51014f869494 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 26904
diff changeset
2358 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
2359 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2360 # - modcache true or false, from --cache-modules/--no-cache-modules
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2361 func_get_autoconf_snippet ()
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2362 {
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2363 if ! $modcache; then
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2364 func_lookup_file "modules/$1"
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2365 sed -n -e "/^configure\.ac$sed_extract_prog" < "$lookedup_file"
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2366 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2367 func_cache_lookup_module "$1"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2368 # Output the field's value, including the final newline (if any).
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2369 if $have_associative; then
33351
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2370 if eval 'test -n "${modcache_configureac[$1]+set}"'; then
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2371 eval 'echo "${modcache_configureac[$1]}"'
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2372 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2373 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2374 eval "field_set=\"\$${cachevar}_configureac_set\""
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2375 if test -n "$field_set"; then
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2376 eval "field_value=\"\$${cachevar}_configureac\""
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2377 echo "${field_value}"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2378 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2379 fi
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2380 fi
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2381 }
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2382
37680
c1257e8693cd gnulib-tool: concatenate lib_SOURCES to a single line
Pádraig Brady <P@draigBrady.com>
parents: 37644
diff changeset
2383 # Concatenate lines with trailing slash.
c1257e8693cd gnulib-tool: concatenate lib_SOURCES to a single line
Pádraig Brady <P@draigBrady.com>
parents: 37644
diff changeset
2384 # $1 is an optional filter to restrict the
c1257e8693cd gnulib-tool: concatenate lib_SOURCES to a single line
Pádraig Brady <P@draigBrady.com>
parents: 37644
diff changeset
2385 # concatenation to groups starting with that expression
c1257e8693cd gnulib-tool: concatenate lib_SOURCES to a single line
Pádraig Brady <P@draigBrady.com>
parents: 37644
diff changeset
2386 combine_lines() {
c1257e8693cd gnulib-tool: concatenate lib_SOURCES to a single line
Pádraig Brady <P@draigBrady.com>
parents: 37644
diff changeset
2387 sed -e "/$1.*"'\\$/{
c1257e8693cd gnulib-tool: concatenate lib_SOURCES to a single line
Pádraig Brady <P@draigBrady.com>
parents: 37644
diff changeset
2388 :a
c1257e8693cd gnulib-tool: concatenate lib_SOURCES to a single line
Pádraig Brady <P@draigBrady.com>
parents: 37644
diff changeset
2389 N
c1257e8693cd gnulib-tool: concatenate lib_SOURCES to a single line
Pádraig Brady <P@draigBrady.com>
parents: 37644
diff changeset
2390 s/\\\n/ /
c1257e8693cd gnulib-tool: concatenate lib_SOURCES to a single line
Pádraig Brady <P@draigBrady.com>
parents: 37644
diff changeset
2391 s/\\$/\\/
c1257e8693cd gnulib-tool: concatenate lib_SOURCES to a single line
Pádraig Brady <P@draigBrady.com>
parents: 37644
diff changeset
2392 ta
c1257e8693cd gnulib-tool: concatenate lib_SOURCES to a single line
Pádraig Brady <P@draigBrady.com>
parents: 37644
diff changeset
2393 }'
c1257e8693cd gnulib-tool: concatenate lib_SOURCES to a single line
Pádraig Brady <P@draigBrady.com>
parents: 37644
diff changeset
2394 }
c1257e8693cd gnulib-tool: concatenate lib_SOURCES to a single line
Pádraig Brady <P@draigBrady.com>
parents: 37644
diff changeset
2395
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2396 # func_get_automake_snippet_conditional module
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2397 # returns the part of the Makefile.am snippet that can be put inside Automake
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2398 # conditionals.
26905
51014f869494 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 26904
diff changeset
2399 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
2400 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2401 # - modcache true or false, from --cache-modules/--no-cache-modules
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2402 func_get_automake_snippet_conditional ()
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2403 {
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2404 if ! $modcache; then
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2405 func_lookup_file "modules/$1"
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2406 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2407 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2408 func_cache_lookup_module "$1"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2409 # Output the field's value, including the final newline (if any).
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2410 if $have_associative; then
33351
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2411 if eval 'test -n "${modcache_makefile[$1]+set}"'; then
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2412 eval 'echo "${modcache_makefile[$1]}"'
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2413 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2414 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2415 eval "field_set=\"\$${cachevar}_makefile_set\""
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2416 if test -n "$field_set"; then
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2417 eval "field_value=\"\$${cachevar}_makefile\""
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2418 echo "${field_value}"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2419 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2420 fi
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2421 fi
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2422 }
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2423
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2424 # func_get_automake_snippet_unconditional module
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2425 # returns the part of the Makefile.am snippet that must stay outside of
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2426 # Automake conditionals.
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2427 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
2428 # - local_gnulib_path from --local-dir
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2429 # - modcache true or false, from --cache-modules/--no-cache-modules
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2430 func_get_automake_snippet_unconditional ()
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2431 {
27188
baeeff786e2e gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 27177
diff changeset
2432 case "$1" in
baeeff786e2e gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 27177
diff changeset
2433 *-tests)
baeeff786e2e gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 27177
diff changeset
2434 # *-tests module live in tests/, not lib/.
28975
0eebc24fa68e Synthesize an EXTRA_DIST augmentation also for tests modules.
Bruno Haible <bruno@clisp.org>
parents: 28966
diff changeset
2435 # Synthesize an EXTRA_DIST augmentation.
0eebc24fa68e Synthesize an EXTRA_DIST augmentation also for tests modules.
Bruno Haible <bruno@clisp.org>
parents: 28966
diff changeset
2436 all_files=`func_get_filelist $1`
30680
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2437 func_filter_filelist tests_files " " "$all_files" 'tests/' '' 'tests/' ''
28975
0eebc24fa68e Synthesize an EXTRA_DIST augmentation also for tests modules.
Bruno Haible <bruno@clisp.org>
parents: 28966
diff changeset
2438 extra_files="$tests_files"
0eebc24fa68e Synthesize an EXTRA_DIST augmentation also for tests modules.
Bruno Haible <bruno@clisp.org>
parents: 28966
diff changeset
2439 if test -n "$extra_files"; then
0eebc24fa68e Synthesize an EXTRA_DIST augmentation also for tests modules.
Bruno Haible <bruno@clisp.org>
parents: 28966
diff changeset
2440 echo "EXTRA_DIST +=" $extra_files
0eebc24fa68e Synthesize an EXTRA_DIST augmentation also for tests modules.
Bruno Haible <bruno@clisp.org>
parents: 28966
diff changeset
2441 echo
0eebc24fa68e Synthesize an EXTRA_DIST augmentation also for tests modules.
Bruno Haible <bruno@clisp.org>
parents: 28966
diff changeset
2442 fi
27188
baeeff786e2e gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 27177
diff changeset
2443 ;;
baeeff786e2e gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 27177
diff changeset
2444 *)
baeeff786e2e gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 27177
diff changeset
2445 # Synthesize an EXTRA_DIST augmentation.
27445
b417e44bbc2b * modules/absolute-header: New module.
Eric Blake <ebb9@byu.net>
parents: 27443
diff changeset
2446 sed_extract_mentioned_files='s/^lib_SOURCES[ ]*+=[ ]*//p'
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2447 already_mentioned_files=` \
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2448 { if ! $modcache; then
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2449 func_lookup_file "modules/$1"
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2450 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2451 else
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2452 func_cache_lookup_module "$1"
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2453 if $have_associative; then
33351
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2454 if eval 'test -n "${modcache_makefile[$1]+set}"'; then
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2455 eval 'echo "${modcache_makefile[$1]}"'
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2456 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2457 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2458 eval 'field_set="$'"${cachevar}"'_makefile_set"'
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2459 if test -n "$field_set"; then
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2460 eval 'field_value="$'"${cachevar}"'_makefile"'
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2461 echo "${field_value}"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2462 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2463 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2464 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2465 } \
37680
c1257e8693cd gnulib-tool: concatenate lib_SOURCES to a single line
Pádraig Brady <P@draigBrady.com>
parents: 37644
diff changeset
2466 | combine_lines \
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2467 | sed -n -e "$sed_extract_mentioned_files" | sed -e 's/#.*//'`
27188
baeeff786e2e gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 27177
diff changeset
2468 all_files=`func_get_filelist $1`
30680
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2469 func_filter_filelist lib_files "$nl" "$all_files" 'lib/' '' 'lib/' ''
27188
baeeff786e2e gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 27177
diff changeset
2470 # Remove $already_mentioned_files from $lib_files.
baeeff786e2e gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 27177
diff changeset
2471 echo "$lib_files" | LC_ALL=C sort -u > "$tmp"/lib-files
32572
f0df2aa3fc0f Really work around around "broken pipe" error message from bash 3.2.
Bruno Haible <bruno@clisp.org>
parents: 32568
diff changeset
2472 extra_files=`for f in $already_mentioned_files; do echo $f; done \
27188
baeeff786e2e gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 27177
diff changeset
2473 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/lib-files`
baeeff786e2e gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 27177
diff changeset
2474 if test -n "$extra_files"; then
baeeff786e2e gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 27177
diff changeset
2475 echo "EXTRA_DIST +=" $extra_files
baeeff786e2e gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 27177
diff changeset
2476 echo
baeeff786e2e gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 27177
diff changeset
2477 fi
27331
5220d90b36c9 Synthesize also an EXTRA_lib_SOURCES augmentation.
Bruno Haible <bruno@clisp.org>
parents: 27329
diff changeset
2478 # Synthesize also an EXTRA_lib_SOURCES augmentation.
5220d90b36c9 Synthesize also an EXTRA_lib_SOURCES augmentation.
Bruno Haible <bruno@clisp.org>
parents: 27329
diff changeset
2479 # This is necessary so that automake can generate the right list of
5220d90b36c9 Synthesize also an EXTRA_lib_SOURCES augmentation.
Bruno Haible <bruno@clisp.org>
parents: 27329
diff changeset
2480 # dependency rules.
5220d90b36c9 Synthesize also an EXTRA_lib_SOURCES augmentation.
Bruno Haible <bruno@clisp.org>
parents: 27329
diff changeset
2481 # A possible approach would be to use autom4te --trace of the redefined
5220d90b36c9 Synthesize also an EXTRA_lib_SOURCES augmentation.
Bruno Haible <bruno@clisp.org>
parents: 27329
diff changeset
2482 # AC_LIBOBJ and AC_REPLACE_FUNCS macros when creating the Makefile.am
5220d90b36c9 Synthesize also an EXTRA_lib_SOURCES augmentation.
Bruno Haible <bruno@clisp.org>
parents: 27329
diff changeset
2483 # (use autom4te --trace, not just grep, so that AC_LIBOBJ invocations
5220d90b36c9 Synthesize also an EXTRA_lib_SOURCES augmentation.
Bruno Haible <bruno@clisp.org>
parents: 27329
diff changeset
2484 # inside autoconf's built-in macros are not missed).
5220d90b36c9 Synthesize also an EXTRA_lib_SOURCES augmentation.
Bruno Haible <bruno@clisp.org>
parents: 27329
diff changeset
2485 # But it's simpler and more robust to do it here, based on the file list.
5220d90b36c9 Synthesize also an EXTRA_lib_SOURCES augmentation.
Bruno Haible <bruno@clisp.org>
parents: 27329
diff changeset
2486 # If some .c file exists and is not used with AC_LIBOBJ - for example,
5220d90b36c9 Synthesize also an EXTRA_lib_SOURCES augmentation.
Bruno Haible <bruno@clisp.org>
parents: 27329
diff changeset
2487 # a .c file is preprocessed into another .c file for BUILT_SOURCES -,
5220d90b36c9 Synthesize also an EXTRA_lib_SOURCES augmentation.
Bruno Haible <bruno@clisp.org>
parents: 27329
diff changeset
2488 # automake will generate a useless dependency; this is harmless.
28047
8621a0a77066 Special handling for the 'relocatable-prog-wrapper' module.
Bruno Haible <bruno@clisp.org>
parents: 27770
diff changeset
2489 case "$1" in
8621a0a77066 Special handling for the 'relocatable-prog-wrapper' module.
Bruno Haible <bruno@clisp.org>
parents: 27770
diff changeset
2490 relocatable-prog-wrapper) ;;
33450
3ab0a5f402a4 gnulib-tool: Fixes for --create-testdir with --libtool.
Bruno Haible <bruno@clisp.org>
parents: 33443
diff changeset
2491 pt_chown) ;;
28047
8621a0a77066 Special handling for the 'relocatable-prog-wrapper' module.
Bruno Haible <bruno@clisp.org>
parents: 27770
diff changeset
2492 *)
30680
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2493 func_filter_filelist extra_files "$nl" "$extra_files" '' '.c' '' ''
28047
8621a0a77066 Special handling for the 'relocatable-prog-wrapper' module.
Bruno Haible <bruno@clisp.org>
parents: 27770
diff changeset
2494 if test -n "$extra_files"; then
8621a0a77066 Special handling for the 'relocatable-prog-wrapper' module.
Bruno Haible <bruno@clisp.org>
parents: 27770
diff changeset
2495 echo "EXTRA_lib_SOURCES +=" $extra_files
8621a0a77066 Special handling for the 'relocatable-prog-wrapper' module.
Bruno Haible <bruno@clisp.org>
parents: 27770
diff changeset
2496 echo
8621a0a77066 Special handling for the 'relocatable-prog-wrapper' module.
Bruno Haible <bruno@clisp.org>
parents: 27770
diff changeset
2497 fi
8621a0a77066 Special handling for the 'relocatable-prog-wrapper' module.
Bruno Haible <bruno@clisp.org>
parents: 27770
diff changeset
2498 ;;
8621a0a77066 Special handling for the 'relocatable-prog-wrapper' module.
Bruno Haible <bruno@clisp.org>
parents: 27770
diff changeset
2499 esac
28798
b22b2cc96a79 Ensure that also files under build-aux/ are distributed.
Bruno Haible <bruno@clisp.org>
parents: 28787
diff changeset
2500 # Synthesize an EXTRA_DIST augmentation also for the files in build-aux/.
30680
108bacccdc2a Speed up gnulib-tool by doing more string processing through shell built-ins.
Bruno Haible <bruno@clisp.org>
parents: 30678
diff changeset
2501 func_filter_filelist buildaux_files "$nl" "$all_files" 'build-aux/' '' 'build-aux/' ''
28798
b22b2cc96a79 Ensure that also files under build-aux/ are distributed.
Bruno Haible <bruno@clisp.org>
parents: 28787
diff changeset
2502 if test -n "$buildaux_files"; then
b22b2cc96a79 Ensure that also files under build-aux/ are distributed.
Bruno Haible <bruno@clisp.org>
parents: 28787
diff changeset
2503 sed_prepend_auxdir='s,^,$(top_srcdir)/'"$auxdir"'/,'
b22b2cc96a79 Ensure that also files under build-aux/ are distributed.
Bruno Haible <bruno@clisp.org>
parents: 28787
diff changeset
2504 echo "EXTRA_DIST += "`echo "$buildaux_files" | sed -e "$sed_prepend_auxdir"`
b22b2cc96a79 Ensure that also files under build-aux/ are distributed.
Bruno Haible <bruno@clisp.org>
parents: 28787
diff changeset
2505 echo
b22b2cc96a79 Ensure that also files under build-aux/ are distributed.
Bruno Haible <bruno@clisp.org>
parents: 28787
diff changeset
2506 fi
27188
baeeff786e2e gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 27177
diff changeset
2507 ;;
baeeff786e2e gnulib-tool now synthesizes the EXTRA_DIST line.
Bruno Haible <bruno@clisp.org>
parents: 27177
diff changeset
2508 esac
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2509 }
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2510
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2511 # func_get_automake_snippet module
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2512 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
2513 # - local_gnulib_path from --local-dir
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2514 # - modcache true or false, from --cache-modules/--no-cache-modules
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2515 func_get_automake_snippet ()
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2516 {
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2517 func_get_automake_snippet_conditional "$1"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2518 func_get_automake_snippet_unconditional "$1"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2519 }
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2520
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2521 # func_get_include_directive module
26905
51014f869494 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 26904
diff changeset
2522 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
2523 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2524 # - modcache true or false, from --cache-modules/--no-cache-modules
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2525 func_get_include_directive ()
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2526 {
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2527 {
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2528 if ! $modcache; then
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2529 func_lookup_file "modules/$1"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2530 sed -n -e "/^Include$sed_extract_prog" < "$lookedup_file"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2531 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2532 func_cache_lookup_module "$1"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2533 # Output the field's value, including the final newline (if any).
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2534 if $have_associative; then
33351
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2535 if eval 'test -n "${modcache_include[$1]+set}"'; then
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2536 eval 'echo "${modcache_include[$1]}"'
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2537 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2538 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2539 eval "field_set=\"\$${cachevar}_include_set\""
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2540 if test -n "$field_set"; then
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2541 eval "field_value=\"\$${cachevar}_include\""
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2542 echo "${field_value}"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2543 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2544 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2545 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2546 } | sed -e 's/^\(["<]\)/#include \1/'
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2547 }
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2548
27746
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
2549 # func_get_link_directive module
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
2550 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
2551 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2552 # - modcache true or false, from --cache-modules/--no-cache-modules
27746
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
2553 func_get_link_directive ()
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
2554 {
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2555 if ! $modcache; then
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2556 func_lookup_file "modules/$1"
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2557 sed -n -e "/^Link$sed_extract_prog" < "$lookedup_file"
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2558 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2559 func_cache_lookup_module "$1"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2560 # Output the field's value, including the final newline (if any).
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2561 if $have_associative; then
33351
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2562 if eval 'test -n "${modcache_link[$1]+set}"'; then
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2563 eval 'echo "${modcache_link[$1]}"'
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2564 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2565 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2566 eval "field_set=\"\$${cachevar}_link_set\""
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2567 if test -n "$field_set"; then
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2568 eval "field_value=\"\$${cachevar}_link\""
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2569 echo "${field_value}"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2570 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2571 fi
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2572 fi
27746
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
2573 }
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
2574
35844
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2575 # func_get_license_raw module
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2576 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
2577 # - local_gnulib_path from --local-dir
35844
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2578 # - modcache true or false, from --cache-modules/--no-cache-modules
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2579 func_get_license_raw ()
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2580 {
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2581 if ! $modcache; then
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2582 func_lookup_file "modules/$1"
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2583 sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2584 else
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2585 func_cache_lookup_module "$1"
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2586 # Output the field's value, including the final newline (if any).
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2587 if $have_associative; then
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2588 if eval 'test -n "${modcache_license[$1]+set}"'; then
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2589 eval 'echo "${modcache_license[$1]}"'
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2590 fi
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2591 else
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2592 eval "field_set=\"\$${cachevar}_license_set\""
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2593 if test -n "$field_set"; then
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2594 eval "field_value=\"\$${cachevar}_license\""
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2595 echo "${field_value}"
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2596 fi
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2597 fi
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2598 fi
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2599 }
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2600
24942
c85b8fccd94e Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 24941
diff changeset
2601 # func_get_license module
26905
51014f869494 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 26904
diff changeset
2602 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
2603 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2604 # - modcache true or false, from --cache-modules/--no-cache-modules
24942
c85b8fccd94e Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 24941
diff changeset
2605 func_get_license ()
c85b8fccd94e Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 24941
diff changeset
2606 {
35844
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2607 # Warn if the License field is missing.
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2608 case "$1" in
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2609 *-tests ) ;;
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2610 * )
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2611 license=`func_get_license_raw "$1"`
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2612 if test -z "$license"; then
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2613 func_warning "module $1 lacks a License"
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2614 fi
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2615 ;;
0b3f3dc2fbf1 gnulib-tool: Verify that the License field is present and non-empty.
Bruno Haible <bruno@clisp.org>
parents: 35813
diff changeset
2616 esac
38154
b214af69f3c8 Avoid gnulib-tool warnings about the dependencies of 'parse-datetime'.
Bruno Haible <bruno@clisp.org>
parents: 38151
diff changeset
2617 case "$1" in
b214af69f3c8 Avoid gnulib-tool warnings about the dependencies of 'parse-datetime'.
Bruno Haible <bruno@clisp.org>
parents: 38151
diff changeset
2618 parse-datetime )
b214af69f3c8 Avoid gnulib-tool warnings about the dependencies of 'parse-datetime'.
Bruno Haible <bruno@clisp.org>
parents: 38151
diff changeset
2619 # These modules are under a weaker license only for the purpose of some
b214af69f3c8 Avoid gnulib-tool warnings about the dependencies of 'parse-datetime'.
Bruno Haible <bruno@clisp.org>
parents: 38151
diff changeset
2620 # users who hand-edit it and don't use gnulib-tool. For the regular
b214af69f3c8 Avoid gnulib-tool warnings about the dependencies of 'parse-datetime'.
Bruno Haible <bruno@clisp.org>
parents: 38151
diff changeset
2621 # gnulib users they are under a stricter license.
b214af69f3c8 Avoid gnulib-tool warnings about the dependencies of 'parse-datetime'.
Bruno Haible <bruno@clisp.org>
parents: 38151
diff changeset
2622 echo "GPL"
b214af69f3c8 Avoid gnulib-tool warnings about the dependencies of 'parse-datetime'.
Bruno Haible <bruno@clisp.org>
parents: 38151
diff changeset
2623 ;;
b214af69f3c8 Avoid gnulib-tool warnings about the dependencies of 'parse-datetime'.
Bruno Haible <bruno@clisp.org>
parents: 38151
diff changeset
2624 * )
b214af69f3c8 Avoid gnulib-tool warnings about the dependencies of 'parse-datetime'.
Bruno Haible <bruno@clisp.org>
parents: 38151
diff changeset
2625 {
b214af69f3c8 Avoid gnulib-tool warnings about the dependencies of 'parse-datetime'.
Bruno Haible <bruno@clisp.org>
parents: 38151
diff changeset
2626 func_get_license_raw "$1"
b214af69f3c8 Avoid gnulib-tool warnings about the dependencies of 'parse-datetime'.
Bruno Haible <bruno@clisp.org>
parents: 38151
diff changeset
2627 # The default is GPL.
b214af69f3c8 Avoid gnulib-tool warnings about the dependencies of 'parse-datetime'.
Bruno Haible <bruno@clisp.org>
parents: 38151
diff changeset
2628 echo "GPL"
b214af69f3c8 Avoid gnulib-tool warnings about the dependencies of 'parse-datetime'.
Bruno Haible <bruno@clisp.org>
parents: 38151
diff changeset
2629 } | sed -e 's,^ *$,,' | sed -e 1q
b214af69f3c8 Avoid gnulib-tool warnings about the dependencies of 'parse-datetime'.
Bruno Haible <bruno@clisp.org>
parents: 38151
diff changeset
2630 ;;
b214af69f3c8 Avoid gnulib-tool warnings about the dependencies of 'parse-datetime'.
Bruno Haible <bruno@clisp.org>
parents: 38151
diff changeset
2631 esac
24942
c85b8fccd94e Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 24941
diff changeset
2632 }
c85b8fccd94e Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 24941
diff changeset
2633
23888
811702529909 Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 23866
diff changeset
2634 # func_get_maintainer module
26905
51014f869494 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 26904
diff changeset
2635 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
2636 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2637 # - modcache true or false, from --cache-modules/--no-cache-modules
23888
811702529909 Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 23866
diff changeset
2638 func_get_maintainer ()
811702529909 Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 23866
diff changeset
2639 {
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2640 if ! $modcache; then
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2641 func_lookup_file "modules/$1"
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2642 sed -n -e "/^Maintainer$sed_extract_prog" < "$lookedup_file"
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2643 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2644 func_cache_lookup_module "$1"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2645 # Output the field's value, including the final newline (if any).
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2646 if $have_associative; then
33351
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2647 if eval 'test -n "${modcache_maintainer[$1]+set}"'; then
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
2648 eval 'echo "${modcache_maintainer[$1]}"'
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2649 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2650 else
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2651 eval "field_set=\"\$${cachevar}_maintainer_set\""
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2652 if test -n "$field_set"; then
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2653 eval "field_value=\"\$${cachevar}_maintainer\""
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2654 echo "${field_value}"
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2655 fi
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2656 fi
32546
80d39608806d gnulib-tool: Make caching optional.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32545
diff changeset
2657 fi
23888
811702529909 Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 23866
diff changeset
2658 }
811702529909 Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 23866
diff changeset
2659
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
2660 # func_get_tests_module module
26905
51014f869494 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 26904
diff changeset
2661 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
2662 # - local_gnulib_path from --local-dir
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
2663 func_get_tests_module ()
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
2664 {
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
2665 # The naming convention for tests modules is hardwired: ${module}-tests.
26905
51014f869494 Small fix after --local-dir introduction.
Bruno Haible <bruno@clisp.org>
parents: 26904
diff changeset
2666 if test -f "$gnulib_dir/modules/$1"-tests \
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
2667 || func_path_foreach "$local_gnulib_path" func_exists_local_module %dir% "$1-tests"; then
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
2668 echo "$1"-tests
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
2669 fi
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
2670 }
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
2671
25672
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
2672 # func_acceptable module
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
2673 # tests whether a module is acceptable.
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
2674 # Input:
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
2675 # - avoidlist list of modules to avoid
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
2676 func_acceptable ()
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
2677 {
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
2678 for avoid in $avoidlist; do
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
2679 if test "$avoid" = "$1"; then
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
2680 return 1
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
2681 fi
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
2682 done
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
2683 return 0
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
2684 }
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
2685
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2686 # sed expression to keep the first 32 characters of each line.
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2687 sed_first_32_chars='s/^\(................................\).*/\1/'
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2688
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2689 # func_module_shellfunc_name module
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2690 # computes the shell function name that will contain the m4 macros for the module.
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2691 # Input:
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2692 # - macro_prefix prefix to use
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2693 # Output:
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2694 # - shellfunc shell function name
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2695 func_module_shellfunc_name ()
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2696 {
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2697 case $1 in
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2698 *[!a-zA-Z0-9_]*)
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2699 shellfunc=func_${macro_prefix}_gnulib_m4code_`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2700 *)
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2701 shellfunc=func_${macro_prefix}_gnulib_m4code_$1 ;;
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2702 esac
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2703 }
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2704
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2705 # func_module_shellvar_name module
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2706 # computes the shell variable name the will be set to true once the m4 macros
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2707 # for the module have been executed.
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2708 # Output:
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2709 # - shellvar shell variable name
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2710 func_module_shellvar_name ()
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2711 {
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2712 case $1 in
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2713 *[!a-zA-Z0-9_]*)
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2714 shellvar=${macro_prefix}_gnulib_enabled_`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2715 *)
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2716 shellvar=${macro_prefix}_gnulib_enabled_$1 ;;
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2717 esac
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2718 }
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2719
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2720 # func_module_conditional_name module
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2721 # computes the automake conditional name for the module.
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2722 # Output:
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2723 # - conditional name of automake conditional
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2724 func_module_conditional_name ()
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2725 {
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2726 case $1 in
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2727 *[!a-zA-Z0-9_]*)
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2728 conditional=${macro_prefix}_GNULIB_ENABLED_`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2729 *)
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2730 conditional=${macro_prefix}_GNULIB_ENABLED_$1 ;;
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2731 esac
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2732 }
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2733
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2734 # func_uncond_add_module B
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2735 # notes the presence of B as an unconditional module.
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2736 #
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2737 # func_conddep_add_module A B cond
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2738 # notes the presence of a conditional dependency from module A to module B,
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2739 # subject to the condition that A is enabled and cond is true.
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2740 #
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2741 # func_cond_module_p B
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2742 # tests whether module B is conditional.
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2743 #
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2744 # func_cond_module_condition A B
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2745 # returns the condition when B should be enabled as a dependency of A, once the
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2746 # m4 code for A has been executed.
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2747 # Output: - condition
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2748 #
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2749 if $have_associative; then
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2750 declare -A conddep_isuncond
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2751 declare -A conddep_dependers
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2752 declare -A conddep_condition
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2753 func_uncond_add_module ()
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2754 {
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2755 eval 'conddep_isuncond[$1]=true'
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2756 eval 'unset conddep_dependers[$1]'
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2757 }
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2758 func_conddep_add_module ()
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2759 {
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2760 eval 'isuncond="${conddep_isuncond[$2]}"'
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2761 if test -z "$isuncond"; then
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2762 # No unconditional dependency to B known at this point.
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2763 eval 'conddep_dependers[$2]="${conddep_dependers[$2]} $1"'
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2764 eval 'conddep_condition[$1---$2]="$3"'
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2765 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2766 }
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2767 func_cond_module_p ()
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2768 {
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2769 eval 'previous_dependers="${conddep_dependers[$1]}"'
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2770 test -n "$previous_dependers"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2771 }
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2772 func_cond_module_condition ()
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2773 {
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2774 eval 'condition="${conddep_condition[$1---$2]}"'
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2775 }
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2776 else
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2777 func_uncond_add_module ()
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2778 {
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2779 case $1 in
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2780 *[!a-zA-Z0-9_]*)
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2781 suffix=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2782 *)
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2783 suffix=$1 ;;
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2784 esac
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2785 eval 'conddep_isuncond_'"$suffix"'=true'
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2786 eval 'unset conddep_dependers_'"$suffix"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2787 }
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2788 func_conddep_add_module ()
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2789 {
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2790 case $2 in
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2791 *[!a-zA-Z0-9_]*)
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2792 suffix=`echo "$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2793 *)
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2794 suffix=$2 ;;
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2795 esac
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2796 eval 'isuncond="${conddep_isuncond_'"$suffix"'}"'
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2797 if test -z "$isuncond"; then
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2798 eval 'conddep_dependers_'"$suffix"'="${conddep_dependers_'"$suffix"'} $1"'
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2799 suffix=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2800 eval 'conddep_condition_'"$suffix"'="$3"'
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2801 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2802 }
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2803 func_cond_module_p ()
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2804 {
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2805 case $1 in
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2806 *[!a-zA-Z0-9_]*)
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2807 suffix=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2808 *)
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2809 suffix=$1 ;;
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2810 esac
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2811 eval 'previous_dependers="${conddep_dependers_'"$suffix"'}"'
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2812 test -n "$previous_dependers"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2813 }
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2814 func_cond_module_condition ()
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2815 {
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2816 suffix=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2817 eval 'condition="${conddep_condition_'"$suffix"'}"'
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2818 }
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2819 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2820
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2821 sed_dependencies_without_conditions='s/ *\[.*//'
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2822
25038
7b235423ca42 Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 25037
diff changeset
2823 # func_modules_transitive_closure
7b235423ca42 Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 25037
diff changeset
2824 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
2825 # - local_gnulib_path from --local-dir
38408
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
2826 # - gnu_make true if --gnu-make was given, false otherwise
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
2827 # - modcache true or false, from --cache-modules/--no-cache-modules
25038
7b235423ca42 Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 25037
diff changeset
2828 # - modules list of specified modules
36623
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
2829 # - inctests true if tests should be included, false otherwise
30435
e8c5a9d6f576 New option --with-obsolete.
Bruno Haible <bruno@clisp.org>
parents: 30434
diff changeset
2830 # - incobsolete true if obsolete modules among dependencies should be
e8c5a9d6f576 New option --with-obsolete.
Bruno Haible <bruno@clisp.org>
parents: 30434
diff changeset
2831 # included, blank otherwise
32771
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
2832 # - inc_cxx_tests true if C++ interoperability tests should be included,
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
2833 # blank otherwise
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
2834 # - inc_longrunning_tests true if long-runnings tests should be included,
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
2835 # blank otherwise
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
2836 # - inc_privileged_tests true if tests that require root privileges should be
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
2837 # included, blank otherwise
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
2838 # - inc_unportable_tests true if tests that fail on some platforms should be
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
2839 # included, blank otherwise
32955
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
2840 # - inc_all_direct_tests true if all kinds of problematic unit tests among
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
2841 # the unit tests of the specified modules should be
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
2842 # included, blank otherwise
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
2843 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
2844 # the unit tests of the dependencies should be
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
2845 # included, blank otherwise
32954
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
2846 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
2847 # blank otherwise
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
2848 # - excl_longrunning_tests true if long-runnings tests should be excluded,
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
2849 # blank otherwise
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
2850 # - excl_privileged_tests true if tests that require root privileges should be
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
2851 # excluded, blank otherwise
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
2852 # - excl_unportable_tests true if tests that fail on some platforms should be
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
2853 # excluded, blank otherwise
25672
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
2854 # - avoidlist list of modules to avoid
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2855 # - cond_dependencies true if conditional dependencies shall be supported,
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2856 # blank otherwise
27011
d51d96d4e903 Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 27010
diff changeset
2857 # - tmp pathname of a temporary directory
25038
7b235423ca42 Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 25037
diff changeset
2858 # Output:
7b235423ca42 Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 25037
diff changeset
2859 # - modules list of modules, including dependencies
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2860 # - conddep_dependers, conddep_condition information about conditionally
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2861 # enabled modules
25038
7b235423ca42 Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 25037
diff changeset
2862 func_modules_transitive_closure ()
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
2863 {
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2864 sed_escape_dependency='s|\([/.]\)|\\\1|g'
27011
d51d96d4e903 Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 27010
diff changeset
2865 # In order to process every module only once (for speed), process an "input
d51d96d4e903 Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 27010
diff changeset
2866 # list" of modules, producing an "output list" of modules. During each round,
d51d96d4e903 Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 27010
diff changeset
2867 # more modules can be queued in the input list. Once a module on the input
d51d96d4e903 Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 27010
diff changeset
2868 # list has been processed, it is added to the "handled list", so we can avoid
d51d96d4e903 Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 27010
diff changeset
2869 # to process it again.
d51d96d4e903 Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 27010
diff changeset
2870 handledmodules=
d51d96d4e903 Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 27010
diff changeset
2871 inmodules="$modules"
d51d96d4e903 Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 27010
diff changeset
2872 outmodules=
32955
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
2873 fmtc_inc_all_tests="$inc_all_direct_tests"
34524
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
2874 if test "$cond_dependencies" = true; then
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2875 for module in $inmodules; do
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2876 func_verify_module
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2877 if test -n "$module"; then
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2878 if func_acceptable $module; then
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2879 func_uncond_add_module $module
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2880 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2881 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2882 done
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2883 fi
27011
d51d96d4e903 Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 27010
diff changeset
2884 while test -n "$inmodules"; do
d51d96d4e903 Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 27010
diff changeset
2885 inmodules_this_round="$inmodules"
d51d96d4e903 Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 27010
diff changeset
2886 inmodules= # Accumulator, queue for next round
d51d96d4e903 Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 27010
diff changeset
2887 for module in $inmodules_this_round; do
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
2888 func_verify_module
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
2889 if test -n "$module"; then
25672
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
2890 if func_acceptable $module; then
27014
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
2891 func_append outmodules " $module"
34524
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
2892 if test "$cond_dependencies" = true; then
38408
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
2893 if ! $gnu_make \
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
2894 && func_get_automake_snippet_conditional $module \
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
2895 | grep '^if ' > /dev/null; then
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2896 # A module whose Makefile.am snippet contains a reference to an
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2897 # automake conditional. If we were to use it conditionally, we
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2898 # would get an error
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2899 # configure: error: conditional "..." was never defined.
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2900 # because automake 1.11.1 does not handle nested conditionals
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2901 # correctly. As a workaround, make the module unconditional.
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2902 func_uncond_add_module $module
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2903 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2904 if func_cond_module_p $module; then
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2905 conditional=true
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2906 else
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2907 conditional=false
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2908 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2909 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2910 deps=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
27011
d51d96d4e903 Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 27010
diff changeset
2911 # Duplicate dependencies are harmless, but Jim wants a warning.
d51d96d4e903 Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 27010
diff changeset
2912 duplicated_deps=`echo "$deps" | LC_ALL=C sort | LC_ALL=C uniq -d`
d51d96d4e903 Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 27010
diff changeset
2913 if test -n "$duplicated_deps"; then
32510
bd082c7777d7 gnulib-tool: Make warning diagnostics consistent.
Bruno Haible <bruno@clisp.org>
parents: 32466
diff changeset
2914 func_warning "module $module has duplicated dependencies: "`echo $duplicated_deps`
27011
d51d96d4e903 Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 27010
diff changeset
2915 fi
36623
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
2916 if $inctests; then
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
2917 testsmodule=`func_get_tests_module $module`
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
2918 if test -n "$testsmodule"; then
32990
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2919 deps="$deps $testsmodule"
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
2920 fi
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
2921 fi
32990
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2922 for dep in $deps; do
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2923 # Determine whether to include the dependency or tests module.
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2924 inc=true
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2925 for word in `func_get_status $dep`; do
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2926 case "$word" in
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2927 obsolete)
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2928 test -n "$incobsolete" \
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2929 || inc=false
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2930 ;;
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2931 c++-test)
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2932 test -z "$excl_cxx_tests" \
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2933 || inc=false
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2934 test -n "$fmtc_inc_all_tests" || test -n "$inc_cxx_tests" \
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2935 || inc=false
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2936 ;;
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2937 longrunning-test)
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2938 test -z "$excl_longrunning_tests" \
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2939 || inc=false
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2940 test -n "$fmtc_inc_all_tests" || test -n "$inc_longrunning_tests" \
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2941 || inc=false
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2942 ;;
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2943 privileged-test)
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2944 test -z "$excl_privileged_tests" \
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2945 || inc=false
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2946 test -n "$fmtc_inc_all_tests" || test -n "$inc_privileged_tests" \
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2947 || inc=false
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2948 ;;
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2949 unportable-test)
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2950 test -z "$excl_unportable_tests" \
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2951 || inc=false
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2952 test -n "$fmtc_inc_all_tests" || test -n "$inc_unportable_tests" \
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2953 || inc=false
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2954 ;;
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2955 *-test)
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2956 test -n "$fmtc_inc_all_tests" \
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2957 || inc=false
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2958 ;;
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2959 esac
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2960 done
35545
e58f094d2c4d gnulib-tool: Improve last commit.
Bruno Haible <bruno@clisp.org>
parents: 35544
diff changeset
2961 if $inc && func_acceptable "$dep"; then
32990
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2962 func_append inmodules " $dep"
34524
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
2963 if test "$cond_dependencies" = true; then
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2964 escaped_dep=`echo "$dep" | sed -e "$sed_escape_dependency"`
34497
740e5a32fc0e gnulib-tool: fix portability problem with MacOS sed
Paul Eggert <eggert@cs.ucla.edu>
parents: 34373
diff changeset
2965 sed_extract_condition1='/^ *'"$escaped_dep"' *$/{
740e5a32fc0e gnulib-tool: fix portability problem with MacOS sed
Paul Eggert <eggert@cs.ucla.edu>
parents: 34373
diff changeset
2966 s/^.*$/true/p
740e5a32fc0e gnulib-tool: fix portability problem with MacOS sed
Paul Eggert <eggert@cs.ucla.edu>
parents: 34373
diff changeset
2967 }'
740e5a32fc0e gnulib-tool: fix portability problem with MacOS sed
Paul Eggert <eggert@cs.ucla.edu>
parents: 34373
diff changeset
2968 sed_extract_condition2='/^ *'"$escaped_dep"' *\[.*\] *$/{
740e5a32fc0e gnulib-tool: fix portability problem with MacOS sed
Paul Eggert <eggert@cs.ucla.edu>
parents: 34373
diff changeset
2969 s/^ *'"$escaped_dep"' *\[\(.*\)\] *$/\1/p
740e5a32fc0e gnulib-tool: fix portability problem with MacOS sed
Paul Eggert <eggert@cs.ucla.edu>
parents: 34373
diff changeset
2970 }'
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2971 condition=`func_get_dependencies $module | sed -n -e "$sed_extract_condition1" -e "$sed_extract_condition2"`
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2972 if test "$condition" = true; then
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2973 condition=
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2974 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2975 if test -n "$condition"; then
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2976 func_conddep_add_module "$module" "$dep" "$condition"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2977 else
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2978 if $conditional; then
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2979 func_conddep_add_module "$module" "$dep" true
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2980 else
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2981 func_uncond_add_module "$dep"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2982 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2983 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
2984 fi
32990
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2985 fi
ee01ea19495d Fix regression from 2010-04-25.
Bruno Haible <bruno@clisp.org>
parents: 32955
diff changeset
2986 done
25672
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
2987 fi
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
2988 fi
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
2989 done
27011
d51d96d4e903 Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 27010
diff changeset
2990 handledmodules=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
d51d96d4e903 Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 27010
diff changeset
2991 # Remove $handledmodules from $inmodules.
d51d96d4e903 Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 27010
diff changeset
2992 for m in $inmodules; do echo $m; done | LC_ALL=C sort -u > "$tmp"/queued-modules
32572
f0df2aa3fc0f Really work around around "broken pipe" error message from bash 3.2.
Bruno Haible <bruno@clisp.org>
parents: 32568
diff changeset
2993 inmodules=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
32955
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
2994 fmtc_inc_all_tests="$inc_all_indirect_tests"
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
2995 done
27011
d51d96d4e903 Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 27010
diff changeset
2996 modules=`for m in $outmodules; do echo $m; done | LC_ALL=C sort -u`
d51d96d4e903 Speed up func_modules_transitive_closure.
Bruno Haible <bruno@clisp.org>
parents: 27010
diff changeset
2997 rm -f "$tmp"/queued-modules
25038
7b235423ca42 Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 25037
diff changeset
2998 }
7b235423ca42 Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 25037
diff changeset
2999
33111
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
3000 # func_show_module_list
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
3001 # Input:
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
3002 # - specified_modules list of specified modules (one per line, sorted)
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
3003 # - modules complete list of modules (one per line, sorted)
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
3004 # - tmp pathname of a temporary directory
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
3005 func_show_module_list ()
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
3006 {
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
3007 if case "$TERM" in
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
3008 xterm*) test -t 1;;
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
3009 *) false;;
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
3010 esac; then
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
3011 # Assume xterm compatible escape sequences.
37644
8c91651d17fb gnulib-tool: output bold attribute more portably
Mats Erik Andersson <gnu@gisladisker.se>
parents: 37568
diff changeset
3012 bold_on=`printf '\033[1m'`
8c91651d17fb gnulib-tool: output bold attribute more portably
Mats Erik Andersson <gnu@gisladisker.se>
parents: 37568
diff changeset
3013 bold_off=`printf '\033[0m'`
33111
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
3014 else
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
3015 bold_on=
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
3016 bold_off=
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
3017 fi
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
3018 echo "Module list with included dependencies (indented):"
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
3019 echo "$specified_modules" | sed -e '/^$/d' -e 's/$/| /' > "$tmp"/specified-modules
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
3020 echo "$modules" | sed -e '/^$/d' \
34316
9d84eaa777a1 Change gnulib-tool to support NetBSD's join
J.T. Conklin <jtc@acorntoolworks.com>
parents: 34076
diff changeset
3021 | LC_ALL=C join -t '|' -a2 "$tmp"/specified-modules - \
33111
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
3022 | sed -e 's/^\(.*\)|.*/|\1/' -e 's/^/ /' -e 's/^ |\(.*\)$/ '"${bold_on}"'\1'"${bold_off}"'/'
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
3023 }
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
3024
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3025 # func_modules_transitive_closure_separately
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3026 # Determine main module list and tests-related module list separately.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3027 # The main module list is the transitive closure of the specified modules,
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3028 # ignoring tests modules. Its lib/* sources go into $sourcebase/. If --lgpl
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3029 # is specified, it will consist only of LGPLed source.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3030 # The tests-related module list is the transitive closure of the specified
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3031 # modules, including tests modules, minus the main module list excluding
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3032 # modules of applicability 'all'. Its lib/* sources (brought in through
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3033 # dependencies of *-tests modules) go into $testsbase/. It may contain GPLed
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3034 # source, even if --lgpl is specified.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3035 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3036 # - local_gnulib_path from --local-dir
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3037 # - modcache true or false, from --cache-modules/--no-cache-modules
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3038 # - specified_modules list of specified modules
36623
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
3039 # - inctests true if tests should be included, false otherwise
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3040 # - incobsolete true if obsolete modules among dependencies should be
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3041 # included, blank otherwise
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3042 # - inc_cxx_tests true if C++ interoperability tests should be included,
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3043 # blank otherwise
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3044 # - inc_longrunning_tests true if long-runnings tests should be included,
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3045 # blank otherwise
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3046 # - inc_privileged_tests true if tests that require root privileges should be
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3047 # included, blank otherwise
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3048 # - inc_unportable_tests true if tests that fail on some platforms should be
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3049 # included, blank otherwise
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3050 # - inc_all_direct_tests true if all kinds of problematic unit tests among
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3051 # the unit tests of the specified modules should be
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3052 # included, blank otherwise
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3053 # - inc_all_indirect_tests true if all kinds of problematic unit tests among
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3054 # the unit tests of the dependencies should be
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3055 # included, blank otherwise
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3056 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3057 # blank otherwise
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3058 # - excl_longrunning_tests true if long-runnings tests should be excluded,
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3059 # blank otherwise
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3060 # - excl_privileged_tests true if tests that require root privileges should be
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3061 # excluded, blank otherwise
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3062 # - excl_unportable_tests true if tests that fail on some platforms should be
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3063 # excluded, blank otherwise
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3064 # - avoidlist list of modules to avoid
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3065 # - cond_dependencies true if conditional dependencies shall be supported,
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3066 # blank otherwise
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3067 # - tmp pathname of a temporary directory
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3068 # Output:
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3069 # - main_modules list of modules, including dependencies
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3070 # - testsrelated_modules list of tests-related modules, including dependencies
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3071 # - conddep_dependers, conddep_condition information about conditionally
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3072 # enabled modules
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3073 func_modules_transitive_closure_separately ()
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3074 {
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3075 # Determine main module list.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3076 saved_inctests="$inctests"
36623
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
3077 inctests=false
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3078 modules="$specified_modules"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3079 func_modules_transitive_closure
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3080 main_modules="$modules"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3081 inctests="$saved_inctests"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3082 if test $verbose -ge 1; then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3083 echo "Main module list:"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3084 echo "$main_modules" | sed -e 's/^/ /'
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3085 fi
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3086 # Determine tests-related module list.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3087 echo "$final_modules" | LC_ALL=C sort -u > "$tmp"/final-modules
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3088 testsrelated_modules=`for module in $main_modules; do
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3089 if test \`func_get_applicability $module\` = main; then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3090 echo $module
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3091 fi
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3092 done \
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3093 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/final-modules`
38420
411afed909ec gnulib-tool: Don't produce a tests directory with only snippet .h files.
Bruno Haible <bruno@clisp.org>
parents: 38413
diff changeset
3094 # If testsrelated_modules consists only of modules with applicability 'all',
411afed909ec gnulib-tool: Don't produce a tests directory with only snippet .h files.
Bruno Haible <bruno@clisp.org>
parents: 38413
diff changeset
3095 # set it to empty (because such modules are only helper modules for other modules).
411afed909ec gnulib-tool: Don't produce a tests directory with only snippet .h files.
Bruno Haible <bruno@clisp.org>
parents: 38413
diff changeset
3096 have_nontrivial_testsrelated_modules=
411afed909ec gnulib-tool: Don't produce a tests directory with only snippet .h files.
Bruno Haible <bruno@clisp.org>
parents: 38413
diff changeset
3097 for module in $testsrelated_modules; do
411afed909ec gnulib-tool: Don't produce a tests directory with only snippet .h files.
Bruno Haible <bruno@clisp.org>
parents: 38413
diff changeset
3098 if test `func_get_applicability $module` != all; then
411afed909ec gnulib-tool: Don't produce a tests directory with only snippet .h files.
Bruno Haible <bruno@clisp.org>
parents: 38413
diff changeset
3099 have_nontrivial_testsrelated_modules=yes
411afed909ec gnulib-tool: Don't produce a tests directory with only snippet .h files.
Bruno Haible <bruno@clisp.org>
parents: 38413
diff changeset
3100 break
411afed909ec gnulib-tool: Don't produce a tests directory with only snippet .h files.
Bruno Haible <bruno@clisp.org>
parents: 38413
diff changeset
3101 fi
411afed909ec gnulib-tool: Don't produce a tests directory with only snippet .h files.
Bruno Haible <bruno@clisp.org>
parents: 38413
diff changeset
3102 done
411afed909ec gnulib-tool: Don't produce a tests directory with only snippet .h files.
Bruno Haible <bruno@clisp.org>
parents: 38413
diff changeset
3103 if test -z "$have_nontrivial_testsrelated_modules"; then
411afed909ec gnulib-tool: Don't produce a tests directory with only snippet .h files.
Bruno Haible <bruno@clisp.org>
parents: 38413
diff changeset
3104 testsrelated_modules=
411afed909ec gnulib-tool: Don't produce a tests directory with only snippet .h files.
Bruno Haible <bruno@clisp.org>
parents: 38413
diff changeset
3105 fi
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3106 if test $verbose -ge 1; then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3107 echo "Tests-related module list:"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3108 echo "$testsrelated_modules" | sed -e 's/^/ /'
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3109 fi
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3110 }
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3111
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3112 # func_determine_use_libtests
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3113 # Determines whether a $testsbase/libtests.a is needed.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3114 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3115 # - local_gnulib_path from --local-dir
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3116 # - modcache true or false, from --cache-modules/--no-cache-modules
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3117 # - testsrelated_modules list of tests-related modules, including dependencies
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3118 # Output:
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3119 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3120 func_determine_use_libtests ()
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3121 {
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3122 use_libtests=false
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3123 for module in $testsrelated_modules; do
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3124 func_verify_nontests_module
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3125 if test -n "$module"; then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3126 all_files=`func_get_filelist $module`
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3127 # Test whether some file in $all_files lies in lib/.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3128 for f in $all_files; do
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3129 case $f in
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3130 lib/*)
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3131 use_libtests=true
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3132 break 2
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3133 ;;
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3134 esac
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3135 done
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3136 fi
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3137 done
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3138 }
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3139
26241
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3140 # func_modules_add_dummy
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3141 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3142 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
3143 # - modcache true or false, from --cache-modules/--no-cache-modules
26241
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3144 # - modules list of modules, including dependencies
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3145 # Output:
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3146 # - modules list of modules, including 'dummy' if needed
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3147 func_modules_add_dummy ()
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3148 {
30676
18fe1b177e81 Terminate loops early when possible.
Bruno Haible <bruno@clisp.org>
parents: 30672
diff changeset
3149 # Determine whether any module provides a lib_SOURCES augmentation.
26241
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3150 have_lib_SOURCES=
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3151 for module in $modules; do
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3152 func_verify_nontests_module
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3153 if test -n "$module"; then
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3154 # Extract the value of "lib_SOURCES += ...".
37680
c1257e8693cd gnulib-tool: concatenate lib_SOURCES to a single line
Pádraig Brady <P@draigBrady.com>
parents: 37644
diff changeset
3155 for file in `func_get_automake_snippet "$module" | combine_lines |
c1257e8693cd gnulib-tool: concatenate lib_SOURCES to a single line
Pádraig Brady <P@draigBrady.com>
parents: 37644
diff changeset
3156 sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'`; do
26241
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3157 # Ignore .h files since they are not compiled.
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3158 case "$file" in
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3159 *.h) ;;
30676
18fe1b177e81 Terminate loops early when possible.
Bruno Haible <bruno@clisp.org>
parents: 30672
diff changeset
3160 *)
18fe1b177e81 Terminate loops early when possible.
Bruno Haible <bruno@clisp.org>
parents: 30672
diff changeset
3161 have_lib_SOURCES=yes
18fe1b177e81 Terminate loops early when possible.
Bruno Haible <bruno@clisp.org>
parents: 30672
diff changeset
3162 break 2
18fe1b177e81 Terminate loops early when possible.
Bruno Haible <bruno@clisp.org>
parents: 30672
diff changeset
3163 ;;
26241
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3164 esac
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3165 done
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3166 fi
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3167 done
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3168 # Add the dummy module, to make sure the library will be non-empty.
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3169 if test -z "$have_lib_SOURCES"; then
28359
d581754de610 2007-04-12 Simon Josefsson <simon@josefsson.org>
Simon Josefsson <simon@josefsson.org>
parents: 28317
diff changeset
3170 if func_acceptable "dummy"; then
d581754de610 2007-04-12 Simon Josefsson <simon@josefsson.org>
Simon Josefsson <simon@josefsson.org>
parents: 28317
diff changeset
3171 func_append modules " dummy"
d581754de610 2007-04-12 Simon Josefsson <simon@josefsson.org>
Simon Josefsson <simon@josefsson.org>
parents: 28317
diff changeset
3172 fi
26241
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3173 fi
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3174 }
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
3175
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3176 # func_modules_add_dummy_separately
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3177 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3178 # - local_gnulib_path from --local-dir
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3179 # - modcache true or false, from --cache-modules/--no-cache-modules
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3180 # - main_modules list of modules, including dependencies
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3181 # - testsrelated_modules list of tests-related modules, including dependencies
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3182 # - use_libtests true if a $testsbase/libtests.a is needed, false otherwise
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3183 # Output:
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3184 # - main_modules list of modules, including 'dummy' if needed
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3185 # - testsrelated_modules list of tests-related modules, including 'dummy' if
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3186 # needed
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3187 func_modules_add_dummy_separately ()
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3188 {
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3189 # Add the dummy module to the main module list if needed.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3190 modules="$main_modules"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3191 func_modules_add_dummy
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3192 main_modules="$modules"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3193
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3194 # Add the dummy module to the tests-related module list if needed.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3195 if $use_libtests; then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3196 modules="$testsrelated_modules"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3197 func_modules_add_dummy
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3198 testsrelated_modules="$modules"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3199 fi
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3200 }
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3201
28880
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
3202 # func_modules_notice
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
3203 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3204 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
3205 # - modcache true or false, from --cache-modules/--no-cache-modules
28880
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
3206 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
3207 # - modules list of modules, including dependencies
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
3208 func_modules_notice ()
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
3209 {
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
3210 if test $verbose -ge -1; then
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
3211 for module in $modules; do
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
3212 func_verify_module
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
3213 if test -n "$module"; then
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
3214 msg=`func_get_notice $module`
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
3215 if test -n "$msg"; then
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
3216 echo "Notice from module $module:"
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
3217 echo "$msg" | sed -e 's/^/ /'
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
3218 fi
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
3219 fi
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
3220 done
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
3221 fi
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
3222 }
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
3223
25039
b5238e9dd1aa Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 25038
diff changeset
3224 # func_modules_to_filelist
b5238e9dd1aa Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 25038
diff changeset
3225 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3226 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
3227 # - modcache true or false, from --cache-modules/--no-cache-modules
25039
b5238e9dd1aa Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 25038
diff changeset
3228 # - modules list of modules, including dependencies
b5238e9dd1aa Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 25038
diff changeset
3229 # Output:
b5238e9dd1aa Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 25038
diff changeset
3230 # - files list of files
b5238e9dd1aa Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 25038
diff changeset
3231 func_modules_to_filelist ()
b5238e9dd1aa Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 25038
diff changeset
3232 {
b5238e9dd1aa Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 25038
diff changeset
3233 files=
b5238e9dd1aa Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 25038
diff changeset
3234 for module in $modules; do
b5238e9dd1aa Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 25038
diff changeset
3235 func_verify_module
b5238e9dd1aa Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 25038
diff changeset
3236 if test -n "$module"; then
27014
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
3237 fs=`func_get_filelist $module`
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
3238 func_append files " $fs"
25039
b5238e9dd1aa Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 25038
diff changeset
3239 fi
b5238e9dd1aa Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 25038
diff changeset
3240 done
27010
ad308cf77878 Use "sort -u" where it makes sense.
Bruno Haible <bruno@clisp.org>
parents: 26990
diff changeset
3241 files=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
25039
b5238e9dd1aa Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 25038
diff changeset
3242 }
b5238e9dd1aa Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 25038
diff changeset
3243
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3244 # func_modules_to_filelist_separately
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3245 # Determine the final file lists.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3246 # They must be computed separately, because files in lib/* go into
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3247 # $sourcebase/ if they are in the main file list but into $testsbase/
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3248 # if they are in the tests-related file list. Furthermore lib/dummy.c
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3249 # can be in both.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3250 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3251 # - local_gnulib_path from --local-dir
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3252 # - modcache true or false, from --cache-modules/--no-cache-modules
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3253 # - main_modules list of modules, including dependencies
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3254 # - testsrelated_modules list of tests-related modules, including dependencies
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3255 func_modules_to_filelist_separately ()
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3256 {
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3257 # Determine final main file list.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3258 modules="$main_modules"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3259 func_modules_to_filelist
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3260 main_files="$files"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3261 # Determine final tests-related file list.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3262 modules="$testsrelated_modules"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3263 func_modules_to_filelist
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3264 testsrelated_files=`echo "$files" | sed -e 's,^lib/,tests=lib/,'`
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3265 # Merge both file lists.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3266 sed_remove_empty_lines='/^$/d'
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3267 files=`{ echo "$main_files"; echo "$testsrelated_files"; } | sed -e "$sed_remove_empty_lines" | LC_ALL=C sort -u`
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3268 if test $verbose -ge 0; then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3269 echo "File list:"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3270 sed_prettyprint_files='s,^tests=lib/\(.*\)$,lib/\1 -> tests/\1,'
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3271 echo "$files" | sed -e "$sed_prettyprint_files" -e 's/^/ /'
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3272 fi
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3273 }
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3274
34531
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3275 # func_compute_include_guard_prefix
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3276 # Determine include_guard_prefix.
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3277 # Input:
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3278 # - macro_prefix prefix of gl_LIBOBJS macros to use
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3279 # Output:
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3280 # - include_guard_prefix replacement for ${gl_include_guard_prefix}
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3281 # - sed_replace_include_guard_prefix
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3282 # sed expression for resolving ${gl_include_guard_prefix}
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3283 func_compute_include_guard_prefix ()
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3284 {
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3285 if test "$macro_prefix" = gl; then
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3286 include_guard_prefix='GL'
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3287 else
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3288 include_guard_prefix='GL_'`echo "$macro_prefix" | LC_ALL=C tr '[a-z]' '[A-Z]'`
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3289 fi
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3290 sed_replace_include_guard_prefix='s/\${gl_include_guard_prefix}/'"${include_guard_prefix}"'/g'
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3291 }
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3292
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3293 # func_execute_command command [args...]
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3294 # Executes a command.
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3295 # Uses also the variables
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3296 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3297 func_execute_command ()
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3298 {
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3299 if test $verbose -ge 0; then
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3300 echo "executing $*"
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3301 "$@"
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3302 else
29756
ad4401159dd5 * gnulib-tool: Fix various comment typos.
Eric Blake <ebb9@byu.net>
parents: 29578
diff changeset
3303 # Commands like automake produce output to stderr even when they succeed.
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3304 # Turn this output off if the command succeeds.
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3305 "$@" > "$tmp"/cmdout 2>&1
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3306 cmdret=$?
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3307 if test $cmdret = 0; then
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3308 rm -f "$tmp"/cmdout
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3309 else
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3310 echo "executing $*"
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3311 cat "$tmp"/cmdout 1>&2
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3312 rm -f "$tmp"/cmdout
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3313 (exit $cmdret)
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3314 fi
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3315 fi
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3316 }
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
3317
31152
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3318 # func_dest_tmpfilename file
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3319 # determines the name of a temporary file (file is relative to destdir).
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3320 # Input:
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3321 # - destdir target directory
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3322 # - doit : if actions shall be executed, false if only to be printed
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3323 # - tmp pathname of a temporary directory
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3324 # Sets variable:
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3325 # - tmpfile absolute filename of the temporary file
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3326 func_dest_tmpfilename ()
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3327 {
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3328 if $doit; then
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3329 # Put the new contents of $file in a file in the same directory (needed
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3330 # to guarantee that an 'mv' to "$destdir/$file" works).
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3331 tmpfile="$destdir/$1.tmp"
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3332 else
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3333 # Put the new contents of $file in a file in a temporary directory
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3334 # (because the directory of "$file" might not exist).
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3335 tmpfile="$tmp"/`basename "$1"`.tmp
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3336 fi
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3337 }
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3338
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3339 # func_is_local_file lookedup_file file
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3340 # check whether file should be instantiated from local gnulib directory
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3341 func_is_local_file ()
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3342 {
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3343 dname=$1
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3344 func_remove_suffix dname "/$2"
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3345 func_path_foreach "$local_gnulib_path" test %dir% = "$dname"
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3346 }
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3347
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3348 # func_should_link
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3349 # determines whether the file $f should be copied, symlinked, or hardlinked.
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3350 # Input:
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3351 # - copymode copy mode for files in general
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3352 # - lcopymode copy mode for files from local_gnulib_path
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3353 # - f the original file name
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3354 # - lookedup_file name of the merged (combined) file
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3355 # Sets variable:
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3356 # - copyaction copy or symlink or hardlink
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3357 func_should_link ()
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3358 {
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3359 if test -n "$lcopymode" && func_is_local_file "$lookedup_file" "$f"; then
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3360 copyaction="$lcopymode"
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3361 else
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3362 if test -n "$copymode"; then
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3363 copyaction="$copymode"
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3364 else
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3365 copyaction=copy
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3366 fi
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3367 fi
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3368 }
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3369
31152
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3370 # func_add_file
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3371 # copies a file from gnulib into the destination directory. The destination
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3372 # is known to not exist.
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3373 # Input:
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3374 # - destdir target directory
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3375 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
3376 # - modcache true or false, from --cache-modules/--no-cache-modules
31152
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3377 # - f the original file name
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3378 # - lookedup_file name of the merged (combined) file
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3379 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3380 # - g the rewritten file name
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3381 # - tmpfile absolute filename of the temporary file
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3382 # - doit : if actions shall be executed, false if only to be printed
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3383 # - copymode copy mode for files in general
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3384 # - lcopymode copy mode for files from local_gnulib_path
31152
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3385 func_add_file ()
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3386 {
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3387 if $doit; then
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3388 echo "Copying file $g"
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3389 func_should_link
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3390 if test "$copyaction" = symlink \
31152
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3391 && test -z "$lookedup_tmp" \
36405
b20b2a61aeb9 gnulib-tool: Avoid unintended error output from 'cmp'.
Bruno Haible <bruno@clisp.org>
parents: 36404
diff changeset
3392 && cmp -s "$lookedup_file" "$tmpfile"; then
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3393 func_symlink_if_changed "$lookedup_file" "$destdir/$g"
31152
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3394 else
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3395 if test "$copyaction" = hardlink \
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3396 && test -z "$lookedup_tmp" \
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3397 && cmp -s "$lookedup_file" "$tmpfile"; then
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3398 func_hardlink "$lookedup_file" "$destdir/$g"
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3399 else
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3400 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error "failed"
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3401 fi
31152
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3402 fi
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3403 else
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3404 echo "Copy file $g"
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3405 fi
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3406 }
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3407
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3408 # func_update_file
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3409 # copies a file from gnulib into the destination directory. The destination
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3410 # is known to exist.
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3411 # Input:
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3412 # - destdir target directory
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3413 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
3414 # - modcache true or false, from --cache-modules/--no-cache-modules
31152
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3415 # - f the original file name
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3416 # - lookedup_file name of the merged (combined) file
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3417 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3418 # - g the rewritten file name
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3419 # - tmpfile absolute filename of the temporary file
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3420 # - doit : if actions shall be executed, false if only to be printed
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3421 # - copymode copy mode for files in general
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3422 # - lcopymode copy mode for files from local_gnulib_path
31152
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3423 # - already_present nonempty if the file should already exist, empty otherwise
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3424 func_update_file ()
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3425 {
36405
b20b2a61aeb9 gnulib-tool: Avoid unintended error output from 'cmp'.
Bruno Haible <bruno@clisp.org>
parents: 36404
diff changeset
3426 if cmp -s "$destdir/$g" "$tmpfile"; then
31152
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3427 : # The file has not changed.
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3428 else
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3429 # Replace the file.
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3430 if $doit; then
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3431 if test -n "$already_present"; then
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3432 echo "Updating file $g (backup in ${g}~)"
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3433 else
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3434 echo "Replacing file $g (non-gnulib code backed up in ${g}~) !!"
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3435 fi
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3436 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error "failed"
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3437 func_should_link
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3438 if test "$copyaction" = symlink \
31152
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3439 && test -z "$lookedup_tmp" \
36405
b20b2a61aeb9 gnulib-tool: Avoid unintended error output from 'cmp'.
Bruno Haible <bruno@clisp.org>
parents: 36404
diff changeset
3440 && cmp -s "$lookedup_file" "$tmpfile"; then
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3441 func_symlink_if_changed "$lookedup_file" "$destdir/$g"
31152
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3442 else
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3443 if test "$copyaction" = hardlink \
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3444 && test -z "$lookedup_tmp" \
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3445 && cmp -s "$lookedup_file" "$tmpfile"; then
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3446 func_hardlink "$lookedup_file" "$destdir/$g"
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3447 else
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3448 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error "failed"
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
3449 fi
31152
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3450 fi
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3451 else
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3452 if test -n "$already_present"; then
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3453 echo "Update file $g (backup in ${g}~)"
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3454 else
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3455 echo "Replace file $g (non-gnulib code backed up in ${g}~) !!"
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3456 fi
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3457 fi
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3458 fi
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3459 }
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
3460
25042
4bfa248af894 Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 25041
diff changeset
3461 # func_emit_lib_Makefile_am
26913
2f6d41ced306 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 26907
diff changeset
3462 # emits the contents of library makefile to standard output.
25042
4bfa248af894 Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 25041
diff changeset
3463 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3464 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
3465 # - modcache true or false, from --cache-modules/--no-cache-modules
25042
4bfa248af894 Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 25041
diff changeset
3466 # - modules list of modules, including dependencies
4bfa248af894 Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 25041
diff changeset
3467 # - libname library name
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3468 # - pobase directory relative to destdir where to place *.po files
27335
edbb3cba56e9 Replace build-aux/ also in the Makefile snippet.
Bruno Haible <bruno@clisp.org>
parents: 27334
diff changeset
3469 # - auxdir directory relative to destdir where to place build aux files
38408
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3470 # - gnu_make true if --gnu-make was given, false otherwise
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
3471 # - makefile_name from --makefile-name
26768
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
3472 # - libtool true if libtool will be used, false or blank otherwise
27177
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
3473 # - macro_prefix prefix of gl_LIBOBJS macros to use
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3474 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
34585
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
3475 # - witness_c_macro from --witness-c-macro
25042
4bfa248af894 Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 25041
diff changeset
3476 # - actioncmd (optional) command that will reproduce this invocation
27672
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
3477 # - for_test true if creating a package for testing, false otherwise
34531
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3478 # - sed_replace_include_guard_prefix
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3479 # sed expression for resolving ${gl_include_guard_prefix}
30167
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3480 # - destfile filename relative to destdir of makefile being generated
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3481 # Input/Output:
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3482 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val}
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3483 # list of edits to be done to Makefile.am variables
27332
73191cd1d374 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27331
diff changeset
3484 # Output:
73191cd1d374 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27331
diff changeset
3485 # - uses_subdirs nonempty if object files in subdirs exist
25042
4bfa248af894 Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 25041
diff changeset
3486 func_emit_lib_Makefile_am ()
4bfa248af894 Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 25041
diff changeset
3487 {
38408
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3488
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3489 # When using GNU make, or when creating an includable Makefile.am snippet,
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3490 # augment variables with += instead of assigning them.
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3491 if $gnu_make || test -n "$makefile_name"; then
26931
cb44f5923734 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26930
diff changeset
3492 assign='+='
cb44f5923734 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26930
diff changeset
3493 else
cb44f5923734 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26930
diff changeset
3494 assign='='
cb44f5923734 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26930
diff changeset
3495 fi
26768
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
3496 if test "$libtool" = true; then
25042
4bfa248af894 Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 25041
diff changeset
3497 libext=la
4bfa248af894 Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 25041
diff changeset
3498 perhapsLT=LT
30091
1d280945b2f7 Make gnulib-tool work with native 'sed' on AIX.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 30071
diff changeset
3499 sed_eliminate_LDFLAGS="$sed_noop"
25042
4bfa248af894 Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 25041
diff changeset
3500 else
4bfa248af894 Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 25041
diff changeset
3501 libext=a
4bfa248af894 Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 25041
diff changeset
3502 perhapsLT=
27026
cf363255def6 * gnulib-tool: Avoid space-tab.
Eric Blake <ebb9@byu.net>
parents: 27023
diff changeset
3503 sed_eliminate_LDFLAGS='/^lib_LDFLAGS[ ]*+=/d'
25042
4bfa248af894 Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 25041
diff changeset
3504 fi
27672
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
3505 if $for_test; then
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
3506 # When creating a package for testing: Attempt to provoke failures,
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
3507 # especially link errors, already during "make" rather than during
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
3508 # "make check", because "make check" is not possible in a cross-compiling
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
3509 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
3510 sed_transform_check_PROGRAMS='s,check_PROGRAMS,noinst_PROGRAMS,g'
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
3511 else
30091
1d280945b2f7 Make gnulib-tool work with native 'sed' on AIX.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 30071
diff changeset
3512 sed_transform_check_PROGRAMS="$sed_noop"
27672
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
3513 fi
27112
499aa823eee7 Mark generated files as "DO NOT EDIT".
Bruno Haible <bruno@clisp.org>
parents: 27082
diff changeset
3514 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
25042
4bfa248af894 Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 25041
diff changeset
3515 echo "## Process this file with automake to produce Makefile.in."
26468
1b01766ac7a3 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 26456
diff changeset
3516 func_emit_copyright_notice
25042
4bfa248af894 Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 25041
diff changeset
3517 if test -n "$actioncmd"; then
31156
60b56e01e401 Work around an autoconf limitation on line lengths.
Bruno Haible <bruno@clisp.org>
parents: 31154
diff changeset
3518 # The maximum line length (excluding the terminating newline) of any file
60b56e01e401 Work around an autoconf limitation on line lengths.
Bruno Haible <bruno@clisp.org>
parents: 31154
diff changeset
3519 # that is to be preprocessed by config.status is 3070. config.status uses
60b56e01e401 Work around an autoconf limitation on line lengths.
Bruno Haible <bruno@clisp.org>
parents: 31154
diff changeset
3520 # awk, and the HP-UX 11.00 awk fails if a line has length >= 3071;
60b56e01e401 Work around an autoconf limitation on line lengths.
Bruno Haible <bruno@clisp.org>
parents: 31154
diff changeset
3521 # similarly, the IRIX 6.5 awk fails if a line has length >= 3072.
60b56e01e401 Work around an autoconf limitation on line lengths.
Bruno Haible <bruno@clisp.org>
parents: 31154
diff changeset
3522 len=`echo "$actioncmd" | wc -c`
60b56e01e401 Work around an autoconf limitation on line lengths.
Bruno Haible <bruno@clisp.org>
parents: 31154
diff changeset
3523 if test -n "$len" && test "$len" -le 3000; then
60b56e01e401 Work around an autoconf limitation on line lengths.
Bruno Haible <bruno@clisp.org>
parents: 31154
diff changeset
3524 echo "# Reproduce by: $actioncmd"
60b56e01e401 Work around an autoconf limitation on line lengths.
Bruno Haible <bruno@clisp.org>
parents: 31154
diff changeset
3525 fi
25042
4bfa248af894 Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 25041
diff changeset
3526 fi
4bfa248af894 Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 25041
diff changeset
3527 echo
27332
73191cd1d374 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27331
diff changeset
3528 uses_subdirs=
73191cd1d374 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27331
diff changeset
3529 {
26860
87d9d03750ca Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 26859
diff changeset
3530 for module in $modules; do
87d9d03750ca Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 26859
diff changeset
3531 func_verify_nontests_module
87d9d03750ca Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 26859
diff changeset
3532 if test -n "$module"; then
87d9d03750ca Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 26859
diff changeset
3533 {
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
3534 func_get_automake_snippet_conditional "$module" |
32608
8f98b62cf16d Fix incorrect Makefile.am generation in German locale.
Bruno Haible <bruno@clisp.org>
parents: 32594
diff changeset
3535 LC_ALL=C \
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
3536 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
28696
9dd6cf2c070c * gnulib-tool (IFS): Initialize early, so we don't set it to
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 28694
diff changeset
3537 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
9dd6cf2c070c * gnulib-tool (IFS): Initialize early, so we don't set it to
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 28694
diff changeset
3538 -e "$sed_eliminate_LDFLAGS" \
9dd6cf2c070c * gnulib-tool (IFS): Initialize early, so we don't set it to
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 28694
diff changeset
3539 -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' \
9dd6cf2c070c * gnulib-tool (IFS): Initialize early, so we don't set it to
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 28694
diff changeset
3540 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
9dd6cf2c070c * gnulib-tool (IFS): Initialize early, so we don't set it to
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 28694
diff changeset
3541 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
34531
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3542 -e "$sed_transform_check_PROGRAMS" \
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3543 -e "$sed_replace_include_guard_prefix"
26860
87d9d03750ca Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 26859
diff changeset
3544 if test "$module" = 'alloca'; then
87d9d03750ca Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 26859
diff changeset
3545 echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
27177
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
3546 echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@"
26860
87d9d03750ca Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 26859
diff changeset
3547 fi
37680
c1257e8693cd gnulib-tool: concatenate lib_SOURCES to a single line
Pádraig Brady <P@draigBrady.com>
parents: 37644
diff changeset
3548 } | combine_lines "${libname}_${libext}_SOURCES" > "$tmp"/amsnippet1
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
3549 {
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
3550 func_get_automake_snippet_unconditional "$module" |
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
3551 LC_ALL=C sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g'
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
3552 } > "$tmp"/amsnippet2
29756
ad4401159dd5 * gnulib-tool: Fix various comment typos.
Eric Blake <ebb9@byu.net>
parents: 29578
diff changeset
3553 # Skip the contents if it's entirely empty.
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
3554 if grep '[^ ]' "$tmp"/amsnippet1 "$tmp"/amsnippet2 > /dev/null ; then
26860
87d9d03750ca Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 26859
diff changeset
3555 echo "## begin gnulib module $module"
38408
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3556 if $gnu_make; then
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3557 echo "ifeq (,\$(OMIT_GNULIB_MODULE_$module))"
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3558 convert_to_gnu_make='s/^if \(.*\)/ifneq (,$(\1))/'
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3559 else
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3560 convert_to_gnu_make=
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3561 fi
26860
87d9d03750ca Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 26859
diff changeset
3562 echo
34524
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
3563 if test "$cond_dependencies" = true; then
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
3564 if func_cond_module_p "$module"; then
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
3565 func_module_conditional_name "$module"
38408
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3566 if $gnu_make; then
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3567 echo "ifneq (,\$($conditional))"
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3568 else
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3569 echo "if $conditional"
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3570 fi
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
3571 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
3572 fi
38408
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3573 sed "$convert_to_gnu_make" "$tmp"/amsnippet1
34524
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
3574 if test "$cond_dependencies" = true; then
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
3575 if func_cond_module_p "$module"; then
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
3576 echo "endif"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
3577 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
3578 fi
38408
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3579 sed "$convert_to_gnu_make" "$tmp"/amsnippet2
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3580 if $gnu_make; then
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3581 echo "endif"
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3582 fi
26860
87d9d03750ca Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 26859
diff changeset
3583 echo "## end gnulib module $module"
87d9d03750ca Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 26859
diff changeset
3584 echo
87d9d03750ca Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 26859
diff changeset
3585 fi
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
3586 rm -f "$tmp"/amsnippet1 "$tmp"/amsnippet2
27332
73191cd1d374 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27331
diff changeset
3587 # Test whether there are some source files in subdirectories.
73191cd1d374 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27331
diff changeset
3588 for f in `func_get_filelist "$module"`; do
73191cd1d374 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27331
diff changeset
3589 case $f in
30676
18fe1b177e81 Terminate loops early when possible.
Bruno Haible <bruno@clisp.org>
parents: 30672
diff changeset
3590 lib/*/*.c)
18fe1b177e81 Terminate loops early when possible.
Bruno Haible <bruno@clisp.org>
parents: 30672
diff changeset
3591 uses_subdirs=yes
18fe1b177e81 Terminate loops early when possible.
Bruno Haible <bruno@clisp.org>
parents: 30672
diff changeset
3592 break
18fe1b177e81 Terminate loops early when possible.
Bruno Haible <bruno@clisp.org>
parents: 30672
diff changeset
3593 ;;
27332
73191cd1d374 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27331
diff changeset
3594 esac
73191cd1d374 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27331
diff changeset
3595 done
26860
87d9d03750ca Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 26859
diff changeset
3596 fi
87d9d03750ca Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 26859
diff changeset
3597 done
32432
aab267317cc7 gnulib-tool: avoid writing in the current directory.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32250
diff changeset
3598 } > "$tmp"/allsnippets
27332
73191cd1d374 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27331
diff changeset
3599 if test -z "$makefile_name"; then
73191cd1d374 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27331
diff changeset
3600 # If there are source files in subdirectories, prevent collision of the
73191cd1d374 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27331
diff changeset
3601 # object files (example: hash.c and libxml/hash.c).
73191cd1d374 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27331
diff changeset
3602 subdir_options=
73191cd1d374 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27331
diff changeset
3603 if test -n "$uses_subdirs"; then
73191cd1d374 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27331
diff changeset
3604 subdir_options=' subdir-objects'
73191cd1d374 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27331
diff changeset
3605 fi
37076
9c7fbcb4f128 deps: require Automake >= 1.9.6 in generated Makefile fragments
Stefano Lattarini <stefano.lattarini@gmail.com>
parents: 37069
diff changeset
3606 echo "AUTOMAKE_OPTIONS = 1.9.6 gnits${subdir_options}"
27332
73191cd1d374 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27331
diff changeset
3607 fi
73191cd1d374 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27331
diff changeset
3608 echo
26937
a85000bd6611 * gnulib-tool (func_emit_lib_Makefile_am): Fix typos in
Paul Eggert <eggert@cs.ucla.edu>
parents: 26936
diff changeset
3609 if test -z "$makefile_name"; then
30167
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3610 echo "SUBDIRS ="
26931
cb44f5923734 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26930
diff changeset
3611 echo "noinst_HEADERS ="
27392
0fa149a0a456 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 27382
diff changeset
3612 echo "noinst_LIBRARIES ="
27382
7558f2104b49 Initialize also noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 27351
diff changeset
3613 echo "noinst_LTLIBRARIES ="
36404
197b3c3ec5e8 gnulib-tool: fix imprecise comments w.r.t. an automake bug
Stefano Lattarini <stefano.lattarini@gmail.com>
parents: 36068
diff changeset
3614 # Automake versions < 1.11.4 create an empty pkgdatadir at
197b3c3ec5e8 gnulib-tool: fix imprecise comments w.r.t. an automake bug
Stefano Lattarini <stefano.lattarini@gmail.com>
parents: 36068
diff changeset
3615 # installation time if you specify pkgdata_DATA to empty.
197b3c3ec5e8 gnulib-tool: fix imprecise comments w.r.t. an automake bug
Stefano Lattarini <stefano.lattarini@gmail.com>
parents: 36068
diff changeset
3616 # See automake bugs #10997 and #11030:
38844
a8586d5e30d2 all: prefer https: URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 38818
diff changeset
3617 # * https://debbugs.gnu.org/10997
a8586d5e30d2 all: prefer https: URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 38818
diff changeset
3618 # * https://debbugs.gnu.org/11030
36404
197b3c3ec5e8 gnulib-tool: fix imprecise comments w.r.t. an automake bug
Stefano Lattarini <stefano.lattarini@gmail.com>
parents: 36068
diff changeset
3619 # So we need this workaround.
32432
aab267317cc7 gnulib-tool: avoid writing in the current directory.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32250
diff changeset
3620 if grep '^pkgdata_DATA *+=' "$tmp"/allsnippets > /dev/null; then
26931
cb44f5923734 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26930
diff changeset
3621 echo "pkgdata_DATA ="
cb44f5923734 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26930
diff changeset
3622 fi
cb44f5923734 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26930
diff changeset
3623 echo "EXTRA_DIST ="
cb44f5923734 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26930
diff changeset
3624 echo "BUILT_SOURCES ="
cb44f5923734 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26930
diff changeset
3625 echo "SUFFIXES ="
26860
87d9d03750ca Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 26859
diff changeset
3626 fi
26931
cb44f5923734 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26930
diff changeset
3627 echo "MOSTLYCLEANFILES $assign core *.stackdump"
26937
a85000bd6611 * gnulib-tool (func_emit_lib_Makefile_am): Fix typos in
Paul Eggert <eggert@cs.ucla.edu>
parents: 26936
diff changeset
3628 if test -z "$makefile_name"; then
26931
cb44f5923734 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26930
diff changeset
3629 echo "MOSTLYCLEANDIRS ="
cb44f5923734 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26930
diff changeset
3630 echo "CLEANFILES ="
cb44f5923734 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26930
diff changeset
3631 echo "DISTCLEANFILES ="
cb44f5923734 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26930
diff changeset
3632 echo "MAINTAINERCLEANFILES ="
30167
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3633 fi
38408
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3634 if $gnu_make; then
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3635 echo "# Start of GNU Make output."
38589
3330a3dd0457 gnulib-tool: improve GNU Make debugging
Paul Eggert <eggert@cs.ucla.edu>
parents: 38465
diff changeset
3636
3330a3dd0457 gnulib-tool: improve GNU Make debugging
Paul Eggert <eggert@cs.ucla.edu>
parents: 38465
diff changeset
3637 # Put autoconf output into a temporary file, so that its exit status
3330a3dd0457 gnulib-tool: improve GNU Make debugging
Paul Eggert <eggert@cs.ucla.edu>
parents: 38465
diff changeset
3638 # can be checked from the shell. Signal any error by putting a
3330a3dd0457 gnulib-tool: improve GNU Make debugging
Paul Eggert <eggert@cs.ucla.edu>
parents: 38465
diff changeset
3639 # syntax error into the output makefile.
3330a3dd0457 gnulib-tool: improve GNU Make debugging
Paul Eggert <eggert@cs.ucla.edu>
parents: 38465
diff changeset
3640 ${AUTOCONF} -t 'AC_SUBST:$1 = @$1@' "$configure_ac" \
3330a3dd0457 gnulib-tool: improve GNU Make debugging
Paul Eggert <eggert@cs.ucla.edu>
parents: 38465
diff changeset
3641 >"$tmp"/makeout 2>"$tmp"/makeout2 &&
3330a3dd0457 gnulib-tool: improve GNU Make debugging
Paul Eggert <eggert@cs.ucla.edu>
parents: 38465
diff changeset
3642 LC_ALL=C sort -u "$tmp"/makeout || {
3330a3dd0457 gnulib-tool: improve GNU Make debugging
Paul Eggert <eggert@cs.ucla.edu>
parents: 38465
diff changeset
3643 echo "== gnulib-tool GNU Make output failed as follows =="
3330a3dd0457 gnulib-tool: improve GNU Make debugging
Paul Eggert <eggert@cs.ucla.edu>
parents: 38465
diff changeset
3644 sed 's/^/# stderr: /' "$tmp"/makeout2
3330a3dd0457 gnulib-tool: improve GNU Make debugging
Paul Eggert <eggert@cs.ucla.edu>
parents: 38465
diff changeset
3645 }
3330a3dd0457 gnulib-tool: improve GNU Make debugging
Paul Eggert <eggert@cs.ucla.edu>
parents: 38465
diff changeset
3646 rm -f "$tmp"/makeout "$tmp"/makeout2
3330a3dd0457 gnulib-tool: improve GNU Make debugging
Paul Eggert <eggert@cs.ucla.edu>
parents: 38465
diff changeset
3647
38408
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3648 echo "# End of GNU Make output."
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3649 else
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3650 echo "# No GNU Make output."
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3651 fi
30167
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3652 # Execute edits that apply to the Makefile.am being generated.
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3653 edit=0
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3654 while test $edit != $makefile_am_edits; do
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3655 edit=`expr $edit + 1`
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3656 eval dir=\"\$makefile_am_edit${edit}_dir\"
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3657 eval var=\"\$makefile_am_edit${edit}_var\"
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3658 eval val=\"\$makefile_am_edit${edit}_val\"
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3659 if test -n "$var"; then
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3660 if test "${dir}Makefile.am" = "$destfile" || test "./${dir}Makefile.am" = "$destfile"; then
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3661 echo "${var} += ${val}"
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3662 eval "makefile_am_edit${edit}_var="
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3663 fi
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3664 fi
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3665 done
34608
d14042e62c4b gnulib-tool: Addendum to 2011-06-08 commit.
Bruno Haible <bruno@clisp.org>
parents: 34599
diff changeset
3666 if test -n "$witness_c_macro"; then
d14042e62c4b gnulib-tool: Addendum to 2011-06-08 commit.
Bruno Haible <bruno@clisp.org>
parents: 34599
diff changeset
3667 cppflags_part1=" -D$witness_c_macro=1"
d14042e62c4b gnulib-tool: Addendum to 2011-06-08 commit.
Bruno Haible <bruno@clisp.org>
parents: 34599
diff changeset
3668 else
d14042e62c4b gnulib-tool: Addendum to 2011-06-08 commit.
Bruno Haible <bruno@clisp.org>
parents: 34599
diff changeset
3669 cppflags_part1=
d14042e62c4b gnulib-tool: Addendum to 2011-06-08 commit.
Bruno Haible <bruno@clisp.org>
parents: 34599
diff changeset
3670 fi
d14042e62c4b gnulib-tool: Addendum to 2011-06-08 commit.
Bruno Haible <bruno@clisp.org>
parents: 34599
diff changeset
3671 if $for_test; then
d14042e62c4b gnulib-tool: Addendum to 2011-06-08 commit.
Bruno Haible <bruno@clisp.org>
parents: 34599
diff changeset
3672 cppflags_part2=" -DGNULIB_STRICT_CHECKING=1"
d14042e62c4b gnulib-tool: Addendum to 2011-06-08 commit.
Bruno Haible <bruno@clisp.org>
parents: 34599
diff changeset
3673 else
d14042e62c4b gnulib-tool: Addendum to 2011-06-08 commit.
Bruno Haible <bruno@clisp.org>
parents: 34599
diff changeset
3674 cppflags_part2=
d14042e62c4b gnulib-tool: Addendum to 2011-06-08 commit.
Bruno Haible <bruno@clisp.org>
parents: 34599
diff changeset
3675 fi
30167
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3676 if test -z "$makefile_name"; then
26931
cb44f5923734 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26930
diff changeset
3677 echo
34585
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
3678 echo "AM_CPPFLAGS =$cppflags_part1$cppflags_part2"
30952
01d22ea1fa88 Make it easier to use the 'visibility' module.
Bruno Haible <bruno@clisp.org>
parents: 30940
diff changeset
3679 echo "AM_CFLAGS ="
34608
d14042e62c4b gnulib-tool: Addendum to 2011-06-08 commit.
Bruno Haible <bruno@clisp.org>
parents: 34599
diff changeset
3680 else
d14042e62c4b gnulib-tool: Addendum to 2011-06-08 commit.
Bruno Haible <bruno@clisp.org>
parents: 34599
diff changeset
3681 if test -n "$cppflags_part1$cppflags_part2"; then
d14042e62c4b gnulib-tool: Addendum to 2011-06-08 commit.
Bruno Haible <bruno@clisp.org>
parents: 34599
diff changeset
3682 echo
d14042e62c4b gnulib-tool: Addendum to 2011-06-08 commit.
Bruno Haible <bruno@clisp.org>
parents: 34599
diff changeset
3683 echo "AM_CPPFLAGS +=$cppflags_part1$cppflags_part2"
d14042e62c4b gnulib-tool: Addendum to 2011-06-08 commit.
Bruno Haible <bruno@clisp.org>
parents: 34599
diff changeset
3684 fi
26931
cb44f5923734 Slightly change the output generated by --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26930
diff changeset
3685 fi
26441
60b9a29627e7 Support for packages that use "gettextize --intl". From Claudio Fontana.
Bruno Haible <bruno@clisp.org>
parents: 26436
diff changeset
3686 echo
32432
aab267317cc7 gnulib-tool: avoid writing in the current directory.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32250
diff changeset
3687 if LC_ALL=C grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$tmp"/allsnippets > /dev/null \
31154
2d0270c3c30b Make it easier to distribute gnulib-built libraries.
Bruno Haible <bruno@clisp.org>
parents: 31152
diff changeset
3688 || { test -n "$makefile_name" \
2d0270c3c30b Make it easier to distribute gnulib-built libraries.
Bruno Haible <bruno@clisp.org>
parents: 31152
diff changeset
3689 && test -f "$sourcebase/Makefile.am" \
2d0270c3c30b Make it easier to distribute gnulib-built libraries.
Bruno Haible <bruno@clisp.org>
parents: 31152
diff changeset
3690 && LC_ALL=C grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$sourcebase/Makefile.am" > /dev/null; \
2d0270c3c30b Make it easier to distribute gnulib-built libraries.
Bruno Haible <bruno@clisp.org>
parents: 31152
diff changeset
3691 }; then
2d0270c3c30b Make it easier to distribute gnulib-built libraries.
Bruno Haible <bruno@clisp.org>
parents: 31152
diff changeset
3692 # One of the snippets or the user's Makefile.am already specifies an
2d0270c3c30b Make it easier to distribute gnulib-built libraries.
Bruno Haible <bruno@clisp.org>
parents: 31152
diff changeset
3693 # installation location for the library. Don't confuse automake by saying
2d0270c3c30b Make it easier to distribute gnulib-built libraries.
Bruno Haible <bruno@clisp.org>
parents: 31152
diff changeset
3694 # it should not be installed.
27392
0fa149a0a456 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 27382
diff changeset
3695 :
0fa149a0a456 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 27382
diff changeset
3696 else
0fa149a0a456 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 27382
diff changeset
3697 # By default, the generated library should not be installed.
0fa149a0a456 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 27382
diff changeset
3698 echo "noinst_${perhapsLT}LIBRARIES += $libname.$libext"
0fa149a0a456 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 27382
diff changeset
3699 fi
0fa149a0a456 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 27382
diff changeset
3700 echo
0fa149a0a456 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 27382
diff changeset
3701 echo "${libname}_${libext}_SOURCES ="
0fa149a0a456 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 27382
diff changeset
3702 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
29756
ad4401159dd5 * gnulib-tool: Fix various comment typos.
Eric Blake <ebb9@byu.net>
parents: 29578
diff changeset
3703 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
27392
0fa149a0a456 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 27382
diff changeset
3704 echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
0fa149a0a456 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 27382
diff changeset
3705 echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
0fa149a0a456 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 27382
diff changeset
3706 echo "EXTRA_${libname}_${libext}_SOURCES ="
0fa149a0a456 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 27382
diff changeset
3707 if test "$libtool" = true; then
0fa149a0a456 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 27382
diff changeset
3708 echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)"
33454
7c7507e6a11a gnulib-tool: Synthesize appropriate _LDFLAGS for a libtool library.
Bruno Haible <bruno@clisp.org>
parents: 33450
diff changeset
3709 echo "${libname}_${libext}_LDFLAGS += -no-undefined"
7c7507e6a11a gnulib-tool: Synthesize appropriate _LDFLAGS for a libtool library.
Bruno Haible <bruno@clisp.org>
parents: 33450
diff changeset
3710 # Synthesize an ${libname}_${libext}_LDFLAGS augmentation by combining
7c7507e6a11a gnulib-tool: Synthesize appropriate _LDFLAGS for a libtool library.
Bruno Haible <bruno@clisp.org>
parents: 33450
diff changeset
3711 # the link dependencies of all modules.
7c7507e6a11a gnulib-tool: Synthesize appropriate _LDFLAGS for a libtool library.
Bruno Haible <bruno@clisp.org>
parents: 33450
diff changeset
3712 for module in $modules; do
7c7507e6a11a gnulib-tool: Synthesize appropriate _LDFLAGS for a libtool library.
Bruno Haible <bruno@clisp.org>
parents: 33450
diff changeset
3713 func_verify_nontests_module
7c7507e6a11a gnulib-tool: Synthesize appropriate _LDFLAGS for a libtool library.
Bruno Haible <bruno@clisp.org>
parents: 33450
diff changeset
3714 if test -n "$module"; then
7c7507e6a11a gnulib-tool: Synthesize appropriate _LDFLAGS for a libtool library.
Bruno Haible <bruno@clisp.org>
parents: 33450
diff changeset
3715 func_get_link_directive "$module"
7c7507e6a11a gnulib-tool: Synthesize appropriate _LDFLAGS for a libtool library.
Bruno Haible <bruno@clisp.org>
parents: 33450
diff changeset
3716 fi
7c7507e6a11a gnulib-tool: Synthesize appropriate _LDFLAGS for a libtool library.
Bruno Haible <bruno@clisp.org>
parents: 33450
diff changeset
3717 done \
7c7507e6a11a gnulib-tool: Synthesize appropriate _LDFLAGS for a libtool library.
Bruno Haible <bruno@clisp.org>
parents: 33450
diff changeset
3718 | LC_ALL=C sed -e '/^$/d' -e 's/ when linking with libtool.*//' \
7c7507e6a11a gnulib-tool: Synthesize appropriate _LDFLAGS for a libtool library.
Bruno Haible <bruno@clisp.org>
parents: 33450
diff changeset
3719 | LC_ALL=C sort -u \
7c7507e6a11a gnulib-tool: Synthesize appropriate _LDFLAGS for a libtool library.
Bruno Haible <bruno@clisp.org>
parents: 33450
diff changeset
3720 | LC_ALL=C sed -e 's/^/'"${libname}_${libext}"'_LDFLAGS += /'
27392
0fa149a0a456 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 27382
diff changeset
3721 fi
0fa149a0a456 Fix double initialization of noinst_LTLIBRARIES.
Bruno Haible <bruno@clisp.org>
parents: 27382
diff changeset
3722 echo
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3723 if test -n "$pobase"; then
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3724 echo "AM_CPPFLAGS += -DDEFAULT_TEXT_DOMAIN=\\\"${po_domain}-gnulib\\\""
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3725 echo
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3726 fi
32432
aab267317cc7 gnulib-tool: avoid writing in the current directory.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32250
diff changeset
3727 cat "$tmp"/allsnippets \
33964
935a718e6928 libposix: Revert the unreviewed part of yesterday's big merge.
Bruce Korb <bkorb@gnu.org>
parents: 33962
diff changeset
3728 | sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
25048
15db1ee4db6d Fix comments. Fix parse problem.
Simon Josefsson <simon@josefsson.org>
parents: 25047
diff changeset
3729 echo
26777
f267a7269b8d Fix for "make -j 3".
Bruno Haible <bruno@clisp.org>
parents: 26770
diff changeset
3730 echo "mostlyclean-local: mostlyclean-generic"
27236
8af8018ad7be Avoid syntax error from bash 2.00 ... 2.05.
Bruno Haible <bruno@clisp.org>
parents: 27224
diff changeset
3731 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
8af8018ad7be Avoid syntax error from bash 2.00 ... 2.05.
Bruno Haible <bruno@clisp.org>
parents: 27224
diff changeset
3732 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
8af8018ad7be Avoid syntax error from bash 2.00 ... 2.05.
Bruno Haible <bruno@clisp.org>
parents: 27224
diff changeset
3733 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
8af8018ad7be Avoid syntax error from bash 2.00 ... 2.05.
Bruno Haible <bruno@clisp.org>
parents: 27224
diff changeset
3734 echo " fi; \\"
28701
3a2193f66342 Don't let the 'mostlyclean' target fail because of a nonempty directory.
Bruno Haible <bruno@clisp.org>
parents: 28700
diff changeset
3735 echo " done; \\"
3a2193f66342 Don't let the 'mostlyclean' target fail because of a nonempty directory.
Bruno Haible <bruno@clisp.org>
parents: 28700
diff changeset
3736 echo " :"
32432
aab267317cc7 gnulib-tool: avoid writing in the current directory.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32250
diff changeset
3737 rm -f "$tmp"/allsnippets
25042
4bfa248af894 Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 25041
diff changeset
3738 }
4bfa248af894 Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 25041
diff changeset
3739
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3740 # func_emit_po_Makevars
29756
ad4401159dd5 * gnulib-tool: Fix various comment typos.
Eric Blake <ebb9@byu.net>
parents: 29578
diff changeset
3741 # emits the contents of po/ makefile parameterization to standard output.
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3742 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3743 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
3744 # - modcache true or false, from --cache-modules/--no-cache-modules
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3745 # - sourcebase directory relative to destdir where to place source code
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3746 # - pobase directory relative to destdir where to place *.po files
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3747 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3748 func_emit_po_Makevars ()
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3749 {
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3750 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3751 func_emit_copyright_notice
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3752 echo
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3753 echo "# Usually the message domain is the same as the package name."
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3754 echo "# But here it has a '-gnulib' suffix."
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3755 echo "DOMAIN = ${po_domain}-gnulib"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3756 echo
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3757 echo "# These two variables depend on the location of this directory."
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3758 echo "subdir = ${pobase}"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3759 echo "top_builddir = "`echo "$pobase" | sed -e 's,//*,/,g' -e 's,[^/][^/]*,..,g'`
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3760 echo
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3761 cat <<\EOF
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3762 # These options get passed to xgettext.
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3763 XGETTEXT_OPTIONS = \
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3764 --keyword=_ --flag=_:1:pass-c-format \
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3765 --keyword=N_ --flag=N_:1:pass-c-format \
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3766 --keyword='proper_name:1,"This is a proper name. See the gettext manual, section Names."' \
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3767 --keyword='proper_name_utf8:1,"This is a proper name. See the gettext manual, section Names."' \
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3768 --flag=error:3:c-format --flag=error_at_line:5:c-format
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3769
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3770 # This is the copyright holder that gets inserted into the header of the
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3771 # $(DOMAIN).pot file. gnulib is copyrighted by the FSF.
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3772 COPYRIGHT_HOLDER = Free Software Foundation, Inc.
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3773
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3774 # This is the email address or URL to which the translators shall report
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3775 # bugs in the untranslated strings:
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3776 # - Strings which are not entire sentences, see the maintainer guidelines
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3777 # in the GNU gettext documentation, section 'Preparing Strings'.
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3778 # - Strings which use unclear terms or require additional context to be
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3779 # understood.
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3780 # - Strings which make invalid assumptions about notation of date, time or
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3781 # money.
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3782 # - Pluralisation problems.
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3783 # - Incorrect English spelling.
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3784 # - Incorrect formatting.
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3785 # It can be your email address, or a mailing list address where translators
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3786 # can write to without being subscribed, or the URL of a web page through
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3787 # which the translators can contact you.
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3788 MSGID_BUGS_ADDRESS = bug-gnulib@gnu.org
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3789
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3790 # This is the list of locale categories, beyond LC_MESSAGES, for which the
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3791 # message catalogs shall be used. It is usually empty.
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3792 EXTRA_LOCALE_CATEGORIES =
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3793
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3794 # This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3795 # context. Possible values are "yes" and "no". Set this to yes if the
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3796 # package uses functions taking also a message context, like pgettext(), or
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3797 # if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3798 USE_MSGCTXT = no
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3799 EOF
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3800 }
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3801
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3802 # func_emit_po_POTFILES_in
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3803 # emits the file list to be passed to xgettext to standard output.
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3804 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3805 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
3806 # - modcache true or false, from --cache-modules/--no-cache-modules
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3807 # - sourcebase directory relative to destdir where to place source code
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3808 # - files list of new files
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3809 func_emit_po_POTFILES_in ()
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3810 {
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3811 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3812 func_emit_copyright_notice
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3813 echo
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3814 echo "# List of files which contain translatable strings."
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3815 echo "$files" | sed -n -e "s,^lib/,$sourcebase/,p"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3816 }
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
3817
32758
3181ecfd95ec Avoid side effects from tests-related modules on the compilation of lib.
Bruno Haible <bruno@clisp.org>
parents: 32677
diff changeset
3818 # func_emit_tests_Makefile_am witness_macro
26913
2f6d41ced306 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 26907
diff changeset
3819 # emits the contents of tests makefile to standard output.
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
3820 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
3821 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
3822 # - modcache true or false, from --cache-modules/--no-cache-modules
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
3823 # - modules list of modules, including dependencies
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
3824 # - libname library name
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3825 # - auxdir directory relative to destdir where to place build aux files
38408
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3826 # - gnu_make true if --gnu-make was given, false otherwise
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
3827 # - makefile_name from --makefile-name
26768
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
3828 # - libtool true if libtool will be used, false or blank otherwise
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
3829 # - sourcebase relative directory containing lib source code
25941
337785cc74ad Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 25940
diff changeset
3830 # - m4base relative directory containing autoconf macros
337785cc74ad Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 25940
diff changeset
3831 # - testsbase relative directory containing unit test code
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3832 # - macro_prefix prefix of gl_LIBOBJS macros to use
34585
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
3833 # - witness_c_macro from --witness-c-macro
27672
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
3834 # - for_test true if creating a package for testing, false otherwise
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3835 # - single_configure true if a single configure file should be generated,
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3836 # false for a separate configure file for the tests
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3837 # - use_libtests true if a libtests.a should be built, false otherwise
34531
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3838 # - sed_replace_include_guard_prefix
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3839 # sed expression for resolving ${gl_include_guard_prefix}
30167
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3840 # - destfile filename relative to destdir of makefile being generated
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3841 # Input/Output:
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3842 # - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val}
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3843 # list of edits to be done to Makefile.am variables
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3844 # Output:
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3845 # - uses_subdirs nonempty if object files in subdirs exist
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
3846 func_emit_tests_Makefile_am ()
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
3847 {
32758
3181ecfd95ec Avoid side effects from tests-related modules on the compilation of lib.
Bruno Haible <bruno@clisp.org>
parents: 32677
diff changeset
3848 witness_macro="$1"
26768
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
3849 if test "$libtool" = true; then
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
3850 libext=la
36738
797c9c038ded gnulib-tool: Improve coding style.
Bruno Haible <bruno@clisp.org>
parents: 36737
diff changeset
3851 perhapsLT=LT
30091
1d280945b2f7 Make gnulib-tool work with native 'sed' on AIX.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 30071
diff changeset
3852 sed_eliminate_LDFLAGS="$sed_noop"
26977
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
3853 else
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
3854 libext=a
36738
797c9c038ded gnulib-tool: Improve coding style.
Bruno Haible <bruno@clisp.org>
parents: 36737
diff changeset
3855 perhapsLT=
27026
cf363255def6 * gnulib-tool: Avoid space-tab.
Eric Blake <ebb9@byu.net>
parents: 27023
diff changeset
3856 sed_eliminate_LDFLAGS='/^lib_LDFLAGS[ ]*+=/d'
26977
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
3857 fi
27672
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
3858 if $for_test; then
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
3859 # When creating a package for testing: Attempt to provoke failures,
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
3860 # especially link errors, already during "make" rather than during
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
3861 # "make check", because "make check" is not possible in a cross-compiling
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
3862 # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
3863 sed_transform_check_PROGRAMS='s,check_PROGRAMS,noinst_PROGRAMS,g'
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
3864 else
30091
1d280945b2f7 Make gnulib-tool work with native 'sed' on AIX.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 30071
diff changeset
3865 sed_transform_check_PROGRAMS="$sed_noop"
27672
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
3866 fi
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
3867 testsbase_inverse=`echo "$testsbase" | sed -e 's,/$,,' | sed -e 's,[^/][^/]*,..,g'`
27112
499aa823eee7 Mark generated files as "DO NOT EDIT".
Bruno Haible <bruno@clisp.org>
parents: 27082
diff changeset
3868 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
3869 echo "## Process this file with automake to produce Makefile.in."
26468
1b01766ac7a3 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 26456
diff changeset
3870 func_emit_copyright_notice
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
3871 echo
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3872 uses_subdirs=
31745
413a39a418c6 Fix value of uses_subdirs in tests/Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 31712
diff changeset
3873 {
26860
87d9d03750ca Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 26859
diff changeset
3874 for module in $modules; do
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3875 if $for_test && ! $single_configure; then
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3876 func_verify_tests_module
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3877 else
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3878 func_verify_module
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3879 fi
26860
87d9d03750ca Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 26859
diff changeset
3880 if test -n "$module"; then
26977
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
3881 {
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
3882 func_get_automake_snippet "$module" |
32608
8f98b62cf16d Fix incorrect Makefile.am generation in German locale.
Bruno Haible <bruno@clisp.org>
parents: 32594
diff changeset
3883 LC_ALL=C \
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
3884 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
28696
9dd6cf2c070c * gnulib-tool (IFS): Initialize early, so we don't set it to
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 28694
diff changeset
3885 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
9dd6cf2c070c * gnulib-tool (IFS): Initialize early, so we don't set it to
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 28694
diff changeset
3886 -e "$sed_eliminate_LDFLAGS" \
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3887 -e 's,lib_\([A-Z][A-Z]*\),libtests_a_\1,g' \
28696
9dd6cf2c070c * gnulib-tool (IFS): Initialize early, so we don't set it to
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 28694
diff changeset
3888 -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
9dd6cf2c070c * gnulib-tool (IFS): Initialize early, so we don't set it to
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 28694
diff changeset
3889 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
34531
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3890 -e "$sed_transform_check_PROGRAMS" \
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
3891 -e "$sed_replace_include_guard_prefix"
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3892 if $use_libtests && test "$module" = 'alloca'; then
38592
6e57d67b861f gnulib-tool: Fix generated code when libtests contains module 'alloca'.
Bruno Haible <bruno@clisp.org>
parents: 38589
diff changeset
3893 echo "libtests_a_LIBADD += @ALLOCA@"
6e57d67b861f gnulib-tool: Fix generated code when libtests contains module 'alloca'.
Bruno Haible <bruno@clisp.org>
parents: 38589
diff changeset
3894 echo "libtests_a_DEPENDENCIES += @ALLOCA@"
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3895 fi
32432
aab267317cc7 gnulib-tool: avoid writing in the current directory.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32250
diff changeset
3896 } > "$tmp"/amsnippet
29756
ad4401159dd5 * gnulib-tool: Fix various comment typos.
Eric Blake <ebb9@byu.net>
parents: 29578
diff changeset
3897 # Skip the contents if it's entirely empty.
32432
aab267317cc7 gnulib-tool: avoid writing in the current directory.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32250
diff changeset
3898 if grep '[^ ]' "$tmp"/amsnippet > /dev/null ; then
32802
7891cf6b30b3 gnulib-tool: Ensure that long-running tests are executed last.
Bruno Haible <bruno@clisp.org>
parents: 32801
diff changeset
3899 # Mention long-running tests at the end.
7891cf6b30b3 gnulib-tool: Ensure that long-running tests are executed last.
Bruno Haible <bruno@clisp.org>
parents: 32801
diff changeset
3900 ofd=3
7891cf6b30b3 gnulib-tool: Ensure that long-running tests are executed last.
Bruno Haible <bruno@clisp.org>
parents: 32801
diff changeset
3901 for word in `func_get_status "$module"`; do
7891cf6b30b3 gnulib-tool: Ensure that long-running tests are executed last.
Bruno Haible <bruno@clisp.org>
parents: 32801
diff changeset
3902 if test "$word" = 'longrunning-test'; then
7891cf6b30b3 gnulib-tool: Ensure that long-running tests are executed last.
Bruno Haible <bruno@clisp.org>
parents: 32801
diff changeset
3903 ofd=4
7891cf6b30b3 gnulib-tool: Ensure that long-running tests are executed last.
Bruno Haible <bruno@clisp.org>
parents: 32801
diff changeset
3904 break
7891cf6b30b3 gnulib-tool: Ensure that long-running tests are executed last.
Bruno Haible <bruno@clisp.org>
parents: 32801
diff changeset
3905 fi
7891cf6b30b3 gnulib-tool: Ensure that long-running tests are executed last.
Bruno Haible <bruno@clisp.org>
parents: 32801
diff changeset
3906 done
7891cf6b30b3 gnulib-tool: Ensure that long-running tests are executed last.
Bruno Haible <bruno@clisp.org>
parents: 32801
diff changeset
3907 { echo "## begin gnulib module $module"
38408
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3908 if $gnu_make; then
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3909 echo "ifeq (,\$(OMIT_GNULIB_MODULE_$module))"
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3910 fi
32802
7891cf6b30b3 gnulib-tool: Ensure that long-running tests are executed last.
Bruno Haible <bruno@clisp.org>
parents: 32801
diff changeset
3911 echo
7891cf6b30b3 gnulib-tool: Ensure that long-running tests are executed last.
Bruno Haible <bruno@clisp.org>
parents: 32801
diff changeset
3912 cat "$tmp"/amsnippet
38408
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3913 if $gnu_make; then
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3914 echo "endif"
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
3915 fi
32802
7891cf6b30b3 gnulib-tool: Ensure that long-running tests are executed last.
Bruno Haible <bruno@clisp.org>
parents: 32801
diff changeset
3916 echo "## end gnulib module $module"
7891cf6b30b3 gnulib-tool: Ensure that long-running tests are executed last.
Bruno Haible <bruno@clisp.org>
parents: 32801
diff changeset
3917 echo
7891cf6b30b3 gnulib-tool: Ensure that long-running tests are executed last.
Bruno Haible <bruno@clisp.org>
parents: 32801
diff changeset
3918 } >&$ofd
26860
87d9d03750ca Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 26859
diff changeset
3919 fi
32432
aab267317cc7 gnulib-tool: avoid writing in the current directory.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 32250
diff changeset
3920 rm -f "$tmp"/amsnippet
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3921 # Test whether there are some source files in subdirectories.
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3922 for f in `func_get_filelist "$module"`; do
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3923 case $f in
30676
18fe1b177e81 Terminate loops early when possible.
Bruno Haible <bruno@clisp.org>
parents: 30672
diff changeset
3924 lib/*/*.c | tests/*/*.c)
18fe1b177e81 Terminate loops early when possible.
Bruno Haible <bruno@clisp.org>
parents: 30672
diff changeset
3925 uses_subdirs=yes
18fe1b177e81 Terminate loops early when possible.
Bruno Haible <bruno@clisp.org>
parents: 30672
diff changeset
3926 break
18fe1b177e81 Terminate loops early when possible.
Bruno Haible <bruno@clisp.org>
parents: 30672
diff changeset
3927 ;;
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3928 esac
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3929 done
26860
87d9d03750ca Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 26859
diff changeset
3930 fi
87d9d03750ca Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 26859
diff changeset
3931 done
32802
7891cf6b30b3 gnulib-tool: Ensure that long-running tests are executed last.
Bruno Haible <bruno@clisp.org>
parents: 32801
diff changeset
3932 } 3> "$tmp"/main_snippets 4> "$tmp"/longrunning_snippets
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3933 # Generate dependencies here, since it eases the debugging of test failures.
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3934 # If there are source files in subdirectories, prevent collision of the
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3935 # object files (example: hash.c and libxml/hash.c).
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3936 subdir_options=
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3937 if test -n "$uses_subdirs"; then
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3938 subdir_options=' subdir-objects'
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3939 fi
37076
9c7fbcb4f128 deps: require Automake >= 1.9.6 in generated Makefile fragments
Stefano Lattarini <stefano.lattarini@gmail.com>
parents: 37069
diff changeset
3940 echo "AUTOMAKE_OPTIONS = 1.9.6 foreign${subdir_options}"
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3941 echo
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
3942 if $for_test && ! $single_configure; then
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3943 echo "ACLOCAL_AMFLAGS = -I ${testsbase_inverse}/${m4base}"
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3944 echo
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3945 fi
26224
830e76819296 Avoid an automake error regarding the 'gettext' module.
Bruno Haible <bruno@clisp.org>
parents: 26203
diff changeset
3946 # Nothing is being added to SUBDIRS; nevertheless the existence of this
830e76819296 Avoid an automake error regarding the 'gettext' module.
Bruno Haible <bruno@clisp.org>
parents: 26203
diff changeset
3947 # variable is needed to avoid an error from automake:
830e76819296 Avoid an automake error regarding the 'gettext' module.
Bruno Haible <bruno@clisp.org>
parents: 26203
diff changeset
3948 # "AM_GNU_GETTEXT used but SUBDIRS not defined"
32801
bf7c7dd9751c gnulib-tool: Ensure the tests in the main directory are executed first.
Bruno Haible <bruno@clisp.org>
parents: 32798
diff changeset
3949 echo "SUBDIRS = ."
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
3950 echo "TESTS ="
31986
bee4af793e1e Add xalloc-die self-test.
Simon Josefsson <simon@josefsson.org>
parents: 31979
diff changeset
3951 echo "XFAIL_TESTS ="
30423
874b4d3dec2c argp: Use standard gnulib idiom for EXEEXT.
Simon Josefsson <simon@josefsson.org>
parents: 30420
diff changeset
3952 echo "TESTS_ENVIRONMENT ="
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
3953 echo "noinst_PROGRAMS ="
27672
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
3954 if ! $for_test; then
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
3955 echo "check_PROGRAMS ="
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
3956 fi
38465
8fd35319e3a8 verify tests: Fix spurious failure with parallel make.
Bruno Haible <bruno@clisp.org>
parents: 38420
diff changeset
3957 echo "EXTRA_PROGRAMS ="
26239
e5bd008ca324 Initialize also noinst_HEADERS to empty.
Bruno Haible <bruno@clisp.org>
parents: 26238
diff changeset
3958 echo "noinst_HEADERS ="
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3959 echo "noinst_LIBRARIES ="
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3960 if $use_libtests; then
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3961 if $for_test; then
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3962 echo "noinst_LIBRARIES += libtests.a"
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3963 else
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3964 echo "check_LIBRARIES = libtests.a"
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3965 fi
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
3966 fi
36404
197b3c3ec5e8 gnulib-tool: fix imprecise comments w.r.t. an automake bug
Stefano Lattarini <stefano.lattarini@gmail.com>
parents: 36068
diff changeset
3967 # Automake versions < 1.11.4 create an empty pkgdatadir at
197b3c3ec5e8 gnulib-tool: fix imprecise comments w.r.t. an automake bug
Stefano Lattarini <stefano.lattarini@gmail.com>
parents: 36068
diff changeset
3968 # installation time if you specify pkgdata_DATA to empty.
197b3c3ec5e8 gnulib-tool: fix imprecise comments w.r.t. an automake bug
Stefano Lattarini <stefano.lattarini@gmail.com>
parents: 36068
diff changeset
3969 # See automake bugs #10997 and #11030:
38844
a8586d5e30d2 all: prefer https: URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 38818
diff changeset
3970 # * https://debbugs.gnu.org/10997
a8586d5e30d2 all: prefer https: URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 38818
diff changeset
3971 # * https://debbugs.gnu.org/11030
36404
197b3c3ec5e8 gnulib-tool: fix imprecise comments w.r.t. an automake bug
Stefano Lattarini <stefano.lattarini@gmail.com>
parents: 36068
diff changeset
3972 # So we need this workaround.
32802
7891cf6b30b3 gnulib-tool: Ensure that long-running tests are executed last.
Bruno Haible <bruno@clisp.org>
parents: 32801
diff changeset
3973 if grep '^pkgdata_DATA *+=' "$tmp"/main_snippets "$tmp"/longrunning_snippets > /dev/null; then
26860
87d9d03750ca Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 26859
diff changeset
3974 echo "pkgdata_DATA ="
87d9d03750ca Don't create a $(pkgdatadir) if there's nothing to be installed in it.
Bruno Haible <bruno@clisp.org>
parents: 26859
diff changeset
3975 fi
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
3976 echo "EXTRA_DIST ="
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
3977 echo "BUILT_SOURCES ="
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
3978 echo "SUFFIXES ="
26770
319b1c055c38 Clean core dumps.
Bruno Haible <bruno@clisp.org>
parents: 26769
diff changeset
3979 echo "MOSTLYCLEANFILES = core *.stackdump"
26553
1f4c8dd80c15 Invent MOSTLYCLEANDIRS.
Bruno Haible <bruno@clisp.org>
parents: 26468
diff changeset
3980 echo "MOSTLYCLEANDIRS ="
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
3981 echo "CLEANFILES ="
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
3982 echo "DISTCLEANFILES ="
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
3983 echo "MAINTAINERCLEANFILES ="
30167
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3984 # Execute edits that apply to the Makefile.am being generated.
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3985 edit=0
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3986 while test $edit != $makefile_am_edits; do
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3987 edit=`expr $edit + 1`
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3988 eval dir=\"\$makefile_am_edit${edit}_dir\"
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3989 eval var=\"\$makefile_am_edit${edit}_var\"
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3990 eval val=\"\$makefile_am_edit${edit}_val\"
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3991 if test -n "$var"; then
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3992 if test "${dir}Makefile.am" = "$destfile" || test "./${dir}Makefile.am" = "$destfile"; then
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3993 echo "${var} += ${val}"
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3994 eval "makefile_am_edit${edit}_var="
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3995 fi
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3996 fi
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
3997 done
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
3998 echo
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
3999 echo "AM_CPPFLAGS = \\"
32908
5cf116f4d137 Stricter declaration checking in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32802
diff changeset
4000 if $for_test; then
5cf116f4d137 Stricter declaration checking in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32802
diff changeset
4001 echo " -DGNULIB_STRICT_CHECKING=1 \\"
5cf116f4d137 Stricter declaration checking in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32802
diff changeset
4002 fi
34585
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
4003 if test -n "$witness_c_macro"; then
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
4004 echo " -D$witness_c_macro=1 \\"
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
4005 fi
32758
3181ecfd95ec Avoid side effects from tests-related modules on the compilation of lib.
Bruno Haible <bruno@clisp.org>
parents: 32677
diff changeset
4006 if test -n "${witness_macro}"; then
3181ecfd95ec Avoid side effects from tests-related modules on the compilation of lib.
Bruno Haible <bruno@clisp.org>
parents: 32677
diff changeset
4007 echo " -D@${witness_macro}@=1 \\"
3181ecfd95ec Avoid side effects from tests-related modules on the compilation of lib.
Bruno Haible <bruno@clisp.org>
parents: 32677
diff changeset
4008 fi
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
4009 echo " -I. -I\$(srcdir) \\"
25941
337785cc74ad Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 25940
diff changeset
4010 echo " -I${testsbase_inverse} -I\$(srcdir)/${testsbase_inverse} \\"
337785cc74ad Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 25940
diff changeset
4011 echo " -I${testsbase_inverse}/${sourcebase-lib} -I\$(srcdir)/${testsbase_inverse}/${sourcebase-lib}"
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
4012 echo
29231
d6ef4c61f19a Remove unnecessary -l options from LDFLAGS.
Bruno Haible <bruno@clisp.org>
parents: 29214
diff changeset
4013 local_ldadd_before=''
d6ef4c61f19a Remove unnecessary -l options from LDFLAGS.
Bruno Haible <bruno@clisp.org>
parents: 29214
diff changeset
4014 local_ldadd_after=''
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4015 if $use_libtests; then
29231
d6ef4c61f19a Remove unnecessary -l options from LDFLAGS.
Bruno Haible <bruno@clisp.org>
parents: 29214
diff changeset
4016 # All test programs need to be linked with libtests.a.
d6ef4c61f19a Remove unnecessary -l options from LDFLAGS.
Bruno Haible <bruno@clisp.org>
parents: 29214
diff changeset
4017 # It needs to be passed to the linker before ${libname}.${libext}, since
d6ef4c61f19a Remove unnecessary -l options from LDFLAGS.
Bruno Haible <bruno@clisp.org>
parents: 29214
diff changeset
4018 # the tests-related modules depend on the main modules.
d6ef4c61f19a Remove unnecessary -l options from LDFLAGS.
Bruno Haible <bruno@clisp.org>
parents: 29214
diff changeset
4019 # It also needs to be passed to the linker after ${libname}.${libext}
d6ef4c61f19a Remove unnecessary -l options from LDFLAGS.
Bruno Haible <bruno@clisp.org>
parents: 29214
diff changeset
4020 # because the latter might contain incomplete modules (such as the 'error'
d6ef4c61f19a Remove unnecessary -l options from LDFLAGS.
Bruno Haible <bruno@clisp.org>
parents: 29214
diff changeset
4021 # module whose dependency to 'progname' is voluntarily omitted).
d6ef4c61f19a Remove unnecessary -l options from LDFLAGS.
Bruno Haible <bruno@clisp.org>
parents: 29214
diff changeset
4022 # The LIBTESTS_LIBDEPS can be passed to the linker once or twice, it does
d6ef4c61f19a Remove unnecessary -l options from LDFLAGS.
Bruno Haible <bruno@clisp.org>
parents: 29214
diff changeset
4023 # not matter.
d6ef4c61f19a Remove unnecessary -l options from LDFLAGS.
Bruno Haible <bruno@clisp.org>
parents: 29214
diff changeset
4024 local_ldadd_before=' libtests.a'
d6ef4c61f19a Remove unnecessary -l options from LDFLAGS.
Bruno Haible <bruno@clisp.org>
parents: 29214
diff changeset
4025 local_ldadd_after=' libtests.a $(LIBTESTS_LIBDEPS)'
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4026 fi
29231
d6ef4c61f19a Remove unnecessary -l options from LDFLAGS.
Bruno Haible <bruno@clisp.org>
parents: 29214
diff changeset
4027 echo "LDADD =${local_ldadd_before} ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext}${local_ldadd_after}"
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
4028 echo
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4029 if $use_libtests; then
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4030 echo "libtests_a_SOURCES ="
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4031 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
29756
ad4401159dd5 * gnulib-tool: Fix various comment typos.
Eric Blake <ebb9@byu.net>
parents: 29578
diff changeset
4032 # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4033 echo "libtests_a_LIBADD = \$(${macro_prefix}tests_LIBOBJS)"
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4034 echo "libtests_a_DEPENDENCIES = \$(${macro_prefix}tests_LIBOBJS)"
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4035 echo "EXTRA_libtests_a_SOURCES ="
29214
320b0092c780 Allow circular dependency of separate libtests.a
Eric Blake <ebb9@byu.net>
parents: 29211
diff changeset
4036 # The circular dependency in LDADD requires this.
320b0092c780 Allow circular dependency of separate libtests.a
Eric Blake <ebb9@byu.net>
parents: 29211
diff changeset
4037 echo "AM_LIBTOOLFLAGS = --preserve-dup-deps"
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4038 echo
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4039 fi
32466
916e14c5b600 Provide EXEEXT and srcdir in TESTS_ENVIRONMENT by default.
Bruno Haible <bruno@clisp.org>
parents: 32434
diff changeset
4040 # Many test scripts use ${EXEEXT} or ${srcdir}.
916e14c5b600 Provide EXEEXT and srcdir in TESTS_ENVIRONMENT by default.
Bruno Haible <bruno@clisp.org>
parents: 32434
diff changeset
4041 # EXEEXT is defined by AC_PROG_CC through autoconf.
916e14c5b600 Provide EXEEXT and srcdir in TESTS_ENVIRONMENT by default.
Bruno Haible <bruno@clisp.org>
parents: 32434
diff changeset
4042 # srcdir is defined by autoconf and automake.
916e14c5b600 Provide EXEEXT and srcdir in TESTS_ENVIRONMENT by default.
Bruno Haible <bruno@clisp.org>
parents: 32434
diff changeset
4043 echo "TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='\$(srcdir)'"
916e14c5b600 Provide EXEEXT and srcdir in TESTS_ENVIRONMENT by default.
Bruno Haible <bruno@clisp.org>
parents: 32434
diff changeset
4044 echo
32802
7891cf6b30b3 gnulib-tool: Ensure that long-running tests are executed last.
Bruno Haible <bruno@clisp.org>
parents: 32801
diff changeset
4045 cat "$tmp"/main_snippets "$tmp"/longrunning_snippets \
29206
c787ec92c3e4 Fix references to the build-aux directory in the generated tests/Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 29205
diff changeset
4046 | sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
4047 echo "# Clean up after Solaris cc."
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
4048 echo "clean-local:"
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
4049 echo " rm -rf SunWS_cache"
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
4050 echo
26777
f267a7269b8d Fix for "make -j 3".
Bruno Haible <bruno@clisp.org>
parents: 26770
diff changeset
4051 echo "mostlyclean-local: mostlyclean-generic"
27236
8af8018ad7be Avoid syntax error from bash 2.00 ... 2.05.
Bruno Haible <bruno@clisp.org>
parents: 27224
diff changeset
4052 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
8af8018ad7be Avoid syntax error from bash 2.00 ... 2.05.
Bruno Haible <bruno@clisp.org>
parents: 27224
diff changeset
4053 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
8af8018ad7be Avoid syntax error from bash 2.00 ... 2.05.
Bruno Haible <bruno@clisp.org>
parents: 27224
diff changeset
4054 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
8af8018ad7be Avoid syntax error from bash 2.00 ... 2.05.
Bruno Haible <bruno@clisp.org>
parents: 27224
diff changeset
4055 echo " fi; \\"
28701
3a2193f66342 Don't let the 'mostlyclean' target fail because of a nonempty directory.
Bruno Haible <bruno@clisp.org>
parents: 28700
diff changeset
4056 echo " done; \\"
3a2193f66342 Don't let the 'mostlyclean' target fail because of a nonempty directory.
Bruno Haible <bruno@clisp.org>
parents: 28700
diff changeset
4057 echo " :"
32802
7891cf6b30b3 gnulib-tool: Ensure that long-running tests are executed last.
Bruno Haible <bruno@clisp.org>
parents: 32801
diff changeset
4058 rm -f "$tmp"/main_snippets "$tmp"/longrunning_snippets
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
4059 }
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
4060
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4061 # func_emit_initmacro_start macro_prefix
27177
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4062 # emits the first few statements of the gl_INIT macro to standard output.
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4063 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4064 func_emit_initmacro_start ()
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4065 {
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4066 macro_prefix_arg="$1"
27337
7918386e79d0 Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 27335
diff changeset
4067 # Overriding AC_LIBOBJ and AC_REPLACE_FUNCS has the effect of storing
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4068 # platform-dependent object files in ${macro_prefix_arg}_LIBOBJS instead of
27337
7918386e79d0 Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 27335
diff changeset
4069 # LIBOBJS. The purpose is to allow several gnulib instantiations under
7918386e79d0 Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 27335
diff changeset
4070 # a single configure.ac file. (AC_CONFIG_LIBOBJ_DIR does not allow this
7918386e79d0 Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 27335
diff changeset
4071 # flexibility.)
7918386e79d0 Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 27335
diff changeset
4072 # Furthermore it avoids an automake error like this when a Makefile.am
7918386e79d0 Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 27335
diff changeset
4073 # that uses pieces of gnulib also uses $(LIBOBJ):
7918386e79d0 Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 27335
diff changeset
4074 # automatically discovered file `error.c' should not be explicitly mentioned
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4075 echo " m4_pushdef([AC_LIBOBJ], m4_defn([${macro_prefix_arg}_LIBOBJ]))"
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4076 echo " m4_pushdef([AC_REPLACE_FUNCS], m4_defn([${macro_prefix_arg}_REPLACE_FUNCS]))"
27337
7918386e79d0 Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 27335
diff changeset
4077 # Overriding AC_LIBSOURCES has the same purpose of avoiding the automake
7918386e79d0 Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 27335
diff changeset
4078 # error when a Makefile.am that uses pieces of gnulib also uses $(LIBOBJ):
7918386e79d0 Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 27335
diff changeset
4079 # automatically discovered file `error.c' should not be explicitly mentioned
7918386e79d0 Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 27335
diff changeset
4080 # We let automake know about the files to be distributed through the
7918386e79d0 Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 27335
diff changeset
4081 # EXTRA_lib_SOURCES variable.
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4082 echo " m4_pushdef([AC_LIBSOURCES], m4_defn([${macro_prefix_arg}_LIBSOURCES]))"
29757
7f775a5ef686 Reduce number of forks required during autoconf.
Eric Blake <ebb9@byu.net>
parents: 29756
diff changeset
4083 # Create data variables for checking the presence of files that are mentioned
7f775a5ef686 Reduce number of forks required during autoconf.
Eric Blake <ebb9@byu.net>
parents: 29756
diff changeset
4084 # as AC_LIBSOURCES arguments. These are m4 variables, not shell variables,
7f775a5ef686 Reduce number of forks required during autoconf.
Eric Blake <ebb9@byu.net>
parents: 29756
diff changeset
4085 # because we want the check to happen when the configure file is created,
7f775a5ef686 Reduce number of forks required during autoconf.
Eric Blake <ebb9@byu.net>
parents: 29756
diff changeset
4086 # not when it is run. ${macro_prefix_arg}_LIBSOURCES_LIST is the list of
7f775a5ef686 Reduce number of forks required during autoconf.
Eric Blake <ebb9@byu.net>
parents: 29756
diff changeset
4087 # files to check for. ${macro_prefix_arg}_LIBSOURCES_DIR is the subdirectory
7f775a5ef686 Reduce number of forks required during autoconf.
Eric Blake <ebb9@byu.net>
parents: 29756
diff changeset
4088 # in which to expect them.
7f775a5ef686 Reduce number of forks required during autoconf.
Eric Blake <ebb9@byu.net>
parents: 29756
diff changeset
4089 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_LIST], [])"
7f775a5ef686 Reduce number of forks required during autoconf.
Eric Blake <ebb9@byu.net>
parents: 29756
diff changeset
4090 echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_DIR], [])"
29578
f48bc6d59682 Fix __GNUC_STDC_INLINE__ predefine with Apple GCC on MacOS X 10.5.
Bruno Haible <bruno@clisp.org>
parents: 29570
diff changeset
4091 echo " gl_COMMON"
27177
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4092 }
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4093
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4094 # func_emit_initmacro_end macro_prefix
27177
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4095 # emits the last few statements of the gl_INIT macro to standard output.
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4096 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4097 func_emit_initmacro_end ()
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4098 {
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4099 macro_prefix_arg="$1"
29757
7f775a5ef686 Reduce number of forks required during autoconf.
Eric Blake <ebb9@byu.net>
parents: 29756
diff changeset
4100 # Check the presence of files that are mentioned as AC_LIBSOURCES arguments.
7f775a5ef686 Reduce number of forks required during autoconf.
Eric Blake <ebb9@byu.net>
parents: 29756
diff changeset
4101 # The check is performed only when autoconf is run from the directory where
7f775a5ef686 Reduce number of forks required during autoconf.
Eric Blake <ebb9@byu.net>
parents: 29756
diff changeset
4102 # the configure.ac resides; if it is run from a different directory, the
7f775a5ef686 Reduce number of forks required during autoconf.
Eric Blake <ebb9@byu.net>
parents: 29756
diff changeset
4103 # check is skipped.
29758
56a12b3d8175 Oops, fix small mistake in last commit.
Bruno Haible <bruno@clisp.org>
parents: 29757
diff changeset
4104 echo " m4_ifval(${macro_prefix_arg}_LIBSOURCES_LIST, ["
29952
8ddb5699ce12 Work with tar's bootstrap.
Eric Blake <ebb9@byu.net>
parents: 29946
diff changeset
4105 echo " m4_syscmd([test ! -d ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[ ||"
29757
7f775a5ef686 Reduce number of forks required during autoconf.
Eric Blake <ebb9@byu.net>
parents: 29756
diff changeset
4106 echo " for gl_file in ]${macro_prefix_arg}_LIBSOURCES_LIST[ ; do"
29952
8ddb5699ce12 Work with tar's bootstrap.
Eric Blake <ebb9@byu.net>
parents: 29946
diff changeset
4107 echo " if test ! -r ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file ; then"
8ddb5699ce12 Work with tar's bootstrap.
Eric Blake <ebb9@byu.net>
parents: 29946
diff changeset
4108 echo " echo \"missing file ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file\" >&2"
29757
7f775a5ef686 Reduce number of forks required during autoconf.
Eric Blake <ebb9@byu.net>
parents: 29756
diff changeset
4109 echo " exit 1"
7f775a5ef686 Reduce number of forks required during autoconf.
Eric Blake <ebb9@byu.net>
parents: 29756
diff changeset
4110 echo " fi"
7f775a5ef686 Reduce number of forks required during autoconf.
Eric Blake <ebb9@byu.net>
parents: 29756
diff changeset
4111 echo " done])dnl"
7f775a5ef686 Reduce number of forks required during autoconf.
Eric Blake <ebb9@byu.net>
parents: 29756
diff changeset
4112 echo " m4_if(m4_sysval, [0], [],"
7f775a5ef686 Reduce number of forks required during autoconf.
Eric Blake <ebb9@byu.net>
parents: 29756
diff changeset
4113 echo " [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])"
7f775a5ef686 Reduce number of forks required during autoconf.
Eric Blake <ebb9@byu.net>
parents: 29756
diff changeset
4114 echo " ])"
7f775a5ef686 Reduce number of forks required during autoconf.
Eric Blake <ebb9@byu.net>
parents: 29756
diff changeset
4115 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_DIR])"
7f775a5ef686 Reduce number of forks required during autoconf.
Eric Blake <ebb9@byu.net>
parents: 29756
diff changeset
4116 echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_LIST])"
27337
7918386e79d0 Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 27335
diff changeset
4117 echo " m4_popdef([AC_LIBSOURCES])"
27177
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4118 echo " m4_popdef([AC_REPLACE_FUNCS])"
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4119 echo " m4_popdef([AC_LIBOBJ])"
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4120 echo " AC_CONFIG_COMMANDS_PRE(["
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4121 echo " ${macro_prefix_arg}_libobjs="
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4122 echo " ${macro_prefix_arg}_ltlibobjs="
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4123 echo " if test -n \"\$${macro_prefix_arg}_LIBOBJS\"; then"
27219
47a9e8e8d863 Remove duplicates from the gl_LIBOBJS list.
Bruno Haible <bruno@clisp.org>
parents: 27188
diff changeset
4124 echo " # Remove the extension."
47a9e8e8d863 Remove duplicates from the gl_LIBOBJS list.
Bruno Haible <bruno@clisp.org>
parents: 27188
diff changeset
4125 echo " sed_drop_objext='s/\\.o\$//;s/\\.obj\$//'"
32108
5419be2f034e Use sed with option -e.
Bruno Haible <bruno@clisp.org>
parents: 32001
diff changeset
4126 echo " for i in \`for i in \$${macro_prefix_arg}_LIBOBJS; do echo \"\$i\"; done | sed -e \"\$sed_drop_objext\" | sort | uniq\`; do"
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4127 echo " ${macro_prefix_arg}_libobjs=\"\$${macro_prefix_arg}_libobjs \$i.\$ac_objext\""
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4128 echo " ${macro_prefix_arg}_ltlibobjs=\"\$${macro_prefix_arg}_ltlibobjs \$i.lo\""
27177
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4129 echo " done"
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4130 echo " fi"
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4131 echo " AC_SUBST([${macro_prefix_arg}_LIBOBJS], [\$${macro_prefix_arg}_libobjs])"
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4132 echo " AC_SUBST([${macro_prefix_arg}_LTLIBOBJS], [\$${macro_prefix_arg}_ltlibobjs])"
27177
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4133 echo " ])"
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4134 }
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4135
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4136 # func_emit_initmacro_done macro_prefix sourcebase
27177
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4137 # emits a few statements after the gl_INIT macro to standard output.
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4138 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
28923
88e1700d0961 Enforce that AC_REPLACE_FUNCS files exist.
Eric Blake <ebb9@byu.net>
parents: 28906
diff changeset
4139 # - sourcebase directory relative to destdir where to place source code
27177
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4140 func_emit_initmacro_done ()
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4141 {
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4142 macro_prefix_arg="$1"
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4143 sourcebase_arg="$2"
27177
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4144 echo
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4145 echo "# Like AC_LIBOBJ, except that the module name goes"
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4146 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4147 echo "AC_DEFUN([${macro_prefix_arg}_LIBOBJ], ["
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4148 echo " AS_LITERAL_IF([\$1], [${macro_prefix_arg}_LIBSOURCES([\$1.c])])dnl"
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4149 echo " ${macro_prefix_arg}_LIBOBJS=\"\$${macro_prefix_arg}_LIBOBJS \$1.\$ac_objext\""
28928
b66be4ae98e2 m4 macro indentation.
Bruno Haible <bruno@linuix.haible.de>
parents: 28923
diff changeset
4150 echo "])"
27177
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4151 echo
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4152 echo "# Like AC_REPLACE_FUNCS, except that the module name goes"
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4153 echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4154 echo "AC_DEFUN([${macro_prefix_arg}_REPLACE_FUNCS], ["
28928
b66be4ae98e2 m4 macro indentation.
Bruno Haible <bruno@linuix.haible.de>
parents: 28923
diff changeset
4155 echo " m4_foreach_w([gl_NAME], [\$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl"
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4156 echo " AC_CHECK_FUNCS([\$1], , [${macro_prefix_arg}_LIBOBJ(\$ac_func)])"
28928
b66be4ae98e2 m4 macro indentation.
Bruno Haible <bruno@linuix.haible.de>
parents: 28923
diff changeset
4157 echo "])"
27337
7918386e79d0 Override also AC_LIBSOURCES. Works around an automake error
Bruno Haible <bruno@clisp.org>
parents: 27335
diff changeset
4158 echo
28966
869b5209f748 AC_LIBSOURCES([alloca.c]) must be a no-op, otherwise it breaks the 'alloca-opt'
Bruno Haible <bruno@clisp.org>
parents: 28928
diff changeset
4159 echo "# Like AC_LIBSOURCES, except the directory where the source file is"
29756
ad4401159dd5 * gnulib-tool: Fix various comment typos.
Eric Blake <ebb9@byu.net>
parents: 29578
diff changeset
4160 echo "# expected is derived from the gnulib-tool parameterization,"
28966
869b5209f748 AC_LIBSOURCES([alloca.c]) must be a no-op, otherwise it breaks the 'alloca-opt'
Bruno Haible <bruno@clisp.org>
parents: 28928
diff changeset
4161 echo "# and alloca is special cased (for the alloca-opt module)."
869b5209f748 AC_LIBSOURCES([alloca.c]) must be a no-op, otherwise it breaks the 'alloca-opt'
Bruno Haible <bruno@clisp.org>
parents: 28928
diff changeset
4162 echo "# We could also entirely rely on EXTRA_lib..._SOURCES."
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4163 echo "AC_DEFUN([${macro_prefix_arg}_LIBSOURCES], ["
28928
b66be4ae98e2 m4 macro indentation.
Bruno Haible <bruno@linuix.haible.de>
parents: 28923
diff changeset
4164 echo " m4_foreach([_gl_NAME], [\$1], ["
28966
869b5209f748 AC_LIBSOURCES([alloca.c]) must be a no-op, otherwise it breaks the 'alloca-opt'
Bruno Haible <bruno@clisp.org>
parents: 28928
diff changeset
4165 echo " m4_if(_gl_NAME, [alloca.c], [], ["
29757
7f775a5ef686 Reduce number of forks required during autoconf.
Eric Blake <ebb9@byu.net>
parents: 29756
diff changeset
4166 echo " m4_define([${macro_prefix_arg}_LIBSOURCES_DIR], [$sourcebase_arg])"
29761
197f55f0ea45 Avoid quadratic growth in gl_LIBSOURCES.
Eric Blake <ebb9@byu.net>
parents: 29758
diff changeset
4167 echo " m4_append([${macro_prefix_arg}_LIBSOURCES_LIST], _gl_NAME, [ ])"
28966
869b5209f748 AC_LIBSOURCES([alloca.c]) must be a no-op, otherwise it breaks the 'alloca-opt'
Bruno Haible <bruno@clisp.org>
parents: 28928
diff changeset
4168 echo " ])"
28928
b66be4ae98e2 m4 macro indentation.
Bruno Haible <bruno@linuix.haible.de>
parents: 28923
diff changeset
4169 echo " ])"
b66be4ae98e2 m4 macro indentation.
Bruno Haible <bruno@linuix.haible.de>
parents: 28923
diff changeset
4170 echo "])"
27177
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4171 }
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
4172
34363
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4173 # func_emit_autoconf_snippet indentation
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4174 # emits the autoconf snippet of a module.
34360
dc926a807a11 gnulib-tool: Reduce code duplication.
Bruno Haible <bruno@clisp.org>
parents: 34316
diff changeset
4175 # Input:
36733
d2cf52993e73 gnulib-tool: Fix indentation of generated gnulib-comp.m4 file.
Bruno Haible <bruno@clisp.org>
parents: 36730
diff changeset
4176 # - indentation spaces to prepend on each line
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4177 # - local_gnulib_path from --local-dir
34360
dc926a807a11 gnulib-tool: Reduce code duplication.
Bruno Haible <bruno@clisp.org>
parents: 34316
diff changeset
4178 # - modcache true or false, from --cache-modules/--no-cache-modules
dc926a807a11 gnulib-tool: Reduce code duplication.
Bruno Haible <bruno@clisp.org>
parents: 34316
diff changeset
4179 # - sed_replace_build_aux sed expression that replaces reference to build-aux
35813
8b54645f70fb Fix conflict between two instantiations of module 'unistd'.
Bruno Haible <bruno@clisp.org>
parents: 35545
diff changeset
4180 # - sed_replace_include_guard_prefix
8b54645f70fb Fix conflict between two instantiations of module 'unistd'.
Bruno Haible <bruno@clisp.org>
parents: 35545
diff changeset
4181 # sed expression for resolving ${gl_include_guard_prefix}
34363
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4182 # - module the module name
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4183 # - toplevel true or false. 'false' means a subordinate use of
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4184 # gnulib-tool.
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4185 # - disable_libtool true or false. It tells whether to disable libtool
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4186 # handling even if it has been specified through the
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4187 # command line options.
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4188 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4189 # invocations.
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4190 func_emit_autoconf_snippet ()
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4191 {
36733
d2cf52993e73 gnulib-tool: Fix indentation of generated gnulib-comp.m4 file.
Bruno Haible <bruno@clisp.org>
parents: 36730
diff changeset
4192 indentation="$1"
34363
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4193 if { case $module in
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4194 gnumakefile | maintainer-makefile)
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4195 # These modules are meant to be used only in the top-level directory.
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4196 $toplevel ;;
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4197 *)
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4198 true ;;
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4199 esac
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4200 }; then
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4201 func_get_autoconf_snippet "$module" \
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4202 | sed -e '/^$/d;' -e "s/^/$indentation/" \
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4203 -e "$sed_replace_build_aux" \
35813
8b54645f70fb Fix conflict between two instantiations of module 'unistd'.
Bruno Haible <bruno@clisp.org>
parents: 35545
diff changeset
4204 -e "$sed_replace_include_guard_prefix" \
34363
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4205 | { if $disable_libtool; then
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4206 sed -e 's/\$gl_cond_libtool/false/g' \
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4207 -e 's/gl_libdeps/gltests_libdeps/g' \
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4208 -e 's/gl_ltlibdeps/gltests_ltlibdeps/g'
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4209 else
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4210 cat
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4211 fi
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4212 } \
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4213 | { if $disable_gettext; then
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4214 sed -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./'
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4215 else
36960
8bcd6d4d0e06 gnulib-tool: fix incompatibility with autopoint 0.18.2
Paul Eggert <eggert@cs.ucla.edu>
parents: 36940
diff changeset
4216 # Don't indent AM_GNU_GETTEXT_VERSION line, as that confuses
8bcd6d4d0e06 gnulib-tool: fix incompatibility with autopoint 0.18.2
Paul Eggert <eggert@cs.ucla.edu>
parents: 36940
diff changeset
4217 # autopoint through at least GNU gettext version 0.18.2.
8bcd6d4d0e06 gnulib-tool: fix incompatibility with autopoint 0.18.2
Paul Eggert <eggert@cs.ucla.edu>
parents: 36940
diff changeset
4218 sed -e 's/^ *AM_GNU_GETTEXT_VERSION/AM_GNU_GETTEXT_VERSION/'
34363
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4219 fi
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4220 }
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4221 if test "$module" = 'alloca' && test "$libtool" = true && ! $disable_libtool; then
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4222 echo 'changequote(,)dnl'
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4223 echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4224 echo 'changequote([, ])dnl'
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4225 echo 'AC_SUBST([LTALLOCA])'
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4226 fi
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4227 fi
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4228 }
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4229
39193
6feb46ed08f6 gnulib-tool: Make --conditional-dependencies work better.
Bruno Haible <bruno@clisp.org>
parents: 39154
diff changeset
4230 # func_emit_autoconf_snippets modules referenceable_modules verifier toplevel disable_libtool disable_gettext
34363
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4231 # collects and emit the autoconf snippets of a set of modules.
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4232 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4233 # - local_gnulib_path from --local-dir
34363
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4234 # - modcache true or false, from --cache-modules/--no-cache-modules
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4235 # - sed_replace_build_aux sed expression that replaces reference to build-aux
35813
8b54645f70fb Fix conflict between two instantiations of module 'unistd'.
Bruno Haible <bruno@clisp.org>
parents: 35545
diff changeset
4236 # - sed_replace_include_guard_prefix
8b54645f70fb Fix conflict between two instantiations of module 'unistd'.
Bruno Haible <bruno@clisp.org>
parents: 35545
diff changeset
4237 # sed expression for resolving ${gl_include_guard_prefix}
34363
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4238 # - modules the list of modules.
39193
6feb46ed08f6 gnulib-tool: Make --conditional-dependencies work better.
Bruno Haible <bruno@clisp.org>
parents: 39154
diff changeset
4239 # - referenceable_modules the list of modules which may be referenced as dependencies.
34363
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4240 # - verifier one of func_verify_module, func_verify_nontests_module,
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4241 # func_verify_tests_module. It selects the subset of
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4242 # $modules to consider.
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4243 # - toplevel true or false. 'false' means a subordinate use of
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4244 # gnulib-tool.
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4245 # - disable_libtool true or false. It tells whether to disable libtool
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4246 # handling even if it has been specified through the
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4247 # command line options.
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4248 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
dd7051bcbb2e gnulib-tool: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 34360
diff changeset
4249 # invocations.
34360
dc926a807a11 gnulib-tool: Reduce code duplication.
Bruno Haible <bruno@clisp.org>
parents: 34316
diff changeset
4250 func_emit_autoconf_snippets ()
dc926a807a11 gnulib-tool: Reduce code duplication.
Bruno Haible <bruno@clisp.org>
parents: 34316
diff changeset
4251 {
39193
6feb46ed08f6 gnulib-tool: Make --conditional-dependencies work better.
Bruno Haible <bruno@clisp.org>
parents: 39154
diff changeset
4252 referenceable_modules="$2"
6feb46ed08f6 gnulib-tool: Make --conditional-dependencies work better.
Bruno Haible <bruno@clisp.org>
parents: 39154
diff changeset
4253 verifier="$3"
6feb46ed08f6 gnulib-tool: Make --conditional-dependencies work better.
Bruno Haible <bruno@clisp.org>
parents: 39154
diff changeset
4254 toplevel="$4"
6feb46ed08f6 gnulib-tool: Make --conditional-dependencies work better.
Bruno Haible <bruno@clisp.org>
parents: 39154
diff changeset
4255 disable_libtool="$5"
6feb46ed08f6 gnulib-tool: Make --conditional-dependencies work better.
Bruno Haible <bruno@clisp.org>
parents: 39154
diff changeset
4256 disable_gettext="$6"
34524
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
4257 if test "$cond_dependencies" = true; then
39193
6feb46ed08f6 gnulib-tool: Make --conditional-dependencies work better.
Bruno Haible <bruno@clisp.org>
parents: 39154
diff changeset
4258 for m in $referenceable_modules; do echo $m; done | LC_ALL=C sort -u > "$tmp"/modules
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4259 # Emit the autoconf code for the unconditional modules.
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4260 for module in $1; do
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4261 eval $verifier
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4262 if test -n "$module"; then
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4263 if func_cond_module_p "$module"; then
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4264 :
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4265 else
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4266 func_emit_autoconf_snippet " "
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4267 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4268 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4269 done
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4270 # Initialize the shell variables indicating that the modules are enabled.
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4271 for module in $1; do
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4272 eval $verifier
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4273 if test -n "$module"; then
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4274 if func_cond_module_p "$module"; then
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4275 func_module_shellvar_name "$module"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4276 echo " $shellvar=false"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4277 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4278 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4279 done
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4280 # Emit the autoconf code for the conditional modules, each in a separate
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4281 # function. This makes it possible to support cycles among conditional
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4282 # modules.
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4283 for module in $1; do
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4284 eval $verifier
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4285 if test -n "$module"; then
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4286 if func_cond_module_p "$module"; then
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4287 func_module_shellfunc_name "$module"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4288 func_module_shellvar_name "$module"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4289 echo " $shellfunc ()"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4290 echo ' {'
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4291 echo " if ! \$$shellvar; then"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4292 func_emit_autoconf_snippet " "
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4293 echo " $shellvar=true"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4294 deps=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
35545
e58f094d2c4d gnulib-tool: Improve last commit.
Bruno Haible <bruno@clisp.org>
parents: 35544
diff changeset
4295 # Intersect $deps with the modules list $1.
e58f094d2c4d gnulib-tool: Improve last commit.
Bruno Haible <bruno@clisp.org>
parents: 35544
diff changeset
4296 deps=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4297 for dep in $deps; do
35545
e58f094d2c4d gnulib-tool: Improve last commit.
Bruno Haible <bruno@clisp.org>
parents: 35544
diff changeset
4298 if func_cond_module_p "$dep"; then
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4299 func_module_shellfunc_name "$dep"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4300 func_cond_module_condition "$module" "$dep"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4301 if test "$condition" != true; then
35543
8117f8cbea9a gnulib-tool: fix typo that broke Emacs on powerpc-apple-darwin9.8.0.
Paul Eggert <eggert@cs.ucla.edu>
parents: 35492
diff changeset
4302 echo " if $condition; then"
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4303 echo " $shellfunc"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4304 echo ' fi'
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4305 else
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4306 echo " $shellfunc"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4307 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4308 else
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4309 # The autoconf code for $dep has already been emitted above and
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4310 # therefore is already executed when this function is run.
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4311 :
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4312 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4313 done
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4314 echo ' fi'
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4315 echo ' }'
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4316 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4317 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4318 done
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4319 # Emit the dependencies from the unconditional to the conditional modules.
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4320 for module in $1; do
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4321 eval $verifier
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4322 if test -n "$module"; then
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4323 if func_cond_module_p "$module"; then
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4324 :
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4325 else
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4326 deps=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
35545
e58f094d2c4d gnulib-tool: Improve last commit.
Bruno Haible <bruno@clisp.org>
parents: 35544
diff changeset
4327 # Intersect $deps with the modules list $1.
e58f094d2c4d gnulib-tool: Improve last commit.
Bruno Haible <bruno@clisp.org>
parents: 35544
diff changeset
4328 deps=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4329 for dep in $deps; do
35545
e58f094d2c4d gnulib-tool: Improve last commit.
Bruno Haible <bruno@clisp.org>
parents: 35544
diff changeset
4330 if func_cond_module_p "$dep"; then
34373
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4331 func_module_shellfunc_name "$dep"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4332 func_cond_module_condition "$module" "$dep"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4333 if test "$condition" != true; then
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4334 echo " if $condition; then"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4335 echo " $shellfunc"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4336 echo ' fi'
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4337 else
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4338 echo " $shellfunc"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4339 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4340 else
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4341 # The autoconf code for $dep has already been emitted above and
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4342 # therefore is already executed when this code is run.
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4343 :
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4344 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4345 done
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4346 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4347 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4348 done
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4349 # Define the Automake conditionals.
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4350 echo " m4_pattern_allow([^${macro_prefix}_GNULIB_ENABLED_])"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4351 for module in $1; do
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4352 eval $verifier
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4353 if test -n "$module"; then
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4354 if func_cond_module_p "$module"; then
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4355 func_module_conditional_name "$module"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4356 func_module_shellvar_name "$module"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4357 echo " AM_CONDITIONAL([$conditional], [\$$shellvar])"
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4358 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4359 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4360 done
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4361 else
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4362 # Ignore the conditions, and enable all modules unconditionally.
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4363 for module in $1; do
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4364 eval $verifier
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4365 if test -n "$module"; then
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4366 func_emit_autoconf_snippet " "
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4367 fi
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4368 done
d56399437013 Support for conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 34363
diff changeset
4369 fi
34360
dc926a807a11 gnulib-tool: Reduce code duplication.
Bruno Haible <bruno@clisp.org>
parents: 34316
diff changeset
4370 }
dc926a807a11 gnulib-tool: Reduce code duplication.
Bruno Haible <bruno@clisp.org>
parents: 34316
diff changeset
4371
37804
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4372 # func_emit_pre_early_macros require indentation modules
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4373 # The require parameter can be ':' (AC_REQUIRE) or 'false' (direct call).
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4374 func_emit_pre_early_macros ()
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4375 {
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4376 echo
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4377 echo "${2}# Pre-early section."
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4378 if $1; then
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4379 _pre_early_snippet="echo \"${2}AC_REQUIRE([\$_pre_early_macro])\""
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4380 else
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4381 _pre_early_snippet="echo \"${2}\$_pre_early_macro\""
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4382 fi
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4383
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4384 # We need to call gl_USE_SYSTEM_EXTENSIONS before gl_PROG_AR_RANLIB. Doing
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4385 # AC_REQUIRE in configure-ac.early is not early enough.
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4386 _pre_early_macro="gl_USE_SYSTEM_EXTENSIONS"
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4387 case "${nl}${3}${nl}" in
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4388 *${nl}extensions${nl}*) eval "$_pre_early_snippet" ;;
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4389 esac
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4390
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4391 _pre_early_macro="gl_PROG_AR_RANLIB"
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4392 eval "$_pre_early_snippet"
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4393 echo
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4394 }
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4395
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4396 # func_reconstruct_cached_dir
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4397 # callback for func_reconstruct_cached_local_gnulib_path
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4398 # Input:
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4399 # - destdir from --dir
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4400 # Output:
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4401 # - local_gnulib_path restored '--local-dir' path from cache
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4402 func_reconstruct_cached_dir ()
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4403 {
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4404 cached_dir=$1
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4405 if test -n "$cached_dir"; then
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4406 case "$destdir" in
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4407 /*)
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4408 func_path_append local_gnulib_path "$destdir/$cached_dir" ;;
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4409 *)
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4410 case "$cached_dir" in
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4411 /*)
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4412 func_path_append local_gnulib_path "$destdir/$cached_dir" ;;
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4413 *)
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4414 func_relconcat "$destdir" "$cached_dir"
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4415 func_path_append local_gnulib_path "$relconcat" ;;
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4416 esac ;;
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4417 esac
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4418 fi
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4419 }
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4420
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4421 # func_reconstruct_cached_local_gnulib_path
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4422 # reconstruct local_gnulib_path from cached_local_gnulib_path to be set
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4423 # relatively to $destdir again.
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4424 # Input:
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4425 # - cached_local_gnulib_path local_gnulib_path stored within gnulib-cache.m4
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4426 # - destdir from --dir
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4427 # Output:
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4428 # - local_gnulib_path restored '--local-dir' path from cache
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4429 func_reconstruct_cached_local_gnulib_path ()
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4430 {
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4431 func_path_foreach "$cached_local_gnulib_path" func_reconstruct_cached_dir %dir%
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4432 }
37804
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
4433
25038
7b235423ca42 Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 25037
diff changeset
4434 # func_import modules
7b235423ca42 Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 25037
diff changeset
4435 # Uses also the variables
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4436 # - mode import or add-import or remove-import or update
25038
7b235423ca42 Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 25037
diff changeset
4437 # - destdir target directory
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4438 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
4439 # - modcache true or false, from --cache-modules/--no-cache-modules
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
4440 # - verbose integer, default 0, inc/decremented by --verbose/--quiet
25038
7b235423ca42 Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 25037
diff changeset
4441 # - libname library name
33323
beef4fd2c334 gnulib-tool: Avoid error when run in a package without Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 33316
diff changeset
4442 # - supplied_libname true if --lib was given, blank otherwise
25038
7b235423ca42 Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 25037
diff changeset
4443 # - sourcebase directory relative to destdir where to place source code
7b235423ca42 Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 25037
diff changeset
4444 # - m4base directory relative to destdir where to place *.m4 macros
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
4445 # - pobase directory relative to destdir where to place *.po files
26646
17ce792d4851 * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 26643
diff changeset
4446 # - docbase directory relative to destdir where to place doc files
25941
337785cc74ad Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 25940
diff changeset
4447 # - testsbase directory relative to destdir where to place unit test code
25800
c7780c4e64f2 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 25799
diff changeset
4448 # - auxdir directory relative to destdir where to place build aux files
36623
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
4449 # - inctests true if --with-tests was given, false otherwise
30435
e8c5a9d6f576 New option --with-obsolete.
Bruno Haible <bruno@clisp.org>
parents: 30434
diff changeset
4450 # - incobsolete true if --with-obsolete was given, blank otherwise
32771
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4451 # - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4452 # - inc_longrunning_tests true if --with-longrunning-tests was given, blank
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4453 # otherwise
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4454 # - inc_privileged_tests true if --with-privileged-tests was given, blank
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4455 # otherwise
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4456 # - inc_unportable_tests true if --with-unportable-tests was given, blank
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4457 # otherwise
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4458 # - inc_all_tests true if --with-all-tests was given, blank otherwise
25672
3222d5c102c1 New option --avoid.
Bruno Haible <bruno@clisp.org>
parents: 25654
diff changeset
4459 # - avoidlist list of modules to avoid, from --avoid
34524
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
4460 # - cond_dependencies true if --conditional-dependencies was given, false if
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
4461 # --no-conditional-dependencies was given, blank otherwise
29108
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4462 # - lgpl yes or a number if library's license shall be LGPL,
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4463 # blank otherwise
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
4464 # - makefile_name from --makefile-name
26768
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
4465 # - libtool true if --libtool was given, false if --no-libtool was
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
4466 # given, blank otherwise
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
4467 # - guessed_libtool true if the configure.ac file uses libtool, false otherwise
25867
88c19369f481 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 25866
diff changeset
4468 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
4469 # - po_domain prefix of i18n domain to use (without -gnulib suffix)
34585
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
4470 # - witness_c_macro from --witness-c-macro
29501
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
4471 # - vc_files true if --vc-files was given, false if --no-vc-files was
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
4472 # given, blank otherwise
26685
c53bd2f2f3a1 Add option --assume-autoconf. Default is back to 2.59.
Bruno Haible <bruno@clisp.org>
parents: 26684
diff changeset
4473 # - autoconf_minversion minimum supported autoconf version
25937
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
4474 # - doit : if actions shall be executed, false if only to be printed
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
4475 # - copymode copy mode for files in general
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
4476 # - lcopymode copy mode for files from local_gnulib_path
28787
34d74d564f68 New gnulib-tool option --more-symlinks.
Bruno Haible <bruno@clisp.org>
parents: 28781
diff changeset
4477 # - do_copyrights true if copyright notices in files should be replaced,
34d74d564f68 New gnulib-tool option --more-symlinks.
Bruno Haible <bruno@clisp.org>
parents: 28781
diff changeset
4478 # blank otherwise
25038
7b235423ca42 Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 25037
diff changeset
4479 func_import ()
7b235423ca42 Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 25037
diff changeset
4480 {
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4481 # Get the cached settings.
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4482 # In 'import' mode, we read them only for the purpose of knowing the old
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4483 # installed file list, and don't use them as defaults.
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4484 cached_local_gnulib_path=
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4485 cached_specified_modules=
30435
e8c5a9d6f576 New option --with-obsolete.
Bruno Haible <bruno@clisp.org>
parents: 30434
diff changeset
4486 cached_incobsolete=
32771
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4487 cached_inc_cxx_tests=
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4488 cached_inc_longrunning_tests=
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4489 cached_inc_privileged_tests=
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4490 cached_inc_unportable_tests=
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4491 cached_inc_all_tests=
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4492 cached_avoidlist=
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4493 cached_sourcebase=
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4494 cached_m4base=
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
4495 cached_pobase=
26646
17ce792d4851 * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 26643
diff changeset
4496 cached_docbase=
25941
337785cc74ad Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 25940
diff changeset
4497 cached_testsbase=
28581
befe07896f09 Remember the presence of the --with-tests command-line option through
Bruno Haible <bruno@clisp.org>
parents: 28363
diff changeset
4498 cached_inctests=
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4499 cached_libname=
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4500 cached_lgpl=
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
4501 cached_makefile_name=
34524
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
4502 cached_cond_dependencies=
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4503 cached_libtool=
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4504 cached_macro_prefix=
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
4505 cached_po_domain=
34585
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
4506 cached_witness_c_macro=
29501
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
4507 cached_vc_files=
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4508 cached_files=
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4509 if test -f "$destdir"/$m4base/gnulib-cache.m4; then
26768
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
4510 cached_libtool=false
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4511 my_sed_traces='
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4512 s,#.*$,,
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4513 s,^dnl .*$,,
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4514 s, dnl .*$,,
26904
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
4515 /gl_LOCAL_DIR(/ {
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4516 s,^.*gl_LOCAL_DIR([[ ]*\([^]"$`\\)]*\).*$,cached_local_gnulib_path="\1",p
26904
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
4517 }
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4518 /gl_MODULES(/ {
29984
a15adfcdef07 Make a sed program more robust.
Bruno Haible <bruno@clisp.org>
parents: 29952
diff changeset
4519 ta
29937
9f325fe5ac55 Make gnulib-cache.m4 easier to diff.
Eric Blake <ebb9@byu.net>
parents: 29848
diff changeset
4520 :a
9f325fe5ac55 Make gnulib-cache.m4 easier to diff.
Eric Blake <ebb9@byu.net>
parents: 29848
diff changeset
4521 s/)/)/
9f325fe5ac55 Make gnulib-cache.m4 easier to diff.
Eric Blake <ebb9@byu.net>
parents: 29848
diff changeset
4522 tb
9f325fe5ac55 Make gnulib-cache.m4 easier to diff.
Eric Blake <ebb9@byu.net>
parents: 29848
diff changeset
4523 N
9f325fe5ac55 Make gnulib-cache.m4 easier to diff.
Eric Blake <ebb9@byu.net>
parents: 29848
diff changeset
4524 ba
9f325fe5ac55 Make gnulib-cache.m4 easier to diff.
Eric Blake <ebb9@byu.net>
parents: 29848
diff changeset
4525 :b
30678
1c749532df25 Fix a security bug.
Bruno Haible <bruno@clisp.org>
parents: 30677
diff changeset
4526 s,^.*gl_MODULES([[ ]*\([^]"$`\\)]*\).*$,cached_specified_modules="\1",p
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4527 }
30435
e8c5a9d6f576 New option --with-obsolete.
Bruno Haible <bruno@clisp.org>
parents: 30434
diff changeset
4528 /gl_WITH_OBSOLETE/ {
e8c5a9d6f576 New option --with-obsolete.
Bruno Haible <bruno@clisp.org>
parents: 30434
diff changeset
4529 s,^.*$,cached_incobsolete=true,p
e8c5a9d6f576 New option --with-obsolete.
Bruno Haible <bruno@clisp.org>
parents: 30434
diff changeset
4530 }
32771
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4531 /gl_WITH_CXX_TESTS/ {
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4532 s,^.*$,cached_inc_cxx_tests=true,p
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4533 }
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4534 /gl_WITH_LONGRUNNING_TESTS/ {
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4535 s,^.*$,cached_inc_longrunning_tests=true,p
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4536 }
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4537 /gl_WITH_PRIVILEGED_TESTS/ {
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4538 s,^.*$,cached_inc_privileged_tests=true,p
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4539 }
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4540 /gl_WITH_UNPORTABLE_TESTS/ {
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4541 s,^.*$,cached_inc_unportable_tests=true,p
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4542 }
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4543 /gl_WITH_ALL_TESTS/ {
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4544 s,^.*$,cached_inc_all_tests=true,p
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4545 }
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4546 /gl_AVOID(/ {
30678
1c749532df25 Fix a security bug.
Bruno Haible <bruno@clisp.org>
parents: 30677
diff changeset
4547 s,^.*gl_AVOID([[ ]*\([^]"$`\\)]*\).*$,cached_avoidlist="\1",p
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4548 }
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4549 /gl_SOURCE_BASE(/ {
30678
1c749532df25 Fix a security bug.
Bruno Haible <bruno@clisp.org>
parents: 30677
diff changeset
4550 s,^.*gl_SOURCE_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_sourcebase="\1",p
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4551 }
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4552 /gl_M4_BASE(/ {
30678
1c749532df25 Fix a security bug.
Bruno Haible <bruno@clisp.org>
parents: 30677
diff changeset
4553 s,^.*gl_M4_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_m4base="\1",p
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4554 }
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
4555 /gl_PO_BASE(/ {
30678
1c749532df25 Fix a security bug.
Bruno Haible <bruno@clisp.org>
parents: 30677
diff changeset
4556 s,^.*gl_PO_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_pobase="\1",p
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
4557 }
26646
17ce792d4851 * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 26643
diff changeset
4558 /gl_DOC_BASE(/ {
30678
1c749532df25 Fix a security bug.
Bruno Haible <bruno@clisp.org>
parents: 30677
diff changeset
4559 s,^.*gl_DOC_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_docbase="\1",p
26646
17ce792d4851 * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 26643
diff changeset
4560 }
25941
337785cc74ad Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 25940
diff changeset
4561 /gl_TESTS_BASE(/ {
30678
1c749532df25 Fix a security bug.
Bruno Haible <bruno@clisp.org>
parents: 30677
diff changeset
4562 s,^.*gl_TESTS_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_testsbase="\1",p
25941
337785cc74ad Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 25940
diff changeset
4563 }
28581
befe07896f09 Remember the presence of the --with-tests command-line option through
Bruno Haible <bruno@clisp.org>
parents: 28363
diff changeset
4564 /gl_WITH_TESTS/ {
befe07896f09 Remember the presence of the --with-tests command-line option through
Bruno Haible <bruno@clisp.org>
parents: 28363
diff changeset
4565 s,^.*$,cached_inctests=true,p
befe07896f09 Remember the presence of the --with-tests command-line option through
Bruno Haible <bruno@clisp.org>
parents: 28363
diff changeset
4566 }
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4567 /gl_LIB(/ {
30678
1c749532df25 Fix a security bug.
Bruno Haible <bruno@clisp.org>
parents: 30677
diff changeset
4568 s,^.*gl_LIB([[ ]*\([^]"$`\\)]*\).*$,cached_libname="\1",p
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4569 }
29108
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4570 /gl_LGPL(/ {
30678
1c749532df25 Fix a security bug.
Bruno Haible <bruno@clisp.org>
parents: 30677
diff changeset
4571 s,^.*gl_LGPL([[ ]*\([^]"$`\\)]*\).*$,cached_lgpl="\1",p
29108
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4572 }
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4573 /gl_LGPL/ {
29108
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4574 s,^.*$,cached_lgpl=yes,p
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4575 }
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
4576 /gl_MAKEFILE_NAME(/ {
30678
1c749532df25 Fix a security bug.
Bruno Haible <bruno@clisp.org>
parents: 30677
diff changeset
4577 s,^.*gl_MAKEFILE_NAME([[ ]*\([^]"$`\\)]*\).*$,cached_makefile_name="\1",p
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
4578 }
34524
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
4579 /gl_CONDITIONAL_DEPENDENCIES/ {
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
4580 s,^.*$,cached_cond_dependencies=true,p
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
4581 }
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4582 /gl_LIBTOOL/ {
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4583 s,^.*$,cached_libtool=true,p
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4584 }
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4585 /gl_MACRO_PREFIX(/ {
30678
1c749532df25 Fix a security bug.
Bruno Haible <bruno@clisp.org>
parents: 30677
diff changeset
4586 s,^.*gl_MACRO_PREFIX([[ ]*\([^]"$`\\)]*\).*$,cached_macro_prefix="\1",p
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
4587 }
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
4588 /gl_PO_DOMAIN(/ {
30678
1c749532df25 Fix a security bug.
Bruno Haible <bruno@clisp.org>
parents: 30677
diff changeset
4589 s,^.*gl_PO_DOMAIN([[ ]*\([^]"$`\\)]*\).*$,cached_po_domain="\1",p
29501
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
4590 }
34585
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
4591 /gl_WITNESS_C_MACRO(/ {
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
4592 s,^.*gl_WITNESS_C_MACRO([[ ]*\([^]"$`\\)]*\).*$,cached_witness_c_macro="\1",p
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
4593 }
29501
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
4594 /gl_VC_FILES(/ {
30678
1c749532df25 Fix a security bug.
Bruno Haible <bruno@clisp.org>
parents: 30677
diff changeset
4595 s,^.*gl_VC_FILES([[ ]*\([^]"$`\\)]*\).*$,cached_vc_files="\1",p
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4596 }'
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
4597 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-cache.m4`
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4598 if test -f "$destdir"/$m4base/gnulib-comp.m4; then
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4599 my_sed_traces='
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4600 s,#.*$,,
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4601 s,^dnl .*$,,
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4602 s, dnl .*$,,
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4603 /AC_DEFUN(\['"${cached_macro_prefix}"'_FILE_LIST\], \[/ {
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4604 s,^.*$,cached_files=",p
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4605 n
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4606 ta
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4607 :a
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4608 s,^\]).*$,",
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4609 tb
30678
1c749532df25 Fix a security bug.
Bruno Haible <bruno@clisp.org>
parents: 30677
diff changeset
4610 s,["$`\\],,g
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4611 p
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4612 n
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4613 ba
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4614 :b
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4615 p
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4616 }'
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
4617 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-comp.m4`
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4618 fi
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4619 fi
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4620
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4621 if test "$mode" = import; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4622 # In 'import' mode, the new set of specified modules overrides the cached
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4623 # set of modules. Ignore the cached settings.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4624 specified_modules="$1"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4625 else
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4626 # Merge the cached settings with the specified ones.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4627 # The m4base must be the same as expected from the pathname.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4628 if test -n "$cached_m4base" && test "$cached_m4base" != "$m4base"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4629 func_fatal_error "$m4base/gnulib-cache.m4 is expected to contain gl_M4_BASE([$m4base])"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4630 fi
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4631 # The local_gnulib_path defaults to the cached one. Recall that the cached one
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4632 # is relative to $destdir, whereas the one we use is relative to . or absolute.
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4633 if test -z "$local_gnulib_path"; then
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
4634 func_reconstruct_cached_local_gnulib_path
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4635 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4636 case $mode in
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4637 add-import)
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4638 # Append the cached and the specified module names. So that
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4639 # "gnulib-tool --add-import foo" means to add the module foo.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4640 specified_modules="$cached_specified_modules $1"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4641 ;;
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4642 remove-import)
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4643 # Take the cached module names, minus the specified module names.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4644 specified_modules=
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4645 if $have_associative; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4646 # Use an associative array, for O(N) worst-case run time.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4647 declare -A to_remove
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4648 for m in $1; do
33351
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
4649 eval 'to_remove[$m]=yes'
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4650 done
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4651 for module in $cached_specified_modules; do
33351
c2623cd8cdc6 gnulib-tool: work with NetBSD /bin/sh
Eric Blake <eblake@redhat.com>
parents: 33349
diff changeset
4652 if eval 'test -z "${to_remove[$module]}"'; then
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4653 func_append specified_modules "$module "
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4654 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4655 done
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4656 else
37789
44387ee93f8c maint: add coding cookies to non-ASCII sources
Paul Eggert <eggert@cs.ucla.edu>
parents: 37760
diff changeset
4657 # This loop has O(N**2) worst-case run time.
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4658 for module in $cached_specified_modules; do
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4659 to_remove=
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4660 for m in $1; do
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4661 if test "$m" = "$module"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4662 to_remove=yes
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4663 break
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4664 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4665 done
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4666 if test -z "$to_remove"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4667 func_append specified_modules "$module "
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4668 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4669 done
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4670 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4671 ;;
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4672 update)
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4673 # Take the cached module names. There are no specified module names.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4674 specified_modules="$cached_specified_modules"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4675 ;;
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4676 esac
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4677 # Included obsolete modules among the dependencies if specified either way.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4678 if test -z "$incobsolete"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4679 incobsolete="$cached_incobsolete"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4680 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4681 # Included special kinds of tests modules among the dependencies if specified
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4682 # either way.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4683 if test -z "$inc_cxx_tests"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4684 inc_cxx_tests="$cached_inc_cxx_tests"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4685 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4686 if test -z "$inc_longrunning_tests"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4687 inc_longrunning_tests="$cached_inc_longrunning_tests"
26904
368b2eb019c7 Save the --local-dir value in the cache file.
Bruno Haible <bruno@clisp.org>
parents: 26903
diff changeset
4688 fi
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4689 if test -z "$inc_privileged_tests"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4690 inc_privileged_tests="$cached_inc_privileged_tests"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4691 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4692 if test -z "$inc_unportable_tests"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4693 inc_unportable_tests="$cached_inc_unportable_tests"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4694 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4695 if test -z "$inc_all_tests"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4696 inc_all_tests="$cached_inc_all_tests"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4697 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4698 # Append the cached and the specified avoidlist. This is probably better
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4699 # than dropping the cached one when --avoid is specified at least once.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4700 avoidlist=`for m in $cached_avoidlist $avoidlist; do echo $m; done | LC_ALL=C sort -u`
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4701 avoidlist=`echo $avoidlist`
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4702
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4703 # The sourcebase defaults to the cached one.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4704 if test -z "$sourcebase"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4705 sourcebase="$cached_sourcebase"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4706 if test -z "$sourcebase"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4707 func_fatal_error "missing --source-base option"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4708 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4709 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4710 # The pobase defaults to the cached one.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4711 if test -z "$pobase"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4712 pobase="$cached_pobase"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4713 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4714 # The docbase defaults to the cached one.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4715 if test -z "$docbase"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4716 docbase="$cached_docbase"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4717 if test -z "$docbase"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4718 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."
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4719 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4720 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4721 # The testsbase defaults to the cached one.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4722 if test -z "$testsbase"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4723 testsbase="$cached_testsbase"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4724 if test -z "$testsbase"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4725 func_fatal_error "missing --tests-base option"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4726 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4727 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4728 # Require the tests if specified either way.
36623
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
4729 if ! $inctests; then
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4730 inctests="$cached_inctests"
36623
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
4731 if test -z "$inctests"; then
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
4732 inctests=false
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
4733 fi
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4734 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4735 # The libname defaults to the cached one.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4736 if test -z "$supplied_libname"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4737 libname="$cached_libname"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4738 if test -z "$libname"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4739 func_fatal_error "missing --lib option"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4740 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4741 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4742 # Require LGPL if specified either way.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4743 if test -z "$lgpl"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4744 lgpl="$cached_lgpl"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4745 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4746 # The makefile_name defaults to the cached one.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4747 if test -z "$makefile_name"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4748 makefile_name="$cached_makefile_name"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4749 fi
34524
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
4750 # Use conditional dependencies if specified either way.
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
4751 if test -z "$cond_dependencies"; then
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
4752 cond_dependencies="$cached_cond_dependencies"
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
4753 fi
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4754 # Use libtool if specified either way, or if guessed.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4755 if test -z "$libtool"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4756 if test -n "$cached_m4base"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4757 libtool="$cached_libtool"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4758 else
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4759 libtool="$guessed_libtool"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4760 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4761 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4762 # The macro_prefix defaults to the cached one.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4763 if test -z "$macro_prefix"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4764 macro_prefix="$cached_macro_prefix"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4765 if test -z "$macro_prefix"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4766 func_fatal_error "missing --macro-prefix option"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4767 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4768 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4769 # The po_domain defaults to the cached one.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4770 if test -z "$po_domain"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4771 po_domain="$cached_po_domain"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4772 fi
34585
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
4773 # The witness_c_macro defaults to the cached one.
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
4774 if test -z "$witness_c_macro"; then
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
4775 witness_c_macro="$cached_witness_c_macro"
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
4776 fi
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4777 # The vc_files defaults to the cached one.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4778 if test -z "$vc_files"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4779 vc_files="$cached_vc_files"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
4780 fi
34524
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
4781 # Ensure constraints.
36623
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
4782 if test "$cond_dependencies" = true && $inctests; then
34524
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
4783 echo "gnulib-tool: option --conditional-dependencies is not supported with --with-tests" 1>&2
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
4784 func_exit 1
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
4785 fi
32771
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
4786 fi
32954
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
4787 # --without-*-tests options are not supported here.
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
4788 excl_cxx_tests=
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
4789 excl_longrunning_tests=
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
4790 excl_privileged_tests=
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
4791 excl_unportable_tests=
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4792
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4793 # Canonicalize the list of specified modules.
27010
ad308cf77878 Use "sort -u" where it makes sense.
Bruno Haible <bruno@clisp.org>
parents: 26990
diff changeset
4794 specified_modules=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
25038
7b235423ca42 Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 25037
diff changeset
4795
32955
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
4796 # Include all kinds of tests modules if --with-all-tests was specified.
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
4797 inc_all_direct_tests="$inc_all_tests"
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
4798 inc_all_indirect_tests="$inc_all_tests"
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
4799
25038
7b235423ca42 Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 25037
diff changeset
4800 # Determine final module list.
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4801 modules="$specified_modules"
25038
7b235423ca42 Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 25037
diff changeset
4802 func_modules_transitive_closure
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
4803 if test $verbose -ge 0; then
33111
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
4804 func_show_module_list
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
4805 fi
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4806 final_modules="$modules"
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
4807
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4808 # Determine main module list and tests-related module list separately.
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
4809 func_modules_transitive_closure_separately
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4810
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4811 # Determine whether a $testsbase/libtests.a is needed.
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
4812 func_determine_use_libtests
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
4813
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
4814 # Add the dummy module to the main module list or to the tests-related module
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
4815 # list if needed.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
4816 func_modules_add_dummy_separately
26241
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
4817
26926
abb31038914f * MODULES.html.sh (Support for building documentation): Add gpl, lgpl.
Paul Eggert <eggert@cs.ucla.edu>
parents: 26913
diff changeset
4818 # If --lgpl, verify that the licenses of modules are compatible.
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
4819 if test -n "$lgpl"; then
30170
abd61bf1a0be Report all license incompatibilities during --import.
Bruno Haible <bruno@clisp.org>
parents: 30169
diff changeset
4820 license_incompatibilities=
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4821 for module in $main_modules; do
25037
f0c5068edad8 Use func_get_license.
Bruno Haible <bruno@clisp.org>
parents: 25036
diff changeset
4822 license=`func_get_license $module`
25654
bc7fda0c16d2 * gnulib-tool (func_import): Add support for 'public domain' license.
Paul Eggert <eggert@cs.ucla.edu>
parents: 25539
diff changeset
4823 case $license in
29108
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4824 'GPLed build tool') ;;
26936
c2cc22bd8cc4 Improve maintainability.
Bruno Haible <bruno@clisp.org>
parents: 26932
diff changeset
4825 'public domain' | 'unlimited' | 'unmodifiable license text') ;;
29108
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4826 *)
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4827 case "$lgpl" in
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4828 yes | 3)
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4829 case $license in
38181
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
4830 LGPLv2+ | 'LGPLv3+ or GPLv2' | LGPLv3+ | LGPL) ;;
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
4831 *) func_append license_incompatibilities "$module $license$nl" ;;
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
4832 esac
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
4833 ;;
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
4834 3orGPLv2)
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
4835 case $license in
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
4836 LGPLv2+ | 'LGPLv3+ or GPLv2') ;;
30170
abd61bf1a0be Report all license incompatibilities during --import.
Bruno Haible <bruno@clisp.org>
parents: 30169
diff changeset
4837 *) func_append license_incompatibilities "$module $license$nl" ;;
29108
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4838 esac
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4839 ;;
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4840 2)
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4841 case $license in
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4842 LGPLv2+) ;;
30170
abd61bf1a0be Report all license incompatibilities during --import.
Bruno Haible <bruno@clisp.org>
parents: 30169
diff changeset
4843 *) func_append license_incompatibilities "$module $license$nl" ;;
29108
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4844 esac
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4845 ;;
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4846 *) func_fatal_error "invalid value lgpl=$lgpl" ;;
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4847 esac
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4848 ;;
25654
bc7fda0c16d2 * gnulib-tool (func_import): Add support for 'public domain' license.
Paul Eggert <eggert@cs.ucla.edu>
parents: 25539
diff changeset
4849 esac
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
4850 done
30170
abd61bf1a0be Report all license incompatibilities during --import.
Bruno Haible <bruno@clisp.org>
parents: 30169
diff changeset
4851 if test -n "$license_incompatibilities"; then
abd61bf1a0be Report all license incompatibilities during --import.
Bruno Haible <bruno@clisp.org>
parents: 30169
diff changeset
4852 # Format the license incompatibilities as a table.
abd61bf1a0be Report all license incompatibilities during --import.
Bruno Haible <bruno@clisp.org>
parents: 30169
diff changeset
4853 sed_expand_column1_width50_indent17='s,^\([^ ]*\) ,\1 ,
abd61bf1a0be Report all license incompatibilities during --import.
Bruno Haible <bruno@clisp.org>
parents: 30169
diff changeset
4854 s,^\(.................................................[^ ]*\) *, \1 ,'
abd61bf1a0be Report all license incompatibilities during --import.
Bruno Haible <bruno@clisp.org>
parents: 30169
diff changeset
4855 license_incompatibilities=`echo "$license_incompatibilities" | sed -e "$sed_expand_column1_width50_indent17"`
abd61bf1a0be Report all license incompatibilities during --import.
Bruno Haible <bruno@clisp.org>
parents: 30169
diff changeset
4856 func_fatal_error "incompatible license on modules:$nl$license_incompatibilities"
abd61bf1a0be Report all license incompatibilities during --import.
Bruno Haible <bruno@clisp.org>
parents: 30169
diff changeset
4857 fi
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
4858 fi
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
4859
28880
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
4860 # Show banner notice of every module.
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4861 modules="$main_modules"
28880
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
4862 func_modules_notice
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
4863
26890
82012f640662 New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 26886
diff changeset
4864 # Determine script to apply to imported library files.
82012f640662 New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 26886
diff changeset
4865 sed_transform_lib_file=
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4866 for module in $main_modules; do
26936
c2cc22bd8cc4 Improve maintainability.
Bruno Haible <bruno@clisp.org>
parents: 26932
diff changeset
4867 if test $module = config-h; then
26890
82012f640662 New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 26886
diff changeset
4868 # Assume config.h exists, and that -DHAVE_CONFIG_H is omitted.
82012f640662 New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 26886
diff changeset
4869 sed_transform_lib_file=$sed_transform_lib_file'
26936
c2cc22bd8cc4 Improve maintainability.
Bruno Haible <bruno@clisp.org>
parents: 26932
diff changeset
4870 s/^#ifdef[ ]*HAVE_CONFIG_H[ ]*$/#if 1/
c2cc22bd8cc4 Improve maintainability.
Bruno Haible <bruno@clisp.org>
parents: 26932
diff changeset
4871 '
c2cc22bd8cc4 Improve maintainability.
Bruno Haible <bruno@clisp.org>
parents: 26932
diff changeset
4872 break
c2cc22bd8cc4 Improve maintainability.
Bruno Haible <bruno@clisp.org>
parents: 26932
diff changeset
4873 fi
c2cc22bd8cc4 Improve maintainability.
Bruno Haible <bruno@clisp.org>
parents: 26932
diff changeset
4874 done
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4875 sed_transform_main_lib_file="$sed_transform_lib_file"
28787
34d74d564f68 New gnulib-tool option --more-symlinks.
Bruno Haible <bruno@clisp.org>
parents: 28781
diff changeset
4876 if test -n "$do_copyrights"; then
34d74d564f68 New gnulib-tool option --more-symlinks.
Bruno Haible <bruno@clisp.org>
parents: 28781
diff changeset
4877 if test -n "$lgpl"; then
34d74d564f68 New gnulib-tool option --more-symlinks.
Bruno Haible <bruno@clisp.org>
parents: 28781
diff changeset
4878 # Update license.
29108
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4879 case "$lgpl" in
38222
c77bf8bb39ee gnulib-tool: properly list the LGPL3orGPLv2 license
Nikos Mavrogiannopoulos <nmav@gnutls.org>
parents: 38181
diff changeset
4880 yes | 3)
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4881 sed_transform_main_lib_file=$sed_transform_main_lib_file'
29108
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4882 s/GNU General/GNU Lesser General/g
34014
17ba25cca675 gnulib-tool: Make copyright notice adjustment more robust.
Bruno Haible <bruno@clisp.org>
parents: 33964
diff changeset
4883 s/General Public License/Lesser General Public License/g
17ba25cca675 gnulib-tool: Make copyright notice adjustment more robust.
Bruno Haible <bruno@clisp.org>
parents: 33964
diff changeset
4884 s/Lesser Lesser General Public License/Lesser General Public License/g
29108
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4885 '
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4886 ;;
38222
c77bf8bb39ee gnulib-tool: properly list the LGPL3orGPLv2 license
Nikos Mavrogiannopoulos <nmav@gnutls.org>
parents: 38181
diff changeset
4887 3orGPLv2)
c77bf8bb39ee gnulib-tool: properly list the LGPL3orGPLv2 license
Nikos Mavrogiannopoulos <nmav@gnutls.org>
parents: 38181
diff changeset
4888 sed_transform_main_lib_file=$sed_transform_main_lib_file'
38224
3a3b15c67245 gnulib-tool: fix the previous change
Daiki Ueno <ueno@gnu.org>
parents: 38223
diff changeset
4889 /^ *This program is free software/i\
3a3b15c67245 gnulib-tool: fix the previous change
Daiki Ueno <ueno@gnu.org>
parents: 38223
diff changeset
4890 This program is free software: you can redistribute it and\/or\
3a3b15c67245 gnulib-tool: fix the previous change
Daiki Ueno <ueno@gnu.org>
parents: 38223
diff changeset
4891 modify it under the terms of either:\
38222
c77bf8bb39ee gnulib-tool: properly list the LGPL3orGPLv2 license
Nikos Mavrogiannopoulos <nmav@gnutls.org>
parents: 38181
diff changeset
4892 \
c77bf8bb39ee gnulib-tool: properly list the LGPL3orGPLv2 license
Nikos Mavrogiannopoulos <nmav@gnutls.org>
parents: 38181
diff changeset
4893 * the GNU Lesser General Public License as published by the Free\
c77bf8bb39ee gnulib-tool: properly list the LGPL3orGPLv2 license
Nikos Mavrogiannopoulos <nmav@gnutls.org>
parents: 38181
diff changeset
4894 Software Foundation; either version 3 of the License, or (at your\
c77bf8bb39ee gnulib-tool: properly list the LGPL3orGPLv2 license
Nikos Mavrogiannopoulos <nmav@gnutls.org>
parents: 38181
diff changeset
4895 option) any later version.\
c77bf8bb39ee gnulib-tool: properly list the LGPL3orGPLv2 license
Nikos Mavrogiannopoulos <nmav@gnutls.org>
parents: 38181
diff changeset
4896 \
c77bf8bb39ee gnulib-tool: properly list the LGPL3orGPLv2 license
Nikos Mavrogiannopoulos <nmav@gnutls.org>
parents: 38181
diff changeset
4897 or\
c77bf8bb39ee gnulib-tool: properly list the LGPL3orGPLv2 license
Nikos Mavrogiannopoulos <nmav@gnutls.org>
parents: 38181
diff changeset
4898 \
c77bf8bb39ee gnulib-tool: properly list the LGPL3orGPLv2 license
Nikos Mavrogiannopoulos <nmav@gnutls.org>
parents: 38181
diff changeset
4899 * the GNU General Public License as published by the Free\
c77bf8bb39ee gnulib-tool: properly list the LGPL3orGPLv2 license
Nikos Mavrogiannopoulos <nmav@gnutls.org>
parents: 38181
diff changeset
4900 Software Foundation; either version 2 of the License, or (at your\
c77bf8bb39ee gnulib-tool: properly list the LGPL3orGPLv2 license
Nikos Mavrogiannopoulos <nmav@gnutls.org>
parents: 38181
diff changeset
4901 option) any later version.\
c77bf8bb39ee gnulib-tool: properly list the LGPL3orGPLv2 license
Nikos Mavrogiannopoulos <nmav@gnutls.org>
parents: 38181
diff changeset
4902 \
c77bf8bb39ee gnulib-tool: properly list the LGPL3orGPLv2 license
Nikos Mavrogiannopoulos <nmav@gnutls.org>
parents: 38181
diff changeset
4903 or both in parallel, as here.
38224
3a3b15c67245 gnulib-tool: fix the previous change
Daiki Ueno <ueno@gnu.org>
parents: 38223
diff changeset
4904 /^ *This program is free software/,/^$/d
38222
c77bf8bb39ee gnulib-tool: properly list the LGPL3orGPLv2 license
Nikos Mavrogiannopoulos <nmav@gnutls.org>
parents: 38181
diff changeset
4905 '
c77bf8bb39ee gnulib-tool: properly list the LGPL3orGPLv2 license
Nikos Mavrogiannopoulos <nmav@gnutls.org>
parents: 38181
diff changeset
4906 ;;
29108
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4907 2)
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4908 sed_transform_main_lib_file=$sed_transform_main_lib_file'
29108
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4909 s/GNU General/GNU Lesser General/g
34014
17ba25cca675 gnulib-tool: Make copyright notice adjustment more robust.
Bruno Haible <bruno@clisp.org>
parents: 33964
diff changeset
4910 s/General Public License/Lesser General Public License/g
17ba25cca675 gnulib-tool: Make copyright notice adjustment more robust.
Bruno Haible <bruno@clisp.org>
parents: 33964
diff changeset
4911 s/Lesser Lesser General Public License/Lesser General Public License/g
17ba25cca675 gnulib-tool: Make copyright notice adjustment more robust.
Bruno Haible <bruno@clisp.org>
parents: 33964
diff changeset
4912
29108
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4913 s/version [23]\([ ,]\)/version 2.1\1/g
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4914 '
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4915 ;;
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4916 *) func_fatal_error "invalid value lgpl=$lgpl" ;;
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
4917 esac
29115
442e3d42b107 If --lgpl is not specified, convert copyright headers to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 29108
diff changeset
4918 else
442e3d42b107 If --lgpl is not specified, convert copyright headers to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 29108
diff changeset
4919 # Update license.
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4920 sed_transform_main_lib_file=$sed_transform_main_lib_file'
29115
442e3d42b107 If --lgpl is not specified, convert copyright headers to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 29108
diff changeset
4921 s/GNU Lesser General/GNU General/g
34014
17ba25cca675 gnulib-tool: Make copyright notice adjustment more robust.
Bruno Haible <bruno@clisp.org>
parents: 33964
diff changeset
4922 s/Lesser General Public License/General Public License/g
17ba25cca675 gnulib-tool: Make copyright notice adjustment more robust.
Bruno Haible <bruno@clisp.org>
parents: 33964
diff changeset
4923
29115
442e3d42b107 If --lgpl is not specified, convert copyright headers to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 29108
diff changeset
4924 s/GNU Library General/GNU General/g
34014
17ba25cca675 gnulib-tool: Make copyright notice adjustment more robust.
Bruno Haible <bruno@clisp.org>
parents: 33964
diff changeset
4925 s/Library General Public License/General Public License/g
17ba25cca675 gnulib-tool: Make copyright notice adjustment more robust.
Bruno Haible <bruno@clisp.org>
parents: 33964
diff changeset
4926
31283
e9df426033f5 gnulib-tool: Don't use non-POSIX regexps.
Simon Josefsson <simon@josefsson.org>
parents: 31251
diff changeset
4927 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
29115
442e3d42b107 If --lgpl is not specified, convert copyright headers to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 29108
diff changeset
4928 '
28787
34d74d564f68 New gnulib-tool option --more-symlinks.
Bruno Haible <bruno@clisp.org>
parents: 28781
diff changeset
4929 fi
26890
82012f640662 New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 26886
diff changeset
4930 fi
82012f640662 New config-h module, so that "make" output needn't be cluttered
Paul Eggert <eggert@cs.ucla.edu>
parents: 26886
diff changeset
4931
31285
23c06ccf3a22 Don't do HAVE_CONFIG_H replacements on build-aux/ files.
Bruno Haible <bruno@clisp.org>
parents: 31284
diff changeset
4932 # Determine script to apply to auxiliary files that go into $auxdir/.
23c06ccf3a22 Don't do HAVE_CONFIG_H replacements on build-aux/ files.
Bruno Haible <bruno@clisp.org>
parents: 31284
diff changeset
4933 sed_transform_build_aux_file=
31284
da13cc76161d gnulib-tool: Transform license on build-aux/ files too.
Simon Josefsson <simon@josefsson.org>
parents: 31283
diff changeset
4934 if test -n "$do_copyrights"; then
da13cc76161d gnulib-tool: Transform license on build-aux/ files too.
Simon Josefsson <simon@josefsson.org>
parents: 31283
diff changeset
4935 # Update license.
da13cc76161d gnulib-tool: Transform license on build-aux/ files too.
Simon Josefsson <simon@josefsson.org>
parents: 31283
diff changeset
4936 sed_transform_build_aux_file=$sed_transform_build_aux_file'
da13cc76161d gnulib-tool: Transform license on build-aux/ files too.
Simon Josefsson <simon@josefsson.org>
parents: 31283
diff changeset
4937 s/GNU Lesser General/GNU General/g
34014
17ba25cca675 gnulib-tool: Make copyright notice adjustment more robust.
Bruno Haible <bruno@clisp.org>
parents: 33964
diff changeset
4938 s/Lesser General Public License/General Public License/g
17ba25cca675 gnulib-tool: Make copyright notice adjustment more robust.
Bruno Haible <bruno@clisp.org>
parents: 33964
diff changeset
4939
31284
da13cc76161d gnulib-tool: Transform license on build-aux/ files too.
Simon Josefsson <simon@josefsson.org>
parents: 31283
diff changeset
4940 s/GNU Library General/GNU General/g
34014
17ba25cca675 gnulib-tool: Make copyright notice adjustment more robust.
Bruno Haible <bruno@clisp.org>
parents: 33964
diff changeset
4941 s/Library General Public License/General Public License/g
17ba25cca675 gnulib-tool: Make copyright notice adjustment more robust.
Bruno Haible <bruno@clisp.org>
parents: 33964
diff changeset
4942
31284
da13cc76161d gnulib-tool: Transform license on build-aux/ files too.
Simon Josefsson <simon@josefsson.org>
parents: 31283
diff changeset
4943 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
da13cc76161d gnulib-tool: Transform license on build-aux/ files too.
Simon Josefsson <simon@josefsson.org>
parents: 31283
diff changeset
4944 '
da13cc76161d gnulib-tool: Transform license on build-aux/ files too.
Simon Josefsson <simon@josefsson.org>
parents: 31283
diff changeset
4945 fi
da13cc76161d gnulib-tool: Transform license on build-aux/ files too.
Simon Josefsson <simon@josefsson.org>
parents: 31283
diff changeset
4946
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4947 # Determine script to apply to library files that go into $testsbase/.
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4948 sed_transform_testsrelated_lib_file="$sed_transform_lib_file"
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4949 if test -n "$do_copyrights"; then
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4950 # Update license.
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4951 sed_transform_testsrelated_lib_file=$sed_transform_testsrelated_lib_file'
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4952 s/GNU Lesser General/GNU General/g
34014
17ba25cca675 gnulib-tool: Make copyright notice adjustment more robust.
Bruno Haible <bruno@clisp.org>
parents: 33964
diff changeset
4953 s/Lesser General Public License/General Public License/g
17ba25cca675 gnulib-tool: Make copyright notice adjustment more robust.
Bruno Haible <bruno@clisp.org>
parents: 33964
diff changeset
4954
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4955 s/GNU Library General/GNU General/g
34014
17ba25cca675 gnulib-tool: Make copyright notice adjustment more robust.
Bruno Haible <bruno@clisp.org>
parents: 33964
diff changeset
4956 s/Library General Public License/General Public License/g
17ba25cca675 gnulib-tool: Make copyright notice adjustment more robust.
Bruno Haible <bruno@clisp.org>
parents: 33964
diff changeset
4957
31283
e9df426033f5 gnulib-tool: Don't use non-POSIX regexps.
Simon Josefsson <simon@josefsson.org>
parents: 31251
diff changeset
4958 s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4959 '
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4960 fi
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4961
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
4962 # Determine the final file lists.
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
4963 func_modules_to_filelist_separately
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
4964
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
4965 test -n "$files" \
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
4966 || func_fatal_error "refusing to do nothing"
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
4967
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4968 # Add m4/gnulib-tool.m4 to the file list. It is not part of any module.
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4969 new_files="$files m4/gnulib-tool.m4"
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4970 old_files="$cached_files"
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4971 if test -f "$destdir"/$m4base/gnulib-tool.m4; then
27014
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
4972 func_append old_files " m4/gnulib-tool.m4"
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4973 fi
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
4974
31251
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
4975 rewritten='%REWRITTEN%'
27296
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
4976 sed_rewrite_old_files="\
31251
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
4977 s,^build-aux/,$rewritten$auxdir/,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
4978 s,^doc/,$rewritten$cached_docbase/,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
4979 s,^lib/,$rewritten$cached_sourcebase/,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
4980 s,^m4/,$rewritten$cached_m4base/,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
4981 s,^tests/,$rewritten$cached_testsbase/,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
4982 s,^tests=lib/,$rewritten$cached_testsbase/,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
4983 s,^top/,$rewritten,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
4984 s,^$rewritten,,"
27296
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
4985 sed_rewrite_new_files="\
31251
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
4986 s,^build-aux/,$rewritten$auxdir/,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
4987 s,^doc/,$rewritten$docbase/,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
4988 s,^lib/,$rewritten$sourcebase/,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
4989 s,^m4/,$rewritten$m4base/,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
4990 s,^tests/,$rewritten$testsbase/,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
4991 s,^tests=lib/,$rewritten$testsbase/,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
4992 s,^top/,$rewritten,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
4993 s,^$rewritten,,"
27296
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
4994
25874
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
4995 # Create directories.
27296
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
4996 { echo "$sourcebase"
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
4997 echo "$m4base"
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
4998 if test -n "$pobase"; then
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
4999 echo "$pobase"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5000 fi
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
5001 docfiles=`echo "$files" | sed -n -e 's,^doc/,,p'`
27296
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
5002 if test -n "$docfiles"; then
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
5003 echo "$docbase"
25937
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5004 fi
36623
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
5005 if $inctests; then
27296
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
5006 echo "$testsbase"
26646
17ce792d4851 * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 26643
diff changeset
5007 fi
27296
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
5008 echo "$auxdir"
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
5009 for f in $files; do echo $f; done \
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
5010 | sed -e "$sed_rewrite_new_files" \
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
5011 | sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
27296
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
5012 | LC_ALL=C sort -u
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
5013 } > "$tmp"/dirs
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
5014 { # Rearrange file descriptors. Needed because "while ... done < ..."
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
5015 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
5016 exec 5<&0 < "$tmp"/dirs
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
5017 while read d; do
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
5018 if test ! -d "$destdir/$d"; then
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
5019 if $doit; then
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
5020 echo "Creating directory $destdir/$d"
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
5021 mkdir -p "$destdir/$d" || func_fatal_error "failed"
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
5022 else
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
5023 echo "Create directory $destdir/$d"
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
5024 fi
25941
337785cc74ad Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 25940
diff changeset
5025 fi
27296
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
5026 done
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
5027 exec 0<&5 5<&-
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
5028 }
25874
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
5029
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
5030 # Copy files or make symbolic links or hard links. Remove obsolete files.
28142
1e4693454cba Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 28123
diff changeset
5031 added_files=''
1e4693454cba Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 28123
diff changeset
5032 removed_files=''
25936
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
5033 delimiter=' '
27012
228eda43ce3f Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 27011
diff changeset
5034 # Construct a table with 2 columns: rewritten-file-name original-file-name,
228eda43ce3f Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 27011
diff changeset
5035 # representing the files according to the last gnulib-tool invocation.
228eda43ce3f Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 27011
diff changeset
5036 for f in $old_files; do echo $f; done \
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
5037 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_old_files" \
27012
228eda43ce3f Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 27011
diff changeset
5038 | LC_ALL=C sort \
228eda43ce3f Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 27011
diff changeset
5039 > "$tmp"/old-files
228eda43ce3f Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 27011
diff changeset
5040 # Construct a table with 2 columns: rewritten-file-name original-file-name,
228eda43ce3f Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 27011
diff changeset
5041 # representing the files after this gnulib-tool invocation.
228eda43ce3f Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 27011
diff changeset
5042 for f in $new_files; do echo $f; done \
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
5043 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" \
27012
228eda43ce3f Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 27011
diff changeset
5044 | LC_ALL=C sort \
228eda43ce3f Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 27011
diff changeset
5045 > "$tmp"/new-files
25936
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
5046 # First the files that are in old-files, but not in new-files:
26286
7dddece5c620 Fix portability problem to Solaris 9 sh.
Bruno Haible <bruno@clisp.org>
parents: 26272
diff changeset
5047 sed_take_first_column='s,'"$delimiter"'.*,,'
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
5048 for g in `LC_ALL=C join -t"$delimiter" -v1 "$tmp"/old-files "$tmp"/new-files | sed -e "$sed_take_first_column"`; do
25936
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
5049 # Remove the file. Do nothing if the user already removed it.
28859
88f8d193887a Care about dangling symbolic links.
Bruno Haible <bruno@clisp.org>
parents: 28858
diff changeset
5050 if test -f "$destdir/$g" || test -h "$destdir/$g"; then
25937
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5051 if $doit; then
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5052 echo "Removing file $g (backup in ${g}~)"
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5053 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error "failed"
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5054 else
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5055 echo "Remove file $g (backup in ${g}~)"
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5056 fi
28142
1e4693454cba Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 28123
diff changeset
5057 func_append removed_files "$g$nl"
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5058 fi
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5059 done
25936
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
5060 # func_add_or_update handles a file that ought to be present afterwards.
27012
228eda43ce3f Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 27011
diff changeset
5061 # Uses parameters
228eda43ce3f Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 27011
diff changeset
5062 # - f the original file name
228eda43ce3f Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 27011
diff changeset
5063 # - g the rewritten file name
31152
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
5064 # - already_present nonempty if the file should already exist, empty
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
5065 # otherwise
25936
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
5066 func_add_or_update ()
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
5067 {
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5068 of="$f"
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5069 case "$f" in
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5070 tests=lib/*) f=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5071 esac
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5072 func_dest_tmpfilename "$g"
26764
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
5073 func_lookup_file "$f"
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
5074 cp "$lookedup_file" "$tmpfile" || func_fatal_error "failed"
38818
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5075 case "$f" in
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5076 *.class | *.mo )
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5077 # Don't process binary files with sed.
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5078 ;;
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5079 *)
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5080 if test -n "$sed_transform_main_lib_file"; then
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5081 case "$of" in
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5082 lib/*)
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5083 sed -e "$sed_transform_main_lib_file" \
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5084 < "$lookedup_file" > "$tmpfile" || func_fatal_error "failed"
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5085 ;;
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5086 esac
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5087 fi
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5088 if test -n "$sed_transform_build_aux_file"; then
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5089 case "$of" in
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5090 build-aux/*)
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5091 sed -e "$sed_transform_build_aux_file" \
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5092 < "$lookedup_file" > "$tmpfile" || func_fatal_error "failed"
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5093 ;;
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5094 esac
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5095 fi
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5096 if test -n "$sed_transform_testsrelated_lib_file"; then
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5097 case "$of" in
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5098 tests=lib/*)
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5099 sed -e "$sed_transform_testsrelated_lib_file" \
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5100 < "$lookedup_file" > "$tmpfile" || func_fatal_error "failed"
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5101 ;;
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5102 esac
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5103 fi
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5104 ;;
3d69ce37523f gnulib-tool: Simplify commit from 2015-08-20.
Bruno Haible <bruno@clisp.org>
parents: 38638
diff changeset
5105 esac
25936
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
5106 if test -f "$destdir/$g"; then
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5107 # The file already exists.
31152
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
5108 func_update_file
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5109 else
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5110 # Install the file.
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5111 # Don't protest if the file should be there but isn't: it happens
33327
445a26f3384a gnulib-tool: Don't talk about CVS any more.
Bruno Haible <bruno@clisp.org>
parents: 33325
diff changeset
5112 # frequently that developers don't put autogenerated files under version control.
31152
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
5113 func_add_file
28142
1e4693454cba Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 28123
diff changeset
5114 func_append added_files "$g$nl"
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
5115 fi
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5116 rm -f "$tmpfile"
25936
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
5117 }
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
5118 # Then the files that are in new-files, but not in old-files:
26286
7dddece5c620 Fix portability problem to Solaris 9 sh.
Bruno Haible <bruno@clisp.org>
parents: 26272
diff changeset
5119 sed_take_last_column='s,^.*'"$delimiter"',,'
25936
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
5120 already_present=
27012
228eda43ce3f Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 27011
diff changeset
5121 LC_ALL=C join -t"$delimiter" -v2 "$tmp"/old-files "$tmp"/new-files \
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
5122 | sed -e "$sed_take_last_column" \
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
5123 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/added-files
27017
a06537a4dd26 Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 27014
diff changeset
5124 { # Rearrange file descriptors. Needed because "while ... done < ..."
a06537a4dd26 Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 27014
diff changeset
5125 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
27059
19fb67891111 * gnulib-tool (func_import, func_create_testdir): Fix typos in
Eric Blake <ebb9@byu.net>
parents: 27041
diff changeset
5126 exec 5<&0 < "$tmp"/added-files
27017
a06537a4dd26 Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 27014
diff changeset
5127 while read g f; do
a06537a4dd26 Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 27014
diff changeset
5128 func_add_or_update
a06537a4dd26 Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 27014
diff changeset
5129 done
27064
e44051d6bc38 Tweak last patch, for symmetry.
Bruno Haible <bruno@clisp.org>
parents: 27059
diff changeset
5130 exec 0<&5 5<&-
27017
a06537a4dd26 Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 27014
diff changeset
5131 }
25936
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
5132 # Then the files that are in new-files and in old-files:
f742e519a637 Speed up the matching of new and old files.
Bruno Haible <bruno@clisp.org>
parents: 25904
diff changeset
5133 already_present=true
27012
228eda43ce3f Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 27011
diff changeset
5134 LC_ALL=C join -t"$delimiter" "$tmp"/old-files "$tmp"/new-files \
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
5135 | sed -e "$sed_take_last_column" \
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
5136 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/kept-files
27017
a06537a4dd26 Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 27014
diff changeset
5137 { # Rearrange file descriptors. Needed because "while ... done < ..."
a06537a4dd26 Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 27014
diff changeset
5138 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
27059
19fb67891111 * gnulib-tool (func_import, func_create_testdir): Fix typos in
Eric Blake <ebb9@byu.net>
parents: 27041
diff changeset
5139 exec 5<&0 < "$tmp"/kept-files
27017
a06537a4dd26 Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 27014
diff changeset
5140 while read g f; do
a06537a4dd26 Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 27014
diff changeset
5141 func_add_or_update
a06537a4dd26 Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 27014
diff changeset
5142 done
27064
e44051d6bc38 Tweak last patch, for symmetry.
Bruno Haible <bruno@clisp.org>
parents: 27059
diff changeset
5143 exec 0<&5 5<&-
27017
a06537a4dd26 Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 27014
diff changeset
5144 }
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
5145
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5146 # Command-line invocation printed in a comment in generated gnulib-cache.m4.
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5147 actioncmd="gnulib-tool --import"
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5148
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5149 # Local helper.
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5150 func_append_local_dir ()
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5151 {
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5152 func_append "$1" " --local-dir=$2"
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5153 }
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5154 func_path_foreach "$local_gnulib_path" func_append_local_dir actioncmd %dir%
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5155
27014
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
5156 func_append actioncmd " --lib=$libname"
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
5157 func_append actioncmd " --source-base=$sourcebase"
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
5158 func_append actioncmd " --m4-base=$m4base"
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5159 if test -n "$pobase"; then
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5160 func_append actioncmd " --po-base=$pobase"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5161 fi
27014
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
5162 func_append actioncmd " --doc-base=$docbase"
30166
e709f74a7db8 Store the --tests-base option in the comment in gnulib-cache.m4.
Yoann Vandoorselaere <yoann.v@prelude-ids.com>
parents: 30144
diff changeset
5163 func_append actioncmd " --tests-base=$testsbase"
27014
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
5164 func_append actioncmd " --aux-dir=$auxdir"
36623
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
5165 if $inctests; then
28581
befe07896f09 Remember the presence of the --with-tests command-line option through
Bruno Haible <bruno@clisp.org>
parents: 28363
diff changeset
5166 func_append actioncmd " --with-tests"
befe07896f09 Remember the presence of the --with-tests command-line option through
Bruno Haible <bruno@clisp.org>
parents: 28363
diff changeset
5167 fi
30435
e8c5a9d6f576 New option --with-obsolete.
Bruno Haible <bruno@clisp.org>
parents: 30434
diff changeset
5168 if test -n "$incobsolete"; then
e8c5a9d6f576 New option --with-obsolete.
Bruno Haible <bruno@clisp.org>
parents: 30434
diff changeset
5169 func_append actioncmd " --with-obsolete"
e8c5a9d6f576 New option --with-obsolete.
Bruno Haible <bruno@clisp.org>
parents: 30434
diff changeset
5170 fi
32771
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
5171 if test -n "$inc_cxx_tests"; then
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
5172 func_append actioncmd " --with-c++-tests"
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
5173 fi
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
5174 if test -n "$inc_longrunning_tests"; then
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
5175 func_append actioncmd " --with-longrunning-tests"
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
5176 fi
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
5177 if test -n "$inc_privileged_tests"; then
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
5178 func_append actioncmd " --with-privileged-tests"
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
5179 fi
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
5180 if test -n "$inc_unportable_tests"; then
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
5181 func_append actioncmd " --with-unportable-tests"
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
5182 fi
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
5183 if test -n "$inc_all_tests"; then
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
5184 func_append actioncmd " --with-all-tests"
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
5185 fi
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5186 for module in $avoidlist; do
27014
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
5187 func_append actioncmd " --avoid=$module"
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5188 done
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5189 if test -n "$lgpl"; then
29108
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
5190 if test "$lgpl" = yes; then
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
5191 func_append actioncmd " --lgpl"
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
5192 else
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
5193 func_append actioncmd " --lgpl=$lgpl"
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
5194 fi
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
5195 fi
38411
57934ebf9f45 gnulib-tool: fix typo in comment output
Paul Eggert <eggert@cs.ucla.edu>
parents: 38409
diff changeset
5196 if $gnu_make; then
38409
f1bcf5edd0ab gnulib-tool: minor --gnu-make fixups
Paul Eggert <eggert@cs.ucla.edu>
parents: 38408
diff changeset
5197 func_append actioncmd " --gnu-make"
f1bcf5edd0ab gnulib-tool: minor --gnu-make fixups
Paul Eggert <eggert@cs.ucla.edu>
parents: 38408
diff changeset
5198 fi
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5199 if test -n "$makefile_name"; then
27291
5296ef8a037a Fix typo in actioncmd. From Charles WIlson.
Bruno Haible <bruno@clisp.org>
parents: 27290
diff changeset
5200 func_append actioncmd " --makefile-name=$makefile_name"
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5201 fi
34524
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
5202 if test "$cond_dependencies" = true; then
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
5203 func_append actioncmd " --conditional-dependencies"
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
5204 else
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
5205 func_append actioncmd " --no-conditional-dependencies"
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
5206 fi
26768
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
5207 if test "$libtool" = true; then
27014
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
5208 func_append actioncmd " --libtool"
26768
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
5209 else
27014
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
5210 func_append actioncmd " --no-libtool"
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
5211 fi
27014
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
5212 func_append actioncmd " --macro-prefix=$macro_prefix"
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5213 if test -n "$po_domain"; then
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5214 func_append actioncmd " --po-domain=$po_domain"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5215 fi
34585
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
5216 if test -n "$witness_c_macro"; then
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
5217 func_append actioncmd " --witness-c-macro=$witness_c_macro"
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
5218 fi
29501
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5219 if test -n "$vc_files"; then
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5220 if test "$vc_files" = true; then
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5221 func_append actioncmd " --vc-files"
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5222 else
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5223 func_append actioncmd " --no-vc-files"
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5224 fi
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5225 fi
27014
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
5226 func_append actioncmd " `echo $specified_modules`"
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
5227
34531
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
5228 # Determine include_guard_prefix.
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
5229 func_compute_include_guard_prefix
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
5230
26913
2f6d41ced306 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 26907
diff changeset
5231 # Default the makefile name to Makefile.am.
2f6d41ced306 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 26907
diff changeset
5232 if test -n "$makefile_name"; then
2f6d41ced306 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 26907
diff changeset
5233 makefile_am=$makefile_name
2f6d41ced306 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 26907
diff changeset
5234 else
2f6d41ced306 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 26907
diff changeset
5235 makefile_am=Makefile.am
2f6d41ced306 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 26907
diff changeset
5236 fi
2f6d41ced306 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 26907
diff changeset
5237
27672
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
5238 # Create normal Makefile.ams.
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
5239 for_test=false
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
5240
30167
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5241 # Setup list of Makefile.am edits that are to be performed afterwards.
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5242 # Some of these edits apply to files that we will generate; others are
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5243 # under the responsibility of the developer.
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5244 makefile_am_edits=0
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5245 # func_note_Makefile_am_edit dir var value
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5246 # remembers that ${dir}Makefile.am needs to be edited to that ${var} mentions
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5247 # ${value}.
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5248 func_note_Makefile_am_edit ()
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5249 {
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5250 makefile_am_edits=`expr $makefile_am_edits + 1`
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5251 eval makefile_am_edit${makefile_am_edits}_dir=\"\$1\"
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5252 eval makefile_am_edit${makefile_am_edits}_var=\"\$2\"
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5253 eval makefile_am_edit${makefile_am_edits}_val=\"\$3\"
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5254 }
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5255 if test "$makefile_am" = Makefile.am; then
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5256 sourcebase_dir=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'`
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5257 sourcebase_base=`basename "$sourcebase"`
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5258 func_note_Makefile_am_edit "$sourcebase_dir" SUBDIRS "$sourcebase_base"
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5259 fi
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5260 if test -n "$pobase"; then
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5261 pobase_dir=`echo "$pobase" | sed -n -e 's,/[^/]*$,/,p'`
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5262 pobase_base=`basename "$pobase"`
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5263 func_note_Makefile_am_edit "$pobase_dir" SUBDIRS "$pobase_base"
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5264 fi
36623
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
5265 if $inctests; then
30167
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5266 if test "$makefile_am" = Makefile.am; then
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5267 testsbase_dir=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'`
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5268 testsbase_base=`basename "$testsbase"`
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5269 func_note_Makefile_am_edit "$testsbase_dir" SUBDIRS "$testsbase_base"
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5270 fi
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5271 fi
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5272 func_note_Makefile_am_edit "" ACLOCAL_AMFLAGS "-I ${m4base}"
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5273 {
30169
f4ffce9c671f Oops, tweak last commit so that it also works in the first gnulib-tool run.
Bruno Haible <bruno@clisp.org>
parents: 30167
diff changeset
5274 # Find the first parent directory of $m4base that contains or will contain
f4ffce9c671f Oops, tweak last commit so that it also works in the first gnulib-tool run.
Bruno Haible <bruno@clisp.org>
parents: 30167
diff changeset
5275 # a Makefile.am.
30167
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5276 sed_last='s,^.*/\([^/][^/]*\)//*$,\1/,
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5277 s,//*$,/,'
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5278 sed_butlast='s,[^/][^/]*//*$,,'
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5279 dir1="${m4base}/"; dir2=""
30169
f4ffce9c671f Oops, tweak last commit so that it also works in the first gnulib-tool run.
Bruno Haible <bruno@clisp.org>
parents: 30167
diff changeset
5280 while test -n "$dir1" \
f4ffce9c671f Oops, tweak last commit so that it also works in the first gnulib-tool run.
Bruno Haible <bruno@clisp.org>
parents: 30167
diff changeset
5281 && ! { test -f "${destdir}/${dir1}Makefile.am" \
f4ffce9c671f Oops, tweak last commit so that it also works in the first gnulib-tool run.
Bruno Haible <bruno@clisp.org>
parents: 30167
diff changeset
5282 || test "${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
f4ffce9c671f Oops, tweak last commit so that it also works in the first gnulib-tool run.
Bruno Haible <bruno@clisp.org>
parents: 30167
diff changeset
5283 || test "./${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
36623
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
5284 || { $inctests \
30169
f4ffce9c671f Oops, tweak last commit so that it also works in the first gnulib-tool run.
Bruno Haible <bruno@clisp.org>
parents: 30167
diff changeset
5285 && { test "${dir1}Makefile.am" = "$testsbase/$makefile_am" \
f4ffce9c671f Oops, tweak last commit so that it also works in the first gnulib-tool run.
Bruno Haible <bruno@clisp.org>
parents: 30167
diff changeset
5286 || test "./${dir1}Makefile.am" = "$testsbase/$makefile_am"; }; }; }; do
30167
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5287 dir2=`echo "$dir1" | sed -e "$sed_last"`"$dir2"
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5288 dir1=`echo "$dir1" | sed -e "$sed_butlast"`
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5289 done
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5290 func_note_Makefile_am_edit "$dir1" EXTRA_DIST "${dir2}gnulib-cache.m4"
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5291 }
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5292
26913
2f6d41ced306 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 26907
diff changeset
5293 # Create library makefile.
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5294 func_dest_tmpfilename $sourcebase/$makefile_am
30167
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5295 destfile="$sourcebase/$makefile_am"
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5296 modules="$main_modules"
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5297 func_emit_lib_Makefile_am > "$tmpfile"
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5298 if test -f "$destdir"/$sourcebase/$makefile_am; then
36405
b20b2a61aeb9 gnulib-tool: Avoid unintended error output from 'cmp'.
Bruno Haible <bruno@clisp.org>
parents: 36404
diff changeset
5299 if cmp -s "$destdir"/$sourcebase/$makefile_am "$tmpfile"; then
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5300 rm -f "$tmpfile"
25937
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5301 else
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5302 if $doit; then
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5303 echo "Updating $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5304 mv -f "$destdir"/$sourcebase/$makefile_am "$destdir"/$sourcebase/$makefile_am~
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5305 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
25937
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5306 else
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5307 echo "Update $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5308 rm -f "$tmpfile"
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5309 fi
25937
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5310 fi
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5311 else
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5312 if $doit; then
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5313 echo "Creating $sourcebase/$makefile_am"
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5314 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
25937
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5315 else
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5316 echo "Create $sourcebase/$makefile_am"
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5317 rm -f "$tmpfile"
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5318 fi
28142
1e4693454cba Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 28123
diff changeset
5319 func_append added_files "$sourcebase/$makefile_am$nl"
25042
4bfa248af894 Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 25041
diff changeset
5320 fi
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
5321
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5322 # Create po/ directory.
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5323 if test -n "$pobase"; then
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5324 # Create po makefile and auxiliary files.
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5325 for file in Makefile.in.in remove-potcdate.sin; do
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5326 func_dest_tmpfilename $pobase/$file
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5327 func_lookup_file build-aux/po/$file
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5328 cat "$lookedup_file" > "$tmpfile"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5329 if test -f "$destdir"/$pobase/$file; then
36405
b20b2a61aeb9 gnulib-tool: Avoid unintended error output from 'cmp'.
Bruno Haible <bruno@clisp.org>
parents: 36404
diff changeset
5330 if cmp -s "$destdir"/$pobase/$file "$tmpfile"; then
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5331 rm -f "$tmpfile"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5332 else
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5333 if $doit; then
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5334 echo "Updating $pobase/$file (backup in $pobase/$file~)"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5335 mv -f "$destdir"/$pobase/$file "$destdir"/$pobase/$file~
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5336 mv -f "$tmpfile" "$destdir"/$pobase/$file
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5337 else
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5338 echo "Update $pobase/$file (backup in $pobase/$file~)"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5339 rm -f "$tmpfile"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5340 fi
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5341 fi
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5342 else
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5343 if $doit; then
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5344 echo "Creating $pobase/$file"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5345 mv -f "$tmpfile" "$destdir"/$pobase/$file
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5346 else
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5347 echo "Create $pobase/$file"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5348 rm -f "$tmpfile"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5349 fi
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5350 func_append added_files "$pobase/$file$nl"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5351 fi
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5352 done
29756
ad4401159dd5 * gnulib-tool: Fix various comment typos.
Eric Blake <ebb9@byu.net>
parents: 29578
diff changeset
5353 # Create po makefile parameterization, part 1.
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5354 func_dest_tmpfilename $pobase/Makevars
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5355 func_emit_po_Makevars > "$tmpfile"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5356 if test -f "$destdir"/$pobase/Makevars; then
36405
b20b2a61aeb9 gnulib-tool: Avoid unintended error output from 'cmp'.
Bruno Haible <bruno@clisp.org>
parents: 36404
diff changeset
5357 if cmp -s "$destdir"/$pobase/Makevars "$tmpfile"; then
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5358 rm -f "$tmpfile"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5359 else
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5360 if $doit; then
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5361 echo "Updating $pobase/Makevars (backup in $pobase/Makevars~)"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5362 mv -f "$destdir"/$pobase/Makevars "$destdir"/$pobase/Makevars~
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5363 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5364 else
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5365 echo "Update $pobase/Makevars (backup in $pobase/Makevars~)"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5366 rm -f "$tmpfile"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5367 fi
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5368 fi
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5369 else
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5370 if $doit; then
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5371 echo "Creating $pobase/Makevars"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5372 mv -f "$tmpfile" "$destdir"/$pobase/Makevars
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5373 else
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5374 echo "Create $pobase/Makevars"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5375 rm -f "$tmpfile"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5376 fi
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5377 func_append added_files "$pobase/Makevars$nl"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5378 fi
29756
ad4401159dd5 * gnulib-tool: Fix various comment typos.
Eric Blake <ebb9@byu.net>
parents: 29578
diff changeset
5379 # Create po makefile parameterization, part 2.
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5380 func_dest_tmpfilename $pobase/POTFILES.in
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5381 func_emit_po_POTFILES_in > "$tmpfile"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5382 if test -f "$destdir"/$pobase/POTFILES.in; then
36405
b20b2a61aeb9 gnulib-tool: Avoid unintended error output from 'cmp'.
Bruno Haible <bruno@clisp.org>
parents: 36404
diff changeset
5383 if cmp -s "$destdir"/$pobase/POTFILES.in "$tmpfile"; then
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5384 rm -f "$tmpfile"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5385 else
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5386 if $doit; then
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5387 echo "Updating $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5388 mv -f "$destdir"/$pobase/POTFILES.in "$destdir"/$pobase/POTFILES.in~
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5389 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.in
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5390 else
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5391 echo "Update $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5392 rm -f "$tmpfile"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5393 fi
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5394 fi
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5395 else
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5396 if $doit; then
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5397 echo "Creating $pobase/POTFILES.in"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5398 mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.in
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5399 else
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5400 echo "Create $pobase/POTFILES.in"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5401 rm -f "$tmpfile"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5402 fi
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5403 func_append added_files "$pobase/POTFILES.in$nl"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5404 fi
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5405 # Fetch PO files.
38846
aba5dc56f9f9 all: Replace many more http URLs by https URLs. Update stale URLs.
Bruno Haible <bruno@clisp.org>
parents: 38844
diff changeset
5406 TP_URL="https://translationproject.org/latest/"
28878
f437b10b29ec Prefer rsync over wget when available.
Bruno Haible <bruno@clisp.org>
parents: 28859
diff changeset
5407 TP_RSYNC_URI="translationproject.org::tp/latest/"
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5408 if $doit; then
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5409 echo "Fetching gnulib PO files from $TP_URL"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5410 (cd "$destdir"/$pobase \
28878
f437b10b29ec Prefer rsync over wget when available.
Bruno Haible <bruno@clisp.org>
parents: 28859
diff changeset
5411 && { # Prefer rsync over wget if it is available, since it consumes
f437b10b29ec Prefer rsync over wget when available.
Bruno Haible <bruno@clisp.org>
parents: 28859
diff changeset
5412 # less network bandwidth, due to compression.
f437b10b29ec Prefer rsync over wget when available.
Bruno Haible <bruno@clisp.org>
parents: 28859
diff changeset
5413 if type rsync 2>/dev/null | grep / > /dev/null; then
37434
07f43e833f01 gnulib-tool: Sync with build-aux/bootstrap options
Mathieu Anquetin <mathieu@anquetin.eu>
parents: 37433
diff changeset
5414 rsync --delete --exclude "*.s1" -Lrtz "${TP_RSYNC_URI}gnulib/" . && return
28878
f437b10b29ec Prefer rsync over wget when available.
Bruno Haible <bruno@clisp.org>
parents: 28859
diff changeset
5415 fi
37433
f405b63d16d2 gnulib-tool: Fallback to wget when rsync fails
Mathieu Anquetin <mathieu@anquetin.eu>
parents: 37361
diff changeset
5416
37434
07f43e833f01 gnulib-tool: Sync with build-aux/bootstrap options
Mathieu Anquetin <mathieu@anquetin.eu>
parents: 37433
diff changeset
5417 wget --no-verbose --mirror -nd -np -A.po -P . "${TP_URL}gnulib/"
28878
f437b10b29ec Prefer rsync over wget when available.
Bruno Haible <bruno@clisp.org>
parents: 28859
diff changeset
5418 }
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5419 )
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5420 else
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5421 echo "Fetch gnulib PO files from $TP_URL"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5422 fi
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5423 # Create po/LINGUAS.
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5424 if $doit; then
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5425 func_dest_tmpfilename $pobase/LINGUAS
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5426 (cd "$destdir"/$pobase \
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5427 && { echo '# Set of available languages.'
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5428 LC_ALL=C ls -1 *.po | sed -e 's,\.po$,,'
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5429 }
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5430 ) > "$tmpfile"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5431 if test -f "$destdir"/$pobase/LINGUAS; then
36405
b20b2a61aeb9 gnulib-tool: Avoid unintended error output from 'cmp'.
Bruno Haible <bruno@clisp.org>
parents: 36404
diff changeset
5432 if cmp -s "$destdir"/$pobase/LINGUAS "$tmpfile"; then
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5433 rm -f "$tmpfile"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5434 else
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5435 echo "Updating $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5436 mv -f "$destdir"/$pobase/LINGUAS "$destdir"/$pobase/LINGUAS~
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5437 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5438 fi
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5439 else
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5440 echo "Creating $pobase/LINGUAS"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5441 mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5442 func_append added_files "$pobase/LINGUAS$nl"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5443 fi
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5444 else
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5445 if test -f "$destdir"/$pobase/LINGUAS; then
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5446 echo "Update $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5447 else
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5448 echo "Create $pobase/LINGUAS"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5449 fi
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5450 fi
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5451 fi
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5452
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5453 # func_count_relative_local_gnulib_path
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5454 # gl_LOCAL_DIR requires local_gnulib_path to be set relatively to destdir
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5455 # Input:
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5456 # - local_gnulib_path from --local-dir
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5457 # - destdir from --dir
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5458 # Output:
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5459 # - relative_local_dir path to be stored into gl_LOCAL_DIR
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5460 func_count_relative_local_gnulib_path ()
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5461 {
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5462 save_IFS=$IFS
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5463 IFS=$PATH_SEPARATOR
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5464 relative_local_gnulib_path=
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5465 for local_dir in $local_gnulib_path
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5466 do
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5467 # Store the local_dir relative to destdir.
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5468 case "$local_dir" in
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5469 "" | /*)
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5470 relative_local_dir="$local_dir" ;;
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5471 * )
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5472 case "$destdir" in
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5473 /*) relative_local_dir="$local_dir" ;;
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5474 *)
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5475 # destdir, local_dir are both relative.
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5476 func_relativize "$destdir" "$local_dir"
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5477 relative_local_dir="$reldir" ;;
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5478 esac ;;
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5479 esac
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5480 func_path_append relative_local_gnulib_path "$relative_local_dir"
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5481 done
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5482 IFS=$save_IFS
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5483 }
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5484
25871
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5485 # Create m4/gnulib-cache.m4.
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5486 func_dest_tmpfilename $m4base/gnulib-cache.m4
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
5487 (
26468
1b01766ac7a3 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 26456
diff changeset
5488 func_emit_copyright_notice
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
5489 echo "#"
25871
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5490 echo "# This file represents the specification of how gnulib-tool is used."
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5491 echo "# It acts as a cache: It is written and read by gnulib-tool."
33327
445a26f3384a gnulib-tool: Don't talk about CVS any more.
Bruno Haible <bruno@clisp.org>
parents: 33325
diff changeset
5492 echo "# In projects that use version control, this file is meant to be put under"
445a26f3384a gnulib-tool: Don't talk about CVS any more.
Bruno Haible <bruno@clisp.org>
parents: 33325
diff changeset
5493 echo "# version control, like the configure.ac and various Makefile.am files."
25871
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5494 echo
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5495 echo
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5496 echo "# Specification in the form of a command-line invocation:"
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5497 echo "# $actioncmd"
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5498 echo
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5499 echo "# Specification in the form of a few gnulib-tool.m4 macro invocations:"
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5500 func_count_relative_local_gnulib_path
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5501 echo "gl_LOCAL_DIR([$relative_local_gnulib_path])"
29937
9f325fe5ac55 Make gnulib-cache.m4 easier to diff.
Eric Blake <ebb9@byu.net>
parents: 29848
diff changeset
5502 echo "gl_MODULES(["
32108
5419be2f034e Use sed with option -e.
Bruno Haible <bruno@clisp.org>
parents: 32001
diff changeset
5503 echo "$specified_modules" | sed -e 's/^/ /g'
29937
9f325fe5ac55 Make gnulib-cache.m4 easier to diff.
Eric Blake <ebb9@byu.net>
parents: 29848
diff changeset
5504 echo "])"
30435
e8c5a9d6f576 New option --with-obsolete.
Bruno Haible <bruno@clisp.org>
parents: 30434
diff changeset
5505 test -z "$incobsolete" || echo "gl_WITH_OBSOLETE"
32771
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
5506 test -z "$inc_cxx_tests" || echo "gl_WITH_CXX_TESTS"
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
5507 test -z "$inc_longrunning_tests" || echo "gl_WITH_LONGRUNNING_TESTS"
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
5508 test -z "$inc_privileged_tests" || echo "gl_WITH_PRIVILEGED_TESTS"
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
5509 test -z "$inc_unportable_tests" || echo "gl_WITH_UNPORTABLE_TESTS"
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
5510 test -z "$inc_all_tests" || echo "gl_WITH_ALL_TESTS"
25871
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5511 echo "gl_AVOID([$avoidlist])"
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5512 echo "gl_SOURCE_BASE([$sourcebase])"
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5513 echo "gl_M4_BASE([$m4base])"
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5514 echo "gl_PO_BASE([$pobase])"
26646
17ce792d4851 * gnulib-tool: List --doc-base before --tests-base.
Eric Blake <ebb9@byu.net>
parents: 26643
diff changeset
5515 echo "gl_DOC_BASE([$docbase])"
25941
337785cc74ad Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 25940
diff changeset
5516 echo "gl_TESTS_BASE([$testsbase])"
36623
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
5517 if $inctests; then
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
5518 echo "gl_WITH_TESTS"
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
5519 fi
25871
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5520 echo "gl_LIB([$libname])"
29108
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
5521 if test -n "$lgpl"; then
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
5522 if test "$lgpl" = yes; then
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
5523 echo "gl_LGPL"
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
5524 else
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
5525 echo "gl_LGPL([$lgpl])"
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
5526 fi
225b39c83b0d Allow specifying the LGPL version number through --lgpl=2 or --lgpl=3.
Bruno Haible <bruno@clisp.org>
parents: 29068
diff changeset
5527 fi
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5528 echo "gl_MAKEFILE_NAME([$makefile_name])"
34524
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
5529 if test "$cond_dependencies" = true; then
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
5530 echo "gl_CONDITIONAL_DEPENDENCIES"
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
5531 fi
26768
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
5532 if test "$libtool" = true; then
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
5533 echo "gl_LIBTOOL"
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
5534 fi
25871
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5535 echo "gl_MACRO_PREFIX([$macro_prefix])"
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5536 echo "gl_PO_DOMAIN([$po_domain])"
36730
a7ae52f2ba90 gnulib-tool: Fix persistence of --witness-c-macro option.
Bruno Haible <bruno@clisp.org>
parents: 36695
diff changeset
5537 echo "gl_WITNESS_C_MACRO([$witness_c_macro])"
29501
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5538 if test -n "$vc_files"; then
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5539 echo "gl_VC_FILES([$vc_files])"
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5540 fi
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5541 ) > "$tmpfile"
25937
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5542 if test -f "$destdir"/$m4base/gnulib-cache.m4; then
36405
b20b2a61aeb9 gnulib-tool: Avoid unintended error output from 'cmp'.
Bruno Haible <bruno@clisp.org>
parents: 36404
diff changeset
5543 if cmp -s "$destdir"/$m4base/gnulib-cache.m4 "$tmpfile"; then
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5544 rm -f "$tmpfile"
25937
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5545 else
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5546 if $doit; then
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5547 echo "Updating $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5548 mv -f "$destdir"/$m4base/gnulib-cache.m4 "$destdir"/$m4base/gnulib-cache.m4~
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5549 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.m4
25937
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5550 else
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5551 echo "Update $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
25940
c7cfdeb294b4 Comment out too much verbosity in --dry-run.
Bruno Haible <bruno@clisp.org>
parents: 25939
diff changeset
5552 if false; then
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5553 cat "$tmpfile"
25940
c7cfdeb294b4 Comment out too much verbosity in --dry-run.
Bruno Haible <bruno@clisp.org>
parents: 25939
diff changeset
5554 echo
c7cfdeb294b4 Comment out too much verbosity in --dry-run.
Bruno Haible <bruno@clisp.org>
parents: 25939
diff changeset
5555 echo "# gnulib-cache.m4 ends here"
c7cfdeb294b4 Comment out too much verbosity in --dry-run.
Bruno Haible <bruno@clisp.org>
parents: 25939
diff changeset
5556 fi
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5557 rm -f "$tmpfile"
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5558 fi
25937
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5559 fi
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5560 else
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5561 if $doit; then
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5562 echo "Creating $m4base/gnulib-cache.m4"
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5563 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.m4
25937
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5564 else
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5565 echo "Create $m4base/gnulib-cache.m4"
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5566 cat "$tmpfile"
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5567 rm -f "$tmpfile"
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5568 fi
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5569 fi
25871
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5570
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5571 # Create m4/gnulib-comp.m4.
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5572 func_dest_tmpfilename $m4base/gnulib-comp.m4
25871
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5573 (
27112
499aa823eee7 Mark generated files as "DO NOT EDIT".
Bruno Haible <bruno@clisp.org>
parents: 27082
diff changeset
5574 echo "# DO NOT EDIT! GENERATED AUTOMATICALLY!"
26468
1b01766ac7a3 * gnulib-tool (func_version): Base copyright year on CVS date.
Eric Blake <ebb9@byu.net>
parents: 26456
diff changeset
5575 func_emit_copyright_notice
25871
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5576 echo "#"
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5577 echo "# This file represents the compiled summary of the specification in"
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5578 echo "# gnulib-cache.m4. It lists the computed macro invocations that need"
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5579 echo "# to be invoked from configure.ac."
33327
445a26f3384a gnulib-tool: Don't talk about CVS any more.
Bruno Haible <bruno@clisp.org>
parents: 33325
diff changeset
5580 echo "# In projects that use version control, this file can be treated like"
445a26f3384a gnulib-tool: Don't talk about CVS any more.
Bruno Haible <bruno@clisp.org>
parents: 33325
diff changeset
5581 echo "# other built files."
25871
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5582 echo
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
5583 echo
25851
98980c1ca9e4 Emit more comments and advice.
Bruno Haible <bruno@clisp.org>
parents: 25850
diff changeset
5584 echo "# This macro should be invoked from $configure_ac, in the section"
98980c1ca9e4 Emit more comments and advice.
Bruno Haible <bruno@clisp.org>
parents: 25850
diff changeset
5585 echo "# \"Checks for programs\", right after AC_PROG_CC, and certainly before"
98980c1ca9e4 Emit more comments and advice.
Bruno Haible <bruno@clisp.org>
parents: 25850
diff changeset
5586 echo "# any checks for libraries, header files, types and library functions."
25867
88c19369f481 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 25866
diff changeset
5587 echo "AC_DEFUN([${macro_prefix}_EARLY],"
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
5588 echo "["
26796
14eb29a6f15e * gnulib-tool (func_import): Detect unexpanded macros in gnulib
Eric Blake <ebb9@byu.net>
parents: 26781
diff changeset
5589 echo " m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
27177
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
5590 echo " m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
5591 echo " m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
5592 echo " m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
37794
650ee93c222a gnulib-common.m4: fix gl_PROG_AR_RANLIB/AM_PROG_AR clash
Pavel Raiskup <praiskup@redhat.com>
parents: 37789
diff changeset
5593
37804
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
5594 func_emit_pre_early_macros : ' ' "$final_modules"
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
5595
38408
16b1e35e18fa gnulib-tool: new option --gnu-make
Paul Eggert <eggert@cs.ucla.edu>
parents: 38383
diff changeset
5596 if ! $gnu_make && test -n "$uses_subdirs"; then
27332
73191cd1d374 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27331
diff changeset
5597 echo " AC_REQUIRE([AM_PROG_CC_C_O])"
73191cd1d374 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27331
diff changeset
5598 fi
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5599 for module in $final_modules; do
27770
77fe2b3ddd5c New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 27746
diff changeset
5600 func_verify_module
77fe2b3ddd5c New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 27746
diff changeset
5601 if test -n "$module"; then
32674
d8e2a660598a gnulib-tool (func_import): Explain origin of code.
Simon Josefsson <simon@josefsson.org>
parents: 32673
diff changeset
5602 echo "# Code from module $module:"
27770
77fe2b3ddd5c New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 27746
diff changeset
5603 func_get_autoconf_early_snippet "$module"
77fe2b3ddd5c New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 27746
diff changeset
5604 fi
77fe2b3ddd5c New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 27746
diff changeset
5605 done \
77fe2b3ddd5c New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 27746
diff changeset
5606 | sed -e '/^$/d;' -e 's/^/ /'
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
5607 echo "])"
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
5608 echo
25851
98980c1ca9e4 Emit more comments and advice.
Bruno Haible <bruno@clisp.org>
parents: 25850
diff changeset
5609 echo "# This macro should be invoked from $configure_ac, in the section"
98980c1ca9e4 Emit more comments and advice.
Bruno Haible <bruno@clisp.org>
parents: 25850
diff changeset
5610 echo "# \"Check for header files, types and library functions\"."
25867
88c19369f481 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 25866
diff changeset
5611 echo "AC_DEFUN([${macro_prefix}_INIT],"
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
5612 echo "["
26768
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
5613 if test "$libtool" = true; then
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
5614 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
26977
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
5615 echo " gl_cond_libtool=true"
26768
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
5616 else
26203
c33fb7d85613 RANLIB is needed.
Bruno Haible <bruno@clisp.org>
parents: 26155
diff changeset
5617 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
26977
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
5618 echo " gl_cond_libtool=false"
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
5619 echo " gl_libdeps="
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
5620 echo " gl_ltlibdeps="
26105
0ee5938698ba * gnulib-tool: Define automake conditional GL_COND_LIBTOOL if
Simon Josefsson <simon@josefsson.org>
parents: 26080
diff changeset
5621 fi
26247
065ab263d5d5 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 26242
diff changeset
5622 if test "$auxdir" != "build-aux"; then
065ab263d5d5 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 26242
diff changeset
5623 sed_replace_build_aux='
065ab263d5d5 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 26242
diff changeset
5624 :a
065ab263d5d5 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 26242
diff changeset
5625 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
065ab263d5d5 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 26242
diff changeset
5626 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
065ab263d5d5 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 26242
diff changeset
5627 ba
065ab263d5d5 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 26242
diff changeset
5628 }'
065ab263d5d5 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 26242
diff changeset
5629 else
30091
1d280945b2f7 Make gnulib-tool work with native 'sed' on AIX.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 30071
diff changeset
5630 sed_replace_build_aux="$sed_noop"
26247
065ab263d5d5 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 26242
diff changeset
5631 fi
32796
e6c5cb9d161b gnulib-tool: Provide the value of --m4-base to modules.
Bruno Haible <bruno@clisp.org>
parents: 32781
diff changeset
5632 echo " gl_m4_base='$m4base'"
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5633 func_emit_initmacro_start $macro_prefix
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5634 echo " gl_source_base='$sourcebase'"
34585
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
5635 if test -n "$witness_c_macro"; then
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
5636 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$witness_c_macro])"
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
5637 fi
39193
6feb46ed08f6 gnulib-tool: Make --conditional-dependencies work better.
Bruno Haible <bruno@clisp.org>
parents: 39154
diff changeset
5638 func_emit_autoconf_snippets "$main_modules" "$main_modules" func_verify_module true false true
34585
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
5639 if test -n "$witness_c_macro"; then
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
5640 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
5641 fi
32674
d8e2a660598a gnulib-tool (func_import): Explain origin of code.
Simon Josefsson <simon@josefsson.org>
parents: 32673
diff changeset
5642 echo " # End of code from modules"
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5643 func_emit_initmacro_end $macro_prefix
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5644 echo " gltests_libdeps="
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5645 echo " gltests_ltlibdeps="
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5646 func_emit_initmacro_start ${macro_prefix}tests
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5647 echo " gl_source_base='$testsbase'"
32758
3181ecfd95ec Avoid side effects from tests-related modules on the compilation of lib.
Bruno Haible <bruno@clisp.org>
parents: 32677
diff changeset
5648 # Define a tests witness macro that depends on the package.
3181ecfd95ec Avoid side effects from tests-related modules on the compilation of lib.
Bruno Haible <bruno@clisp.org>
parents: 32677
diff changeset
5649 # PACKAGE is defined by AM_INIT_AUTOMAKE, PACKAGE_TARNAME is defined by AC_INIT.
39154
55dc3d465b51 maint: shorten https://lists.gnu.org/archive/html/... links
Jim Meyering <meyering@fb.com>
parents: 38925
diff changeset
5650 # See <https://lists.gnu.org/r/automake/2009-05/msg00145.html>.
32780
dae5edf34b2e Fix definition of tests witness macro.
Bruno Haible <bruno@clisp.org>
parents: 32772
diff changeset
5651 echo "changequote(,)dnl"
32781
6aee34af8f13 Fix definition of tests witness macro.
Bruno Haible <bruno@clisp.org>
parents: 32780
diff changeset
5652 echo " ${macro_prefix}tests_WITNESS=IN_\`echo \"\${PACKAGE-\$PACKAGE_TARNAME}\" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'\`_GNULIB_TESTS"
32780
dae5edf34b2e Fix definition of tests witness macro.
Bruno Haible <bruno@clisp.org>
parents: 32772
diff changeset
5653 echo "changequote([, ])dnl"
32758
3181ecfd95ec Avoid side effects from tests-related modules on the compilation of lib.
Bruno Haible <bruno@clisp.org>
parents: 32677
diff changeset
5654 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
3181ecfd95ec Avoid side effects from tests-related modules on the compilation of lib.
Bruno Haible <bruno@clisp.org>
parents: 32677
diff changeset
5655 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
3181ecfd95ec Avoid side effects from tests-related modules on the compilation of lib.
Bruno Haible <bruno@clisp.org>
parents: 32677
diff changeset
5656 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
39193
6feb46ed08f6 gnulib-tool: Make --conditional-dependencies work better.
Bruno Haible <bruno@clisp.org>
parents: 39154
diff changeset
5657 func_emit_autoconf_snippets "$testsrelated_modules" "$main_modules $testsrelated_modules" func_verify_module true true true
32758
3181ecfd95ec Avoid side effects from tests-related modules on the compilation of lib.
Bruno Haible <bruno@clisp.org>
parents: 32677
diff changeset
5658 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5659 func_emit_initmacro_end ${macro_prefix}tests
26977
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
5660 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
5661 # created using libtool, because libtool already handles the dependencies.
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
5662 if test "$libtool" != true; then
33459
66fa8199c3fe more ports to Solaris tr, which needs [] around ranges
Paul Eggert <eggert@cs.ucla.edu>
parents: 33454
diff changeset
5663 libname_upper=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
26977
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
5664 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
5665 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
5666 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
5667 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
5668 fi
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5669 if $use_libtests; then
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5670 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5671 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5672 fi
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
5673 echo "])"
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5674 func_emit_initmacro_done $macro_prefix $sourcebase
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5675 func_emit_initmacro_done ${macro_prefix}tests $testsbase
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
5676 echo
25871
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5677 echo "# This macro records the list of files which have been installed by"
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5678 echo "# gnulib-tool and may be removed by future gnulib-tool invocations."
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5679 echo "AC_DEFUN([${macro_prefix}_FILE_LIST], ["
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
5680 echo "$files" | sed -e 's,^, ,'
25871
ccb8c06dbc55 Separate the generates files into cvs-committable files and frequently
Bruno Haible <bruno@clisp.org>
parents: 25870
diff changeset
5681 echo "])"
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5682 ) > "$tmpfile"
25937
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5683 if test -f "$destdir"/$m4base/gnulib-comp.m4; then
36405
b20b2a61aeb9 gnulib-tool: Avoid unintended error output from 'cmp'.
Bruno Haible <bruno@clisp.org>
parents: 36404
diff changeset
5684 if cmp -s "$destdir"/$m4base/gnulib-comp.m4 "$tmpfile"; then
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5685 rm -f "$tmpfile"
25937
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5686 else
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5687 if $doit; then
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5688 echo "Updating $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5689 mv -f "$destdir"/$m4base/gnulib-comp.m4 "$destdir"/$m4base/gnulib-comp.m4~
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5690 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.m4
25937
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5691 else
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5692 echo "Update $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
25940
c7cfdeb294b4 Comment out too much verbosity in --dry-run.
Bruno Haible <bruno@clisp.org>
parents: 25939
diff changeset
5693 if false; then
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5694 cat "$tmpfile"
25940
c7cfdeb294b4 Comment out too much verbosity in --dry-run.
Bruno Haible <bruno@clisp.org>
parents: 25939
diff changeset
5695 echo
c7cfdeb294b4 Comment out too much verbosity in --dry-run.
Bruno Haible <bruno@clisp.org>
parents: 25939
diff changeset
5696 echo "# gnulib-comp.m4 ends here"
c7cfdeb294b4 Comment out too much verbosity in --dry-run.
Bruno Haible <bruno@clisp.org>
parents: 25939
diff changeset
5697 fi
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5698 rm -f "$tmpfile"
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5699 fi
25937
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5700 fi
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5701 else
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5702 if $doit; then
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5703 echo "Creating $m4base/gnulib-comp.m4"
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5704 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.m4
25937
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5705 else
d98ffd4192ec Rework the way --dry-run works.
Bruno Haible <bruno@clisp.org>
parents: 25936
diff changeset
5706 echo "Create $m4base/gnulib-comp.m4"
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5707 cat "$tmpfile"
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5708 rm -f "$tmpfile"
25872
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5709 fi
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5710 fi
bd4120bb08f1 Read the previous cached settings.
Bruno Haible <bruno@clisp.org>
parents: 25871
diff changeset
5711
36623
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
5712 if $inctests; then
26913
2f6d41ced306 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 26907
diff changeset
5713 # Create tests makefile.
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5714 func_dest_tmpfilename $testsbase/$makefile_am
30167
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5715 destfile="$testsbase/$makefile_am"
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5716 modules="$testsrelated_modules"
32758
3181ecfd95ec Avoid side effects from tests-related modules on the compilation of lib.
Bruno Haible <bruno@clisp.org>
parents: 32677
diff changeset
5717 func_emit_tests_Makefile_am "${macro_prefix}tests_WITNESS" > "$tmpfile"
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5718 if test -f "$destdir"/$testsbase/$makefile_am; then
36405
b20b2a61aeb9 gnulib-tool: Avoid unintended error output from 'cmp'.
Bruno Haible <bruno@clisp.org>
parents: 36404
diff changeset
5719 if cmp -s "$destdir"/$testsbase/$makefile_am "$tmpfile"; then
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5720 rm -f "$tmpfile"
25941
337785cc74ad Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 25940
diff changeset
5721 else
337785cc74ad Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 25940
diff changeset
5722 if $doit; then
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5723 echo "Updating $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5724 mv -f "$destdir"/$testsbase/$makefile_am "$destdir"/$testsbase/$makefile_am~
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5725 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
25941
337785cc74ad Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 25940
diff changeset
5726 else
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5727 echo "Update $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5728 rm -f "$tmpfile"
25941
337785cc74ad Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 25940
diff changeset
5729 fi
337785cc74ad Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 25940
diff changeset
5730 fi
337785cc74ad Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 25940
diff changeset
5731 else
337785cc74ad Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 25940
diff changeset
5732 if $doit; then
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5733 echo "Creating $testsbase/$makefile_am"
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5734 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
25941
337785cc74ad Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 25940
diff changeset
5735 else
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5736 echo "Create $testsbase/$makefile_am"
26436
4d8a0156fc8d Fix "gnulib-tool --dry-run --import" in a package that has no lib/ and
Bruno Haible <bruno@clisp.org>
parents: 26324
diff changeset
5737 rm -f "$tmpfile"
25941
337785cc74ad Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 25940
diff changeset
5738 fi
36737
b88e4025e62c gnulib-tool: Fix indentation.
Bruno Haible <bruno@clisp.org>
parents: 36736
diff changeset
5739 func_append added_files "$testsbase/$makefile_am$nl"
25941
337785cc74ad Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 25940
diff changeset
5740 fi
337785cc74ad Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 25940
diff changeset
5741 fi
337785cc74ad Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 25940
diff changeset
5742
29501
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5743 if test "$vc_files" != false; then
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5744 # Update the .cvsignore and .gitignore files.
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5745 { echo "$added_files" | sed -e '/^$/d' -e 's,\([^/]*\)$,|A|\1,'
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5746 echo "$removed_files" | sed -e '/^$/d' -e 's,\([^/]*\)$,|R|\1,'
29943
56d540c6e174 Put gnulib-comp.m4 into .cvsignore or .gitignore.
Bruno Haible <bruno@clisp.org>
parents: 29941
diff changeset
5747 # Treat gnulib-comp.m4 like an added file, even if it already existed.
56d540c6e174 Put gnulib-comp.m4 into .cvsignore or .gitignore.
Bruno Haible <bruno@clisp.org>
parents: 29941
diff changeset
5748 echo "$m4base/|A|gnulib-comp.m4"
29501
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5749 } | LC_ALL=C sort -t'|' -k1,1 > "$tmp"/fileset-changes
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5750 { # Rearrange file descriptors. Needed because "while ... done < ..."
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5751 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5752 exec 5<&0 < "$tmp"/fileset-changes
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5753 func_update_ignorelist ()
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5754 {
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5755 ignore="$1"
29989
3a0901f48668 Prepend each added line in .gitignore files with a slash.
Bruno Haible <bruno@clisp.org>
parents: 29984
diff changeset
5756 if test "$ignore" = .gitignore; then
3a0901f48668 Prepend each added line in .gitignore files with a slash.
Bruno Haible <bruno@clisp.org>
parents: 29984
diff changeset
5757 # In a .gitignore file, "foo" applies to the current directory and all
3a0901f48668 Prepend each added line in .gitignore files with a slash.
Bruno Haible <bruno@clisp.org>
parents: 29984
diff changeset
5758 # subdirectories, whereas "/foo" applies to the current directory only.
3a0901f48668 Prepend each added line in .gitignore files with a slash.
Bruno Haible <bruno@clisp.org>
parents: 29984
diff changeset
5759 anchor='/'
3a0901f48668 Prepend each added line in .gitignore files with a slash.
Bruno Haible <bruno@clisp.org>
parents: 29984
diff changeset
5760 escaped_anchor='\/'
3a0901f48668 Prepend each added line in .gitignore files with a slash.
Bruno Haible <bruno@clisp.org>
parents: 29984
diff changeset
5761 doubly_escaped_anchor='\\/'
3a0901f48668 Prepend each added line in .gitignore files with a slash.
Bruno Haible <bruno@clisp.org>
parents: 29984
diff changeset
5762 else
3a0901f48668 Prepend each added line in .gitignore files with a slash.
Bruno Haible <bruno@clisp.org>
parents: 29984
diff changeset
5763 anchor=''
3a0901f48668 Prepend each added line in .gitignore files with a slash.
Bruno Haible <bruno@clisp.org>
parents: 29984
diff changeset
5764 escaped_anchor=''
3a0901f48668 Prepend each added line in .gitignore files with a slash.
Bruno Haible <bruno@clisp.org>
parents: 29984
diff changeset
5765 doubly_escaped_anchor=''
3a0901f48668 Prepend each added line in .gitignore files with a slash.
Bruno Haible <bruno@clisp.org>
parents: 29984
diff changeset
5766 fi
29501
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5767 if test -f "$destdir/$dir$ignore"; then
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5768 if test -n "$dir_added" || test -n "$dir_removed"; then
29989
3a0901f48668 Prepend each added line in .gitignore files with a slash.
Bruno Haible <bruno@clisp.org>
parents: 29984
diff changeset
5769 sed -e "s|^$anchor||" < "$destdir/$dir$ignore" | LC_ALL=C sort > "$tmp"/ignore
32572
f0df2aa3fc0f Really work around around "broken pipe" error message from bash 3.2.
Bruno Haible <bruno@clisp.org>
parents: 32568
diff changeset
5770 (echo "$dir_added" | sed -e '/^$/d' | LC_ALL=C sort -u \
30671
2907ecb1931e work around Solaris 8 'join' bug
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 30660
diff changeset
5771 | LC_ALL=C join -v 1 - "$tmp"/ignore > "$tmp"/ignore-added
30070
4b97135750e5 Attempt to avoid error messages like "echo: write error: Broken pipe".
Bruno Haible <bruno@clisp.org>
parents: 29989
diff changeset
5772 echo "$dir_removed" | sed -e '/^$/d' | LC_ALL=C sort -u \
36736
965eb3cd3677 gnulib-tool: Remove old file names from .cvsignore, .gitignore.
Bruno Haible <bruno@clisp.org>
parents: 36733
diff changeset
5773 > "$tmp"/ignore-removed
30070
4b97135750e5 Attempt to avoid error messages like "echo: write error: Broken pipe".
Bruno Haible <bruno@clisp.org>
parents: 29989
diff changeset
5774 )
29501
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5775 if test -s "$tmp"/ignore-added || test -s "$tmp"/ignore-removed; then
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5776 if $doit; then
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5777 echo "Updating $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5778 mv -f "$destdir/$dir$ignore" "$destdir/$dir$ignore"~
30672
8a9b4da790dc Fix small bug in update of .cvsignore or .gitignore.
Bruno Haible <bruno@clisp.org>
parents: 30671
diff changeset
5779 { sed -e 's,/,\\/,g' -e 's,^,/^,' -e 's,$,\$/d,' < "$tmp"/ignore-removed
30923
5b8af6b3130b Make a sed expression POSIX compliant.
Bruno Haible <bruno@clisp.org>
parents: 30922
diff changeset
5780 if test -n "$anchor"; then sed -e 's,/,\\/,g' -e "s,^,/^${doubly_escaped_anchor}," -e 's,$,$/d,' < "$tmp"/ignore-removed; fi
29989
3a0901f48668 Prepend each added line in .gitignore files with a slash.
Bruno Haible <bruno@clisp.org>
parents: 29984
diff changeset
5781 } > "$tmp"/sed-ignore-removed
3a0901f48668 Prepend each added line in .gitignore files with a slash.
Bruno Haible <bruno@clisp.org>
parents: 29984
diff changeset
5782 { cat "$destdir/$dir$ignore"~
3a0901f48668 Prepend each added line in .gitignore files with a slash.
Bruno Haible <bruno@clisp.org>
parents: 29984
diff changeset
5783 sed -e "s|^|$anchor|" < "$tmp"/ignore-added
3a0901f48668 Prepend each added line in .gitignore files with a slash.
Bruno Haible <bruno@clisp.org>
parents: 29984
diff changeset
5784 } | sed -f "$tmp"/sed-ignore-removed \
29501
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5785 > "$destdir/$dir$ignore"
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5786 else
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5787 echo "Update $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5788 fi
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5789 fi
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5790 fi
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5791 else
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5792 if test -n "$dir_added"; then
28142
1e4693454cba Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 28123
diff changeset
5793 if $doit; then
29501
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5794 echo "Creating $destdir/$dir$ignore"
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5795 {
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5796 if test "$ignore" = .cvsignore; then
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5797 echo ".deps"
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5798 # Automake generates Makefile rules that create .dirstamp files.
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5799 echo ".dirstamp"
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5800 fi
29989
3a0901f48668 Prepend each added line in .gitignore files with a slash.
Bruno Haible <bruno@clisp.org>
parents: 29984
diff changeset
5801 echo "$dir_added" | sed -e '/^$/d' -e "s|^|$anchor|" | LC_ALL=C sort -u
29501
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5802 } > "$destdir/$dir$ignore"
28142
1e4693454cba Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 28123
diff changeset
5803 else
29501
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5804 echo "Create $destdir/$dir$ignore"
28142
1e4693454cba Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 28123
diff changeset
5805 fi
1e4693454cba Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 28123
diff changeset
5806 fi
1e4693454cba Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 28123
diff changeset
5807 fi
29501
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5808 }
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5809 func_done_dir ()
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5810 {
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5811 dir="$1"
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5812 dir_added="$2"
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5813 dir_removed="$3"
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5814 if test -d "$destdir/CVS" || test -d "$destdir/${dir}CVS" || test -f "$destdir/${dir}.cvsignore"; then
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5815 func_update_ignorelist .cvsignore
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5816 fi
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5817 if test -d "$destdir/.git" || test -f "$destdir/${dir}.gitignore"; then
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5818 func_update_ignorelist .gitignore
28142
1e4693454cba Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 28123
diff changeset
5819 fi
29501
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5820 }
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5821 last_dir=
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5822 last_dir_added=
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5823 last_dir_removed=
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5824 while read line; do
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5825 # Why not ''read next_dir op file'' ? Because the dir column can be empty.
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5826 next_dir=`echo "$line" | sed -e 's,|.*,,'`
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5827 op=`echo "$line" | sed -e 's,^[^|]*|\([^|]*\)|.*$,\1,'`
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5828 file=`echo "$line" | sed -e 's,^[^|]*|[^|]*|,,'`
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5829 if test "$next_dir" != "$last_dir"; then
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5830 func_done_dir "$last_dir" "$last_dir_added" "$last_dir_removed"
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5831 last_dir="$next_dir"
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5832 last_dir_added=
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5833 last_dir_removed=
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5834 fi
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5835 case $op in
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5836 A) func_append last_dir_added "$file$nl";;
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5837 R) func_append last_dir_removed "$file$nl";;
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5838 esac
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5839 done
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5840 func_done_dir "$last_dir" "$last_dir_added" "$last_dir_removed"
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5841 exec 0<&5 5<&-
28142
1e4693454cba Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 28123
diff changeset
5842 }
29501
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
5843 fi
28142
1e4693454cba Update .cvsignore and .gitignore files.
Bruno Haible <bruno@clisp.org>
parents: 28123
diff changeset
5844
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
5845 echo "Finished."
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
5846 echo
25263
153fa85cb69c Print #include directives when --import'ing.
Simon Josefsson <simon@josefsson.org>
parents: 25218
diff changeset
5847 echo "You may need to add #include directives for the following .h files."
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5848 # Intersect $specified_modules and $main_modules
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5849 # (since $specified_modules is not necessarily of subset of $main_modules
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5850 # - some may have been skipped through --avoid, and since the elements of
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5851 # $main_modules but not in $specified_modules can go away without explicit
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5852 # notice - through changes in the module dependencies).
27412
ae875b2fd4e3 Don't show the includes for modules that were not explicitly specified.
Bruno Haible <bruno@clisp.org>
parents: 27392
diff changeset
5853 echo "$specified_modules" > "$tmp"/modules1 # a sorted list, one module per line
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5854 echo "$main_modules" > "$tmp"/modules2 # also a sorted list, one module per line
27013
cf27fa57df2e Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 27012
diff changeset
5855 # First the #include <...> directives without #ifs, sorted for convenience,
cf27fa57df2e Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 27012
diff changeset
5856 # then the #include "..." directives without #ifs, sorted for convenience,
cf27fa57df2e Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 27012
diff changeset
5857 # then the #include directives that are surrounded by #ifs. Not sorted.
27413
4691f87ed198 Fix 'join' invocation.
Bruno Haible <bruno@clisp.org>
parents: 27412
diff changeset
5858 for module in `LC_ALL=C join "$tmp"/modules1 "$tmp"/modules2`; do
27013
cf27fa57df2e Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 27012
diff changeset
5859 include_directive=`func_get_include_directive "$module"`
cf27fa57df2e Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 27012
diff changeset
5860 case "$nl$include_directive" in
cf27fa57df2e Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 27012
diff changeset
5861 *"$nl#if"*)
cf27fa57df2e Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 27012
diff changeset
5862 echo "$include_directive" 1>&5
cf27fa57df2e Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 27012
diff changeset
5863 ;;
cf27fa57df2e Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 27012
diff changeset
5864 *)
cf27fa57df2e Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 27012
diff changeset
5865 echo "$include_directive" | grep -v 'include "' 1>&6
cf27fa57df2e Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 27012
diff changeset
5866 echo "$include_directive" | grep 'include "' 1>&7
cf27fa57df2e Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 27012
diff changeset
5867 ;;
cf27fa57df2e Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 27012
diff changeset
5868 esac
cf27fa57df2e Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 27012
diff changeset
5869 done 5> "$tmp"/include-if 6> "$tmp"/include-angles 7> "$tmp"/include-quotes
26447
efc55c1ccfe6 Sort the #include directives more carefully.
Bruno Haible <bruno@clisp.org>
parents: 26441
diff changeset
5870 (
27013
cf27fa57df2e Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 27012
diff changeset
5871 LC_ALL=C sort -u "$tmp"/include-angles
cf27fa57df2e Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 27012
diff changeset
5872 LC_ALL=C sort -u "$tmp"/include-quotes
cf27fa57df2e Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 27012
diff changeset
5873 cat "$tmp"/include-if
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
5874 ) | sed -e '/^$/d' -e 's/^/ /'
27013
cf27fa57df2e Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 27012
diff changeset
5875 rm -f "$tmp"/include-angles "$tmp"/include-quotes "$tmp"/include-if
cf27fa57df2e Speed up presentation of the include files.
Bruno Haible <bruno@clisp.org>
parents: 27012
diff changeset
5876
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
5877 for module in $main_modules; do
27746
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
5878 func_get_link_directive "$module"
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
5879 done \
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
5880 | LC_ALL=C sort -u | sed -e '/^$/d' -e 's/^/ /' > "$tmp"/link
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
5881 if test `wc -l < "$tmp"/link` != 0; then
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
5882 echo
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
5883 echo "You may need to use the following Makefile variables when linking."
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
5884 echo "Use them in <program>_LDADD when linking a program, or"
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
5885 echo "in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library."
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
5886 cat "$tmp"/link
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
5887 fi
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
5888 rm -f "$tmp"/link
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
5889
25263
153fa85cb69c Print #include directives when --import'ing.
Simon Josefsson <simon@josefsson.org>
parents: 25218
diff changeset
5890 echo
25851
98980c1ca9e4 Emit more comments and advice.
Bruno Haible <bruno@clisp.org>
parents: 25850
diff changeset
5891 echo "Don't forget to"
26913
2f6d41ced306 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 26907
diff changeset
5892 if test "$makefile_am" = Makefile.am; then
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5893 echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5894 else
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5895 echo " - \"include $makefile_name\" from within \"$sourcebase/Makefile.am\","
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5896 fi
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5897 if test -n "$pobase"; then
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5898 echo " - add \"$pobase/Makefile.in\" to AC_CONFIG_FILES in $configure_ac,"
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
5899 fi
36623
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
5900 if $inctests; then
26913
2f6d41ced306 * gnulib-tool (emit_lib_Makefile_am): Don't put $makefile_name
Paul Eggert <eggert@cs.ucla.edu>
parents: 26907
diff changeset
5901 if test "$makefile_am" = Makefile.am; then
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5902 echo " - add \"$testsbase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5903 else
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5904 echo " - \"include $makefile_name\" from within \"$testsbase/Makefile.am\","
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5905 fi
25941
337785cc74ad Support --with-tests also with --import.
Bruno Haible <bruno@clisp.org>
parents: 25940
diff changeset
5906 fi
30167
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5907 edit=0
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5908 while test $edit != $makefile_am_edits; do
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5909 edit=`expr $edit + 1`
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5910 eval dir=\"\$makefile_am_edit${edit}_dir\"
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5911 eval var=\"\$makefile_am_edit${edit}_var\"
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5912 eval val=\"\$makefile_am_edit${edit}_val\"
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5913 if test -n "$var"; then
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5914 echo " - mention \"${val}\" in ${var} in ${dir}Makefile.am,"
26907
063390363779 New option --makefile-name.
Bruno Haible <bruno@clisp.org>
parents: 26906
diff changeset
5915 fi
30167
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
5916 done
35492
253a80743b4a gnulib-tool: Improve suggestion where to put gl_EARLY invocation.
Bruno Haible <bruno@clisp.org>
parents: 35481
diff changeset
5917 if grep '^ *AC_PROG_CC_STDC' "$configure_ac" > /dev/null; then
253a80743b4a gnulib-tool: Improve suggestion where to put gl_EARLY invocation.
Bruno Haible <bruno@clisp.org>
parents: 35481
diff changeset
5918 position_early_after=AC_PROG_CC_STDC
253a80743b4a gnulib-tool: Improve suggestion where to put gl_EARLY invocation.
Bruno Haible <bruno@clisp.org>
parents: 35481
diff changeset
5919 else
253a80743b4a gnulib-tool: Improve suggestion where to put gl_EARLY invocation.
Bruno Haible <bruno@clisp.org>
parents: 35481
diff changeset
5920 if grep '^ *AC_PROG_CC_C99' "$configure_ac" > /dev/null; then
253a80743b4a gnulib-tool: Improve suggestion where to put gl_EARLY invocation.
Bruno Haible <bruno@clisp.org>
parents: 35481
diff changeset
5921 position_early_after=AC_PROG_CC_C99
253a80743b4a gnulib-tool: Improve suggestion where to put gl_EARLY invocation.
Bruno Haible <bruno@clisp.org>
parents: 35481
diff changeset
5922 else
253a80743b4a gnulib-tool: Improve suggestion where to put gl_EARLY invocation.
Bruno Haible <bruno@clisp.org>
parents: 35481
diff changeset
5923 position_early_after=AC_PROG_CC
253a80743b4a gnulib-tool: Improve suggestion where to put gl_EARLY invocation.
Bruno Haible <bruno@clisp.org>
parents: 35481
diff changeset
5924 fi
253a80743b4a gnulib-tool: Improve suggestion where to put gl_EARLY invocation.
Bruno Haible <bruno@clisp.org>
parents: 35481
diff changeset
5925 fi
253a80743b4a gnulib-tool: Improve suggestion where to put gl_EARLY invocation.
Bruno Haible <bruno@clisp.org>
parents: 35481
diff changeset
5926 echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after $position_early_after,"
25867
88c19369f481 New option --macro-prefix.
Bruno Haible <bruno@clisp.org>
parents: 25866
diff changeset
5927 echo " - invoke ${macro_prefix}_INIT in $configure_ac."
25036
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
5928 }
3195b91d0d23 Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 25035
diff changeset
5929
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5930 # func_create_testdir testdir modules
25800
c7780c4e64f2 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 25799
diff changeset
5931 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
5932 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
5933 # - modcache true or false, from --cache-modules/--no-cache-modules
25800
c7780c4e64f2 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 25799
diff changeset
5934 # - auxdir directory relative to destdir where to place build aux files
36623
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
5935 # - inctests true if tests should be included, false otherwise
32677
7030d03d6c13 Clarify which options are available for --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32674
diff changeset
5936 # - incobsolete true if obsolete modules among dependencies should be
7030d03d6c13 Clarify which options are available for --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32674
diff changeset
5937 # included, blank otherwise
32954
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
5938 # - excl_cxx_tests true if C++ interoperability tests should be excluded,
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
5939 # blank otherwise
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
5940 # - excl_longrunning_tests true if long-runnings tests should be excluded,
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
5941 # blank otherwise
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
5942 # - excl_privileged_tests true if tests that require root privileges should be
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
5943 # excluded, blank otherwise
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
5944 # - excl_unportable_tests true if tests that fail on some platforms should be
65e026da66b8 gnulib-tool: Add --without-*-tests options.
Bruno Haible <bruno@clisp.org>
parents: 32914
diff changeset
5945 # excluded, blank otherwise
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
5946 # - single_configure true if a single configure file should be generated,
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
5947 # false for a separate configure file for the tests
32677
7030d03d6c13 Clarify which options are available for --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32674
diff changeset
5948 # - avoidlist list of modules to avoid
34524
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
5949 # - cond_dependencies true if --conditional-dependencies was given, false if
112e9c3223ba Finish the conditional dependencies mechanism.
Bruno Haible <bruno@clisp.org>
parents: 34497
diff changeset
5950 # --no-conditional-dependencies was given, blank otherwise
32677
7030d03d6c13 Clarify which options are available for --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32674
diff changeset
5951 # - libtool true if --libtool was given, false if --no-libtool was
7030d03d6c13 Clarify which options are available for --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32674
diff changeset
5952 # given, blank otherwise
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
5953 # - copymode copy mode for files in general
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
5954 # - lcopymode copy mode for files from local_gnulib_path
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5955 func_create_testdir ()
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5956 {
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5957 testdir="$1"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5958 modules="$2"
27175
fc8ac5fcad48 --create-testdir without module names now means to use nearly all modules.
Bruno Haible <bruno@clisp.org>
parents: 27112
diff changeset
5959 if test -z "$modules"; then
fc8ac5fcad48 --create-testdir without module names now means to use nearly all modules.
Bruno Haible <bruno@clisp.org>
parents: 27112
diff changeset
5960 # All modules together.
fc8ac5fcad48 --create-testdir without module names now means to use nearly all modules.
Bruno Haible <bruno@clisp.org>
parents: 27112
diff changeset
5961 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
38151
2c076dc4ca4d gnulib-tool: Make --create-testdir on all modules work again.
Bruno Haible <bruno@clisp.org>
parents: 37911
diff changeset
5962 # Except non-recursive-gnulib-prefix-hack, which represents a nonstandard
2c076dc4ca4d gnulib-tool: Make --create-testdir on all modules work again.
Bruno Haible <bruno@clisp.org>
parents: 37911
diff changeset
5963 # way of using Automake.
27224
02459d0c4632 Don't include ftruncate and mountlist by default.
Bruno Haible <bruno@clisp.org>
parents: 27221
diff changeset
5964 # Except ftruncate, mountlist, which abort the configuration on mingw. FIXME.
32614
61670ea35256 Exclude lib-ignore module.
Bruno Haible <bruno@clisp.org>
parents: 32608
diff changeset
5965 # Except lib-ignore, which leads to link errors when Sun C++ is used. FIXME.
27175
fc8ac5fcad48 --create-testdir without module names now means to use nearly all modules.
Bruno Haible <bruno@clisp.org>
parents: 27112
diff changeset
5966 modules=`func_all_modules`
38151
2c076dc4ca4d gnulib-tool: Make --create-testdir on all modules work again.
Bruno Haible <bruno@clisp.org>
parents: 37911
diff changeset
5967 modules=`for m in $modules; do case $m in config-h | non-recursive-gnulib-prefix-hack | ftruncate | mountlist | lib-ignore) ;; *) echo $m;; esac; done`
27175
fc8ac5fcad48 --create-testdir without module names now means to use nearly all modules.
Bruno Haible <bruno@clisp.org>
parents: 27112
diff changeset
5968 fi
33110
fa1171945e1b gnulib-tool: Align code of func_import and func_create_testdir.
Bruno Haible <bruno@clisp.org>
parents: 32990
diff changeset
5969 specified_modules="$modules"
fa1171945e1b gnulib-tool: Align code of func_import and func_create_testdir.
Bruno Haible <bruno@clisp.org>
parents: 32990
diff changeset
5970
fa1171945e1b gnulib-tool: Align code of func_import and func_create_testdir.
Bruno Haible <bruno@clisp.org>
parents: 32990
diff changeset
5971 # Canonicalize the list of specified modules.
fa1171945e1b gnulib-tool: Align code of func_import and func_create_testdir.
Bruno Haible <bruno@clisp.org>
parents: 32990
diff changeset
5972 specified_modules=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5973
38383
375601e34ee8 gnulib-tool: Avoid conflict of havelib-tests with --single-configure.
Bruno Haible <bruno@clisp.org>
parents: 38305
diff changeset
5974 # Test modules which invoke AC_CONFIG_FILES cannot be used with
375601e34ee8 gnulib-tool: Avoid conflict of havelib-tests with --single-configure.
Bruno Haible <bruno@clisp.org>
parents: 38305
diff changeset
5975 # --with-tests --single-configure. Avoid them.
375601e34ee8 gnulib-tool: Avoid conflict of havelib-tests with --single-configure.
Bruno Haible <bruno@clisp.org>
parents: 38305
diff changeset
5976 if $inctests && $single_configure; then
375601e34ee8 gnulib-tool: Avoid conflict of havelib-tests with --single-configure.
Bruno Haible <bruno@clisp.org>
parents: 38305
diff changeset
5977 avoidlist="$avoidlist havelib-tests"
375601e34ee8 gnulib-tool: Avoid conflict of havelib-tests with --single-configure.
Bruno Haible <bruno@clisp.org>
parents: 38305
diff changeset
5978 fi
375601e34ee8 gnulib-tool: Avoid conflict of havelib-tests with --single-configure.
Bruno Haible <bruno@clisp.org>
parents: 38305
diff changeset
5979
32955
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
5980 # Unlike in func_import, here we want to include all kinds of tests for the
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
5981 # directly specified modules, but not for dependencies.
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
5982 inc_all_direct_tests=true
adc6baea3c4f gnulib-tool: Don't include hairy tests of dependencies in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 32954
diff changeset
5983 inc_all_indirect_tests="$inc_all_tests"
32771
7e2538b276a5 gnulib-tool: Add support for special categories of tests.
Bruno Haible <bruno@clisp.org>
parents: 32761
diff changeset
5984
27351
e81480bd2f39 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 27338
diff changeset
5985 # Check that the license of every module is consistent with the license of
e81480bd2f39 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 27338
diff changeset
5986 # its dependencies.
27587
bd6ba74aca5e Tests modules are under GPL now.
Bruno Haible <bruno@clisp.org>
parents: 27563
diff changeset
5987 saved_inctests="$inctests"
bd6ba74aca5e Tests modules are under GPL now.
Bruno Haible <bruno@clisp.org>
parents: 27563
diff changeset
5988 # When computing transitive closures, don't consider $module to depend on
36049
e8b25af12cbd maint: spelling fixes
Paul Eggert <eggert@cs.ucla.edu>
parents: 35954
diff changeset
5989 # $module-tests. Need this because tests are implicitly GPL and may depend
27587
bd6ba74aca5e Tests modules are under GPL now.
Bruno Haible <bruno@clisp.org>
parents: 27563
diff changeset
5990 # on GPL modules - therefore we don't want a warning in this case.
36623
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
5991 inctests=false
33110
fa1171945e1b gnulib-tool: Align code of func_import and func_create_testdir.
Bruno Haible <bruno@clisp.org>
parents: 32990
diff changeset
5992 for requested_module in $specified_modules; do
27351
e81480bd2f39 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 27338
diff changeset
5993 requested_license=`func_get_license "$requested_module"`
e81480bd2f39 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 27338
diff changeset
5994 if test "$requested_license" != GPL; then
e81480bd2f39 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 27338
diff changeset
5995 # Here we use func_modules_transitive_closure, not just
e81480bd2f39 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 27338
diff changeset
5996 # func_get_dependencies, so that we also detect weird situations like
e81480bd2f39 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 27338
diff changeset
5997 # an LGPL module which depends on a GPLed build tool module which depends
e81480bd2f39 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 27338
diff changeset
5998 # on a GPL module.
e81480bd2f39 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 27338
diff changeset
5999 modules="$requested_module"
e81480bd2f39 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 27338
diff changeset
6000 func_modules_transitive_closure
e81480bd2f39 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 27338
diff changeset
6001 for module in $modules; do
e81480bd2f39 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 27338
diff changeset
6002 license=`func_get_license "$module"`
28781
f7d75819a4c5 Handle copying terms "GPLv2+" and "LGPLv2+".
Bruno Haible <bruno@clisp.org>
parents: 28777
diff changeset
6003 case "$license" in
f7d75819a4c5 Handle copying terms "GPLv2+" and "LGPLv2+".
Bruno Haible <bruno@clisp.org>
parents: 28777
diff changeset
6004 'GPLed build tool') ;;
27351
e81480bd2f39 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 27338
diff changeset
6005 'public domain' | 'unlimited' | 'unmodifiable license text') ;;
28781
f7d75819a4c5 Handle copying terms "GPLv2+" and "LGPLv2+".
Bruno Haible <bruno@clisp.org>
parents: 28777
diff changeset
6006 *)
f7d75819a4c5 Handle copying terms "GPLv2+" and "LGPLv2+".
Bruno Haible <bruno@clisp.org>
parents: 28777
diff changeset
6007 case "$requested_license" in
38181
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
6008 GPLv3+ | GPL)
28781
f7d75819a4c5 Handle copying terms "GPLv2+" and "LGPLv2+".
Bruno Haible <bruno@clisp.org>
parents: 28777
diff changeset
6009 case "$license" in
38181
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
6010 LGPLv2+ | 'LGPLv3+ or GPLv2' | LGPLv3+ | LGPL | GPLv2+ | GPLv3+ | GPL) ;;
32510
bd082c7777d7 gnulib-tool: Make warning diagnostics consistent.
Bruno Haible <bruno@clisp.org>
parents: 32466
diff changeset
6011 *) func_warning "module $requested_module depends on a module with an incompatible license: $module" ;;
28781
f7d75819a4c5 Handle copying terms "GPLv2+" and "LGPLv2+".
Bruno Haible <bruno@clisp.org>
parents: 28777
diff changeset
6012 esac
f7d75819a4c5 Handle copying terms "GPLv2+" and "LGPLv2+".
Bruno Haible <bruno@clisp.org>
parents: 28777
diff changeset
6013 ;;
38181
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
6014 GPLv2+)
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
6015 case "$license" in
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
6016 LGPLv2+ | 'LGPLv3+ or GPLv2' | GPLv2+) ;;
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
6017 *) func_warning "module $requested_module depends on a module with an incompatible license: $module" ;;
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
6018 esac
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
6019 ;;
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
6020 LGPLv3+ | LGPL)
28781
f7d75819a4c5 Handle copying terms "GPLv2+" and "LGPLv2+".
Bruno Haible <bruno@clisp.org>
parents: 28777
diff changeset
6021 case "$license" in
38181
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
6022 LGPLv2+ | 'LGPLv3+ or GPLv2' | LGPLv3+ | LGPL) ;;
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
6023 *) func_warning "module $requested_module depends on a module with an incompatible license: $module" ;;
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
6024 esac
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
6025 ;;
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
6026 'LGPLv3+ or GPLv2')
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
6027 case "$license" in
4094d1fca079 gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
Bruno Haible <bruno@clisp.org>
parents: 38154
diff changeset
6028 LGPLv2+ | 'LGPLv3+ or GPLv2') ;;
32510
bd082c7777d7 gnulib-tool: Make warning diagnostics consistent.
Bruno Haible <bruno@clisp.org>
parents: 32466
diff changeset
6029 *) func_warning "module $requested_module depends on a module with an incompatible license: $module" ;;
28781
f7d75819a4c5 Handle copying terms "GPLv2+" and "LGPLv2+".
Bruno Haible <bruno@clisp.org>
parents: 28777
diff changeset
6030 esac
f7d75819a4c5 Handle copying terms "GPLv2+" and "LGPLv2+".
Bruno Haible <bruno@clisp.org>
parents: 28777
diff changeset
6031 ;;
f7d75819a4c5 Handle copying terms "GPLv2+" and "LGPLv2+".
Bruno Haible <bruno@clisp.org>
parents: 28777
diff changeset
6032 LGPLv2+)
f7d75819a4c5 Handle copying terms "GPLv2+" and "LGPLv2+".
Bruno Haible <bruno@clisp.org>
parents: 28777
diff changeset
6033 case "$license" in
f7d75819a4c5 Handle copying terms "GPLv2+" and "LGPLv2+".
Bruno Haible <bruno@clisp.org>
parents: 28777
diff changeset
6034 LGPLv2+) ;;
32510
bd082c7777d7 gnulib-tool: Make warning diagnostics consistent.
Bruno Haible <bruno@clisp.org>
parents: 32466
diff changeset
6035 *) func_warning "module $requested_module depends on a module with an incompatible license: $module" ;;
28781
f7d75819a4c5 Handle copying terms "GPLv2+" and "LGPLv2+".
Bruno Haible <bruno@clisp.org>
parents: 28777
diff changeset
6036 esac
f7d75819a4c5 Handle copying terms "GPLv2+" and "LGPLv2+".
Bruno Haible <bruno@clisp.org>
parents: 28777
diff changeset
6037 ;;
f7d75819a4c5 Handle copying terms "GPLv2+" and "LGPLv2+".
Bruno Haible <bruno@clisp.org>
parents: 28777
diff changeset
6038 esac
f7d75819a4c5 Handle copying terms "GPLv2+" and "LGPLv2+".
Bruno Haible <bruno@clisp.org>
parents: 28777
diff changeset
6039 ;;
27351
e81480bd2f39 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 27338
diff changeset
6040 esac
e81480bd2f39 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 27338
diff changeset
6041 done
e81480bd2f39 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 27338
diff changeset
6042 fi
e81480bd2f39 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 27338
diff changeset
6043 done
27587
bd6ba74aca5e Tests modules are under GPL now.
Bruno Haible <bruno@clisp.org>
parents: 27563
diff changeset
6044 inctests="$saved_inctests"
27351
e81480bd2f39 Add license compatibility check in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 27338
diff changeset
6045
26886
9cdd63c880bc Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 26878
diff changeset
6046 # Subdirectory names.
9cdd63c880bc Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 26878
diff changeset
6047 sourcebase=gllib
9cdd63c880bc Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 26878
diff changeset
6048 m4base=glm4
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
6049 pobase=
27012
228eda43ce3f Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 27011
diff changeset
6050 docbase=gldoc
26886
9cdd63c880bc Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 26878
diff changeset
6051 testsbase=gltests
27177
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
6052 macro_prefix=gl
28799
b5ec39fc93a2 New options --po-base, --po-domain.
Bruno Haible <bruno@clisp.org>
parents: 28798
diff changeset
6053 po_domain=
34585
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
6054 witness_c_macro=
29501
7f79dd16de02 New options --vc-files, --no-vc-files.
Bruno Haible <bruno@clisp.org>
parents: 29498
diff changeset
6055 vc_files=
26886
9cdd63c880bc Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 26878
diff changeset
6056
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6057 # Determine final module list.
33110
fa1171945e1b gnulib-tool: Align code of func_import and func_create_testdir.
Bruno Haible <bruno@clisp.org>
parents: 32990
diff changeset
6058 modules="$specified_modules"
25038
7b235423ca42 Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 25037
diff changeset
6059 func_modules_transitive_closure
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
6060 if test $verbose -ge 0; then
33111
d33725640853 gnulib-tool: Display specified modules and dependencies differently.
Bruno Haible <bruno@clisp.org>
parents: 33110
diff changeset
6061 func_show_module_list
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
6062 fi
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6063 final_modules="$modules"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6064
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6065 if $single_configure; then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6066 # Determine main module list and tests-related module list separately.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6067 func_modules_transitive_closure_separately
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6068 fi
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6069
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6070 if $single_configure; then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6071 # Determine whether a $testsbase/libtests.a is needed.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6072 func_determine_use_libtests
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6073 fi
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6074
26241
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
6075 # Add the dummy module if needed.
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6076 if $single_configure; then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6077 func_modules_add_dummy_separately
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6078 else
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6079 func_modules_add_dummy
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6080 fi
26241
25a4bc2124b3 Avoid error due to empty archive on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 26240
diff changeset
6081
39193
6feb46ed08f6 gnulib-tool: Make --conditional-dependencies work better.
Bruno Haible <bruno@clisp.org>
parents: 39154
diff changeset
6082 # Note:
6feb46ed08f6 gnulib-tool: Make --conditional-dependencies work better.
Bruno Haible <bruno@clisp.org>
parents: 39154
diff changeset
6083 # If $single_configure, we use the module lists $main_modules and
6feb46ed08f6 gnulib-tool: Make --conditional-dependencies work better.
Bruno Haible <bruno@clisp.org>
parents: 39154
diff changeset
6084 # $testsrelated_modules; $modules is merely a temporary variable.
6feb46ed08f6 gnulib-tool: Make --conditional-dependencies work better.
Bruno Haible <bruno@clisp.org>
parents: 39154
diff changeset
6085 # Whereas if ! $configure, the module list is $modules.
6feb46ed08f6 gnulib-tool: Make --conditional-dependencies work better.
Bruno Haible <bruno@clisp.org>
parents: 39154
diff changeset
6086
28880
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
6087 # Show banner notice of every module.
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6088 if $single_configure; then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6089 modules="$main_modules"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6090 func_modules_notice
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6091 else
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6092 func_modules_notice
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6093 fi
28880
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
6094
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6095 # Determine final file list.
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6096 if $single_configure; then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6097 func_modules_to_filelist_separately
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6098 else
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6099 func_modules_to_filelist
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6100 if test $verbose -ge 0; then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6101 echo "File list:"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6102 echo "$files" | sed -e 's/^/ /'
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6103 fi
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
6104 fi
33443
7856ea013cd9 gnulib-tool: In testdirs, use the newest available config.{guess.sub}.
Bruno Haible <bruno@clisp.org>
parents: 33441
diff changeset
6105 # Add files for which the copy in gnulib is newer than the one that
7856ea013cd9 gnulib-tool: In testdirs, use the newest available config.{guess.sub}.
Bruno Haible <bruno@clisp.org>
parents: 33441
diff changeset
6106 # "automake --add-missing --copy" would provide.
7856ea013cd9 gnulib-tool: In testdirs, use the newest available config.{guess.sub}.
Bruno Haible <bruno@clisp.org>
parents: 33441
diff changeset
6107 files="$files build-aux/config.guess"
7856ea013cd9 gnulib-tool: In testdirs, use the newest available config.{guess.sub}.
Bruno Haible <bruno@clisp.org>
parents: 33441
diff changeset
6108 files="$files build-aux/config.sub"
7856ea013cd9 gnulib-tool: In testdirs, use the newest available config.{guess.sub}.
Bruno Haible <bruno@clisp.org>
parents: 33441
diff changeset
6109 files=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6110
31251
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
6111 rewritten='%REWRITTEN%'
27012
228eda43ce3f Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 27011
diff changeset
6112 sed_rewrite_files="\
31251
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
6113 s,^build-aux/,$rewritten$auxdir/,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
6114 s,^doc/,$rewritten$docbase/,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
6115 s,^lib/,$rewritten$sourcebase/,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
6116 s,^m4/,$rewritten$m4base/,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
6117 s,^tests/,$rewritten$testsbase/,
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6118 s,^tests=lib/,$rewritten$testsbase/,
31251
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
6119 s,^top/,$rewritten,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
6120 s,^$rewritten,,"
27296
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
6121
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
6122 # Create directories.
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
6123 for f in $files; do echo $f; done \
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
6124 | sed -e "$sed_rewrite_files" \
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
6125 | sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
27296
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
6126 | LC_ALL=C sort -u \
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
6127 > "$tmp"/dirs
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
6128 { # Rearrange file descriptors. Needed because "while ... done < ..."
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
6129 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
6130 exec 5<&0 < "$tmp"/dirs
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
6131 while read d; do
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
6132 mkdir -p "$testdir/$d"
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
6133 done
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
6134 exec 0<&5 5<&-
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
6135 }
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
6136
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
6137 # Copy files or make symbolic links or hard links.
27296
5553348dccf8 Create also all needed subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27291
diff changeset
6138 delimiter=' '
27012
228eda43ce3f Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 27011
diff changeset
6139 for f in $files; do echo $f; done \
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
6140 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_files" \
27012
228eda43ce3f Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 27011
diff changeset
6141 | LC_ALL=C sort \
228eda43ce3f Rewrite all file names at once.
Bruno Haible <bruno@clisp.org>
parents: 27011
diff changeset
6142 > "$tmp"/files
27017
a06537a4dd26 Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 27014
diff changeset
6143 { # Rearrange file descriptors. Needed because "while ... done < ..."
a06537a4dd26 Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 27014
diff changeset
6144 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
27059
19fb67891111 * gnulib-tool (func_import, func_create_testdir): Fix typos in
Eric Blake <ebb9@byu.net>
parents: 27041
diff changeset
6145 exec 5<&0 < "$tmp"/files
27017
a06537a4dd26 Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 27014
diff changeset
6146 while read g f; do
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6147 case "$f" in
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6148 tests=lib/*) f=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6149 esac
27017
a06537a4dd26 Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 27014
diff changeset
6150 func_lookup_file "$f"
a06537a4dd26 Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 27014
diff changeset
6151 if test -n "$lookedup_tmp"; then
26764
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
6152 cp -p "$lookedup_file" "$testdir/$g"
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
6153 else
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
6154 func_should_link
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
6155 if test "$copyaction" = symlink; then
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
6156 func_symlink "$lookedup_file" "$testdir/$g"
27334
4c79ad403923 New option --local-symlink.
Bruno Haible <bruno@clisp.org>
parents: 27333
diff changeset
6157 else
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
6158 if test "$copyaction" = hardlink; then
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
6159 func_hardlink "$lookedup_file" "$testdir/$g"
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
6160 else
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
6161 cp -p "$lookedup_file" "$testdir/$g"
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
6162 fi
27017
a06537a4dd26 Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 27014
diff changeset
6163 fi
26764
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
6164 fi
27017
a06537a4dd26 Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 27014
diff changeset
6165 done
27064
e44051d6bc38 Tweak last patch, for symmetry.
Bruno Haible <bruno@clisp.org>
parents: 27059
diff changeset
6166 exec 0<&5 5<&-
27017
a06537a4dd26 Avoid to execute while loops in a subshell.
Bruno Haible <bruno@clisp.org>
parents: 27014
diff changeset
6167 }
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6168
34531
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
6169 # Determine include_guard_prefix.
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
6170 func_compute_include_guard_prefix
aebcca9ddd62 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 34527
diff changeset
6171
27672
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
6172 # Create Makefile.ams that are for testing.
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
6173 for_test=true
1b27d121660e In testing directories, link the test programs already during "make", not
Bruno Haible <bruno@clisp.org>
parents: 27602
diff changeset
6174
30167
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
6175 # No special edits are needed.
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
6176 makefile_am_edits=0
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
6177
26886
9cdd63c880bc Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 26878
diff changeset
6178 # Create $sourcebase/Makefile.am.
9cdd63c880bc Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 26878
diff changeset
6179 mkdir -p "$testdir/$sourcebase"
30167
fbcfeace872a Don't ask the user to perform edits in the generated Makefile.ams.
Bruno Haible <bruno@clisp.org>
parents: 30166
diff changeset
6180 destfile="$sourcebase/Makefile.am"
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6181 if $single_configure; then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6182 modules="$main_modules"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6183 fi
26886
9cdd63c880bc Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 26878
diff changeset
6184 func_emit_lib_Makefile_am > "$testdir/$sourcebase/Makefile.am"
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
6185 any_uses_subdirs="$uses_subdirs"
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6186
26886
9cdd63c880bc Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 26878
diff changeset
6187 # Create $m4base/Makefile.am.
9cdd63c880bc Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 26878
diff changeset
6188 mkdir -p "$testdir/$m4base"
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6189 (echo "## Process this file with automake to produce Makefile.in."
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6190 echo
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6191 echo "EXTRA_DIST ="
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6192 for f in $files; do
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6193 case "$f" in
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6194 m4/* )
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
6195 echo "EXTRA_DIST += "`echo "$f" | sed -e 's,^m4/,,'` ;;
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6196 esac
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6197 done
26886
9cdd63c880bc Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 26878
diff changeset
6198 ) > "$testdir/$m4base/Makefile.am"
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6199
26886
9cdd63c880bc Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 26878
diff changeset
6200 subdirs="$sourcebase $m4base"
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
6201 subdirs_with_configure_ac=""
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6202
27176
75068ae47af5 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 27175
diff changeset
6203 if false && test -f "$testdir"/$m4base/gettext.m4; then
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6204 # Avoid stupid error message from automake:
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6205 # "AM_GNU_GETTEXT used but `po' not in SUBDIRS"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6206 mkdir -p "$testdir/po"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6207 (echo "## Process this file with automake to produce Makefile.in."
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6208 ) > "$testdir/po/Makefile.am"
27014
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
6209 func_append subdirs " po"
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6210 fi
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6211
36623
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
6212 if $inctests; then
26886
9cdd63c880bc Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 26878
diff changeset
6213 test -d "$testdir/$testsbase" || mkdir "$testdir/$testsbase"
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6214 if $single_configure; then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6215 # Create $testsbase/Makefile.am.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6216 destfile="$testsbase/Makefile.am"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6217 modules="$testsrelated_modules"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6218 func_emit_tests_Makefile_am "${macro_prefix}tests_WITNESS" > "$testdir/$testsbase/Makefile.am"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6219 else
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6220 # Viewed from the $testsbase subdirectory, $auxdir is different.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6221 saved_auxdir="$auxdir"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6222 auxdir=`echo "$testsbase/" | sed -e 's%[^/][^/]*//*%../%g'`"$auxdir"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6223 # Create $testsbase/Makefile.am.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6224 use_libtests=false
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6225 destfile="$testsbase/Makefile.am"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6226 func_emit_tests_Makefile_am "" > "$testdir/$testsbase/Makefile.am"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6227 any_uses_subdirs="$any_uses_subdirs$uses_subdirs"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6228 # Create $testsbase/configure.ac.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6229 (echo "# Process this file with autoconf to produce a configure script."
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6230 echo "AC_INIT([dummy], [0])"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6231 echo "AC_CONFIG_AUX_DIR([$auxdir])"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6232 echo "AM_INIT_AUTOMAKE"
31800
45b2d29be3b9 Conditionally emit AM_PROG_CC_C_O invocation to tests/configure.ac.
Bruno Haible <bruno@clisp.org>
parents: 31746
diff changeset
6233 echo
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6234 echo "AC_CONFIG_HEADERS([config.h])"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6235 echo
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6236 echo "AC_PROG_CC"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6237 echo "AC_PROG_INSTALL"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6238 echo "AC_PROG_MAKE_SET"
37804
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
6239
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
6240 func_emit_pre_early_macros false '' "$modules"
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
6241
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6242 if test -n "$uses_subdirs"; then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6243 echo "AM_PROG_CC_C_O"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6244 echo
27770
77fe2b3ddd5c New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 27746
diff changeset
6245 fi
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6246 for module in $modules; do
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6247 func_verify_module
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6248 if test -n "$module"; then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6249 case $module in
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6250 gnumakefile | maintainer-makefile)
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6251 # These modules are meant to be used only in the top-level directory.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6252 ;;
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6253 *)
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6254 func_get_autoconf_early_snippet "$module"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6255 ;;
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6256 esac
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6257 fi
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6258 done \
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6259 | sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6260 if test "$libtool" = true; then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6261 echo "LT_INIT([win32-dll])"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6262 echo "LT_LANG([C++])"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6263 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6264 echo "gl_cond_libtool=true"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6265 else
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6266 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6267 echo "gl_cond_libtool=false"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6268 echo "gl_libdeps="
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6269 echo "gl_ltlibdeps="
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6270 fi
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6271 # Wrap the set of autoconf snippets into an autoconf macro that is then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6272 # invoked. This is needed because autoconf does not support AC_REQUIRE
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6273 # at the top level:
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6274 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6275 # but we want the AC_REQUIRE to have its normal meaning (provide one
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6276 # expansion of the required macro before the current point, and only one
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6277 # expansion total).
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6278 echo "AC_DEFUN([gl_INIT], ["
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6279 sed_replace_build_aux='
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6280 :a
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6281 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6282 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6283 ba
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6284 }'
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6285 echo "gl_m4_base='../$m4base'"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6286 func_emit_initmacro_start $macro_prefix
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6287 # We don't have explicit ordering constraints between the various
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6288 # autoconf snippets. It's cleanest to put those of the library before
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6289 # those of the tests.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6290 echo "gl_source_base='../$sourcebase'"
39193
6feb46ed08f6 gnulib-tool: Make --conditional-dependencies work better.
Bruno Haible <bruno@clisp.org>
parents: 39154
diff changeset
6291 func_emit_autoconf_snippets "$modules" "$modules" func_verify_nontests_module false false false
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6292 echo "gl_source_base='.'"
39193
6feb46ed08f6 gnulib-tool: Make --conditional-dependencies work better.
Bruno Haible <bruno@clisp.org>
parents: 39154
diff changeset
6293 func_emit_autoconf_snippets "$modules" "$modules" func_verify_tests_module false false false
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6294 func_emit_initmacro_end $macro_prefix
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6295 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6296 # created using libtool, because libtool already handles the dependencies.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6297 if test "$libtool" != true; then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6298 libname_upper=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6299 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6300 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6301 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6302 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6303 fi
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6304 echo "])"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6305 func_emit_initmacro_done $macro_prefix $sourcebase # FIXME use $sourcebase or $testsbase?
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6306 echo
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6307 echo "gl_INIT"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6308 echo
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6309 # Usually $testsbase/config.h will be a superset of config.h. Verify this
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6310 # by "merging" config.h into $testsbase/config.h; look out for gcc warnings.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6311 echo "AH_TOP([#include \"../config.h\"])"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6312 echo
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6313 echo "AC_CONFIG_FILES([Makefile])"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6314 echo "AC_OUTPUT"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6315 ) > "$testdir/$testsbase/configure.ac"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6316 auxdir="$saved_auxdir"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6317 subdirs_with_configure_ac="$subdirs_with_configure_ac $testsbase"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6318 fi
34532
68c04300b877 gnulib-tool: Fix bug in yesterday's commit.
Bruno Haible <bruno@clisp.org>
parents: 34531
diff changeset
6319 func_append subdirs " $testsbase"
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
6320 fi
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
6321
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6322 # Create Makefile.am.
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6323 (echo "## Process this file with automake to produce Makefile.in."
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6324 echo
37076
9c7fbcb4f128 deps: require Automake >= 1.9.6 in generated Makefile fragments
Stefano Lattarini <stefano.lattarini@gmail.com>
parents: 37069
diff changeset
6325 echo "AUTOMAKE_OPTIONS = 1.9.6 foreign"
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6326 echo
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6327 echo "SUBDIRS = $subdirs"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6328 echo
26886
9cdd63c880bc Test other subdirectory names than 'lib' and 'm4'.
Bruno Haible <bruno@clisp.org>
parents: 26878
diff changeset
6329 echo "ACLOCAL_AMFLAGS = -I $m4base"
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6330 ) > "$testdir/Makefile.am"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6331
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6332 # Create configure.ac.
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6333 (echo "# Process this file with autoconf to produce a configure script."
25797
4bece2ccb518 Proper autoconf macro argument quoting.
Bruno Haible <bruno@clisp.org>
parents: 25730
diff changeset
6334 echo "AC_INIT([dummy], [0])"
25800
c7780c4e64f2 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 25799
diff changeset
6335 if test "$auxdir" != "."; then
c7780c4e64f2 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 25799
diff changeset
6336 echo "AC_CONFIG_AUX_DIR([$auxdir])"
c7780c4e64f2 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 25799
diff changeset
6337 fi
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6338 echo "AM_INIT_AUTOMAKE"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6339 echo
31622
538807cfadd1 Replace uses of obsolete Autoconf macros with modern counterparts.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 31610
diff changeset
6340 echo "AC_CONFIG_HEADERS([config.h])"
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6341 echo
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6342 echo "AC_PROG_CC"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6343 echo "AC_PROG_INSTALL"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6344 echo "AC_PROG_MAKE_SET"
26797
67490bc6261d Apply last patch also to --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 26796
diff changeset
6345 echo
27468
16f7f084e066 2007-01-03 Simon Josefsson <simon@josefsson.org>
Simon Josefsson <simon@josefsson.org>
parents: 27462
diff changeset
6346 echo "# For autobuild."
16f7f084e066 2007-01-03 Simon Josefsson <simon@josefsson.org>
Simon Josefsson <simon@josefsson.org>
parents: 27462
diff changeset
6347 echo "AC_CANONICAL_BUILD"
16f7f084e066 2007-01-03 Simon Josefsson <simon@josefsson.org>
Simon Josefsson <simon@josefsson.org>
parents: 27462
diff changeset
6348 echo "AC_CANONICAL_HOST"
16f7f084e066 2007-01-03 Simon Josefsson <simon@josefsson.org>
Simon Josefsson <simon@josefsson.org>
parents: 27462
diff changeset
6349 echo
26797
67490bc6261d Apply last patch also to --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 26796
diff changeset
6350 echo "m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
27177
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
6351 echo "m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
6352 echo "m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
6353 echo "m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
37804
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
6354
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
6355 func_emit_pre_early_macros false '' "$final_modules"
b33224b4d6e9 gnulib-tool: fix tests of 'extensions' module
Pavel Raiskup <praiskup@redhat.com>
parents: 37794
diff changeset
6356
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
6357 if test -n "$any_uses_subdirs"; then
27332
73191cd1d374 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27331
diff changeset
6358 echo "AM_PROG_CC_C_O"
73191cd1d374 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27331
diff changeset
6359 echo
73191cd1d374 Finish support for source files in subdirectories.
Bruno Haible <bruno@clisp.org>
parents: 27331
diff changeset
6360 fi
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6361 for module in $final_modules; do
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6362 if $single_configure; then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6363 func_verify_module
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6364 else
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6365 func_verify_nontests_module
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6366 fi
27770
77fe2b3ddd5c New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 27746
diff changeset
6367 if test -n "$module"; then
77fe2b3ddd5c New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 27746
diff changeset
6368 func_get_autoconf_early_snippet "$module"
77fe2b3ddd5c New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 27746
diff changeset
6369 fi
77fe2b3ddd5c New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 27746
diff changeset
6370 done \
77fe2b3ddd5c New module description section 'configure.ac-early'.
Bruno Haible <bruno@clisp.org>
parents: 27746
diff changeset
6371 | sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
26768
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
6372 if test "$libtool" = true; then
32669
bfda6e39f11c gnulib-tool: Add support for --libtool in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32614
diff changeset
6373 echo "LT_INIT([win32-dll])"
32673
472c7ddee5d7 Fix problem with automake's definition of CXXLINK.
Bruno Haible <bruno@clisp.org>
parents: 32670
diff changeset
6374 echo "LT_LANG([C++])"
26768
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
6375 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
26977
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
6376 echo "gl_cond_libtool=true"
26768
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
6377 else
26109
4cbd6973b4aa Proper autoconf macro argument quoting.
Bruno Haible <bruno@clisp.org>
parents: 26105
diff changeset
6378 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
26977
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
6379 echo "gl_cond_libtool=false"
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
6380 echo "gl_libdeps="
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
6381 echo "gl_ltlibdeps="
26105
0ee5938698ba * gnulib-tool: Define automake conditional GL_COND_LIBTOOL if
Simon Josefsson <simon@josefsson.org>
parents: 26080
diff changeset
6382 fi
26781
669c115edbb3 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 26780
diff changeset
6383 # Wrap the set of autoconf snippets into an autoconf macro that is then
669c115edbb3 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 26780
diff changeset
6384 # invoked. This is needed because autoconf does not support AC_REQUIRE
669c115edbb3 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 26780
diff changeset
6385 # at the top level:
669c115edbb3 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 26780
diff changeset
6386 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
669c115edbb3 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 26780
diff changeset
6387 # but we want the AC_REQUIRE to have its normal meaning (provide one
669c115edbb3 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 26780
diff changeset
6388 # expansion of the required macro before the current point, and only one
669c115edbb3 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 26780
diff changeset
6389 # expansion total).
669c115edbb3 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 26780
diff changeset
6390 echo "AC_DEFUN([gl_INIT], ["
26247
065ab263d5d5 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 26242
diff changeset
6391 if test "$auxdir" != "build-aux"; then
065ab263d5d5 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 26242
diff changeset
6392 sed_replace_build_aux='
065ab263d5d5 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 26242
diff changeset
6393 :a
065ab263d5d5 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 26242
diff changeset
6394 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
065ab263d5d5 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 26242
diff changeset
6395 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
065ab263d5d5 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 26242
diff changeset
6396 ba
065ab263d5d5 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 26242
diff changeset
6397 }'
065ab263d5d5 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 26242
diff changeset
6398 else
30091
1d280945b2f7 Make gnulib-tool work with native 'sed' on AIX.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 30071
diff changeset
6399 sed_replace_build_aux="$sed_noop"
26247
065ab263d5d5 Fix sed_replace_auxdir.
Bruno Haible <bruno@clisp.org>
parents: 26242
diff changeset
6400 fi
32796
e6c5cb9d161b gnulib-tool: Provide the value of --m4-base to modules.
Bruno Haible <bruno@clisp.org>
parents: 32781
diff changeset
6401 echo "gl_m4_base='$m4base'"
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
6402 func_emit_initmacro_start $macro_prefix
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
6403 echo "gl_source_base='$sourcebase'"
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6404 if $single_configure; then
39193
6feb46ed08f6 gnulib-tool: Make --conditional-dependencies work better.
Bruno Haible <bruno@clisp.org>
parents: 39154
diff changeset
6405 func_emit_autoconf_snippets "$main_modules" "$main_modules" func_verify_module true false false
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6406 else
39193
6feb46ed08f6 gnulib-tool: Make --conditional-dependencies work better.
Bruno Haible <bruno@clisp.org>
parents: 39154
diff changeset
6407 func_emit_autoconf_snippets "$modules" "$modules" func_verify_nontests_module true false false
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6408 fi
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
6409 func_emit_initmacro_end $macro_prefix
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6410 if $single_configure; then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6411 echo " gltests_libdeps="
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6412 echo " gltests_ltlibdeps="
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6413 func_emit_initmacro_start ${macro_prefix}tests
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6414 echo " gl_source_base='$testsbase'"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6415 # Define a tests witness macro.
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6416 echo " ${macro_prefix}tests_WITNESS=IN_GNULIB_TESTS"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6417 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6418 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6419 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
39193
6feb46ed08f6 gnulib-tool: Make --conditional-dependencies work better.
Bruno Haible <bruno@clisp.org>
parents: 39154
diff changeset
6420 func_emit_autoconf_snippets "$testsrelated_modules" "$main_modules $testsrelated_modules" func_verify_module true false false
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6421 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6422 func_emit_initmacro_end ${macro_prefix}tests
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6423 fi
26977
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
6424 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
6425 # created using libtool, because libtool already handles the dependencies.
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
6426 if test "$libtool" != true; then
33459
66fa8199c3fe more ports to Solaris tr, which needs [] around ranges
Paul Eggert <eggert@cs.ucla.edu>
parents: 33454
diff changeset
6427 libname_upper=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
26977
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
6428 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
6429 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
6430 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
6431 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
e530c5122afa For libraries not built with libtool:
Bruno Haible <bruno@clisp.org>
parents: 26961
diff changeset
6432 fi
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6433 if $single_configure; then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6434 if $use_libtests; then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6435 echo " LIBTESTS_LIBDEPS=\"\$gltests_libdeps\""
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6436 echo " AC_SUBST([LIBTESTS_LIBDEPS])"
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6437 fi
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6438 fi
26781
669c115edbb3 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 26780
diff changeset
6439 echo "])"
29207
4717dc158f28 Collect sources for tests-related modules in tests/, compile them to libtests.a.
Bruno Haible <bruno@clisp.org>
parents: 29206
diff changeset
6440 func_emit_initmacro_done $macro_prefix $sourcebase
34527
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6441 if $single_configure; then
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6442 func_emit_initmacro_done ${macro_prefix}tests $testsbase
33f5cda65100 gnulib-tool: Alternative structure of testdirs, similar to --import.
Bruno Haible <bruno@clisp.org>
parents: 34524
diff changeset
6443 fi
27177
567b1f6c5127 Add support for multiple gnulib-tool invocations in the scope of a single
Bruno Haible <bruno@clisp.org>
parents: 27176
diff changeset
6444 echo
26781
669c115edbb3 Allow AC_REQUIREs in the configure.ac snippet.
Bruno Haible <bruno@clisp.org>
parents: 26780
diff changeset
6445 echo "gl_INIT"
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6446 echo
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
6447 if test -n "$subdirs_with_configure_ac"; then
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
6448 echo "AC_CONFIG_SUBDIRS(["`echo $subdirs_with_configure_ac`"])"
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
6449 fi
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6450 makefiles="Makefile"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6451 for d in $subdirs; do
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
6452 # For subdirs that have a configure.ac by their own, it's the subdir's
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
6453 # configure.ac which creates the subdir's Makefile.am, not this one.
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
6454 case " $subdirs_with_configure_ac " in
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
6455 *" $d "*) ;;
27014
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
6456 *) func_append makefiles " $d/Makefile" ;;
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
6457 esac
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6458 done
31622
538807cfadd1 Replace uses of obsolete Autoconf macros with modern counterparts.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 31610
diff changeset
6459 echo "AC_CONFIG_FILES([$makefiles])"
538807cfadd1 Replace uses of obsolete Autoconf macros with modern counterparts.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 31610
diff changeset
6460 echo "AC_OUTPUT"
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6461 ) > "$testdir/configure.ac"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6462
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6463 # Create autogenerated files.
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6464 (cd "$testdir"
27176
75068ae47af5 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 27175
diff changeset
6465 # Do not use "${AUTORECONF} --force --install", because it may invoke
75068ae47af5 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 27175
diff changeset
6466 # autopoint, which brings in older versions of some of our .m4 files.
75068ae47af5 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 27175
diff changeset
6467 if test -f $m4base/gettext.m4; then
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
6468 func_execute_command ${AUTOPOINT} --force || func_exit 1
27176
75068ae47af5 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 27175
diff changeset
6469 for f in $m4base/*.m4~; do
30660
86aeab85af1c Fix a gnulib-tool failure.
Bruno Haible <bruno@clisp.org>
parents: 30545
diff changeset
6470 if test -f $f; then
86aeab85af1c Fix a gnulib-tool failure.
Bruno Haible <bruno@clisp.org>
parents: 30545
diff changeset
6471 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit 1
86aeab85af1c Fix a gnulib-tool failure.
Bruno Haible <bruno@clisp.org>
parents: 30545
diff changeset
6472 fi
27176
75068ae47af5 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 27175
diff changeset
6473 done
75068ae47af5 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 27175
diff changeset
6474 fi
32669
bfda6e39f11c gnulib-tool: Add support for --libtool in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32614
diff changeset
6475 if test "$libtool" = true; then
bfda6e39f11c gnulib-tool: Add support for --libtool in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32614
diff changeset
6476 func_execute_command ${LIBTOOLIZE} --copy || func_exit 1
bfda6e39f11c gnulib-tool: Add support for --libtool in --create-testdir.
Bruno Haible <bruno@clisp.org>
parents: 32614
diff changeset
6477 fi
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
6478 func_execute_command ${ACLOCAL} -I $m4base || func_exit 1
27176
75068ae47af5 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 27175
diff changeset
6479 if ! test -d build-aux; then
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
6480 func_execute_command mkdir build-aux || func_exit 1
27176
75068ae47af5 Handle mismatch between latest gettext release and current gnulib.
Bruno Haible <bruno@clisp.org>
parents: 27175
diff changeset
6481 fi
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
6482 func_execute_command ${AUTOCONF} || func_exit 1
38915
177c381baa2d gnulib-tool: Avoid unnecessary config.h.in remaking in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 38846
diff changeset
6483 # Explicit 'touch config.h.in': see <https://savannah.gnu.org/support/index.php?109406>.
38925
dabdf773f103 Port recent gnulib-tool change to Dash
Paul Eggert <eggert@cs.ucla.edu>
parents: 38915
diff changeset
6484 func_execute_command ${AUTOHEADER} &&
dabdf773f103 Port recent gnulib-tool change to Dash
Paul Eggert <eggert@cs.ucla.edu>
parents: 38915
diff changeset
6485 func_execute_command touch config.h.in ||
dabdf773f103 Port recent gnulib-tool change to Dash
Paul Eggert <eggert@cs.ucla.edu>
parents: 38915
diff changeset
6486 func_exit 1
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
6487 func_execute_command ${AUTOMAKE} --add-missing --copy || func_exit 1
38638
39292f9fddf7 gnulib-tool: Clean up after autotools.
Bruno Haible <bruno@clisp.org>
parents: 38631
diff changeset
6488 rm -rf autom4te.cache
27329
30e7bde1d386 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27296
diff changeset
6489 ) || func_exit 1
36623
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
6490 if $inctests && ! $single_configure; then
27329
30e7bde1d386 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27296
diff changeset
6491 # Create autogenerated files.
30e7bde1d386 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27296
diff changeset
6492 (cd "$testdir/$testsbase" || func_exit 1
30e7bde1d386 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27296
diff changeset
6493 # Do not use "${AUTORECONF} --force --install", because it may invoke
30e7bde1d386 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27296
diff changeset
6494 # autopoint, which brings in older versions of some of our .m4 files.
30e7bde1d386 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27296
diff changeset
6495 if test -f ../$m4base/gettext.m4; then
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
6496 func_execute_command ${AUTOPOINT} --force || func_exit 1
27329
30e7bde1d386 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27296
diff changeset
6497 for f in ../$m4base/*.m4~; do
30660
86aeab85af1c Fix a gnulib-tool failure.
Bruno Haible <bruno@clisp.org>
parents: 30545
diff changeset
6498 if test -f $f; then
86aeab85af1c Fix a gnulib-tool failure.
Bruno Haible <bruno@clisp.org>
parents: 30545
diff changeset
6499 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit 1
86aeab85af1c Fix a gnulib-tool failure.
Bruno Haible <bruno@clisp.org>
parents: 30545
diff changeset
6500 fi
27329
30e7bde1d386 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27296
diff changeset
6501 done
30e7bde1d386 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27296
diff changeset
6502 fi
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
6503 func_execute_command ${ACLOCAL} -I ../$m4base || func_exit 1
27329
30e7bde1d386 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27296
diff changeset
6504 if ! test -d ../build-aux; then
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
6505 func_execute_command mkdir ../build-aux
27329
30e7bde1d386 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27296
diff changeset
6506 fi
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
6507 func_execute_command ${AUTOCONF} || func_exit 1
38915
177c381baa2d gnulib-tool: Avoid unnecessary config.h.in remaking in testdirs.
Bruno Haible <bruno@clisp.org>
parents: 38846
diff changeset
6508 # Explicit 'touch config.h.in': see <https://savannah.gnu.org/support/index.php?109406>.
38925
dabdf773f103 Port recent gnulib-tool change to Dash
Paul Eggert <eggert@cs.ucla.edu>
parents: 38915
diff changeset
6509 func_execute_command ${AUTOHEADER} &&
dabdf773f103 Port recent gnulib-tool change to Dash
Paul Eggert <eggert@cs.ucla.edu>
parents: 38915
diff changeset
6510 func_execute_command touch config.h.in ||
dabdf773f103 Port recent gnulib-tool change to Dash
Paul Eggert <eggert@cs.ucla.edu>
parents: 38915
diff changeset
6511 func_exit 1
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
6512 func_execute_command ${AUTOMAKE} --add-missing --copy || func_exit 1
38638
39292f9fddf7 gnulib-tool: Clean up after autotools.
Bruno Haible <bruno@clisp.org>
parents: 38631
diff changeset
6513 rm -rf autom4te.cache
27329
30e7bde1d386 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27296
diff changeset
6514 ) || func_exit 1
30e7bde1d386 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27296
diff changeset
6515 fi
27557
13bbc0762d0a Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 27549
diff changeset
6516 # Need to run configure and make once, to create built files that are to be
33460
dd5f1ea406c5 parse-datetime: better name than get_date
Eric Blake <eblake@redhat.com>
parents: 33459
diff changeset
6517 # distributed (such as parse-datetime.c).
32798
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6518 sed_remove_make_variables='s,[$]([A-Za-z0-9_]*),,g'
28101
d4f859a70a0f Avoiding the "./configure && make && make distclean" did not work most of the
Bruno Haible <bruno@clisp.org>
parents: 28047
diff changeset
6519 # Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...".
37680
c1257e8693cd gnulib-tool: concatenate lib_SOURCES to a single line
Pádraig Brady <P@draigBrady.com>
parents: 37644
diff changeset
6520 cleaned_files=`combine_lines < "$testdir/$sourcebase/Makefile.am" \
28194
1f12c96be792 * gnulib-tool: Rearrange space-tab sequences, since some editors
Eric Blake <ebb9@byu.net>
parents: 28142
diff changeset
6521 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
28101
d4f859a70a0f Avoiding the "./configure && make && make distclean" did not work most of the
Bruno Haible <bruno@clisp.org>
parents: 28047
diff changeset
6522 cleaned_files=`for file in $cleaned_files; do echo " $file "; done`
27557
13bbc0762d0a Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 27549
diff changeset
6523 # Extract the value of "BUILT_SOURCES += ...". Remove variable references
13bbc0762d0a Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 27549
diff changeset
6524 # such $(FOO_H) because they don't refer to distributed files.
37680
c1257e8693cd gnulib-tool: concatenate lib_SOURCES to a single line
Pádraig Brady <P@draigBrady.com>
parents: 37644
diff changeset
6525 built_sources=`combine_lines < "$testdir/$sourcebase/Makefile.am" \
28194
1f12c96be792 * gnulib-tool: Rearrange space-tab sequences, since some editors
Eric Blake <ebb9@byu.net>
parents: 28142
diff changeset
6526 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
27557
13bbc0762d0a Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 27549
diff changeset
6527 | sed -e "$sed_remove_make_variables"`
13bbc0762d0a Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 27549
diff changeset
6528 distributed_built_sources=`for file in $built_sources; do
13bbc0762d0a Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 27549
diff changeset
6529 case "$cleaned_files" in
13bbc0762d0a Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 27549
diff changeset
6530 *" "$file" "*) ;;
13bbc0762d0a Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 27549
diff changeset
6531 *) echo $file ;;
13bbc0762d0a Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 27549
diff changeset
6532 esac;
13bbc0762d0a Don't unnecessarily run configure and make.
Bruno Haible <bruno@clisp.org>
parents: 27549
diff changeset
6533 done`
32798
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6534 tests_distributed_built_sources=
36623
1e4c74ea8e54 gnulib-tool: Refactor inctests variable.
Bruno Haible <bruno@clisp.org>
parents: 36622
diff changeset
6535 if $inctests; then
32798
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6536 # Likewise for built files in the $testsbase directory.
37680
c1257e8693cd gnulib-tool: concatenate lib_SOURCES to a single line
Pádraig Brady <P@draigBrady.com>
parents: 37644
diff changeset
6537 tests_cleaned_files=`combine_lines < "$testdir/$testsbase/Makefile.am" \
32798
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6538 | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6539 tests_cleaned_files=`for file in $tests_cleaned_files; do echo " $file "; done`
37680
c1257e8693cd gnulib-tool: concatenate lib_SOURCES to a single line
Pádraig Brady <P@draigBrady.com>
parents: 37644
diff changeset
6540 tests_built_sources=`combine_lines < "$testdir/$testsbase/Makefile.am" \
32798
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6541 | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6542 | sed -e "$sed_remove_make_variables"`
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6543 tests_distributed_built_sources=`for file in $tests_built_sources; do
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6544 case "$tests_cleaned_files" in
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6545 *" "$file" "*) ;;
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6546 *) echo $file ;;
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6547 esac;
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6548 done`
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6549 fi
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6550 if test -n "$distributed_built_sources" || test -n "$tests_distributed_built_sources"; then
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6551 (cd "$testdir"
27329
30e7bde1d386 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27296
diff changeset
6552 ./configure || func_exit 1
32798
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6553 if test -n "$distributed_built_sources"; then
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6554 cd "$sourcebase"
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6555 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6556 $MAKE AUTOCONF="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6557 built_sources \
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6558 || func_exit 1
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6559 cd ..
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6560 fi
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6561 if test -n "$tests_distributed_built_sources"; then
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6562 cd "$testsbase"
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6563 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6564 $MAKE AUTOCONF="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6565 built_sources \
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6566 || func_exit 1
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6567 cd ..
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6568 fi
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6569 $MAKE AUTOCONF="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6570 distclean \
dc9692436fd9 gnulib-tool: Create distributed built sources also for the tests.
Bruno Haible <bruno@clisp.org>
parents: 32797
diff changeset
6571 || func_exit 1
27329
30e7bde1d386 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27296
diff changeset
6572 ) || func_exit 1
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6573 fi
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6574 }
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6575
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6576 # func_create_megatestdir megatestdir allmodules
25800
c7780c4e64f2 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 25799
diff changeset
6577 # Input:
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
6578 # - local_gnulib_path from --local-dir
32548
7985653cee1d gnulib-tool: Fix up caching patches.
Bruno Haible <bruno@clisp.org>
parents: 32547
diff changeset
6579 # - modcache true or false, from --cache-modules/--no-cache-modules
25800
c7780c4e64f2 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 25799
diff changeset
6580 # - auxdir directory relative to destdir where to place build aux files
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6581 func_create_megatestdir ()
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6582 {
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6583 megatestdir="$1"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6584 allmodules="$2"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6585 if test -z "$allmodules"; then
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6586 allmodules=`func_all_modules`
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6587 fi
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6588
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6589 megasubdirs=
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6590 # First, all modules one by one.
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6591 for onemodule in $allmodules; do
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6592 func_create_testdir "$megatestdir/$onemodule" $onemodule
27014
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
6593 func_append megasubdirs "$onemodule "
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6594 done
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6595 # Then, all modules all together.
27041
d2caa9db1c8c Don't include the config-h module in megatestdir.
Bruno Haible <bruno@clisp.org>
parents: 27039
diff changeset
6596 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
31428
046f085875cb Undo last gnulib-tool commit: maintainer-makefile is fixed.
Bruno Haible <bruno@clisp.org>
parents: 31425
diff changeset
6597 allmodules=`for m in $allmodules; do if test $m != config-h; then echo $m; fi; done`
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6598 func_create_testdir "$megatestdir/ALL" "$allmodules"
27014
073e679d8bea Avoid quadratic complexity due to string concatenations.
Bruno Haible <bruno@clisp.org>
parents: 27013
diff changeset
6599 func_append megasubdirs "ALL"
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6600
28107
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6601 # Create autobuild.
37069
ad409ab5c454 Assume gnulib is checked out from Git, not CVS
Stefano Lattarini <stefano.lattarini@gmail.com>
parents: 36960
diff changeset
6602 cvsdate=`vc_witness="$gnulib_dir/.git/refs/heads/master"; \
29068
eb9c66e92bc3 Update after move from cvs to git.
Bruno Haible <bruno@clisp.org>
parents: 29046
diff changeset
6603 sh "$gnulib_dir/build-aux/mdate-sh" "$vc_witness" \
28107
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6604 | sed -e 's,January,01,' -e 's,Jan,01,' \
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6605 -e 's,February,02,' -e 's,Feb,02,' \
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6606 -e 's,March,03,' -e 's,Mar,03,' \
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6607 -e 's,April,04,' -e 's,Apr,04,' \
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6608 -e 's,May,05,' \
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6609 -e 's,June,06,' -e 's,Jun,06,' \
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6610 -e 's,July,07,' -e 's,Jul,07,' \
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6611 -e 's,August,08,' -e 's,Aug,08,' \
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6612 -e 's,September,09,' -e 's,Sep,09,' \
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6613 -e 's,October,10,' -e 's,Oct,10,' \
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6614 -e 's,November,11,' -e 's,Nov,11,' \
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6615 -e 's,December,12,' -e 's,Dec,12,' \
28713
5fc5f06c1ac7 * gnulib-tool: Fix indentation.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 28701
diff changeset
6616 -e 's,^,00,' -e 's,^[0-9]*\([0-9][0-9] \),\1,' \
28696
9dd6cf2c070c * gnulib-tool (IFS): Initialize early, so we don't set it to
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 28694
diff changeset
6617 -e 's,^\([0-9]*\) \([0-9]*\) \([0-9]*\),\3\2\1,'`
28109
fd20ff8b8682 Start the autobuild script with /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 28107
diff changeset
6618 (echo '#!/bin/sh'
fd20ff8b8682 Start the autobuild script with /bin/sh.
Bruno Haible <bruno@clisp.org>
parents: 28107
diff changeset
6619 echo "CVSDATE=$cvsdate"
31094
463b488ace7a gnulib-tool: use $MAKE not make in generated files
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 30952
diff changeset
6620 echo ": \${MAKE=make}"
28107
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6621 echo "test -d logs || mkdir logs"
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6622 echo "for module in $megasubdirs; do"
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6623 echo " echo \"Working on module \$module...\""
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6624 echo " safemodule=\`echo \$module | sed -e 's|/|-|g'\`"
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6625 echo " (echo \"To: gnulib@autobuild.josefsson.org\""
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6626 echo " echo"
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6627 echo " set -x"
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6628 echo " : autobuild project... \$module"
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6629 echo " : autobuild revision... cvs-\$CVSDATE-000000"
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6630 echo " : autobuild timestamp... \`date \"+%Y%m%d-%H%M%S\"\`"
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6631 echo " : autobuild hostname... \`hostname\`"
31094
463b488ace7a gnulib-tool: use $MAKE not make in generated files
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 30952
diff changeset
6632 echo " cd \$module && ./configure \$CONFIGURE_OPTIONS && \$MAKE && \$MAKE check && \$MAKE distclean"
28107
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6633 echo " echo rc=\$?"
28110
8c8ff0cf35b6 Avoid using sed -e "", not supported by AIX sed.
Bruno Haible <bruno@clisp.org>
parents: 28109
diff changeset
6634 echo " ) 2>&1 | { if test -n \"\$AUTOBUILD_SUBST\"; then sed -e \"\$AUTOBUILD_SUBST\"; else cat; fi; } > logs/\$safemodule"
28107
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6635 echo "done"
28363
4738c5b3fc20 2007-04-12 Simon Josefsson <simon@josefsson.org>
Simon Josefsson <simon@josefsson.org>
parents: 28359
diff changeset
6636 ) > "$megatestdir/do-autobuild"
4738c5b3fc20 2007-04-12 Simon Josefsson <simon@josefsson.org>
Simon Josefsson <simon@josefsson.org>
parents: 28359
diff changeset
6637 chmod a+x "$megatestdir/do-autobuild"
28107
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6638
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6639 # Create Makefile.am.
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6640 (echo "## Process this file with automake to produce Makefile.in."
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6641 echo
37076
9c7fbcb4f128 deps: require Automake >= 1.9.6 in generated Makefile fragments
Stefano Lattarini <stefano.lattarini@gmail.com>
parents: 37069
diff changeset
6642 echo "AUTOMAKE_OPTIONS = 1.9.6 foreign"
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6643 echo
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6644 echo "SUBDIRS = $megasubdirs"
28107
c5bd9b6fd360 Create also an autobuild script.
Bruno Haible <bruno@clisp.org>
parents: 28101
diff changeset
6645 echo
28363
4738c5b3fc20 2007-04-12 Simon Josefsson <simon@josefsson.org>
Simon Josefsson <simon@josefsson.org>
parents: 28359
diff changeset
6646 echo "EXTRA_DIST = do-autobuild"
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6647 ) > "$megatestdir/Makefile.am"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6648
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6649 # Create configure.ac.
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6650 (echo "# Process this file with autoconf to produce a configure script."
25797
4bece2ccb518 Proper autoconf macro argument quoting.
Bruno Haible <bruno@clisp.org>
parents: 25730
diff changeset
6651 echo "AC_INIT([dummy], [0])"
25800
c7780c4e64f2 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 25799
diff changeset
6652 if test "$auxdir" != "."; then
c7780c4e64f2 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 25799
diff changeset
6653 echo "AC_CONFIG_AUX_DIR([$auxdir])"
c7780c4e64f2 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 25799
diff changeset
6654 fi
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6655 echo "AM_INIT_AUTOMAKE"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6656 echo
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6657 echo "AC_PROG_MAKE_SET"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6658 echo
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6659 echo "AC_CONFIG_SUBDIRS([$megasubdirs])"
31622
538807cfadd1 Replace uses of obsolete Autoconf macros with modern counterparts.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 31610
diff changeset
6660 echo "AC_CONFIG_FILES([Makefile])"
538807cfadd1 Replace uses of obsolete Autoconf macros with modern counterparts.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 31610
diff changeset
6661 echo "AC_OUTPUT"
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6662 ) > "$megatestdir/configure.ac"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6663
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6664 # Create autogenerated files.
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6665 (cd "$megatestdir"
26238
51a51b4ff67f Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 26237
diff changeset
6666 # Do not use "${AUTORECONF} --install", because autoreconf operates
51a51b4ff67f Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 26237
diff changeset
6667 # recursively, but the subdirectories are already finished, therefore
51a51b4ff67f Don't waste time in a recursive autoreconf.
Bruno Haible <bruno@clisp.org>
parents: 26237
diff changeset
6668 # calling autoreconf here would only waste lots of CPU time.
28879
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
6669 func_execute_command ${ACLOCAL} || func_exit 1
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
6670 func_execute_command mkdir build-aux
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
6671 func_execute_command ${AUTOCONF} || func_exit 1
e01bf527d4f4 New options --verbose, --quiet.
Bruno Haible <bruno@clisp.org>
parents: 28878
diff changeset
6672 func_execute_command ${AUTOMAKE} --add-missing --copy || func_exit 1
38638
39292f9fddf7 gnulib-tool: Clean up after autotools.
Bruno Haible <bruno@clisp.org>
parents: 38631
diff changeset
6673 rm -rf autom4te.cache
27329
30e7bde1d386 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27296
diff changeset
6674 ) || func_exit 1
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6675 }
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6676
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6677 case $mode in
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6678 "" )
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6679 func_fatal_error "no mode specified" ;;
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6680
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6681 list )
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6682 func_all_modules
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6683 ;;
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6684
32567
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6685 find )
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6686 # sed expression that converts a literal to a basic regular expression.
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6687 # Needs to handle . [ \ * ^ $.
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6688 sed_literal_to_basic_regex='s/\\/\\\\/g
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6689 s/\[/\\[/g
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6690 s/\^/\\^/g
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6691 s/\([.*$]\)/[\1]/g'
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6692 for filename
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6693 do
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6694 if test -f "$gnulib_dir/$filename" \
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
6695 || func_lookup_local_file "$filename"; then
32568
195033961f8a Tweak last commit: Reduce the candidate list.
Bruno Haible <bruno@clisp.org>
parents: 32567
diff changeset
6696 filename_anywhere_regex=`echo "$filename" | sed -e "$sed_literal_to_basic_regex"`
195033961f8a Tweak last commit: Reduce the candidate list.
Bruno Haible <bruno@clisp.org>
parents: 32567
diff changeset
6697 filename_line_regex='^'"$filename_anywhere_regex"'$'
32567
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6698 module_candidates=`
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6699 {
32568
195033961f8a Tweak last commit: Reduce the candidate list.
Bruno Haible <bruno@clisp.org>
parents: 32567
diff changeset
6700 (cd "$gnulib_dir" && find modules -type f -print | xargs -n 100 grep -l "$filename_line_regex" /dev/null | sed -e 's,^modules/,,')
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
6701 func_path_foreach "$local_gnulib_path" func_modules_in_dir %dir% | xargs -n 100 grep -l "$filename_anywhere_regex" /dev/null | sed -e 's,^modules/,,' -e 's,\.diff$,,'
32567
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6702 } \
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6703 | func_sanitize_modulelist \
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6704 | LC_ALL=C sort -u
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6705 `
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6706 for module in $module_candidates; do
32568
195033961f8a Tweak last commit: Reduce the candidate list.
Bruno Haible <bruno@clisp.org>
parents: 32567
diff changeset
6707 if func_get_filelist $module | grep "$filename_line_regex" > /dev/null; then
32567
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6708 echo $module
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6709 fi
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6710 done
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6711 else
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6712 func_warning "file $filename does not exist"
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6713 fi
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6714 done
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6715 ;;
cd80080a8294 Make it easier to find modules. New gnulib-tool option '--find'.
Bruno Haible <bruno@clisp.org>
parents: 32550
diff changeset
6716
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6717 import | add-import | remove-import | update )
26631
058df35bd9f8 * gnulib-tool (func_get_filelist): Don't echo m4/onceonly_2_57.m4,
Paul Eggert <eggert@cs.ucla.edu>
parents: 26553
diff changeset
6718
25034
e16b271da962 Untabify.
Bruno Haible <bruno@clisp.org>
parents: 25003
diff changeset
6719 # Where to import.
e16b271da962 Untabify.
Bruno Haible <bruno@clisp.org>
parents: 25003
diff changeset
6720 if test -z "$destdir"; then
e16b271da962 Untabify.
Bruno Haible <bruno@clisp.org>
parents: 25003
diff changeset
6721 destdir=.
e16b271da962 Untabify.
Bruno Haible <bruno@clisp.org>
parents: 25003
diff changeset
6722 fi
e16b271da962 Untabify.
Bruno Haible <bruno@clisp.org>
parents: 25003
diff changeset
6723 test -d "$destdir" \
e16b271da962 Untabify.
Bruno Haible <bruno@clisp.org>
parents: 25003
diff changeset
6724 || func_fatal_error "destination directory does not exist: $destdir"
24893
34b357ffb87e Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 24889
diff changeset
6725
25874
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6726 # Prefer configure.ac to configure.in.
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6727 if test -f "$destdir"/configure.ac; then
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6728 configure_ac="$destdir/configure.ac"
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6729 else
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6730 if test -f "$destdir"/configure.in; then
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6731 configure_ac="$destdir/configure.in"
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6732 else
31712
935265154f43 Add advice to an error message.
Bruno Haible <bruno@clisp.org>
parents: 31622
diff changeset
6733 func_fatal_error "cannot find $destdir/configure.ac - make sure you run gnulib-tool from within your package's directory"
25874
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6734 fi
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6735 fi
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6736
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6737 # Analyze configure.ac.
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6738 guessed_auxdir="."
26768
e17f433521ce New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 26767
diff changeset
6739 guessed_libtool=false
25874
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6740 my_sed_traces='
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6741 s,#.*$,,
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6742 s,^dnl .*$,,
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6743 s, dnl .*$,,
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6744 /AC_CONFIG_AUX_DIR/ {
30678
1c749532df25 Fix a security bug.
Bruno Haible <bruno@clisp.org>
parents: 30677
diff changeset
6745 s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^]"$`\\)]*\).*$,guessed_auxdir="\1",p
25489
078dc4f32daa 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 25376
diff changeset
6746 }
25874
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6747 /A[CM]_PROG_LIBTOOL/ {
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6748 s,^.*$,guessed_libtool=true,p
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6749 }'
27443
c2d5698794da * gnulib-tool (SED): Remove, undoing previous change.
Paul Eggert <eggert@cs.ucla.edu>
parents: 27428
diff changeset
6750 eval `sed -n -e "$my_sed_traces" < "$configure_ac"`
24893
34b357ffb87e Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 24889
diff changeset
6751
25874
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6752 if test -z "$auxdir"; then
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6753 auxdir="$guessed_auxdir"
25034
e16b271da962 Untabify.
Bruno Haible <bruno@clisp.org>
parents: 25003
diff changeset
6754 fi
24893
34b357ffb87e Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 24889
diff changeset
6755
25874
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6756 # Determine where to apply func_import.
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6757 if test "$mode" = import; then
25874
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6758 # Apply func_import to a particular gnulib directory.
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6759 # The command line contains the complete specification; don't look at
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6760 # the contents of gnulib-cache.m4.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6761 test -n "$supplied_libname" || supplied_libname=true
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6762 test -n "$sourcebase" || sourcebase="lib"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6763 test -n "$m4base" || m4base="m4"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6764 test -n "$docbase" || docbase="doc"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6765 test -n "$testsbase" || testsbase="tests"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6766 test -n "$macro_prefix" || macro_prefix="gl"
25874
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6767 func_import "$*"
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6768 else
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6769 if test -n "$m4base"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6770 # Apply func_import to a particular gnulib directory.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6771 # Any number of additional modules can be given.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6772 if test ! -f "$destdir/$m4base"/gnulib-cache.m4; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6773 # First use of gnulib in the given m4base.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6774 test -n "$supplied_libname" || supplied_libname=true
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6775 test -n "$sourcebase" || sourcebase="lib"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6776 test -n "$docbase" || docbase="doc"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6777 test -n "$testsbase" || testsbase="tests"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6778 test -n "$macro_prefix" || macro_prefix="gl"
25874
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6779 fi
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6780 func_import "$*"
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6781 else
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6782 # Apply func_import to all gnulib directories.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6783 # To get this list of directories, look at Makefile.am. (Not at
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6784 # configure, because it may be omitted from version control. Also,
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6785 # don't run "find $destdir -name gnulib-cache.m4", as it might be
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6786 # too expensive.)
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6787 m4dirs=
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6788 m4dirs_count=0
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6789 if test -f "$destdir"/Makefile.am; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6790 aclocal_amflags=`sed -n -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/p' "$destdir"/Makefile.am`
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6791 m4dir_is_next=
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6792 for arg in $aclocal_amflags; do
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6793 if test -n "$m4dir_is_next"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6794 # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6795 case "$arg" in
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6796 /*) ;;
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6797 *)
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6798 if test -f "$destdir/$arg"/gnulib-cache.m4; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6799 func_append m4dirs " $arg"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6800 m4dirs_count=`expr $m4dirs_count + 1`
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6801 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6802 ;;
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6803 esac
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6804 m4dir_is_next=
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6805 else
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6806 if test "X$arg" = "X-I"; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6807 m4dir_is_next=yes
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6808 else
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6809 m4dir_is_next=
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6810 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6811 fi
25874
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6812 done
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6813 else
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6814 # No Makefile.am! Oh well. Look at the last generated aclocal.m4.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6815 if test -f "$destdir"/aclocal.m4; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6816 sedexpr1='s,^m4_include(\[\(.*\)])$,\1,p'
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6817 sedexpr2='s,^[^/]*$,.,'
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6818 sedexpr3='s,/[^/]*$,,'
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6819 m4dirs=`sed -n -e "$sedexpr1" aclocal.m4 | sed -e "$sedexpr2" -e "$sedexpr3" | LC_ALL=C sort -u`
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6820 m4dirs=`for arg in $m4dirs; do if test -f "$destdir/$arg"/gnulib-cache.m4; then echo $arg; fi; done`
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6821 m4dirs_count=`for arg in $m4dirs; do echo "$arg"; done | wc -l`
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6822 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6823 fi
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6824 if test $m4dirs_count = 0; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6825 # First use of gnulib in a package.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6826 # Any number of additional modules can be given.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6827 test -n "$supplied_libname" || supplied_libname=true
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6828 test -n "$sourcebase" || sourcebase="lib"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6829 m4base="m4"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6830 test -n "$docbase" || docbase="doc"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6831 test -n "$testsbase" || testsbase="tests"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6832 test -n "$macro_prefix" || macro_prefix="gl"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6833 func_import "$*"
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6834 else
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6835 if test $m4dirs_count = 1; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6836 # There's only one use of gnulib here. Assume the user means it.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6837 # Any number of additional modules can be given.
25874
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6838 for m4base in $m4dirs; do
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6839 func_import "$*"
25874
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6840 done
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6841 else
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6842 # Ambiguous - guess what the user meant.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6843 if test $# = 0; then
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6844 # No further arguments. Guess the user wants to update all of them.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6845 for m4base in $m4dirs; do
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6846 # Perform func_import in a subshell, so that variable values
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6847 # such as
37853
afdf4aebd46a gnulib-tool: allow multiple --local-dir usage
Pavel Raiskup <praiskup@redhat.com>
parents: 37804
diff changeset
6848 # local_gnulib_path, incobsolete, inc_cxx_tests,
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6849 # inc_longrunning_tests, inc_privileged_tests,
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6850 # inc_unportable_tests, inc_all_tests, avoidlist, sourcebase,
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6851 # m4base, pobase, docbase, testsbase, inctests, libname, lgpl,
34585
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
6852 # makefile_name, libtool, macro_prefix, po_domain,
7e4be8f26e15 gnulib-tool: Better isolation between different gnulib-tool invocations.
Bruno Haible <bruno@clisp.org>
parents: 34532
diff changeset
6853 # witness_c_macro, vc_files
33329
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6854 # don't propagate from one directory to another.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6855 (func_import) || func_exit 1
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6856 done
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6857 else
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6858 # Really ambiguous.
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6859 func_fatal_error "Ambiguity: to which directory should the modules be added? Please specify at least --m4-base=..."
a83430863bdd gnulib-tool: Change --import. New options --add/remove-import.
Bruno Haible <bruno@clisp.org>
parents: 33327
diff changeset
6860 fi
25874
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6861 fi
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6862 fi
285390a30d79 Make it possible to use multiple gnulib instantiations with the same
Bruno Haible <bruno@clisp.org>
parents: 25873
diff changeset
6863 fi
25869
09d68312511e Rename some variables.
Bruno Haible <bruno@clisp.org>
parents: 25868
diff changeset
6864 fi
25034
e16b271da962 Untabify.
Bruno Haible <bruno@clisp.org>
parents: 25003
diff changeset
6865 ;;
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6866
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6867 create-testdir )
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6868 if test -z "$destdir"; then
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6869 func_fatal_error "please specify --dir option"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6870 fi
23817
b32568f8e9fd (create-testdir): don't complain if destdir
Karl Berry <karl@freefriends.org>
parents: 23815
diff changeset
6871 mkdir "$destdir"
b32568f8e9fd (create-testdir): don't complain if destdir
Karl Berry <karl@freefriends.org>
parents: 23815
diff changeset
6872 test -d "$destdir" \
b32568f8e9fd (create-testdir): don't complain if destdir
Karl Berry <karl@freefriends.org>
parents: 23815
diff changeset
6873 || func_fatal_error "could not create destination directory"
25800
c7780c4e64f2 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 25799
diff changeset
6874 test -n "$auxdir" || auxdir="build-aux"
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6875 func_create_testdir "$destdir" "$*"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6876 ;;
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6877
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6878 create-megatestdir )
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6879 if test -z "$destdir"; then
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6880 func_fatal_error "please specify --dir option"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6881 fi
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6882 mkdir "$destdir" || func_fatal_error "could not create destination directory"
25800
c7780c4e64f2 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 25799
diff changeset
6883 test -n "$auxdir" || auxdir="build-aux"
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6884 func_create_megatestdir "$destdir" "$*"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6885 ;;
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6886
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6887 test )
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6888 test -n "$destdir" || destdir=testdir$$
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6889 mkdir "$destdir" || func_fatal_error "could not create destination directory"
25800
c7780c4e64f2 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 25799
diff changeset
6890 test -n "$auxdir" || auxdir="build-aux"
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6891 func_create_testdir "$destdir" "$*"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6892 cd "$destdir"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6893 mkdir build
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6894 cd build
27329
30e7bde1d386 * gnulib-tool (func_create_testdir): Fix replacement of
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27296
diff changeset
6895 ../configure || func_exit 1
31095
9b202fc78b1b gnulib-tool: execute $MAKE not make
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 31094
diff changeset
6896 $MAKE || func_exit 1
9b202fc78b1b gnulib-tool: execute $MAKE not make
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 31094
diff changeset
6897 $MAKE check || func_exit 1
9b202fc78b1b gnulib-tool: execute $MAKE not make
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 31094
diff changeset
6898 $MAKE distclean || func_exit 1
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6899 remaining=`find . -type f -print`
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6900 if test -n "$remaining"; then
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6901 echo "Remaining files:" $remaining 1>&2
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6902 echo "gnulib-tool: *** Stop." 1>&2
27023
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
6903 func_exit 1
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6904 fi
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6905 cd ..
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6906 cd ..
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6907 rm -rf "$destdir"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6908 ;;
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6909
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6910 megatest )
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6911 test -n "$destdir" || destdir=testdir$$
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6912 mkdir "$destdir" || func_fatal_error "could not create destination directory"
25800
c7780c4e64f2 Generalize support for --aux-dir.
Bruno Haible <bruno@clisp.org>
parents: 25799
diff changeset
6913 test -n "$auxdir" || auxdir="build-aux"
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6914 func_create_megatestdir "$destdir" "$*"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6915 cd "$destdir"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6916 mkdir build
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6917 cd build
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6918 ../configure
31095
9b202fc78b1b gnulib-tool: execute $MAKE not make
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 31094
diff changeset
6919 $MAKE
9b202fc78b1b gnulib-tool: execute $MAKE not make
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 31094
diff changeset
6920 $MAKE check
9b202fc78b1b gnulib-tool: execute $MAKE not make
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 31094
diff changeset
6921 $MAKE distclean
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6922 remaining=`find . -type f -print`
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6923 if test -n "$remaining"; then
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6924 echo "Remaining files:" $remaining 1>&2
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6925 echo "gnulib-tool: *** Stop." 1>&2
27023
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
6926 func_exit 1
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6927 fi
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6928 cd ..
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6929 cd ..
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6930 rm -rf "$destdir"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6931 ;;
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6932
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6933 extract-description )
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6934 for module
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6935 do
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6936 func_verify_module
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6937 if test -n "$module"; then
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6938 func_get_description "$module"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6939 fi
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6940 done
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6941 ;;
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6942
32761
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
6943 extract-comment )
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
6944 for module
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
6945 do
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
6946 func_verify_module
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
6947 if test -n "$module"; then
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
6948 func_get_comment "$module"
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
6949 fi
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
6950 done
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
6951 ;;
5951993580c3 New module description field 'Comment'.
Bruno Haible <bruno@clisp.org>
parents: 32760
diff changeset
6952
30434
46e6cd35a028 Modules now have a 'status' attribute.
Bruno Haible <bruno@clisp.org>
parents: 30423
diff changeset
6953 extract-status )
46e6cd35a028 Modules now have a 'status' attribute.
Bruno Haible <bruno@clisp.org>
parents: 30423
diff changeset
6954 for module
46e6cd35a028 Modules now have a 'status' attribute.
Bruno Haible <bruno@clisp.org>
parents: 30423
diff changeset
6955 do
46e6cd35a028 Modules now have a 'status' attribute.
Bruno Haible <bruno@clisp.org>
parents: 30423
diff changeset
6956 func_verify_module
46e6cd35a028 Modules now have a 'status' attribute.
Bruno Haible <bruno@clisp.org>
parents: 30423
diff changeset
6957 if test -n "$module"; then
46e6cd35a028 Modules now have a 'status' attribute.
Bruno Haible <bruno@clisp.org>
parents: 30423
diff changeset
6958 func_get_status "$module"
46e6cd35a028 Modules now have a 'status' attribute.
Bruno Haible <bruno@clisp.org>
parents: 30423
diff changeset
6959 fi
46e6cd35a028 Modules now have a 'status' attribute.
Bruno Haible <bruno@clisp.org>
parents: 30423
diff changeset
6960 done
46e6cd35a028 Modules now have a 'status' attribute.
Bruno Haible <bruno@clisp.org>
parents: 30423
diff changeset
6961 ;;
46e6cd35a028 Modules now have a 'status' attribute.
Bruno Haible <bruno@clisp.org>
parents: 30423
diff changeset
6962
28880
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
6963 extract-notice )
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
6964 for module
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
6965 do
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
6966 func_verify_module
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
6967 if test -n "$module"; then
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
6968 func_get_notice "$module"
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
6969 fi
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
6970 done
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
6971 ;;
0e4090cb3c01 Allow for modules to show an arbitrary notice.
Bruno Haible <bruno@clisp.org>
parents: 28879
diff changeset
6972
32151
ec3aec36193f New module attribute 'Applicability'.
Bruno Haible <bruno@clisp.org>
parents: 32108
diff changeset
6973 extract-applicability )
ec3aec36193f New module attribute 'Applicability'.
Bruno Haible <bruno@clisp.org>
parents: 32108
diff changeset
6974 for module
ec3aec36193f New module attribute 'Applicability'.
Bruno Haible <bruno@clisp.org>
parents: 32108
diff changeset
6975 do
ec3aec36193f New module attribute 'Applicability'.
Bruno Haible <bruno@clisp.org>
parents: 32108
diff changeset
6976 func_verify_module
ec3aec36193f New module attribute 'Applicability'.
Bruno Haible <bruno@clisp.org>
parents: 32108
diff changeset
6977 if test -n "$module"; then
ec3aec36193f New module attribute 'Applicability'.
Bruno Haible <bruno@clisp.org>
parents: 32108
diff changeset
6978 func_get_applicability "$module"
ec3aec36193f New module attribute 'Applicability'.
Bruno Haible <bruno@clisp.org>
parents: 32108
diff changeset
6979 fi
ec3aec36193f New module attribute 'Applicability'.
Bruno Haible <bruno@clisp.org>
parents: 32108
diff changeset
6980 done
ec3aec36193f New module attribute 'Applicability'.
Bruno Haible <bruno@clisp.org>
parents: 32108
diff changeset
6981 ;;
ec3aec36193f New module attribute 'Applicability'.
Bruno Haible <bruno@clisp.org>
parents: 32108
diff changeset
6982
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6983 extract-filelist )
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6984 for module
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6985 do
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6986 func_verify_module
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6987 if test -n "$module"; then
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6988 func_get_filelist "$module"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6989 fi
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6990 done
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6991 ;;
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6992
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6993 extract-dependencies )
35544
6ee17ba14829 gnulib-tool: don't follow dependencies to avoided modules
Paul Eggert <eggert@cs.ucla.edu>
parents: 35543
diff changeset
6994 if test -n "$avoidlist"; then
6ee17ba14829 gnulib-tool: don't follow dependencies to avoided modules
Paul Eggert <eggert@cs.ucla.edu>
parents: 35543
diff changeset
6995 func_fatal_error "cannot combine --avoid and --extract-dependencies"
6ee17ba14829 gnulib-tool: don't follow dependencies to avoided modules
Paul Eggert <eggert@cs.ucla.edu>
parents: 35543
diff changeset
6996 fi
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6997 for module
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6998 do
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6999 func_verify_module
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7000 if test -n "$module"; then
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7001 func_get_dependencies "$module"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7002 fi
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7003 done
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7004 ;;
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7005
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7006 extract-autoconf-snippet )
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7007 for module
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7008 do
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7009 func_verify_module
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7010 if test -n "$module"; then
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7011 func_get_autoconf_snippet "$module"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7012 fi
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7013 done
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7014 ;;
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7015
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7016 extract-automake-snippet )
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7017 for module
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7018 do
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7019 func_verify_module
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7020 if test -n "$module"; then
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7021 func_get_automake_snippet "$module"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7022 fi
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7023 done
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7024 ;;
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7025
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7026 extract-include-directive )
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7027 for module
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7028 do
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7029 func_verify_module
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7030 if test -n "$module"; then
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7031 func_get_include_directive "$module"
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7032 fi
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7033 done
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7034 ;;
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7035
27746
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
7036 extract-link-directive )
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
7037 for module
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
7038 do
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
7039 func_verify_module
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
7040 if test -n "$module"; then
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
7041 func_get_link_directive "$module"
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
7042 fi
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
7043 done
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
7044 ;;
13660b673233 New module description field 'Link'.
Bruno Haible <bruno@clisp.org>
parents: 27731
diff changeset
7045
24942
c85b8fccd94e Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 24941
diff changeset
7046 extract-license )
c85b8fccd94e Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 24941
diff changeset
7047 for module
c85b8fccd94e Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 24941
diff changeset
7048 do
c85b8fccd94e Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 24941
diff changeset
7049 func_verify_module
c85b8fccd94e Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 24941
diff changeset
7050 if test -n "$module"; then
c85b8fccd94e Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 24941
diff changeset
7051 func_get_license "$module"
c85b8fccd94e Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 24941
diff changeset
7052 fi
c85b8fccd94e Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 24941
diff changeset
7053 done
c85b8fccd94e Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 24941
diff changeset
7054 ;;
c85b8fccd94e Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 24941
diff changeset
7055
23888
811702529909 Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 23866
diff changeset
7056 extract-maintainer )
811702529909 Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 23866
diff changeset
7057 for module
811702529909 Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 23866
diff changeset
7058 do
811702529909 Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 23866
diff changeset
7059 func_verify_module
811702529909 Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 23866
diff changeset
7060 if test -n "$module"; then
811702529909 Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 23866
diff changeset
7061 func_get_maintainer "$module"
811702529909 Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 23866
diff changeset
7062 fi
811702529909 Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 23866
diff changeset
7063 done
811702529909 Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 23866
diff changeset
7064 ;;
811702529909 Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 23866
diff changeset
7065
25804
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
7066 extract-tests-module )
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
7067 for module
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
7068 do
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
7069 func_verify_module
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
7070 if test -n "$module"; then
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
7071 func_get_tests_module "$module"
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
7072 fi
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
7073 done
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
7074 ;;
6f643c834ebb Support for unit test modules.
Bruno Haible <bruno@clisp.org>
parents: 25802
diff changeset
7075
31152
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7076 copy-file )
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7077 # Verify the number of arguments.
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7078 if test $# -lt 1 || test $# -gt 2; then
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7079 func_fatal_error "invalid number of arguments for --$mode"
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7080 fi
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7081
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7082 # The first argument is the file to be copied.
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7083 f="$1"
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7084 # Verify the file exists.
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7085 func_lookup_file "$f"
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7086
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7087 # The second argument is the destination; either a directory ot a file.
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7088 # It defaults to the current directory.
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7089 dest="$2"
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7090 test -n "$dest" || dest='.'
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7091 test -n "$sourcebase" || sourcebase="lib"
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7092 test -n "$m4base" || m4base="m4"
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7093 test -n "$docbase" || docbase="doc"
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7094 test -n "$testsbase" || testsbase="tests"
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7095 test -n "$auxdir" || auxdir="build-aux"
31251
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
7096 rewritten='%REWRITTEN%'
31152
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7097 sed_rewrite_files="\
31251
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
7098 s,^build-aux/,$rewritten$auxdir/,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
7099 s,^doc/,$rewritten$docbase/,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
7100 s,^lib/,$rewritten$sourcebase/,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
7101 s,^m4/,$rewritten$m4base/,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
7102 s,^tests/,$rewritten$testsbase/,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
7103 s,^top/,$rewritten,
691748ca2687 Fix the rewriting rules for file names.
Bruno Haible <bruno@clisp.org>
parents: 31224
diff changeset
7104 s,^$rewritten,,"
31152
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7105 if test -d "$dest"; then
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7106 destdir="$dest"
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7107 g=`echo "$f" | sed -e "$sed_rewrite_files"`
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7108 else
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7109 destdir=`dirname "$dest"`
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7110 g=`basename "$dest"`
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7111 fi
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7112
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7113 # Create the directory for destfile.
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7114 d=`dirname "$destdir/$g"`
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7115 if $doit; then
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7116 if test -n "$d" && test ! -d "$d"; then
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7117 mkdir -p "$d" || func_fatal_error "failed"
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7118 fi
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7119 fi
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7120 # Copy the file.
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7121 func_dest_tmpfilename "$g"
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7122 cp "$lookedup_file" "$tmpfile" || func_fatal_error "failed"
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7123 already_present=true
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7124 if test -f "$destdir/$g"; then
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7125 # The file already exists.
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7126 func_update_file
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7127 else
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7128 # Install the file.
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7129 # Don't protest if the file should be there but isn't: it happens
33327
445a26f3384a gnulib-tool: Don't talk about CVS any more.
Bruno Haible <bruno@clisp.org>
parents: 33325
diff changeset
7130 # frequently that developers don't put autogenerated files under version
445a26f3384a gnulib-tool: Don't talk about CVS any more.
Bruno Haible <bruno@clisp.org>
parents: 33325
diff changeset
7131 # control.
31152
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7132 func_add_file
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7133 fi
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7134 rm -f "$tmpfile"
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7135 ;;
dbfcb611067b New gnulib-tool option --copy-file.
Bruno Haible <bruno@clisp.org>
parents: 31112
diff changeset
7136
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7137 * )
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7138 func_fatal_error "unknown operation mode --$mode" ;;
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7139 esac
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7140
38616
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
7141 if test "$copymode" = hardlink -o "$lcopymode" = hardlink; then
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
7142 # Setting hard links modifies the ctime of files in the gnulib checkout.
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
7143 # This disturbs the result of the next "gitk" invocation.
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
7144 # Workaround: Let git scan the files. This can be done through
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
7145 # "git update-index --refresh" or "git status" or "git diff".
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
7146 if test -d "$gnulib_dir"/.git \
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
7147 && (git --version) >/dev/null 2>/dev/null; then
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
7148 (cd "$gnulib_dir" && git update-index --refresh >/dev/null)
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
7149 fi
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
7150 fi
75af3ee7583d gnulib-tool: Add options to create hard links.
Bruno Haible <bruno@clisp.org>
parents: 38613
diff changeset
7151
26764
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
7152 rm -rf "$tmp"
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
7153 # Undo the effect of the previous 'trap' command. Some shellology:
27023
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
7154 # We cannot use "trap - 0 1 2 3 13 15", because Solaris sh would attempt to
26764
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
7155 # execute the command "-". "trap '' ..." is fine only for signal 0 (= normal
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
7156 # exit); for the others we need to call 'exit' explicitly. The value of $? is
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
7157 # 128 + signal number and is set before the trap-registered command is run.
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
7158 trap '' 0
27023
ee1674176326 * gnulib-tool (func_exit): New function, to allow to pass the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 27018
diff changeset
7159 trap 'func_exit $?' 1 2 3 13 15
26764
2efde233d1ca Make it possible to use a locally augmented gnulib.
Bruno Haible <bruno@clisp.org>
parents: 26763
diff changeset
7160
23803
4339ab66270d Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7161 exit 0
26932
0fc9f93c6f37 * gnulib-tool: Don't let emacs change spaces to TAB.
Eric Blake <ebb9@byu.net>
parents: 26931
diff changeset
7162
0fc9f93c6f37 * gnulib-tool: Don't let emacs change spaces to TAB.
Eric Blake <ebb9@byu.net>
parents: 26931
diff changeset
7163 # Local Variables:
0fc9f93c6f37 * gnulib-tool: Don't let emacs change spaces to TAB.
Eric Blake <ebb9@byu.net>
parents: 26931
diff changeset
7164 # indent-tabs-mode: nil
0fc9f93c6f37 * gnulib-tool: Don't let emacs change spaces to TAB.
Eric Blake <ebb9@byu.net>
parents: 26931
diff changeset
7165 # whitespace-check-buffer-indent: nil
0fc9f93c6f37 * gnulib-tool: Don't let emacs change spaces to TAB.
Eric Blake <ebb9@byu.net>
parents: 26931
diff changeset
7166 # End: