configure.ac 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. AC_PREREQ([2.59])
  4. AC_INIT(bind10-devel, 20120405, bind10-dev@isc.org)
  5. AC_CONFIG_SRCDIR(README)
  6. AM_INIT_AUTOMAKE
  7. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])dnl be backward compatible
  8. AC_CONFIG_HEADERS([config.h])
  9. # Checks for programs.
  10. AC_PROG_CXX
  11. # Libtool configuration
  12. #
  13. # libtool cannot handle spaces in paths, so exit early if there is one
  14. if [ test `echo $PWD | grep -c ' '` != "0" ]; then
  15. AC_MSG_ERROR([BIND 10 cannot be built in a directory that contains spaces, because of libtool limitations. Please change the directory name, or use a symbolic link that does not contain spaces.])
  16. fi
  17. # On FreeBSD (and probably some others), clang++ does not meet an autoconf
  18. # assumption in identifying libtool configuration regarding shared library:
  19. # the configure script will execute "$CC -shared $CFLAGS/$CXXFLAGS -v" and
  20. # expect the output contains -Lxxx or -Ryyy. This is the case for g++, but
  21. # not for clang++, and, as a result, it will cause various errors in linking
  22. # programs or running them with a shared object (such as some of our python
  23. # scripts).
  24. # To work around this problem we define a temporary variable
  25. # "CXX_LIBTOOL_LDFLAGS". It's expected to be defined as, e.g, "-L/usr/lib"
  26. # to temporarily fake the output so that it will be compatible with that of
  27. # g++.
  28. CFLAGS_SAVED=$CFLAGS
  29. CXXFLAGS_SAVED=$CXXFLAGS
  30. CFLAGS="$CFLAGS $CXX_LIBTOOL_LDFLAGS"
  31. CXXFLAGS="$CXXFLAGS $CXX_LIBTOOL_LDFLAGS"
  32. AC_PROG_LIBTOOL
  33. CFLAGS=$CFLAGS_SAVED
  34. CXXFLAGS=$CXXFLAGS_SAVED
  35. # Use C++ language
  36. AC_LANG([C++])
  37. # Identify the compiler: this check must be after AC_PROG_CXX and AC_LANG.
  38. AM_CONDITIONAL(USE_GXX, test "X${GXX}" = "Xyes")
  39. AC_CHECK_DECL([__SUNPRO_CC], [SUNCXX="yes"], [SUNCXX="no"])
  40. AC_CHECK_DECL([__clang__], [CLANGPP="yes"], [CLANGPP="no"])
  41. AM_CONDITIONAL(USE_CLANGPP, test "X${CLANGPP}" = "Xyes")
  42. # Linker options
  43. # check -R and -Wl,-R rather than gcc specific -rpath to be as portable
  44. # as possible.
  45. AC_MSG_CHECKING([whether -R flag is available in linker])
  46. LDFLAGS_SAVED="$LDFLAGS"
  47. LDFLAGS="$LDFLAGS -R/usr/lib"
  48. AC_TRY_LINK([],[],
  49. [ AC_MSG_RESULT(yes)
  50. rpath_flag=-R
  51. ],[ AC_MSG_RESULT(no)
  52. AC_MSG_CHECKING([whether -Wl,-R flag is available in linker])
  53. LDFLAGS="$LDFLAGS_SAVED -Wl,-R"
  54. AC_TRY_LINK([], [],
  55. [ AC_MSG_RESULT(yes)
  56. rpath_flag=-Wl,-R
  57. ],[ AC_MSG_RESULT(no)
  58. rpath_flag=no
  59. ])
  60. ])
  61. LDFLAGS=$LDFLAGS_SAVED
  62. # allow building programs with static link. we need to make it selective
  63. # because loadable modules cannot be statically linked.
  64. AC_ARG_ENABLE([static-link],
  65. AC_HELP_STRING([--enable-static-link],
  66. [build programs with static link [[default=no]]]),
  67. [enable_static_link=yes], [enable_static_link=no])
  68. AM_CONDITIONAL(USE_STATIC_LINK, test $enable_static_link = yes)
  69. # Check validity about some libtool options
  70. if test $enable_static_link = yes -a $enable_static = no; then
  71. AC_MSG_ERROR([--enable-static-link requires --enable-static])
  72. fi
  73. if test $enable_shared = no; then
  74. AC_MSG_ERROR([BIND 10 requires shared libraries to be built])
  75. fi
  76. # allow configuring without setproctitle.
  77. AC_ARG_ENABLE(setproctitle-check,
  78. AC_HELP_STRING([--disable-setproctitle-check],
  79. [do not check for python setproctitle module (used to give nice names to python processes)]),
  80. setproctitle_check=$enableval, setproctitle_check=yes)
  81. # OS dependent configuration
  82. SET_ENV_LIBRARY_PATH=no
  83. ENV_LIBRARY_PATH=LD_LIBRARY_PATH
  84. case "$host" in
  85. *-solaris*)
  86. # Solaris requires special definitions to get some standard libraries
  87. # (e.g. getopt(3)) available with common used header files.
  88. CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
  89. # "now" binding is necessary to prevent deadlocks in C++ static initialization code
  90. LDFLAGS="$LDFLAGS -z now"
  91. ;;
  92. *-apple-darwin*)
  93. # Starting with OSX 10.7 (Lion) we must choose which IPv6 API to use
  94. # (RFC2292 or RFC3542).
  95. CPPFLAGS="$CPPFLAGS -D__APPLE_USE_RFC_3542"
  96. # libtool doesn't work perfectly with Darwin: libtool embeds the
  97. # final install path in dynamic libraries and our loadable python
  98. # modules always refer to that path even if it's loaded within the
  99. # source tree. This prevents pre-install tests from working.
  100. # To work around this problem we explicitly specify paths to dynamic
  101. # libraries when we use them in the source tree.
  102. SET_ENV_LIBRARY_PATH=yes
  103. ENV_LIBRARY_PATH=DYLD_LIBRARY_PATH
  104. ;;
  105. *-freebsd*)
  106. SET_ENV_LIBRARY_PATH=yes
  107. ;;
  108. *-netbsd*)
  109. SET_ENV_LIBRARY_PATH=yes
  110. ;;
  111. *-openbsd*)
  112. SET_ENV_LIBRARY_PATH=yes
  113. ;;
  114. esac
  115. AM_CONDITIONAL(SET_ENV_LIBRARY_PATH, test $SET_ENV_LIBRARY_PATH = yes)
  116. AC_SUBST(SET_ENV_LIBRARY_PATH)
  117. AC_SUBST(ENV_LIBRARY_PATH)
  118. m4_define([_AM_PYTHON_INTERPRETER_LIST], [python python3 python3.1 python3.2])
  119. AC_ARG_WITH([pythonpath],
  120. AC_HELP_STRING([--with-pythonpath=PATH],
  121. [specify an absolute path to python executable when automatic version check (incorrectly) fails]),
  122. [python_path="$withval"], [python_path="auto"])
  123. if test "$python_path" = auto; then
  124. AM_PATH_PYTHON([3.1])
  125. else
  126. # Older versions of automake can't handle python3 well. This is an
  127. # in-house workaround for them.
  128. PYTHON=$python_path
  129. AC_SUBST(PYTHON)
  130. PYTHON_PREFIX='${prefix}'
  131. AC_SUBST(PYTHON_PREFIX)
  132. PYTHON_EXEC_PREFIX='$(exec_prefix)'
  133. AC_SUBST(PYTHON_EXEC_PREFIX)
  134. PYTHON_VERSION=[`$PYTHON -c "import sys; sys.stdout.write(sys.version[:3])"`]
  135. if test `echo "$PYTHON_VERSION >= 3.1" | bc` != 1 ; then
  136. AC_MSG_ERROR(["Python version too old: $PYTHON_VERSION, need 3.1 or higher"])
  137. fi
  138. AC_SUBST(PYTHON_VERSION)
  139. PYTHON_PLATFORM=`$PYTHON -c "import sys; print(sys.platform)"`
  140. AC_SUBST(PYTHON_PLATFORM)
  141. pythondir='${prefix}/lib/python'$PYTHON_VERSION'/site-packages'
  142. AC_SUBST(pythondir)
  143. pkgpythondir='${pythondir}/'$PACKAGE
  144. AC_SUBST(pkgpythondir)
  145. pyexecdir='${exec_prefix}/lib/python'$PYTHON_VERSION'/site-packages'
  146. AC_SUBST(pyexecdir)
  147. pkgpyexecdir='${pyexecdir}/'$PACKAGE
  148. AC_SUBST(pkgpyexecdir)
  149. fi
  150. # We need to store the default pyexecdir in a separate variable so that
  151. # we can specify in Makefile.am the install directory of various BIND 10
  152. # python scripts and loadable modules; in Makefile.am we cannot replace
  153. # $(pyexecdir) using itself, e.g, this doesn't work:
  154. # pyexecdir = $(pyexecdir)/isc/some_module
  155. # The separate variable makes this setup possible as follows:
  156. # pyexecdir = $(PYTHON_SITEPKG_DIR)/isc/some_module
  157. PYTHON_SITEPKG_DIR=${pyexecdir}
  158. AC_SUBST(PYTHON_SITEPKG_DIR)
  159. # This will be commonly used in various Makefile.am's that need to generate
  160. # python log messages.
  161. PYTHON_LOGMSGPKG_DIR="\$(top_builddir)/src/lib/python/isc/log_messages"
  162. AC_SUBST(PYTHON_LOGMSGPKG_DIR)
  163. # This is python package paths commonly used in python tests. See
  164. # README of log_messages for why it's included.
  165. COMMON_PYTHON_PATH="\$(abs_top_builddir)/src/lib/python/isc/log_messages:\$(abs_top_srcdir)/src/lib/python:\$(abs_top_builddir)/src/lib/python"
  166. AC_SUBST(COMMON_PYTHON_PATH)
  167. # Check for python development environments
  168. if test -x ${PYTHON}-config; then
  169. PYTHON_INCLUDES=`${PYTHON}-config --includes`
  170. for flag in `${PYTHON}-config --ldflags`; do
  171. # add any '-L..." flags to PYTHON_LDFLAGS
  172. flag=`echo $flag | sed -ne 's/^\(\-L.*\)$/\1/p'`
  173. if test "X${flag}" != X; then
  174. PYTHON_LDFLAGS="$PYTHON_LDFLAGS ${flag}"
  175. fi
  176. done
  177. # on some platforms, ${PYTHON}-config --ldflags doesn't provide a -L
  178. # option while having the library under a non trivial directory.
  179. # as a workaround we try the "lib" sub directory under the common
  180. # prefix for this python.
  181. if test -z "${PYTHON_LDFLAGS}"; then
  182. PYTHON_LDFLAGS="-L`${PYTHON}-config --prefix`/lib"
  183. fi
  184. else
  185. if test "X$PYTHON_INCLUDES" = X -o "X$PYTHON_LDFLAGS" = X; then
  186. AC_MSG_WARN([${PYTHON}-config does not exist or is not executable, so we could not detect python development environment. Your system may require an additional package (e.g. "python3-dev"). Alternatively, if you are sure you have python headers and libraries, define PYTHON_INCLUDES and PYTHON_LDFLAGS and run this script.])
  187. fi
  188. fi
  189. # Some OSes including NetBSD don't install libpython.so in a well known path.
  190. # To avoid requiring dynamic library path with our python wrapper loadable
  191. # modules, we embed the path to the modules when possible. We do this even
  192. # when the path is known in the common operational environment (e.g. when
  193. # it's stored in a common "hint" file) for simplicity.
  194. if test $rpath_flag != no; then
  195. python_rpath=
  196. for flag in ${PYTHON_LDFLAGS}; do
  197. python_rpath="${python_rpath} `echo $flag | sed -ne "s/^\(\-L\)/${rpath_flag}/p"`"
  198. done
  199. PYTHON_LDFLAGS="${PYTHON_LDFLAGS} ${python_rpath}"
  200. fi
  201. AC_SUBST(PYTHON_INCLUDES)
  202. AC_SUBST(PYTHON_LDFLAGS)
  203. CPPFLAGS_SAVED="$CPPFLAGS"
  204. CPPFLAGS="$CPPFLAGS ${PYTHON_INCLUDES}"
  205. AC_CHECK_HEADERS([Python.h],, AC_MSG_ERROR([Missing Python.h]))
  206. CPPFLAGS="$CPPFLAGS_SAVED"
  207. # Check for python library. Needed for Python-wrapper libraries.
  208. LDFLAGS_SAVED="$LDFLAGS"
  209. LDFLAGS="$LDFLAGS $PYTHON_LDFLAGS"
  210. python_bin="python${PYTHON_VERSION}"
  211. AC_CHECK_LIB($python_bin, main, python_lib=$python_bin, python_lib=no)
  212. if test $python_lib != "no"; then
  213. PYTHON_LIB="-l$python_lib"
  214. fi
  215. AC_SUBST(PYTHON_LIB)
  216. LDFLAGS=$LDFLAGS_SAVED
  217. # Check for the setproctitle module
  218. if test "$setproctitle_check" = "yes" ; then
  219. AC_MSG_CHECKING(for setproctitle module)
  220. if "$PYTHON" -c 'import setproctitle' 2>/dev/null ; then
  221. AC_MSG_RESULT(ok)
  222. else
  223. AC_MSG_RESULT(missing)
  224. AC_MSG_WARN([Missing setproctitle python module.
  225. Use --disable-setproctitle-check to skip this check.
  226. In this case we will continue, but naming of python processes will not work.])
  227. fi
  228. fi
  229. # TODO: check for _sqlite3.py module
  230. # Compiler dependent settings: define some mandatory CXXFLAGS here.
  231. # We also use a separate variable B10_CXXFLAGS. This will (and should) be
  232. # used as the default value for each specific AM_CXXFLAGS:
  233. # AM_CXXFLAGS = $(B10_CXXFLAGS)
  234. # AM_CXXFLAGS += ... # add module specific flags
  235. # We need this so that we can disable some specific compiler warnings per
  236. # module basis; since AM_CXXFLAGS are placed before CXXFLAGS, and since
  237. # gcc's -Wno-XXX option must be specified after -Wall or -Wextra, we cannot
  238. # specify the default warning flags in CXXFLAGS and let specific modules
  239. # "override" the default.
  240. # This may be used to try linker flags.
  241. AC_DEFUN([BIND10_CXX_TRY_FLAG], [
  242. AC_MSG_CHECKING([whether $CXX supports $1])
  243. bind10_save_CXXFLAGS="$CXXFLAGS"
  244. CXXFLAGS="$CXXFLAGS $1"
  245. AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void){ return 0;}])],
  246. [bind10_cxx_flag=yes], [bind10_cxx_flag=no])
  247. CXXFLAGS="$bind10_save_CXXFLAGS"
  248. if test "x$bind10_cxx_flag" = "xyes"; then
  249. ifelse([$2], , :, [$2])
  250. else
  251. ifelse([$3], , :, [$3])
  252. fi
  253. AC_MSG_RESULT([$bind10_cxx_flag])
  254. ])
  255. # SunStudio compiler requires special compiler options for boost
  256. # (http://blogs.sun.com/sga/entry/boost_mini_howto)
  257. if test "$SUNCXX" = "yes"; then
  258. CXXFLAGS="$CXXFLAGS -library=stlport4 -features=tmplife -features=tmplrefstatic"
  259. MULTITHREADING_FLAG="-mt"
  260. fi
  261. BIND10_CXX_TRY_FLAG([-Wno-missing-field-initializers],
  262. [WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG="-Wno-missing-field-initializers"])
  263. AC_SUBST(WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG)
  264. # gcc specific settings:
  265. if test "X$GXX" = "Xyes"; then
  266. B10_CXXFLAGS="-Wall -Wextra -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare"
  267. case "$host" in
  268. *-solaris*)
  269. MULTITHREADING_FLAG=-pthreads
  270. # In Solaris, IN6ADDR_ANY_INIT and IN6ADDR_LOOPBACK_INIT need -Wno-missing-braces
  271. B10_CXXFLAGS="$B10_CXXFLAGS -Wno-missing-braces"
  272. ;;
  273. *)
  274. MULTITHREADING_FLAG=-pthread
  275. ;;
  276. esac
  277. # Don't use -Werror if configured not to
  278. AC_ARG_WITH(werror,
  279. AC_HELP_STRING([--with-werror], [Compile using -Werror (default=yes)]),
  280. [
  281. case "${withval}" in
  282. yes) with_werror=1 ;;
  283. no) with_werror=0 ;;
  284. *) AC_MSG_ERROR(bad value ${withval} for --with-werror) ;;
  285. esac],
  286. [with_werror=1])
  287. werror_ok=0
  288. # Certain versions of gcc (g++) have a bug that incorrectly warns about
  289. # the use of anonymous name spaces even if they're closed in a single
  290. # translation unit. For these versions we have to disable -Werror.
  291. if test $with_werror = 1; then
  292. CXXFLAGS_SAVED="$CXXFLAGS"
  293. CXXFLAGS="$CXXFLAGS $B10_CXXFLAGS -Werror"
  294. AC_MSG_CHECKING(for in-TU anonymous namespace breakage)
  295. AC_TRY_COMPILE([namespace { class Foo {}; }
  296. namespace isc {class Bar {Foo foo_;};} ],,
  297. [AC_MSG_RESULT(no)
  298. werror_ok=1
  299. B10_CXXFLAGS="$B10_CXXFLAGS -Werror"],
  300. [AC_MSG_RESULT(yes)])
  301. CXXFLAGS="$CXXFLAGS_SAVED"
  302. fi
  303. # Python 3.2 has an unused parameter in one of its headers. This
  304. # has been reported, but not fixed as of yet, so we check if we need
  305. # to set -Wno-unused-parameter.
  306. if test $werror_ok = 1; then
  307. CPPFLAGS_SAVED="$CPPFLAGS"
  308. CPPFLAGS=${PYTHON_INCLUDES}
  309. CXXFLAGS_SAVED="$CXXFLAGS"
  310. CXXFLAGS="$CXXFLAGS $B10_CXXFLAGS -Werror"
  311. AC_MSG_CHECKING([whether we need -Wno-unused-parameter for python])
  312. AC_TRY_COMPILE(
  313. [#include <Python.h>],
  314. [],
  315. [AC_MSG_RESULT(no)],
  316. [
  317. CXXFLAGS="$CXXFLAGS -Wno-unused-parameter"
  318. AC_TRY_COMPILE([#include <Python.h>],
  319. [],
  320. [AC_MSG_RESULT(yes)
  321. PYTHON_CXXFLAGS="${PYTHON_CXXFLAGS} -Wno-unused-parameter"
  322. AC_SUBST(PYTHON_CXXFLAGS)
  323. ],
  324. [AC_MSG_ERROR([Can't compile against Python.h])]
  325. )
  326. ]
  327. )
  328. CXXFLAGS="$CXXFLAGS_SAVED"
  329. CPPFLAGS="$CPPFLAGS_SAVED"
  330. fi
  331. fi dnl GXX = yes
  332. AM_CONDITIONAL(GCC_WERROR_OK, test $werror_ok = 1)
  333. # produce PIC unless we disable shared libraries. need this for python bindings.
  334. if test $enable_shared != "no" -a "X$GXX" = "Xyes"; then
  335. B10_CXXFLAGS="$B10_CXXFLAGS -fPIC"
  336. fi
  337. AC_SUBST(B10_CXXFLAGS)
  338. # Checks for libraries.
  339. AC_SEARCH_LIBS(inet_pton, [nsl])
  340. AC_SEARCH_LIBS(recvfrom, [socket])
  341. AC_SEARCH_LIBS(nanosleep, [rt])
  342. # Checks for header files.
  343. # Checks for typedefs, structures, and compiler characteristics.
  344. AC_HEADER_STDBOOL
  345. AC_TYPE_SIZE_T
  346. # Detect OS type (it may be used to do OS-specific things, e.g.
  347. # interface detection in DHCP)
  348. AC_MSG_CHECKING(OS family)
  349. system=`uname -s`
  350. case $system in
  351. Linux)
  352. OS_TYPE="Linux"
  353. CPPFLAGS="$CPPFLAGS -DOS_LINUX"
  354. ;;
  355. Darwin | FreeBSD | NetBSD | OpenBSD)
  356. OS_TYPE="BSD"
  357. CPPFLAGS="$CPPFLAGS -DOS_BSD"
  358. ;;
  359. Solaris)
  360. OS_TYPE="Solaris"
  361. CPPFLAGS="$CPPFLAGS -DOS_SOLARIS"
  362. ;;
  363. *)
  364. OS_TYPE="Unknown"
  365. AC_MSG_WARN("Unsupported OS: uname returned $system")
  366. ;;
  367. esac
  368. AC_MSG_RESULT($OS_TYPE)
  369. AM_CONDITIONAL(OS_LINUX, test $OS_TYPE = Linux)
  370. AM_COND_IF([OS_LINUX], [AC_DEFINE([OS_LINUX], [1], [Running on Linux?])])
  371. AM_CONDITIONAL(OS_BSD, test $OS_TYPE = BSD)
  372. AM_COND_IF([OS_BSD], [AC_DEFINE([OS_BSD], [1], [Running on BSD?])])
  373. AM_CONDITIONAL(OS_SOLARIS, test $OS_TYPE = Solaris)
  374. AM_COND_IF([OS_SOLARIS], [AC_DEFINE([OS_SOLARIS], [1], [Running on Solaris?])])
  375. AC_MSG_CHECKING(for sa_len in struct sockaddr)
  376. AC_TRY_COMPILE([
  377. #include <sys/types.h>
  378. #include <sys/socket.h>],
  379. [struct sockaddr sa; sa.sa_len = 0; return (0);],
  380. [AC_MSG_RESULT(yes)
  381. AC_DEFINE(HAVE_SA_LEN, 1, [Define to 1 if sockaddr has a sa_len member, and corresponding sin_len and sun_len])],
  382. AC_MSG_RESULT(no))
  383. AC_ARG_WITH(pycoverage,
  384. [ --with-pycoverage[=PROGRAM] enable python code coverage using the specified coverage], pycoverage="$withval", pycoverage="no")
  385. if test "$pycoverage" = "no" ; then
  386. # just run the tests normally with python
  387. PYCOVERAGE_RUN="${PYTHON}"
  388. USE_PYCOVERAGE="no"
  389. elif test "$pycoverage" = "yes" ; then
  390. PYCOVERAGE="coverage"
  391. PYCOVERAGE_RUN="${PYCOVERAGE} run --branch --append"
  392. USE_PYCOVERAGE="yes"
  393. else
  394. PYCOVERAGE="$pycoverage"
  395. PYCOVERAGE_RUN="${PYCOVERAGE} run --branch --append"
  396. USE_PYCOVERAGE="yes"
  397. fi
  398. AM_CONDITIONAL(ENABLE_PYTHON_COVERAGE, test x$USE_PYCOVERAGE != xno)
  399. AC_SUBST(PYCOVERAGE)
  400. AC_SUBST(PYCOVERAGE_RUN)
  401. AC_SUBST(USE_PYCOVERAGE)
  402. AC_ARG_WITH(lcov,
  403. [ --with-lcov[=PROGRAM] enable gtest and coverage target using the specified lcov], lcov="$withval", lcov="no")
  404. AC_ARG_WITH(gtest,
  405. [ --with-gtest=PATH specify a path to gtest header files (PATH/include) and library (PATH/lib)],
  406. gtest_path="$withval", gtest_path="no")
  407. USE_LCOV="no"
  408. if test "$lcov" != "no"; then
  409. # force gtest if not set
  410. if test "$gtest_path" = "no"; then
  411. # AC_MSG_ERROR("lcov needs gtest for test coverage report")
  412. AC_MSG_NOTICE([gtest support is now enabled, because used by coverage tests])
  413. gtest_path="yes"
  414. fi
  415. if test "$lcov" != "yes"; then
  416. LCOV=$lcov
  417. else
  418. AC_PATH_PROG([LCOV], [lcov])
  419. fi
  420. if test -x "${LCOV}"; then
  421. USE_LCOV="yes"
  422. else
  423. AC_MSG_ERROR([Cannot find lcov.])
  424. fi
  425. # is genhtml always in the same directory?
  426. GENHTML=`echo "$LCOV" | sed s/lcov$/genhtml/`
  427. if test ! -x $GENHTML; then
  428. AC_MSG_ERROR([genhtml not found, needed for lcov])
  429. fi
  430. # GCC specific?
  431. CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage"
  432. LIBS=" $LIBS -lgcov"
  433. AC_SUBST(CPPFLAGS)
  434. AC_SUBST(LIBS)
  435. AC_SUBST(LCOV)
  436. AC_SUBST(GENHTML)
  437. fi
  438. AC_SUBST(USE_LCOV)
  439. # Simplified, non-caching AC_CHECK_PROG
  440. # Searches $PATH for the existence of argument 2,
  441. # and sets the full path to the variable in argument 1.
  442. # if not found, and a third argument is given, the value
  443. # is set to that. If not, the value is untouched.
  444. # Does not take absolute paths into account at this point,
  445. # and also works for single files only (arguments are not
  446. # stripped like in AC_CHECK_PROG)
  447. AC_DEFUN([ACX_CHECK_PROG_NONCACHE], [
  448. RESULT=""
  449. IFS_SAVED="$IFS"
  450. IFS=${PATH_SEPARATOR}
  451. for cur_path in ${PATH} ; do
  452. if test -e "${cur_path}/$2" ; then
  453. RESULT="${cur_path}/$2"
  454. fi
  455. done
  456. if test "$RESULT" = "" ; then
  457. :
  458. m4_ifvaln([$3], [$1=$3])
  459. else
  460. $1=$RESULT
  461. fi
  462. IFS="$IFS_SAVED"
  463. ])
  464. # Botan helper test function
  465. # Tries to compile a botan program, given the output of the given
  466. # config tool
  467. # Arguments:
  468. # - name of tool (checked for path), must support --libs and --cflags
  469. # - fixed argument(s) for tool
  470. # - action if successful
  471. AC_DEFUN([ACX_TRY_BOTAN_TOOL], [
  472. TOOL=$1
  473. TOOL_ARG=$2
  474. BOTAN_TOOL=""
  475. ACX_CHECK_PROG_NONCACHE([BOTAN_TOOL], [${TOOL}])
  476. AC_MSG_CHECKING([usability of ${TOOL} ${TOOL_ARG}])
  477. if test "$BOTAN_TOOL" != "" ; then
  478. if test -x ${BOTAN_TOOL}; then
  479. BOTAN_LIBS=`$BOTAN_TOOL $TOOL_ARG --libs`
  480. LIBS_SAVED=${LIBS}
  481. LIBS="$LIBS $BOTAN_LIBS"
  482. BOTAN_INCLUDES=`$BOTAN_TOOL $TOOL_ARG --cflags`
  483. CPPFLAGS_SAVED=${CPPFLAGS}
  484. CPPFLAGS="$BOTAN_INCLUDES $CPPFLAGS"
  485. #AC_MSG_RESULT([found])
  486. AC_LINK_IFELSE(
  487. [AC_LANG_PROGRAM([#include <botan/botan.h>
  488. #include <botan/hash.h>
  489. ],
  490. [using namespace Botan;
  491. LibraryInitializer::initialize();
  492. HashFunction *h = get_hash("MD5");
  493. ])],
  494. [ AC_MSG_RESULT([ok])
  495. $3
  496. ],
  497. [ AC_MSG_RESULT([not usable]) ]
  498. )
  499. LIBS=${LIBS_SAVED}
  500. CPPFLAGS=${CPPFLAGS_SAVED}
  501. else
  502. AC_MSG_RESULT([not executable])
  503. fi
  504. else
  505. AC_MSG_RESULT([not found])
  506. fi
  507. BOTAN_TOOL=""
  508. AC_SUBST(BOTAN_TOOL)
  509. ]
  510. )
  511. # Check for Botan
  512. #
  513. # Unless --with-botan-config is given, we first try to find these config
  514. # scripts ourselves. Unfortunately, on some systems, these scripts do not
  515. # provide the correct implementation, so for each script found, we try
  516. # a compilation test (ACX_TRY_BOTAN_TOOL). If none are found, or none of
  517. # them work, we see if pkg-config is available. If so, we try the several
  518. # potential pkg-config .pc files. Again, on some systems, these can return
  519. # incorrect information as well, so the try-compile test is repeated for
  520. # each.
  521. #
  522. # If a working config script or pkgconfig file is found, we then munge its
  523. # output for use in our Makefiles, and to make sure it works, another header
  524. # and compilation test is done (this should also check whether we can compile
  525. # against botan should neither -config scripts nor pkgconfig data exist).
  526. #
  527. botan_config="yes"
  528. AC_ARG_WITH([botan-config],
  529. AC_HELP_STRING([--with-botan-config=PATH],
  530. [specify the path to the botan-config script]),
  531. [botan_config="$withval"])
  532. if test "${botan_config}" = "no" ; then
  533. AC_MSG_ERROR([Need botan for libcryptolink])
  534. fi
  535. if test "${botan_config}" != "yes" ; then
  536. if test -x "${botan_config}" ; then
  537. if test -d "${botan_config}" ; then
  538. AC_MSG_ERROR([${botan_config} is a directory])
  539. else
  540. BOTAN_CONFIG="${botan_config}"
  541. fi
  542. else
  543. AC_MSG_ERROR([--with-botan-config should point to a botan-config program and not a directory (${botan_config})])
  544. fi
  545. else
  546. BOTAN_CONFIG=""
  547. # first try several possible names of the config script
  548. # (botan-config-1.8 is there just in case, the official name change
  549. # came later)
  550. BOTAN_CONFIG_VERSIONS="botan-config-1.10 botan-config-1.9 botan-config-1.8 botan-config"
  551. for botan_config in $BOTAN_CONFIG_VERSIONS; do
  552. ACX_TRY_BOTAN_TOOL([$botan_config],,
  553. [ BOTAN_CONFIG="$botan_config" ]
  554. )
  555. if test "$BOTAN_CONFIG" != "" ; then
  556. break
  557. fi
  558. done
  559. if test "$BOTAN_CONFIG" = "" ; then
  560. AC_PATH_PROG([PKG_CONFIG], [pkg-config])
  561. if test "$PKG_CONFIG" != "" ; then
  562. # Ok so no script found, see if pkg-config knows of it.
  563. # Unfortunately, the botan.pc files also have their minor version
  564. # in their name, so we need to try them one by one
  565. BOTAN_VERSIONS="botan-1.10 botan-1.9 botan-1.8"
  566. for version in $BOTAN_VERSIONS; do
  567. ACX_TRY_BOTAN_TOOL([pkg-config], ["$version --silence-errors"],
  568. [ BOTAN_CONFIG="$PKG_CONFIG $version" ]
  569. )
  570. if test "$BOTAN_CONFIG" != "" ; then
  571. break
  572. fi
  573. done
  574. fi
  575. fi
  576. fi
  577. if test "x${BOTAN_CONFIG}" != "x"
  578. then
  579. BOTAN_LIBS=`${BOTAN_CONFIG} --libs`
  580. BOTAN_INCLUDES=`${BOTAN_CONFIG} --cflags`
  581. # We expect botan-config --libs to contain -L<path_to_libbotan>, but
  582. # this is not always the case. As a heuristics workaround we add
  583. # -L`botan-config --prefix/lib` in this case (if not present already).
  584. # Same for BOTAN_INCLUDES (but using include instead of lib) below.
  585. if [ ${BOTAN_CONFIG} --prefix >/dev/null 2>&1 ] ; then
  586. echo ${BOTAN_LIBS} | grep -- -L > /dev/null || \
  587. BOTAN_LIBS="-L`${BOTAN_CONFIG} --prefix`/lib ${BOTAN_LIBS}"
  588. echo ${BOTAN_INCLUDES} | grep -- -I > /dev/null || \
  589. BOTAN_INCLUDES="-I`${BOTAN_CONFIG} --prefix`/include ${BOTAN_INCLUDES}"
  590. fi
  591. fi
  592. # botan-config script (and the way we call pkg-config) returns -L and -l
  593. # as one string, but we need them in separate values
  594. BOTAN_LDFLAGS=
  595. BOTAN_NEWLIBS=
  596. for flag in ${BOTAN_LIBS}; do
  597. BOTAN_LDFLAGS="${BOTAN_LDFLAGS} `echo $flag | sed -ne '/^\(\-L\)/p'`"
  598. BOTAN_LIBS="${BOTAN_LIBS} `echo $flag | sed -ne '/^\(\-l\)/p'`"
  599. done
  600. # See python_rpath for some info on why we do this
  601. if test $rpath_flag != no; then
  602. BOTAN_RPATH=
  603. for flag in ${BOTAN_LIBS}; do
  604. BOTAN_RPATH="${BOTAN_RPATH} `echo $flag | sed -ne "s/^\(\-L\)/${rpath_flag}/p"`"
  605. done
  606. AC_SUBST(BOTAN_RPATH)
  607. # According to the libtool manual, it should be sufficient if we
  608. # specify the "-R libdir" in our wrapper library of botan (no other
  609. # programs will need libbotan directly); "libdir" should be added to
  610. # the program's binary image. But we've seen in our build environments
  611. # that (some versions of?) libtool doesn't propagate -R as documented,
  612. # and it caused a linker error at run time. To work around this, we
  613. # also add the rpath to the global LDFLAGS.
  614. LDFLAGS="$BOTAN_RPATH $LDFLAGS"
  615. fi
  616. AC_SUBST(BOTAN_LDFLAGS)
  617. AC_SUBST(BOTAN_LIBS)
  618. AC_SUBST(BOTAN_INCLUDES)
  619. # Even though chances are high we already performed a real compilation check
  620. # in the search for the right (pkg)config data, we try again here, to
  621. # be sure.
  622. CPPFLAGS_SAVED=$CPPFLAGS
  623. CPPFLAGS="$BOTAN_INCLUDES $CPPFLAGS"
  624. LIBS_SAVED="$LIBS"
  625. LIBS="$LIBS $BOTAN_LIBS"
  626. AC_CHECK_HEADERS([botan/botan.h],,AC_MSG_ERROR([Missing required header files.]))
  627. AC_LINK_IFELSE(
  628. [AC_LANG_PROGRAM([#include <botan/botan.h>
  629. #include <botan/hash.h>
  630. ],
  631. [using namespace Botan;
  632. LibraryInitializer::initialize();
  633. HashFunction *h = get_hash("MD5");
  634. ])],
  635. [AC_MSG_RESULT([checking for Botan library... yes])],
  636. [AC_MSG_RESULT([checking for Botan library... no])
  637. AC_MSG_ERROR([Needs Botan library 1.8 or higher. On some systems,
  638. the botan package has a few missing dependencies (libbz2 and
  639. libgmp), if libbotan has been installed and you see this error,
  640. try upgrading to a higher version of botan or installing libbz2
  641. and libgmp.])]
  642. )
  643. CPPFLAGS=$CPPFLAGS_SAVED
  644. LIBS=$LIBS_SAVED
  645. # Check for log4cplus
  646. log4cplus_path="yes"
  647. AC_ARG_WITH([log4cplus],
  648. AC_HELP_STRING([--with-log4cplus=PATH],
  649. [specify exact directory of log4cplus library and headers]),
  650. [log4cplus_path="$withval"])
  651. if test "${log4cplus_path}" = "no" ; then
  652. AC_MSG_ERROR([Need log4cplus])
  653. elif test "${log4cplus_path}" != "yes" ; then
  654. LOG4CPLUS_INCLUDES="-I${log4cplus_path}/include"
  655. LOG4CPLUS_LIBS="-L${log4cplus_path}/lib"
  656. else
  657. # If not specified, try some common paths.
  658. log4cplusdirs="/usr/local /usr/pkg /opt /opt/local"
  659. for d in $log4cplusdirs
  660. do
  661. if test -f $d/include/log4cplus/logger.h; then
  662. LOG4CPLUS_INCLUDES="-I$d/include"
  663. LOG4CPLUS_LIBS="-L$d/lib"
  664. break
  665. fi
  666. done
  667. fi
  668. LOG4CPLUS_LIBS="$LOG4CPLUS_LIBS -llog4cplus $MULTITHREADING_FLAG"
  669. AC_SUBST(LOG4CPLUS_LIBS)
  670. AC_SUBST(LOG4CPLUS_INCLUDES)
  671. CPPFLAGS_SAVED=$CPPFLAGS
  672. CPPFLAGS="$LOG4CPLUS_INCLUDES $CPPFLAGS"
  673. LIBS_SAVED="$LIBS"
  674. LIBS="$LOG4CPLUS_LIBS $LIBS"
  675. AC_CHECK_HEADERS([log4cplus/logger.h],,AC_MSG_ERROR([Missing required header files.]))
  676. AC_LINK_IFELSE(
  677. [AC_LANG_PROGRAM([#include <log4cplus/logger.h>
  678. ],
  679. [using namespace log4cplus;
  680. Logger logger = Logger::getInstance("main");
  681. ])],
  682. [AC_MSG_RESULT([checking for log4cplus library... yes])],
  683. [AC_MSG_RESULT([checking for log4cplus library... no])
  684. AC_MSG_ERROR([Needs log4cplus library])]
  685. )
  686. CPPFLAGS=$CPPFLAGS_SAVED
  687. LIBS=$LIBS_SAVED
  688. #
  689. # Configure Boost header path
  690. #
  691. # If explicitly specified, use it.
  692. AC_ARG_WITH([boost-include],
  693. AC_HELP_STRING([--with-boost-include=PATH],
  694. [specify exact directory for Boost headers]),
  695. [boost_include_path="$withval"])
  696. # If not specified, try some common paths.
  697. if test -z "$with_boost_include"; then
  698. boostdirs="/usr/local /usr/pkg /opt /opt/local"
  699. for d in $boostdirs
  700. do
  701. if test -f $d/include/boost/shared_ptr.hpp; then
  702. boost_include_path=$d/include
  703. break
  704. fi
  705. done
  706. fi
  707. CPPFLAGS_SAVES="$CPPFLAGS"
  708. if test "${boost_include_path}" ; then
  709. BOOST_INCLUDES="-I${boost_include_path}"
  710. CPPFLAGS="$CPPFLAGS $BOOST_INCLUDES"
  711. fi
  712. AC_CHECK_HEADERS([boost/shared_ptr.hpp boost/foreach.hpp boost/interprocess/sync/interprocess_upgradable_mutex.hpp boost/date_time/posix_time/posix_time_types.hpp boost/bind.hpp boost/function.hpp],,
  713. AC_MSG_ERROR([Missing required header files.]))
  714. # Detect whether Boost tries to use threads by default, and, if not,
  715. # make it sure explicitly. In some systems the automatic detection
  716. # may depend on preceding header files, and if inconsistency happens
  717. # it could lead to a critical disruption.
  718. AC_MSG_CHECKING([whether Boost tries to use threads])
  719. AC_TRY_COMPILE([
  720. #include <boost/config.hpp>
  721. #ifdef BOOST_HAS_THREADS
  722. #error "boost will use threads"
  723. #endif],,
  724. [AC_MSG_RESULT(no)
  725. CPPFLAGS_BOOST_THREADCONF="-DBOOST_DISABLE_THREADS=1"],
  726. [AC_MSG_RESULT(yes)])
  727. CPPFLAGS="$CPPFLAGS_SAVES $CPPFLAGS_BOOST_THREADCONF"
  728. AC_SUBST(BOOST_INCLUDES)
  729. # I can't get some of the #include <asio.hpp> right without this
  730. # TODO: find the real cause of asio/boost wanting pthreads
  731. # (this currently only occurs for src/lib/cc/session_unittests)
  732. PTHREAD_LDFLAGS=
  733. AC_CHECK_LIB(pthread, pthread_create,[ PTHREAD_LDFLAGS=-lpthread ], [])
  734. AC_SUBST(PTHREAD_LDFLAGS)
  735. AC_SUBST(MULTITHREADING_FLAG)
  736. #
  737. # Check availability of gtest, which will be used for unit tests.
  738. #
  739. if test "$gtest_path" != "no"
  740. then
  741. DISTCHECK_GTEST_CONFIGURE_FLAG="--with-gtest=\"$gtest_path\""
  742. if test "$gtest_path" != "yes"; then
  743. GTEST_PATHS=$gtest_path
  744. if test -x "${gtest_path}/bin/gtest-config" ; then
  745. GTEST_CONFIG="${gtest_path}/bin/gtest-config"
  746. fi
  747. else
  748. AC_PATH_PROG([GTEST_CONFIG], [gtest-config])
  749. fi
  750. if test -x "${GTEST_CONFIG}" ; then :
  751. # using cppflags instead of cxxflags
  752. GTEST_INCLUDES=`${GTEST_CONFIG} --cppflags`
  753. GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`
  754. GTEST_LDADD=`${GTEST_CONFIG} --libs`
  755. GTEST_FOUND="true"
  756. else
  757. AC_MSG_WARN([Unable to locate Google Test gtest-config.])
  758. if test -z "${GTEST_PATHS}" ; then
  759. GTEST_PATHS="/usr /usr/local"
  760. fi
  761. GTEST_FOUND="false"
  762. fi
  763. if test "${GTEST_FOUND}" != "true"; then
  764. GTEST_FOUND="false"
  765. for dir in $GTEST_PATHS; do
  766. if test -f "$dir/include/gtest/gtest.h"; then
  767. GTEST_INCLUDES="-I$dir/include"
  768. GTEST_LDFLAGS="-L$dir/lib"
  769. GTEST_LDADD="-lgtest"
  770. GTEST_FOUND="true"
  771. # There is no gtest-config script on this
  772. # system, which is supposed to inform us
  773. # whether we need pthreads as well (a
  774. # gtest compile-time option). So we still
  775. # need to test that manually.
  776. CPPFLAGS_SAVED="$CPPFLAGS"
  777. CPPFLAGS="$CPPFLAGS $GTEST_INCLUDES"
  778. LDFLAGS_SAVED="$LDFLAGS"
  779. LDFLAGS="$LDFLAGS $GTEST_LDFLAGS"
  780. LIBS_SAVED=$LIBS
  781. LIBS="$LIBS $GTEST_LDADD"
  782. AC_MSG_CHECKING([Checking whether gtest tests need pthreads])
  783. # First try to compile without pthreads
  784. AC_TRY_LINK([
  785. #include <gtest/gtest.h>
  786. ],[
  787. int i = 0;
  788. char* c = NULL;
  789. ::testing::InitGoogleTest(&i, &c);
  790. return (0);
  791. ],
  792. [ AC_MSG_RESULT(no) ],
  793. [
  794. LIBS="$SAVED_LIBS $GTEST_LDADD $PTHREAD_LDFLAGS"
  795. # Now try to compile with pthreads
  796. AC_TRY_LINK([
  797. #include <gtest/gtest.h>
  798. ],[
  799. int i = 0;
  800. char* c = NULL;
  801. ::testing::InitGoogleTest(&i, &c);
  802. return (0);
  803. ],
  804. [ AC_MSG_RESULT(yes)
  805. GTEST_LDADD="$GTEST_LDADD $PTHREAD_LDFLAGS"
  806. ],
  807. # Apparently we can't compile it at all
  808. [ AC_MSG_ERROR(unable to compile with gtest) ])
  809. ])
  810. CPPFLAGS=$CPPFLAGS_SAVED
  811. LDFLAGS=$LDFLAGS_SAVED
  812. LIBS=$LIBS_SAVED
  813. break
  814. fi
  815. done
  816. fi
  817. if test "${GTEST_FOUND}" != "true"; then
  818. AC_MSG_ERROR([Cannot find gtest in: $GTEST_PATHS])
  819. fi
  820. else
  821. GTEST_INCLUDES=
  822. GTEST_LDFLAGS=
  823. GTEST_LDADD=
  824. DISTCHECK_GTEST_CONFIGURE_FLAG=
  825. fi
  826. AM_CONDITIONAL(HAVE_GTEST, test $gtest_path != "no")
  827. AC_SUBST(DISTCHECK_GTEST_CONFIGURE_FLAG)
  828. AC_SUBST(GTEST_INCLUDES)
  829. AC_SUBST(GTEST_LDFLAGS)
  830. AC_SUBST(GTEST_LDADD)
  831. dnl check for pkg-config itself so we don't try the m4 macro without pkg-config
  832. AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes, no)
  833. if test "x$HAVE_PKG_CONFIG" = "xno" ; then
  834. AC_MSG_ERROR(Please install pkg-config)
  835. fi
  836. PKG_CHECK_MODULES(SQLITE, sqlite3 >= 3.3.9, enable_features="$enable_features SQLite3")
  837. #
  838. # ASIO: we extensively use it as the C++ event management module.
  839. #
  840. # Use local ASIO headers from ext
  841. #
  842. CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/ext/asio"
  843. #
  844. # Use our 'coroutine' header from ext
  845. CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/ext/coroutine"
  846. #
  847. # Disable threads: Currently we don't use them.
  848. CPPFLAGS="$CPPFLAGS -DASIO_DISABLE_THREADS=1"
  849. # Check for functions that are not available on all platforms
  850. AC_CHECK_FUNCS([pselect])
  851. # perfdhcp: If the clock_gettime() function does not exist on the system,
  852. # use an alternative supplied in the code based on gettimeofday().
  853. CLOCK_GETTIME_LDFLAGS=
  854. AC_CHECK_LIB([rt], [clock_gettime], [CLOCK_GETTIME_LDFLAGS=-lrt], [])
  855. AC_SUBST([CLOCK_GETTIME_LDFLAGS])
  856. # perfdhcp: if getifaddrs() does not exist, have the code output a message
  857. # that it can't be run on this version of the operating system. For the
  858. # systems on which BIND 10 is built, this means Solaris 10. (Replacements
  859. # for this function are long and involved, and the function is reported present
  860. # on Solaris 11 and later, either in the libsocket or libnsl libraries.)
  861. AC_SEARCH_LIBS([getifaddrs], [socket nsl],
  862. [AC_DEFINE([HAVE_GETIFADDRS], [1], [getifaddrs() present])])
  863. # /dev/poll issue: ASIO uses /dev/poll by default if it's available (generally
  864. # the case with Solaris). Unfortunately its /dev/poll specific code would
  865. # trigger the gcc's "missing-field-initializers" warning, which would
  866. # subsequently make the build fail with -Werror. Further, older versions of
  867. # gcc don't provide an option to selectively suppress this warning.
  868. # So, for the moment, we simply disable the use of /dev/poll. Unless we
  869. # implement recursive DNS server with randomized ports, we don't need the
  870. # scalability that /dev/poll can provide, so this decision wouldn't affect
  871. # run time performance. Hopefully we can find a better solution or the ASIO
  872. # code will be updated by the time we really need it.
  873. AC_CHECK_HEADERS(sys/devpoll.h, ac_cv_have_devpoll=yes, ac_cv_have_devpoll=no)
  874. if test "X$ac_cv_have_devpoll" = "Xyes" -a "X$GXX" = "Xyes"; then
  875. CPPFLAGS="$CPPFLAGS -DASIO_DISABLE_DEV_POLL=1"
  876. fi
  877. #
  878. # Perl is optional; it is used only by some of the system test scripts.
  879. #
  880. AC_PATH_PROGS(PERL, perl5 perl)
  881. AC_SUBST(PERL)
  882. AC_PATH_PROGS(AWK, gawk awk)
  883. AC_SUBST(AWK)
  884. AC_ARG_ENABLE(man, [AC_HELP_STRING([--enable-man],
  885. [regenerate man pages [default=no]])], enable_man=$enableval, enable_man=no)
  886. AM_CONDITIONAL(ENABLE_MAN, test x$enable_man != xno)
  887. AC_ARG_ENABLE(install-configurations,
  888. [AC_HELP_STRING([--disable-install-configurations],
  889. [do not install configuration])], install_configurations=$enableval, install_configurations=yes)
  890. AM_CONDITIONAL(INSTALL_CONFIGURATIONS, test x$install_configurations = xyes || test x$install_configurations = xtrue)
  891. AC_CONFIG_FILES([Makefile
  892. doc/Makefile
  893. doc/guide/Makefile
  894. compatcheck/Makefile
  895. src/Makefile
  896. src/bin/Makefile
  897. src/bin/bind10/Makefile
  898. src/bin/bind10/tests/Makefile
  899. src/bin/cmdctl/Makefile
  900. src/bin/cmdctl/tests/Makefile
  901. src/bin/bindctl/Makefile
  902. src/bin/bindctl/tests/Makefile
  903. src/bin/cfgmgr/Makefile
  904. src/bin/cfgmgr/plugins/Makefile
  905. src/bin/cfgmgr/plugins/tests/Makefile
  906. src/bin/cfgmgr/tests/Makefile
  907. src/bin/dbutil/Makefile
  908. src/bin/dbutil/tests/Makefile
  909. src/bin/dbutil/tests/testdata/Makefile
  910. src/bin/host/Makefile
  911. src/bin/loadzone/Makefile
  912. src/bin/loadzone/tests/correct/Makefile
  913. src/bin/loadzone/tests/error/Makefile
  914. src/bin/msgq/Makefile
  915. src/bin/msgq/tests/Makefile
  916. src/bin/auth/Makefile
  917. src/bin/auth/tests/Makefile
  918. src/bin/auth/benchmarks/Makefile
  919. src/bin/ddns/Makefile
  920. src/bin/ddns/tests/Makefile
  921. src/bin/dhcp6/Makefile
  922. src/bin/dhcp6/tests/Makefile
  923. src/bin/dhcp4/Makefile
  924. src/bin/dhcp4/tests/Makefile
  925. src/bin/resolver/Makefile
  926. src/bin/resolver/tests/Makefile
  927. src/bin/sockcreator/Makefile
  928. src/bin/sockcreator/tests/Makefile
  929. src/bin/xfrin/Makefile
  930. src/bin/xfrin/tests/Makefile
  931. src/bin/xfrin/tests/testdata/Makefile
  932. src/bin/xfrout/Makefile
  933. src/bin/xfrout/tests/Makefile
  934. src/bin/zonemgr/Makefile
  935. src/bin/zonemgr/tests/Makefile
  936. src/bin/stats/Makefile
  937. src/bin/stats/tests/Makefile
  938. src/bin/usermgr/Makefile
  939. src/bin/tests/Makefile
  940. src/lib/Makefile
  941. src/lib/asiolink/Makefile
  942. src/lib/asiolink/tests/Makefile
  943. src/lib/asiodns/Makefile
  944. src/lib/asiodns/tests/Makefile
  945. src/lib/bench/Makefile
  946. src/lib/bench/example/Makefile
  947. src/lib/bench/tests/Makefile
  948. src/lib/cc/Makefile
  949. src/lib/cc/tests/Makefile
  950. src/lib/python/Makefile
  951. src/lib/python/isc/Makefile
  952. src/lib/python/isc/acl/Makefile
  953. src/lib/python/isc/acl/tests/Makefile
  954. src/lib/python/isc/util/Makefile
  955. src/lib/python/isc/util/tests/Makefile
  956. src/lib/python/isc/util/cio/Makefile
  957. src/lib/python/isc/util/cio/tests/Makefile
  958. src/lib/python/isc/datasrc/Makefile
  959. src/lib/python/isc/datasrc/tests/Makefile
  960. src/lib/python/isc/dns/Makefile
  961. src/lib/python/isc/cc/Makefile
  962. src/lib/python/isc/cc/tests/Makefile
  963. src/lib/python/isc/config/Makefile
  964. src/lib/python/isc/config/tests/Makefile
  965. src/lib/python/isc/log/Makefile
  966. src/lib/python/isc/log/tests/Makefile
  967. src/lib/python/isc/log_messages/Makefile
  968. src/lib/python/isc/log_messages/work/Makefile
  969. src/lib/python/isc/net/Makefile
  970. src/lib/python/isc/net/tests/Makefile
  971. src/lib/python/isc/notify/Makefile
  972. src/lib/python/isc/notify/tests/Makefile
  973. src/lib/python/isc/testutils/Makefile
  974. src/lib/python/isc/bind10/Makefile
  975. src/lib/python/isc/bind10/tests/Makefile
  976. src/lib/python/isc/xfrin/Makefile
  977. src/lib/python/isc/xfrin/tests/Makefile
  978. src/lib/python/isc/server_common/Makefile
  979. src/lib/python/isc/server_common/tests/Makefile
  980. src/lib/config/Makefile
  981. src/lib/config/tests/Makefile
  982. src/lib/config/tests/testdata/Makefile
  983. src/lib/cryptolink/Makefile
  984. src/lib/cryptolink/tests/Makefile
  985. src/lib/dns/Makefile
  986. src/lib/dns/tests/Makefile
  987. src/lib/dns/tests/testdata/Makefile
  988. src/lib/dns/python/Makefile
  989. src/lib/dns/python/tests/Makefile
  990. src/lib/dns/benchmarks/Makefile
  991. src/lib/dhcp/Makefile
  992. src/lib/dhcp/tests/Makefile
  993. src/lib/exceptions/Makefile
  994. src/lib/exceptions/tests/Makefile
  995. src/lib/datasrc/Makefile
  996. src/lib/datasrc/tests/Makefile
  997. src/lib/datasrc/tests/testdata/Makefile
  998. src/lib/xfr/Makefile
  999. src/lib/xfr/tests/Makefile
  1000. src/lib/log/Makefile
  1001. src/lib/log/compiler/Makefile
  1002. src/lib/log/tests/Makefile
  1003. src/lib/resolve/Makefile
  1004. src/lib/resolve/tests/Makefile
  1005. src/lib/testutils/Makefile
  1006. src/lib/testutils/testdata/Makefile
  1007. src/lib/nsas/Makefile
  1008. src/lib/nsas/tests/Makefile
  1009. src/lib/cache/Makefile
  1010. src/lib/cache/tests/Makefile
  1011. src/lib/server_common/Makefile
  1012. src/lib/server_common/tests/Makefile
  1013. src/lib/util/Makefile
  1014. src/lib/util/io/Makefile
  1015. src/lib/util/unittests/Makefile
  1016. src/lib/util/python/Makefile
  1017. src/lib/util/pyunittests/Makefile
  1018. src/lib/util/tests/Makefile
  1019. src/lib/acl/Makefile
  1020. src/lib/acl/tests/Makefile
  1021. src/lib/statistics/Makefile
  1022. src/lib/statistics/tests/Makefile
  1023. tests/Makefile
  1024. tests/system/Makefile
  1025. tests/tools/Makefile
  1026. tests/tools/badpacket/Makefile
  1027. tests/tools/badpacket/tests/Makefile
  1028. tests/tools/perfdhcp/Makefile
  1029. ])
  1030. AC_OUTPUT([doc/version.ent
  1031. src/bin/cfgmgr/b10-cfgmgr.py
  1032. src/bin/cfgmgr/tests/b10-cfgmgr_test.py
  1033. src/bin/cmdctl/cmdctl.py
  1034. src/bin/cmdctl/run_b10-cmdctl.sh
  1035. src/bin/cmdctl/tests/cmdctl_test
  1036. src/bin/cmdctl/cmdctl.spec.pre
  1037. src/bin/dbutil/dbutil.py
  1038. src/bin/dbutil/run_dbutil.sh
  1039. src/bin/dbutil/tests/dbutil_test.sh
  1040. src/bin/ddns/ddns.py
  1041. src/bin/xfrin/tests/xfrin_test
  1042. src/bin/xfrin/xfrin.py
  1043. src/bin/xfrin/run_b10-xfrin.sh
  1044. src/bin/xfrout/xfrout.py
  1045. src/bin/xfrout/xfrout.spec.pre
  1046. src/bin/xfrout/tests/xfrout_test
  1047. src/bin/xfrout/tests/xfrout_test.py
  1048. src/bin/xfrout/run_b10-xfrout.sh
  1049. src/bin/resolver/resolver.spec.pre
  1050. src/bin/resolver/spec_config.h.pre
  1051. src/bin/zonemgr/zonemgr.py
  1052. src/bin/zonemgr/zonemgr.spec.pre
  1053. src/bin/zonemgr/tests/zonemgr_test
  1054. src/bin/zonemgr/run_b10-zonemgr.sh
  1055. src/bin/stats/stats.py
  1056. src/bin/stats/stats_httpd.py
  1057. src/bin/bind10/bind10_src.py
  1058. src/bin/bind10/run_bind10.sh
  1059. src/bin/bind10/tests/bind10_test.py
  1060. src/bin/bindctl/run_bindctl.sh
  1061. src/bin/bindctl/bindctl_main.py
  1062. src/bin/bindctl/tests/bindctl_test
  1063. src/bin/loadzone/run_loadzone.sh
  1064. src/bin/loadzone/tests/correct/correct_test.sh
  1065. src/bin/loadzone/tests/error/error_test.sh
  1066. src/bin/loadzone/b10-loadzone.py
  1067. src/bin/usermgr/run_b10-cmdctl-usermgr.sh
  1068. src/bin/usermgr/b10-cmdctl-usermgr.py
  1069. src/bin/msgq/msgq.py
  1070. src/bin/msgq/tests/msgq_test
  1071. src/bin/msgq/run_msgq.sh
  1072. src/bin/auth/auth.spec.pre
  1073. src/bin/auth/spec_config.h.pre
  1074. src/bin/dhcp4/spec_config.h.pre
  1075. src/bin/dhcp6/spec_config.h.pre
  1076. src/bin/tests/process_rename_test.py
  1077. src/lib/config/tests/data_def_unittests_config.h
  1078. src/lib/python/isc/config/tests/config_test
  1079. src/lib/python/isc/cc/tests/cc_test
  1080. src/lib/python/isc/notify/tests/notify_out_test
  1081. src/lib/python/isc/log/tests/log_console.py
  1082. src/lib/python/isc/log_messages/work/__init__.py
  1083. src/lib/dns/gen-rdatacode.py
  1084. src/lib/python/bind10_config.py
  1085. src/lib/cc/session_config.h.pre
  1086. src/lib/cc/tests/session_unittests_config.h
  1087. src/lib/datasrc/datasrc_config.h.pre
  1088. src/lib/log/tests/console_test.sh
  1089. src/lib/log/tests/destination_test.sh
  1090. src/lib/log/tests/init_logger_test.sh
  1091. src/lib/log/tests/local_file_test.sh
  1092. src/lib/log/tests/severity_test.sh
  1093. src/lib/log/tests/tempdir.h
  1094. src/lib/util/python/mkpywrapper.py
  1095. src/lib/util/python/gen_wiredata.py
  1096. src/lib/server_common/tests/data_path.h
  1097. tests/lettuce/setup_intree_bind10.sh
  1098. tests/system/conf.sh
  1099. tests/system/run.sh
  1100. tests/system/glue/setup.sh
  1101. tests/system/glue/nsx1/b10-config.db
  1102. tests/system/bindctl/nsx1/b10-config.db.template
  1103. tests/system/ixfr/db.example.n0
  1104. tests/system/ixfr/db.example.n2
  1105. tests/system/ixfr/db.example.n2.refresh
  1106. tests/system/ixfr/db.example.n4
  1107. tests/system/ixfr/db.example.n6
  1108. tests/system/ixfr/ixfr_init.sh
  1109. tests/system/ixfr/b10-config.db
  1110. tests/system/ixfr/common_tests.sh
  1111. tests/system/ixfr/in-1/setup.sh
  1112. tests/system/ixfr/in-2/setup.sh
  1113. tests/system/ixfr/in-3/setup.sh
  1114. tests/system/ixfr/in-4/setup.sh
  1115. ], [
  1116. chmod +x src/bin/cmdctl/run_b10-cmdctl.sh
  1117. chmod +x src/bin/xfrin/run_b10-xfrin.sh
  1118. chmod +x src/bin/xfrout/run_b10-xfrout.sh
  1119. chmod +x src/bin/zonemgr/run_b10-zonemgr.sh
  1120. chmod +x src/bin/bind10/run_bind10.sh
  1121. chmod +x src/bin/cmdctl/tests/cmdctl_test
  1122. chmod +x src/bin/dbutil/run_dbutil.sh
  1123. chmod +x src/bin/dbutil/tests/dbutil_test.sh
  1124. chmod +x src/bin/xfrin/tests/xfrin_test
  1125. chmod +x src/bin/xfrout/tests/xfrout_test
  1126. chmod +x src/bin/zonemgr/tests/zonemgr_test
  1127. chmod +x src/bin/bindctl/tests/bindctl_test
  1128. chmod +x src/bin/bindctl/run_bindctl.sh
  1129. chmod +x src/bin/loadzone/run_loadzone.sh
  1130. chmod +x src/bin/loadzone/tests/correct/correct_test.sh
  1131. chmod +x src/bin/loadzone/tests/error/error_test.sh
  1132. chmod +x src/bin/usermgr/run_b10-cmdctl-usermgr.sh
  1133. chmod +x src/bin/msgq/run_msgq.sh
  1134. chmod +x src/bin/msgq/tests/msgq_test
  1135. chmod +x src/lib/dns/gen-rdatacode.py
  1136. chmod +x src/lib/log/tests/console_test.sh
  1137. chmod +x src/lib/log/tests/destination_test.sh
  1138. chmod +x src/lib/log/tests/init_logger_test.sh
  1139. chmod +x src/lib/log/tests/local_file_test.sh
  1140. chmod +x src/lib/log/tests/severity_test.sh
  1141. chmod +x src/lib/util/python/mkpywrapper.py
  1142. chmod +x src/lib/util/python/gen_wiredata.py
  1143. chmod +x src/lib/python/isc/log/tests/log_console.py
  1144. chmod +x tests/system/conf.sh
  1145. chmod +x tests/system/run.sh
  1146. chmod +x tests/system/ixfr/ixfr_init.sh
  1147. chmod +x tests/system/ixfr/common_tests.sh
  1148. chmod +x tests/system/ixfr/in-1/setup.sh
  1149. chmod +x tests/system/ixfr/in-2/setup.sh
  1150. chmod +x tests/system/ixfr/in-3/setup.sh
  1151. chmod +x tests/system/ixfr/in-4/setup.sh
  1152. ])
  1153. AC_OUTPUT
  1154. dnl Print the results
  1155. dnl
  1156. cat > config.report << END
  1157. BIND 10 source configure results:
  1158. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1159. Package:
  1160. Name: $PACKAGE_NAME
  1161. Version: $PACKAGE_VERSION
  1162. C++ Compiler: $CXX
  1163. Flags:
  1164. DEFS: $DEFS
  1165. CPPFLAGS: $CPPFLAGS
  1166. CXXFLAGS: $CXXFLAGS
  1167. LDFLAGS: $LDFLAGS
  1168. B10_CXXFLAGS: $B10_CXXFLAGS
  1169. OS Family: $OS_TYPE
  1170. dnl includes too
  1171. Python: ${PYTHON_INCLUDES}
  1172. ${PYTHON_CXXFLAGS}
  1173. ${PYTHON_LDFLAGS}
  1174. ${PYTHON_LIB}
  1175. Boost: ${BOOST_INCLUDES}
  1176. Botan: ${BOTAN_INCLUDES}
  1177. ${BOTAN_LDFLAGS}
  1178. ${BOTAN_LIBS}
  1179. Log4cplus: ${LOG4CPLUS_INCLUDES}
  1180. ${LOG4CPLUS_LIBS}
  1181. SQLite: $SQLITE_CFLAGS
  1182. $SQLITE_LIBS
  1183. Features:
  1184. $enable_features
  1185. Developer:
  1186. Google Tests: $gtest_path
  1187. C++ Code Coverage: $USE_LCOV
  1188. Python Code Coverage: $USE_PYCOVERAGE
  1189. Generate Manuals: $enable_man
  1190. END
  1191. cat config.report
  1192. cat <<EOF
  1193. Now you can type "make" to build BIND 10
  1194. EOF