configure.ac 14 KB

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