dnl $Id: configure.in,v 1.5 2002/03/03 20:24:27 jjgignac Exp $

AC_INIT()

dnl Checks for programs.
AC_PATH_PROGS(PERL, perl5 perl)
if test -z $PERL ; then
    AC_MSG_ERROR([*** Please install PERL 5 first: http://www.cpan.org ***])
fi

AC_PATH_PROGS(GNUTAR, gtar gnutar tar)
if test ! -z "$GNUTAR"; then
    case "`\"$GNUTAR\" --version 2>&1`" in
    *GNU*tar* | *Free*paxutils* )
	;;
    *)
	AC_MSG_WARN([*** $GNUTAR is not GNU tar, so it will not be used. ***])
	GNUTAR=
	;;
    esac
else
    AC_MSG_ERROR([*** Please install GNU tar first: http://www.gnu.org ***])
fi

AC_PATH_PROGS(RM, rm)
if test -z $RM ; then
    AC_MSG_ERROR([*** rm(1) not found?! You must have rm command in system. ***])
fi

AC_PATH_PROGS(CAT, cat)
if test -z $CAT ; then
    AC_MSG_ERROR([*** cat(1) not found?! You must have cat command in system. ***])
fi

AC_PATH_PROGS(THE_PWD, pwd)
if test -z $PWD ; then
    AC_MSG_ERROR([*** pwd(1) not found?! You must have pwd command in system. ***])
fi

AC_PATH_PROGS(HOSTNAME, hostname)
if test -z $HOSTNAME ; then
    AC_MSG_ERROR([*** hostname(1) not found?! You must have hostname command in system. ***])
fi

AC_PATH_PROGS(DATE, date)
if test -z $DATE ; then
    AC_MSG_ERROR([*** date(1) not found?! You must have date command in system. ***])
fi

AC_PATH_PROGS(MV, mv)
if test -z $MV ; then
    AC_MSG_ERROR([*** mv(1) not found?! You must have mv command in system. ***])
fi

AC_PATH_PROGS(TRUE, true)
if test -z $TRUE ; then
    AC_MSG_ERROR([*** true(1) not found?! You must have true command in system. ***])
fi

AC_PATH_PROGS(MOUNT, mount)
if test -z $MOUNT ; then
    AC_MSG_ERROR([*** mount(8) not found?! You must have mount command in system. ***])
fi

AC_PATH_PROGS(UMOUNT, umount)
if test -z $UMOUNT ; then
    AC_MSG_ERROR([*** umount(8) not found?! You must have umount command in system. ***])
fi

AC_PATH_PROGS(GZIP, gzip)
if test -z $GZIP ; then
    AC_MSG_ERROR([*** Please install GNU zip/unzip first: http://www.gnu.org ***])
fi

AC_PATH_PROGS(BZIP, bzip2)
if test -z $BZIP ; then
    AC_MSG_ERROR([*** Please install bzip2 first: http://sources.redhat.com/bzip2 ***])
fi

AC_PATH_PROGS(MKISOFS, mkisofs)
if test -z $MKISOFS ; then
    AC_MSG_ERROR([*** Please install cdrtools first: http://www.fokus.gmd.de/research/cc/glone/employees/joerg.schilling/private/cdrecord.html ***])
fi

AC_PATH_PROGS(CDRECORD, cdrecord)
if test -z $CDRECORD ; then
    AC_MSG_ERROR([*** Please install cdrtools first: http://www.fokus.gmd.de/research/cc/glone/employees/joerg.schilling/private/cdrecord.html ***])
fi

AC_PATH_PROGS(EJECT, eject)
if test -z $EJECT ; then
    AC_MSG_ERROR([*** Please install eject first: http://sourceforge.net/projects/eject ***])
fi

AC_PATH_PROGS(SSH, ssh ssh2)
if test -z $SSH ; then
    AC_MSG_ERROR([*** Please install OpenSSH first: http://www.openssh.org ***])
fi

AC_PROG_INSTALL
AC_PROG_MAKE_SET

AC_ARG_WITH(snardir, 
[  --with-snardir=DIR      any *.snar and *.info files will be placed in DIR,
                          default directory is '/var/cdbkup'],
, [withval=/var/cdbkup])
echo "optional: snardir sets to... $withval"
SNARDIR=$withval
AC_SUBST(SNARDIR)

AC_ARG_WITH(dumper, 
[  --with-dumper=USER      the SNARDIR will be owned by USER, default is 'root'],
, [withval=root])
echo "optional: dump user sets to... $withval"
DUMPER=$withval
AC_SUBST(DUMPER)

AC_ARG_WITH(dumpgrp, 
[  --with-dumpgrp=GROUP    the SNARDIR will be owned by dumper in group GROUP,
                          default is 'operator'],
, [withval=operator])
echo "optional: group for dump user sets to... $withval"
DUMPGRP=$withval
AC_SUBST(DUMPGRP)

if test -f src/CDVER ; then
	CDVER=`head -1 src/CDVER`
else
	CDVER="unknown"
fi
AC_SUBST(CDVER)

dnl Checks for libraries.

dnl Checks for header files.

dnl Checks for typedefs, structures, and compiler characteristics.

dnl Checks for library functions.

AC_OUTPUT(test/test-suite src/cdappend src/cdbkup src/cdcat src/cdrstr src/cdsplit man/cdappend.1 man/cdbkup.1 man/cdcat.1 man/cdrstr.1 man/cdsplit.1 src/Makefile man/Makefile Makefile)
