configure.ac 5.7 KB

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