configure.ac 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. AC_PREREQ([2.59])
  4. AC_INIT(bind10-devel, 20100318, bind10-bugs@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. AC_PROG_CC
  11. AC_PROG_LIBTOOL
  12. # Use C++ language
  13. AC_LANG_CPLUSPLUS
  14. m4_define([_AM_PYTHON_INTERPRETER_LIST], [python python3 python3.1])
  15. AC_ARG_WITH([pythonpath],
  16. AC_HELP_STRING([--with-pythonpath=PATH],
  17. [specify an absolute path to python executable when automatic version check (incorrectly) fails]),
  18. [python_path="$withval"], [python_path="auto"])
  19. if test "$python_path" = auto; then
  20. AM_PATH_PYTHON([3.1])
  21. else
  22. # Older versions of automake can't handle python3 well. This is an
  23. # in-house workaround for them.
  24. PYTHON=$python_path
  25. AC_SUBST(PYTHON)
  26. PYTHON_PREFIX='${prefix}'
  27. AC_SUBST(PYTHON_PREFIX)
  28. PYTHON_EXEC_PREFIX='$(exec_prefix)'
  29. AC_SUBST(PYTHON_EXEC_PREFIX)
  30. PYTHON_VERSION=[`$PYTHON -c "import sys; sys.stdout.write(sys.version[:3])"`]
  31. if test `echo "$PYTHON_VERSION >= 3.1" | bc` != 1 ; then
  32. AC_MSG_ERROR(["Python version too old: $PYTHON_VERSION, need 3.1 or higher"])
  33. fi
  34. AC_SUBST(PYTHON_VERSION)
  35. PYTHON_PLATFORM=`$PYTHON -c "import sys; print(sys.platform)"`
  36. AC_SUBST(PYTHON_PLATFORM)
  37. pythondir='${prefix}/lib/python'$PYTHON_VERSION'/site-packages'
  38. AC_SUBST(pythondir)
  39. pkgpythondir='${pythondir}/'$PACKAGE
  40. AC_SUBST(pkgpythondir)
  41. pyexecdir='${exec_prefix}/lib/python'$PYTHON_VERSION'/site-packages'
  42. AC_SUBST(pyexecdir)
  43. pkgpyexecdir='${pyexecdir}/'$PACKAGE
  44. AC_SUBST(pkgpyexecdir)
  45. fi
  46. if test ! -x ${PYTHON}-config; then
  47. AC_MSG_ERROR([${PYTHON}-config not found])
  48. fi
  49. PYTHON_INCLUDES=`${PYTHON}-config --includes`
  50. AC_SUBST(PYTHON_INCLUDES)
  51. for flag in `${PYTHON}-config --ldflags`; do
  52. PYTHON_LDFLAGS="$PYTHON_LDFLAGS `echo $flag | sed -ne 's/^\(\-L.*\)$/\1/p'`"
  53. done
  54. AC_SUBST(PYTHON_LDFLAGS)
  55. CPPFLAGS_SAVED="$CPPFLAGS"
  56. CPPFLAGS="$CPPFLAGS ${PYTHON_INCLUDES}"
  57. AC_CHECK_HEADERS([Python.h],, AC_MSG_ERROR([Missing Python.h]))
  58. CPPFLAGS="$CPPFLAGS_SAVED"
  59. # Check for python library (not absolutely mandatory, but needed for
  60. # Boost.Python when we use it. See below.)
  61. LDFLAGS_SAVED="$LDFLAGS"
  62. LDFLAGS="$LDFLAGS $PYTHON_LDFLAGS"
  63. python_bin="python${PYTHON_VERSION}"
  64. AC_CHECK_LIB($python_bin, main, python_lib=$python_bin, python_lib=no)
  65. if test $python_lib != "no"; then
  66. PYTHON_LIB="-l$python_lib"
  67. fi
  68. AC_SUBST(PYTHON_LIB)
  69. # TODO: check for _sqlite3.py module
  70. # default compiler warning settings
  71. if test "X$GCC" = "Xyes"; then
  72. CXXFLAGS="$CXXFLAGS -g -Wall -Wextra -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare"
  73. UNUSED_PARAM_ATTRIBUTE='__attribute__((unused))'
  74. # Certain versions of gcc (g++) have a bug that incorrectly warns about
  75. # the use of anonymous name spaces even if they're closed in a single
  76. # translation unit. For these versions we have to disable -Werror.
  77. werror_ok=0
  78. CXXFLAGS_SAVED="$CXXFLAGS"
  79. CXXFLAGS="$CXXFLAGS -Werror"
  80. AC_MSG_CHECKING(for in-TU anonymous namespace breakage)
  81. AC_TRY_COMPILE([namespace { class Foo {}; }
  82. namespace isc {class Bar {Foo foo_;};} ],,
  83. [AC_MSG_RESULT(no)
  84. werror_ok=1],
  85. [AC_MSG_RESULT(yes)])
  86. CXXFLAGS="$CXXFLAGS_SAVED"
  87. fi
  88. AC_DEFINE_UNQUOTED(UNUSED_PARAM, $UNUSED_PARAM_ATTRIBUTE, Define to compiler keyword indicating a function argument is intentionally unused)
  89. AM_CONDITIONAL(GCC_WERROR_OK, test $werror_ok = 1)
  90. # produce PIC unless we disable shared libraries. need this for python bindings.
  91. if test $enable_shared != "no" -a "X$GCC" = "Xyes"; then
  92. CXXFLAGS="$CXXFLAGS -fPIC"
  93. fi
  94. # Checks for libraries.
  95. AC_SEARCH_LIBS(inet_pton, [nsl])
  96. AC_SEARCH_LIBS(recvfrom, [socket])
  97. # Checks for header files.
  98. # Checks for typedefs, structures, and compiler characteristics.
  99. AC_HEADER_STDBOOL
  100. AC_TYPE_SIZE_T
  101. AC_MSG_CHECKING(for sa_len in struct sockaddr)
  102. AC_TRY_COMPILE([
  103. #include <sys/types.h>
  104. #include <sys/socket.h>],
  105. [struct sockaddr sa; sa.sa_len = 0; return (0);],
  106. [AC_MSG_RESULT(yes)
  107. AC_DEFINE(HAVE_SIN_LEN, 1, Define to 1 if sockaddr_in has a sin_len member)],
  108. AC_MSG_RESULT(no))
  109. AC_ARG_WITH(lcov,
  110. [ --with-lcov[=PROGRAM] enable gtest and coverage target using the specified lcov], lcov="$withval", lcov="no")
  111. AC_ARG_WITH(gtest,
  112. [ --with-gtest=PATH specify a path to gtest header files (PATH/include) and library (PATH/lib)],
  113. gtest_path="$withval", gtest_path="no")
  114. USE_LCOV="no"
  115. if test "$lcov" != "no"; then
  116. # force gtest if not set
  117. if test "$gtest_path" = "no"; then
  118. # AC_MSG_ERROR("lcov needs gtest for test coverage report")
  119. AC_MSG_NOTICE([gtest support is now enabled, because used by coverage tests])
  120. gtest_path="yes"
  121. fi
  122. if test "$lcov" != "yes"; then
  123. LCOV=$lcov
  124. else
  125. AC_PATH_PROG([LCOV], [lcov])
  126. fi
  127. if test -x "${LCOV}"; then
  128. USE_LCOV="yes"
  129. else
  130. AC_MSG_ERROR([Cannot find lcov.])
  131. fi
  132. # is genhtml always in the same directory?
  133. GENHTML=`echo "$LCOV" | sed s/lcov$/genhtml/`
  134. if test ! -x $GENHTML; then
  135. AC_MSG_ERROR([genhtml not found, needed for lcov])
  136. fi
  137. # GCC specific?
  138. CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage"
  139. LIBS=" $LIBS -lgcov"
  140. AC_SUBST(CPPFLAGS)
  141. AC_SUBST(LIBS)
  142. AC_SUBST(LCOV)
  143. AC_SUBST(GENHTML)
  144. fi
  145. AC_SUBST(USE_LCOV)
  146. AC_ARG_WITH([boost-include],
  147. AC_HELP_STRING([--with-boost-include=PATH],
  148. [specify exact directory for Boost headers]),
  149. [boost_include_path="$withval"])
  150. if test "${boost_include_path}" ; then
  151. BOOST_INCLUDES="-I${boost_include_path}"
  152. CPPFLAGS="$CPPFLAGS $BOOST_INCLUDES"
  153. fi
  154. AC_SUBST(BOOST_INCLUDES)
  155. AC_ARG_WITH([boost-lib],
  156. AC_HELP_STRING([--with-boost-lib=PATH],
  157. [specify exact directory for Boost libraries]),
  158. [if test "$withval" != "yes" -a "$withval" != "no"; then
  159. BOOST_LDFLAGS="-L$withval"
  160. fi])
  161. AC_SUBST(BOOST_LDFLAGS)
  162. # Check availability of the Boost System library
  163. AC_MSG_CHECKING([for boost::system library])
  164. AC_ARG_WITH([boost-system],
  165. AC_HELP_STRING([--with-boost-system],
  166. [specify whether to use the boost system library]),
  167. [with_boost_system="$withval"], [with_boost_system="auto"])
  168. if test "$with_boost_system" != "no"; then
  169. LDFLAGS_SAVED="$LDFLAGS"
  170. LIBS_SAVED="$LIBS"
  171. CPPFLAGS_SAVED="$CPPFLAGS"
  172. CPPFLAGS="$CPPFLAGS -Iext"
  173. for BOOST_TRY_LIB in boost_system boost_system-mt; do
  174. LDFLAGS="$LDFLAGS_SAVED ${BOOST_LDFLAGS}"
  175. LIBS="$LIBS_SAVED -l${BOOST_TRY_LIB}"
  176. AC_TRY_LINK([#include <boost/system/error_code.hpp>],
  177. [ boost::system::error_code error_code;
  178. std::string message(error_code.message());
  179. return 0; ],
  180. [ AC_MSG_RESULT(yes)
  181. BOOST_SYSTEM_LIB="-l${BOOST_TRY_LIB}"
  182. ],[])
  183. if test "X${BOOST_SYSTEM_LIB}" != X; then
  184. break
  185. fi
  186. done
  187. LDFLAGS="$LDFLAGS_SAVED"
  188. CPPFLAGS="$CPPFLAGS_SAVED"
  189. LIBS="$LIBS_SAVED"
  190. fi
  191. if test "X${BOOST_SYSTEM_LIB}" = X; then
  192. AC_MSG_RESULT(no)
  193. if test "$with_boost_system" = "yes"; then
  194. AC_MSG_ERROR([boost system library is requested but not found])
  195. fi
  196. else
  197. AC_DEFINE(HAVE_BOOST_SYSTEM, 1, Define to 1 if boost system library is available)
  198. fi
  199. AM_CONDITIONAL(HAVE_BOOST_SYSTEM, test "X${BOOST_SYSTEM_LIB}" != X)
  200. AC_SUBST(BOOST_SYSTEM_LIB)
  201. # Check availability of the Boost Python library
  202. AC_MSG_CHECKING([for boost::python library])
  203. AC_ARG_WITH([boost-python],
  204. AC_HELP_STRING([--with-boost-python],
  205. [specify whether to use the boost python library]),
  206. [with_boost_python="$withval"], [with_boost_python="auto"])
  207. if test "$with_boost_python" != "no"; then
  208. if test "$with_boost_python" != "auto" -a "X$PYTHON_LIB" = X; then
  209. AC_MSG_ERROR([Boost.Python requested but python library is not available])
  210. fi
  211. LDFLAGS_SAVED="$LDFLAGS"
  212. LIBS_SAVED="$LIBS"
  213. CPPFLAGS_SAVED="$CPPFLAGS"
  214. CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
  215. for BOOST_TRY_LIB in boost_python boost_python-mt; do
  216. LDFLAGS="$LDFLAGS_SAVED ${BOOST_LDFLAGS} ${PYTHON_LDFLAGS}"
  217. LIBS="$LIBS_SAVED -l${BOOST_TRY_LIB} ${PYTHON_LIB}"
  218. AC_TRY_LINK([#include <boost/python/module.hpp>
  219. using namespace boost::python;
  220. BOOST_PYTHON_MODULE(test) { throw "Boost::Python test."; }],
  221. [ return 0; ],
  222. [ AC_MSG_RESULT(yes)
  223. BOOST_PYTHON_LIB="-l${BOOST_TRY_LIB}"
  224. ],[])
  225. if test "X${BOOST_PYTHON_LIB}" != X; then
  226. break
  227. fi
  228. done
  229. LDFLAGS="$LDFLAGS_SAVED"
  230. CPPFLAGS="$CPPFLAGS_SAVED"
  231. LIBS="$LIBS_SAVED"
  232. fi
  233. if test "X${BOOST_PYTHON_LIB}" = X; then
  234. AC_MSG_RESULT(no)
  235. if test "$with_boost_python" = "yes"; then
  236. AC_MSG_ERROR([boost python library is requested but not found])
  237. fi
  238. else
  239. AC_DEFINE(HAVE_BOOST_PYTHON, 1, Define to 1 if boost python library is available)
  240. fi
  241. AM_CONDITIONAL(HAVE_BOOST_PYTHON, test "X${BOOST_PYTHON_LIB}" != X)
  242. AC_SUBST(BOOST_PYTHON_LIB)
  243. #
  244. # Check availability of gtest, which will be used for unit tests.
  245. #
  246. if test "$gtest_path" != "no"
  247. then
  248. if test "$gtest_path" != "yes"; then
  249. GTEST_PATHS=$gtest_path
  250. if test -x "${gtest_path}/bin/gtest-config" ; then
  251. GTEST_CONFIG="${gtest_path}/bin/gtest-config"
  252. fi
  253. else
  254. AC_PATH_PROG([GTEST_CONFIG], [gtest-config])
  255. fi
  256. if test -x "${GTEST_CONFIG}" ; then :
  257. # using cppflags instead of cxxflags
  258. GTEST_INCLUDES=`${GTEST_CONFIG} --cppflags`
  259. GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`
  260. GTEST_LDADD=`${GTEST_CONFIG} --libs`
  261. GTEST_FOUND="true"
  262. else
  263. AC_MSG_WARN([Unable to locate Google Test gtest-config.])
  264. if test -z "${GTEST_PATHS}" ; then
  265. GTEST_PATHS="/usr /usr/local"
  266. fi
  267. GTEST_FOUND="false"
  268. fi
  269. if test "${GTEST_FOUND}" != "true"; then
  270. GTEST_FOUND="false"
  271. for dir in $GTEST_PATHS; do
  272. if test -f "$dir/include/gtest/gtest.h"; then
  273. GTEST_INCLUDES="-I$dir/include"
  274. GTEST_LDFLAGS="-L$dir/lib"
  275. GTEST_LDADD="-lgtest"
  276. GTEST_FOUND="true"
  277. break
  278. fi
  279. done
  280. fi
  281. if test "${GTEST_FOUND}" != "true"; then
  282. AC_MSG_ERROR([Cannot find gtest in: $GTEST_PATHS])
  283. fi
  284. else
  285. GTEST_INCLUDES=
  286. GTEST_LDFLAGS=
  287. GTEST_LDADD=
  288. fi
  289. AM_CONDITIONAL(HAVE_GTEST, test $gtest_path != "no")
  290. AC_SUBST(GTEST_INCLUDES)
  291. AC_SUBST(GTEST_LDFLAGS)
  292. AC_SUBST(GTEST_LDADD)
  293. PKG_CHECK_MODULES(SQLITE, sqlite3 >= 3.3.9)
  294. # Check for headers from required devel kits.
  295. # boost/shared_ptr.hpp is in ext in svn but not in tarball.
  296. CPPFLAGS_SAVED=$CPPFLAGS
  297. if test "X$BOOST_INCLUDES" = "X"; then
  298. # abs_top_srcdir not defined yet
  299. # so this is only useful to check. We'll replace it after the check.
  300. CPPFLAGS="$CPPFLAGS -Iext"
  301. fi
  302. AC_CHECK_HEADERS([boost/shared_ptr.hpp boost/foreach.hpp],,
  303. AC_MSG_ERROR([Missing required header files.]))
  304. CPPFLAGS=$CPPFLAGS_SAVED
  305. if test "X$BOOST_INCLUDES" = "X"; then
  306. CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/ext"
  307. fi
  308. AC_ARG_ENABLE(man, [AC_HELP_STRING([--enable-man],
  309. [regenerate man pages [default=no]])] ,enable_man=yes, enable_man=no)
  310. AM_CONDITIONAL(ENABLE_MAN, test x$enable_man != xno)
  311. AC_ARG_ENABLE(install-configurations,
  312. [AC_HELP_STRING([--disable-install-configurations],
  313. [do not install configuration])], install_configurations=$enableval, install_configurations=yes)
  314. AM_CONDITIONAL(INSTALL_CONFIGURATIONS, test x$install_configurations = xyes || test x$install_configurations = xtrue)
  315. AC_CONFIG_FILES([Makefile
  316. src/Makefile
  317. src/bin/Makefile
  318. src/bin/bind10/Makefile
  319. src/bin/cmdctl/Makefile
  320. src/bin/bindctl/Makefile
  321. src/bin/cfgmgr/Makefile
  322. src/bin/host/Makefile
  323. src/bin/loadzone/Makefile
  324. src/bin/msgq/Makefile
  325. src/bin/auth/Makefile
  326. src/bin/auth/tests/Makefile
  327. src/bin/xfrin/Makefile
  328. src/bin/xfrout/Makefile
  329. src/bin/usermgr/Makefile
  330. src/lib/Makefile
  331. src/lib/cc/Makefile
  332. src/lib/python/Makefile
  333. src/lib/python/isc/Makefile
  334. src/lib/python/isc/auth/Makefile
  335. src/lib/python/isc/cc/Makefile
  336. src/lib/python/isc/config/Makefile
  337. src/lib/config/Makefile
  338. src/lib/config/tests/Makefile
  339. src/lib/dns/Makefile
  340. src/lib/dns/tests/Makefile
  341. src/lib/dns/python/Makefile
  342. src/lib/dns-python/Makefile
  343. src/lib/exceptions/Makefile
  344. src/lib/auth/Makefile
  345. src/lib/auth/tests/Makefile
  346. src/lib/xfr/Makefile
  347. ])
  348. AC_OUTPUT([src/bin/cfgmgr/b10-cfgmgr.py
  349. src/bin/cmdctl/cmdctl.py
  350. src/bin/cmdctl/run_b10-cmdctl.sh
  351. src/bin/cmdctl/tests/cmdctl_test
  352. src/bin/xfrin/tests/xfrin_test
  353. src/bin/xfrin/xfrin.py
  354. src/bin/xfrin/xfrin.spec.pre
  355. src/bin/xfrin/run_b10-xfrin.sh
  356. src/bin/xfrout/xfrout.py
  357. src/bin/xfrout/xfrout.spec.pre
  358. src/bin/xfrout/tests/xfrout_test
  359. src/bin/xfrout/run_b10-xfrout.sh
  360. src/bin/bind10/bind10.py
  361. src/bin/bind10/tests/bind10_test
  362. src/bin/bind10/run_bind10.sh
  363. src/bin/bindctl/run_bindctl.sh
  364. src/bin/bindctl/bindctl-source.py
  365. src/bin/bindctl/tests/bindctl_test
  366. src/bin/loadzone/run_loadzone.sh
  367. src/bin/loadzone/b10-loadzone.py
  368. src/bin/usermgr/run_b10-cmdctl-usermgr.sh
  369. src/bin/usermgr/b10-cmdctl-usermgr.py
  370. src/bin/msgq/msgq.py
  371. src/bin/msgq/msgq_test
  372. src/bin/msgq/run_msgq.sh
  373. src/bin/auth/auth.spec.pre
  374. src/bin/auth/spec_config.h
  375. src/lib/config/tests/data_def_unittests_config.h
  376. src/lib/python/isc/config/tests/config_test
  377. src/lib/python/isc/cc/tests/cc_test
  378. src/lib/dns/python/tests/libdns_python_test
  379. src/lib/dns/gen-rdatacode.py
  380. src/lib/dns/tests/testdata/gen-wiredata.py
  381. ], [
  382. chmod +x src/bin/cmdctl/run_b10-cmdctl.sh
  383. chmod +x src/bin/xfrin/run_b10-xfrin.sh
  384. chmod +x src/bin/xfrout/run_b10-xfrout.sh
  385. chmod +x src/bin/bind10/run_bind10.sh
  386. chmod +x src/bin/cmdctl/tests/cmdctl_test
  387. chmod +x src/bin/xfrin/tests/xfrin_test
  388. chmod +x src/bin/xfrout/tests/xfrout_test
  389. chmod +x src/bin/bindctl/tests/bindctl_test
  390. chmod +x src/bin/bindctl/run_bindctl.sh
  391. chmod +x src/bin/loadzone/run_loadzone.sh
  392. chmod +x src/bin/usermgr/run_b10-cmdctl-usermgr.sh
  393. chmod +x src/bin/msgq/run_msgq.sh
  394. chmod +x src/bin/msgq/msgq_test
  395. chmod +x src/lib/dns/gen-rdatacode.py
  396. chmod +x src/lib/dns/tests/testdata/gen-wiredata.py
  397. chmod +x src/lib/dns/python/tests/libdns_python_test
  398. ])
  399. AC_OUTPUT