dnl Process this file with autoconf to produce a configure script.
AC_INIT(mipdiag.c)
AC_PREFIX_DEFAULT(/usr/local/v6)

dnl Configure these parameters accordingly
PROGS="mipdiag"
INITDIRS="$INIT_RH6 $INIT_RH7 $INIT_DEBIAN $INIT_SUSE"

INITDIR=\$\{sysconfdir\}/init.d
SYSCONFDIR=\$\{sysconfdir\}
LOCKDIR=\${localstatedir\}/lock
LOCKDIRS="/var/lock/subsys /var/lock"	# XXX: remove /var/log/subsys
NETWORK_MIP6_CONF=\$\{sysconfdir\} dnl by default

dnl Check for programs & stuff
VERSION=`grep -v ^# ./VERSION | tr -d '\012'`
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
INSTALL_LIB="\${INSTALL_DATA}"
AC_SUBST(INSTALL_LIB)
INSTALL_DIR="\${INSTALL} -d"
AC_SUBST(INSTALL_DIR)
AC_PROG_LN_S
AC_PATH_PROG(RM, rm)
if test "x$RM" = "x" ; then AC_MSG_ERROR(Cannot find 'rm') ; fi
AC_PATH_PROG(MKDIR, mkdir)
if test "x$MKDIR" = "x" ; then AC_MSG_ERROR(Cannot find 'mkdir') ; fi
AC_PATH_PROG(SED, sed)
if test "x$SED" = "x" ; then AC_MSG_ERROR(Cannot find 'sed') ; fi
AC_PATH_PROG(GZIP, gzip)
if test "x$GZIP" = "x" ; then AC_MSG_WARN(Cannot find 'gzip') ; fi

AC_SUBST(PROGS)
AC_SUBST(VERSION)
AC_SUBST(INITDIR)
AC_SUBST(NETWORK_MIP6_CONF)
AC_MSG_CHECKING(for lockdir)
for dir in $LOCKDIRS ; do
        if test -d $dir ; then
                LOCKDIR=$dir
                break
        fi
done
AC_MSG_RESULT($LOCKDIR)
AC_SUBST(LOCKDIR)

AC_PROG_MAKE_SET
AC_PROG_INSTALL

AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h malloc.h sys/ioctl.h sys/time.h syslog.h unistd.h)

AC_C_CONST
AC_HEADER_TIME
AC_STRUCT_TM

AC_CHECK_FUNCS(gettimeofday select socket strerror strstr strtoul)

CFLAGS="-Wall -O2"
CFLAGS="-I../libinet6/include $CFLAGS"
LIBS="-L../libinet6 -linet6 $LIBS"

AC_OUTPUT(Makefile mobile-ip6)
