annotate gnulib-tool @ 5848:a48fb0e98c8c

*** empty log message ***
author Paul Eggert <eggert@cs.ucla.edu>
date Sat, 14 May 2005 06:03:57 +0000
parents 918e52aa283d
children 6fb8c48c4dcd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 #! /bin/sh
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2 #
5572
54000928a33d Print #include directives when --import'ing.
Simon Josefsson <simon@josefsson.org>
parents: 5527
diff changeset
3 # Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 #
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 # This program is free software; you can redistribute it and/or modify
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 # it under the terms of the GNU General Public License as published by
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 # the Free Software Foundation; either version 2, or (at your option)
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 # any later version.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 #
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 # This program is distributed in the hope that it will be useful,
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 # GNU General Public License for more details.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 #
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 # You should have received a copy of the GNU General Public License
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16 # along with this program; if not, write to the Free Software
5848
a48fb0e98c8c *** empty log message ***
Paul Eggert <eggert@cs.ucla.edu>
parents: 5845
diff changeset
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 #
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 # This program is meant for authors or maintainers which want to import
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 # modules from gnulib into their packages.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 progname=$0
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 package=gnulib
5848
a48fb0e98c8c *** empty log message ***
Paul Eggert <eggert@cs.ucla.edu>
parents: 5845
diff changeset
25 cvsdatestamp='$Date: 2005-05-14 06:03:57 $'
4124
5b5f22d7530e (last_checkin_date): don't expand the $Date here.
Karl Berry <karl@freefriends.org>
parents: 4112
diff changeset
26 last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'`
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'`
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 # You can set AUTOCONFPATH to empty if autoconf 2.57 is already in your PATH.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 AUTOCONFPATH=
5250
46a747db97f2 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 5237
diff changeset
31 #case $USER in
46a747db97f2 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 5237
diff changeset
32 # bruno )
46a747db97f2 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 5237
diff changeset
33 # AUTOCONFBINDIR=/packages/gnu-inst-autoconf/2.57/bin
46a747db97f2 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 5237
diff changeset
34 # AUTOCONFPATH="eval env PATH=${AUTOCONFBINDIR}:\$PATH "
46a747db97f2 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 5237
diff changeset
35 # ;;
46a747db97f2 Comment out private settings.
Bruno Haible <bruno@clisp.org>
parents: 5237
diff changeset
36 #esac
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37
5237
bd85db908172 Replace various ad-hoc automake/autoconf/aclocal
Paul Eggert <eggert@cs.ucla.edu>
parents: 5202
diff changeset
38 AUTORECONF="${AUTOCONFPATH}autoreconf"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 # func_usage
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 # outputs to stdout the --help usage message.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 func_usage ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 echo "\
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 Usage: gnulib-tool --list
5344
c2f5677fc6ed Initialize supplied_libname. Tweak usage message.
Bruno Haible <bruno@clisp.org>
parents: 5343
diff changeset
46 gnulib-tool --import [module1 ... moduleN]
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 gnulib-tool --create-testdir --dir=directory module1 ... moduleN
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 gnulib-tool --create-megatestdir --dir=directory [module1 ... moduleN]
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 gnulib-tool --test --dir=directory module1 ... moduleN
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 gnulib-tool --megatest --dir=directory [module1 ... moduleN]
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 gnulib-tool --extract-description module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 gnulib-tool --extract-filelist module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 gnulib-tool --extract-dependencies module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 gnulib-tool --extract-autoconf-snippet module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 gnulib-tool --extract-automake-snippet module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
56 gnulib-tool --extract-include-directive module
5251
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
57 gnulib-tool --extract-license module
4197
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
58 gnulib-tool --extract-maintainer module
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
59
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60 Operation modes:
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
61 --list print the available module names
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
62 --import import the given modules into the current package
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
63 --create-testdir create a scratch package with the given modules
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
64 --create-megatestdir create a mega scratch package with the given modules
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
65 one by one and all together
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
66 --test test the combination of the given modules
4197
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
67 (recommended to use CC=\"gcc -Wall\" here)
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
68 --megatest test the given modules one by one and all together
4197
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
69 (recommended to use CC=\"gcc -Wall\" here)
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
70 --extract-description extract the description
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
71 --extract-filelist extract the list of files
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
72 --extract-dependencies extract the dependencies
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
73 --extract-autoconf-snippet extract the snippet for configure.ac
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
74 --extract-automake-snippet extract the snippet for lib/Makefile.am
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
75 --extract-include-directive extract the #include directive
5251
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
76 --extract-license report the license terms of the source files
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
77 under lib/
4197
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
78 --extract-maintainer report the maintainer(s) inside gnulib
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
79
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
80 Options:
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
81 --dir=DIRECTORY specify the target directory
5344
c2f5677fc6ed Initialize supplied_libname. Tweak usage message.
Bruno Haible <bruno@clisp.org>
parents: 5343
diff changeset
82 For --import, this specifies where your
5198
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
83 configure.ac can be found. Defaults to current
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
84 directory.
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
85 --lib=LIBRARY Specify the library name. Defaults to 'libgnu'.
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
86 --source-base=DIRECTORY
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
87 Directory relative --dir where source code is
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
88 placed (default \"lib\"), for --import.
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
89 --m4-base=DIRECTORY Directory relative --dir where *.m4 macros are
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
90 placed (default \"m4\"), for --import.
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
91 --aux-dir=DIRECTORY Directory relative --dir where auxiliary build
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
92 tools are placed (default \".\"), for --import.
5262
97ed4b64d853 New parameter --lgpl, to asseert that modules are
Paul Eggert <eggert@cs.ucla.edu>
parents: 5255
diff changeset
93 --lgpl Abort if modules aren't available under the LGPL.
97ed4b64d853 New parameter --lgpl, to asseert that modules are
Paul Eggert <eggert@cs.ucla.edu>
parents: 5255
diff changeset
94 Also modify license template from GPL to LGPL.
5198
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
95 --libtool Use libtool rules, for --import.
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
96 --no-changelog don't update or create ChangeLog files
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
97 --dry-run For --import, only print what would have been done.
5805
afd959c1af76 (Options): Add -s for --symlink/--symbolic.
Simon Josefsson <simon@josefsson.org>
parents: 5803
diff changeset
98 -s, --symbolic, --symlink Make symbolic links instead of copying files.
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
99
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
100 Report bugs to <bug-gnulib@gnu.org>."
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
101 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
102
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
103 # func_version
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
104 # outputs to stdout the --version message.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
105 func_version ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
106 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
107 echo "$progname (GNU $package) $version"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
108 echo "Copyright (C) 2002 Free Software Foundation, Inc.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
109 This is free software; see the source for copying conditions. There is NO
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
110 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
111 echo "Written by" "Bruno Haible"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
112 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
113
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
114 # func_fatal_error message
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
115 # outputs to stderr a fatal error message, and terminates the program.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
116 func_fatal_error ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
117 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
118 echo "gnulib-tool: *** $1" 1>&2
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
119 echo "gnulib-tool: *** Stop." 1>&2
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
120 exit 1
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
121 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
122
5684
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
123 # func_cp_if_changed SRC DEST
5685
18b4bb3dea47 Preserve timestamps of files that have not changed.
Bruno Haible <bruno@clisp.org>
parents: 5684
diff changeset
124 # Like cp, but avoids munging timestamps if the file hasn't changed.
18b4bb3dea47 Preserve timestamps of files that have not changed.
Bruno Haible <bruno@clisp.org>
parents: 5684
diff changeset
125 # Uses also the variables
18b4bb3dea47 Preserve timestamps of files that have not changed.
Bruno Haible <bruno@clisp.org>
parents: 5684
diff changeset
126 # - dry_run true if actions shall only be printed, blank otherwise
5684
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
127 func_cp_if_changed ()
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
128 {
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
129 if test $# -ne 2; then
5685
18b4bb3dea47 Preserve timestamps of files that have not changed.
Bruno Haible <bruno@clisp.org>
parents: 5684
diff changeset
130 echo "usage: func_cp_if_changed SRC DEST" >&2
5684
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
131 fi
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
132 test -n "$dry_run" && dry=echo
5685
18b4bb3dea47 Preserve timestamps of files that have not changed.
Bruno Haible <bruno@clisp.org>
parents: 5684
diff changeset
133 if cmp "$1" "$2" >/dev/null 2>&1; then
18b4bb3dea47 Preserve timestamps of files that have not changed.
Bruno Haible <bruno@clisp.org>
parents: 5684
diff changeset
134 :
18b4bb3dea47 Preserve timestamps of files that have not changed.
Bruno Haible <bruno@clisp.org>
parents: 5684
diff changeset
135 else
5684
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
136 $dry cp -p "$1" "$2"
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
137 fi
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
138 }
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
139
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
140 # func_mv_if_changed SRC DEST
5685
18b4bb3dea47 Preserve timestamps of files that have not changed.
Bruno Haible <bruno@clisp.org>
parents: 5684
diff changeset
141 # Like mv, but avoids munging timestamps if the file hasn't changed.
18b4bb3dea47 Preserve timestamps of files that have not changed.
Bruno Haible <bruno@clisp.org>
parents: 5684
diff changeset
142 # Removes SRC if it is not renamed.
18b4bb3dea47 Preserve timestamps of files that have not changed.
Bruno Haible <bruno@clisp.org>
parents: 5684
diff changeset
143 # Uses also the variables
18b4bb3dea47 Preserve timestamps of files that have not changed.
Bruno Haible <bruno@clisp.org>
parents: 5684
diff changeset
144 # - dry_run true if actions shall only be printed, blank otherwise
5684
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
145 func_mv_if_changed ()
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
146 {
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
147 if test $# -ne 2; then
5685
18b4bb3dea47 Preserve timestamps of files that have not changed.
Bruno Haible <bruno@clisp.org>
parents: 5684
diff changeset
148 echo "usage: func_mv_if_changed SRC DEST" >&2
5684
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
149 fi
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
150 test -n "$dry_run" && dry=echo
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
151 if cmp "$1" "$2" >/dev/null 2>&1; then
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
152 $dry rm "$1"
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
153 else
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
154 $dry mv "$1" "$2"
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
155 fi
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
156 }
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
157
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
158 # func_ln_if_changed SRC DEST
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
159 # Like ln -s, but avoids munging timestamps if the link is correct.
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
160 # Uses also the variables
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
161 # - dry_run true if actions shall only be printed, blank otherwise
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
162 func_ln_if_changed ()
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
163 {
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
164 if test $# -ne 2; then
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
165 echo "usage: func_ln_if_changed SRC DEST" >&2
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
166 fi
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
167 test -n "$dry_run" && dry=echo
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
168 if test -L "$2" -a "$1" = "`readlink "$2"`"; then
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
169 :
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
170 else
5805
afd959c1af76 (Options): Add -s for --symlink/--symbolic.
Simon Josefsson <simon@josefsson.org>
parents: 5803
diff changeset
171 $dry rm -f "$2"
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
172 $dry ln -s "$1" "$2"
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
173 fi
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
174 }
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
175
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
176 # Command-line option processing.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
177 # Removes the OPTIONS from the arguments. Sets the variables:
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
178 # - mode list or import or create-testdir or create-megatestdir
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
179 # - destdir from --dir
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
180 # - libname, supplied_libname from --lib
5198
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
181 # - sourcebase from --source-base
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
182 # - m4base from --m4-base
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
183 # - auxdir from --aux-dir
5198
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
184 # - libtool true if --libtool was given, blank otherwise
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
185 # - lgpl true if --lgpl was given, blank otherwise
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
186 # - do_changelog false if --no-changelog was given, : otherwise
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
187 # - dry_run true if --dry-run was given, blank otherwise
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
188 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
189 mode=
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
190 destdir=
5198
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
191 libname=libgnu
5344
c2f5677fc6ed Initialize supplied_libname. Tweak usage message.
Bruno Haible <bruno@clisp.org>
parents: 5343
diff changeset
192 supplied_libname=
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
193 sourcebase=
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
194 m4base=
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
195 auxdir=
5198
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
196 libtool=
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
197 lgpl=
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
198 do_changelog=:
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
199 dry_run=
5799
ad9eff556694 2005-04-15 Simon Josefsson <jas@extundo.com>
Simon Josefsson <simon@josefsson.org>
parents: 5798
diff changeset
200 symbolic=
5262
97ed4b64d853 New parameter --lgpl, to asseert that modules are
Paul Eggert <eggert@cs.ucla.edu>
parents: 5255
diff changeset
201 lgpl=
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
203 supplied_opts="$@"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
204
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
205 while test $# -gt 0; do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
206 case "$1" in
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
207 --list | --lis )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
208 mode=list
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
209 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
210 --import | --impor | --impo | --imp | --im | --i )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
211 mode=import
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
212 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
213 --create-testdir | --create-testdi | --create-testd | --create-test | --create-tes | --create-te | --create-t )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
214 mode=create-testdir
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
215 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
216 --create-megatestdir | --create-megatestdi | --create-megatestd | --create-megatest | --create-megates | --create-megate | --create-megat | --create-mega | --create-meg | --create-me | --create-m )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
217 mode=create-megatestdir
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
218 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
219 --test | --tes | --te | --t )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
220 mode=test
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
221 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
222 --megatest | --megates | --megate | --megat | --mega | --meg | --me | --m )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
223 mode=megatest
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
224 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
225 --extract-* )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
226 mode=`echo "X$1" | sed -e 's/^X--//'`
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
227 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
228 --dir )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
229 shift
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
230 if test $# = 0; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
231 func_fatal_error "missing argument for --dir"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
232 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
233 destdir=$1
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
234 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
235 --dir=* )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
236 destdir=`echo "X$1" | sed -e 's/^X--dir=//'`
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
237 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
238 --lib )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
239 shift
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
240 if test $# = 0; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
241 func_fatal_error "missing argument for --lib"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
242 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
243 libname=$1
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
244 supplied_libname=true
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
245 shift ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
246 --lib=* )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
247 libname=`echo "X$1" | sed -e 's/^X--lib=//'`
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
248 supplied_libname=true
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
249 shift ;;
5198
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
250 --source-base )
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
251 shift
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
252 if test $# = 0; then
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
253 func_fatal_error "missing argument for --source-base"
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
254 fi
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
255 sourcebase=$1
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
256 shift ;;
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
257 --source-base=* )
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
258 sourcebase=`echo "X$1" | sed -e 's/^X--source-base=//'`
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
259 shift ;;
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
260 --m4-base )
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
261 shift
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
262 if test $# = 0; then
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
263 func_fatal_error "missing argument for --m4-base"
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
264 fi
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
265 m4base=$1
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
266 shift ;;
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
267 --m4-base=* )
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
268 m4base=`echo "X$1" | sed -e 's/^X--m4-base=//'`
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
269 shift ;;
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
270 --aux-dir )
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
271 shift
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
272 if test $# = 0; then
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
273 func_fatal_error "missing argument for --aux-dir"
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
274 fi
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
275 auxdir=$1
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
276 shift ;;
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
277 --aux-dir=* )
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
278 auxdir=`echo "X$1" | sed -e 's/^X--aux-dir=//'`
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
279 shift ;;
5198
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
280 --libtool )
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
281 libtool=true
9317c9ebe82c Add --source-base, --m4-base, --libtool options.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4717
diff changeset
282 shift ;;
5262
97ed4b64d853 New parameter --lgpl, to asseert that modules are
Paul Eggert <eggert@cs.ucla.edu>
parents: 5255
diff changeset
283 --lgpl )
97ed4b64d853 New parameter --lgpl, to asseert that modules are
Paul Eggert <eggert@cs.ucla.edu>
parents: 5255
diff changeset
284 lgpl=true
97ed4b64d853 New parameter --lgpl, to asseert that modules are
Paul Eggert <eggert@cs.ucla.edu>
parents: 5255
diff changeset
285 shift ;;
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
286 --no-changelog | --no-changelo | --no-changel | --no-change | --no-chang | --no-chan | --no-cha | --no-ch | --no-c )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
287 do_changelog=false
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
288 shift ;;
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
289 --dry-run )
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
290 dry_run=true
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
291 shift ;;
5805
afd959c1af76 (Options): Add -s for --symlink/--symbolic.
Simon Josefsson <simon@josefsson.org>
parents: 5803
diff changeset
292 -s | --symbolic | --symlink )
5799
ad9eff556694 2005-04-15 Simon Josefsson <jas@extundo.com>
Simon Josefsson <simon@josefsson.org>
parents: 5798
diff changeset
293 symbolic=true
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
294 shift ;;
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
295 --help | --hel | --he | --h )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
296 func_usage
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
297 exit 0 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
298 --version | --versio | --versi | --vers | --ver | --ve | --v )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
299 func_version
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
300 exit 0 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
301 -- )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
302 # Stop option prcessing
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
303 shift
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
304 break ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
305 -* )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
306 echo "gnulib-tool: unknown option $1" 1>&2
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
307 echo "Try 'gnulib-tool --help' for more information." 1>&2
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
308 exit 1 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
309 * )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
310 break ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
311 esac
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
312 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
313 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
314
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
315 case "$0" in
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
316 /*) self_abspathname="$0" ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
317 */*) self_abspathname=`pwd`/"$0" ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
318 *) for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'`; do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
319 if test -x "$d/$0" && test ! -d "$d/$0"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
320 self_abspathname="$d/$0"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
321 break
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
322 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
323 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
324 if test -z "$self_abspathname"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
325 func_fatal_error "could not locate the gnulib-tool program - how did you invoke it?"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
326 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
327 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
328 esac
4717
ed7cd4050365 Port gnulib-tool to Solaris 8.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4712
diff changeset
329 while test -h "$self_abspathname"; do
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
330 # Resolve symbolic link.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
331 sedexpr1='s, -> ,#%%#,'
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
332 sedexpr2='s,^.*#%%#\(.*\)$,\1,p'
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
333 linkval=`LC_ALL=C ls -l "$self_abspathname" | sed -e "$sedexpr1" | sed -n -e "$sedexpr2"`
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
334 test -n "$linkval" || break
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
335 case "$linkval" in
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
336 /* ) self_abspathname="$linkval" ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
337 * ) self_abspathname=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
338 esac
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
339 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
340 gnulib_dir=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
341
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
342 # func_all_modules
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
343 func_all_modules ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
344 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
345 (cd "$gnulib_dir/modules" && ls -1) \
5312
47f04c1cec16 'README' is not a module.
Bruno Haible <bruno@clisp.org>
parents: 5268
diff changeset
346 | sed -e '/^CVS$/d' -e '/^ChangeLog$/d' -e '/^README$/d' -e '/^TEMPLATE$/d' -e '/~$/d' \
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
347 | sort
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
348 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
349
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
350 # func_verify_module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
351 # verifies a module name
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
352 func_verify_module ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
353 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
354 if test ! -f "$gnulib_dir/modules/$module" \
4128
1346b5405a74 (func_verify_module): report module name $module
Karl Berry <karl@freefriends.org>
parents: 4126
diff changeset
355 || test "CVS" = "$module" \
1346b5405a74 (func_verify_module): report module name $module
Karl Berry <karl@freefriends.org>
parents: 4126
diff changeset
356 || test "ChangeLog" = "$module" \
5312
47f04c1cec16 'README' is not a module.
Bruno Haible <bruno@clisp.org>
parents: 5268
diff changeset
357 || test "README" = "$module" \
4128
1346b5405a74 (func_verify_module): report module name $module
Karl Berry <karl@freefriends.org>
parents: 4126
diff changeset
358 || test "TEMPLATE" = "$module"; then
1346b5405a74 (func_verify_module): report module name $module
Karl Berry <karl@freefriends.org>
parents: 4126
diff changeset
359 echo "gnulib-tool: module $module doesn't exist" 1>&2
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
360 module=
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
361 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
362 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
363
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
364 sed_extract_prog=':[ ]*$/ {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
365 :a
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
366 n
4717
ed7cd4050365 Port gnulib-tool to Solaris 8.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4712
diff changeset
367 s/^Description:[ ]*$//
ed7cd4050365 Port gnulib-tool to Solaris 8.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4712
diff changeset
368 s/^Files:[ ]*$//
ed7cd4050365 Port gnulib-tool to Solaris 8.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4712
diff changeset
369 s/^Depends-on:[ ]*$//
ed7cd4050365 Port gnulib-tool to Solaris 8.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4712
diff changeset
370 s/^configure\.ac:[ ]*$//
ed7cd4050365 Port gnulib-tool to Solaris 8.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4712
diff changeset
371 s/^Makefile\.am:[ ]*$//
ed7cd4050365 Port gnulib-tool to Solaris 8.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4712
diff changeset
372 s/^Include:[ ]*$//
5251
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
373 s/^License:[ ]*$//
4717
ed7cd4050365 Port gnulib-tool to Solaris 8.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4712
diff changeset
374 s/^Maintainer:[ ]*$//
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
375 tb
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
376 p
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
377 ba
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
378 :b
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
379 }'
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
380
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
381 # func_get_description module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
382 func_get_description ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
383 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
384 sed -n -e "/^Description$sed_extract_prog" < "$gnulib_dir/modules/$1"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
385 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
386
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
387 # func_get_filelist module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
388 func_get_filelist ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
389 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
390 sed -n -e "/^Files$sed_extract_prog" < "$gnulib_dir/modules/$1"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
391 #echo m4/onceonly.m4
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
392 echo m4/onceonly_2_57.m4
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
393 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
394
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
395 # func_get_dependencies module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
396 func_get_dependencies ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
397 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
398 sed -n -e "/^Depends-on$sed_extract_prog" < "$gnulib_dir/modules/$1"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
399 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
400
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
401 # func_get_autoconf_snippet module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
402 func_get_autoconf_snippet ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
403 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
404 sed -n -e "/^configure\.ac$sed_extract_prog" < "$gnulib_dir/modules/$1"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
405 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
406
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
407 # func_get_automake_snippet module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
408 func_get_automake_snippet ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
409 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
410 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$gnulib_dir/modules/$1"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
411 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
412
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
413 # func_get_include_directive module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
414 func_get_include_directive ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
415 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
416 sed -n -e "/^Include$sed_extract_prog" < "$gnulib_dir/modules/$1" | \
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
417 sed -e 's/^\(["<]\)/#include \1/'
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
418 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
419
5251
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
420 # func_get_license module
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
421 func_get_license ()
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
422 {
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
423 sed -n -e "/^License$sed_extract_prog" < "$gnulib_dir/modules/$1"
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
424 }
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
425
4197
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
426 # func_get_maintainer module
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
427 func_get_maintainer ()
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
428 {
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
429 sed -n -e "/^Maintainer$sed_extract_prog" < "$gnulib_dir/modules/$1"
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
430 }
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
431
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
432 # func_modules_transitive_closure
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
433 # Input:
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
434 # - modules list of specified modules
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
435 # Output:
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
436 # - modules list of modules, including dependencies
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
437 func_modules_transitive_closure ()
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
438 {
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
439 while true; do
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
440 xmodules=
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
441 for module in $modules; do
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
442 func_verify_module
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
443 if test -n "$module"; then
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
444 # Duplicate dependenies are harmless, but Jim wants a warning.
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
445 duplicated_deps=`func_get_dependencies $module | sort | uniq -d`
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
446 if test -n "$duplicated_deps"; then
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
447 echo "warning: module $module has duplicated dependencies: "`echo $duplicated_deps` 1>&2
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
448 fi
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
449 xmodules="$xmodules $module "`func_get_dependencies $module`
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
450 fi
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
451 done
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
452 xmodules=`for m in $xmodules; do echo $m; done | sort | uniq`
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
453 if test "$xmodules" = "$modules"; then
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
454 break
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
455 fi
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
456 modules="$xmodules"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
457 done
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
458 }
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
459
5348
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
460 # func_modules_to_filelist
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
461 # Input:
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
462 # - modules list of modules, including dependencies
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
463 # Output:
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
464 # - files list of files
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
465 func_modules_to_filelist ()
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
466 {
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
467 files=
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
468 for module in $modules; do
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
469 func_verify_module
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
470 if test -n "$module"; then
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
471 files="$files "`func_get_filelist $module`
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
472 fi
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
473 done
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
474 files=`for f in $files; do echo $f; done | sort | uniq`
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
475 }
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
476
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
477 # func_emit_lib_Makefile_am
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
478 # emits the contents of lib/Makefile.am to standard output.
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
479 # Input:
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
480 # - modules list of modules, including dependencies
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
481 # - libname library name
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
482 # - libtool true if libtool will be used, blank otherwise
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
483 # - cmd (optional) command that led to this invocation
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
484 # - actioncmd (optional) command that will reproduce this invocation
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
485 func_emit_lib_Makefile_am ()
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
486 {
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
487 if test -n "$libtool"; then
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
488 libext=la
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
489 perhapsLT=LT
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
490 else
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
491 libext=a
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
492 perhapsLT=
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
493 fi
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
494 echo "## Process this file with automake to produce Makefile.in."
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
495 echo "# Copyright (C) 2004 Free Software Foundation, Inc."
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
496 echo "#"
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
497 echo "# This file is free software, distributed under the terms of the GNU"
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
498 echo "# General Public License. As a special exception to the GNU General"
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
499 echo "# Public License, this file may be distributed as part of a program"
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
500 echo "# that contains a configuration script generated by Automake, under"
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
501 echo "# the same distribution terms as the rest of that program."
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
502 echo "#"
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
503 echo "# Generated by gnulib-tool."
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
504 if test -n "$cmd"; then
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
505 echo "# Invoked as: $cmd"
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
506 fi
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
507 if test -n "$actioncmd"; then
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
508 echo "# Reproduce by: $actioncmd"
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
509 fi
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
510 echo
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
511 # No need to generate dependencies since the sources are in gnulib, not here.
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
512 echo "AUTOMAKE_OPTIONS = 1.5 gnits no-dependencies"
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
513 echo
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
514 echo "noinst_${perhapsLT}LIBRARIES = $libname.$libext"
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
515 echo
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
516 echo "${libname}_${libext}_SOURCES ="
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
517 echo "${libname}_${libext}_LIBADD = @${perhapsLT}LIBOBJS@"
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
518 echo "EXTRA_DIST ="
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
519 echo "BUILT_SOURCES ="
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
520 echo "SUFFIXES ="
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
521 echo "MOSTLYCLEANFILES ="
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
522 echo "CLEANFILES ="
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
523 echo "DISTCLEANFILES ="
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
524 echo "MAINTAINERCLEANFILES ="
5352
f1f20fc1ff2f Emit separators in lib/Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 5351
diff changeset
525 echo
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
526 for module in $modules; do
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
527 func_verify_module
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
528 if test -n "$module"; then
5352
f1f20fc1ff2f Emit separators in lib/Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 5351
diff changeset
529 {
5527
1270fb7d6695 (func_emit_lib_Makefile_am): Shorten a long sed command.
Paul Eggert <eggert@cs.ucla.edu>
parents: 5358
diff changeset
530 func_get_automake_snippet "$module" |
1270fb7d6695 (func_emit_lib_Makefile_am): Shorten a long sed command.
Paul Eggert <eggert@cs.ucla.edu>
parents: 5358
diff changeset
531 sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g'
5352
f1f20fc1ff2f Emit separators in lib/Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 5351
diff changeset
532 if test "$module" = 'alloca'; then
5358
e3d296179cc6 (func_emit_lib_Makefile_am): Fix typo: a $ was
Paul Eggert <eggert@cs.ucla.edu>
parents: 5357
diff changeset
533 echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
5352
f1f20fc1ff2f Emit separators in lib/Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 5351
diff changeset
534 fi
f1f20fc1ff2f Emit separators in lib/Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 5351
diff changeset
535 } > amsnippet.tmp
f1f20fc1ff2f Emit separators in lib/Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 5351
diff changeset
536 # Skip the contents if its entirely empty.
f1f20fc1ff2f Emit separators in lib/Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 5351
diff changeset
537 if grep '[^ ]' amsnippet.tmp > /dev/null ; then
f1f20fc1ff2f Emit separators in lib/Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 5351
diff changeset
538 echo "## begin gnulib module $module"
f1f20fc1ff2f Emit separators in lib/Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 5351
diff changeset
539 echo
f1f20fc1ff2f Emit separators in lib/Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 5351
diff changeset
540 cat amsnippet.tmp
f1f20fc1ff2f Emit separators in lib/Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 5351
diff changeset
541 echo "## end gnulib module $module"
f1f20fc1ff2f Emit separators in lib/Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 5351
diff changeset
542 echo
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
543 fi
5352
f1f20fc1ff2f Emit separators in lib/Makefile.am.
Bruno Haible <bruno@clisp.org>
parents: 5351
diff changeset
544 rm -f amsnippet.tmp
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
545 fi
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
546 done
5357
8bce169f70cc Fix comments. Fix parse problem.
Simon Josefsson <simon@josefsson.org>
parents: 5356
diff changeset
547 echo
8bce169f70cc Fix comments. Fix parse problem.
Simon Josefsson <simon@josefsson.org>
parents: 5356
diff changeset
548 echo "# Makefile.am ends here"
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
549 }
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
550
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
551 # func_import modules
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
552 # Uses also the variables
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
553 # - destdir target directory
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
554 # - libname library name
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
555 # - sourcebase directory relative to destdir where to place source code
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
556 # - m4base directory relative to destdir where to place *.m4 macros
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
557 # - libtool true if libtool will be used, blank otherwise
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
558 # - lgpl true if library's license shall be LGPL, blank otherwise
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
559 # - dry_run true if actions shall only be printed, blank otherwise
5799
ad9eff556694 2005-04-15 Simon Josefsson <jas@extundo.com>
Simon Josefsson <simon@josefsson.org>
parents: 5798
diff changeset
560 # - symbolic true if files should be symlinked, copied otherwise
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
561 # - supplied_opts all options passed to gnulib-tool
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
562 func_import ()
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
563 {
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
564 modules="$1"
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
565 modules=`for m in $modules; do echo $m; done | sort | uniq`
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
566
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
567 # Determine final module list.
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
568 func_modules_transitive_closure
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
569 echo "Module list with included dependencies:"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
570 echo "$modules" | sed -e 's/^/ /'
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
571
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
572 # If --lgpl, check the license of modules are compatible.
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
573 if test -n "$lgpl"; then
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
574 for module in $modules; do
5346
40f5d74050d5 Use func_get_license.
Bruno Haible <bruno@clisp.org>
parents: 5345
diff changeset
575 license=`func_get_license $module`
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
576 if test $license != LGPL; then
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
577 func_fatal_error "incompatible license on module \`$module\`: $license"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
578 fi
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
579 done
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
580 fi
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
581
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
582 # Determine final file list.
5348
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
583 func_modules_to_filelist
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
584 echo "File list:"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
585 echo "$files" | sed -e 's/^/ /'
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
586
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
587 test -n "$files" \
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
588 || func_fatal_error "refusing to do nothing"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
589
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
590 # Copy files or make symbolic links.
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
591 for f in $files; do
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
592 source=
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
593 case "$f" in
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
594 build-aux/*) g=`echo "$f" | sed -e "s,^build-aux/,$auxdir/,"` ;;
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
595 lib/*) g=`echo "$f" | sed -e "s,^lib/,$sourcebase/,"`; source=true ;;
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
596 m4/*) g=`echo "$f" | sed -e "s,^m4/,$m4base/,"` ;;
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
597 *) g="$f" ;;
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
598 esac
5799
ad9eff556694 2005-04-15 Simon Josefsson <jas@extundo.com>
Simon Josefsson <simon@josefsson.org>
parents: 5798
diff changeset
599 if test -z "$symbolic"; then
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
600 func_cp_if_changed "$gnulib_dir/$f" "$destdir/$g"
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
601 else
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
602 func_ln_if_changed "$gnulib_dir/$f" "$destdir/$g"
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
603 fi
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
604 # Update license.
5350
bc679d3084c9 Portability tweak.
Bruno Haible <bruno@clisp.org>
parents: 5349
diff changeset
605 if test -z "$dry_run" && test -n "$lgpl" && test -n "$source"; then
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
606 perl -pi -e 's/GNU General/GNU Lesser General/g;' \
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
607 -e 's/version 2([ ,])/version 2.1\1/g' \
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
608 $destdir/$g
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
609 fi
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
610 done
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
611
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
612 # Commands printed in a comment in generated files.
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
613 cmd="gnulib-tool $supplied_opts"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
614 opt_libtool=
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
615 if test -n "$libtool"; then
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
616 opt_libtool="--libtool"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
617 fi
5349
3644893488ed Initialize opt_lgpl.
Bruno Haible <bruno@clisp.org>
parents: 5348
diff changeset
618 opt_lgpl=
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
619 if test -n "$lgpl"; then
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
620 opt_lgpl="--lgpl"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
621 fi
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
622 actioncmd="gnulib-tool --import --dir=$destdir --lib=$libname --source-base=$sourcebase --m4-base=$m4base --aux-dir=$auxdir $opt_libtool $opt_lgpl `echo $modules`"
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
623
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
624 # Create lib/Makefile.am.
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
625 echo "Creating $destdir/$sourcebase/Makefile.am..."
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
626 if test -z "$dry_run"; then
5684
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
627 func_emit_lib_Makefile_am > $destdir/$sourcebase/Makefile.am.new
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
628 else
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
629 func_emit_lib_Makefile_am
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
630 fi
5684
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
631 func_mv_if_changed $destdir/$sourcebase/Makefile.am.new \
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
632 $destdir/$sourcebase/Makefile.am
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
633
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
634 # Create gnulib.m4.
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
635 echo "Creating $destdir/$m4base/gnulib.m4..."
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
636 (
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
637 if test -z "$dry_run"; then
5684
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
638 exec > $destdir/$m4base/gnulib.m4.new
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
639 else
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
640 echo "# $destdir/$m4base/gnulib.m4"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
641 fi
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
642 echo "# Copyright (C) 2004 Free Software Foundation, Inc."
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
643 echo "# This file is free software, distributed under the terms of the GNU"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
644 echo "# General Public License. As a special exception to the GNU General"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
645 echo "# Public License, this file may be distributed as part of a program"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
646 echo "# that contains a configuration script generated by Autoconf, under"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
647 echo "# the same distribution terms as the rest of that program."
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
648 echo "#"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
649 echo "# Generated by gnulib-tool."
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
650 echo "#"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
651 echo "# Invoked as: $cmd"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
652 echo "# Reproduce by: $actioncmd"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
653 echo
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
654 echo "AC_DEFUN([gl_EARLY],"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
655 echo "["
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
656 if grep AC_GNU_SOURCE "$destdir"/$m4base/*.m4 > /dev/null; then
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
657 echo " AC_GNU_SOURCE"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
658 fi
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
659 if grep gl_USE_SYSTEM_EXTENSIONS "$destdir"/$m4base/*.m4 > /dev/null; then
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
660 echo " gl_USE_SYSTEM_EXTENSIONS"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
661 fi
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
662 echo "])"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
663 echo
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
664 echo "AC_DEFUN([gl_INIT],"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
665 echo "["
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
666 for module in $modules; do
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
667 func_verify_module
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
668 if test -n "$module"; then
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
669 func_get_autoconf_snippet "$module" | sed -e '/^$/d;' -e 's/^/ /' -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./'
5357
8bce169f70cc Fix comments. Fix parse problem.
Simon Josefsson <simon@josefsson.org>
parents: 5356
diff changeset
670 if test "$module" = 'alloca' && test -n "$libtool"; then
5356
144b29bba7b7 Provisions for defining LTALLOCA.
Bruno Haible <bruno@clisp.org>
parents: 5353
diff changeset
671 echo 'changequote(,)dnl'
144b29bba7b7 Provisions for defining LTALLOCA.
Bruno Haible <bruno@clisp.org>
parents: 5353
diff changeset
672 echo 'LTALLOCA=`echo "$ALLOCA" | sed '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
144b29bba7b7 Provisions for defining LTALLOCA.
Bruno Haible <bruno@clisp.org>
parents: 5353
diff changeset
673 echo 'changequote([, ])dnl'
144b29bba7b7 Provisions for defining LTALLOCA.
Bruno Haible <bruno@clisp.org>
parents: 5353
diff changeset
674 echo 'AC_SUBST(LTALLOCA)'
144b29bba7b7 Provisions for defining LTALLOCA.
Bruno Haible <bruno@clisp.org>
parents: 5353
diff changeset
675 fi
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
676 fi
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
677 done
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
678 echo "])"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
679 echo
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
680 echo "dnl Usage: gl_MODULES(module1 module2 ...)"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
681 echo "AC_DEFUN([gl_MODULES], [])"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
682 echo
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
683 echo "dnl Usage: gl_SOURCE_BASE(DIR)"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
684 echo "AC_DEFUN([gl_SOURCE_BASE], [])"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
685 echo
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
686 echo "dnl Usage: gl_M4_BASE(DIR)"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
687 echo "AC_DEFUN([gl_M4_BASE], [])"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
688 echo
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
689 echo "dnl Usage: gl_LIB(LIBNAME)"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
690 echo "AC_DEFUN([gl_LIB], [])"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
691 echo
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
692 echo "dnl Usage: gl_LGPL"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
693 echo "AC_DEFUN([gl_LGPL], [])"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
694 echo
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
695 echo "# gnulib.m4 ends here"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
696 )
5684
0aebab2c04d4 * gnulib-tool: Only replace files via --import when they have
Paul Eggert <eggert@cs.ucla.edu>
parents: 5572
diff changeset
697 func_mv_if_changed $destdir/$m4base/gnulib.m4.new $destdir/$m4base/gnulib.m4
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
698 echo "Finished."
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
699 echo
5572
54000928a33d Print #include directives when --import'ing.
Simon Josefsson <simon@josefsson.org>
parents: 5527
diff changeset
700 echo "You may need to add #include directives for the following .h files."
54000928a33d Print #include directives when --import'ing.
Simon Josefsson <simon@josefsson.org>
parents: 5527
diff changeset
701 for module in $modules; do
5845
918e52aa283d (func_import): Sort and uniquify recommended includes.
Paul Eggert <eggert@cs.ucla.edu>
parents: 5805
diff changeset
702 func_get_include_directive "$module"
918e52aa283d (func_import): Sort and uniquify recommended includes.
Paul Eggert <eggert@cs.ucla.edu>
parents: 5805
diff changeset
703 done | LC_ALL=C sort -u | sed -e '/^$/d;' -e 's/^/ /'
5572
54000928a33d Print #include directives when --import'ing.
Simon Josefsson <simon@josefsson.org>
parents: 5527
diff changeset
704 echo
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
705 echo "Don't forget to add \"$sourcebase/Makefile\""
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
706 echo "to AC_CONFIG_FILES in \"$configure_ac\" and to mention"
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
707 echo "\"`basename $sourcebase`\" in SUBDIRS in some Makefile.am."
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
708 }
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
709
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
710 # func_create_testdir testdir modules
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
711 func_create_testdir ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
712 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
713 testdir="$1"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
714 modules="$2"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
715 modules=`for m in $modules; do echo $m; done | sort | uniq`
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
716
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
717 # Determine final module list.
5347
0318c37925dc Move duplicated code into function func_modules_transitive_closure().
Bruno Haible <bruno@clisp.org>
parents: 5346
diff changeset
718 func_modules_transitive_closure
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
719 echo "Module list with included dependencies:"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
720 echo "$modules" | sed -e 's/^/ /'
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
721
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
722 # Determine final file list.
5348
6afb021e2fc1 Move duplicated code into function func_modules_to_filelist().
Bruno Haible <bruno@clisp.org>
parents: 5347
diff changeset
723 func_modules_to_filelist
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
724 echo "File list:"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
725 echo "$files" | sed -e 's/^/ /'
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
726
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
727 # Create directories.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
728 for d in `echo "$files" | sed -n -e 's,^\(.*\)/[^/]*,\1,p'`; do
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
729 if test "$d" = build-aux; then
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
730 mkdir -p "$testdir/$auxdir"
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
731 else
4175
ace040a2b821 Files meant for the AUX_DIR are now in the config subdirectory.
Bruno Haible <bruno@clisp.org>
parents: 4171
diff changeset
732 mkdir -p "$testdir/$d"
ace040a2b821 Files meant for the AUX_DIR are now in the config subdirectory.
Bruno Haible <bruno@clisp.org>
parents: 4171
diff changeset
733 fi
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
734 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
735
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
736 # Copy files or make symbolic links.
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
737 for f in $files; do
4175
ace040a2b821 Files meant for the AUX_DIR are now in the config subdirectory.
Bruno Haible <bruno@clisp.org>
parents: 4171
diff changeset
738 case "$f" in
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
739 build-aux/*) g=`echo "$f" | sed -e "s,^build-aux/,$auxdir/,"` ;;
4175
ace040a2b821 Files meant for the AUX_DIR are now in the config subdirectory.
Bruno Haible <bruno@clisp.org>
parents: 4171
diff changeset
740 *) g="$f" ;;
ace040a2b821 Files meant for the AUX_DIR are now in the config subdirectory.
Bruno Haible <bruno@clisp.org>
parents: 4171
diff changeset
741 esac
ace040a2b821 Files meant for the AUX_DIR are now in the config subdirectory.
Bruno Haible <bruno@clisp.org>
parents: 4171
diff changeset
742 ln "$gnulib_dir/$f" "$testdir/$g" 2>/dev/null ||
5799
ad9eff556694 2005-04-15 Simon Josefsson <jas@extundo.com>
Simon Josefsson <simon@josefsson.org>
parents: 5798
diff changeset
743 if test -z "$symbolic"; then
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
744 cp -p "$gnulib_dir/$f" "$testdir/$g"
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
745 else
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
746 ln -s "$gnulib_dir/$f" "$testdir/$g"
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
747 fi
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
748 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
749
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
750 # Create lib/Makefile.am.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
751 mkdir -p "$testdir/lib"
5351
7c565c8ecabc Move duplicated code into function func_emit_lib_Makefile_am().
Bruno Haible <bruno@clisp.org>
parents: 5350
diff changeset
752 func_emit_lib_Makefile_am > "$testdir/lib/Makefile.am"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
753
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
754 # Create m4/Makefile.am.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
755 mkdir -p "$testdir/m4"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
756 (echo "## Process this file with automake to produce Makefile.in."
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
757 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
758 echo "EXTRA_DIST ="
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
759 for f in $files; do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
760 case "$f" in
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
761 m4/* )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
762 echo "EXTRA_DIST += "`echo "$f" | sed -e 's,^m4/,,'` ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
763 esac
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
764 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
765 ) > "$testdir/m4/Makefile.am"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
766
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
767 subdirs="lib m4"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
768
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
769 if test -f "$testdir"/m4/gettext.m4; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
770 # Avoid stupid error message from automake:
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
771 # "AM_GNU_GETTEXT used but `po' not in SUBDIRS"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
772 mkdir -p "$testdir/po"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
773 (echo "## Process this file with automake to produce Makefile.in."
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
774 ) > "$testdir/po/Makefile.am"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
775 subdirs="$subdirs po"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
776 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
777
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
778 # Create Makefile.am.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
779 (echo "## Process this file with automake to produce Makefile.in."
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
780 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
781 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
782 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
783 echo "SUBDIRS = $subdirs"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
784 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
785 echo "ACLOCAL_AMFLAGS = -I m4"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
786 ) > "$testdir/Makefile.am"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
787
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
788 # Create configure.ac.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
789 (echo "# Process this file with autoconf to produce a configure script."
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
790 echo "AC_INIT(dummy,0)"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
791 echo "AM_INIT_AUTOMAKE"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
792 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
793 echo "AM_CONFIG_HEADER(config.h)"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
794 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
795 echo "AC_PROG_CC"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
796 echo "AC_PROG_INSTALL"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
797 echo "AC_PROG_MAKE_SET"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
798 echo "AC_PROG_RANLIB"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
799 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
800 if grep AC_GNU_SOURCE "$testdir"/m4/*.m4 > /dev/null; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
801 echo "AC_GNU_SOURCE"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
802 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
803 fi
4586
eb1b4acf2e86 Avoid autoconf/autoheader warning
Bruno Haible <bruno@clisp.org>
parents: 4325
diff changeset
804 if grep gl_USE_SYSTEM_EXTENSIONS "$testdir"/m4/*.m4 > /dev/null; then
eb1b4acf2e86 Avoid autoconf/autoheader warning
Bruno Haible <bruno@clisp.org>
parents: 4325
diff changeset
805 echo "gl_USE_SYSTEM_EXTENSIONS"
eb1b4acf2e86 Avoid autoconf/autoheader warning
Bruno Haible <bruno@clisp.org>
parents: 4325
diff changeset
806 echo
eb1b4acf2e86 Avoid autoconf/autoheader warning
Bruno Haible <bruno@clisp.org>
parents: 4325
diff changeset
807 fi
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
808 for module in $modules; do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
809 func_verify_module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
810 if test -n "$module"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
811 func_get_autoconf_snippet "$module"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
812 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
813 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
814 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
815 makefiles="Makefile"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
816 for d in $subdirs; do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
817 makefiles="$makefiles $d/Makefile"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
818 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
819 echo "AC_OUTPUT([$makefiles])"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
820 ) > "$testdir/configure.ac"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
821
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
822 # Create autogenerated files.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
823 (cd "$testdir"
5237
bd85db908172 Replace various ad-hoc automake/autoconf/aclocal
Paul Eggert <eggert@cs.ucla.edu>
parents: 5202
diff changeset
824 echo "executing ${AUTORECONF} --force --install"
bd85db908172 Replace various ad-hoc automake/autoconf/aclocal
Paul Eggert <eggert@cs.ucla.edu>
parents: 5202
diff changeset
825 ${AUTORECONF} --force --install
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
826 )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
827 if grep '^BUILT_SOURCES *+=' "$testdir/lib/Makefile.am" > /dev/null; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
828 (cd "$testdir"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
829 ./configure
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
830 cd lib
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
831 built_sources=`grep '^BUILT_SOURCES *=' Makefile.in | sed -e 's/^BUILT_SOURCES *=//'`
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
832 if test -n "$built_sources"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
833 make $built_sources
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
834 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
835 cd ..
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
836 make distclean
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
837 )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
838 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
839 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
840
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
841 # func_create_megatestdir megatestdir allmodules
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
842 func_create_megatestdir ()
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
843 {
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
844 megatestdir="$1"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
845 allmodules="$2"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
846 if test -z "$allmodules"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
847 allmodules=`func_all_modules`
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
848 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
849
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
850 megasubdirs=
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
851 # First, all modules one by one.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
852 for onemodule in $allmodules; do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
853 func_create_testdir "$megatestdir/$onemodule" $onemodule
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
854 megasubdirs="${megasubdirs}$onemodule "
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
855 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
856 # Then, all modules all together.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
857 # Except fnmatch-posix, which conflicts with fnmatch-gnu. FIXME.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
858 allmodules=`for m in $allmodules; do if test $m != fnmatch-posix; then echo $m; fi; done`
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
859 func_create_testdir "$megatestdir/ALL" "$allmodules"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
860 megasubdirs="${megasubdirs}ALL"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
861
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
862 # Create Makefile.am.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
863 (echo "## Process this file with automake to produce Makefile.in."
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
864 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
865 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
866 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
867 echo "SUBDIRS = $megasubdirs"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
868 ) > "$megatestdir/Makefile.am"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
869
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
870 # Create configure.ac.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
871 (echo "# Process this file with autoconf to produce a configure script."
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
872 echo "AC_INIT(dummy,0)"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
873 echo "AM_INIT_AUTOMAKE"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
874 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
875 echo "AC_PROG_MAKE_SET"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
876 echo
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
877 echo "AC_CONFIG_SUBDIRS([$megasubdirs])"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
878 echo "AC_OUTPUT([Makefile])"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
879 ) > "$megatestdir/configure.ac"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
880
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
881 # Create autogenerated files.
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
882 (cd "$megatestdir"
5237
bd85db908172 Replace various ad-hoc automake/autoconf/aclocal
Paul Eggert <eggert@cs.ucla.edu>
parents: 5202
diff changeset
883 echo "executing ${AUTORECONF} --force --install"
bd85db908172 Replace various ad-hoc automake/autoconf/aclocal
Paul Eggert <eggert@cs.ucla.edu>
parents: 5202
diff changeset
884 ${AUTORECONF} --force --install
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
885 )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
886 }
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
887
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
888 case $mode in
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
889 "" )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
890 func_fatal_error "no mode specified" ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
891
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
892 list )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
893 func_all_modules
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
894 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
895
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
896 import )
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
897 # Where to import.
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
898 if test -z "$destdir"; then
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
899 destdir=.
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
900 fi
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
901 test -d "$destdir" \
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
902 || func_fatal_error "destination directory does not exist: $destdir"
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
903
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
904 # Prefer configure.ac to configure.in
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
905 test -f $destdir/configure.in && configure_ac=$destdir/configure.in
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
906 test -f $destdir/configure.ac && configure_ac=$destdir/configure.ac
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
907 test -f "$configure_ac" \
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
908 || func_fatal_error "cannot find $destdir/configure.ac"
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
909
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
910 # Get settings.
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
911 my_sed_traces='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,;
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
912 /gl_MODULES[^_]/ {
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
913 s,^.*gl_MODULES([[ ]*\([^])]*\).*$,ac_modules="\1",; p;
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
914 };
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
915 /gl_SOURCE_BASE/ {
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
916 s,^.*gl_SOURCE_BASE([[ ]*\([^])]*\).*$,ac_sourcebase="\1",; p;
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
917 };
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
918 /gl_M4_BASE/ {
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
919 s,^.*gl_M4_BASE([[ ]*\([^])]*\).*$,ac_m4base="\1",; p;
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
920 };
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
921 /gl_LIB/ {
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
922 s,^.*gl_LIB([[ ]*\([^])]*\).*$,ac_libname="\1",; p;
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
923 };
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
924 /AC_CONFIG_AUX_DIR/ {
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
925 s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^])]*\).*$,ac_auxdir="\1",; p;
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
926 }
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
927 /A[CM]_PROG_LIBTOOL/ { s,^.*$,seen_libtool=:,; p; };
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
928 /LT_INIT/ { s,^.*$,seen_libtool=:,; p; };
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
929 /gl_LGPL/ { s,^.*$,lgpl=true,; p; };
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
930 d;'
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
931 eval `cat $configure_ac | sed "$my_sed_traces"`
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
932
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
933 # Override libname?
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
934 if test -z "$supplied_libname" && test -n "$ac_libname"; then
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
935 libname="$ac_libname"
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
936 fi
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
937
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
938 # Set up source base.
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
939 test -z "$sourcebase" && sourcebase="$ac_sourcebase"
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
940 test -z "$sourcebase" && sourcebase="lib"
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
941 test -d "$destdir/$sourcebase" \
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
942 || (test -z "$dry_run" && mkdir "$destdir/$sourcebase") \
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
943 || func_fatal_error "source base $destdir/$sourcebase doesn't exist"
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
944
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
945 # Set up m4 base.
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
946 test -z "$m4base" && m4base="$ac_m4base"
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
947 test -z "$m4base" && m4base="m4"
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
948 test -d "$destdir/$m4base" \
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
949 || (test -z "$dry_run" && mkdir "$destdir/$m4base") \
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
950 || func_fatal_error "m4 base $destdir/$m4base doesn't exist"
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
951
5798
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
952 # Set up auxiliary directory.
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
953 test -z "$auxdir" && auxdir="$ac_auxdir"
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
954 test -z "$auxdir" && auxdir="."
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
955 test -d "$destdir/$auxdir" \
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
956 || (test -z "$dry_run" && mkdir "$destdir/$auxdir") \
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
957 || func_fatal_error "aux directory $destdir/$auxdir doesn't exist"
49900d80eaaf 2005-04-15 Oskar Liljeblad <oskar@osk.mine.nu>
Simon Josefsson <simon@josefsson.org>
parents: 5685
diff changeset
958
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
959 # Using libtool?
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
960 if test -n "$seen_libtool"; then
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
961 libtool=true
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
962 fi
5202
64446bf39961 Use sed instead of autoconf --trace, inspired by
Paul Eggert <eggert@cs.ucla.edu>
parents: 5198
diff changeset
963
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
964 # What modules to extract.
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
965 if test $# = 0; then
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
966 modules="$ac_modules"
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
967 else
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
968 modules="$*"
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
969 fi
5262
97ed4b64d853 New parameter --lgpl, to asseert that modules are
Paul Eggert <eggert@cs.ucla.edu>
parents: 5255
diff changeset
970
5345
8394c9bf619f Move a lot of code into function func_import().
Bruno Haible <bruno@clisp.org>
parents: 5344
diff changeset
971 func_import "$modules"
5343
eae956a8e0ec Untabify.
Bruno Haible <bruno@clisp.org>
parents: 5312
diff changeset
972 ;;
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
973
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
974 create-testdir )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
975 if test -z "$destdir"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
976 func_fatal_error "please specify --dir option"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
977 fi
4126
e8caa337b4e1 (create-testdir): don't complain if destdir
Karl Berry <karl@freefriends.org>
parents: 4124
diff changeset
978 mkdir "$destdir"
e8caa337b4e1 (create-testdir): don't complain if destdir
Karl Berry <karl@freefriends.org>
parents: 4124
diff changeset
979 test -d "$destdir" \
e8caa337b4e1 (create-testdir): don't complain if destdir
Karl Berry <karl@freefriends.org>
parents: 4124
diff changeset
980 || func_fatal_error "could not create destination directory"
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
981 func_create_testdir "$destdir" "$*"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
982 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
983
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
984 create-megatestdir )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
985 if test -z "$destdir"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
986 func_fatal_error "please specify --dir option"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
987 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
988 mkdir "$destdir" || func_fatal_error "could not create destination directory"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
989 func_create_megatestdir "$destdir" "$*"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
990 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
991
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
992 test )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
993 test -n "$destdir" || destdir=testdir$$
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
994 mkdir "$destdir" || func_fatal_error "could not create destination directory"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
995 func_create_testdir "$destdir" "$*"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
996 cd "$destdir"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
997 mkdir build
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
998 cd build
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
999 ../configure
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1000 make
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1001 make check
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1002 make distclean
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1003 remaining=`find . -type f -print`
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1004 if test -n "$remaining"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1005 echo "Remaining files:" $remaining 1>&2
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1006 echo "gnulib-tool: *** Stop." 1>&2
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1007 exit 1
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1008 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1009 cd ..
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1010 cd ..
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1011 rm -rf "$destdir"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1012 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1013
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1014 megatest )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1015 test -n "$destdir" || destdir=testdir$$
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1016 mkdir "$destdir" || func_fatal_error "could not create destination directory"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1017 func_create_megatestdir "$destdir" "$*"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1018 cd "$destdir"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1019 mkdir build
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1020 cd build
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1021 ../configure
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1022 make
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1023 make check
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1024 make distclean
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1025 remaining=`find . -type f -print`
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1026 if test -n "$remaining"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1027 echo "Remaining files:" $remaining 1>&2
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1028 echo "gnulib-tool: *** Stop." 1>&2
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1029 exit 1
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1030 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1031 cd ..
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1032 cd ..
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1033 rm -rf "$destdir"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1034 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1035
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1036 extract-description )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1037 for module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1038 do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1039 func_verify_module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1040 if test -n "$module"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1041 func_get_description "$module"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1042 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1043 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1044 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1045
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1046 extract-filelist )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1047 for module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1048 do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1049 func_verify_module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1050 if test -n "$module"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1051 func_get_filelist "$module"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1052 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1053 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1054 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1055
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1056 extract-dependencies )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1057 for module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1058 do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1059 func_verify_module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1060 if test -n "$module"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1061 func_get_dependencies "$module"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1062 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1063 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1064 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1065
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1066 extract-autoconf-snippet )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1067 for module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1068 do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1069 func_verify_module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1070 if test -n "$module"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1071 func_get_autoconf_snippet "$module"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1072 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1073 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1074 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1075
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1076 extract-automake-snippet )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1077 for module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1078 do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1079 func_verify_module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1080 if test -n "$module"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1081 func_get_automake_snippet "$module"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1082 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1083 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1084 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1085
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1086 extract-include-directive )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1087 for module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1088 do
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1089 func_verify_module
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1090 if test -n "$module"; then
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1091 func_get_include_directive "$module"
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1092 fi
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1093 done
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1094 ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1095
5251
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
1096 extract-license )
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
1097 for module
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
1098 do
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
1099 func_verify_module
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
1100 if test -n "$module"; then
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
1101 func_get_license "$module"
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
1102 fi
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
1103 done
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
1104 ;;
42b53a22aee5 Add a license tag to every module.
Bruno Haible <bruno@clisp.org>
parents: 5250
diff changeset
1105
4197
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
1106 extract-maintainer )
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
1107 for module
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
1108 do
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
1109 func_verify_module
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
1110 if test -n "$module"; then
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
1111 func_get_maintainer "$module"
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
1112 fi
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
1113 done
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
1114 ;;
3ccc6d0d52bb Add a Maintainer.
Bruno Haible <bruno@clisp.org>
parents: 4175
diff changeset
1115
4112
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1116 * )
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1117 func_fatal_error "unknown operation mode --$mode" ;;
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1118 esac
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1119
98e795b64056 Tool for managing gnulib modules.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1120 exit 0