configure.ac 4.4 KB

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