PageRenderTime 64ms CodeModel.GetById 29ms RepoModel.GetById 1ms app.codeStats 0ms

/release/src/router/dhcpv6/configure.in

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