configure.ac 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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_RANLIB
  12. AC_PROG_LIBTOOL
  13. m4_define([_AM_PYTHON_INTERPRETER_LIST], [python python3 python3.1])
  14. AM_PATH_PYTHON([3.1])
  15. # default compiler warning settings
  16. if test "X$GCC" = "Xyes"; then
  17. CXXFLAGS="-g -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare"
  18. fi
  19. # produce PIC unless we disable shared libraries. need this for python bindings.
  20. if test $enable_shared != "no" -a "X$GCC" = "Xyes"; then
  21. CXXFLAGS="$CXXFLAGS -fPIC"
  22. fi
  23. # Checks for libraries.
  24. AC_SEARCH_LIBS(inet_pton, [nsl])
  25. AC_SEARCH_LIBS(recvfrom, [socket])
  26. # Checks for header files.
  27. # Checks for typedefs, structures, and compiler characteristics.
  28. AC_HEADER_STDBOOL
  29. AC_TYPE_SIZE_T
  30. AC_MSG_CHECKING(for sa_len in struct sockaddr)
  31. AC_TRY_COMPILE([
  32. #include <sys/types.h>
  33. #include <sys/socket.h>],
  34. [struct sockaddr sa; sa.sa_len = 0; return (0);],
  35. [AC_MSG_RESULT(yes)
  36. AC_DEFINE(HAVE_SIN_LEN, 1, Define to 1 if sockaddr_in has a sin_len member)],
  37. AC_MSG_RESULT(no))
  38. AC_ARG_WITH(lcov,
  39. [ --with-lcov[=PROGRAM] enable gtest and coverage target using the specified lcov], lcov="$withval", lcov="no")
  40. AC_ARG_WITH(gtest,
  41. [ --with-gtest=PATH specify a path to gtest header files (PATH/include) and library (PATH/lib)],
  42. gtest_path="$withval", gtest_path="no")
  43. USE_LCOV="no"
  44. if test "$lcov" != "no"; then
  45. # force gtest if not set
  46. if test "$gtest_path" = "no"; then
  47. # AC_MSG_ERROR("lcov needs gtest for test coverage report")
  48. AC_MSG_NOTICE([gtest support is now enabled, because used by coverage tests])
  49. gtest_path="yes"
  50. fi
  51. if test "$lcov" != "yes"; then
  52. LCOV=$lcov
  53. else
  54. AC_PATH_PROG([LCOV], [lcov])
  55. fi
  56. if test -x "${LCOV}"; then
  57. USE_LCOV="yes"
  58. else
  59. AC_MSG_ERROR([Cannot find lcov.])
  60. fi
  61. # is genhtml always in the same directory?
  62. GENHTML=`echo "$LCOV" | sed s/lcov$/genhtml/`
  63. if test ! -x $GENHTML; then
  64. AC_MSG_ERROR([genhtml not found, needed for lcov])
  65. fi
  66. # GCC specific?
  67. CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage"
  68. LIBS=" $LIBS -lgcov"
  69. AC_SUBST(CPPFLAGS)
  70. AC_SUBST(LIBS)
  71. AC_SUBST(LCOV)
  72. AC_SUBST(GENHTML)
  73. fi
  74. AC_SUBST(USE_LCOV)
  75. #
  76. # Check availability of gtest, which will be used for unit tests.
  77. #
  78. if test "$gtest_path" != "no"
  79. then
  80. if test "$gtest_path" != "yes"; then
  81. GTEST_PATHS=$gtest_path
  82. if test -x "${gtest_path}/bin/gtest-config" ; then
  83. GTEST_CONFIG="${gtest_path}/bin/gtest-config"
  84. fi
  85. else
  86. AC_PATH_PROG([GTEST_CONFIG], [gtest-config])
  87. fi
  88. if test -x "${GTEST_CONFIG}" ; then :
  89. # using cppflags instead of cxxflags
  90. GTEST_INCLUDES=`${GTEST_CONFIG} --cppflags`
  91. GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`
  92. GTEST_LDADD=`${GTEST_CONFIG} --libs`
  93. GTEST_FOUND="true"
  94. else
  95. AC_MSG_WARN([Unable to locate Google Test gtest-config.])
  96. if test -z "${GTEST_PATHS}" ; then
  97. GTEST_PATHS="/usr /usr/local"
  98. fi
  99. GTEST_FOUND="false"
  100. fi
  101. if test "${GTEST_FOUND}" != "true"; then
  102. GTEST_FOUND="false"
  103. for dir in $GTEST_PATHS; do
  104. if test -f "$dir/include/gtest/gtest.h"; then
  105. GTEST_INCLUDES="-I$dir/include"
  106. GTEST_LDFLAGS="-L$dir/lib"
  107. GTEST_LDADD="-lgtest"
  108. GTEST_FOUND="true"
  109. break
  110. fi
  111. done
  112. fi
  113. if test "${GTEST_FOUND}" != "true"; then
  114. AC_MSG_ERROR([Cannot find gtest in: $GTEST_PATHS])
  115. fi
  116. else
  117. GTEST_INCLUDES=
  118. GTEST_LDFLAGS=
  119. GTEST_LDADD=
  120. fi
  121. AM_CONDITIONAL(HAVE_GTEST, test $gtest_path != "no")
  122. AC_SUBST(GTEST_INCLUDES)
  123. AC_SUBST(GTEST_LDFLAGS)
  124. AC_SUBST(GTEST_LDADD)
  125. PKG_CHECK_MODULES(SQLITE, sqlite3)
  126. # Checks for library functions.
  127. AC_CONFIG_FILES([Makefile
  128. src/Makefile
  129. src/bin/Makefile
  130. src/bin/bind10/Makefile
  131. src/bin/cmdctl/Makefile
  132. src/bin/bindctl/Makefile
  133. src/bin/cfgmgr/Makefile
  134. src/bin/host/Makefile
  135. src/bin/msgq/Makefile
  136. src/bin/auth/Makefile
  137. src/lib/Makefile
  138. src/lib/cc/Makefile
  139. src/lib/cc/cpp/Makefile
  140. src/lib/cc/python/Makefile
  141. src/lib/cc/python/isc/Makefile
  142. src/lib/cc/python/isc/cc/Makefile
  143. src/lib/cc/python/isc/Util/Makefile
  144. src/lib/config/Makefile
  145. src/lib/config/cpp/Makefile
  146. src/lib/config/python/Makefile
  147. src/lib/config/python/isc/Makefile
  148. src/lib/config/python/isc/config/Makefile
  149. src/lib/dns/Makefile
  150. src/lib/dns/cpp/Makefile
  151. src/lib/dns/cpp/tests/Makefile
  152. src/lib/exceptions/cpp/Makefile
  153. src/lib/exceptions/Makefile
  154. src/lib/auth/Makefile
  155. src/lib/auth/cpp/Makefile
  156. ])
  157. AC_OUTPUT([src/bin/cfgmgr/b10-cfgmgr.py
  158. src/bin/cmdctl/cmdctl.py
  159. src/bin/cmdctl/run_b10-cmdctl.sh
  160. src/bin/cmdctl/unittest/cmdctl_test
  161. src/bin/bind10/bind10.py
  162. src/bin/bind10/bind10_test
  163. src/bin/bind10/run_bind10.sh
  164. src/bin/bindctl/bindctl
  165. src/bin/bindctl/unittest/bindctl_test
  166. src/bin/msgq/msgq.py
  167. src/bin/msgq/msgq_test
  168. src/bin/msgq/run_msgq.sh
  169. src/bin/auth/config.h
  170. src/lib/config/cpp/data_def_unittests_config.h
  171. src/lib/config/python/isc/config/unittests/config_test
  172. src/lib/dns/cpp/gen-rdatacode.py
  173. ], [
  174. chmod +x src/bin/cfgmgr/run_b10-cfgmgr.sh
  175. chmod +x src/bin/cmdctl/run_b10-cmdctl.sh
  176. chmod +x src/bin/bind10/run_bind10.sh
  177. chmod +x src/bin/cmdctl/unittest/cmdctl_test
  178. chmod +x src/bin/bindctl/unittest/bindctl_test
  179. chmod +x src/bin/bindctl/bindctl
  180. chmod +x src/bin/msgq/run_msgq.sh
  181. chmod +x src/bin/msgq/msgq_test
  182. chmod +x src/lib/dns/cpp/gen-rdatacode.py
  183. ])
  184. AC_OUTPUT