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 ---
46 while [ $# -gt 0 ]; do
48 -h | --h | --he | --hel | --help)
50 Usage: mkaclocal [-lx] [-c CONFIG] [-o OUTPUT] [LIBRARY...]
52 In \`extract' mode (-x, default), constructs an \`aclocal.m4' file containing
53 the right macros for the \`configure.in' script CONFIG (by default this is
54 \`configure.in'). The output is written to OUTPUT, or \`aclocal.m4' if none
57 In addition to libraries specified on the command line, the files
58 \`aclocal.glob' and \`aclocal.site' contained in the shared file repository,
59 and \`aclocal.lib' in the current directory are also searched.
61 If \`aclocal.lib' contains the string \`*@--TOP--@*', the preceding text is
62 written at the top of any output file generated.
64 In \`list' mode (-l), lists the macros defined in the various libraries.
68 -h, --help Print this help text.
69 -v, --version Print the program's version number.
70 -l, --list List chunks defined in text libraries.
71 -x, --extract Extract chunks from text libraries (default).
72 -c, --config=CONFIG Read CONFIG, not \`configure.in', to decide which
73 macros need extracting.
74 -o, --output=OUTPUT Extract chunks to OUTPUT, not \`aclocal.m4'.
78 -v | --v | --ve | --ver | --vers | --versi | --versio | --version)
79 version=`echo '$Revision: 1.2 $' |
80 sed -n -e 's;^.*: \([0-9.]*\)\\$;\1;p'`
81 echo "txtlib $version; Common Files Distribution version @VERSION@"
84 -c | --c | --co | --con | --conf | --confi | --config)
89 in=`echo $1 | sed -e 's/^-[a-z]//'`
91 --c=* | --co=* | --con=* | --conf=* | --confi=* | --config=*)
92 in=`echo $1 | sed -e 's/^--[a-z]*=//'`
94 -o | --o | --ou | --out | --outp | --outpu | --output)
99 out=`echo $1 | sed -e 's/^-[a-z]//'`
101 --o=* | --ou=* | --out=* | --outp=* | --outpu=* | --output=*)
102 out=`echo $1 | sed -e 's/^--[a-z]*=//'`
104 -l | --l | --li | --lis | --list)
107 -x | --e | --ex | --ext | --extr | --extra | --extrac | --extract)
118 echo "mkaclocal: unknown option \`$1'" >&2
129 "$datadir/aclocal.glob" \
130 `test -r $datadir/aclocal.site && echo "$datadir/aclocal.site"` \
131 `test -r ./aclocal.lib && echo "./aclocal.lib"` \
134 # --- Now do the job ---
139 $bindir/txtlib -l "$@" | sort | uniq
144 if mkdir -m 700 $t; then :
146 echo >&2 "mkaclocal: cculd not creat etemporary directory"
152 $bindir/txtlib -l "$@" | sort | uniq | while read LINE; do
157 until { echo -NOTICE-; sed -n -f $t/sed $in; } | sort | uniq >$t/b
160 $bindir/txtlib "$@" <$t/b >$out.tmp
166 if [ "$created" = "yes" ]; then
167 { test -r ./aclocal.lib &&
168 grep "\*@--TOP--@\*" ./aclocal.lib >/dev/null &&
169 sed -e "/\*@--TOP--@\*/, $ d" ./aclocal.lib