configure.ac 7.7 KB

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