configure.ac 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768
  1. # -*- Autoconf -*-
  2. # $Id$
  3. AC_PREREQ([2.61])
  4. AC_INIT([rpkitools], [1.0])
  5. # AC_REVISION is a great idea in theory, but the revision will always
  6. # be wrong unless we do two checkins, so skip it for now. Someday.
  7. dnl AC_REVISION([$Revision$])
  8. AC_CONFIG_SRCDIR([rp/rcynic/rcynic.c])
  9. AC_CONFIG_AUX_DIR([buildtools])
  10. # I'm not sure we should really be using the $host_* variables as we
  11. # are, some of the stuff we're doing with them looks more like
  12. # $target_* to me now, but on the theory that we should not fix things
  13. # that aren't broken, stick with $host_* for now.
  14. AC_CANONICAL_HOST
  15. dnl AC_CANONICAL_TARGET
  16. # Remember whether CFLAGS or LDFLAGS were set explictly. This has to
  17. # come early in the script, before we mess it up testing things.
  18. if test "x${CFLAGS+set}" = "x" && test "x${LDFLAGS+set}" = "x"
  19. then
  20. CFLAGS_or_LDFLAGS_were_set=no
  21. else
  22. CFLAGS_or_LDFLAGS_were_set=yes
  23. fi
  24. # Put the user option stuff up front.
  25. AC_ARG_WITH([system_openssl], [AS_HELP_STRING([--with-system-openssl], [Link against system copy of OpenSSL])], [], [with_system_openssl=auto])
  26. AC_ARG_ENABLE([openssl_asm], [AS_HELP_STRING([--disable-openssl-asm], [Don't let OpenSSL build assembler code])], [], [enable_openssl_asm=auto])
  27. AC_ARG_ENABLE([ca_tools], [AS_HELP_STRING([--disable-ca-tools], [Don't build any of the CA tools])], [], [enable_ca_tools=yes])
  28. AC_ARG_ENABLE([rp_tools], [AS_HELP_STRING([--disable-rp-tools], [Don't build any of the relying party tools])], [], [enable_rp_tools=yes])
  29. AC_ARG_ENABLE([target_installation], [AS_HELP_STRING([--disable-target-installation], [Don't perform final target installation])], [], [enable_target_installation=yes])
  30. AC_ARG_ENABLE([wsgi_daemon_mode], [AS_HELP_STRING([--enable-wsgi-daemon-mode=user[[:group]]], [Run the web portal as a separate process])], [], [enable_wsgi_daemon_mode=no])
  31. AC_ARG_ENABLE([python_install_layout], [AS_HELP_STRING([--enable-python-install-layout=layout], [Specify Python --install-layout])], [], [enable_python_install_layout=auto])
  32. AC_ARG_ENABLE([wsgi_python_egg_cache], [AS_HELP_STRING([--enable-wsgi-python-egg-cache=dir[[:user]]], [Set up PYTHON_EGG_CACHE in wsgi wrapper])], [], [enable_wsgi_python_egg_cache=auto])
  33. AC_ARG_ENABLE([runtime_dependencies], [AS_HELP_STRING([--disable-runtime-dependencies], [Don't enforce runtime dependencies])], [], [enable_runtime_dependencies=yes])
  34. AC_ARG_VAR([RCYNIC_DIR], [Where to put output files from rcynic and rpki-rtr])
  35. AC_ARG_VAR([APACHE_VERSION], [Version of Apache httpd, mostly used on FreeBSD where it determines some of the directory names])
  36. # Obsolete options. If you know of a better way to handle this, tell me.
  37. AC_ARG_ENABLE([python], [AS_HELP_STRING([--disable-python], [(Obsolete, do not use)])], [AC_MSG_ERROR([--disable-python is obsolete. Please see the --disable-ca-tools option])], [])
  38. AC_ARG_ENABLE([django], [AS_HELP_STRING([--disable-django], [(Obsolete, do not use)])], [AC_MSG_ERROR([--disable-django is obsolete. Please see the --disable-ca-tools option])], [])
  39. AC_ARG_ENABLE([rpki_rtr], [AS_HELP_STRING([--disable-rpki-rtr], [(Obsolete, do not use)])], [AC_MSG_ERROR([--disable-rpki-rtr is obsolete. Please see the --disable-rp-tools option])], [])
  40. AC_ARG_ENABLE([rcynic_jail], [AS_HELP_STRING([--enable-rcynic-jail], [(Obsolete, do not use)])], [AC_MSG_ERROR([--enable-rcynic-jail is obsolete.])], [])
  41. AC_PROG_CC
  42. AC_PROG_INSTALL
  43. AC_CHECK_SIZEOF([long])
  44. AC_MSG_CHECKING([whether compiler and linker support -Wl,-Bsymbolic])
  45. old_LDFLAGS="$LDFLAGS"
  46. LDFLAGS="$LDFLAGS -Wl,-Bsymbolic"
  47. AC_LINK_IFELSE([AC_LANG_SOURCE([[int main (int argc, char *argv[]) { return 0; }]])],
  48. [linker_supports_Bsymbolic=yes],
  49. [linker_supports_Bsymbolic=no])
  50. AC_MSG_RESULT([$linker_supports_Bsymbolic])
  51. LDFLAGS="$old_LDFLAGS"
  52. unset old_LDFLAGS
  53. if test $linker_supports_Bsymbolic = yes
  54. then
  55. POW_LDFLAGS='-Wl,-Bsymbolic'
  56. else
  57. POW_LDFLAGS=''
  58. fi
  59. AC_SUBST(POW_LDFLAGS)
  60. AC_MSG_CHECKING([whether compiler and linker support -Wl,-z,noexecstack])
  61. old_LDFLAGS="$LDFLAGS"
  62. LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
  63. AC_LINK_IFELSE([AC_LANG_SOURCE([[int main (int argc, char *argv[]) { return 0; }]])],
  64. [linker_supports_znoexecstack=yes],
  65. [linker_supports_znoexecstack=no])
  66. AC_MSG_RESULT([$linker_supports_znoexecstack])
  67. if test $linker_supports_znoexecstack = no
  68. then
  69. LDFLAGS="$old_LDFLAGS"
  70. fi
  71. unset old_LDFLAGS
  72. AC_PROG_GREP
  73. AC_PATH_PROG([PYTHON], [python])
  74. AC_PATH_PROG([XSLTPROC], [xsltproc])
  75. AC_PATH_PROG([AWK], [awk])
  76. AC_PATH_PROG([SORT], [sort])
  77. AC_PATH_PROG([RRDTOOL], [rrdtool])
  78. AC_PATH_PROG([TRANG], [trang], [\${abs_top_srcdir}/buildtools/trang-not-found])
  79. AC_PATH_PROG([RSYNC], [rsync])
  80. AC_PATH_PROG([SUDO], [sudo])
  81. # See whether we need to check for dependencies that we only need at
  82. # runtime. We do this by default when compiling from source to avoid
  83. # surprises after installation, but this just adds pain when building
  84. # binary packages within a platform framework which already handles
  85. # all the dependencies for us, so we need a way to turn it off.
  86. case $enable_runtime_dependencies in
  87. yes|no)
  88. ;;
  89. *)
  90. AC_MSG_ERROR([Unrecognized value for --enable-runtime-dependencies: $enable_runtime_dependencies])
  91. ;;
  92. esac
  93. # Figure out whether we want RP tools, CA tools, or both
  94. AC_MSG_CHECKING([whether user wants the RP tools])
  95. case $enable_rp_tools in
  96. yes|no)
  97. build_rp_tools=$enable_rp_tools
  98. ;;
  99. *)
  100. AC_MSG_ERROR([Unrecognized value for --enable-rp-tools: $enable_rp_tools])
  101. ;;
  102. esac
  103. AC_MSG_RESULT([$build_rp_tools])
  104. AC_MSG_CHECKING([whether user wants the CA tools])
  105. case $enable_ca_tools in
  106. yes|no)
  107. build_ca_tools=$enable_ca_tools
  108. ;;
  109. *)
  110. AC_MSG_ERROR([Unrecognized value for --enable-ca-tools: $enable_ca_tools])
  111. ;;
  112. esac
  113. AC_MSG_RESULT([$build_ca_tools])
  114. if test $build_rp_tools = no && test $build_ca_tools = no
  115. then
  116. AC_MSG_ERROR([Building with neither RP tools nor CA tools makes no sense])
  117. fi
  118. # Figure out whether we need to build our own OpenSSL library or can
  119. # use the system libraries. We're looking for two recent features:
  120. # CMS and RFC 3779 support. We also have to check whether the user
  121. # has an opinion on all this. In the "auto" case (no
  122. # --with-system-openssl option specified in any form), we may need to
  123. # check a platform-specific location (eg, /usr/local on FreeBSD).
  124. #
  125. # At this point all of the C code is in the RP tools package, so we can
  126. # skip all this if we're just building the CA tools.
  127. if test $build_rp_tools = no
  128. then
  129. build_openssl=no
  130. else
  131. old_CFLAGS="$CFLAGS"
  132. old_LDFLAGS="$LDFLAGS"
  133. case $with_system_openssl in
  134. yes|auto)
  135. if test $CFLAGS_or_LDFLAGS_were_set = no
  136. then
  137. case $host_os in
  138. freebsd*)
  139. CFLAGS="-I/usr/local/include $CFLAGS"
  140. LDFLAGS="-L/usr/local/lib $LDFLAGS"
  141. ;;
  142. esac
  143. fi
  144. ;;
  145. no|/usr)
  146. :
  147. ;;
  148. *)
  149. CFLAGS="-I$with_system_openssl/include $CFLAGS"
  150. LDFLAGS="-L$with_system_openssl/lib $LDFLAGS"
  151. esac
  152. case $with_system_openssl in
  153. no)
  154. have_usable_openssl=no
  155. ;;
  156. *)
  157. AC_CHECK_LIB([crypto], [v3_addr_validate_path],
  158. [system_openssl_has_rfc3779=yes],
  159. [system_openssl_has_rfc3779=no])
  160. AC_CHECK_LIB([crypto], [CMS_verify],
  161. [system_openssl_has_cms=yes],
  162. [system_openssl_has_cms=no])
  163. AC_MSG_CHECKING([whether system OpenSSL library is usable])
  164. if test $system_openssl_has_rfc3779 = yes && test $system_openssl_has_cms = yes
  165. then
  166. have_usable_openssl=yes
  167. else
  168. have_usable_openssl=no
  169. fi
  170. AC_MSG_RESULT([$have_usable_openssl])
  171. esac
  172. AC_MSG_CHECKING([whether we need to build a private copy of OpenSSL])
  173. case $with_system_openssl in
  174. yes)
  175. build_openssl=no
  176. if test $have_usable_openssl = no
  177. then
  178. AC_MSG_ERROR([Can't find OpenSSL crypto library with CMS and RFC 3779 support, try --with-system-openssl=/path/to/openssl])
  179. fi
  180. ;;
  181. no)
  182. build_openssl=yes
  183. ;;
  184. auto)
  185. if test $have_usable_openssl = no
  186. then
  187. build_openssl=yes
  188. else
  189. build_openssl=no
  190. fi
  191. ;;
  192. *)
  193. build_openssl=no
  194. if test $have_usable_openssl = no
  195. then
  196. AC_MSG_ERROR([Can't find OpenSSL crypto library with CMS and RFC 3779 support in $with_system_openssl])
  197. fi
  198. esac
  199. AC_MSG_RESULT([$build_openssl])
  200. build_openssl_asm=undefined
  201. if test $build_openssl = yes
  202. then
  203. CFLAGS="$old_CFLAGS"
  204. LDFLAGS="$old_LDFLAGS"
  205. AC_MSG_CHECKING([whether to enable assembly code in OpenSSL])
  206. case $enable_openssl_asm in
  207. yes|no)
  208. build_openssl_asm=$enable_openssl_asm
  209. ;;
  210. auto)
  211. case $host in
  212. x86_64-*-linux*)
  213. build_openssl_asm=no
  214. ;;
  215. *)
  216. build_openssl_asm=yes
  217. ;;
  218. esac
  219. ;;
  220. *)
  221. AC_MSG_ERROR([Unrecognized value for --enable-openssl-asm: $enable_openssl_asm])
  222. ;;
  223. esac
  224. AC_MSG_RESULT([$enable_openssl_asm])
  225. fi
  226. fi
  227. # RCYNIC_DIR is a "precious" argument variable to this script (see
  228. # autoconf doc), which means that autoconf is careful with whatever
  229. # value (if any) was passed in, and that it's already been declared
  230. # for variable substitution. We still have to set a default value for
  231. # it, though, and we might as well handle DESTDIR while we're at it.
  232. if test "X$RCYNIC_DIR" = "X"
  233. then
  234. RCYNIC_DIR='/var/rcynic'
  235. fi
  236. # APACHE_VERSION is another "precious" argument to this script. It
  237. # mostly matters on FreeBSD, where most things involving Apache encode
  238. # the Apache version number into their filenames.
  239. #
  240. # If we can't figure out the version number, we assume 2.4 and hope
  241. # for the best; at some point we may need to do better than this.
  242. #
  243. # apachectl sometimes whines about ulimits, so we discard its stderr.
  244. # If you're reading this because this test is misbehaving, well,
  245. # try not discarding stderr.
  246. AC_MSG_CHECKING([Apache version])
  247. if test "X$APACHE_VERSION" = "X"
  248. then
  249. for apachectl in /usr/local/sbin/apachectl /usr/sbin/apachectl
  250. do
  251. if test -x $apachectl
  252. then
  253. APACHE_VERSION=`$apachectl -v 2>/dev/null | sed -n 's=^Server version: Apache/\([[0-9]]*\)\.\([[0-9]]*\)\..*$=\1\2=p'`
  254. break
  255. fi
  256. done
  257. fi
  258. if test "X$APACHE_VERSION" = "X"
  259. then
  260. APACHE_VERSION="24"
  261. msg='not found, defaulting to 2.4'
  262. else
  263. msg=`echo $APACHE_VERSION | sed 's=.=&.='`
  264. fi
  265. AC_MSG_RESULT([$msg])
  266. # Perhaps there should be a way to set these, but for now just
  267. # wire them in here so at least they're consistent in all Makefiles.
  268. AC_SUBST(RPKI_USER, [rpki])
  269. AC_SUBST(RPKI_GROUP, [rpki])
  270. RCYNIC_CONF_DATA="${RCYNIC_DIR}/data"
  271. AC_SUBST(RCYNIC_CONF_DATA)
  272. # Check whether to do "final target installation". This means actions
  273. # that can only be done when installing a package, as opposed to when
  274. # building a package.
  275. AC_MSG_CHECKING([whether to do final target installation on "make install"])
  276. case $enable_target_installation in
  277. yes|no)
  278. ;;
  279. *)
  280. AC_MSG_ERROR([Unrecognized value for --enable-target-installation: $enable_target_installation])
  281. ;;
  282. esac
  283. AC_MSG_RESULT([$enable_target_installation])
  284. # Some bits of post-installation setup are complicated enough that
  285. # it's simplest to have different rule sets for different platforms.
  286. case $host_os in
  287. darwin*)
  288. RCYNIC_MAKE_RULES='rp/rcynic/rules.darwin.mk'
  289. RTR_ORIGIN_MAKE_RULES='rp/rpki-rtr/rules.darwin.mk'
  290. CA_MAKE_RULES='ca/rules.darwin.mk'
  291. ;;
  292. freebsd*)
  293. RCYNIC_MAKE_RULES='rp/rcynic/rules.freebsd.mk'
  294. RTR_ORIGIN_MAKE_RULES='rp/rpki-rtr/rules.freebsd.mk'
  295. CA_MAKE_RULES='ca/rules.freebsd.mk'
  296. ;;
  297. linux*)
  298. RCYNIC_MAKE_RULES='rp/rcynic/rules.linux.mk'
  299. RTR_ORIGIN_MAKE_RULES='rp/rpki-rtr/rules.linux.mk'
  300. CA_MAKE_RULES='ca/rules.linux.mk'
  301. ;;
  302. *)
  303. RCYNIC_MAKE_RULES='rp/rcynic/rules.unknown.mk'
  304. RTR_ORIGIN_MAKE_RULES='rp/rpki-rtr/rules.unknown.mk'
  305. CA_MAKE_RULES='ca/rules.unknown.mk'
  306. ;;
  307. esac
  308. AC_SUBST_FILE(RCYNIC_MAKE_RULES)
  309. AC_SUBST_FILE(RTR_ORIGIN_MAKE_RULES)
  310. AC_SUBST_FILE(CA_MAKE_RULES)
  311. # Where to put HTML files is similarly platform dependent, we have to know.
  312. # rcynic-cron will skip generating HTML files if it has no place to put them.
  313. AC_MSG_CHECKING([where rcynic-html output should go])
  314. case $host_os in
  315. freebsd*)
  316. RCYNIC_HTML_DIR="/usr/local/www/apache${APACHE_VERSION}/data/rcynic"
  317. ;;
  318. linux*)
  319. RCYNIC_HTML_DIR='/var/www/html/rcynic'
  320. ;;
  321. *)
  322. RCYNIC_HTML_DIR=''
  323. ;;
  324. esac
  325. AC_MSG_RESULT([$RCYNIC_HTML_DIR])
  326. AC_SUBST(RCYNIC_HTML_DIR)
  327. # Sort out which things to install, depending on whether
  328. # we're doing final target installation.
  329. #
  330. # As things have evolved, this a bit repetitive. Simplify someday, maybe.
  331. RCYNIC_INSTALL_TARGETS='install-always'
  332. RTR_ORIGIN_INSTALL_TARGETS='install-always'
  333. CA_INSTALL_TARGETS='install-always'
  334. CFG_INSTALL_TARGETS='install-always'
  335. if test $enable_target_installation = yes
  336. then
  337. RCYNIC_INSTALL_TARGETS="$RCYNIC_INSTALL_TARGETS install-postconf"
  338. RTR_ORIGIN_INSTALL_TARGETS="$RTR_ORIGIN_INSTALL_TARGETS install-postconf"
  339. CA_INSTALL_TARGETS="$CA_INSTALL_TARGETS install-postconf"
  340. CFG_INSTALL_TARGETS="$CFG_INSTALL_TARGETS install-postconf"
  341. fi
  342. AC_SUBST(RCYNIC_INSTALL_TARGETS)
  343. AC_SUBST(RTR_ORIGIN_INSTALL_TARGETS)
  344. AC_SUBST(CA_INSTALL_TARGETS)
  345. AC_SUBST(CFG_INSTALL_TARGETS)
  346. # Now a bunch of checks to figure out what we can do with Python. If
  347. # we don't have Python at all, none of the rest of this matters. If
  348. # we do have Python, we need to check for required packages and
  349. # versions.
  350. if test "x$PYTHON" = "x"
  351. then
  352. AC_MSG_ERROR([I can't find a Python binary at all, this isn't going to work. Perhaps you need to set PATH?])
  353. fi
  354. AC_MSG_CHECKING([for Python version 2.7 or higher])
  355. have_acceptable_python=`$PYTHON -c 'import sys; print "yes" if sys.version_info[[0]] == 2 and sys.version_info[[1]] >= 7 else "no"'`
  356. AC_MSG_RESULT([$have_acceptable_python])
  357. AC_MSG_CHECKING([distutils to find out where Python.h should be])
  358. python_h=`$PYTHON -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_inc() + "/Python.h"'`
  359. AC_MSG_RESULT([$python_h])
  360. AC_CHECK_HEADER([$python_h], [have_python_h=yes], [have_python_h=no])
  361. AC_MSG_CHECKING([for lxml.etree])
  362. if $PYTHON -c 'import lxml.etree' 2>/dev/null; then have_lxml=yes; else have_lxml=no; fi
  363. AC_MSG_RESULT([$have_lxml])
  364. AC_MSG_CHECKING([for Tornado])
  365. if $PYTHON -c 'import tornado' 2>/dev/null; then have_tornado=yes; else have_tornado=no; fi
  366. AC_MSG_RESULT([$have_tornado])
  367. if test $have_tornado = yes
  368. then
  369. AC_MSG_CHECKING([for Tornado 4.2 or higher])
  370. have_acceptable_tornado=`$PYTHON -c "import tornado; print 'no' if tornado.version_info < (4, 2) else 'yes'"`
  371. AC_MSG_RESULT([$have_acceptable_tornado])
  372. else
  373. have_acceptable_tornado=no
  374. fi
  375. AC_MSG_CHECKING([for Django])
  376. if $PYTHON -c 'import django' 2>/dev/null; then have_django=yes; else have_django=no; fi
  377. AC_MSG_RESULT([$have_django])
  378. if test $have_django = yes
  379. then
  380. AC_MSG_CHECKING([for Django 1.8 or higher])
  381. have_acceptable_django=`$PYTHON -c "import django; print 'no' if django.VERSION < (1, 8) else 'yes'"`
  382. AC_MSG_RESULT([$have_acceptable_django])
  383. else
  384. have_acceptable_django=no
  385. fi
  386. AC_MSG_CHECKING([for PyYAML])
  387. if $PYTHON -c 'import yaml' 2>/dev/null; then have_pyyaml=yes; else have_pyyaml=no; fi
  388. AC_MSG_RESULT([$have_pyyaml])
  389. AC_MSG_CHECKING([for vobject])
  390. if $PYTHON -c 'import vobject' 2>/dev/null; then have_vobject=yes; else have_vobject=no; fi
  391. AC_MSG_RESULT([$have_vobject])
  392. AC_MSG_CHECKING([for argparse])
  393. if $PYTHON -c 'import argparse' 2>/dev/null; then have_argparse=yes; else have_argparse=no; fi
  394. AC_MSG_RESULT([$have_argparse])
  395. # Warnings and dependency errors. Exit on fatal errors deferred until
  396. # the very end of this, so we can warn the user about all known
  397. # problems in a single pass. Errors that prevent build or basic
  398. # installation are always fatal; errors that prevent proper operation
  399. # at runtime or during post-installation setup can be converted to
  400. # warnings by --disable-runtime-dependencies.
  401. build_ok=yes
  402. runtime_ok=yes
  403. if test $have_acceptable_python = no
  404. then
  405. runtime_ok=no
  406. AC_MSG_WARN([The RPKI code requires Python version 2.x, for x = 7 or higher.])
  407. fi
  408. if test $build_rp_tools = yes
  409. then
  410. if test $have_python_h = no
  411. then
  412. build_ok=no
  413. AC_MSG_WARN([I can't find Python.h. Python sources are required to build the rpki.POW module.])
  414. fi
  415. if test "x$RRDTOOL" = "x"
  416. then
  417. runtime_ok=no
  418. AC_MSG_WARN([rcynic-html requires rrdtool.])
  419. fi
  420. if test "X$RSYNC" = "X"
  421. then
  422. runtime_ok=no
  423. AC_MSG_WARN([The RPKI relying party tools require rsync.])
  424. fi
  425. fi
  426. if test $have_lxml = no
  427. then
  428. runtime_ok=no
  429. AC_MSG_WARN([The RPKI tools require the Python LXML package.])
  430. fi
  431. if test $have_acceptable_django = no
  432. then
  433. runtime_ok=no
  434. AC_MSG_WARN([The RPKI tools require Django 1.8 or higher.])
  435. fi
  436. if test $have_argparse = no
  437. then
  438. runtime_ok=no
  439. AC_MSG_WARN([The RPKI tools require the Python argparse module.])
  440. fi
  441. if test $have_acceptable_tornado = no
  442. then
  443. runtime_ok=no
  444. AC_MSG_WARN([The RPKI tools require Tornado 4.2 or higher.])
  445. fi
  446. if test $build_ca_tools = yes
  447. then
  448. if test $have_vobject = no
  449. then
  450. runtime_ok=no
  451. AC_MSG_WARN([The RPKI CA GUI requires the Python vobject module.])
  452. fi
  453. if test $have_pyyaml = no
  454. then
  455. AC_MSG_WARN([PyYAML missing, so "make test" will not work properly.])
  456. fi
  457. if test "x$XSLTPROC" = "x"
  458. then
  459. AC_MSG_WARN([xsltproc missing, so "make test" will not work properly.])
  460. fi
  461. fi
  462. if test $build_ok = no || test $runtime_ok = no
  463. then
  464. if test $build_rp_tools = yes
  465. then
  466. AC_MSG_WARN([If you do not wish to install the RPKI RP tools, please specify --disable-rp-tools as an argument to this configure script.])
  467. fi
  468. if test $build_ca_tools = yes
  469. then
  470. AC_MSG_WARN([If you do not wish to install the RPKI CA tools, please specify --disable-ca-tools as an argument to this configure script.])
  471. fi
  472. if test $build_ok = no || test $enable_runtime_dependencies = yes
  473. then
  474. AC_MSG_ERROR([Please correct the problems above then re-run this configuration script.])
  475. else
  476. AC_MSG_WARN([Runtime dependency enforcement disabled, proceeding (at your own risk)])
  477. fi
  478. fi
  479. # Figure out whether we are on a Debian-derived system where we need
  480. # to tell setup.py about Debian installation layout.
  481. if test $build_ca_tools = yes
  482. then
  483. AC_MSG_CHECKING([whether we need to tell distutils to use a particular installation layout])
  484. looks_like_debian=no
  485. if test -x /usr/bin/lsb_release
  486. then
  487. case `/usr/bin/lsb_release -is` in
  488. Debian|Ubuntu)
  489. looks_like_debian=yes
  490. ;;
  491. esac
  492. fi
  493. if test $looks_like_debian = yes
  494. then
  495. install_layout="deb"
  496. else
  497. install_layout="unix"
  498. fi
  499. case $enable_python_install_layout in
  500. yes|no)
  501. use_install_layout=$enable_python_install_layout
  502. ;;
  503. auto)
  504. use_install_layout=no
  505. ;;
  506. *)
  507. use_install_layout=yes
  508. install_layout="$enable_python_install_layout"
  509. ;;
  510. esac
  511. if test $use_install_layout = yes
  512. then
  513. SETUP_PY_INSTALL_LAYOUT="--install-layout=$install_layout"
  514. else
  515. SETUP_PY_INSTALL_LAYOUT=''
  516. fi
  517. AC_MSG_RESULT([$use_install_layout $SETUP_PY_INSTALL_LAYOUT])
  518. AC_SUBST(SETUP_PY_INSTALL_LAYOUT)
  519. fi
  520. # Figure out whether we're going to want a PYTHON_EGG_CACHE directory.
  521. # This is mostly just a pass through to rpkigui-apache-confgen and rpki.wsgi
  522. # via rpki.autoconf.
  523. AC_MSG_CHECKING([whether we need rpki.wgi to use a Python egg cache])
  524. save_IFS="$IFS"
  525. IFS=':' read WSGI_PYTHON_EGG_CACHE_DIR WSGI_PYTHON_EGG_CACHE_USER <<_EOF
  526. $enable_wsgi_python_egg_cache
  527. _EOF
  528. IFS="$save_IFS"
  529. if test "X$WSGI_PYTHON_EGG_CACHE_DIR" = "Xauto"
  530. then
  531. case $host_os in
  532. freebsd*) WSGI_PYTHON_EGG_CACHE_DIR=yes;;
  533. *) WSGI_PYTHON_EGG_CACHE_DIR=no;;
  534. esac
  535. fi
  536. case $WSGI_PYTHON_EGG_CACHE_DIR in
  537. yes)
  538. WSGI_PYTHON_EGG_CACHE_DIR='${datarootdir}/rpki/python-eggs'
  539. ;;
  540. no)
  541. WSGI_PYTHON_EGG_CACHE_DIR=''
  542. ;;
  543. esac
  544. if test "X$WSGI_PYTHON_EGG_CACHE_DIR" != "X" &&
  545. test "X$WSGI_PYTHON_EGG_CACHE_USER" = "X"
  546. then
  547. case $host_os in
  548. freebsd*) WSGI_PYTHON_EGG_CACHE_USER="www";;
  549. linux*) WSGI_PYTHON_EGG_CACHE_USER="www-data";;
  550. esac
  551. fi
  552. AC_SUBST(WSGI_PYTHON_EGG_CACHE_DIR)
  553. AC_SUBST(WSGI_PYTHON_EGG_CACHE_USER)
  554. if test "X$WSGI_PYTHON_EGG_CACHE_DIR" = "X"
  555. then
  556. AC_MSG_RESULT([no])
  557. elif test "X$WSGI_PYTHON_EGG_CACHE_USER" != "X"
  558. then
  559. AC_MSG_RESULT([$WSGI_PYTHON_EGG_CACHE_DIR (user $WSGI_PYTHON_EGG_CACHE_USER)])
  560. else
  561. AC_MSG_RESULT([$WSGI_PYTHON_EGG_CACHE_DIR])
  562. fi
  563. # Tell the Makefiles and setup.py which parts of this package we've decided to build.
  564. if test $build_openssl = yes; then OPENSSL_TARGET=openssl; else OPENSSL_TARGET=noop; fi
  565. if test $build_rp_tools = yes; then RP_TARGET=rp; else RP_TARGET=noop; fi
  566. if test $build_ca_tools = yes; then CA_TARGET=ca; else CA_TARGET=noop; fi
  567. AC_SUBST(OPENSSL_TARGET)
  568. AC_SUBST(RP_TARGET)
  569. AC_SUBST(CA_TARGET)
  570. AC_CONFIG_FILES([Makefile])
  571. # OpenSSL has its own build system that bears no relationship to
  572. # anything but itself, and our use of it is a bit weird, so this is a
  573. # BFMI (Brute Force and Massive Ignorance) job.
  574. if test $build_openssl = yes
  575. then
  576. AC_CONFIG_FILES([openssl/Makefile
  577. openssl/tests/Makefile])
  578. AC_MSG_CHECKING([what configuration target to use when building OpenSSL])
  579. case $host in
  580. i*86-apple-darwin*)
  581. if test "$ac_cv_sizeof_long" = 8
  582. then
  583. OPENSSL_CONFIG_COMMAND='./Configure darwin64-x86_64-cc'
  584. fi
  585. ;;
  586. *)
  587. if test $build_openssl_asm = yes
  588. then
  589. OPENSSL_CONFIG_COMMAND="MACHINE=$host_cpu ./config"
  590. else
  591. OPENSSL_CONFIG_COMMAND="MACHINE=$host_cpu ./config no-asm"
  592. fi
  593. ;;
  594. esac
  595. AC_SUBST(OPENSSL_CONFIG_COMMAND)
  596. AC_MSG_RESULT([$OPENSSL_CONFIG_COMMAND])
  597. AC_MSG_CHECKING([what glob to use when renaming OpenSSL shared libraries])
  598. case $host in
  599. *-apple-darwin*)
  600. OPENSSL_SO_GLOB='*.dylib'
  601. ;;
  602. *)
  603. OPENSSL_SO_GLOB='*.so*'
  604. ;;
  605. esac
  606. AC_SUBST(OPENSSL_SO_GLOB)
  607. AC_MSG_RESULT([$OPENSSL_SO_GLOB])
  608. # NB: We put our OpenSSL directory at the *front* of the
  609. # search list to preempt conflicts with system copies.
  610. CFLAGS="-I\${abs_top_srcdir}/openssl/openssl/include $CFLAGS"
  611. LIBS="\${abs_top_builddir}/openssl/openssl/libcrypto.a $LIBS"
  612. else
  613. LIBS="$LIBS -lcrypto"
  614. fi
  615. if test $build_rp_tools = yes
  616. then
  617. AC_CONFIG_FILES([rp/Makefile
  618. rp/config/Makefile
  619. rp/rcynic/Makefile
  620. rp/utils/Makefile
  621. rp/rpki-rtr/Makefile])
  622. fi
  623. if test $build_ca_tools = yes
  624. then
  625. AC_CONFIG_FILES([ca/Makefile
  626. ca/tests/Makefile])
  627. fi
  628. if test $build_ca_tools = yes
  629. then
  630. case $enable_wsgi_daemon_mode in
  631. no)
  632. ;;
  633. yes)
  634. AC_MSG_ERROR([You must specify the user to run the wsgi process as with --enable-wsgi-daemon-mode=USER])
  635. ;;
  636. *)
  637. AC_MSG_CHECKING([how to run mod_wsgi daemon mode])
  638. save_IFS="$IFS"
  639. IFS=':'
  640. read user group <<_EOF
  641. $enable_wsgi_daemon_mode
  642. _EOF
  643. IFS="$save_IFS"
  644. AC_SUBST(WSGI_DAEMON_PROCESS, "WSGIDaemonProcess rpkigui user=$user ${group:+group=}${group} display-name=%{GROUP}")
  645. AC_SUBST(WSGI_PROCESS_GROUP, "WSGIProcessGroup rpkigui")
  646. AC_MSG_RESULT([with user "$user" and group "${group:-default}"])
  647. ;;
  648. esac
  649. fi
  650. # Now that we're finally done with all the conditional changes to
  651. # CFLAGS, add a search directive for our own header directory. If we
  652. # ever get to the point of having our own library directory, we'd add
  653. # it here too, but for the moment our shared C code is all in .h files.
  654. CFLAGS="$CFLAGS -I\${abs_top_srcdir}/h"
  655. AC_OUTPUT