configure.ac 8.1 KB

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