configure.ac 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. AC_PREREQ([2.59])
  4. AC_INIT(bind10, 10.0.0, 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. AX_COMPILER_VENDOR
  15. m4_define([_AM_PYTHON_INTERPRETER_LIST], [python python3 python3.1])
  16. AM_PATH_PYTHON([3.1])
  17. # TODO: check for _sqlite3.py module
  18. # default compiler warning settings
  19. if test "X$GCC" = "Xyes"; then
  20. CXXFLAGS="$CXXFLAGS -g -Wall -Wextra -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare"
  21. UNUSED_PARAM_ATTRIBUTE='__attribute__((unused))'
  22. # Certain versions of gcc (g++) have a bug that incorrectly warns about
  23. # the use of anonymous name spaces even if they're closed in a single
  24. # translation unit. For these versions we have to disable -Werror.
  25. werror_ok=0
  26. CXXFLAGS_SAVED="$CXXFLAGS"
  27. CXXFLAGS="$CXXFLAGS -Werror"
  28. AC_MSG_CHECKING(for in-TU anonymous namespace breakage)
  29. AC_TRY_COMPILE([namespace { class Foo {}; }
  30. namespace isc {class Bar {Foo foo_;};} ],,
  31. [AC_MSG_RESULT(no)
  32. werror_ok=1],
  33. [AC_MSG_RESULT(yes)])
  34. CXXFLAGS="$CXXFLAGS_SAVED"
  35. fi
  36. AC_DEFINE_UNQUOTED(UNUSED_PARAM, $UNUSED_PARAM_ATTRIBUTE, Define to compiler keyword indicating a function argument is intentionally unused)
  37. AM_CONDITIONAL(GCC_WERROR_OK, test $werror_ok = 1)
  38. # produce PIC unless we disable shared libraries. need this for python bindings.
  39. if test $enable_shared != "no" -a "X$GCC" = "Xyes"; then
  40. CXXFLAGS="$CXXFLAGS -fPIC"
  41. fi
  42. # Checks for libraries.
  43. AC_SEARCH_LIBS(inet_pton, [nsl])
  44. AC_SEARCH_LIBS(recvfrom, [socket])
  45. # Checks for header files.
  46. # Checks for typedefs, structures, and compiler characteristics.
  47. AC_HEADER_STDBOOL
  48. AC_TYPE_SIZE_T
  49. AC_MSG_CHECKING(for sa_len in struct sockaddr)
  50. AC_TRY_COMPILE([
  51. #include <sys/types.h>
  52. #include <sys/socket.h>],
  53. [struct sockaddr sa; sa.sa_len = 0; return (0);],
  54. [AC_MSG_RESULT(yes)
  55. AC_DEFINE(HAVE_SIN_LEN, 1, Define to 1 if sockaddr_in has a sin_len member)],
  56. AC_MSG_RESULT(no))
  57. AC_ARG_WITH(lcov,
  58. [ --with-lcov[=PROGRAM] enable gtest and coverage target using the specified lcov], lcov="$withval", lcov="no")
  59. AC_ARG_WITH(gtest,
  60. [ --with-gtest=PATH specify a path to gtest header files (PATH/include) and library (PATH/lib)],
  61. gtest_path="$withval", gtest_path="no")
  62. USE_LCOV="no"
  63. if test "$lcov" != "no"; then
  64. # force gtest if not set
  65. if test "$gtest_path" = "no"; then
  66. # AC_MSG_ERROR("lcov needs gtest for test coverage report")
  67. AC_MSG_NOTICE([gtest support is now enabled, because used by coverage tests])
  68. gtest_path="yes"
  69. fi
  70. if test "$lcov" != "yes"; then
  71. LCOV=$lcov
  72. else
  73. AC_PATH_PROG([LCOV], [lcov])
  74. fi
  75. if test -x "${LCOV}"; then
  76. USE_LCOV="yes"
  77. else
  78. AC_MSG_ERROR([Cannot find lcov.])
  79. fi
  80. # is genhtml always in the same directory?
  81. GENHTML=`echo "$LCOV" | sed s/lcov$/genhtml/`
  82. if test ! -x $GENHTML; then
  83. AC_MSG_ERROR([genhtml not found, needed for lcov])
  84. fi
  85. # GCC specific?
  86. CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage"
  87. LIBS=" $LIBS -lgcov"
  88. AC_SUBST(CPPFLAGS)
  89. AC_SUBST(LIBS)
  90. AC_SUBST(LCOV)
  91. AC_SUBST(GENHTML)
  92. fi
  93. AC_SUBST(USE_LCOV)
  94. # Check availability of the Boost System library
  95. AC_MSG_CHECKING([for boost::system library])
  96. AC_ARG_WITH([boostlib],
  97. AC_HELP_STRING([--with-boostlib=PATH],
  98. [specify a path to boost libraries if it is not automatically found, or "no" to disable it]),
  99. [boostlib_path="$withval"], [boostlib_path="auto"])
  100. if test "$boostlib_path" != "no" -a "$boostlib_path" != "auto" -a "$boostlib_path" != "yes"; then
  101. BOOST_LDFLAGS="-L$boostlib_path"
  102. fi
  103. if test "$boostlib_path" != "no"; then
  104. LDFLAGS_SAVED="$LDFLAGS"
  105. LIBS_SAVED="$LIBS"
  106. CPPFLAGS_SAVED="$CPPFLAGS"
  107. CPPFLAGS="$CPPFLAGS -Iext"
  108. for BOOST_TRY_LIB in boost_system boost_system-mt; do
  109. LDFLAGS="$LDFLAGS_SAVED ${BOOST_LDFLAGS}"
  110. LIBS="$LIBS_SAVED -l${BOOST_TRY_LIB}"
  111. AC_TRY_LINK([#include <boost/system/error_code.hpp>],
  112. [ boost::system::error_code error_code;
  113. std::string message(error_code.message());
  114. return 0; ],
  115. [ AC_MSG_RESULT(yes)
  116. BOOST_SYSTEM_LIB="-l${BOOST_TRY_LIB}"
  117. ],[])
  118. if test "X${BOOST_SYSTEM_LIB}" != X; then
  119. break
  120. fi
  121. done
  122. LDFLAGS="$LDFLAGS_SAVED"
  123. CPPFLAGS="$CPPFLAGS_SAVED"
  124. LIBS="$LIBS_SAVED"
  125. fi
  126. if test "X${BOOST_SYSTEM_LIB}" = X; then
  127. AC_MSG_RESULT(no)
  128. else
  129. AC_DEFINE(HAVE_BOOSTLIB, 1, Define to 1 if boost libraries are available)
  130. fi
  131. AM_CONDITIONAL(HAVE_BOOSTLIB, test "X${BOOST_SYSTEM_LIB}" != X)
  132. AC_SUBST(BOOST_LDFLAGS)
  133. AC_SUBST(BOOST_SYSTEM_LIB)
  134. #
  135. # Check availability of gtest, which will be used for unit tests.
  136. #
  137. if test "$gtest_path" != "no"
  138. then
  139. if test "$gtest_path" != "yes"; then
  140. GTEST_PATHS=$gtest_path
  141. if test -x "${gtest_path}/bin/gtest-config" ; then
  142. GTEST_CONFIG="${gtest_path}/bin/gtest-config"
  143. fi
  144. else
  145. AC_PATH_PROG([GTEST_CONFIG], [gtest-config])
  146. fi
  147. if test -x "${GTEST_CONFIG}" ; then :
  148. # using cppflags instead of cxxflags
  149. GTEST_INCLUDES=`${GTEST_CONFIG} --cppflags`
  150. GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`
  151. GTEST_LDADD=`${GTEST_CONFIG} --libs`
  152. GTEST_FOUND="true"
  153. else
  154. AC_MSG_WARN([Unable to locate Google Test gtest-config.])
  155. if test -z "${GTEST_PATHS}" ; then
  156. GTEST_PATHS="/usr /usr/local"
  157. fi
  158. GTEST_FOUND="false"
  159. fi
  160. if test "${GTEST_FOUND}" != "true"; then
  161. GTEST_FOUND="false"
  162. for dir in $GTEST_PATHS; do
  163. if test -f "$dir/include/gtest/gtest.h"; then
  164. GTEST_INCLUDES="-I$dir/include"
  165. GTEST_LDFLAGS="-L$dir/lib"
  166. GTEST_LDADD="-lgtest"
  167. GTEST_FOUND="true"
  168. break
  169. fi
  170. done
  171. fi
  172. if test "${GTEST_FOUND}" != "true"; then
  173. AC_MSG_ERROR([Cannot find gtest in: $GTEST_PATHS])
  174. fi
  175. else
  176. GTEST_INCLUDES=
  177. GTEST_LDFLAGS=
  178. GTEST_LDADD=
  179. fi
  180. AM_CONDITIONAL(HAVE_GTEST, test $gtest_path != "no")
  181. AC_SUBST(GTEST_INCLUDES)
  182. AC_SUBST(GTEST_LDFLAGS)
  183. AC_SUBST(GTEST_LDADD)
  184. PKG_CHECK_MODULES(SQLITE, sqlite3 >= 3.3.9)
  185. # Checks for library functions.
  186. AC_CONFIG_FILES([Makefile
  187. src/Makefile
  188. src/bin/Makefile
  189. src/bin/bind10/Makefile
  190. src/bin/cmdctl/Makefile
  191. src/bin/bindctl/Makefile
  192. src/bin/cfgmgr/Makefile
  193. src/bin/host/Makefile
  194. src/bin/loadzone/Makefile
  195. src/bin/msgq/Makefile
  196. src/bin/auth/Makefile
  197. src/bin/auth/tests/Makefile
  198. src/bin/xfrin/Makefile
  199. src/bin/usermgr/Makefile
  200. src/lib/Makefile
  201. src/lib/cc/Makefile
  202. src/lib/python/Makefile
  203. src/lib/python/isc/Makefile
  204. src/lib/python/isc/auth/Makefile
  205. src/lib/python/isc/cc/Makefile
  206. src/lib/python/isc/config/Makefile
  207. src/lib/config/Makefile
  208. src/lib/config/tests/Makefile
  209. src/lib/dns/Makefile
  210. src/lib/dns/tests/Makefile
  211. src/lib/exceptions/Makefile
  212. src/lib/auth/Makefile
  213. src/lib/auth/tests/Makefile
  214. ])
  215. AC_OUTPUT([src/bin/cfgmgr/b10-cfgmgr.py
  216. src/bin/cmdctl/cmdctl.py
  217. src/bin/cmdctl/run_b10-cmdctl.sh
  218. src/bin/cmdctl/unittest/cmdctl_test
  219. src/bin/xfrin/unittest/xfrin_test
  220. src/bin/xfrin/xfrin.py
  221. src/bin/xfrin/run_b10-xfrin.sh
  222. src/bin/bind10/bind10.py
  223. src/bin/bind10/tests/bind10_test
  224. src/bin/bind10/run_bind10.sh
  225. src/bin/bindctl/bindctl
  226. src/bin/bindctl/unittest/bindctl_test
  227. src/bin/loadzone/run_loadzone
  228. src/bin/loadzone/b10-loadzone.py
  229. src/bin/usermgr/run_b10-cmdctl-usermgr.sh
  230. src/bin/usermgr/b10-cmdctl-usermgr.py
  231. src/bin/msgq/msgq.py
  232. src/bin/msgq/msgq_test
  233. src/bin/msgq/run_msgq.sh
  234. src/bin/auth/spec_config.h
  235. src/lib/config/tests/data_def_unittests_config.h
  236. src/lib/python/isc/config/tests/config_test
  237. src/lib/dns/gen-rdatacode.py
  238. src/lib/dns/tests/testdata/gen-wiredata.py
  239. ], [
  240. chmod +x src/bin/cmdctl/run_b10-cmdctl.sh
  241. chmod +x src/bin/xfrin/run_b10-xfrin.sh
  242. chmod +x src/bin/bind10/run_bind10.sh
  243. chmod +x src/bin/cmdctl/unittest/cmdctl_test
  244. chmod +x src/bin/xfrin/unittest/xfrin_test
  245. chmod +x src/bin/bindctl/unittest/bindctl_test
  246. chmod +x src/bin/bindctl/bindctl
  247. chmod +x src/bin/loadzone/run_loadzone
  248. chmod +x src/bin/usermgr/run_b10-cmdctl-usermgr.sh
  249. chmod +x src/bin/msgq/run_msgq.sh
  250. chmod +x src/bin/msgq/msgq_test
  251. chmod +x src/lib/dns/gen-rdatacode.py
  252. chmod +x src/lib/dns/tests/testdata/gen-wiredata.py
  253. ])
  254. AC_OUTPUT