#!/bin/sh -x

ORIGPATH="$( pwd )"
VERSION=$1

cd ${SLACKTRACKSCRATCHDIR}
tar xzf $ORIGPATH/source/autoconf*orig*
cd autoconf*
zcat $ORIGPATH/source/autoconf*diff* | patch -p1
./configure --prefix=/usr
make
make install DESTDIR=$PKG
mkdir -p $PKG/install
install -m644 $ORIGPATH/slack-desc $PKG/install/

# We do this renaming because of debian's autoconf-wrapper.
( cd ${SLACKTRACKFAKEROOT}/usr/bin
  # Let the wrapper deal with these:
  mv autoconf autoconf${VERSION}
  mv autoheader autoheader${VERSION}
  mv autoreconf autoreconf${VERSION}

  # The wrapper doesn't do these, so we'll make symlinks to 
  # let us easily see which our default version is.
  mv autoupdate autoupdate${VERSION}
  ln -fs autoupdate${VERSION} autoupdate
  mv ifnames ifnames${VERSION}
  ln -fs ifnames${VERSION} ifnames
  mv autoscan autoscan${VERSION}
  ln -fs autoscan${VERSION} autoscan

  # Install Debian's autoconf-wrapper
  install -m755 ${ORIGPATH}/autoconf-wrapper .

  # And to make everything work:
  ln -fs autoconf-wrapper autoconf
  ln -fs autoconf-wrapper autoheader
  ln -fs autoconf-wrapper autoreconf

  # Don't want this. Well, I do but not right this moment.
  cd ../..
  rm -rf usr/info )

