configure.ac 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. AC_PREREQ([2.59])
  4. AC_INIT(kea, 20140602-git, kea-dev@isc.org)
  5. AC_CONFIG_SRCDIR(README)
  6. # serial-tests is not available in automake version before 1.13, so
  7. # we'll check that and conditionally use serial-tests. This check is
  8. # adopted from code by Richard W.M. Jones:
  9. # https://www.redhat.com/archives/libguestfs/2013-February/msg00102.html
  10. m4_define([serial_tests], [
  11. m4_esyscmd([automake --version |
  12. head -1 |
  13. awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 12) { print "serial-tests" }}'
  14. ])
  15. ])
  16. AM_INIT_AUTOMAKE(foreign serial_tests)
  17. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])dnl be backward compatible
  18. AC_CONFIG_HEADERS([config.h])
  19. AC_CONFIG_MACRO_DIR([m4macros])
  20. # Checks for programs.
  21. AC_PROG_CXX
  22. # Enable low-performing debugging facilities? This option optionally
  23. # enables some debugging aids that perform slowly and hence aren't built
  24. # by default.
  25. AC_ARG_ENABLE([debug],
  26. AS_HELP_STRING([--enable-debug],
  27. [enable debugging (default is no)]),
  28. [case "${enableval}" in
  29. yes) debug_enabled=yes ;;
  30. no) debug_enabled=no ;;
  31. *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
  32. esac],[debug_enabled=no])
  33. AM_CONDITIONAL([DEBUG_ENABLED], [test x$debug_enabled = xyes])
  34. AM_COND_IF([DEBUG_ENABLED], [AC_DEFINE([ENABLE_DEBUG], [1], [Enable low-performing debugging facilities?])])
  35. # Libtool configuration
  36. #
  37. # libtool cannot handle spaces in paths, so exit early if there is one
  38. if [ test `echo $PWD | grep -c ' '` != "0" ]; then
  39. AC_MSG_ERROR([BIND 10 cannot be built in a directory that contains spaces, because of libtool limitations. Please change the directory name, or use a symbolic link that does not contain spaces.])
  40. fi
  41. # On FreeBSD (and probably some others), clang++ does not meet an autoconf
  42. # assumption in identifying libtool configuration regarding shared library:
  43. # the configure script will execute "$CC -shared $CFLAGS/$CXXFLAGS -v" and
  44. # expect the output contains -Lxxx or -Ryyy. This is the case for g++, but
  45. # not for clang++, and, as a result, it will cause various errors in linking
  46. # programs or running them with a shared object (such as some of our python
  47. # scripts).
  48. # To work around this problem we define a temporary variable
  49. # "CXX_LIBTOOL_LDFLAGS". It's expected to be defined as, e.g, "-L/usr/lib"
  50. # to temporarily fake the output so that it will be compatible with that of
  51. # g++.
  52. CFLAGS_SAVED=$CFLAGS
  53. CXXFLAGS_SAVED=$CXXFLAGS
  54. CFLAGS="$CFLAGS $CXX_LIBTOOL_LDFLAGS"
  55. CXXFLAGS="$CXXFLAGS $CXX_LIBTOOL_LDFLAGS"
  56. AC_PROG_LIBTOOL
  57. CFLAGS=$CFLAGS_SAVED
  58. CXXFLAGS=$CXXFLAGS_SAVED
  59. # Use C++ language
  60. AC_LANG([C++])
  61. # Identify the compiler: this check must be after AC_PROG_CXX and AC_LANG.
  62. AM_CONDITIONAL(USE_GXX, test "X${GXX}" = "Xyes")
  63. AC_CHECK_DECL([__SUNPRO_CC], [SUNCXX="yes"], [SUNCXX="no"])
  64. AC_CHECK_DECL([__clang__], [CLANGPP="yes"], [CLANGPP="no"])
  65. AM_CONDITIONAL(USE_CLANGPP, test "X${CLANGPP}" = "Xyes")
  66. dnl Determine if weare using GNU sed
  67. GNU_SED=no
  68. $SED --version 2> /dev/null | grep GNU > /dev/null 2>&1
  69. if test $? -eq 0; then
  70. GNU_SED=yes
  71. fi
  72. # Linker options
  73. # check -R, "-Wl,-R" or -rpath (we share the AX function defined in
  74. # examples/m4)
  75. AX_ISC_RPATH
  76. # Compiler dependent settings: define some mandatory CXXFLAGS here.
  77. # We also use a separate variable B10_CXXFLAGS. This will (and should) be
  78. # used as the default value for each specific AM_CXXFLAGS:
  79. # AM_CXXFLAGS = $(B10_CXXFLAGS)
  80. # AM_CXXFLAGS += ... # add module specific flags
  81. # We need this so that we can disable some specific compiler warnings per
  82. # module basis; since AM_CXXFLAGS are placed before CXXFLAGS, and since
  83. # gcc's -Wno-XXX option must be specified after -Wall or -Wextra, we cannot
  84. # specify the default warning flags in CXXFLAGS and let specific modules
  85. # "override" the default.
  86. # This may be used to try linker flags.
  87. AC_DEFUN([BIND10_CXX_TRY_FLAG], [
  88. AC_MSG_CHECKING([whether $CXX supports $1])
  89. bind10_save_CXXFLAGS="$CXXFLAGS"
  90. CXXFLAGS="$CXXFLAGS $1"
  91. AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void){ return 0;}])],
  92. [bind10_cxx_flag=yes], [bind10_cxx_flag=no])
  93. CXXFLAGS="$bind10_save_CXXFLAGS"
  94. if test "x$bind10_cxx_flag" = "xyes"; then
  95. ifelse([$2], , :, [$2])
  96. else
  97. ifelse([$3], , :, [$3])
  98. fi
  99. AC_MSG_RESULT([$bind10_cxx_flag])
  100. ])
  101. CXX_VERSION="unknown"
  102. # SunStudio compiler requires special compiler options for boost
  103. # (http://blogs.sun.com/sga/entry/boost_mini_howto)
  104. if test "$SUNCXX" = "yes"; then
  105. CXX_VERSION=`$CXX -V 2> /dev/null | head -1`
  106. CXXFLAGS="$CXXFLAGS -library=stlport4 -features=tmplife -features=tmplrefstatic"
  107. MULTITHREADING_FLAG="-mt"
  108. fi
  109. # Newer versions of clang++ promotes "unused driver arguments" warnings to
  110. # a fatal error with -Werror, causing build failure. Since we use multiple
  111. # compilers on multiple systems, this can easily happen due to settings for
  112. # non clang++ environments that could be just ignored otherwise. It can also
  113. # happen if clang++ is used via ccache. So, although probably suboptimal,
  114. # we suppress this particular warning. Note that it doesn't weaken checks
  115. # on the source code.
  116. if test "$CLANGPP" = "yes"; then
  117. CXX_VERSION=`$CXX --version 2> /dev/null | head -1`
  118. B10_CXXFLAGS="$B10_CXXFLAGS -Qunused-arguments"
  119. fi
  120. BIND10_CXX_TRY_FLAG([-Wno-missing-field-initializers],
  121. [WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG="-Wno-missing-field-initializers"])
  122. AC_SUBST(WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG)
  123. # gcc specific settings:
  124. if test "X$GXX" = "Xyes"; then
  125. CXX_VERSION=`$CXX --version 2> /dev/null | head -1`
  126. B10_CXXFLAGS="$B10_CXXFLAGS -Wall -Wextra -Wnon-virtual-dtor -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare"
  127. case "$host" in
  128. *-solaris*)
  129. MULTITHREADING_FLAG=-pthreads
  130. # In Solaris, IN6ADDR_ANY_INIT and IN6ADDR_LOOPBACK_INIT need -Wno-missing-braces
  131. B10_CXXFLAGS="$B10_CXXFLAGS -Wno-missing-braces"
  132. ;;
  133. *)
  134. MULTITHREADING_FLAG=-pthread
  135. ;;
  136. esac
  137. # Don't use -Werror if configured not to
  138. AC_ARG_WITH(werror,
  139. AC_HELP_STRING([--with-werror], [Compile using -Werror (default=yes)]),
  140. [
  141. case "${withval}" in
  142. yes) with_werror=1 ;;
  143. no) with_werror=0 ;;
  144. *) AC_MSG_ERROR(bad value ${withval} for --with-werror) ;;
  145. esac],
  146. [with_werror=1])
  147. werror_ok=0
  148. # Certain versions of gcc (g++) have a bug that incorrectly warns about
  149. # the use of anonymous name spaces even if they're closed in a single
  150. # translation unit. For these versions we have to disable -Werror.
  151. if test $with_werror = 1; then
  152. CXXFLAGS_SAVED="$CXXFLAGS"
  153. CXXFLAGS="$CXXFLAGS $B10_CXXFLAGS -Werror"
  154. AC_MSG_CHECKING(for in-TU anonymous namespace breakage)
  155. # We use struct, not class, here, because some compilers complain about
  156. # "unused private members", causing a false positive.
  157. AC_TRY_COMPILE([namespace { struct Foo {}; }
  158. namespace isc {struct Bar {Foo foo_;};} ],,
  159. [AC_MSG_RESULT(no)
  160. werror_ok=1
  161. B10_CXXFLAGS="$B10_CXXFLAGS -Werror"],
  162. [AC_MSG_RESULT(yes)])
  163. CXXFLAGS="$CXXFLAGS_SAVED"
  164. fi
  165. fi dnl GXX = yes
  166. # allow building programs with static link. we need to make it selective
  167. # because loadable modules cannot be statically linked.
  168. AC_ARG_ENABLE([static-link],
  169. AC_HELP_STRING([--enable-static-link],
  170. [build programs with static link [[default=no]]]),
  171. [enable_static_link=yes], [enable_static_link=no])
  172. AM_CONDITIONAL(USE_STATIC_LINK, test $enable_static_link = yes)
  173. AM_COND_IF([USE_STATIC_LINK], [AC_DEFINE([USE_STATIC_LINK], [1], [BIND 10 was statically linked?])])
  174. # Check validity about some libtool options
  175. if test $enable_static_link = yes -a $enable_static = no; then
  176. AC_MSG_ERROR([--enable-static-link requires --enable-static])
  177. fi
  178. if test $enable_shared = no; then
  179. AC_MSG_ERROR([BIND 10 requires shared libraries to be built])
  180. fi
  181. # allow configuring without setproctitle.
  182. AC_ARG_ENABLE(setproctitle-check,
  183. AC_HELP_STRING([--disable-setproctitle-check],
  184. [do not check for python setproctitle module (used to give nice names to python processes)]),
  185. setproctitle_check=$enableval, setproctitle_check=yes)
  186. # OS dependent configuration
  187. SET_ENV_LIBRARY_PATH=no
  188. ENV_LIBRARY_PATH=LD_LIBRARY_PATH
  189. bind10_undefined_pthread_behavior=no
  190. case "$host" in
  191. *-solaris*)
  192. # Solaris requires special definitions to get some standard libraries
  193. # (e.g. getopt(3)) available with common used header files.
  194. CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
  195. # "now" binding is necessary to prevent deadlocks in C++ static initialization code
  196. LDFLAGS="$LDFLAGS -z now"
  197. # Destroying locked mutexes, condition variables being waited
  198. # on, etc. are undefined behavior on Solaris, so we set it as
  199. # such here.
  200. bind10_undefined_pthread_behavior=yes
  201. ;;
  202. *-apple-darwin*)
  203. # Starting with OSX 10.7 (Lion) we must choose which IPv6 API to use
  204. # (RFC2292 or RFC3542).
  205. CPPFLAGS="$CPPFLAGS -D__APPLE_USE_RFC_3542"
  206. # In OS X 10.9 (and possibly any future versions?) pthread_cond_destroy
  207. # doesn't work as documented, which makes some of unit tests fail.
  208. # Testing a specific system and version is not a good practice, but
  209. # identifying this behavior would be too heavy (running a program
  210. # with multiple threads), so this is a compromise. In general,
  211. # it should be avoided to rely on 'osx_version' unless there's no
  212. # viable alternative.
  213. osx_version=`/usr/bin/sw_vers -productVersion`
  214. if [ test $osx_version = "10.9" \
  215. -o $osx_version = "10.9.1" \
  216. -o $osx_version = "10.9.2" \
  217. -o $osx_version = "10.9.3" ]; then
  218. bind10_undefined_pthread_behavior=yes
  219. fi
  220. # libtool doesn't work perfectly with Darwin: libtool embeds the
  221. # final install path in dynamic libraries and our loadable python
  222. # modules always refer to that path even if it's loaded within the
  223. # source tree. This prevents pre-install tests from working.
  224. # To work around this problem we explicitly specify paths to dynamic
  225. # libraries when we use them in the source tree.
  226. SET_ENV_LIBRARY_PATH=yes
  227. ENV_LIBRARY_PATH=DYLD_LIBRARY_PATH
  228. ;;
  229. *-freebsd*)
  230. SET_ENV_LIBRARY_PATH=yes
  231. ;;
  232. *-netbsd*)
  233. SET_ENV_LIBRARY_PATH=yes
  234. ;;
  235. *-openbsd*)
  236. SET_ENV_LIBRARY_PATH=yes
  237. ;;
  238. esac
  239. AM_CONDITIONAL(SET_ENV_LIBRARY_PATH, test $SET_ENV_LIBRARY_PATH = yes)
  240. AC_SUBST(SET_ENV_LIBRARY_PATH)
  241. AC_SUBST(ENV_LIBRARY_PATH)
  242. if [ test $bind10_undefined_pthread_behavior = "yes" ]; then
  243. AC_DEFINE([HAS_UNDEFINED_PTHREAD_BEHAVIOR], [1], [Does this platform have some undefined pthreads behavior?])
  244. fi
  245. # Our experiments have shown Solaris 10 has broken support for the
  246. # IPV6_USE_MIN_MTU socket option for getsockopt(); it doesn't return the value
  247. # previously set via setsockopt(). We know it doesn't happen on one instance
  248. # on Solaris 11, but we don't know whether it happens for any Solaris 10
  249. # implementations or for earlier versions of Solaris. In any case, at the
  250. # moment this matters for only one unittest case, so we'll simply disable
  251. # the affected test using the following definition with the specific hardcoding
  252. # of that version of Solaris.
  253. case "$host" in
  254. *-solaris2.10)
  255. AC_DEFINE([HAVE_BROKEN_GET_IPV6_USE_MIN_MTU], [1],
  256. [Define to 1 if getsockopt(IPV6_USE_MIN_MTU) does not work])
  257. ;;
  258. esac
  259. m4_define([_AM_PYTHON_INTERPRETER_LIST], [python python3.4 python3.3 python3.2 python3.1 python3])
  260. AC_ARG_WITH([pythonpath],
  261. AC_HELP_STRING([--with-pythonpath=PATH],
  262. [specify an absolute path to python executable when automatic version check (incorrectly) fails]),
  263. [python_path="$withval"], [python_path="auto"])
  264. if test "$python_path" = auto; then
  265. AM_PATH_PYTHON([3.1])
  266. else
  267. # Older versions of automake can't handle python3 well. This is an
  268. # in-house workaround for them.
  269. PYTHON=$python_path
  270. AC_SUBST(PYTHON)
  271. PYTHON_PREFIX='${prefix}'
  272. AC_SUBST(PYTHON_PREFIX)
  273. PYTHON_EXEC_PREFIX='$(exec_prefix)'
  274. AC_SUBST(PYTHON_EXEC_PREFIX)
  275. PYTHON_VERSION=[`$PYTHON -c "import sys; sys.stdout.write(sys.version[:3])"`]
  276. if test `echo "$PYTHON_VERSION >= 3.1" | bc` != 1 ; then
  277. AC_MSG_ERROR(["Python version too old: $PYTHON_VERSION, need 3.1 or higher"])
  278. fi
  279. AC_SUBST(PYTHON_VERSION)
  280. PYTHON_PLATFORM=`$PYTHON -c "import sys; print(sys.platform)"`
  281. AC_SUBST(PYTHON_PLATFORM)
  282. pythondir='${prefix}/lib/python'$PYTHON_VERSION'/site-packages'
  283. AC_SUBST(pythondir)
  284. pkgpythondir='${pythondir}/'$PACKAGE
  285. AC_SUBST(pkgpythondir)
  286. pyexecdir='${exec_prefix}/lib/python'$PYTHON_VERSION'/site-packages'
  287. AC_SUBST(pyexecdir)
  288. pkgpyexecdir='${pyexecdir}/'$PACKAGE
  289. AC_SUBST(pkgpyexecdir)
  290. fi
  291. # We need to store the default pyexecdir in a separate variable so that
  292. # we can specify in Makefile.am the install directory of various BIND 10
  293. # python scripts and loadable modules; in Makefile.am we cannot replace
  294. # $(pyexecdir) using itself, e.g, this doesn't work:
  295. # pyexecdir = $(pyexecdir)/isc/some_module
  296. # The separate variable makes this setup possible as follows:
  297. # pyexecdir = $(PYTHON_SITEPKG_DIR)/isc/some_module
  298. PYTHON_SITEPKG_DIR=${pyexecdir}
  299. AC_SUBST(PYTHON_SITEPKG_DIR)
  300. # This will be commonly used in various Makefile.am's that need to generate
  301. # python log messages.
  302. PYTHON_LOGMSGPKG_DIR="\$(top_builddir)/src/lib/python/isc/log_messages"
  303. AC_SUBST(PYTHON_LOGMSGPKG_DIR)
  304. # This is python package paths commonly used in python tests. See
  305. # README of log_messages for why it's included.
  306. # lib/dns/python/.libs is necessary because __init__.py of isc package
  307. # automatically imports isc.datasrc, which then requires the DNS loadable
  308. # module. #2145 should eliminate the need for it.
  309. COMMON_PYTHON_PATH="\$(abs_top_builddir)/src/lib/python/isc/log_messages:\$(abs_top_builddir)/src/lib/python/isc/cc:\$(abs_top_srcdir)/src/lib/python:\$(abs_top_builddir)/src/lib/python:\$(abs_top_builddir)/src/lib/dns/python/.libs"
  310. AC_SUBST(COMMON_PYTHON_PATH)
  311. # Check for python development environments
  312. if test -x ${PYTHON}-config; then
  313. PYTHON_INCLUDES=`${PYTHON}-config --includes`
  314. # Add any '-L..." flags to PYTHON_LDFLAGS. We first make a copy of
  315. # python-config --ldflags, removing any spaces and tabs
  316. # between "-L" and its argument (some instances of python-config
  317. # insert a space, which would confuse the code below).
  318. # Notes: if -L isn't contained at all we can simply skip this process,
  319. # so we only go through the flag if it's contained; also, protecting
  320. # the output with [] seems necessary for environment to avoid getting
  321. # an empty output accidentally.
  322. python_config_ldflags=[`${PYTHON}-config --ldflags | ${SED} -ne 's/\([ \t]*-L\)[ ]*\([^ \t]*[ \t]*\)/\1\2/gp'`]
  323. for flag in $python_config_ldflags; do
  324. flag=`echo $flag | ${SED} -ne 's/^\(\-L.*\)$/\1/p'`
  325. if test "X${flag}" != X; then
  326. PYTHON_LDFLAGS="$PYTHON_LDFLAGS ${flag}"
  327. fi
  328. done
  329. # on some platforms, ${PYTHON}-config --ldflags doesn't provide a -L
  330. # option while having the library under a non trivial directory.
  331. # as a workaround we try the "lib" sub directory under the common
  332. # prefix for this python.
  333. if test -z "${PYTHON_LDFLAGS}"; then
  334. PYTHON_LDFLAGS="-L`${PYTHON}-config --prefix`/lib"
  335. fi
  336. else
  337. if test "X$PYTHON_INCLUDES" = X -o "X$PYTHON_LDFLAGS" = X; then
  338. AC_MSG_WARN([${PYTHON}-config does not exist or is not executable, so we could not detect python development environment. Your system may require an additional package (e.g. "python3-dev"). Alternatively, if you are sure you have python headers and libraries, define PYTHON_INCLUDES and PYTHON_LDFLAGS and run this script.])
  339. fi
  340. fi
  341. # Some OSes including NetBSD don't install libpython.so in a well known path.
  342. # To avoid requiring dynamic library path with our python wrapper loadable
  343. # modules, we embed the path to the modules when possible. We do this even
  344. # when the path is known in the common operational environment (e.g. when
  345. # it's stored in a common "hint" file) for simplicity.
  346. if test "x$ISC_RPATH_FLAG" != "x"; then
  347. python_rpath=
  348. for flag in ${PYTHON_LDFLAGS}; do
  349. python_rpath="${python_rpath} `echo $flag | ${SED} -ne "s/^\(\-L\)/${ISC_RPATH_FLAG}/p"`"
  350. done
  351. PYTHON_LDFLAGS="${PYTHON_LDFLAGS} ${python_rpath}"
  352. fi
  353. AC_SUBST(PYTHON_INCLUDES)
  354. AC_SUBST(PYTHON_LDFLAGS)
  355. CPPFLAGS_SAVED="$CPPFLAGS"
  356. CPPFLAGS="$CPPFLAGS ${PYTHON_INCLUDES}"
  357. AC_CHECK_HEADERS([Python.h],, AC_MSG_ERROR([Missing Python.h]))
  358. CPPFLAGS="$CPPFLAGS_SAVED"
  359. # Check for python library. Needed for Python-wrapper libraries.
  360. LDFLAGS_SAVED="$LDFLAGS"
  361. LDFLAGS="$LDFLAGS $PYTHON_LDFLAGS"
  362. python_bin="python${PYTHON_VERSION}"
  363. AC_CHECK_LIB($python_bin, main, python_lib=$python_bin, python_lib=no)
  364. if test $python_lib != "no"; then
  365. PYTHON_LIB="-l$python_lib"
  366. fi
  367. AC_SUBST(PYTHON_LIB)
  368. LDFLAGS=$LDFLAGS_SAVED
  369. # Python 3.2 changed the return type of internal hash function to
  370. # Py_hash_t and some platforms (such as Solaris) strictly check for long
  371. # vs Py_hash_t. So we detect and use the appropriate return type.
  372. # Remove this test (and associated changes in pydnspp_config.h.in) when
  373. # we require Python 3.2.
  374. have_py_hash_t=0
  375. CPPFLAGS_SAVED="$CPPFLAGS"
  376. CPPFLAGS=${PYTHON_INCLUDES}
  377. AC_MSG_CHECKING(for Py_hash_t)
  378. AC_TRY_COMPILE([#include <Python.h>
  379. Py_hash_t h;],,
  380. [AC_MSG_RESULT(yes)
  381. have_py_hash_t=1],
  382. [AC_MSG_RESULT(no)])
  383. CPPFLAGS="$CPPFLAGS_SAVED"
  384. HAVE_PY_HASH_T=$have_py_hash_t
  385. AC_SUBST(HAVE_PY_HASH_T)
  386. # Check for the setproctitle module
  387. if test "$setproctitle_check" = "yes" ; then
  388. AC_MSG_CHECKING(for setproctitle module)
  389. if "$PYTHON" -c 'import setproctitle' 2>/dev/null ; then
  390. AC_MSG_RESULT(ok)
  391. else
  392. AC_MSG_RESULT(missing)
  393. AC_MSG_WARN([Missing setproctitle python module.
  394. Use --disable-setproctitle-check to skip this check.
  395. In this case we will continue, but naming of python processes will not work.])
  396. fi
  397. fi
  398. # (g++ only check)
  399. # Python 3.2 has an unused parameter in one of its headers. This
  400. # has been reported, but not fixed as of yet, so we check if we need
  401. # to set -Wno-unused-parameter.
  402. if test "X$GXX" = "Xyes" -a "$werror_ok" = 1; then
  403. CPPFLAGS_SAVED="$CPPFLAGS"
  404. CPPFLAGS=${PYTHON_INCLUDES}
  405. CXXFLAGS_SAVED="$CXXFLAGS"
  406. CXXFLAGS="$CXXFLAGS $B10_CXXFLAGS -Werror"
  407. AC_MSG_CHECKING([whether we need -Wno-unused-parameter for python])
  408. AC_TRY_COMPILE(
  409. [#include <Python.h>],
  410. [],
  411. [AC_MSG_RESULT(no)],
  412. [
  413. CXXFLAGS="$CXXFLAGS -Wno-unused-parameter"
  414. AC_TRY_COMPILE([#include <Python.h>],
  415. [],
  416. [AC_MSG_RESULT(yes)
  417. PYTHON_CXXFLAGS="${PYTHON_CXXFLAGS} -Wno-unused-parameter"
  418. AC_SUBST(PYTHON_CXXFLAGS)
  419. ],
  420. [AC_MSG_ERROR([Can't compile against Python.h. If you're using MacOS X and have installed Python with Homebrew, see http://kea.isc.org/wiki/SystemNotesMacOSX])]
  421. )
  422. ]
  423. )
  424. CXXFLAGS="$CXXFLAGS_SAVED"
  425. CPPFLAGS="$CPPFLAGS_SAVED"
  426. fi
  427. # produce PIC unless we disable shared libraries. need this for python bindings.
  428. if test $enable_shared != "no" -a "X$GXX" = "Xyes"; then
  429. B10_CXXFLAGS="$B10_CXXFLAGS -fPIC"
  430. fi
  431. AC_SUBST(B10_CXXFLAGS)
  432. # Checks for libraries.
  433. AC_SEARCH_LIBS(inet_pton, [nsl])
  434. AC_SEARCH_LIBS(recvfrom, [socket])
  435. AC_SEARCH_LIBS(nanosleep, [rt])
  436. AC_SEARCH_LIBS(dlsym, [dl])
  437. # Checks for header files.
  438. # Checks for typedefs, structures, and compiler characteristics.
  439. AC_HEADER_STDBOOL
  440. AC_TYPE_SIZE_T
  441. # Detect OS type (it may be used to do OS-specific things, e.g.
  442. # interface detection in DHCP)
  443. AC_MSG_CHECKING(OS family)
  444. system=`uname -s`
  445. case $system in
  446. Linux)
  447. OS_TYPE="Linux"
  448. CPPFLAGS="$CPPFLAGS -DOS_LINUX"
  449. ;;
  450. Darwin | FreeBSD | NetBSD | OpenBSD)
  451. OS_TYPE="BSD"
  452. CPPFLAGS="$CPPFLAGS -DOS_BSD"
  453. ;;
  454. SunOS)
  455. OS_TYPE="Solaris"
  456. CPPFLAGS="$CPPFLAGS -DOS_SUN"
  457. ;;
  458. *)
  459. OS_TYPE="Unknown"
  460. AC_MSG_WARN("Unsupported OS: uname returned $system")
  461. ;;
  462. esac
  463. AC_MSG_RESULT($OS_TYPE)
  464. AM_CONDITIONAL(OS_LINUX, test $OS_TYPE = Linux)
  465. AM_COND_IF([OS_LINUX], [AC_DEFINE([OS_LINUX], [1], [Running on Linux?])])
  466. AM_CONDITIONAL(OS_BSD, test $OS_TYPE = BSD)
  467. AM_COND_IF([OS_BSD], [AC_DEFINE([OS_BSD], [1], [Running on BSD?])])
  468. AM_CONDITIONAL(OS_SOLARIS, test $OS_TYPE = Solaris)
  469. AM_COND_IF([OS_SOLARIS], [AC_DEFINE([OS_SOLARIS], [1], [Running on Solaris?])])
  470. # Deal with variants
  471. AM_CONDITIONAL(OS_FREEBSD, test $system = FreeBSD)
  472. AM_COND_IF([OS_FREEBSD], [AC_DEFINE([OS_FREEBSD], [1], [Running on FreeBSD?])])
  473. AM_CONDITIONAL(OS_NETBSD, test $system = NetBSD)
  474. AM_COND_IF([OS_NETBSD], [AC_DEFINE([OS_NETBSD], [1], [Running on NetBSD?])])
  475. AM_CONDITIONAL(OS_OPENBSD, test $system = OpenBSD)
  476. AM_COND_IF([OS_OPENBSD], [AC_DEFINE([OS_OPENBSD], [1], [Running on OpenBSD?])])
  477. AM_CONDITIONAL(OS_OSX, test $system = Darwin)
  478. AM_COND_IF([OS_OSX], [AC_DEFINE([OS_OSX], [1], [Running on OSX?])])
  479. AC_MSG_CHECKING(for sa_len in struct sockaddr)
  480. AC_TRY_COMPILE([
  481. #include <sys/types.h>
  482. #include <sys/socket.h>],
  483. [struct sockaddr sa; sa.sa_len = 0; return (0);],
  484. [AC_MSG_RESULT(yes)
  485. AC_DEFINE(HAVE_SA_LEN, 1, [Define to 1 if sockaddr has a sa_len member, and corresponding sin_len and sun_len])],
  486. AC_MSG_RESULT(no))
  487. AC_ARG_WITH(pycoverage,
  488. [ --with-pycoverage[=PROGRAM] enable python code coverage using the specified coverage], pycoverage="$withval", pycoverage="no")
  489. if test "$pycoverage" = "no" ; then
  490. # just run the tests normally with python
  491. PYCOVERAGE_RUN="${PYTHON}"
  492. USE_PYCOVERAGE="no"
  493. elif test "$pycoverage" = "yes" ; then
  494. PYCOVERAGE="coverage"
  495. PYCOVERAGE_RUN="${PYCOVERAGE} run --branch --append"
  496. USE_PYCOVERAGE="yes"
  497. else
  498. PYCOVERAGE="$pycoverage"
  499. PYCOVERAGE_RUN="${PYCOVERAGE} run --branch --append"
  500. USE_PYCOVERAGE="yes"
  501. fi
  502. AM_CONDITIONAL(ENABLE_PYTHON_COVERAGE, test x$USE_PYCOVERAGE != xno)
  503. AC_SUBST(PYCOVERAGE)
  504. AC_SUBST(PYCOVERAGE_RUN)
  505. AC_SUBST(USE_PYCOVERAGE)
  506. enable_gtest="no"
  507. GTEST_INCLUDES=
  508. AC_ARG_WITH([gtest-source],
  509. [AS_HELP_STRING([--with-gtest-source=PATH],
  510. [location of the Googletest source, defaults to /usr/src/gtest])],
  511. [enable_gtest="yes" ; GTEST_SOURCE="$withval"],
  512. [GTEST_SOURCE="/usr/src/gtest"])
  513. AC_ARG_WITH([gtest],
  514. [AS_HELP_STRING([--with-gtest=PATH],
  515. [specify a path to gtest header files (PATH/include) and library (PATH/lib)])],
  516. [gtest_path="$withval"; enable_gtest="yes"], [gtest_path="no"])
  517. AC_ARG_WITH(lcov,
  518. [ --with-lcov[=PROGRAM] enable gtest and coverage target using the specified lcov], lcov="$withval", lcov="no")
  519. USE_LCOV="no"
  520. if test "$lcov" != "no"; then
  521. # force gtest if not set
  522. if test "$enable_gtest" = "no"; then
  523. # AC_MSG_ERROR("lcov needs gtest for test coverage report")
  524. AC_MSG_NOTICE([gtest support is now enabled, because used by coverage tests])
  525. enable_gtest="yes"
  526. fi
  527. if test "$lcov" != "yes"; then
  528. LCOV=$lcov
  529. else
  530. AC_PATH_PROG([LCOV], [lcov])
  531. fi
  532. if test -x "${LCOV}"; then
  533. USE_LCOV="yes"
  534. else
  535. AC_MSG_ERROR([Cannot find lcov.])
  536. fi
  537. # is genhtml always in the same directory?
  538. GENHTML=`echo "$LCOV" | ${SED} s/lcov$/genhtml/`
  539. if test ! -x $GENHTML; then
  540. AC_MSG_ERROR([genhtml not found, needed for lcov])
  541. fi
  542. # GCC specific?
  543. CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage"
  544. LIBS=" $LIBS -lgcov"
  545. AC_SUBST(CPPFLAGS)
  546. AC_SUBST(LIBS)
  547. AC_SUBST(LCOV)
  548. AC_SUBST(GENHTML)
  549. fi
  550. AC_SUBST(USE_LCOV)
  551. # Simplified, non-caching AC_CHECK_PROG
  552. # Searches $PATH for the existence of argument 2,
  553. # and sets the full path to the variable in argument 1.
  554. # if not found, and a third argument is given, the value
  555. # is set to that. If not, the value is untouched.
  556. # Does not take absolute paths into account at this point,
  557. # and also works for single files only (arguments are not
  558. # stripped like in AC_CHECK_PROG)
  559. AC_DEFUN([ACX_CHECK_PROG_NONCACHE], [
  560. RESULT=""
  561. IFS_SAVED="$IFS"
  562. IFS=${PATH_SEPARATOR}
  563. for cur_path in ${PATH} ; do
  564. if test -e "${cur_path}/$2" ; then
  565. RESULT="${cur_path}/$2"
  566. fi
  567. done
  568. if test "$RESULT" = "" ; then
  569. :
  570. m4_ifvaln([$3], [$1=$3])
  571. else
  572. $1=$RESULT
  573. fi
  574. IFS="$IFS_SAVED"
  575. ])
  576. # Botan helper test function
  577. # Tries to compile a botan program, given the output of the given
  578. # config tool
  579. # Arguments:
  580. # - name of tool (checked for path), must support --libs and --cflags
  581. # - fixed argument(s) for tool
  582. # - action if successful
  583. AC_DEFUN([ACX_TRY_BOTAN_TOOL], [
  584. TOOL=$1
  585. TOOL_ARG=$2
  586. BOTAN_TOOL=""
  587. ACX_CHECK_PROG_NONCACHE([BOTAN_TOOL], [${TOOL}])
  588. AC_MSG_CHECKING([usability of ${TOOL} ${TOOL_ARG}])
  589. if test "$BOTAN_TOOL" != "" ; then
  590. if test -x ${BOTAN_TOOL}; then
  591. BOTAN_LIBS=`$BOTAN_TOOL $TOOL_ARG --libs`
  592. LIBS_SAVED=${LIBS}
  593. LIBS="$LIBS $BOTAN_LIBS"
  594. BOTAN_INCLUDES=`$BOTAN_TOOL $TOOL_ARG --cflags`
  595. CPPFLAGS_SAVED=${CPPFLAGS}
  596. CPPFLAGS="$BOTAN_INCLUDES $CPPFLAGS"
  597. #AC_MSG_RESULT([found])
  598. AC_LINK_IFELSE(
  599. [AC_LANG_PROGRAM([#include <botan/botan.h>
  600. #include <botan/hash.h>
  601. ],
  602. [using namespace Botan;
  603. LibraryInitializer::initialize();
  604. HashFunction *h = get_hash("MD5");
  605. ])],
  606. [ AC_MSG_RESULT([ok])
  607. $3
  608. ],
  609. [ AC_MSG_RESULT([not usable]) ]
  610. )
  611. LIBS=${LIBS_SAVED}
  612. CPPFLAGS=${CPPFLAGS_SAVED}
  613. else
  614. AC_MSG_RESULT([not executable])
  615. fi
  616. else
  617. AC_MSG_RESULT([not found])
  618. fi
  619. BOTAN_TOOL=""
  620. AC_SUBST(BOTAN_TOOL)
  621. ]
  622. )
  623. # Check for Botan
  624. #
  625. # Unless --with-botan-config is given, we first try to find these config
  626. # scripts ourselves. Unfortunately, on some systems, these scripts do not
  627. # provide the correct implementation, so for each script found, we try
  628. # a compilation test (ACX_TRY_BOTAN_TOOL). If none are found, or none of
  629. # them work, we see if pkg-config is available. If so, we try the several
  630. # potential pkg-config .pc files. Again, on some systems, these can return
  631. # incorrect information as well, so the try-compile test is repeated for
  632. # each.
  633. #
  634. # If a working config script or pkgconfig file is found, we then munge its
  635. # output for use in our Makefiles, and to make sure it works, another header
  636. # and compilation test is done (this should also check whether we can compile
  637. # against botan should neither -config scripts nor pkgconfig data exist).
  638. #
  639. botan_config="yes"
  640. AC_ARG_WITH([botan-config],
  641. AC_HELP_STRING([--with-botan-config=PATH],
  642. [specify the path to the botan-config script]),
  643. [botan_config="$withval"])
  644. if test "${botan_config}" = "no" ; then
  645. AC_MSG_ERROR([Need botan for libcryptolink])
  646. fi
  647. if test "${botan_config}" != "yes" ; then
  648. if test -x "${botan_config}" ; then
  649. if test -d "${botan_config}" ; then
  650. AC_MSG_ERROR([${botan_config} is a directory])
  651. else
  652. BOTAN_CONFIG="${botan_config}"
  653. fi
  654. else
  655. AC_MSG_ERROR([--with-botan-config should point to a botan-config program and not a directory (${botan_config})])
  656. fi
  657. else
  658. BOTAN_CONFIG=""
  659. # first try several possible names of the config script
  660. # (botan-config-1.8 is there just in case, the official name change
  661. # came later)
  662. BOTAN_CONFIG_VERSIONS="botan-config-1.10 botan-config-1.9 botan-config-1.8 botan-config"
  663. for botan_config in $BOTAN_CONFIG_VERSIONS; do
  664. ACX_TRY_BOTAN_TOOL([$botan_config],,
  665. [ BOTAN_CONFIG="$botan_config" ]
  666. )
  667. if test "$BOTAN_CONFIG" != "" ; then
  668. break
  669. fi
  670. done
  671. if test "$BOTAN_CONFIG" = "" ; then
  672. AC_PATH_PROG([PKG_CONFIG], [pkg-config])
  673. if test "$PKG_CONFIG" != "" ; then
  674. # Ok so no script found, see if pkg-config knows of it.
  675. # Unfortunately, the botan.pc files also have their minor version
  676. # in their name, so we need to try them one by one
  677. BOTAN_VERSIONS="botan-1.10 botan-1.9 botan-1.8"
  678. for version in $BOTAN_VERSIONS; do
  679. ACX_TRY_BOTAN_TOOL([pkg-config], ["$version --silence-errors"],
  680. [ BOTAN_CONFIG="$PKG_CONFIG $version" ]
  681. )
  682. if test "$BOTAN_CONFIG" != "" ; then
  683. break
  684. fi
  685. done
  686. fi
  687. fi
  688. fi
  689. if test "x${BOTAN_CONFIG}" != "x"
  690. then
  691. BOTAN_LIBS=`${BOTAN_CONFIG} --libs`
  692. BOTAN_INCLUDES=`${BOTAN_CONFIG} --cflags`
  693. # We expect botan-config --libs to contain -L<path_to_libbotan>, but
  694. # this is not always the case. As a heuristics workaround we add
  695. # -L`botan-config --prefix/lib` in this case (if not present already).
  696. # Same for BOTAN_INCLUDES (but using include instead of lib) below.
  697. if [ ${BOTAN_CONFIG} --prefix >/dev/null 2>&1 ] ; then
  698. echo ${BOTAN_LIBS} | grep -- -L > /dev/null || \
  699. BOTAN_LIBS="-L`${BOTAN_CONFIG} --prefix`/lib ${BOTAN_LIBS}"
  700. echo ${BOTAN_INCLUDES} | grep -- -I > /dev/null || \
  701. BOTAN_INCLUDES="-I`${BOTAN_CONFIG} --prefix`/include ${BOTAN_INCLUDES}"
  702. fi
  703. fi
  704. dnl Determine the Botan version
  705. AC_MSG_CHECKING([Botan version])
  706. cat > conftest.cpp << EOF
  707. #include <botan/version.h>
  708. AUTOCONF_BOTAN_VERSION=BOTAN_VERSION_MAJOR . BOTAN_VERSION_MINOR . BOTAN_VERSION_PATCH
  709. EOF
  710. BOTAN_VERSION=`$CPP $CPPFLAGS $BOTAN_INCLUDES conftest.cpp | grep '^AUTOCONF_BOTAN_VERSION=' | $SED -e 's/^AUTOCONF_BOTAN_VERSION=//' -e 's/[[ ]]//g' -e 's/"//g' 2> /dev/null`
  711. if test -z "$BOTAN_VERSION"; then
  712. BOTAN_VERSION="unknown"
  713. fi
  714. $RM -f conftest.cpp
  715. AC_MSG_RESULT([$BOTAN_VERSION])
  716. # botan-config script (and the way we call pkg-config) returns -L and -l
  717. # as one string, but we need them in separate values
  718. BOTAN_LDFLAGS=
  719. BOTAN_NEWLIBS=
  720. for flag in ${BOTAN_LIBS}; do
  721. BOTAN_LDFLAGS="${BOTAN_LDFLAGS} `echo $flag | ${SED} -ne '/^\(\-L\)/p'`"
  722. BOTAN_LIBS="${BOTAN_LIBS} `echo $flag | ${SED} -ne '/^\(\-l\)/p'`"
  723. done
  724. # See python_rpath for some info on why we do this
  725. if test "x$ISC_RPATH_FLAG" != "x"; then
  726. BOTAN_RPATH=
  727. for flag in ${BOTAN_LIBS}; do
  728. BOTAN_RPATH="${BOTAN_RPATH} `echo $flag | ${SED} -ne "s/^\(\-L\)/${ISC_RPATH_FLAG}/p"`"
  729. done
  730. AC_SUBST(BOTAN_RPATH)
  731. # According to the libtool manual, it should be sufficient if we
  732. # specify the "-R libdir" in our wrapper library of botan (no other
  733. # programs will need libbotan directly); "libdir" should be added to
  734. # the program's binary image. But we've seen in our build environments
  735. # that (some versions of?) libtool doesn't propagate -R as documented,
  736. # and it caused a linker error at run time. To work around this, we
  737. # also add the rpath to the global LDFLAGS.
  738. LDFLAGS="$BOTAN_RPATH $LDFLAGS"
  739. fi
  740. AC_SUBST(BOTAN_LDFLAGS)
  741. AC_SUBST(BOTAN_LIBS)
  742. AC_SUBST(BOTAN_INCLUDES)
  743. # Even though chances are high we already performed a real compilation check
  744. # in the search for the right (pkg)config data, we try again here, to
  745. # be sure.
  746. CPPFLAGS_SAVED=$CPPFLAGS
  747. CPPFLAGS="$BOTAN_INCLUDES $CPPFLAGS"
  748. LIBS_SAVED="$LIBS"
  749. LIBS="$LIBS $BOTAN_LIBS"
  750. # ac_header_preproc is an autoconf symbol (undocumented but stable) that
  751. # is set if the pre-processor phase passes. Thus by adding a custom
  752. # failure handler we can detect the difference between a header not existing
  753. # (or not even passing the pre-processor phase) and a header file resulting
  754. # in compilation failures.
  755. AC_CHECK_HEADERS([botan/botan.h],,[
  756. if test "x$ac_header_preproc" = "xyes"; then
  757. AC_MSG_ERROR([
  758. botan/botan.h was found but is unusable. The most common cause of this problem
  759. is attempting to use an updated C++ compiler with older C++ libraries, such as
  760. the version of Botan that comes with your distribution. If you have updated
  761. your C++ compiler we highly recommend that you use support libraries such as
  762. Boost and Botan that were compiled with the same compiler version.])
  763. else
  764. AC_MSG_ERROR([Missing required header files.])
  765. fi]
  766. )
  767. AC_LINK_IFELSE(
  768. [AC_LANG_PROGRAM([#include <botan/botan.h>
  769. #include <botan/hash.h>
  770. ],
  771. [using namespace Botan;
  772. LibraryInitializer::initialize();
  773. HashFunction *h = get_hash("MD5");
  774. ])],
  775. [AC_MSG_RESULT([checking for Botan library... yes])],
  776. [AC_MSG_RESULT([checking for Botan library... no])
  777. AC_MSG_ERROR([Needs Botan library 1.8 or higher. On some systems,
  778. the botan package has a few missing dependencies (libbz2 and
  779. libgmp), if libbotan has been installed and you see this error,
  780. try upgrading to a higher version of botan or installing libbz2
  781. and libgmp.])]
  782. )
  783. CPPFLAGS=$CPPFLAGS_SAVED
  784. LIBS=$LIBS_SAVED
  785. # Check for MySql. The path to the mysql_config program is given with
  786. # the --with-mysql-config (default to /usr/bin/mysql-config). By default,
  787. # the software is not built with MySQL support enabled.
  788. mysql_config="no"
  789. AC_ARG_WITH([dhcp-mysql],
  790. AC_HELP_STRING([--with-dhcp-mysql=PATH],
  791. [path to the MySQL 'mysql_config' script (MySQL is used for the DHCP database)]),
  792. [mysql_config="$withval"])
  793. if test "${mysql_config}" = "yes" ; then
  794. MYSQL_CONFIG="/usr/bin/mysql_config"
  795. elif test "${mysql_config}" != "no" ; then
  796. MYSQL_CONFIG="${withval}"
  797. fi
  798. if test "$MYSQL_CONFIG" != "" ; then
  799. if test -d "$MYSQL_CONFIG" -o ! -x "$MYSQL_CONFIG" ; then
  800. AC_MSG_ERROR([--with-dhcp-mysql should point to a mysql_config program])
  801. fi
  802. MYSQL_CPPFLAGS=`$MYSQL_CONFIG --cflags`
  803. MYSQL_LIBS=`$MYSQL_CONFIG --libs`
  804. MYSQL_VERSION=`$MYSQL_CONFIG --version`
  805. AC_SUBST(MYSQL_CPPFLAGS)
  806. AC_SUBST(MYSQL_LIBS)
  807. # Check that a simple program using MySQL functions can compile and link.
  808. CPPFLAGS_SAVED="$CPPFLAGS"
  809. LIBS_SAVED="$LIBS"
  810. CPPFLAGS="$MYSQL_CPPFLAGS $CPPFLAGS"
  811. LIBS="$MYSQL_LIBS $LIBS"
  812. AC_LINK_IFELSE(
  813. [AC_LANG_PROGRAM([#include <mysql.h>],
  814. [MYSQL mysql_handle;
  815. (void) mysql_init(&mysql_handle);
  816. ])],
  817. [AC_MSG_RESULT([checking for MySQL headers and library... yes])],
  818. [AC_MSG_RESULT([checking for MySQL headers and library... no])
  819. AC_MSG_ERROR([Needs MySQL library])]
  820. )
  821. CPPFLAGS=$CPPFLAGS_SAVED
  822. LIBS=$LIBS_SAVED
  823. # Note that MYSQL is present in the config.h file
  824. AC_DEFINE([HAVE_MYSQL], [1], [MySQL is present])
  825. fi
  826. # Solaris puts FIONREAD in filio.h
  827. AC_CHECK_HEADERS(sys/filio.h,,,)
  828. # ... and at the shell level, so Makefile.am can take action depending on this.
  829. AM_CONDITIONAL(HAVE_MYSQL, test "$MYSQL_CONFIG" != "")
  830. pg_config="no"
  831. AC_ARG_WITH([dhcp-pgsql],
  832. AC_HELP_STRING([--with-dhcp-pgsql=PATH],
  833. [path to the PostgreSQL 'pg_config' script]),
  834. [pg_config="$withval"])
  835. if test "${pg_config}" = "yes" ; then
  836. PG_CONFIG="/usr/bin/pg_config"
  837. elif test "${pg_config}" != "no" ; then
  838. PG_CONFIG="${withval}"
  839. fi
  840. if test "$PG_CONFIG" != "" ; then
  841. if test -d "$PG_CONFIG" -o ! -x "$PG_CONFIG" ; then
  842. AC_MSG_ERROR([--with-dhcp-pgsql should point to a pg_config program])
  843. fi
  844. PGSQL_CPPFLAGS=`$PG_CONFIG --cppflags`
  845. PGSQL_INCLUDEDIR=`$PG_CONFIG --includedir`
  846. PGSQL_INCLUDEDIR_SERVER=`$PG_CONFIG --includedir-server`
  847. PGSQL_CPPFLAGS="$PGSQL_CPPFLAGS -I$PGSQL_INCLUDEDIR -I$PGSQL_INCLUDEDIR_SERVER"
  848. PGSQL_LIBS=`$PG_CONFIG --libdir`
  849. PGSQL_LIBS="-L$PGSQL_LIBS -lpq"
  850. PGSQL_VERSION=`$PG_CONFIG --version`
  851. AC_SUBST(PGSQL_CPPFLAGS)
  852. AC_SUBST(PGSQL_LIBS)
  853. # Check that a simple program using PostgreSQL functions can compile and link.
  854. CPPFLAGS_SAVED="$CPPFLAGS"
  855. LIBS_SAVED="$LIBS"
  856. CPPFLAGS="$PGSQL_CPPFLAGS $CPPFLAGS"
  857. LIBS="$PGSQL_LIBS $LIBS"
  858. AC_LINK_IFELSE(
  859. [AC_LANG_PROGRAM([#include <libpq-fe.h>],
  860. [PGconn * c = PQconnectdb("dbname = 'postgres'");
  861. PQfinish(c);])],
  862. [AC_MSG_RESULT([checking for PostgreSQL headers and library... yes])],
  863. [AC_MSG_RESULT([checking for PostgreSQL headers and library... no])
  864. AC_MSG_ERROR([Needs PostgreSQL library])]
  865. )
  866. CPPFLAGS=$CPPFLAGS_SAVED
  867. LIBS=$LIBS_SAVED
  868. # Note that PostgreSQL is present in the config.h file
  869. AC_DEFINE([HAVE_PGSQL], [1], [PostgreSQL is present])
  870. fi
  871. # ... and at the shell level, so Makefile.am can take action depending on this.
  872. AM_CONDITIONAL(HAVE_PGSQL, test "$PG_CONFIG" != "")
  873. # Check for log4cplus
  874. log4cplus_path="yes"
  875. AC_ARG_WITH([log4cplus],
  876. AC_HELP_STRING([--with-log4cplus=PATH],
  877. [specify exact directory of log4cplus library and headers]),
  878. [log4cplus_path="$withval"])
  879. if test "${log4cplus_path}" = "no" ; then
  880. AC_MSG_ERROR([Need log4cplus])
  881. elif test "${log4cplus_path}" != "yes" ; then
  882. LOG4CPLUS_INCLUDES="-I${log4cplus_path}/include"
  883. LOG4CPLUS_LIBS="-L${log4cplus_path}/lib"
  884. else
  885. # If not specified, try some common paths.
  886. log4cplusdirs="/usr/local /usr/pkg /opt /opt/local"
  887. for d in $log4cplusdirs
  888. do
  889. if test -f $d/include/log4cplus/logger.h; then
  890. LOG4CPLUS_INCLUDES="-I$d/include"
  891. LOG4CPLUS_LIBS="-L$d/lib"
  892. break
  893. fi
  894. done
  895. fi
  896. LOG4CPLUS_LIBS="$LOG4CPLUS_LIBS -llog4cplus $MULTITHREADING_FLAG"
  897. AC_SUBST(LOG4CPLUS_LIBS)
  898. AC_SUBST(LOG4CPLUS_INCLUDES)
  899. CPPFLAGS_SAVED=$CPPFLAGS
  900. CPPFLAGS="$LOG4CPLUS_INCLUDES $CPPFLAGS"
  901. LIBS_SAVED="$LIBS"
  902. LIBS="$LOG4CPLUS_LIBS $LIBS"
  903. AC_CHECK_HEADERS([log4cplus/logger.h],,AC_MSG_ERROR([Missing required header files.]))
  904. AC_LINK_IFELSE(
  905. [AC_LANG_PROGRAM([#include <log4cplus/logger.h>
  906. ],
  907. [using namespace log4cplus;
  908. Logger logger = Logger::getInstance("main");
  909. ])],
  910. [AC_MSG_RESULT([checking for log4cplus library... yes])],
  911. [AC_MSG_RESULT([checking for log4cplus library... no])
  912. AC_MSG_ERROR([Needs log4cplus library])]
  913. )
  914. dnl Determine the log4cplus version, used mainly for config.report.
  915. AC_MSG_CHECKING([log4cplus version])
  916. cat > conftest.cpp << EOF
  917. #include <log4cplus/version.h>
  918. AUTOCONF_LOG4CPLUS_VERSION=LOG4CPLUS_VERSION_STR
  919. EOF
  920. LOG4CPLUS_VERSION=`$CPP $CPPFLAGS conftest.cpp | grep '^AUTOCONF_LOG4CPLUS_VERSION=' | $SED -e 's/^AUTOCONF_LOG4CPLUS_VERSION=//' -e 's/[[ ]]//g' -e 's/"//g' 2> /dev/null`
  921. if test -z "$LOG4CPLUS_VERSION"; then
  922. LOG4CPLUS_VERSION="unknown"
  923. fi
  924. $RM -f conftest.cpp
  925. AC_MSG_RESULT([$LOG4CPLUS_VERSION])
  926. CPPFLAGS=$CPPFLAGS_SAVED
  927. LIBS=$LIBS_SAVED
  928. #
  929. # Configure Boost header path
  930. #
  931. AX_BOOST_FOR_BIND10
  932. # Boost offset_ptr is required in one library and not optional right now, so
  933. # we unconditionally fail here if it doesn't work.
  934. if test "$BOOST_OFFSET_PTR_WOULDFAIL" = "yes" -a "$werror_ok" = 1; then
  935. AC_MSG_ERROR([Failed to compile a required header file. Try upgrading Boost to 1.44 or higher (when using clang++) or specifying --without-werror. See the ChangeLog entry for Trac no. 2147 for more details.])
  936. fi
  937. if test "$BOOST_STATIC_ASSERT_WOULDFAIL" = "yes" -a X"$werror_ok" = X1; then
  938. AC_MSG_ERROR([Failed to use Boost static assertions. Try upgrading Boost to 1.54 or higher (when using GCC 4.8) or specifying --without-werror. See trac ticket no. 3039 for more details.])
  939. fi
  940. # There's a known bug in FreeBSD ports for Boost that would trigger a false
  941. # warning in build with g++ and -Werror (we exclude clang++ explicitly to
  942. # avoid unexpected false positives).
  943. if test "$BOOST_NUMERIC_CAST_WOULDFAIL" = "yes" -a X"$werror_ok" = X1 -a $CLANGPP = "no"; then
  944. AC_MSG_ERROR([Failed to compile a required header file. If you are using FreeBSD and Boost installed via ports, retry with specifying --without-werror. See the ChangeLog entry for Trac no. 1991 for more details.])
  945. fi
  946. use_shared_memory=yes
  947. AC_ARG_WITH(shared-memory,
  948. AC_HELP_STRING([--with-shared-memory],
  949. [Build with Boost shared memory support; for large scale authoritative DNS servers]),
  950. [use_shared_memory=$withval])
  951. if test X$use_shared_memory = Xyes -a "$BOOST_MAPPED_FILE_WOULDFAIL" = "yes" -a "$want_dns" = "yes"; then
  952. AC_MSG_ERROR([Boost shared memory does not compile on this system. If you don't need it (most normal users won't) build without it by rerunning this script with --without-shared-memory; using a different compiler or a different version of Boost may also help.])
  953. fi
  954. AM_CONDITIONAL([USE_SHARED_MEMORY], [test x$use_shared_memory = xyes])
  955. if test "x$use_shared_memory" = "xyes"; then
  956. AC_DEFINE(USE_SHARED_MEMORY, 1, [Define to 1 if shared memory support is enabled])
  957. fi
  958. AC_SUBST(BOOST_MAPPED_FILE_CXXFLAG)
  959. if test "$BOOST_OFFSET_PTR_OLD" = "yes" -a "$use_shared_memory" = "yes" -a "$want_dns" = "yes"; then
  960. AC_MSG_ERROR([You're trying to compile against boost older than 1.48 with
  961. shared memory. Older versions of boost have a bug which causes segfaults in
  962. offset_ptr implementation when compiled by GCC with optimisations enabled.
  963. See ticket no. 3025 for details.
  964. Either update boost to newer version or use --without-shared-memory.
  965. Note that most users likely don't need shared memory support.
  966. ])
  967. fi
  968. # Add some default CPP flags needed for Boost, identified by the AX macro.
  969. CPPFLAGS="$CPPFLAGS $CPPFLAGS_BOOST_THREADCONF"
  970. # I can't get some of the #include <asio.hpp> right without this
  971. # TODO: find the real cause of asio/boost wanting pthreads
  972. # (this currently only occurs for src/lib/cc/session_unittests)
  973. PTHREAD_LDFLAGS=
  974. AC_CHECK_LIB(pthread, pthread_create,[ PTHREAD_LDFLAGS=-lpthread ], [])
  975. AC_SUBST(PTHREAD_LDFLAGS)
  976. AC_SUBST(MULTITHREADING_FLAG)
  977. #
  978. # Check availability of gtest, which will be used for unit tests.
  979. #
  980. GTEST_LDFLAGS=
  981. GTEST_LDADD=
  982. DISTCHECK_GTEST_CONFIGURE_FLAG=
  983. GTEST_VERSION="unknown"
  984. if test "x$enable_gtest" = "xyes" ; then
  985. DISTCHECK_GTEST_CONFIGURE_FLAG="--with-gtest=$gtest_path"
  986. if test -n "$with_gtest_source" ; then
  987. if test "x$GTEST_SOURCE" = "xyes" ; then
  988. AC_MSG_CHECKING([for gtest source])
  989. # If not specified, try some common paths.
  990. GTEST_SOURCE=
  991. for d in /usr/src/gtest /usr/local /usr/pkg /opt /opt/local ; do
  992. if test -f $d/src/gtest-all.cc -a $d/src/gtest_main.cc; then
  993. GTEST_SOURCE=$d
  994. AC_MSG_RESULT([$GTEST_SOURCE])
  995. break
  996. fi
  997. done
  998. if test -z $GTEST_SOURCE ; then
  999. AC_MSG_ERROR([no gtest source but it was selected])
  1000. fi
  1001. else
  1002. AC_CHECK_FILES([$GTEST_SOURCE/src/gtest-all.cc]
  1003. [$GTEST_SOURCE/src/gtest_main.cc],
  1004. [have_gtest_source=yes],
  1005. [AC_MSG_ERROR([no gtest source at $GTEST_SOURCE])])
  1006. fi
  1007. have_gtest_source=yes
  1008. GTEST_LDFLAGS="\$(top_builddir)/libgtest.a"
  1009. DISTCHECK_GTEST_CONFIGURE_FLAG="--with-gtest-source=$GTEST_SOURCE"
  1010. GTEST_INCLUDES="-I$GTEST_SOURCE -I$GTEST_SOURCE/include"
  1011. # See $GTEST_SOURCE/include/gtest/internal/gtest-port.h
  1012. # about GTEST_HAS_PTHREAD.
  1013. case "$host" in
  1014. *-solaris*|*-linux*|*-hpux*)
  1015. GTEST_LDADD="$GTEST_LDADD $PTHREAD_LDFLAGS"
  1016. ;;
  1017. esac
  1018. fi
  1019. if test "$gtest_path" != "no" ; then
  1020. if test "$gtest_path" != "yes"; then
  1021. GTEST_PATHS=$gtest_path
  1022. if test -x "${gtest_path}/bin/gtest-config" ; then
  1023. GTEST_CONFIG="${gtest_path}/bin/gtest-config"
  1024. fi
  1025. else
  1026. AC_PATH_PROG([GTEST_CONFIG], [gtest-config])
  1027. fi
  1028. if test -x "${GTEST_CONFIG}" ; then :
  1029. # using cppflags instead of cxxflags
  1030. GTEST_INCLUDES=`${GTEST_CONFIG} --cppflags`
  1031. GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`
  1032. GTEST_LDADD=`${GTEST_CONFIG} --libs`
  1033. GTEST_VERSION=`${GTEST_CONFIG} --version`
  1034. GTEST_FOUND="true"
  1035. else
  1036. AC_MSG_WARN([Unable to locate Google Test gtest-config.])
  1037. if test -z "${GTEST_PATHS}" ; then
  1038. GTEST_PATHS="/usr /usr/local"
  1039. fi
  1040. GTEST_FOUND="false"
  1041. fi
  1042. if test "${GTEST_FOUND}" != "true"; then
  1043. GTEST_FOUND="false"
  1044. for dir in $GTEST_PATHS; do
  1045. if test -f "$dir/include/gtest/gtest.h"; then
  1046. GTEST_INCLUDES="-I$dir/include"
  1047. GTEST_LDFLAGS="-L$dir/lib"
  1048. GTEST_LDADD="-lgtest"
  1049. GTEST_FOUND="true"
  1050. # There is no gtest-config script on this
  1051. # system, which is supposed to inform us
  1052. # whether we need pthreads as well (a
  1053. # gtest compile-time option). So we still
  1054. # need to test that manually.
  1055. CPPFLAGS_SAVED="$CPPFLAGS"
  1056. CPPFLAGS="$CPPFLAGS $GTEST_INCLUDES"
  1057. LDFLAGS_SAVED="$LDFLAGS"
  1058. LDFLAGS="$LDFLAGS $GTEST_LDFLAGS"
  1059. LIBS_SAVED=$LIBS
  1060. LIBS="$LIBS $GTEST_LDADD"
  1061. AC_MSG_CHECKING([Checking whether gtest tests need pthreads])
  1062. # First try to compile without pthreads
  1063. AC_TRY_LINK([
  1064. #include <gtest/gtest.h>
  1065. ],[
  1066. int i = 0;
  1067. char* c = NULL;
  1068. ::testing::InitGoogleTest(&i, &c);
  1069. return (0);
  1070. ],
  1071. [ AC_MSG_RESULT(no) ],
  1072. [
  1073. LIBS="$SAVED_LIBS $GTEST_LDADD $PTHREAD_LDFLAGS"
  1074. # Now try to compile with pthreads
  1075. AC_TRY_LINK([
  1076. #include <gtest/gtest.h>
  1077. ],[
  1078. int i = 0;
  1079. char* c = NULL;
  1080. ::testing::InitGoogleTest(&i, &c);
  1081. return (0);
  1082. ],
  1083. [ AC_MSG_RESULT(yes)
  1084. GTEST_LDADD="$GTEST_LDADD $PTHREAD_LDFLAGS"
  1085. ],
  1086. # Apparently we can't compile it at all
  1087. [ AC_MSG_ERROR(unable to compile with gtest) ])
  1088. ])
  1089. CPPFLAGS=$CPPFLAGS_SAVED
  1090. LDFLAGS=$LDFLAGS_SAVED
  1091. LIBS=$LIBS_SAVED
  1092. break
  1093. fi
  1094. done
  1095. fi
  1096. if test "${GTEST_FOUND}" != "true"; then
  1097. AC_MSG_ERROR([Cannot find gtest in: $GTEST_PATHS])
  1098. fi
  1099. fi
  1100. fi
  1101. AM_CONDITIONAL(HAVE_GTEST, test $enable_gtest != "no")
  1102. AM_CONDITIONAL(HAVE_GTEST_SOURCE, test "X$have_gtest_source" = "Xyes")
  1103. AC_SUBST(DISTCHECK_GTEST_CONFIGURE_FLAG)
  1104. AC_SUBST(GTEST_INCLUDES)
  1105. AC_SUBST(GTEST_LDFLAGS)
  1106. AC_SUBST(GTEST_LDADD)
  1107. AC_SUBST(GTEST_SOURCE)
  1108. dnl check for pkg-config itself
  1109. AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes, no)
  1110. if test "x$HAVE_PKG_CONFIG" = "xno" ; then
  1111. AC_MSG_ERROR(Please install pkg-config)
  1112. fi
  1113. #
  1114. # ASIO: we extensively use it as the C++ event management module.
  1115. #
  1116. # Use local ASIO headers from ext
  1117. #
  1118. CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/ext/asio"
  1119. #
  1120. # Use our 'coroutine' header from ext
  1121. CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/ext/coroutine"
  1122. #
  1123. # Disable threads: Currently we don't use them.
  1124. CPPFLAGS="$CPPFLAGS -DASIO_DISABLE_THREADS=1"
  1125. # Check for functions that are not available on all platforms
  1126. AC_CHECK_FUNCS([pselect])
  1127. # /dev/poll issue: ASIO uses /dev/poll by default if it's available (generally
  1128. # the case with Solaris). Unfortunately its /dev/poll specific code would
  1129. # trigger the gcc's "missing-field-initializers" warning, which would
  1130. # subsequently make the build fail with -Werror. Further, older versions of
  1131. # gcc don't provide an option to selectively suppress this warning.
  1132. # So, for the moment, we simply disable the use of /dev/poll. Unless we
  1133. # implement recursive DNS server with randomized ports, we don't need the
  1134. # scalability that /dev/poll can provide, so this decision wouldn't affect
  1135. # run time performance. Hopefully we can find a better solution or the ASIO
  1136. # code will be updated by the time we really need it.
  1137. AC_CHECK_HEADERS(sys/devpoll.h, ac_cv_have_devpoll=yes, ac_cv_have_devpoll=no)
  1138. if test "X$ac_cv_have_devpoll" = "Xyes" -a "X$GXX" = "Xyes"; then
  1139. CPPFLAGS="$CPPFLAGS -DASIO_DISABLE_DEV_POLL=1"
  1140. fi
  1141. #
  1142. # Perl is optional; it is used only by some of the system test scripts.
  1143. #
  1144. AC_PATH_PROGS(PERL, perl5 perl)
  1145. AC_SUBST(PERL)
  1146. AC_PATH_PROGS(AWK, gawk awk)
  1147. AC_SUBST(AWK)
  1148. # Kea configuration backend section
  1149. # Currently there are 2 backends available: BUNDY and JSON
  1150. # It is possible that we may extend this to accept additional backends.
  1151. AC_ARG_WITH(kea-config,
  1152. AC_HELP_STRING([--with-kea-config],
  1153. [Selects configuration backend; currently available options are: BUNDY (default,
  1154. Kea reads configuration and commands from Bundy framework) or JSON (Kea reads
  1155. configuration from a JSON file from disk)]),
  1156. [CONFIG_BACKEND="$withval"],
  1157. [CONFIG_BACKEND=BUNDY])
  1158. AM_CONDITIONAL(CONFIG_BACKEND_BUNDY, test "x$CONFIG_BACKEND" = "xBUNDY")
  1159. AM_CONDITIONAL(CONFIG_BACKEND_JSON, test "x$CONFIG_BACKEND" = "xJSON")
  1160. if test "x$CONFIG_BACKEND" = "xBUNDY"; then
  1161. AC_DEFINE(CONFIG_BACKEND_BUNDY, 1, [Define to 1 if Kea config was set to BUNDY])
  1162. fi
  1163. if test "x$CONFIG_BACKEND" = "xJSON"; then
  1164. AC_DEFINE(CONFIG_BACKEND_JSON, 1, [Define to 1 if Kea config was set to JSON])
  1165. fi
  1166. # Let's sanity check if the specified backend value is allowed
  1167. if test "x$CONFIG_BACKEND" != "xBUNDY" && test "x$CONFIG_BACKEND" != "xJSON"; then
  1168. AC_MSG_ERROR("Invalid configuration backend specified: $CONFIG_BACKEND. The only supported are: BUNDY JSON")
  1169. fi
  1170. AC_ARG_ENABLE(generate_docs, [AC_HELP_STRING([--enable-generate-docs],
  1171. [regenerate documentation using Docbook [default=no]])],
  1172. enable_generate_docs=$enableval, enable_generate_docs=no)
  1173. # Check for xsltproc
  1174. if test "x$enable_generate_docs" != xno ; then
  1175. AC_PATH_PROG([XSLTPROC], [xsltproc])
  1176. if test -z "$XSLTPROC"; then
  1177. AC_MSG_ERROR("xsltproc not found; it is required for --enable-generate-docs")
  1178. else
  1179. AC_MSG_CHECKING([if $XSLTPROC works])
  1180. # run xsltproc to see if works
  1181. $XSLTPROC --novalid --xinclude --nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
  1182. if test $? -ne 0 ; then
  1183. AC_MSG_ERROR("Error with $XSLTPROC using release/xsl/current/manpages/docbook.xsl")
  1184. fi
  1185. $XSLTPROC --novalid --xinclude --nonet http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl
  1186. if test $? -ne 0 ; then
  1187. AC_MSG_ERROR("Error with $XSLTPROC using release/xsl/current/html/docbook.xsl")
  1188. fi
  1189. AC_MSG_RESULT(yes)
  1190. fi
  1191. AC_PATH_PROG([ELINKS], [elinks])
  1192. if test -z "$ELINKS"; then
  1193. AC_MSG_ERROR("elinks not found; it is required for --enable-generate-docs")
  1194. fi
  1195. fi
  1196. AM_CONDITIONAL(GENERATE_DOCS, test x$enable_generate_docs != xno)
  1197. AC_ARG_ENABLE(install-configurations,
  1198. [AC_HELP_STRING([--disable-install-configurations],
  1199. [do not install configuration])], install_configurations=$enableval, install_configurations=yes)
  1200. AM_CONDITIONAL(INSTALL_CONFIGURATIONS, test x$install_configurations = xyes || test x$install_configurations = xtrue)
  1201. AC_ARG_ENABLE(logger-checks, [AC_HELP_STRING([--enable-logger-checks],
  1202. [check logger messages [default=no]])], enable_logger_checks=$enableval, enable_logger_checks=no)
  1203. AM_CONDITIONAL(ENABLE_LOGGER_CHECKS, test x$enable_logger_checks != xno)
  1204. AM_COND_IF([ENABLE_LOGGER_CHECKS], [AC_DEFINE([ENABLE_LOGGER_CHECKS], [1], [Check logger messages?])])
  1205. # Check for asciidoc
  1206. AC_PATH_PROG(ASCIIDOC, asciidoc, no)
  1207. AM_CONDITIONAL(HAVE_ASCIIDOC, test "x$ASCIIDOC" != "xno")
  1208. # Check for plantuml
  1209. AC_PATH_PROG(PLANTUML, plantuml, no)
  1210. AM_CONDITIONAL(HAVE_PLANTUML, test "x$PLANTUML" != "xno")
  1211. # Check for valgrind
  1212. AC_PATH_PROG(VALGRIND, valgrind, no)
  1213. AM_CONDITIONAL(HAVE_VALGRIND, test "x$VALGRIND" != "xno")
  1214. # Also check for valgrind headers
  1215. # We could consider adding them to the source code tree, as this
  1216. # is the encouraged method of using them; they are BSD-licensed.
  1217. # However, until we find that this is a problem, we just use
  1218. # the system-provided ones, if available
  1219. AC_CHECK_HEADERS(valgrind/valgrind.h, [AC_DEFINE([HAVE_VALGRIND_HEADERS], [1], [Check valgrind headers])])
  1220. found_valgrind="not found"
  1221. if test "x$VALGRIND" != "xno"; then
  1222. found_valgrind="found"
  1223. fi
  1224. # Check for optreset in unistd.h. On BSD systems the optreset is
  1225. # used to reset the state of getopt() function. Resetting its state
  1226. # is required if command line arguments are parsed multiple times
  1227. # during a program. On Linux this variable will not exist because
  1228. # getopt() reset is performed by setting optind = 0. On Operating
  1229. # Systems where optreset is defined use optreset = 1 and optind = 1
  1230. # to reset internal state of getopt(). Failing to do so will result
  1231. # in unpredictable output from getopt().
  1232. AC_MSG_CHECKING([whether optreset variable is defined in unistd.h])
  1233. AC_TRY_LINK(
  1234. [#include <unistd.h>],
  1235. [extern int optreset; optreset=1;],
  1236. [ AC_MSG_RESULT(yes)
  1237. var_optreset_exists=yes],
  1238. [ AC_MSG_RESULT(no)
  1239. var_optreset_exists=no]
  1240. )
  1241. AM_CONDITIONAL(HAVE_OPTRESET, test "x$var_optreset_exists" != "xno")
  1242. AM_COND_IF([HAVE_OPTRESET], [AC_DEFINE([HAVE_OPTRESET], [1], [Check for optreset?])])
  1243. AC_CONFIG_FILES([compatcheck/Makefile
  1244. dns++.pc
  1245. doc/design/datasrc/Makefile
  1246. doc/design/Makefile
  1247. doc/guide/Makefile
  1248. doc/Makefile
  1249. doc/version.ent
  1250. ext/asio/asio/Makefile
  1251. ext/asio/Makefile
  1252. ext/Makefile
  1253. m4macros/Makefile
  1254. Makefile
  1255. src/bin/d2/Makefile
  1256. src/bin/d2/spec_config.h.pre
  1257. src/bin/d2/tests/Makefile
  1258. src/bin/d2/tests/test_data_files_config.h
  1259. src/bin/dhcp4/Makefile
  1260. src/bin/dhcp4/spec_config.h.pre
  1261. src/bin/dhcp4/tests/Makefile
  1262. src/bin/dhcp4/tests/marker_file.h
  1263. src/bin/dhcp4/tests/test_data_files_config.h
  1264. src/bin/dhcp4/tests/test_libraries.h
  1265. src/bin/dhcp6/Makefile
  1266. src/bin/dhcp6/spec_config.h.pre
  1267. src/bin/dhcp6/tests/Makefile
  1268. src/bin/dhcp6/tests/marker_file.h
  1269. src/bin/dhcp6/tests/test_data_files_config.h
  1270. src/bin/dhcp6/tests/test_libraries.h
  1271. src/bin/Makefile
  1272. src/bin/sockcreator/Makefile
  1273. src/bin/sockcreator/tests/Makefile
  1274. src/hooks/dhcp/Makefile
  1275. src/hooks/dhcp/user_chk/Makefile
  1276. src/hooks/dhcp/user_chk/tests/Makefile
  1277. src/hooks/dhcp/user_chk/tests/test_data_files_config.h
  1278. src/hooks/Makefile
  1279. src/lib/asiodns/Makefile
  1280. src/lib/asiodns/tests/Makefile
  1281. src/lib/asiolink/Makefile
  1282. src/lib/asiolink/tests/Makefile
  1283. src/lib/cc/Makefile
  1284. src/lib/cc/session_config.h.pre
  1285. src/lib/cc/tests/Makefile
  1286. src/lib/cc/tests/session_unittests_config.h
  1287. src/lib/config/Makefile
  1288. src/lib/config/tests/data_def_unittests_config.h
  1289. src/lib/config/tests/Makefile
  1290. src/lib/config/tests/testdata/Makefile
  1291. src/lib/cryptolink/Makefile
  1292. src/lib/cryptolink/tests/Makefile
  1293. src/lib/dhcp_ddns/Makefile
  1294. src/lib/dhcp_ddns/tests/Makefile
  1295. src/lib/dhcp/Makefile
  1296. src/lib/dhcpsrv/Makefile
  1297. src/lib/dhcpsrv/testutils/Makefile
  1298. src/lib/dhcpsrv/tests/Makefile
  1299. src/lib/dhcpsrv/tests/test_libraries.h
  1300. src/lib/dhcp/tests/Makefile
  1301. src/lib/dns/gen-rdatacode.py
  1302. src/lib/dns/Makefile
  1303. src/lib/dns/tests/Makefile
  1304. src/lib/dns/tests/testdata/Makefile
  1305. src/lib/exceptions/Makefile
  1306. src/lib/exceptions/tests/Makefile
  1307. src/lib/hooks/Makefile
  1308. src/lib/hooks/tests/Makefile
  1309. src/lib/hooks/tests/marker_file.h
  1310. src/lib/hooks/tests/test_libraries.h
  1311. src/lib/log/compiler/Makefile
  1312. src/lib/log/interprocess/Makefile
  1313. src/lib/log/interprocess/tests/Makefile
  1314. src/lib/log/Makefile
  1315. src/lib/log/tests/buffer_logger_test.sh
  1316. src/lib/log/tests/console_test.sh
  1317. src/lib/log/tests/destination_test.sh
  1318. src/lib/log/tests/init_logger_test.sh
  1319. src/lib/log/tests/local_file_test.sh
  1320. src/lib/log/tests/logger_lock_test.sh
  1321. src/lib/log/tests/Makefile
  1322. src/lib/log/tests/severity_test.sh
  1323. src/lib/log/tests/tempdir.h
  1324. src/lib/Makefile
  1325. src/lib/testutils/Makefile
  1326. src/lib/testutils/testdata/Makefile
  1327. src/lib/util/io/Makefile
  1328. src/lib/util/Makefile
  1329. src/lib/util/python/doxygen2pydoc.py
  1330. src/lib/util/python/gen_wiredata.py
  1331. src/lib/util/python/Makefile
  1332. src/lib/util/python/mkpywrapper.py
  1333. src/lib/util/pyunittests/Makefile
  1334. src/lib/util/tests/Makefile
  1335. src/lib/util/threads/Makefile
  1336. src/lib/util/threads/tests/Makefile
  1337. src/lib/util/unittests/Makefile
  1338. src/Makefile
  1339. tests/Makefile
  1340. tests/tools/Makefile
  1341. tests/tools/perfdhcp/Makefile
  1342. tests/tools/perfdhcp/tests/Makefile
  1343. tests/tools/perfdhcp/tests/testdata/Makefile
  1344. ])
  1345. AC_CONFIG_COMMANDS([permissions], [
  1346. chmod +x src/lib/dns/gen-rdatacode.py
  1347. chmod +x src/lib/log/tests/console_test.sh
  1348. chmod +x src/lib/log/tests/destination_test.sh
  1349. chmod +x src/lib/log/tests/init_logger_test.sh
  1350. chmod +x src/lib/log/tests/local_file_test.sh
  1351. chmod +x src/lib/log/tests/logger_lock_test.sh
  1352. chmod +x src/lib/log/tests/severity_test.sh
  1353. chmod +x src/lib/python/isc/log/tests/log_console.py
  1354. chmod +x src/lib/util/python/doxygen2pydoc.py
  1355. chmod +x src/lib/util/python/gen_wiredata.py
  1356. chmod +x src/lib/util/python/mkpywrapper.py
  1357. ])
  1358. AC_OUTPUT
  1359. dnl Print the results
  1360. dnl
  1361. cat > config.report << END
  1362. Kea source configure results:
  1363. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1364. Package:
  1365. Name: ${PACKAGE_NAME}
  1366. Version: ${PACKAGE_VERSION}
  1367. OS Family: ${OS_TYPE}
  1368. Using GNU sed: ${GNU_SED}
  1369. C++ Compiler:
  1370. CXX: ${CXX}
  1371. CXX_VERSION: ${CXX_VERSION}
  1372. DEFS: ${DEFS}
  1373. CPPFLAGS: ${CPPFLAGS}
  1374. CXXFLAGS: ${CXXFLAGS}
  1375. LDFLAGS: ${LDFLAGS}
  1376. B10_CXXFLAGS: ${B10_CXXFLAGS}
  1377. Python:
  1378. PYTHON_VERSION: ${PYTHON_VERSION}
  1379. PYTHON_INCLUDES: ${PYTHON_INCLUDES}
  1380. PYTHON_CXXFLAGS: ${PYTHON_CXXFLAGS}
  1381. PYTHON_LDFLAGS: ${PYTHON_LDFLAGS}
  1382. PYTHON_LIB: ${PYTHON_LIB}
  1383. Boost:
  1384. BOOST_VERSION: ${BOOST_VERSION}
  1385. BOOST_INCLUDES: ${BOOST_INCLUDES}
  1386. Botan:
  1387. BOTAN_VERSION: ${BOTAN_VERSION}
  1388. BOTAN_INCLUDES: ${BOTAN_INCLUDES}
  1389. BOTAN_LDFLAGS: ${BOTAN_LDFLAGS}
  1390. BOTAN_LIBS: ${BOTAN_LIBS}
  1391. Log4cplus:
  1392. LOG4CPLUS_VERSION: ${LOG4CPLUS_VERSION}
  1393. LOG4CPLUS_INCLUDES: ${LOG4CPLUS_INCLUDES}
  1394. LOG4CPLUS_LIBS: ${LOG4CPLUS_LIBS}
  1395. Kea config backend:
  1396. CONFIG_BACKEND: ${CONFIG_BACKEND}
  1397. END
  1398. # Avoid confusion on DNS/DHCP and only mention MySQL if it
  1399. # were specified on the command line.
  1400. if test "$MYSQL_CPPFLAGS" != "" ; then
  1401. cat >> config.report << END
  1402. MySQL:
  1403. MYSQL_VERSION: ${MYSQL_VERSION}
  1404. MYSQL_CPPFLAGS: ${MYSQL_CPPFLAGS}
  1405. MYSQL_LIBS: ${MYSQL_LIBS}
  1406. END
  1407. else
  1408. cat >> config.report << END
  1409. MySQL: no
  1410. END
  1411. fi
  1412. if test "$PGSQL_CPPFLAGS" != "" ; then
  1413. cat >> config.report << END
  1414. PostgreSQL:
  1415. PGSQL_VERSION: ${PGSQL_VERSION}
  1416. PGSQL_CPPFLAGS: ${PGSQL_CPPFLAGS}
  1417. PGSQL_LIBS: ${PGSQL_LIBS}
  1418. END
  1419. else
  1420. cat >> config.report << END
  1421. PostgreSQL: no
  1422. END
  1423. fi
  1424. if test "$enable_gtest" != "no"; then
  1425. cat >> config.report << END
  1426. GTest:
  1427. GTEST_VERSION: ${GTEST_VERSION}
  1428. GTEST_INCLUDES: ${GTEST_INCLUDES}
  1429. GTEST_LDFLAGS: ${GTEST_LDFLAGS}
  1430. GTEST_LDADD: ${GTEST_LDADD}
  1431. GTEST_SOURCE: ${GTEST_SOURCE}
  1432. END
  1433. fi
  1434. cat >> config.report << END
  1435. Features:
  1436. $enable_features
  1437. Developer:
  1438. Enable Debugging: $debug_enabled
  1439. Google Tests: $enable_gtest
  1440. Valgrind: $found_valgrind
  1441. C++ Code Coverage: $USE_LCOV
  1442. Python Code Coverage: $USE_PYCOVERAGE
  1443. Logger checks: $enable_logger_checks
  1444. Generate Documentation: $enable_generate_docs
  1445. END
  1446. cat config.report
  1447. cat <<EOF
  1448. Now you can type "make" to build BIND 10. Note that if you intend to
  1449. run "make check", you must run "make" first as some files need to be
  1450. generated by "make" before "make check" can be run.
  1451. When running "make install" do not use any form of parallel or job
  1452. server options (such as GNU make's -j option). Doing so may cause
  1453. errors.
  1454. EOF