1dnl $USAGI: configure.in,v 1.12 2003-07-16 09:49:01 yoshfuji Exp $
2
3dnl Copyright (C) 2002 USAGI/WIDE Project.
4dnl All rights reserved.
5dnl
6dnl Redistribution and use in source and binary forms, with or without
7dnl modification, are permitted provided that the following conditions
8dnl are met:
9dnl 1. Redistributions of source code must retain the above copyright
10dnl    notice, this list of conditions and the following disclaimer.
11dnl 2. Redistributions in binary form must reproduce the above copyright
12dnl    notice, this list of conditions and the following disclaimer in the
13dnl    documentation and/or other materials provided with the distribution.
14dnl 3. Neither the name of the project nor the names of its contributors
15dnl    may be used to endorse or promote products derived from this software
16dnl    without specific prior written permission.
17dnl
18dnl THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
19dnl ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21dnl ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
22dnl FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24dnl OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25dnl HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26dnl LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27dnl OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28dnl SUCH DAMAGE.
29
30AC_PREREQ(2.53)
31AC_INIT(ninfod.c)
32AC_CONFIG_HEADER(config.h)
33AC_PREFIX_DEFAULT(/usr/local/v6)
34
35AC_COPYRIGHT([Copyright (C)2002 USAGI/WIDE Project.  All Rights Reserved.])
36
37dnl Checks for programs.
38AC_PROG_CC
39AC_PROG_INSTALL
40INSTALL_LIB="\${INSTALL_DATA}"
41AC_SUBST(INSTALL_LIB)
42INSTALL_DIR="\${INSTALL} -d"
43AC_SUBST(INSTALL_DIR)
44
45dnl Checks for Enable/With
46AC_ARG_ENABLE(debug,
47[  --enable-debug          Enable debugging])
48if test x"$enableval" != x"no"; then
49  AC_DEFINE(ENABLE_DEBUG, 1,
50	    [Enable debugging])
51fi
52
53AC_ARG_ENABLE(threads,
54[  --disable-threads       Disable threads (and random delay)],,enable_threads=no)
55if test x"$enableval" != x"no"; then
56  AC_DEFINE(ENABLE_THREADS, 1,
57            [Enable threads])
58fi
59
60AC_ARG_ENABLE(suptypes,
61[  --enable-suptypes       Enable suptypes qtype (deprecated)])
62if test x"$enableval" != x"no"; then
63  AC_DEFINE(ENABLE_SUPTYPES, 1,
64	    [Enable suptypes (deprecated)])
65fi
66
67AC_ARG_ENABLE(suptypes,
68[  --enable-ttl            Enable ttl support for qtypes (deprecated)])
69if test x"$enableval" != x"no"; then
70  AC_DEFINE(ENABLE_SUPTYPES, 1,
71	    [Enable ttl support for qtypes (deprecated)])
72fi
73
74dnl Checks for libraries.
75
76dnl Checks for header files.
77AC_HEADER_STDC
78AC_HEADER_TIME
79AC_CHECK_HEADERS(limits.h)
80AC_CHECK_HEADERS(gnutls/openssl.h)
81AC_CHECK_HEADERS(openssl/md5.h)
82AC_CHECK_HEADERS(sys/uio.h)
83AC_CHECK_HEADERS(sys/utsname.h arpa/inet.h netdb.h syslog.h)
84AC_CHECK_HEADERS(sys/capability.h)
85AC_CHECK_HEADERS(pwd.h)
86AC_CHECK_HEADERS(netinet/in.h)
87AC_CHECK_HEADERS(netinet/ip6.h netinet/icmp6.h,,,[
88#if HAVE_SYS_TYPES_H
89# include <sys/types.h>
90#endif
91#if HAVE_NETINET_IN_H
92# include <netinet/in.h>
93#endif
94])
95AC_CHECK_HEADERS(linux/rtnetlink.h,,,[
96#include <asm/types.h>
97#include <sys/socket.h>
98])
99AC_CHECK_HEADERS(pthread.h)
100
101dnl Checks for typedefs, structures, and compiler characteristics.
102AC_C_BIGENDIAN
103AC_C_CONST
104AC_TYPE_SIZE_T
105
106AC_MSG_CHECKING([for struct icmp6_nodeinfo])
107AC_TRY_COMPILE([
108#include <sys/types.h>
109#include <netinet/in.h>
110#include <netinet/icmp6.h>
111],[
112struct icmp6_nodeinfo nodeinfo;
113],[
114	AC_MSG_RESULT([yes])
115	AC_DEFINE([HAVE_STRUCT_ICMP6_NODEINFO], 1,
116		  [Define to 1 if you have struct icmp6_nodeinfo])
117],[
118	AC_MSG_RESULT([no])
119])
120
121dnl Checks for library functions.
122AC_CHECK_FUNCS(nanosleep)
123AC_CHECK_LIB(pthread, pthread_create)
124AC_CHECK_LIB(cap, cap_init)
125
126AC_CHECK_LIB(gnutls-openssl, MD5_Init,
127	AC_DEFINE(HAVE_MD5_INIT)
128	LIBS="-lgnutls-openssl $LIBS",
129	AC_CHECK_LIB(crypto, MD5_Init,
130		AC_DEFINE(HAVE_MD5_INIT)
131		LIBS="-lcrypto $LIBS",
132	)
133)
134dnl AC_CHECK_LIB(crypto, MD5Init,
135dnl	AC_DEFINE(HAVE_MD5INIT)
136dnl	LIBS="-lcrypto $LIBS",
137dnl)
138
139dnl AC_SUBST(DEFS)
140
141AC_OUTPUT(Makefile ninfod.sh)
142