autogen.sh revision c7f5f8508d98d5952d42ed7648c2a8f30a4da156
1c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott#!/bin/sh
2c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
3c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott# These are the files that this script might edit:
4c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott#    aclocal.m4 configure Makefile.in src/config.h.in \
5c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott#    depcomp config.guess config.sub install-sh missing mkinstalldirs \
6c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott#    ltmain.sh
7c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott#
8c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott# Here's a command you can run to see what files aclocal will import:
9c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott#  aclocal -I ../autoconf --output=- | sed -n 's/^m4_include..\([^]]*\).*/\1/p'
10c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
11c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scottset -ex
12c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scottrm -rf autom4te.cache
13c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
14c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scotttrap 'rm -f aclocal.m4.tmp' EXIT
15c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
16c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott# Use version 1.10 of aclocal and automake if available.
17c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick ScottACLOCAL=aclocal-1.10
18c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scottif test -z `which "$ACLOCAL"`; then
19c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott  ACLOCAL=aclocal
20c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scottfi
21c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
22c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick ScottAUTOMAKE=automake-1.10
23c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scottif test -z `which "$AUTOMAKE"`; then
24c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott  AUTOMAKE=automake
25c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scottfi
26c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
27c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott# glibtoolize is used for Mac OS X
28c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick ScottLIBTOOLIZE=libtoolize
29c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scottif test -z `which "$LIBTOOLIZE"`; then
30c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott  LIBTOOLIZE=glibtoolize
31c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scottfi
32c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
33c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott# aclocal tries to overwrite aclocal.m4 even if the contents haven't
34c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott# changed, which is annoying when the file is not open for edit (in
35c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott# p4).  We work around this by writing to a temp file and just
36c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott# updating the timestamp if the file hasn't change.
37c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott"$ACLOCAL" --force -I m4 --output=aclocal.m4.tmp
38c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scottif cmp aclocal.m4.tmp aclocal.m4; then
39c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott  touch aclocal.m4               # pretend that we regenerated the file
40c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott  rm -f aclocal.m4.tmp
41c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scottelse
42c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott  mv aclocal.m4.tmp aclocal.m4   # we did set -e above, so we die if this fails
43c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scottfi
44c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
45c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scottgrep -q LIBTOOL configure.ac && "$LIBTOOLIZE" -c -f
46c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scottautoconf -f -W all,no-obsolete
47c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scottautoheader -f -W all
48c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott"$AUTOMAKE" -a -c -f -W all
49c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scott
50c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scottrm -rf autom4te.cache
51c7f5f8508d98d5952d42ed7648c2a8f30a4da156Patrick Scottexit 0
52