1#! /bin/sh 2 3# This script is a work-alike of `aclocal' contained in the GNU automake 4# package. It is needed because our aclocal.m4 must be generated from the 5# non-gettext .m4 files in /usr/share/aclocal and from the gettext specific 6# .m4 files in the local m4 directory. 7# With "aclocal --acdir=m4" 8# we get an error: macro `AM_INIT_AUTOMAKE' not found in library 9# With "aclocal -I m4" 10# we get an error: duplicated macro `AM_GNU_GETTEXT' 11# The solution is to put all the .m4 files into a temporary directory. 12 13# This program is free software; you can redistribute it and/or modify 14# it under the terms of the GNU General Public License as published by 15# the Free Software Foundation; either version 2, or (at your option) 16# any later version. 17# 18# This program is distributed in the hope that it will be useful, 19# but WITHOUT ANY WARRANTY; without even the implied warranty of 20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21# GNU General Public License for more details. 22# 23# You should have received a copy of the GNU General Public License 24# along with this program; if not, write to the Free Software 25# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 26# 02111-1307, USA. 27 28set -e 29 30if test $# = 0; then 31 echo "Usage: $0 aclocal-program [aclocal-options]" 1>&2 32 exit 1 33fi 34 35ACLOCAL="$1" 36shift 37 38# Prepare temporary directory. 39mkdir aclocal.tmp 40trap "rm -rf aclocal.tmp; exit 1" 1 2 15 41 42# First, copy the standard m4 files. 43for f in `"$ACLOCAL" --print-ac-dir`/*.m4; do 44 cp $f aclocal.tmp 45done 46 47# Then, copy the contents of any -I directories, overriding previously 48# copied files of the same name. 49options="" 50last_was_I=no 51for arg 52do 53 if test $last_was_I = yes; then 54 for f in "$arg"/*.m4; do 55 cp $f aclocal.tmp 56 done 57 last_was_I=no 58 else 59 case "$arg" in 60 -I) last_was_I=yes;; 61 *) last_was_I=no options="$options $arg";; 62 esac 63 fi 64done 65 66# Now call `aclocal' for real. 67"$ACLOCAL" --acdir=aclocal.tmp $options 68 69# Clean up temporary directory. 70rm -rf aclocal.tmp 71 72