1#!/bin/sh 2 3# Before using, you should figure out all the .m4 macros that your 4# configure.m4 script needs and make sure they exist in the m4/ 5# directory. 6# 7# These are the files that this script might edit: 8# aclocal.m4 configure Makefile.in src/config.h.in \ 9# depcomp config.guess config.sub install-sh missing mkinstalldirs \ 10# ltmain.sh 11# 12# Here's a command you can run to see what files aclocal will import: 13# aclocal -I ../autoconf --output=- | sed -n 's/^m4_include..\([^]]*\).*/\1/p' 14 15set -ex 16rm -rf autom4te.cache 17 18trap 'rm -f aclocal.m4.tmp' EXIT 19 20# Returns the first binary in $* that exists, or the last arg, if none exists. 21WhichOf() { 22 for candidate in "$@"; do 23 if "$candidate" --version >/dev/null 2>&1; then 24 echo "$candidate" 25 return 26 fi 27 done 28 echo "$candidate" # the last one in $@ 29} 30 31# Use version 1.9 of aclocal and automake if available. 32ACLOCAL=`WhichOf aclocal-1.9 aclocal` 33AUTOMAKE=`WhichOf automake-1.9 automake` 34LIBTOOLIZE=`WhichOf glibtoolize libtoolize15 libtoolize14 libtoolize` 35 36# aclocal tries to overwrite aclocal.m4 even if the contents haven't 37# changed, which is annoying when the file is not open for edit (in 38# p4). We work around this by writing to a temp file and just 39# updating the timestamp if the file hasn't change. 40"$ACLOCAL" --force -I m4 --output=aclocal.m4.tmp 41if cmp aclocal.m4.tmp aclocal.m4; then 42 touch aclocal.m4 # pretend that we regenerated the file 43 rm -f aclocal.m4.tmp 44else 45 mv aclocal.m4.tmp aclocal.m4 # we did set -e above, so we die if this fails 46fi 47 48grep -q '^[^#]*AC_PROG_LIBTOOL' configure.ac && "$LIBTOOLIZE" -c -f 49autoconf -f -W all,no-obsolete 50autoheader -f -W all 51"$AUTOMAKE" -a -c -f -W all 52 53rm -rf autom4te.cache 54exit 0 55