1#!/bin/sh
2# Script for fixing aclocal.m4 files produced by 'aclocal' from automake 1.10.
3# Copyright (C) 2006, 2008 Free Software Foundation, Inc.
4#
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18# Usage: fixaclocal aclocal [OPTIONS]
19
20"$@"
21result=$?
22if test $result = 0 && test -f aclocal.m4; then
23  # Remove the block of 4 lines starting with 'm4_if(m4_PACKAGE_VERSION'
24  # and the block of 5 lines starting with 'm4_if(AC_AUTOCONF_VERSION'
25  # (automake <= 1.10.1) or with 'm4_if(m4_defn([AC_AUTOCONF_VERSION])'
26  # (automake >= 1.10.2).
27  sed -e '/m4_if(m4_PACKAGE_VERSION/{N;N;N;d}' -e '/m4_if(AC_AUTOCONF_VERSION/{N;N;N;N;d}' -e '/m4_if(m4_defn(\[AC_AUTOCONF_VERSION\])/{N;N;N;N;d}' < aclocal.m4 > aclocal.m4.tmp
28  if cmp aclocal.m4 aclocal.m4.tmp > /dev/null; then
29    rm -f aclocal.m4.tmp
30  else
31    mv aclocal.m4.tmp aclocal.m4
32  fi
33else
34  exit $result
35fi
36