configure.in 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. AC_INIT(pptpmanager.c)
  2. AM_CONFIG_HEADER(config.h)
  3. AM_INIT_AUTOMAKE(pptpd,1.4.0)
  4. # check common command line options early
  5. AC_DEFINE(PPP_BINARY, "/usr/sbin/pppd")
  6. AC_MSG_CHECKING(command line for use of BSD PPP)
  7. AC_ARG_WITH(bsdppp,
  8. [ --with-bsdppp Use BSD user-space ppp ],
  9. [
  10. case "$withval" in
  11. yes)
  12. AC_MSG_RESULT(BSD user-space ppp)
  13. AC_DEFINE(BSDUSER_PPP)
  14. BSDUSER_PPP=$with_bsdppp
  15. AC_DEFINE(PPP_BINARY, "/usr/sbin/ppp")
  16. break;
  17. ;;
  18. no)
  19. AC_MSG_RESULT(explicit standard pppd)
  20. ;;
  21. *)
  22. # only yes or no are expected for this option
  23. AC_MSG_RESULT(unrecognised... terminating)
  24. exit 1
  25. ;;
  26. esac
  27. ], [AC_MSG_RESULT(default standard pppd)])
  28. AC_MSG_CHECKING(command line for use of SLIRP)
  29. AC_ARG_WITH(slirp,
  30. [ --with-slirp Use SLIRP instead of pppd ],
  31. [
  32. case "$withval" in
  33. yes)
  34. AC_MSG_RESULT(yes)
  35. AC_DEFINE(SLIRP)
  36. SLIRP=$with_slirp
  37. AC_DEFINE(PPP_BINARY, "/bin/slirp")
  38. break;
  39. ;;
  40. no)
  41. AC_MSG_RESULT(explicit no)
  42. ;;
  43. *)
  44. # only yes or no are expected for this option
  45. AC_MSG_RESULT(unrecognised... terminating)
  46. exit 1
  47. ;;
  48. esac
  49. ], [AC_MSG_RESULT(default no)])
  50. AC_MSG_CHECKING(command line for syslog facility name)
  51. AC_ARG_ENABLE(facility,
  52. [ --enable-facility=name Use another syslog facility, default LOG_DAEMON ],
  53. [
  54. AC_MSG_RESULT($enableval)
  55. AC_DEFINE_UNQUOTED(PPTP_FACILITY, $enableval)
  56. ],
  57. [
  58. AC_MSG_RESULT(default LOG_DAEMON)
  59. AC_DEFINE_UNQUOTED(PPTP_FACILITY, LOG_DAEMON)
  60. ])
  61. AC_MSG_CHECKING(command line for bcrelay build)
  62. AC_ARG_ENABLE(bcrelay,
  63. [ --enable-bcrelay Enable broadcast relay function ],
  64. [
  65. case "$enableval" in
  66. yes)
  67. AC_MSG_RESULT(yes)
  68. AC_DEFINE(BCRELAY)
  69. BCRELAY=$enableval
  70. break;
  71. ;;
  72. no)
  73. AC_MSG_RESULT(explicit no)
  74. ;;
  75. *)
  76. # only yes or no are expected for this option
  77. AC_MSG_RESULT(unrecognised... terminating)
  78. exit 1
  79. ;;
  80. esac
  81. ], [AC_MSG_RESULT(default no)])
  82. AC_MSG_CHECKING(command line for VRF build)
  83. AC_ARG_ENABLE(vrf,
  84. [ --enable-vrf Enable support for VRFs],
  85. [
  86. case "$enableval" in
  87. yes)
  88. AC_MSG_RESULT(yes)
  89. VRF=$enableval
  90. ;;
  91. no)
  92. AC_MSG_RESULT(explicit no)
  93. ;;
  94. *)
  95. AC_MSG_RESULT(unrecognised... terminating)
  96. exit 1
  97. ;;
  98. esac
  99. ], [AC_MSG_RESULT(default no)])
  100. AC_PROG_CC
  101. AC_PROG_RANLIB
  102. AC_PROG_INSTALL
  103. AC_PROG_LN_S
  104. AC_PROG_MAKE_SET
  105. AC_C_CONST
  106. AC_C_INLINE
  107. AC_EXEEXT
  108. AC_OBJEXT
  109. AC_SYS_INTERPRETER
  110. AC_CHECK_FUNCS(setsid daemon setproctitle getservbyname strlcpy fork memmove strerror writev)
  111. AC_CHECK_HEADERS(pty.h)
  112. AC_CHECK_HEADERS(string.h)
  113. AC_CHECK_HEADERS(syslog.h)
  114. AC_CHECK_HEADERS(libintl.h)
  115. AC_CHECK_HEADERS(libutil.h)
  116. AC_CHECK_HEADERS(sys/uio.h)
  117. AC_CHECK_TYPE(size_t, unsigned int)
  118. AC_CHECK_TYPE(ssize_t, int)
  119. AC_CHECK_TYPE(u_int8_t, unsigned char)
  120. AC_CHECK_TYPE(u_int16_t, unsigned short)
  121. AC_CHECK_TYPE(u_int32_t, unsigned int)
  122. dnl Check for type in sys/socket.h - from Squid source (GPL)
  123. AC_CACHE_CHECK(for socklen_t, ac_cv_type_socklen_t, [
  124. AC_EGREP_CPP([socklen_t[^a-zA-Z_0-9]], [#include <sys/types.h>
  125. #include <sys/socket.h>
  126. #if STDC_HEADERS
  127. #include <stdlib.h>
  128. #include <stddef.h>
  129. #endif],
  130. ac_cv_type_socklen_t=yes,
  131. ac_cv_type_socklen_t=no)
  132. ])
  133. if test $ac_cv_type_socklen_t = no; then
  134. AC_DEFINE(socklen_t, int)
  135. fi
  136. dnl Check for libwrap (black magic check)
  137. AC_ARG_WITH(libwrap,
  138. [ --with-libwrap Use libwrap (tcp wrappers) ],
  139. [
  140. if test "$with_libwrap" = "yes"; then
  141. XYZZY_LIBS="$LIBS"
  142. AC_MSG_CHECKING(for libwrap alone)
  143. LIBS="$XYZZY_LIBS -lwrap"
  144. AC_TRY_LINK([ int allow_severity, deny_severity; ],
  145. [ hosts_access(); ],
  146. [ AC_MSG_RESULT(yes)
  147. AC_DEFINE(HAVE_LIBWRAP)
  148. LIBWRAP="yes"
  149. XTRALIBS_MGR="-lwrap" ],
  150. [ AC_MSG_RESULT(no)
  151. LIBS="$XYZZY_LIBS -lwrap -lnsl"
  152. AC_MSG_CHECKING(for libwrap with libnsl)
  153. AC_TRY_LINK([ int allow_severity, deny_severity; ],
  154. [ hosts_access(); ],
  155. [ AC_MSG_RESULT(yes)
  156. AC_DEFINE(HAVE_LIBWRAP)
  157. LIBWRAP="yes"
  158. XTRALIBS_MGR="-lwrap -lnsl" ],
  159. [ AC_MSG_RESULT(no) ])
  160. ])
  161. LIBS="$XYZZY_LIBS"
  162. fi
  163. ])
  164. dnl More ugliness; -lnsl, -lutil and -lsocket
  165. XYZZY_LIBS="$LIBS"
  166. AC_CHECK_LIB(c, accept)
  167. AC_CHECK_LIB(c, gethostbyname)
  168. AC_CHECK_LIB(c, openpty)
  169. AC_CHECK_LIB(c, gettext)
  170. AC_CHECK_LIB(socket, accept)
  171. AC_CHECK_LIB(nsl, gethostbyname)
  172. AC_CHECK_LIB(util, openpty)
  173. AC_CHECK_LIB(intl, gettext)
  174. LIBS="$XYZZY_LIBS"
  175. if test "$ac_cv_lib_c_accept" = no; then
  176. if test "$ac_cv_lib_socket_accept" = yes; then
  177. LIBS="$LIBS -lsocket"
  178. else
  179. echo "Couldn't find a usable accept!" 1>&2
  180. exit 1
  181. fi
  182. fi
  183. if test "$ac_cv_lib_c_gethostbyname" = no; then
  184. if test "$ac_cv_lib_nsl_gethostbyname" = yes; then
  185. LIBS="$LIBS -lnsl"
  186. if test "$XTRALIBS_MGR" = "-lwrap -lnsl"; then
  187. XTRALIBS_MGR="-lwrap"
  188. fi
  189. else
  190. echo "Couldn't find a usable gethostbyname!" 1>&2
  191. exit 1
  192. fi
  193. fi
  194. if test "$ac_cv_lib_c_openpty" = yes; then
  195. AC_DEFINE(HAVE_OPENPTY)
  196. else
  197. if test "$ac_cv_lib_util_openpty" = yes; then
  198. AC_DEFINE(HAVE_OPENPTY)
  199. XTRALIBS_CTRL="-lutil"
  200. fi
  201. fi
  202. if test "$ac_cv_header_libintl_h" = yes; then
  203. if test "$ac_cv_lib_c_gettext" = no; then
  204. if test "$ac_cv_lib_intl_gettext" = yes; then
  205. XTRALIBS_MGR = "$XTRALIBS_MGR -lintl"
  206. else
  207. echo "Have libintl.h but no usable gettext!" 1>&2
  208. exit 1
  209. fi
  210. fi
  211. fi
  212. if test "$BCRELAY" = "yes"; then
  213. if test "$BCRELAY" = "yes"; then
  214. XTRA_PROG="bcrelay"
  215. true
  216. else
  217. echo "No BCrelay selected." 1>&2
  218. fi
  219. fi
  220. if test "$VRF" = "yes"; then
  221. AC_CHECKING([for vrf Library and Header files])
  222. AC_CHECK_HEADER(vrf.h, ,
  223. AC_MSG_ERROR([vrf headers were not found])
  224. )
  225. AC_CHECK_LIB(vrf, vrf_socket, [
  226. AC_DEFINE(VRF, 1, [Use vrf_socket from vrf library])
  227. XTRALIBS_CTRL="$XTRALIBS_CTRL -lvrf"
  228. XTRALIBS_MGR="$XTRALIBS_MGR -lvrf"
  229. ], [
  230. AC_MSG_ERROR(vrf library was not found)
  231. ])
  232. fi
  233. AC_SUBST(XTRALIBS_CTRL)
  234. AC_SUBST(XTRALIBS_MGR)
  235. AC_SUBST(XTRA_PROG)
  236. AC_SUBST(HAVE_OPENPTY)
  237. echo '==============================================================================='
  238. echo 'Configuration chosen:'
  239. echo -n ' PPPd: '
  240. if test "$BSDUSER_PPP" = "yes"; then
  241. echo 'BSD user-space PPPd.'
  242. else
  243. if test "$SLIRP" = "yes"; then
  244. echo 'SLIRP.'
  245. else
  246. echo 'Standard.'
  247. fi
  248. fi
  249. echo -n ' LIBWRAP security: '
  250. if test "$LIBWRAP" = "yes"; then
  251. echo 'Yes.'
  252. else
  253. echo 'No.'
  254. fi
  255. echo -n ' Broadcast Relay: '
  256. if test "$BCRELAY" = "yes"; then
  257. echo 'Yes.'
  258. else
  259. echo 'No.'
  260. fi
  261. echo -n ' VRF support: '
  262. if test "$VRF" = "yes"; then
  263. echo 'Yes.'
  264. else
  265. echo 'No.'
  266. fi
  267. AC_CACHE_SAVE
  268. AC_OUTPUT(Makefile)