configure.ac 47 KB

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