configure.ac 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. AC_PREREQ([2.59])
  4. AC_INIT(bind10-devel, 20110120, bind10-dev@isc.org)
  5. AC_CONFIG_SRCDIR(README)
  6. AM_INIT_AUTOMAKE
  7. AC_CONFIG_HEADERS([config.h])
  8. # Checks for programs.
  9. AC_PROG_CXX
  10. # Libtool configuration
  11. #
  12. # On FreeBSD (and probably some others), clang++ does not meet an autoconf
  13. # assumption in identifying libtool configuration regarding shared library:
  14. # the configure script will execute "$CC -shared $CFLAGS -v -o" and expect
  15. # the output contains -Lxxx or -Ryyy. This is the case for g++, but not for
  16. # clang++, and, as a result, it will cause various errors in linking programs
  17. # or running them with a shared object (such as some of our python scripts).
  18. # To work around this problem we define a temporary variable
  19. # "CXX_LIBTOOL_LDFLAGS". It's expected to be defined as, e.g, "-L/usr/lib"
  20. # to temporarily fake the output so that it will be compatible with that of
  21. # g++.
  22. CFLAGS_SAVED=$CFLAGS
  23. CFLAGS="$CFLAGS $CXX_LIBTOOL_LDFLAGS"
  24. AC_PROG_LIBTOOL
  25. CFLAGS=$CFLAGS_SAVED
  26. # Use C++ language
  27. AC_LANG([C++])
  28. # Identify the compiler: this check must be after AC_PROG_CXX and AC_LANG.
  29. AM_CONDITIONAL(USE_GXX, test "X${GXX}" = "Xyes")
  30. AC_CHECK_DECL([__SUNPRO_CC], [SUNCXX="yes"], [SUNCXX="no"])
  31. AC_CHECK_DECL([__clang__], [CLANGPP="yes"], [CLANGPP="no"])
  32. AM_CONDITIONAL(USE_CLANGPP, test "X${CLANGPP}" = "Xyes")
  33. # Linker options
  34. # check -R rather than gcc specific -rpath to be as portable as possible.
  35. AC_MSG_CHECKING([whether -R flag is available in linker])
  36. LDFLAGS_SAVED="$LDFLAGS"
  37. LDFLAGS="$LDFLAGS -R/usr/lib"
  38. AC_TRY_LINK([],[],
  39. [ AC_MSG_RESULT(yes)
  40. rpath_available=yes
  41. ],[ AC_MSG_RESULT(no)
  42. rpath_available=no
  43. ])
  44. LDFLAGS=$LDFLAGS_SAVED
  45. # allow building programs with static link. we need to make it selective
  46. # because loadable modules cannot be statically linked.
  47. AC_ARG_ENABLE([static-link],
  48. AC_HELP_STRING([--enable-static-link],
  49. [build programs with static link [[default=no]]]),
  50. [enable_static_link=yes], [enable_static_link=no])
  51. AM_CONDITIONAL(USE_STATIC_LINK, test $enable_static_link = yes)
  52. # Check validity about some libtool options
  53. if test $enable_static_link = yes -a $enable_static = no; then
  54. AC_MSG_ERROR([--enable-static-link requires --enable-static])
  55. fi
  56. if test $enable_shared = no; then
  57. AC_MSG_ERROR([BIND 10 requires shared libraries to be built])
  58. fi
  59. # allow configuring without setproctitle.
  60. AC_ARG_ENABLE(setproctitle-check,
  61. AC_HELP_STRING([--disable-setproctitle-check],
  62. [do not check for python setproctitle module (used to give nice names to python processes)]),
  63. setproctitle_check=$enableval, setproctitle_check=yes)
  64. # OS dependent configuration
  65. SET_ENV_LIBRARY_PATH=no
  66. ENV_LIBRARY_PATH=LD_LIBRARY_PATH
  67. case "$host" in
  68. *-solaris*)
  69. # Solaris requires special definitions to get some standard libraries
  70. # (e.g. getopt(3)) available with common used header files.
  71. CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
  72. ;;
  73. *-apple-darwin*)
  74. # libtool doesn't work perfectly with Darwin: libtool embeds the
  75. # final install path in dynamic libraries and our loadable python
  76. # modules always refer to that path even if it's loaded within the
  77. # source tree. This prevents pre-install tests from working.
  78. # To work around this problem we explicitly specify paths to dynamic
  79. # libraries when we use them in the source tree.
  80. SET_ENV_LIBRARY_PATH=yes
  81. ENV_LIBRARY_PATH=DYLD_LIBRARY_PATH
  82. ;;
  83. esac
  84. AM_CONDITIONAL(SET_ENV_LIBRARY_PATH, test $SET_ENV_LIBRARY_PATH = yes)
  85. AC_SUBST(SET_ENV_LIBRARY_PATH)
  86. AC_SUBST(ENV_LIBRARY_PATH)
  87. m4_define([_AM_PYTHON_INTERPRETER_LIST], [python python3 python3.1])
  88. AC_ARG_WITH([pythonpath],
  89. AC_HELP_STRING([--with-pythonpath=PATH],
  90. [specify an absolute path to python executable when automatic version check (incorrectly) fails]),
  91. [python_path="$withval"], [python_path="auto"])
  92. if test "$python_path" = auto; then
  93. AM_PATH_PYTHON([3.1])
  94. else
  95. # Older versions of automake can't handle python3 well. This is an
  96. # in-house workaround for them.
  97. PYTHON=$python_path
  98. AC_SUBST(PYTHON)
  99. PYTHON_PREFIX='${prefix}'
  100. AC_SUBST(PYTHON_PREFIX)
  101. PYTHON_EXEC_PREFIX='$(exec_prefix)'
  102. AC_SUBST(PYTHON_EXEC_PREFIX)
  103. PYTHON_VERSION=[`$PYTHON -c "import sys; sys.stdout.write(sys.version[:3])"`]
  104. if test `echo "$PYTHON_VERSION >= 3.1" | bc` != 1 ; then
  105. AC_MSG_ERROR(["Python version too old: $PYTHON_VERSION, need 3.1 or higher"])
  106. fi
  107. AC_SUBST(PYTHON_VERSION)
  108. PYTHON_PLATFORM=`$PYTHON -c "import sys; print(sys.platform)"`
  109. AC_SUBST(PYTHON_PLATFORM)
  110. pythondir='${prefix}/lib/python'$PYTHON_VERSION'/site-packages'
  111. AC_SUBST(pythondir)
  112. pkgpythondir='${pythondir}/'$PACKAGE
  113. AC_SUBST(pkgpythondir)
  114. pyexecdir='${exec_prefix}/lib/python'$PYTHON_VERSION'/site-packages'
  115. AC_SUBST(pyexecdir)
  116. pkgpyexecdir='${pyexecdir}/'$PACKAGE
  117. AC_SUBST(pkgpyexecdir)
  118. fi
  119. # Check for python development environments
  120. if test -x ${PYTHON}-config; then
  121. PYTHON_INCLUDES=`${PYTHON}-config --includes`
  122. for flag in `${PYTHON}-config --ldflags`; do
  123. # add any '-L..." flags to PYTHON_LDFLAGS
  124. flag=`echo $flag | sed -ne 's/^\(\-L.*\)$/\1/p'`
  125. if test "X${flag}" != X; then
  126. PYTHON_LDFLAGS="$PYTHON_LDFLAGS ${flag}"
  127. fi
  128. done
  129. # on some platforms, ${PYTHON}-config --ldflags doesn't provide a -L
  130. # option while having the library under a non trivial directory.
  131. # as a workaround we try the "lib" sub directory under the common
  132. # prefix for this python.
  133. if test -z "${PYTHON_LDFLAGS}"; then
  134. PYTHON_LDFLAGS="-L`${PYTHON}-config --prefix`/lib"
  135. fi
  136. else
  137. if test "X$PYTHON_INCLUDES" = X -o "X$PYTHON_LDFLAGS" = X; then
  138. 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.])
  139. fi
  140. fi
  141. # Some OSes including NetBSD don't install libpython.so in a well known path.
  142. # To avoid requiring dynamic library path with our python wrapper loadable
  143. # modules, we embed the path to the modules when possible. We do this even
  144. # when the path is known in the common operational environment (e.g. when
  145. # it's stored in a common "hint" file) for simplicity.
  146. if test $rpath_available = yes; then
  147. python_rpath=
  148. for flag in ${PYTHON_LDFLAGS}; do
  149. python_rpath="${python_rpath} `echo $flag | sed -ne 's/^\(\-L\)/-R/p'`"
  150. done
  151. PYTHON_LDFLAGS="${PYTHON_LDFLAGS} ${python_rpath}"
  152. fi
  153. AC_SUBST(PYTHON_INCLUDES)
  154. AC_SUBST(PYTHON_LDFLAGS)
  155. CPPFLAGS_SAVED="$CPPFLAGS"
  156. CPPFLAGS="$CPPFLAGS ${PYTHON_INCLUDES}"
  157. AC_CHECK_HEADERS([Python.h],, AC_MSG_ERROR([Missing Python.h]))
  158. CPPFLAGS="$CPPFLAGS_SAVED"
  159. # Check for python library. Needed for Python-wrapper libraries.
  160. LDFLAGS_SAVED="$LDFLAGS"
  161. LDFLAGS="$LDFLAGS $PYTHON_LDFLAGS"
  162. python_bin="python${PYTHON_VERSION}"
  163. AC_CHECK_LIB($python_bin, main, python_lib=$python_bin, python_lib=no)
  164. if test $python_lib != "no"; then
  165. PYTHON_LIB="-l$python_lib"
  166. fi
  167. AC_SUBST(PYTHON_LIB)
  168. LDFLAGS=$LDFLAGS_SAVED
  169. # Check for the setproctitle module
  170. if test "$setproctitle_check" = "yes" ; then
  171. AC_MSG_CHECKING(for setproctitle module)
  172. if "$PYTHON" -c 'import setproctitle' 2>/dev/null ; then
  173. AC_MSG_RESULT(ok)
  174. else
  175. AC_MSG_RESULT(missing)
  176. AC_MSG_ERROR([Missing setproctitle module. Either install it or provide --disable-setproctitle-check.
  177. In that case we will continue, but naming of python processes will not work.])
  178. fi
  179. fi
  180. # TODO: check for _sqlite3.py module
  181. # Compiler dependent settings: define some mandatory CXXFLAGS here.
  182. # We also use a separate variable B10_CXXFLAGS. This will (and should) be
  183. # used as the default value for each specific AM_CXXFLAGS:
  184. # AM_CXXFLAGS = $(B10_CXXFLAGS)
  185. # AM_CXXFLAGS += ... # add module specific flags
  186. # We need this so that we can disable some specific compiler warnings per
  187. # module basis; since AM_CXXFLAGS are placed before CXXFLAGS, and since
  188. # gcc's -Wno-XXX option must be specified after -Wall or -Wextra, we cannot
  189. # specify the default warning flags in CXXFLAGS and let specific modules
  190. # "override" the default.
  191. # This may be used to try linker flags.
  192. AC_DEFUN([BIND10_CXX_TRY_FLAG], [
  193. AC_MSG_CHECKING([whether $CXX supports $1])
  194. bind10_save_CXXFLAGS="$CXXFLAGS"
  195. CXXFLAGS="$CXXFLAGS $1"
  196. AC_LINK_IFELSE([int main(void){ return 0;} ],
  197. [bind10_cxx_flag=yes], [bind10_cxx_flag=no])
  198. CXXFLAGS="$bind10_save_CXXFLAGS"
  199. if test "x$bind10_cxx_flag" = "xyes"; then
  200. ifelse([$2], , :, [$2])
  201. else
  202. ifelse([$3], , :, [$3])
  203. fi
  204. AC_MSG_RESULT([$bind10_cxx_flag])
  205. ])
  206. werror_ok=0
  207. # SunStudio compiler requires special compiler options for boost
  208. # (http://blogs.sun.com/sga/entry/boost_mini_howto)
  209. if test "$SUNCXX" = "yes"; then
  210. CXXFLAGS="$CXXFLAGS -library=stlport4 -features=tmplife -features=tmplrefstatic"
  211. MULTITHREADING_FLAG="-mt"
  212. fi
  213. BIND10_CXX_TRY_FLAG(-Wno-missing-field-initializers,
  214. [WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG="-Wno-missing-field-initializers"])
  215. AC_SUBST(WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG)
  216. # gcc specific settings:
  217. if test "X$GXX" = "Xyes"; then
  218. B10_CXXFLAGS="-Wall -Wextra -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare"
  219. case "$host" in
  220. *-solaris*)
  221. MULTITHREADING_FLAG=-pthreads
  222. ;;
  223. *)
  224. MULTITHREADING_FLAG=-pthread
  225. ;;
  226. esac
  227. # Certain versions of gcc (g++) have a bug that incorrectly warns about
  228. # the use of anonymous name spaces even if they're closed in a single
  229. # translation unit. For these versions we have to disable -Werror.
  230. CXXFLAGS_SAVED="$CXXFLAGS"
  231. CXXFLAGS="$CXXFLAGS $B10_CXXFLAGS -Werror"
  232. AC_MSG_CHECKING(for in-TU anonymous namespace breakage)
  233. AC_TRY_COMPILE([namespace { class Foo {}; }
  234. namespace isc {class Bar {Foo foo_;};} ],,
  235. [AC_MSG_RESULT(no)
  236. werror_ok=1
  237. B10_CXXFLAGS="$B10_CXXFLAGS -Werror"],
  238. [AC_MSG_RESULT(yes)])
  239. CXXFLAGS="$CXXFLAGS_SAVED"
  240. fi dnl GXX = yes
  241. AM_CONDITIONAL(GCC_WERROR_OK, test $werror_ok = 1)
  242. # produce PIC unless we disable shared libraries. need this for python bindings.
  243. if test $enable_shared != "no" -a "X$GXX" = "Xyes"; then
  244. B10_CXXFLAGS="$B10_CXXFLAGS -fPIC"
  245. fi
  246. AC_SUBST(B10_CXXFLAGS)
  247. # Checks for libraries.
  248. AC_SEARCH_LIBS(inet_pton, [nsl])
  249. AC_SEARCH_LIBS(recvfrom, [socket])
  250. # Checks for header files.
  251. # Checks for typedefs, structures, and compiler characteristics.
  252. AC_HEADER_STDBOOL
  253. AC_TYPE_SIZE_T
  254. AC_MSG_CHECKING(for sa_len in struct sockaddr)
  255. AC_TRY_COMPILE([
  256. #include <sys/types.h>
  257. #include <sys/socket.h>],
  258. [struct sockaddr sa; sa.sa_len = 0; return (0);],
  259. [AC_MSG_RESULT(yes)
  260. AC_DEFINE(HAVE_SA_LEN, 1, [Define to 1 if sockaddr has a sa_len member, and corresponding sin_len and sun_len])],
  261. AC_MSG_RESULT(no))
  262. AC_ARG_WITH(pycoverage,
  263. [ --with-pycoverage[=PROGRAM] enable python code coverage using the specified coverage], pycoverage="$withval", pycoverage="no")
  264. if test "$pycoverage" = "no" ; then
  265. # just run the tests normally with python
  266. PYCOVERAGE_RUN="${PYTHON}"
  267. USE_PYCOVERAGE="no"
  268. elif test "$pycoverage" = "yes" ; then
  269. PYCOVERAGE="coverage"
  270. PYCOVERAGE_RUN="${PYCOVERAGE} run --branch --append"
  271. USE_PYCOVERAGE="yes"
  272. else
  273. PYCOVERAGE="$pycoverage"
  274. PYCOVERAGE_RUN="${PYCOVERAGE} run --branch --append"
  275. USE_PYCOVERAGE="yes"
  276. fi
  277. AM_CONDITIONAL(ENABLE_PYTHON_COVERAGE, test x$USE_PYCOVERAGE != xno)
  278. AC_SUBST(PYCOVERAGE)
  279. AC_SUBST(PYCOVERAGE_RUN)
  280. AC_SUBST(USE_PYCOVERAGE)
  281. AC_ARG_WITH(lcov,
  282. [ --with-lcov[=PROGRAM] enable gtest and coverage target using the specified lcov], lcov="$withval", lcov="no")
  283. AC_ARG_WITH(gtest,
  284. [ --with-gtest=PATH specify a path to gtest header files (PATH/include) and library (PATH/lib)],
  285. gtest_path="$withval", gtest_path="no")
  286. USE_LCOV="no"
  287. if test "$lcov" != "no"; then
  288. # force gtest if not set
  289. if test "$gtest_path" = "no"; then
  290. # AC_MSG_ERROR("lcov needs gtest for test coverage report")
  291. AC_MSG_NOTICE([gtest support is now enabled, because used by coverage tests])
  292. gtest_path="yes"
  293. fi
  294. if test "$lcov" != "yes"; then
  295. LCOV=$lcov
  296. else
  297. AC_PATH_PROG([LCOV], [lcov])
  298. fi
  299. if test -x "${LCOV}"; then
  300. USE_LCOV="yes"
  301. else
  302. AC_MSG_ERROR([Cannot find lcov.])
  303. fi
  304. # is genhtml always in the same directory?
  305. GENHTML=`echo "$LCOV" | sed s/lcov$/genhtml/`
  306. if test ! -x $GENHTML; then
  307. AC_MSG_ERROR([genhtml not found, needed for lcov])
  308. fi
  309. # GCC specific?
  310. CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage"
  311. LIBS=" $LIBS -lgcov"
  312. AC_SUBST(CPPFLAGS)
  313. AC_SUBST(LIBS)
  314. AC_SUBST(LCOV)
  315. AC_SUBST(GENHTML)
  316. fi
  317. AC_SUBST(USE_LCOV)
  318. #
  319. # Configure Boost header path
  320. #
  321. # If explicitly specified, use it.
  322. AC_ARG_WITH([boost-include],
  323. AC_HELP_STRING([--with-boost-include=PATH],
  324. [specify exact directory for Boost headers]),
  325. [boost_include_path="$withval"])
  326. # If not specified, try some common paths.
  327. if test -z "$with_boost_include"; then
  328. boostdirs="/usr/local /usr/pkg /opt /opt/local"
  329. for d in $boostdirs
  330. do
  331. if test -f $d/include/boost/shared_ptr.hpp; then
  332. boost_include_path=$d/include
  333. break
  334. fi
  335. done
  336. fi
  337. CPPFLAGS_SAVES="$CPPFLAGS"
  338. if test "${boost_include_path}" ; then
  339. BOOST_INCLUDES="-I${boost_include_path}"
  340. CPPFLAGS="$CPPFLAGS $BOOST_INCLUDES"
  341. fi
  342. 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],,
  343. AC_MSG_ERROR([Missing required header files.]))
  344. CPPFLAGS="$CPPFLAGS_SAVES"
  345. AC_SUBST(BOOST_INCLUDES)
  346. # Using boost::mutex can result in requiring libboost_thread with older
  347. # versions of Boost. We'd like to avoid relying on a compiled Boost library
  348. # whenever possible, so we need to check for it step by step.
  349. #
  350. # NOTE: another fix of this problem is to simply require newer versions of
  351. # boost. If we choose that solution we should simplify the following tricky
  352. # checks accordingly and all Makefile.am's that refer to NEED_LIBBOOST_THREAD.
  353. AC_MSG_CHECKING(for boost::mutex)
  354. CPPFLAGS_SAVES="$CPPFLAGS"
  355. LIBS_SAVES="$LIBS"
  356. CPPFLAGS="$BOOST_INCLUDES $CPPFLAGS $MULTITHREADING_FLAG"
  357. need_libboost_thread=0
  358. need_sunpro_workaround=0
  359. AC_TRY_LINK([
  360. #include <boost/thread.hpp>
  361. ],[
  362. boost::mutex m;
  363. ],
  364. [ AC_MSG_RESULT(yes (without libboost_thread)) ],
  365. # there is one specific problem with SunStudio 5.10
  366. # where including boost/thread causes a compilation failure
  367. # There is a workaround in boost but it checks the version not being 5.10
  368. # This will probably be fixed in the future, in which case this
  369. # is only a temporary workaround
  370. [ AC_TRY_LINK([
  371. #if defined(__SUNPRO_CC) && __SUNPRO_CC == 0x5100
  372. #undef __SUNPRO_CC
  373. #define __SUNPRO_CC 0x5090
  374. #endif
  375. #include <boost/thread.hpp>
  376. ],[
  377. boost::mutex m;
  378. ],
  379. [ AC_MSG_RESULT(yes (with SUNOS workaround))
  380. need_sunpro_workaround=1 ],
  381. [ LIBS=" $LIBS -lboost_thread"
  382. AC_TRY_LINK([
  383. #include <boost/thread.hpp>
  384. ],[
  385. boost::mutex m;
  386. ],
  387. [ AC_MSG_RESULT(yes (with libboost_thread))
  388. need_libboost_thread=1 ],
  389. [ AC_MSG_RESULT(no)
  390. AC_MSG_ERROR([boost::mutex cannot be linked in this build environment.
  391. Perhaps you are using an older version of Boost that requires libboost_thread for the mutex support, which does not appear to be available.
  392. You may want to check the availability of the library or to upgrade Boost.])
  393. ])])])
  394. CPPFLAGS="$CPPFLAGS_SAVES"
  395. LIBS="$LIBS_SAVES"
  396. AM_CONDITIONAL(NEED_LIBBOOST_THREAD, test $need_libboost_thread = 1)
  397. if test $need_sunpro_workaround = 1; then
  398. AC_DEFINE([NEED_SUNPRO_WORKAROUND], [], [Need boost sunstudio workaround])
  399. fi
  400. #
  401. # Check availability of gtest, which will be used for unit tests.
  402. #
  403. if test "$gtest_path" != "no"
  404. then
  405. if test "$gtest_path" != "yes"; then
  406. GTEST_PATHS=$gtest_path
  407. if test -x "${gtest_path}/bin/gtest-config" ; then
  408. GTEST_CONFIG="${gtest_path}/bin/gtest-config"
  409. fi
  410. else
  411. AC_PATH_PROG([GTEST_CONFIG], [gtest-config])
  412. fi
  413. if test -x "${GTEST_CONFIG}" ; then :
  414. # using cppflags instead of cxxflags
  415. GTEST_INCLUDES=`${GTEST_CONFIG} --cppflags`
  416. GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`
  417. GTEST_LDADD=`${GTEST_CONFIG} --libs`
  418. GTEST_FOUND="true"
  419. else
  420. AC_MSG_WARN([Unable to locate Google Test gtest-config.])
  421. if test -z "${GTEST_PATHS}" ; then
  422. GTEST_PATHS="/usr /usr/local"
  423. fi
  424. GTEST_FOUND="false"
  425. fi
  426. if test "${GTEST_FOUND}" != "true"; then
  427. GTEST_FOUND="false"
  428. for dir in $GTEST_PATHS; do
  429. if test -f "$dir/include/gtest/gtest.h"; then
  430. GTEST_INCLUDES="-I$dir/include"
  431. GTEST_LDFLAGS="-L$dir/lib"
  432. GTEST_LDADD="-lgtest"
  433. GTEST_FOUND="true"
  434. break
  435. fi
  436. done
  437. fi
  438. if test "${GTEST_FOUND}" != "true"; then
  439. AC_MSG_ERROR([Cannot find gtest in: $GTEST_PATHS])
  440. fi
  441. else
  442. GTEST_INCLUDES=
  443. GTEST_LDFLAGS=
  444. GTEST_LDADD=
  445. fi
  446. AM_CONDITIONAL(HAVE_GTEST, test $gtest_path != "no")
  447. AC_SUBST(GTEST_INCLUDES)
  448. AC_SUBST(GTEST_LDFLAGS)
  449. AC_SUBST(GTEST_LDADD)
  450. dnl check for pkg-config itself so we don't try the m4 macro without pkg-config
  451. AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes, no)
  452. if test "x$HAVE_PKG_CONFIG" = "xno" ; then
  453. AC_MSG_ERROR(Please install pkg-config)
  454. fi
  455. PKG_CHECK_MODULES(SQLITE, sqlite3 >= 3.3.9, enable_features="$enable_features SQLite3")
  456. # I can't get some of the #include <asio.hpp> right without this
  457. # TODO: find the real cause of asio/boost wanting pthreads
  458. # (this currently only occurs for src/lib/cc/session_unittests)
  459. PTHREAD_LDFLAGS=
  460. AC_CHECK_LIB(pthread, pthread_create,[ PTHREAD_LDFLAGS=-lpthread ], [])
  461. AC_SUBST(PTHREAD_LDFLAGS)
  462. AC_SUBST(MULTITHREADING_FLAG)
  463. #
  464. # ASIO: we extensively use it as the C++ event management module.
  465. #
  466. # Use local ASIO headers from ext
  467. #
  468. CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/ext/asio"
  469. #
  470. # Disable threads: Currently we don't use them.
  471. CPPFLAGS="$CPPFLAGS -DASIO_DISABLE_THREADS=1"
  472. #
  473. # kqueue portability: ASIO uses kqueue by default if it's available (it's
  474. # generally available in BSD variants). Unfortunately, some public
  475. # implementation of kqueue forces a conversion from a pointer to an integer,
  476. # which is prohibited in C++ unless reinterpret_cast, C++'s most evil beast
  477. # (and ASIO doesn't use it anyway) is used. This will cause build error for
  478. # some of our C++ files including ASIO header files. The following check
  479. # detects such cases and tells ASIO not to use kqueue if so.
  480. AC_CHECK_FUNC(kqueue, ac_cv_have_kqueue=yes, ac_cv_have_kqueue=no)
  481. if test "X$ac_cv_have_kqueue" = "Xyes"; then
  482. AC_MSG_CHECKING([whether kqueue EV_SET compiles in C++])
  483. AC_TRY_COMPILE([
  484. #include <sys/types.h>
  485. #include <sys/param.h>
  486. #include <sys/event.h>],
  487. [char* udata;
  488. EV_SET(NULL, 0, 0, 0, 0, 0, udata);],
  489. [AC_MSG_RESULT(yes)],
  490. [AC_MSG_RESULT([no, disable kqueue for ASIO])
  491. CPPFLAGS="$CPPFLAGS -DASIO_DISABLE_KQUEUE=1"
  492. ])
  493. fi
  494. # /dev/poll issue: ASIO uses /dev/poll by default if it's available (generally
  495. # the case with Solaris). Unfortunately its /dev/poll specific code would
  496. # trigger the gcc's "missing-field-initializers" warning, which would
  497. # subsequently make the build fail with -Werror. Further, older versions of
  498. # gcc don't provide an option to selectively suppress this warning.
  499. # So, for the moment, we simply disable the use of /dev/poll. Unless we
  500. # implement recursive DNS server with randomized ports, we don't need the
  501. # scalability that /dev/poll can provide, so this decision wouldn't affect
  502. # run time performance. Hopefully we can find a better solution or the ASIO
  503. # code will be updated by the time we really need it.
  504. AC_CHECK_HEADERS(sys/devpoll.h, ac_cv_have_devpoll=yes, ac_cv_have_devpoll=no)
  505. if test "X$ac_cv_have_devpoll" = "Xyes" -a "X$GXX" = "Xyes"; then
  506. CPPFLAGS="$CPPFLAGS -DASIO_DISABLE_DEV_POLL=1"
  507. fi
  508. AC_ARG_ENABLE(man, [AC_HELP_STRING([--enable-man],
  509. [regenerate man pages [default=no]])], enable_man=yes, enable_man=no)
  510. AM_CONDITIONAL(ENABLE_MAN, test x$enable_man != xno)
  511. AC_ARG_ENABLE(install-configurations,
  512. [AC_HELP_STRING([--disable-install-configurations],
  513. [do not install configuration])], install_configurations=$enableval, install_configurations=yes)
  514. AM_CONDITIONAL(INSTALL_CONFIGURATIONS, test x$install_configurations = xyes || test x$install_configurations = xtrue)
  515. AC_CONFIG_FILES([Makefile
  516. doc/Makefile
  517. doc/guide/Makefile
  518. src/Makefile
  519. src/bin/Makefile
  520. src/bin/bind10/Makefile
  521. src/bin/bind10/tests/Makefile
  522. src/bin/cmdctl/Makefile
  523. src/bin/cmdctl/tests/Makefile
  524. src/bin/bindctl/Makefile
  525. src/bin/bindctl/tests/Makefile
  526. src/bin/cfgmgr/Makefile
  527. src/bin/cfgmgr/tests/Makefile
  528. src/bin/host/Makefile
  529. src/bin/loadzone/Makefile
  530. src/bin/loadzone/tests/correct/Makefile
  531. src/bin/loadzone/tests/error/Makefile
  532. src/bin/msgq/Makefile
  533. src/bin/msgq/tests/Makefile
  534. src/bin/auth/Makefile
  535. src/bin/auth/tests/Makefile
  536. src/bin/auth/benchmarks/Makefile
  537. src/bin/resolver/Makefile
  538. src/bin/resolver/tests/Makefile
  539. src/bin/xfrin/Makefile
  540. src/bin/xfrin/tests/Makefile
  541. src/bin/xfrout/Makefile
  542. src/bin/xfrout/tests/Makefile
  543. src/bin/zonemgr/Makefile
  544. src/bin/zonemgr/tests/Makefile
  545. src/bin/stats/Makefile
  546. src/bin/stats/tests/Makefile
  547. src/bin/stats/tests/isc/Makefile
  548. src/bin/stats/tests/isc/cc/Makefile
  549. src/bin/stats/tests/isc/config/Makefile
  550. src/bin/stats/tests/isc/util/Makefile
  551. src/bin/stats/tests/testdata/Makefile
  552. src/bin/usermgr/Makefile
  553. src/bin/tests/Makefile
  554. src/lib/Makefile
  555. src/lib/asiolink/Makefile
  556. src/lib/asiolink/tests/Makefile
  557. src/lib/asiolink/internal/Makefile
  558. src/lib/asiolink/internal/tests/Makefile
  559. src/lib/bench/Makefile
  560. src/lib/bench/example/Makefile
  561. src/lib/bench/tests/Makefile
  562. src/lib/cc/Makefile
  563. src/lib/cc/tests/Makefile
  564. src/lib/python/Makefile
  565. src/lib/python/isc/Makefile
  566. src/lib/python/isc/util/Makefile
  567. src/lib/python/isc/util/tests/Makefile
  568. src/lib/python/isc/datasrc/Makefile
  569. src/lib/python/isc/datasrc/tests/Makefile
  570. src/lib/python/isc/cc/Makefile
  571. src/lib/python/isc/cc/tests/Makefile
  572. src/lib/python/isc/config/Makefile
  573. src/lib/python/isc/config/tests/Makefile
  574. src/lib/python/isc/log/Makefile
  575. src/lib/python/isc/log/tests/Makefile
  576. src/lib/python/isc/net/Makefile
  577. src/lib/python/isc/net/tests/Makefile
  578. src/lib/python/isc/notify/Makefile
  579. src/lib/python/isc/notify/tests/Makefile
  580. src/lib/config/Makefile
  581. src/lib/config/tests/Makefile
  582. src/lib/config/tests/testdata/Makefile
  583. src/lib/dns/Makefile
  584. src/lib/dns/tests/Makefile
  585. src/lib/dns/tests/testdata/Makefile
  586. src/lib/dns/python/Makefile
  587. src/lib/dns/python/tests/Makefile
  588. src/lib/exceptions/Makefile
  589. src/lib/exceptions/tests/Makefile
  590. src/lib/datasrc/Makefile
  591. src/lib/datasrc/tests/Makefile
  592. src/lib/xfr/Makefile
  593. src/lib/log/Makefile
  594. src/lib/testutils/Makefile
  595. src/lib/testutils/testdata/Makefile
  596. src/lib/nsas/Makefile
  597. src/lib/nsas/tests/Makefile
  598. ])
  599. AC_OUTPUT([doc/version.ent
  600. src/bin/cfgmgr/b10-cfgmgr.py
  601. src/bin/cfgmgr/tests/b10-cfgmgr_test.py
  602. src/bin/cmdctl/cmdctl.py
  603. src/bin/cmdctl/run_b10-cmdctl.sh
  604. src/bin/cmdctl/tests/cmdctl_test
  605. src/bin/cmdctl/cmdctl.spec.pre
  606. src/bin/xfrin/tests/xfrin_test
  607. src/bin/xfrin/xfrin.py
  608. src/bin/xfrin/run_b10-xfrin.sh
  609. src/bin/xfrout/xfrout.py
  610. src/bin/xfrout/xfrout.spec.pre
  611. src/bin/xfrout/tests/xfrout_test
  612. src/bin/xfrout/run_b10-xfrout.sh
  613. src/bin/resolver/resolver.spec.pre
  614. src/bin/resolver/spec_config.h.pre
  615. src/bin/zonemgr/zonemgr.py
  616. src/bin/zonemgr/zonemgr.spec.pre
  617. src/bin/zonemgr/tests/zonemgr_test
  618. src/bin/zonemgr/run_b10-zonemgr.sh
  619. src/bin/stats/stats.py
  620. src/bin/stats/stats_stub.py
  621. src/bin/stats/stats.spec.pre
  622. src/bin/stats/run_b10-stats.sh
  623. src/bin/stats/run_b10-stats_stub.sh
  624. src/bin/stats/tests/stats_test
  625. src/bin/bind10/bind10.py
  626. src/bin/bind10/tests/bind10_test
  627. src/bin/bind10/run_bind10.sh
  628. src/bin/bindctl/run_bindctl.sh
  629. src/bin/bindctl/bindctl-source.py
  630. src/bin/bindctl/tests/bindctl_test
  631. src/bin/loadzone/run_loadzone.sh
  632. src/bin/loadzone/tests/correct/correct_test.sh
  633. src/bin/loadzone/tests/error/error_test.sh
  634. src/bin/loadzone/b10-loadzone.py
  635. src/bin/usermgr/run_b10-cmdctl-usermgr.sh
  636. src/bin/usermgr/b10-cmdctl-usermgr.py
  637. src/bin/msgq/msgq.py
  638. src/bin/msgq/tests/msgq_test
  639. src/bin/msgq/run_msgq.sh
  640. src/bin/auth/auth.spec.pre
  641. src/bin/auth/spec_config.h.pre
  642. src/bin/tests/process_rename_test.py
  643. src/lib/config/tests/data_def_unittests_config.h
  644. src/lib/python/isc/config/tests/config_test
  645. src/lib/python/isc/cc/tests/cc_test
  646. src/lib/python/isc/log/tests/log_test
  647. src/lib/python/isc/notify/tests/notify_out_test
  648. src/lib/dns/gen-rdatacode.py
  649. src/lib/python/bind10_config.py
  650. src/lib/dns/tests/testdata/gen-wiredata.py
  651. src/lib/cc/session_config.h.pre
  652. src/lib/cc/tests/session_unittests_config.h
  653. ], [
  654. chmod +x src/bin/cmdctl/run_b10-cmdctl.sh
  655. chmod +x src/bin/xfrin/run_b10-xfrin.sh
  656. chmod +x src/bin/xfrout/run_b10-xfrout.sh
  657. chmod +x src/bin/zonemgr/run_b10-zonemgr.sh
  658. chmod +x src/bin/stats/tests/stats_test
  659. chmod +x src/bin/stats/run_b10-stats.sh
  660. chmod +x src/bin/stats/run_b10-stats_stub.sh
  661. chmod +x src/bin/bind10/run_bind10.sh
  662. chmod +x src/bin/cmdctl/tests/cmdctl_test
  663. chmod +x src/bin/xfrin/tests/xfrin_test
  664. chmod +x src/bin/xfrout/tests/xfrout_test
  665. chmod +x src/bin/zonemgr/tests/zonemgr_test
  666. chmod +x src/bin/bindctl/tests/bindctl_test
  667. chmod +x src/bin/bindctl/run_bindctl.sh
  668. chmod +x src/bin/loadzone/run_loadzone.sh
  669. chmod +x src/bin/loadzone/tests/correct/correct_test.sh
  670. chmod +x src/bin/loadzone/tests/error/error_test.sh
  671. chmod +x src/bin/usermgr/run_b10-cmdctl-usermgr.sh
  672. chmod +x src/bin/msgq/run_msgq.sh
  673. chmod +x src/bin/msgq/tests/msgq_test
  674. chmod +x src/lib/dns/gen-rdatacode.py
  675. chmod +x src/lib/dns/tests/testdata/gen-wiredata.py
  676. ])
  677. AC_OUTPUT
  678. dnl Print the results
  679. dnl
  680. cat > config.report << END
  681. BIND 10 source configure results:
  682. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  683. Package:
  684. Name: $PACKAGE_NAME
  685. Version: $PACKAGE_VERSION
  686. C++ Compiler: $CXX
  687. Flags:
  688. DEFS: $DEFS
  689. CPPFLAGS: $CPPFLAGS
  690. CXXFLAGS: $CXXFLAGS
  691. B10_CXXFLAGS: $B10_CXXFLAGS
  692. dnl includes too
  693. Python: ${PYTHON_INCLUDES}
  694. ${PYTHON_LDFLAGS}
  695. ${PYTHON_LIB}
  696. Boost: ${BOOST_INCLUDES}
  697. SQLite: $SQLITE_CFLAGS
  698. $SQLITE_LIBS
  699. Features:
  700. $enable_features
  701. Developer:
  702. Google Tests: $gtest_path
  703. C++ Code Coverage: $USE_LCOV
  704. Python Code Coverage: $USE_PYCOVERAGE
  705. Generate Manuals: $enable_man
  706. END
  707. cat config.report
  708. cat <<EOF
  709. Now you can type "make" to build BIND 10
  710. EOF