configure.ac 63 KB

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