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/
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 \
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'
18 trap 'rm -f aclocal.m4.tmp' EXIT
20 # Returns the first binary in $* that exists, or the last arg, if none exists.
22 for candidate
in "$@"; do
23 if "$candidate" --version >/dev
/null
2>&1; then
28 echo "$candidate" # the last one in $@
31 # Use version 1.9 of aclocal and automake if available.
32 ACLOCAL
=`WhichOf aclocal-1.9 aclocal`
33 AUTOMAKE
=`WhichOf automake-1.9 automake`
34 LIBTOOLIZE
=`WhichOf glibtoolize libtoolize15 libtoolize14 libtoolize`
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
41 if cmp aclocal.
m4.tmp aclocal.
m4; then
42 touch aclocal.
m4 # pretend that we regenerated the file
45 mv aclocal.
m4.tmp aclocal.
m4 # we did set -e above, so we die if this fails
48 grep -q '^[^#]*AC_PROG_LIBTOOL' configure.ac
&& "$LIBTOOLIZE" -c -f
49 autoconf
-f -W all
,no-obsolete
51 "$AUTOMAKE" -a -c -f -W all