configure.ac 59 KB

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