Allow IPv6 address entry in tools>ping - Loosens valid character check
[tomato/davidwu.git] / release / src / router / dhcpv6 / configure.in
blob59dd84ef9382c42ee60a26b841f21698e3662b36
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(dhcp6c.c)
4 dnl Checks for programs.
5 AC_PROG_INSTALL
6 AC_PROG_MAKE_SET
7 AC_PROG_CC
8 AC_PROG_CPP
9 AC_PROG_YACC
10 AC_PROG_LEX
12 dnl Checks for libraries.
13 dnl AC_CHECK_LIB(c, kvm_open, [], [AC_CHECK_LIB(kvm, kvm_open)])
14 dnl AC_CHECK_LIB(mld, nlist)
16 dnl pcap library
17 dnl CFLAGS="-I. $CFLAGS"
18 dnl AC_MSG_CHECKING(for pcap library/header)
19 dnl for dir in /usr/local/libpcap /usr/local/v6 /usr/local \
20 dnl             ../libpcap* ../../libpcap*; do
21 dnl     ac_cv_pcap_lib=no
22 dnl     ac_cv_pcap_include=no
23 dnl     if test -d $dir -a -f $dir/libpcap.a; then
24 dnl             ac_cv_pcap_lib="$dir"
25 dnl     elif test -d $dir/lib -a -f $dir/lib/libpcap.a; then
26 dnl             ac_cv_pcap_lib="$dir/lib"
27 dnl     fi
28 dnl     if test -d $dir -a -f $dir/pcap.h; then
29 dnl             ac_cv_pcap_include="$dir"
30 dnl     elif test -d $dir/include -a -f $dir/include/pcap.h; then
31 dnl             ac_cv_pcap_include="$dir/include"
32 dnl     fi
33 dnl     if test "$ac_cv_pcap_lib" != "no" -a "$ac_cv_pcap_include" != "no"; then
34 dnl             LIBS="-L$ac_cv_pcap_lib $LIBS"
35 dnl             CFLAGS="-I$ac_cv_pcap_include $CFLAGS"
36 dnl             break
37 dnl     fi
38 dnl done
39 dnl if test "$ac_cv_pcap_lib" = "no" -a "$ac_cv_pcap_include" = "no"; then
40 dnl     AC_MSG_RESULT(no)
41 dnl else
42 dnl     AC_MSG_RESULT($ac_cv_pcap_lib and $ac_cv_pcap_include)
43 dnl fi
44 dnl AC_CHECK_LIB(pcap, pcap_lookupdev, [],
45 dnl     [echo "Fatal: libpcap.a not found"
46 dnl     exit 1])
47 dnl AC_TRY_COMPILE([#include <pcap.h>], [], [], [dnl
48 dnl     echo "Fatal: pcap.h not found"
49 dnl     exit 1])
51 CFLAGS="$CFLAGS -I\$(srcdir)"
53 dnl On Sun systems, we need to use the standards-compliant 3XNET functions
54 if test -x /usr/bin/sun && /usr/bin/sun; then
55         CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
56         LDFLAGS="-lxnet -ldevinfo -lnsl -lsocket -lrt"
59 AC_MSG_CHECKING(for sys/queue.h)
60 AC_TRY_COMPILE([#include <sys/queue.h>],
61         [TAILQ_HEAD(test, none);],
62         [AC_MSG_RESULT(yes)],
63         [AC_MSG_RESULT(no)
64         CFLAGS="$CFLAGS -I\$(srcdir)/missing"])
66 AC_EGREP_CPP(yes,
67 [#include <netinet/in.h>
68 #ifdef __KAME__
69  yes
70 #endif], [result=kame], [result=regular])
71 AC_MSG_CHECKING(for getaddrinfo/getnameinfo library)
72 AC_MSG_RESULT($result)
73 case $result in
74 kame)   AC_DEFINE(INET6)
75         o_LIBS="$LIBS"
76         LIBS="$LIBS -L/usr/local/v6/lib"
77         AC_CHECK_LIB(inet6, getaddrinfo, [], [LIBS="$o_LIBS"])
78         ;;
79 *)      ;;
80 esac
82 AC_REPLACE_FUNCS(getaddrinfo)
83 AC_REPLACE_FUNCS(getnameinfo)
84 AC_REPLACE_FUNCS(getifaddrs)
85 AC_CHECK_FUNCS(if_nametoindex)
86 AC_REPLACE_FUNCS(strlcpy strlcat)
87 AC_REPLACE_FUNCS(daemon)
88 AC_REPLACE_FUNCS(warnx)
90 dnl Checks for header files.
91 AC_HEADER_STDC
92 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h syslog.h unistd.h ifaddrs.h)
93 AC_MSG_CHECKING(for socklen_t)
94 AC_TRY_COMPILE([#include <sys/types.h>
95 #include <sys/socket.h>],
96         [socklen_t x;  x = 1; return x;],
97         [AC_MSG_RESULT(yes)],
98         [AC_MSG_RESULT(no)
99         AC_CHECK_TYPE(socklen_t, int)])
101 dnl Checks for typedefs, structures, and compiler characteristics.
102 AC_C_CONST
103 AC_TYPE_SIZE_T
104 AC_HEADER_TIME
105 AC_STRUCT_TM
106 AC_STRUCT_TIMEZONE
107 AC_CHECK_TYPES([sig_atomic_t], , [AC_DEFINE(sig_atomic_t, u_long)], [#include <sys/types.h>
108         #include <signal.h>])
111 dnl Checks for library functions.
112 AC_FUNC_GETPGRP
113 AC_PROG_GCC_TRADITIONAL
114 AC_FUNC_SETPGRP
115 AC_TYPE_SIGNAL
116 AC_CHECK_FUNCS(mktime select socket)
117 AC_CHECK_FUNCS(clock_gettime)
119 dnl configure local DB directory
120 AC_MSG_CHECKING(for local DB directory)
121 AC_ARG_WITH(localdbdir,
122 [  --with-localdbdir=VALUE where to put local DB files],
123     localdbdir="$withval", localdbdir="/var/db")
124 AC_MSG_RESULT($localdbdir)
125 AC_SUBST(localdbdir)
127 dnl Checks for arc4random
128 AC_REPLACE_FUNCS(arc4random)
130 AC_MSG_CHECKING(if --enable-pedant option is specified)
131 AC_ARG_ENABLE(pedant, [  --enable-pedant         pedantic compilation],
132         [if test "$enableval" = "yes"; then
133                 CFLAGS="-Wall -Werror $CFLAGS"
134         fi], [enableval=no])
135 AC_MSG_RESULT($enableval);
137 dnl Checks predeclared identifers of function names
138 AC_MSG_CHECKING(ANSI predeclared __func__)
139 AC_TRY_COMPILE([],
140 [void func(void) {printf("%s\n", __func__);}],
141         [AC_MSG_RESULT(yes)
142          pred_func_id=ansi],
143         [AC_MSG_RESULT(no)
144          pred_func_id=no])
145 if test $pred_func_id = no; then
146 AC_MSG_CHECKING(gcc predelcared __FUNCTION__)
147         AC_TRY_COMPILE([],
148         [void func(void) {printf("%s\n", __FUNCTION__);}],
149                 [AC_MSG_RESULT(yes)
150                  pred_func_id=gcc],
151                 [AC_MSG_RESULT(no)
152                  pred_func_id=no])
154 case $pred_func_id in
155         ansi)
156                 AC_DEFINE(HAVE_ANSI_FUNC)
157                 ;;
158         gcc)
159                 AC_DEFINE(HAVE_GCC_FUNCTION)
160                 ;;
161 esac
163 dnl DHCP option type values not officially defined
164 dnl (no such option now)
166 dnl Checks the existence of TAILQ_FOREACH_REVERSE
167 AC_MSG_CHECKING(checking the existence TAILQ_FOREACH_REVERSE)
168 AC_EGREP_CPP(yes,
169 [#include <sys/queue.h>
170  #ifdef TAILQ_FOREACH_REVERSE
171   yes
172 #endif], [result=yes], [result=no])
173 AC_MSG_RESULT($result)
174 case $result in
175 yes)    tailq_foreach=yes
176         ;;
177 *)      tailq_foreach=no
178         ;;
179 esac
181 dnl Checks the argument order of TAILQ_FOREACH_REVERSE if it exists
182 if test $tailq_foreach = yes ; then
183         AC_MSG_CHECKING(argument order of TAILQ_FOREACH_REVERSE)
184         AC_TRY_COMPILE([],
185         [
186         #include <stdio.h>
187         #include <sys/queue.h>
189         TAILQ_HEAD(tailhead, entry) head = TAILQ_HEAD_INITIALIZER(head);
190         struct entry {
191                 TAILQ_ENTRY(entry) entries;
192         } *p;
194         int i;
195         struct tailhead *headp;
197         TAILQ_FOREACH_REVERSE(p, headp, tailhead, entries) {
198         }
199         ],
200         [AC_MSG_RESULT(new)
201          AC_DEFINE(HAVE_TAILQ_FOREACH_REVERSE)],
202         [AC_MSG_RESULT(old)
203          AC_DEFINE(HAVE_TAILQ_FOREACH_REVERSE_OLD)]);
206 dnl Checks for other features
207 AC_MSG_CHECKING(if you have a length field in struct sockaddr*)
208 AC_CACHE_VAL(ts_cv_sa_len, [dnl
209  AC_TRY_COMPILE([
210  #include <sys/types.h>
211  #include <sys/socket.h>
212  ], [ 
213  struct sockaddr a;
214  a.sa_len = 1;
215  ], [ts_cv_sa_len="yes"], [ts_cv_sa_len="no"])])
216 AC_MSG_RESULT($ts_cv_sa_len);
217 if test "$ts_cv_sa_len" = yes; then
218         AC_DEFINE([HAVE_SA_LEN], 1, [Define to 1 if you have a length field in struct sockaddr])
221 dnl configure the ownership of the programs
222 AC_MSG_CHECKING(the owner of the programs)
223 AC_ARG_WITH(user,
224 [  --with-user=USER     set the owner of the programs],
225     user="$withval", user="bin")
226 AC_MSG_RESULT($user)
227 AC_SUBST(user)
229 dnl configure the group ownership of the programs
230 AC_MSG_CHECKING(the group owner of the programs)
231 AC_ARG_WITH(group,
232 [  --with-group=GROUP   set the group owner of the programs],
233     group="$withval", group="bin")
234 AC_MSG_RESULT($group)
235 AC_SUBST(group)
237 AC_CHECK_HEADERS(stdarg.h)
239 AC_OUTPUT(Makefile)