#! /bin/sh # -*-sh-*- # # $Id: mkaclocal.in,v 1.2 1997/09/11 09:06:33 mdw Exp $ # # Create an `aclocal.m4' file containing the right macros. # # (c) 1997 Mark Wooding # #----- Licensing notice ----------------------------------------------------- # # This file is part of the Common Files Distribution (`common'). # # `Common' is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # `Common' is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with `common'; if not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. set -e # --- Configuration variables --- prefix=@prefix@ exec_prefix=@exec_prefix@ bindir=@bindir@ datadir=@datadir@/@PACKAGE@ # --- Parse command line --- mode=x out="aclocal.m4" in="configure.in" stdlib=true while [ $# -gt 0 ]; do case $1 in -h | --h | --he | --hel | --help) cat <&2 exit 1 ;; *) break ;; esac shift done if $stdlib; then set -- \ `test -r $datadir/aclocal.site && echo "$datadir/aclocal.site"` \ `test -r ./aclocal.lib && echo "./aclocal.lib"` \ "$@" else set -- \ `test -r ./aclocal.lib && echo "./aclocal.lib"` \ "$@" fi # --- Now do the job --- case $mode in l) $bindir/txtlib -l "$@" | sort | uniq ;; x) t=${TMPDIR-/tmp}/mkaclocal.$$ doaclocal=false if $stdlib && [ $out = aclocal.m4 ]; then doaclocal=true out=acinclude.m4 fi if mkdir -m700 $t; then : else echo >&2 "mkaclocal: cculd not create temporary directory" exit 1 fi echo -NOTICE- >$t/a created=no $bindir/txtlib -l "$@" | sort | uniq | while read LINE; do echo "/$LINE/ i\\ $LINE" done >$t/sed until { echo -NOTICE-; sed -n -f $t/sed $in; } | sort | uniq >$t/b cmp -s $t/a $t/b do $bindir/txtlib "$@" <$t/b >$out.tmp in=$out.tmp mv $t/b $t/a created=yes done if [ "$created" = "yes" ]; then { test -r ./aclocal.lib && grep "\*@--TOP--@\*" ./aclocal.lib >/dev/null && sed -e "/\*@--TOP--@\*/, $ d" ./aclocal.lib cat $out.tmp } >$out.new mv $out.new $out else rm -f $out fi rm -fr $t $out.tmp if $doaclocal; then aclocal; fi ;; esac