configure.ac 63 KB

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