configure.ac 64 KB

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