Blob Blame History Raw
dnl @(#) $Header: /usr/src/local/sbin/arpwatch/RCS/configure.in,v 1.35 2006/06/21 20:34:27 leres Exp $ (LBL)
dnl
dnl Copyright (c) 1994, 1995, 1996, 1997, 1998, 2000, 2006
dnl	The Regents of the University of California.  All rights reserved.
dnl
dnl Process this file with autoconf to produce a configure script.
dnl

AC_INIT(arpwatch.c)

AC_CANONICAL_SYSTEM

umask 002

if test -z "$PWD" ; then
	PWD=`pwd`
fi

AC_LBL_C_INIT(V_CCOPT, V_INCLS)

AC_CHECK_HEADERS(fcntl.h memory.h)
AC_HEADER_TIME

AC_REPLACE_FUNCS(bcopy strerror)

dnl The following generates a warning from autoconf...
AC_C_BIGENDIAN

AC_LBL_TYPE_SIGNAL
AC_LBL_UNION_WAIT

AC_CHECK_LIB(resolv, res_query)
AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)

AC_PATH_PROG(V_SENDMAIL, sendmail, /usr/lib/sendmail,
    $PATH:/usr/sbin:/usr/lib:/usr/bin:/usr/ucblib:/usr/local/etc)

case "$target_os" in

linux*)
	V_INCLS="$V_INCLS -Ilinux-include"
	;;

osf3*)
	# workaround around ip_hl vs. ip_vhl problem in netinet/ip.h
	AC_DEFINE(__STDC__,2)
	;;
esac

AC_LBL_CHECK_TYPE

AC_LBL_DEVEL(V_CCOPT)

AC_MSG_CHECKING(if ether_header uses ether_addr structs)
AC_CACHE_VAL(ac_cv_ether_header_has_ea,
    LBL_SAVE_CFLAGS="$CFLAGS"
    CFLAGS="$CFLAGS $V_INCLS"
    AC_TRY_COMPILE([
#	include <sys/types.h>
#	if __STDC__
	/* osf3 has REALLY good prototyes */
	struct mbuf;
	struct rtentry;
#	endif
#	include <sys/socket.h>
#	include <net/if.h>
#	include <netinet/in.h>
#	include <netinet/if_ether.h>],
	[u_int i =
	    sizeof(((struct ether_header *)0)->ether_dhost.ether_addr_octet)],
	ac_cv_ether_header_has_ea=yes,
	ac_cv_ether_header_has_ea=no)
    CFLAGS="$LBL_SAVE_CFLAGS")
AC_MSG_RESULT($ac_cv_ether_header_has_ea)
if test $ac_cv_ether_header_has_ea = yes ; then
	AC_DEFINE(ETHER_HEADER_HAS_EA)
fi

AC_MSG_CHECKING(if ether_arp uses ether_addr structs)
AC_CACHE_VAL(ac_cv_ether_arp_has_ea,
    LBL_SAVE_CFLAGS="$CFLAGS"
    CFLAGS="$CFLAGS $V_INCLS"
    AC_TRY_COMPILE([
#	include <sys/types.h>
#	if __STDC__
	/* osf3 has REALLY good prototyes */
	struct mbuf;
	struct rtentry;
#	endif
#	include <sys/socket.h>
#	include <net/if.h>
#	include <netinet/in.h>
#	include <netinet/if_ether.h>],
	[u_int i =
	    sizeof(((struct ether_arp *)0)->arp_sha.ether_addr_octet)],
	ac_cv_ether_arp_has_ea=yes,
	ac_cv_ether_arp_has_ea=no)
    CFLAGS="$LBL_SAVE_CFLAGS")
AC_MSG_RESULT($ac_cv_ether_arp_has_ea)
if test $ac_cv_ether_arp_has_ea = yes ; then
	AC_DEFINE(ETHER_ARP_HAS_EA)
fi

AC_MSG_CHECKING(if ether_arp uses erp_xsha member)
AC_CACHE_VAL(ac_cv_struct_ether_arp_x,
    LBL_SAVE_CFLAGS="$CFLAGS"
    CFLAGS="$CFLAGS $V_INCLS"
    AC_TRY_COMPILE([
#	include <sys/types.h>
#	include <sys/socket.h>
#	if __STDC__
	/* osf3 has REALLY good prototyes */
	struct mbuf;
	struct rtentry;
#	endif
#	include <net/if.h>
#	include <netinet/in.h>
#	include <netinet/if_ether.h>],
	[u_int i = sizeof( ((struct ether_arp *)0)->arp_xsha)],
	ac_cv_struct_ether_arp_x=yes,
	ac_cv_struct_ether_arp_x=no)
    CFLAGS="$LBL_SAVE_CFLAGS")
AC_MSG_RESULT($ac_cv_struct_ether_arp_x)
if test $ac_cv_struct_ether_arp_x = yes ; then
	AC_DEFINE(ETHER_ARP_HAS_X)
fi

dnl
dnl bind 8 does some routine name renaming so we must test specially
dnl
AC_MSG_CHECKING(for dn_skipname)
AC_CACHE_VAL(ac_cv_have_dn_skipname,
    AC_TRY_LINK([
#	include <sys/types.h>
#	include <netinet/in.h>
#	include <arpa/nameser.h>
#	include <resolv.h>],
	[(void)dn_skipname(0, 0);],
	ac_cv_have_dn_skipname=yes,
	ac_cv_have_dn_skipname=no))
AC_MSG_RESULT($ac_cv_have_dn_skipname)
if test $ac_cv_have_dn_skipname = yes ; then
	AC_DEFINE(HAVE_DN_SKIPNAME)
fi

if test -f .devel ; then
	AC_DEFINE(LBL)
fi

if test -r lbl/gnuc.h ; then
	rm -f gnuc.h
	ln -s lbl/gnuc.h gnuc.h
fi

if test ! -r addresses.h ; then
	cp addresses.h.in addresses.h
fi

AC_SUBST(V_CCOPT)
AC_SUBST(V_INCLS)
AC_SUBST(V_PCAPDEP)
AC_SUBST(V_SENDMAIL)
AC_SUBST(LBL_LIBS)

AC_PROG_INSTALL

AC_OUTPUT(Makefile)

if test ! -f arp.dat ; then
	echo 'creating empty arp.dat file'
	touch arp.dat
fi

if test -f .devel ; then
	make depend
fi
exit 0