dnl
dnl Process this file with autoconf to produce a configure script.
dnl 

AC_REVISION($Id: configure.in,v 1.9 2000/09/08 08:46:08 paul Exp $)dnl

AC_INIT(COPYING.authlib)

#
# Set these according to your preferences
#
env | grep CONFIG_ |sort
#if called from isdn4k-utils configure script, empty values mean 'n'
#
if test -n "${CONFIG_EUROFILE}"; then
echo
echo execing $1 on behalf of isdn4k-utils make config
echo 
CONFIG_EFTD=${CONFIG_EFTD:-n}
CONFIG_EFTD_WUAUTH=${CONFIG_EFTD_WUAUTH:-n}
CONFIG_EFTP=${CONFIG_EFTP:-n}
CONFIG_EFTP_READLINE=${CONFIG_EFTP_READLINE:-n}
CONFIG_EFTP_SETUID=${CONFIG_EFTP_SETUID:-n}
CONFIG_EFT_INSTALL_CONF=${CONFIG_EFT_INSTALL_CONF:-n}
fi
#
# Default config options to be applied when configuring stand-alone
#
CONFIG_EFTD=${CONFIG_EFTD:-y}
# Shall eurofile daemon use authentification modules from wu-ftpd?
CONFIG_EFTD_WUAUTH=${CONFIG_EFTD_WUAUTH:-y}
CONFIG_EFTP=${CONFIG_EFTP:-y}
# This will be redefined to "n" by the configure script if no readline
# library supporting the alternate interface is found
CONFIG_EFTP_READLINE=${CONFIG_EFTP_READLINE:-y}
CONFIG_EFTP_SETUID=${CONFIG_EFTP_SETUID:-n}
CONFIG_EFT_INSTALL_CONF=${CONFIG_EFT_INSTALL_CONF:-n}


EFTP_CLIENT_MSN=`eval echo ${CONFIG_EFTP_CLIENT_MSN:-"XXX"}`
EFTD_SERVER_MSN=`eval echo ${CONFIG_EFTD_SERVER_MSN:-"YYY"}`

I4LCONFDIR=`eval echo ${CONFIG_I4LCONFDIR:-"/etc/isdn"}`
I4LVERSION=${I4LVERSION:-"?.?"}
BINDIR=`eval echo ${CONFIG_BINDIR:-'\\${bindir}'}`
SBINDIR=`eval echo ${CONFIG_SBINDIR:-'\\${sbindir}'}`
KERNELDIR=`eval echo ${CONFIG_KERNELDIR:-"/usr/src/linux"}`
dnl RUNDIR=`eval echo ${CONFIG_RUNDIR:-'\\${localstatedir}/run'}`
dnl enforce a unique dire for pidfiles, independent of install patch
RUNDIR=`eval echo ${CONFIG_RUNDIR:-"/var/run"}`

AC_CHECK_FILE(/etc/rc.d/init.d, DEFAULT_SYSVINIT_RC_DIR=/etc/rc.d/init.d, DEFAULT_SYSVINIT_RC_DIR=/etc/init.d)
SYSVINIT_RC_DIR=`eval echo ${CONFIG_SYSVINIT_RC_DIR=$DEFAULT_SYSVINIT_RC_DIR}`

EFT_TOPDIR=${EFT_TOPDIR:-$PWD}

dnl This warning to be inserted in each file generated by configure.
dnl Warning does not apply to this (configure.in) file.

EFT_AUTOCONF_WARNING=".autoconf_warning"

dnl Checks for programs.

AC_PROG_INSTALL
AC_PROG_CC

dnl AC_PATH_PROG(PERL, perl, /usr/bin/perl, /usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/usr/bin:/bin)
AC_PATH_PROG(ISDNCTRL, isdnctrl, $SBINDIR/isdnctrl, /usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/usr/bin:/bin)
AC_PATH_PROG(LOOPCTRL, loopctrl, $SBINDIR/loopctrl, /usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/usr/bin:/bin)
AC_PATH_PROG(INSMOD, insmod, /sbin/insmod, /usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/usr/bin:/bin)
AC_PATH_PROG(RMMOD, rmmod, /sbin/rmmod, /usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/usr/bin:/bin)
AC_PATH_PROG(IFCONFIG, ifconfig, /sbin/ifconfig, /usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/usr/bin:/bin)
AC_PATH_PROG(X25ROUTE, x25route, $SBINDIR/x25route, /usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/usr/bin:/bin)
AC_PATH_PROG(X25TRACE, x25trace, $SBINDIR/x25trace, /usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/usr/bin:/bin)



dnl Checks for libraries.

dnl for command line editing to work, we need a (GNU) readline library
dnl which supports the "alternative interface".

AC_CHECK_LIB(readline,rl_callback_handler_install,,CONFIG_EFTP_READLINE="n",-lncurses)

dnl Checks for header files.

AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h sys/ioctl.h unistd.h)

AC_CHECK_HEADERS(linux/isdn.h)
dnl Find current kernel source

dnl Checks for typedefs, structures, and compiler characteristics.


dnl Checks for library functions.


dnl some systems don't contain crypt() in the std C library. Linking servers
dnl with passwd based authentication need -lcrypt in that case.

AC_CHECK_FUNC(crypt,LIBCRYPT="",LIBCRYPT="-lcrypt")

dnl AC_CHECK_FUNC(getdelim,HAVE_GETDELIM="HAVE_GETDELIM",HAVE_GETDELIM="DUMMY")



AC_SUBST(I4LCONFDIR)
AC_SUBST(EFT_TOPDIR)
AC_SUBST_FILE(EFT_AUTOCONF_WARNING)
AC_SUBST(I4LVERSION)
AC_SUBST(KERNELDIR)

AC_SUBST(BINDIR)
AC_SUBST(SBINDIR)
AC_SUBST(RUNDIR)
AC_SUBST(SYSVINIT_RC_DIR)
AC_SUBST(LIBCRYPT)
AC_SUBST(CONFIG_EFTD)
AC_SUBST(CONFIG_EFTD_WUAUTH)
AC_SUBST(CONFIG_EFTP)
AC_SUBST(CONFIG_EFTP_READLINE)
AC_SUBST(CONFIG_EFTP_SETUID)
AC_SUBST(CONFIG_EFT_INSTALL_CONF)
dnl AC_SUBST(INSTALL)
dnl AC_SUBST(INSTALL_PROGRAM)
dnl AC_SUBST(INSTALL_SCRIPT)
AC_SUBST(EFTP_CLIENT_MSN)
AC_SUBST(EFTD_SERVER_MSN)



dnl AC_SUBST(HAVE_GETDELIM)
AC_OUTPUT(Rules.make src/config.h scripts/eftp.sh scripts/eftd.sh examples/eft.conf)
