configure.ac 58 KB

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