configure.ac 14 KB

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