configure.ac 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  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. [if test "$withval" != "yes" -a "$withval" != "no"; then
  152. BOOST_LDFLAGS="-L$withval"
  153. fi])
  154. AC_SUBST(BOOST_LDFLAGS)
  155. # Check availability of the Boost System library
  156. AC_MSG_CHECKING([for boost::system library])
  157. AC_ARG_WITH([boost-system],
  158. AC_HELP_STRING([--with-boost-system],
  159. [specify whether to use the boost system library]),
  160. [with_boost_system="$withval"], [with_boost_system="auto"])
  161. if test "$with_boost_system" != "no"; then
  162. LDFLAGS_SAVED="$LDFLAGS"
  163. LIBS_SAVED="$LIBS"
  164. CPPFLAGS_SAVED="$CPPFLAGS"
  165. CPPFLAGS="$CPPFLAGS -Iext"
  166. for BOOST_TRY_LIB in boost_system boost_system-mt; do
  167. LDFLAGS="$LDFLAGS_SAVED ${BOOST_LDFLAGS}"
  168. LIBS="$LIBS_SAVED -l${BOOST_TRY_LIB}"
  169. AC_TRY_LINK([#include <boost/system/error_code.hpp>],
  170. [ boost::system::error_code error_code;
  171. std::string message(error_code.message());
  172. return 0; ],
  173. [ AC_MSG_RESULT(yes)
  174. BOOST_SYSTEM_LIB="-l${BOOST_TRY_LIB}"
  175. ],[])
  176. if test "X${BOOST_SYSTEM_LIB}" != X; then
  177. break
  178. fi
  179. done
  180. LDFLAGS="$LDFLAGS_SAVED"
  181. CPPFLAGS="$CPPFLAGS_SAVED"
  182. LIBS="$LIBS_SAVED"
  183. fi
  184. if test "X${BOOST_SYSTEM_LIB}" = X; then
  185. AC_MSG_RESULT(no)
  186. if test "$with_boost_system" = "yes"; then
  187. AC_MSG_ERROR([boost system library is requested but not found])
  188. fi
  189. else
  190. AC_DEFINE(HAVE_BOOST_SYSTEM, 1, Define to 1 if boost system library is available)
  191. fi
  192. AM_CONDITIONAL(HAVE_BOOST_SYSTEM, test "X${BOOST_SYSTEM_LIB}" != X)
  193. AC_SUBST(BOOST_SYSTEM_LIB)
  194. # Check availability of the Boost Python library
  195. AC_MSG_CHECKING([for boost::python library])
  196. AC_ARG_WITH([boost-python],
  197. AC_HELP_STRING([--with-boost-python],
  198. [specify whether to use the boost python library]),
  199. [with_boost_python="$withval"], [with_boost_python="auto"])
  200. if test "$with_boost_python" != "no"; then
  201. if test "$with_boost_python" != "auto" -a "X$PYTHON_LIB" = X; then
  202. AC_MSG_ERROR([Boost.Python requested but python library is not available])
  203. fi
  204. LDFLAGS_SAVED="$LDFLAGS"
  205. LIBS_SAVED="$LIBS"
  206. CPPFLAGS_SAVED="$CPPFLAGS"
  207. CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
  208. for BOOST_TRY_LIB in boost_python boost_python-mt; do
  209. LDFLAGS="$LDFLAGS_SAVED ${BOOST_LDFLAGS} ${PYTHON_LDFLAGS}"
  210. LIBS="$LIBS_SAVED -l${BOOST_TRY_LIB} ${PYTHON_LIB}"
  211. AC_TRY_LINK([#include <boost/python/module.hpp>
  212. using namespace boost::python;
  213. BOOST_PYTHON_MODULE(test) { throw "Boost::Python test."; }],
  214. [ return 0; ],
  215. [ AC_MSG_RESULT(yes)
  216. BOOST_PYTHON_LIB="-l${BOOST_TRY_LIB}"
  217. ],[])
  218. if test "X${BOOST_PYTHON_LIB}" != X; then
  219. break
  220. fi
  221. done
  222. LDFLAGS="$LDFLAGS_SAVED"
  223. CPPFLAGS="$CPPFLAGS_SAVED"
  224. LIBS="$LIBS_SAVED"
  225. fi
  226. if test "X${BOOST_PYTHON_LIB}" = X; then
  227. AC_MSG_RESULT(no)
  228. if test "$with_boost_python" = "yes"; then
  229. AC_MSG_ERROR([boost python library is requested but not found])
  230. fi
  231. else
  232. AC_DEFINE(HAVE_BOOST_PYTHON, 1, Define to 1 if boost python library is available)
  233. fi
  234. AM_CONDITIONAL(HAVE_BOOST_PYTHON, test "X${BOOST_PYTHON_LIB}" != X)
  235. AC_SUBST(BOOST_PYTHON_LIB)
  236. #
  237. # Check availability of gtest, which will be used for unit tests.
  238. #
  239. if test "$gtest_path" != "no"
  240. then
  241. if test "$gtest_path" != "yes"; then
  242. GTEST_PATHS=$gtest_path
  243. if test -x "${gtest_path}/bin/gtest-config" ; then
  244. GTEST_CONFIG="${gtest_path}/bin/gtest-config"
  245. fi
  246. else
  247. AC_PATH_PROG([GTEST_CONFIG], [gtest-config])
  248. fi
  249. if test -x "${GTEST_CONFIG}" ; then :
  250. # using cppflags instead of cxxflags
  251. GTEST_INCLUDES=`${GTEST_CONFIG} --cppflags`
  252. GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`
  253. GTEST_LDADD=`${GTEST_CONFIG} --libs`
  254. GTEST_FOUND="true"
  255. else
  256. AC_MSG_WARN([Unable to locate Google Test gtest-config.])
  257. if test -z "${GTEST_PATHS}" ; then
  258. GTEST_PATHS="/usr /usr/local"
  259. fi
  260. GTEST_FOUND="false"
  261. fi
  262. if test "${GTEST_FOUND}" != "true"; then
  263. GTEST_FOUND="false"
  264. for dir in $GTEST_PATHS; do
  265. if test -f "$dir/include/gtest/gtest.h"; then
  266. GTEST_INCLUDES="-I$dir/include"
  267. GTEST_LDFLAGS="-L$dir/lib"
  268. GTEST_LDADD="-lgtest"
  269. GTEST_FOUND="true"
  270. break
  271. fi
  272. done
  273. fi
  274. if test "${GTEST_FOUND}" != "true"; then
  275. AC_MSG_ERROR([Cannot find gtest in: $GTEST_PATHS])
  276. fi
  277. else
  278. GTEST_INCLUDES=
  279. GTEST_LDFLAGS=
  280. GTEST_LDADD=
  281. fi
  282. AM_CONDITIONAL(HAVE_GTEST, test $gtest_path != "no")
  283. AC_SUBST(GTEST_INCLUDES)
  284. AC_SUBST(GTEST_LDFLAGS)
  285. AC_SUBST(GTEST_LDADD)
  286. PKG_CHECK_MODULES(SQLITE, sqlite3 >= 3.3.9)
  287. # Check for headers from required devel kits.
  288. # boost/shared_ptr.hpp is in ext in svn but not in tarball.
  289. CPPFLAGS_SAVED=$CPPFLAGS
  290. if test "X$BOOST_INCLUDES" = "X"; then
  291. # abs_top_srcdir not defined yet
  292. # so this is only useful to check. We'll replace it after the check.
  293. CPPFLAGS="$CPPFLAGS -Iext"
  294. fi
  295. AC_CHECK_HEADERS([boost/shared_ptr.hpp boost/foreach.hpp],,
  296. AC_MSG_ERROR([Missing required header files.]))
  297. CPPFLAGS=$CPPFLAGS_SAVED
  298. if test "X$BOOST_INCLUDES" = "X"; then
  299. CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/ext"
  300. fi
  301. AC_ARG_ENABLE(man, [AC_HELP_STRING([--enable-man],
  302. [regenerate man pages [default=no]])] ,enable_man=yes, enable_man=no)
  303. AM_CONDITIONAL(ENABLE_MAN, test x$enable_man != xno)
  304. AC_ARG_ENABLE(install-configurations,
  305. [AC_HELP_STRING([--disable-install-configurations],
  306. [do not install configuration])], install_configurations=$enableval, install_configurations=yes)
  307. AM_CONDITIONAL(INSTALL_CONFIGURATIONS, test x$install_configurations = xyes || test x$install_configurations = xtrue)
  308. AC_CONFIG_FILES([Makefile
  309. src/Makefile
  310. src/bin/Makefile
  311. src/bin/bind10/Makefile
  312. src/bin/cmdctl/Makefile
  313. src/bin/bindctl/Makefile
  314. src/bin/cfgmgr/Makefile
  315. src/bin/host/Makefile
  316. src/bin/loadzone/Makefile
  317. src/bin/msgq/Makefile
  318. src/bin/auth/Makefile
  319. src/bin/auth/tests/Makefile
  320. src/bin/xfrin/Makefile
  321. src/bin/xfrout/Makefile
  322. src/bin/usermgr/Makefile
  323. src/lib/Makefile
  324. src/lib/cc/Makefile
  325. src/lib/python/Makefile
  326. src/lib/python/isc/Makefile
  327. src/lib/python/isc/auth/Makefile
  328. src/lib/python/isc/cc/Makefile
  329. src/lib/python/isc/config/Makefile
  330. src/lib/config/Makefile
  331. src/lib/config/tests/Makefile
  332. src/lib/dns/Makefile
  333. src/lib/dns/tests/Makefile
  334. src/lib/exceptions/Makefile
  335. src/lib/auth/Makefile
  336. src/lib/auth/tests/Makefile
  337. src/lib/xfr/Makefile
  338. ])
  339. AC_OUTPUT([src/bin/cfgmgr/b10-cfgmgr.py
  340. src/bin/cmdctl/cmdctl.py
  341. src/bin/cmdctl/run_b10-cmdctl.sh
  342. src/bin/cmdctl/tests/cmdctl_test
  343. src/bin/xfrin/tests/xfrin_test
  344. src/bin/xfrin/xfrin.py
  345. src/bin/xfrin/xfrin.spec.pre
  346. src/bin/xfrin/run_b10-xfrin.sh
  347. src/bin/xfrout/xfrout.py
  348. src/bin/xfrout/xfrout.spec.pre
  349. src/bin/xfrout/tests/xfrout_test
  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/tests/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.spec.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/tests/cmdctl_test
  377. chmod +x src/bin/xfrin/tests/xfrin_test
  378. chmod +x src/bin/xfrout/tests/xfrout_test
  379. chmod +x src/bin/bindctl/tests/bindctl_test
  380. chmod +x src/bin/bindctl/run_bindctl.sh
  381. chmod +x src/bin/loadzone/run_loadzone.sh
  382. chmod +x src/bin/usermgr/run_b10-cmdctl-usermgr.sh
  383. chmod +x src/bin/msgq/run_msgq.sh
  384. chmod +x src/bin/msgq/msgq_test
  385. chmod +x src/lib/dns/gen-rdatacode.py
  386. chmod +x src/lib/dns/tests/testdata/gen-wiredata.py
  387. ])
  388. AC_OUTPUT