configure.ac 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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 enable gtest and coverage target using the specified lcov], lcov="yes", 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. CPPFLAGS="$(CPPFLAGS) -fprofile-arcs -ftest-coverage"
  58. LIBS=" $(LIBS) -lgcov"
  59. AC_SUBST(CPPFLAGS)
  60. AC_SUBST(LIBS)
  61. AC_SUBST(LCOV)
  62. AC_SUBST(GENHTML)
  63. fi
  64. AC_SUBST(USE_LCOV)
  65. #
  66. # Check availablity of gtest, which will be used for unit tests.
  67. #
  68. if test "$gtest_path" != "no"
  69. then
  70. if test "$gtest_path" != "yes"; then
  71. GTEST_PATHS=$gtest_path
  72. else
  73. GTEST_PATHS="/usr /usr/local"
  74. fi
  75. GTEST_FOUND="false"
  76. for dir in $GTEST_PATHS; do
  77. if test -f "$dir/include/gtest/gtest.h"; then
  78. GTEST_INCLUDES="-I$dir/include"
  79. GTEST_LDFLAGS="-L$dir/lib"
  80. GTEST_LDADD="-lgtest"
  81. GTEST_FOUND="true"
  82. fi
  83. done
  84. if test $GTEST_FOUND != "true"; then
  85. AC_MSG_ERROR([Cannot find gtest in: $GTEST_PATHS])
  86. fi
  87. else
  88. GTEST_INCLUDES=
  89. GTEST_LDFLAGS=
  90. GTEST_LDADD=
  91. fi
  92. AM_CONDITIONAL(HAVE_GTEST, test $gtest_path != "no")
  93. AC_SUBST(GTEST_INCLUDES)
  94. AC_SUBST(GTEST_LDFLAGS)
  95. AC_SUBST(GTEST_LDADD)
  96. # Checks for library functions.
  97. AC_CONFIG_FILES([Makefile
  98. src/Makefile
  99. src/bin/Makefile
  100. src/bin/bigtool/Makefile
  101. src/bin/bind10/Makefile
  102. src/bin/host/Makefile
  103. src/bin/msgq/Makefile
  104. src/bin/parkinglot/Makefile
  105. src/lib/Makefile
  106. src/lib/cc/Makefile
  107. src/lib/cc/cpp/Makefile
  108. src/lib/dns/Makefile
  109. ])
  110. AC_OUTPUT([src/bin/bind-cfgd/bind-cfgd
  111. src/bin/bigtool/run_bigtool
  112. src/bin/bind10/bind10
  113. src/bin/msgq/msgq
  114. src/bin/msgq/msgq_test
  115. src/bin/parkinglot/config.h
  116. ], [
  117. chmod +x src/bin/bind-cfgd/bind-cfgd
  118. chmod +x src/bin/bigtool/run_bigtool
  119. chmod +x src/bin/bind10/bind10
  120. chmod +x src/bin/msgq/msgq
  121. chmod +x src/bin/msgq/msgq_test
  122. ])
  123. AC_OUTPUT