configure.ac 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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. PYTHON=$python_path
  23. AC_SUBST(PYTHON)
  24. PYTHON_PREFIX='${prefix}'
  25. AC_SUBST(PYTHON_PREFIX)
  26. PYTHON_EXEC_PREFIX='$(exec_prefix)'
  27. AC_SUBST(PYTHON_EXEC_PREFIX)
  28. PYTHON_VERSION=[`$PYTHON -c "import sys; print(sys.version[:3])"`]
  29. AC_SUBST(PYTHON_VERSION)
  30. AM_PYTHON_CHECK_VERSION([$PYTHON], [3.1], [], [AC_MSG_ERROR(["Python version too old: $PYTHON_VERSION, need 3.1 or higher"])])
  31. PYTHON_PLATFORM=`$PYTHON -c "import sys; print(sys.platform)"`
  32. AC_SUBST(PYTHON_PLATFORM)
  33. pythondir='${prefix}/lib/python3.1/site-packages'
  34. AC_SUBST(pythondir)
  35. pkgpythondir='${pythondir}/'$PACKAGE
  36. AC_SUBST(pkgpythondir)
  37. pyexecdir='${exec_prefix}/lib/python3.1/site-packages'
  38. AC_SUBST(pyexecdir)
  39. pkgpyexecdir='${pyexecdir}/'$PACKAGE
  40. AC_SUBST(pkgpyexecdir)
  41. fi
  42. # TODO: check for _sqlite3.py module
  43. # default compiler warning settings
  44. if test "X$GCC" = "Xyes"; then
  45. CXXFLAGS="$CXXFLAGS -g -Wall -Wextra -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare"
  46. UNUSED_PARAM_ATTRIBUTE='__attribute__((unused))'
  47. # Certain versions of gcc (g++) have a bug that incorrectly warns about
  48. # the use of anonymous name spaces even if they're closed in a single
  49. # translation unit. For these versions we have to disable -Werror.
  50. werror_ok=0
  51. CXXFLAGS_SAVED="$CXXFLAGS"
  52. CXXFLAGS="$CXXFLAGS -Werror"
  53. AC_MSG_CHECKING(for in-TU anonymous namespace breakage)
  54. AC_TRY_COMPILE([namespace { class Foo {}; }
  55. namespace isc {class Bar {Foo foo_;};} ],,
  56. [AC_MSG_RESULT(no)
  57. werror_ok=1],
  58. [AC_MSG_RESULT(yes)])
  59. CXXFLAGS="$CXXFLAGS_SAVED"
  60. fi
  61. AC_DEFINE_UNQUOTED(UNUSED_PARAM, $UNUSED_PARAM_ATTRIBUTE, Define to compiler keyword indicating a function argument is intentionally unused)
  62. AM_CONDITIONAL(GCC_WERROR_OK, test $werror_ok = 1)
  63. # produce PIC unless we disable shared libraries. need this for python bindings.
  64. if test $enable_shared != "no" -a "X$GCC" = "Xyes"; then
  65. CXXFLAGS="$CXXFLAGS -fPIC"
  66. fi
  67. # Checks for libraries.
  68. AC_SEARCH_LIBS(inet_pton, [nsl])
  69. AC_SEARCH_LIBS(recvfrom, [socket])
  70. # Checks for header files.
  71. # Checks for typedefs, structures, and compiler characteristics.
  72. AC_HEADER_STDBOOL
  73. AC_TYPE_SIZE_T
  74. AC_MSG_CHECKING(for sa_len in struct sockaddr)
  75. AC_TRY_COMPILE([
  76. #include <sys/types.h>
  77. #include <sys/socket.h>],
  78. [struct sockaddr sa; sa.sa_len = 0; return (0);],
  79. [AC_MSG_RESULT(yes)
  80. AC_DEFINE(HAVE_SIN_LEN, 1, Define to 1 if sockaddr_in has a sin_len member)],
  81. AC_MSG_RESULT(no))
  82. AC_ARG_WITH(lcov,
  83. [ --with-lcov[=PROGRAM] enable gtest and coverage target using the specified lcov], lcov="$withval", lcov="no")
  84. AC_ARG_WITH(gtest,
  85. [ --with-gtest=PATH specify a path to gtest header files (PATH/include) and library (PATH/lib)],
  86. gtest_path="$withval", gtest_path="no")
  87. USE_LCOV="no"
  88. if test "$lcov" != "no"; then
  89. # force gtest if not set
  90. if test "$gtest_path" = "no"; then
  91. # AC_MSG_ERROR("lcov needs gtest for test coverage report")
  92. AC_MSG_NOTICE([gtest support is now enabled, because used by coverage tests])
  93. gtest_path="yes"
  94. fi
  95. if test "$lcov" != "yes"; then
  96. LCOV=$lcov
  97. else
  98. AC_PATH_PROG([LCOV], [lcov])
  99. fi
  100. if test -x "${LCOV}"; then
  101. USE_LCOV="yes"
  102. else
  103. AC_MSG_ERROR([Cannot find lcov.])
  104. fi
  105. # is genhtml always in the same directory?
  106. GENHTML=`echo "$LCOV" | sed s/lcov$/genhtml/`
  107. if test ! -x $GENHTML; then
  108. AC_MSG_ERROR([genhtml not found, needed for lcov])
  109. fi
  110. # GCC specific?
  111. CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage"
  112. LIBS=" $LIBS -lgcov"
  113. AC_SUBST(CPPFLAGS)
  114. AC_SUBST(LIBS)
  115. AC_SUBST(LCOV)
  116. AC_SUBST(GENHTML)
  117. fi
  118. AC_SUBST(USE_LCOV)
  119. AC_ARG_WITH([boost-include],
  120. AC_HELP_STRING([--with-boost-include=PATH],
  121. [specify exact directory for Boost headers]),
  122. [boost_include_path="$withval"])
  123. if test "${boost_include_path}" ; then
  124. CPPFLAGS="$CPPFLAGS -I${boost_include_path}"
  125. else
  126. # abs_top_srcdir not defined yet
  127. # so this is only useful to check but not to use later
  128. CPPFLAGS="$CPPFLAGS -Iext"
  129. fi
  130. # Check availability of the Boost System library
  131. AC_MSG_CHECKING([for boost::system library])
  132. AC_ARG_WITH([boostlib],
  133. AC_HELP_STRING([--with-boostlib=PATH],
  134. [specify a path to boost libraries if it is not automatically found, or "no" to disable it]),
  135. [boostlib_path="$withval"], [boostlib_path="auto"])
  136. if test "$boostlib_path" != "no" -a "$boostlib_path" != "auto" -a "$boostlib_path" != "yes"; then
  137. BOOST_LDFLAGS="-L$boostlib_path"
  138. fi
  139. if test "$boostlib_path" != "no"; then
  140. LDFLAGS_SAVED="$LDFLAGS"
  141. LIBS_SAVED="$LIBS"
  142. CPPFLAGS_SAVED="$CPPFLAGS"
  143. CPPFLAGS="$CPPFLAGS -Iext"
  144. for BOOST_TRY_LIB in boost_system boost_system-mt; do
  145. LDFLAGS="$LDFLAGS_SAVED ${BOOST_LDFLAGS}"
  146. LIBS="$LIBS_SAVED -l${BOOST_TRY_LIB}"
  147. AC_TRY_LINK([#include <boost/system/error_code.hpp>],
  148. [ boost::system::error_code error_code;
  149. std::string message(error_code.message());
  150. return 0; ],
  151. [ AC_MSG_RESULT(yes)
  152. BOOST_SYSTEM_LIB="-l${BOOST_TRY_LIB}"
  153. ],[])
  154. if test "X${BOOST_SYSTEM_LIB}" != X; then
  155. break
  156. fi
  157. done
  158. LDFLAGS="$LDFLAGS_SAVED"
  159. CPPFLAGS="$CPPFLAGS_SAVED"
  160. LIBS="$LIBS_SAVED"
  161. fi
  162. if test "X${BOOST_SYSTEM_LIB}" = X; then
  163. AC_MSG_RESULT(no)
  164. else
  165. AC_DEFINE(HAVE_BOOSTLIB, 1, Define to 1 if boost libraries are available)
  166. fi
  167. AM_CONDITIONAL(HAVE_BOOSTLIB, test "X${BOOST_SYSTEM_LIB}" != X)
  168. AC_SUBST(BOOST_LDFLAGS)
  169. AC_SUBST(BOOST_SYSTEM_LIB)
  170. #
  171. # Check availability of gtest, which will be used for unit tests.
  172. #
  173. if test "$gtest_path" != "no"
  174. then
  175. if test "$gtest_path" != "yes"; then
  176. GTEST_PATHS=$gtest_path
  177. if test -x "${gtest_path}/bin/gtest-config" ; then
  178. GTEST_CONFIG="${gtest_path}/bin/gtest-config"
  179. fi
  180. else
  181. AC_PATH_PROG([GTEST_CONFIG], [gtest-config])
  182. fi
  183. if test -x "${GTEST_CONFIG}" ; then :
  184. # using cppflags instead of cxxflags
  185. GTEST_INCLUDES=`${GTEST_CONFIG} --cppflags`
  186. GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`
  187. GTEST_LDADD=`${GTEST_CONFIG} --libs`
  188. GTEST_FOUND="true"
  189. else
  190. AC_MSG_WARN([Unable to locate Google Test gtest-config.])
  191. if test -z "${GTEST_PATHS}" ; then
  192. GTEST_PATHS="/usr /usr/local"
  193. fi
  194. GTEST_FOUND="false"
  195. fi
  196. if test "${GTEST_FOUND}" != "true"; then
  197. GTEST_FOUND="false"
  198. for dir in $GTEST_PATHS; do
  199. if test -f "$dir/include/gtest/gtest.h"; then
  200. GTEST_INCLUDES="-I$dir/include"
  201. GTEST_LDFLAGS="-L$dir/lib"
  202. GTEST_LDADD="-lgtest"
  203. GTEST_FOUND="true"
  204. break
  205. fi
  206. done
  207. fi
  208. if test "${GTEST_FOUND}" != "true"; then
  209. AC_MSG_ERROR([Cannot find gtest in: $GTEST_PATHS])
  210. fi
  211. else
  212. GTEST_INCLUDES=
  213. GTEST_LDFLAGS=
  214. GTEST_LDADD=
  215. fi
  216. AM_CONDITIONAL(HAVE_GTEST, test $gtest_path != "no")
  217. AC_SUBST(GTEST_INCLUDES)
  218. AC_SUBST(GTEST_LDFLAGS)
  219. AC_SUBST(GTEST_LDADD)
  220. PKG_CHECK_MODULES(SQLITE, sqlite3 >= 3.3.9)
  221. # Check for headers from required devel kits.
  222. # boost/shared_ptr.hpp is in ext in svn but not in tarball.
  223. AC_CHECK_HEADERS([boost/shared_ptr.hpp boost/foreach.hpp],,
  224. AC_MSG_ERROR([Missing required header files.]))
  225. AC_ARG_ENABLE(man, [AC_HELP_STRING([--enable-man],
  226. [regenerate man pages [default=no]])] ,enable_man=yes, enable_man=no)
  227. AM_CONDITIONAL(ENABLE_MAN, test x$enable_man != xno)
  228. AC_ARG_ENABLE(configuration-install,
  229. [AC_HELP_STRING([--enable-configuration-install],
  230. [install configuration [default=yes]])], enable_configuration_install=$enableval, enable_configuration_install=no)
  231. AM_CONDITIONAL(ENABLE_CONFIGURATION_INSTALL, test x$enable_configuration_install != xno)
  232. AC_CONFIG_FILES([Makefile
  233. src/Makefile
  234. src/bin/Makefile
  235. src/bin/bind10/Makefile
  236. src/bin/cmdctl/Makefile
  237. src/bin/bindctl/Makefile
  238. src/bin/cfgmgr/Makefile
  239. src/bin/host/Makefile
  240. src/bin/loadzone/Makefile
  241. src/bin/msgq/Makefile
  242. src/bin/auth/Makefile
  243. src/bin/auth/tests/Makefile
  244. src/bin/xfrin/Makefile
  245. src/bin/usermgr/Makefile
  246. src/lib/Makefile
  247. src/lib/cc/Makefile
  248. src/lib/python/Makefile
  249. src/lib/python/isc/Makefile
  250. src/lib/python/isc/auth/Makefile
  251. src/lib/python/isc/cc/Makefile
  252. src/lib/python/isc/config/Makefile
  253. src/lib/config/Makefile
  254. src/lib/config/tests/Makefile
  255. src/lib/dns/Makefile
  256. src/lib/dns/tests/Makefile
  257. src/lib/exceptions/Makefile
  258. src/lib/auth/Makefile
  259. src/lib/auth/tests/Makefile
  260. ])
  261. AC_OUTPUT([src/bin/cfgmgr/b10-cfgmgr.py
  262. src/bin/cmdctl/cmdctl.py
  263. src/bin/cmdctl/run_b10-cmdctl.sh
  264. src/bin/cmdctl/unittest/cmdctl_test
  265. src/bin/xfrin/unittest/xfrin_test
  266. src/bin/xfrin/xfrin.py
  267. src/bin/xfrin/xfrin.pre
  268. src/bin/xfrin/run_b10-xfrin.sh
  269. src/bin/bind10/bind10.py
  270. src/bin/bind10/tests/bind10_test
  271. src/bin/bind10/run_bind10.sh
  272. src/bin/bindctl/run_bindctl.sh
  273. src/bin/bindctl/bindctl-source.py
  274. src/bin/bindctl/unittest/bindctl_test
  275. src/bin/loadzone/run_loadzone.sh
  276. src/bin/loadzone/b10-loadzone.py
  277. src/bin/usermgr/run_b10-cmdctl-usermgr.sh
  278. src/bin/usermgr/b10-cmdctl-usermgr.py
  279. src/bin/msgq/msgq.py
  280. src/bin/msgq/msgq_test
  281. src/bin/msgq/run_msgq.sh
  282. src/bin/auth/auth.pre
  283. src/bin/auth/spec_config.h
  284. src/lib/config/tests/data_def_unittests_config.h
  285. src/lib/python/isc/config/tests/config_test
  286. src/lib/python/isc/cc/tests/cc_test
  287. src/lib/dns/gen-rdatacode.py
  288. src/lib/dns/tests/testdata/gen-wiredata.py
  289. ], [
  290. chmod +x src/bin/cmdctl/run_b10-cmdctl.sh
  291. chmod +x src/bin/xfrin/run_b10-xfrin.sh
  292. chmod +x src/bin/bind10/run_bind10.sh
  293. chmod +x src/bin/cmdctl/unittest/cmdctl_test
  294. chmod +x src/bin/xfrin/unittest/xfrin_test
  295. chmod +x src/bin/bindctl/unittest/bindctl_test
  296. chmod +x src/bin/bindctl/run_bindctl.sh
  297. chmod +x src/bin/loadzone/run_loadzone.sh
  298. chmod +x src/bin/usermgr/run_b10-cmdctl-usermgr.sh
  299. chmod +x src/bin/msgq/run_msgq.sh
  300. chmod +x src/bin/msgq/msgq_test
  301. chmod +x src/lib/dns/gen-rdatacode.py
  302. chmod +x src/lib/dns/tests/testdata/gen-wiredata.py
  303. ])
  304. AC_OUTPUT