dnl Process this file with autoconf to produce a configure script.
AC_INIT(nid.c)
AC_CONFIG_HEADER(config.h)

AC_PREFIX_DEFAULT(/usr/local/v6/sbin)

dnl Checks for options.
AC_ARG_ENABLE(daemon,
[ --enable-daemon          Enable daemonize],
        AC_DEFINE(ENABLE_DAEMON))
AC_ARG_ENABLE(ipv4mapped, 
[ --enable-ipv4mapped      Enable IPv4-mapped address support],
	AC_DEFINE(ENABLE_IPV4MAPPED))

dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL

dnl Checks for libraries.
AC_CHECK_LIB(crypto,MD5_Init)

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(netinet/in.h netinet/icmp6.h)
AC_CHECK_HEADERS(ssl/md5.h openssl/md5.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_MSG_CHECKING([whether you have struct icmp6_nodeinfo])
AC_EGREP_HEADER(netinet/icmp6.h,icmp6_nodeinfo,
	AC_DEFINE(HAVE_STRUCT_ICMP6_NODEINFO)
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no])
)
AC_MSG_CHECKING([whether you have sin6_scope_id in struct sockaddr_in6])
AC_EGREP_HEADER(netinet/in.h,sin6_scope_id,
	AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID)
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no])
)

dnl Checks for library functions.
AC_CHECK_FUNCS(socket uname)
AC_CHECK_FUNCS(getaddrinfo getnameinfo inet_ntop)

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

AC_OUTPUT(Makefile)
