1311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff#!/bin/sh
264fe2324403ea78dbd781073f4e5b34768676e2copenvcdiff@gmail.com# Copyright 2008 Google Inc.
364fe2324403ea78dbd781073f4e5b34768676e2copenvcdiff@gmail.com# Authors: Craig Silverstein, Lincoln Smith
464fe2324403ea78dbd781073f4e5b34768676e2copenvcdiff@gmail.com#
564fe2324403ea78dbd781073f4e5b34768676e2copenvcdiff@gmail.com# Licensed under the Apache License, Version 2.0 (the "License");
664fe2324403ea78dbd781073f4e5b34768676e2copenvcdiff@gmail.com# you may not use this file except in compliance with the License.
764fe2324403ea78dbd781073f4e5b34768676e2copenvcdiff@gmail.com# You may obtain a copy of the License at
864fe2324403ea78dbd781073f4e5b34768676e2copenvcdiff@gmail.com#
964fe2324403ea78dbd781073f4e5b34768676e2copenvcdiff@gmail.com#      http://www.apache.org/licenses/LICENSE-2.0
1064fe2324403ea78dbd781073f4e5b34768676e2copenvcdiff@gmail.com#
1164fe2324403ea78dbd781073f4e5b34768676e2copenvcdiff@gmail.com# Unless required by applicable law or agreed to in writing, software
1264fe2324403ea78dbd781073f4e5b34768676e2copenvcdiff@gmail.com# distributed under the License is distributed on an "AS IS" BASIS,
1364fe2324403ea78dbd781073f4e5b34768676e2copenvcdiff@gmail.com# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1464fe2324403ea78dbd781073f4e5b34768676e2copenvcdiff@gmail.com# See the License for the specific language governing permissions and
1564fe2324403ea78dbd781073f4e5b34768676e2copenvcdiff@gmail.com# limitations under the License.
1664fe2324403ea78dbd781073f4e5b34768676e2copenvcdiff@gmail.com#
17311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff# These are the files that this script might edit:
18311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff#    aclocal.m4 configure Makefile.in src/config.h.in \
19311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff#    depcomp config.guess config.sub install-sh missing mkinstalldirs \
20311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff#    ltmain.sh
21311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff#
22311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff# Here's a command you can run to see what files aclocal will import:
23311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff#  aclocal -I ../autoconf --output=- | sed -n 's/^m4_include..\([^]]*\).*/\1/p'
24311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff
25311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiffset -ex
26311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiffrm -rf autom4te.cache
27311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff
28311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdifftrap 'rm -f aclocal.m4.tmp' EXIT
29311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff
30732fff248e662ec47aa27c124632f406f27b6c8dopenvcdiff@gmail.com# Use version 1.11 of aclocal and automake if available.
31732fff248e662ec47aa27c124632f406f27b6c8dopenvcdiff@gmail.comACLOCAL=aclocal-1.11
32311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiffif test -z `which "$ACLOCAL"`; then
33311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff  ACLOCAL=aclocal
34311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdifffi
35311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff
36732fff248e662ec47aa27c124632f406f27b6c8dopenvcdiff@gmail.comAUTOMAKE=automake-1.11
37311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiffif test -z `which "$AUTOMAKE"`; then
38311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff  AUTOMAKE=automake
39311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdifffi
40311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff
41311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff# glibtoolize is used for Mac OS X
42311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiffLIBTOOLIZE=libtoolize
43311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiffif test -z `which "$LIBTOOLIZE"`; then
44311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff  LIBTOOLIZE=glibtoolize
45311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdifffi
46311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff
47311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff# aclocal tries to overwrite aclocal.m4 even if the contents haven't
48311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff# changed, which is annoying when the file is not open for edit (in
49311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff# p4).  We work around this by writing to a temp file and just
50311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff# updating the timestamp if the file hasn't change.
51732fff248e662ec47aa27c124632f406f27b6c8dopenvcdiff@gmail.com"$ACLOCAL" --force -I m4 -I gflags/m4 --output=aclocal.m4.tmp
52311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiffif cmp aclocal.m4.tmp aclocal.m4; then
53311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff  touch aclocal.m4               # pretend that we regenerated the file
54311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff  rm -f aclocal.m4.tmp
55311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiffelse
56311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff  mv aclocal.m4.tmp aclocal.m4   # we did set -e above, so we die if this fails
57311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdifffi
58311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff
59311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiffgrep -q LIBTOOL configure.ac && "$LIBTOOLIZE" -c -f
60311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiffautoconf -f -W all,no-obsolete
61311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiffautoheader -f -W all
62311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff"$AUTOMAKE" -a -c -f -W all
63311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiff
64311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiffrm -rf autom4te.cache
65311c71486f5f6074e5ba62a7f4c5397c8700b868openvcdiffexit 0
66