configure.ac 59 KB

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