4 # $Id: mkaclocal.in,v 1.2 1997/09/11 09:06:33 mdw Exp $
6 # Create an `aclocal.m4' file containing the right macros.
8 # (c) 1997 Mark Wooding
11 #----- Licensing notice -----------------------------------------------------
13 # This file is part of the Common Files Distribution (`common').
15 # `Common' is free software; you can redistribute it and/or modify
16 # it under the terms of the GNU General Public License as published by
17 # the Free Software Foundation; either version 2 of the License, or
18 # (at your option) any later version.
20 # `Common' is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with `common'; if not, write to the Free Software Foundation,
27 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 #----- Revision history -----------------------------------------------------
33 # --- Configuration variables ---
36 exec_prefix=@exec_prefix@
38 datadir=@datadir@/@PACKAGE@
40 # --- Parse command line ---
47 while [ $# -gt 0 ]; do
49 -h | --h | --he | --hel | --help)
51 Usage: mkaclocal [-lx] [-c CONFIG] [-o OUTPUT] [LIBRARY...]
53 In \`extract' mode (-x, default), constructs an \`aclocal.m4' file containing
54 the right macros for the \`configure.in' script CONFIG (by default this is
55 \`configure.in'). The output is written to OUTPUT, or \`aclocal.m4' if none
58 In addition to libraries specified on the command line, the files
59 \`aclocal.glob' and \`aclocal.site' contained in the shared file repository,
60 and \`aclocal.lib' in the current directory are also searched.
62 If \`aclocal.lib' contains the string \`*@--TOP--@*', the preceding text is
63 written at the top of any output file generated.
65 In \`list' mode (-l), lists the macros defined in the various libraries.
69 -h, --help Print this help text.
70 -v, --version Print the program's version number.
71 -l, --list List chunks defined in text libraries.
72 -x, --extract Extract chunks from text libraries (default).
73 -n, --no-stdlib Don't read from the standard libraries.
74 -c, --config=CONFIG Read CONFIG, not \`configure.in', to decide which
75 macros need extracting.
76 -o, --output=OUTPUT Extract chunks to OUTPUT, not \`aclocal.m4'.
80 -v | --v | --ve | --ver | --vers | --versi | --versio | --version)
81 version=`echo '$Revision: 1.2 $' |
82 sed -n -e 's;^.*: \([0-9.]*\) *\\$;\1;p'`
83 echo "mkaclocal $version; Common Files Distribution version @VERSION@"
86 -c | --c | --co | --con | --conf | --confi | --config)
91 in=`echo $1 | sed -e 's/^-[a-z]//'`
93 --c=* | --co=* | --con=* | --conf=* | --confi=* | --config=*)
94 in=`echo $1 | sed -e 's/^--[a-z]*=//'`
96 -o | --o | --ou | --out | --outp | --outpu | --output)
101 out=`echo $1 | sed -e 's/^-[a-z]//'`
103 --o=* | --ou=* | --out=* | --outp=* | --outpu=* | --output=*)
104 out=`echo $1 | sed -e 's/^--[a-z]*=//'`
106 -n | --no-s* | --no-st* | --no-std* | --no-stdl* | \
107 --no-stdli* | --no-stdlib)
110 -l | --l | --li | --lis | --list)
113 -x | --e | --ex | --ext | --extr | --extra | --extrac | --extract)
124 echo "mkaclocal: unknown option \`$1'" >&2
136 "$datadir/aclocal.glob" \
137 `test -r $datadir/aclocal.site && echo "$datadir/aclocal.site"` \
138 `test -r ./aclocal.lib && echo "./aclocal.lib"` \
142 `test -r ./aclocal.lib && echo "./aclocal.lib"` \
146 # --- Now do the job ---
151 $bindir/txtlib -l "$@" | sort | uniq
155 t=${TMPDIR-/tmp}/mkaclocal.$$
156 if mkdir -m700 $t; then :
158 echo >&2 "mkaclocal: cculd not create temporary directory"
164 $bindir/txtlib -l "$@" | sort | uniq | while read LINE; do
169 until { echo -NOTICE-; sed -n -f $t/sed $in; } | sort | uniq >$t/b
172 $bindir/txtlib "$@" <$t/b >$out.tmp
178 if [ "$created" = "yes" ]; then
179 { test -r ./aclocal.lib &&
180 grep "\*@--TOP--@\*" ./aclocal.lib >/dev/null &&
181 sed -e "/\*@--TOP--@\*/, $ d" ./aclocal.lib