configure.ac 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. gtest_path="yes"
  37. fi
  38. if test "$lcov" != "yes"; then
  39. LCOV_PATHS=$lcov
  40. else
  41. LCOV_PATHS="/usr/bin/lcov /usr/local/bin/lcov"
  42. fi
  43. for f in $LCOV_PATHS; do
  44. if test -x "$f"; then
  45. USE_LCOV="yes"
  46. LCOV=$f
  47. fi
  48. done
  49. if test $USE_LCOV != "yes"; then
  50. AC_MSG_ERROR([Cannot find lcov in: $LCOV_PATHS])
  51. fi
  52. # is genhtml always in the same directory?
  53. GENHTML=`echo "$LCOV" | sed s/lcov$/genhtml/`
  54. if test ! -x $GENHTML; then
  55. AC_MSG_ERROR([genhtml not found, needed for lcov])
  56. fi
  57. # GCC specific?
  58. CPPFLAGS="$CPPFLAGS -fprofile-arcs -ftest-coverage"
  59. LIBS=" $LIBS -lgcov"
  60. AC_SUBST(CPPFLAGS)
  61. AC_SUBST(LIBS)
  62. AC_SUBST(LCOV)
  63. AC_SUBST(GENHTML)
  64. fi
  65. AC_SUBST(USE_LCOV)
  66. #
  67. # Check availablity of gtest, which will be used for unit tests.
  68. #
  69. if test "$gtest_path" != "no"
  70. then
  71. if test "$gtest_path" != "yes"; then
  72. GTEST_PATHS=$gtest_path
  73. else
  74. GTEST_PATHS="/usr /usr/local"
  75. fi
  76. GTEST_FOUND="false"
  77. for dir in $GTEST_PATHS; do
  78. if test -f "$dir/include/gtest/gtest.h"; then
  79. GTEST_INCLUDES="-I$dir/include"
  80. GTEST_LDFLAGS="-L$dir/lib"
  81. GTEST_LDADD="-lgtest"
  82. GTEST_FOUND="true"
  83. fi
  84. done
  85. if test $GTEST_FOUND != "true"; then
  86. AC_MSG_ERROR([Cannot find gtest in: $GTEST_PATHS])
  87. fi
  88. else
  89. GTEST_INCLUDES=
  90. GTEST_LDFLAGS=
  91. GTEST_LDADD=
  92. fi
  93. AM_CONDITIONAL(HAVE_GTEST, test $gtest_path != "no")
  94. AC_SUBST(GTEST_INCLUDES)
  95. AC_SUBST(GTEST_LDFLAGS)
  96. AC_SUBST(GTEST_LDADD)
  97. # Checks for library functions.
  98. AC_CONFIG_FILES([Makefile
  99. src/Makefile
  100. src/bin/Makefile
  101. src/bin/bigtool/Makefile
  102. src/bin/bind10/Makefile
  103. src/bin/host/Makefile
  104. src/bin/msgq/Makefile
  105. src/bin/parkinglot/Makefile
  106. src/lib/Makefile
  107. src/lib/cc/Makefile
  108. src/lib/cc/cpp/Makefile
  109. src/lib/dns/Makefile
  110. ])
  111. AC_OUTPUT([src/bin/bind-cfgd/bind-cfgd
  112. src/bin/bigtool/run_bigtool
  113. src/bin/bind10/bind10
  114. src/bin/msgq/msgq
  115. src/bin/msgq/msgq_test
  116. src/bin/parkinglot/config.h
  117. ], [
  118. chmod +x src/bin/bind-cfgd/bind-cfgd
  119. chmod +x src/bin/bigtool/run_bigtool
  120. chmod +x src/bin/bind10/bind10
  121. chmod +x src/bin/msgq/msgq
  122. chmod +x src/bin/msgq/msgq_test
  123. ])
  124. AC_OUTPUT