configure.ac 5.8 KB

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