configure.ac 59 KB

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