configure.ac 58 KB

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