# Maintainer: Allan McRae <allan@archlinux.org>
# Contributor: Andreas Radke <andyrtr@archlinux.org>

pkgname=autoconf
pkgver=2.69
pkgrel=5
pkgdesc="A GNU tool for automatically configuring source code"
arch=('any')
license=('GPL2' 'GPL3' 'custom')
url="http://www.gnu.org/software/autoconf"
groups=('base-devel')
depends=('awk' 'm4' 'diffutils' 'sh')
makedepends=('help2man')  # needed while perl patch is present
checkdepends=('gcc-fortran')
source=(ftp://ftp.gnu.org/pub/gnu/${pkgname}/${pkgname}-${pkgver}.tar.xz{,.sig}
        autoconf-2.69-perl-5.22-autoscan.patch
        autoconf-2.69-perl-5.28.patch
        autoconf-2.69-libtool-compatibility.patch)
md5sums=('50f97f4159805e374639a73e2636f22e'
         'SKIP'
         'aa07afe5a671df25bf1878831702d5b9'
         'f450ce6001458d800907e5d4ad8023fb'
         '87bceda7922ebc2a453568b2ae179e1b')
validpgpkeys=('71C2CC22B1C4602927D2F3AAA7A16B4A2527436A')


prepare() {
  cd ${pkgname}-${pkgver}

  # fix incompatibility with recent perl
  patch -p1 -i $srcdir/autoconf-2.69-perl-5.22-autoscan.patch
  patch -p1 -i $srcdir/autoconf-2.69-perl-5.28.patch

  # fix tesetsuite failures with recent libtool
  patch -p1 -i $srcdir/autoconf-2.69-libtool-compatibility.patch
}
  
build() {
  cd ${pkgname}-${pkgver}
  ./configure --prefix=/usr
  make
}

check() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make check
}

package() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} install

  # license exception
  install -Dm644 COPYING.EXCEPTION \
    $pkgdir/usr/share/licenses/autoconf/COPYING.EXCEPTION

  # remove unwanted file
  rm -f ${pkgdir}/usr/share/info/standards.info
}
