PageRenderTime 36ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/configure.ac

https://gitlab.com/evergreen-bjwebb/opensrf-debian
m4 | 393 lines | 272 code | 61 blank | 60 comment | 0 complexity | 22c591ea78a46e040789904f232871ed MD5 | raw file
Possible License(s): GPL-2.0, BSD-3-Clause
  1. # Copyright (C) 2008 Equinox Software, Inc.
  2. # Kevin Beswick <kevinbeswick00@gmail.com>
  3. # Copyright (C) 2009-2010 Dan Scott <dscott@laurentian.ca>
  4. #
  5. # This program is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU General Public License
  7. # as published by the Free Software Foundation; either version 2
  8. # of the License, or (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # Process this file with autoconf to produce a configure script.
  16. #-------------------------------
  17. # Initialization
  18. #-------------------------------
  19. export PATH=${PATH}:/usr/sbin
  20. AC_PREREQ(2.59)
  21. AC_INIT([OpenSRF],[trunk],[open-ils-dev@list.georgialibraries.org])
  22. AM_INIT_AUTOMAKE([OpenSRF], [trunk])
  23. AC_REVISION($Revision: 0.1 $)
  24. AC_CONFIG_SRCDIR([configure.ac])
  25. AC_PREFIX_DEFAULT([/opensrf])
  26. AC_CONFIG_MACRO_DIR([m4])
  27. # Enable $prefix to resolve to a reasonable value in substitutions in
  28. # scripts if no explict value was passed in to configure
  29. if test "$prefix" == "NONE"; then
  30. prefix=$ac_default_prefix
  31. fi
  32. # Perl and Python scripts don't want ${prefix} if no value was specified
  33. eval "eval CONF_DIR=$sysconfdir"
  34. eval "eval PID_DIR=$localstatedir"
  35. AC_SUBST([CONF_DIR])
  36. AC_SUBST([PID_DIR])
  37. AC_SUBST(prefix)
  38. AC_SUBST(bindir)
  39. AC_DEFUN([AC_PYTHON_MOD],[
  40. if test -z $PYTHON;
  41. then
  42. PYTHON="python"
  43. fi
  44. AC_MSG_CHECKING($PYTHON_NAME module: $1)
  45. $PYTHON -c "import $1" 2>/dev/null
  46. if test $? -eq 0;
  47. then
  48. AC_MSG_RESULT(yes)
  49. eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
  50. else
  51. AC_MSG_ERROR(failed to find required module $1)
  52. exit 1
  53. fi
  54. ])
  55. #-------------------------------
  56. # Installation options
  57. #-------------------------------
  58. # build and install the java libs?
  59. AC_ARG_ENABLE([java],
  60. [ --enable-java enable building and installing the java libraries],
  61. [case "${enableval}" in
  62. yes) OSRF_INSTALL_JAVA=true ;;
  63. no) OSRF_INSTALL_JAVA=false ;;
  64. *) AC_MSG_ERROR([please choose another value for --enable-java (supported values are yes or no)]) ;;
  65. esac],
  66. [OSRF_INSTALL_JAVA=false])
  67. AM_CONDITIONAL([BUILDJAVA], [test x$OSRF_INSTALL_JAVA = xtrue])
  68. AC_SUBST([OSRF_INSTALL_JAVA])
  69. # install the javascript files?
  70. AC_ARG_ENABLE([javascript],
  71. [ --disable-javascript disable installing JavaScript libraries],
  72. [case "${enableval}" in
  73. yes) OSRF_INSTALL_JAVASCRIPT=true ;;
  74. no) OSRF_INSTALL_JAVASCRIPT=false ;;
  75. *) AC_MSG_ERROR([please choose another value for --disable-javascript (supported values are yes or no)]) ;;
  76. esac],
  77. [OSRF_INSTALL_JAVASCRIPT=true])
  78. AM_CONDITIONAL([INSTALLJAVASCRIPT], [test x$OSRF_INSTALL_JAVASCRIPT = xtrue])
  79. AC_SUBST([OSRF_INSTALL_JAVASCRIPT])
  80. # install the OpenSRF core files?
  81. AC_ARG_ENABLE([core],
  82. [ --disable-core disable installing core files],
  83. [case "${enableval}" in
  84. yes) OSRF_INSTALL_CORE=true ;;
  85. no) OSRF_INSTALL_CORE=false ;;
  86. *) AC_MSG_ERROR([please choose another value for --disable-core (supported values are yes or no)]) ;;
  87. esac],
  88. [OSRF_INSTALL_CORE=true])
  89. AM_CONDITIONAL([BUILDCORE], [test x$OSRF_INSTALL_CORE = xtrue])
  90. AC_SUBST([OSRF_INSTALL_CORE])
  91. # build and install the python modules
  92. AC_ARG_ENABLE([python],
  93. [ --enable-python enable building and installing python modules],
  94. [case "${enableval}" in
  95. yes) OSRF_INSTALL_PYTHON=true ;;
  96. no) OSRF_INSTALL_PYTHON=false ;;
  97. *) AC_MSG_ERROR([please choose another value for --enable-python (supported values are yes or no)]) ;;
  98. esac],
  99. [OSRF_INSTALL_PYTHON=false])
  100. AM_CONDITIONAL([BUILDPYTHON], [test x$OSRF_INSTALL_PYTHON = xtrue])
  101. AC_SUBST([OSRF_INSTALL_PYTHON])
  102. # enable chopchop, the basic XMPP server
  103. AC_ARG_ENABLE([chopchop],
  104. [ --enable-chopchop build and install chopchop, a basic XMPP server],
  105. [case "${enableval}" in
  106. yes) OSRF_INSTALL_CHOPCHOP=true ;;
  107. no) OSRF_INSTALL_CHOPCHOP=false ;;
  108. *) AC_MSG_ERROR([please choose another value for --enable-chopchop (supported values are yes or no)]) ;;
  109. esac],
  110. [OSRF_INSTALL_CHOPCHOP=false])
  111. AM_CONDITIONAL([BUILDCHOPCHOP], [test x$OSRF_INSTALL_CHOPCHOP = xtrue])
  112. AC_SUBST([OSRF_INSTALL_CHOPCHOP])
  113. # enable debug?
  114. AC_ARG_ENABLE(debug,
  115. [ --enable-debug Turn on debugging],
  116. [case "${enableval}" in
  117. yes) debug=true ;;
  118. no) debug=false ;;
  119. *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
  120. esac],[debug=false])
  121. AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
  122. # path to the directory containing the java dependency jar files (included if java installs)
  123. if test $OSRF_INSTALL_JAVA; then
  124. AC_SUBST([OSRF_JAVA_DEPSDIR], [/opt/java])
  125. AC_CONFIG_FILES([src/java/Makefile])
  126. fi
  127. #--------------------------------
  128. # Checks for programs.
  129. #--------------------------------
  130. AC_PROG_LIBTOOL
  131. AC_PROG_AWK
  132. AC_PROG_CC
  133. AC_PROG_INSTALL
  134. AC_PROG_MAKE_SET
  135. #------------------------------
  136. # Set install path variables
  137. #------------------------------
  138. AC_ARG_WITH([tmp],
  139. [ --with-tmp=path location for the temporary directory for OpenSRF (default is /tmp)],
  140. [TMP=${withval}],
  141. [TMP=/tmp])
  142. AC_SUBST([TMP])
  143. AC_ARG_WITH([apxs],
  144. [ --with-apxs=path location of the apxs (Apache extension) tool (default is /usr/bin/apxs2)],
  145. [APXS2=${withval}],
  146. [APXS2=/usr/bin/apxs2])
  147. if ! test -x "$APXS2"; then
  148. for i in /usr/bin /usr/sbin /usr/local/apache/bin /usr/local/apache2/bin ; do
  149. for j in apxs apxs2 ; do
  150. if test -x "$i/$j"; then
  151. APXS2="$i/$j"
  152. break
  153. fi
  154. done
  155. done
  156. fi
  157. AC_SUBST([APXS2])
  158. AC_ARG_WITH([apache],
  159. [ --with-apache=path location of the Apache headers (default is /usr/include/apache2)],
  160. [APACHE2_HEADERS=${withval}],
  161. [APACHE2_HEADERS=/usr/include/apache2])
  162. if ! test -d "$APACHE2_HEADERS"; then
  163. for i in /usr/include/httpd ; do
  164. if test -d "$i"; then
  165. APACHE2_HEADERS="$i"
  166. break
  167. fi
  168. done
  169. fi
  170. AC_SUBST([APACHE2_HEADERS])
  171. AC_ARG_WITH([apr],
  172. [ --with-apr=path location of the Apache Portable Runtime headers (default is /usr/include/apr-1.0/)],
  173. [APR_HEADERS=${withval}],
  174. [APR_HEADERS=/usr/include/apr-1.0])
  175. if ! test -d "$APR_HEADERS"; then
  176. for i in /usr/include/apr-1 ; do
  177. if test -d "$i"; then
  178. APR_HEADERS="$i"
  179. break
  180. fi
  181. done
  182. fi
  183. AC_SUBST([APR_HEADERS])
  184. AC_ARG_WITH([libxml],
  185. [ --with-libxml=path location of the libxml2 headers (default is /usr/include/libxml2/))],
  186. [LIBXML2_HEADERS=${withval}],
  187. [LIBXML2_HEADERS=/usr/include/libxml2/])
  188. AC_SUBST([LIBXML2_HEADERS])
  189. AC_ARG_WITH([includes],
  190. [ --with-includes=DIRECTORIES a colon-separated list of directories that will be added to the list the compiler searches for header files (Example: --with-includes=/path/headers:/anotherpath/moreheaders)],
  191. [EXTRA_USER_INCLUDES=${withval}])
  192. AC_ARG_WITH([libraries],
  193. [ --with-libraries=DIRECTORIES a colon-separated list of directories to search for libraries (Example: --with-libraries=/lib:/usr/lib)],
  194. [EXTRA_USER_LIBRARIES=${withval}])
  195. # Change these lists to proper compiler/linker options
  196. IFSBAK=${IFS}
  197. IFS="${IFS}:"
  198. for dir in $EXTRA_USER_INCLUDES; do
  199. if test -d "$dir"; then
  200. INCLUDES="$INCLUDES -I$dir"
  201. else
  202. AC_MSG_WARN([*** Include directory $dir does not exist.])
  203. fi
  204. done
  205. AC_SUBST(INCLUDES)
  206. for dir in $EXTRA_USER_LIBRARIES; do
  207. if test -d "$dir"; then
  208. LIBDIRS="$LIBDIRS -L$dir"
  209. else
  210. AC_MSG_WARN([*** Library directory $dir does not exist.])
  211. fi
  212. done
  213. AC_SUBST(LIBDIRS)
  214. IFS=${IFSBAK}
  215. AC_CONFIG_FILES([Makefile
  216. src/Makefile])
  217. #PYTHON TESTS
  218. if test x$OSRF_INSTALL_PYTHON = xtrue; then
  219. AC_CHECK_PROG([HAVE_PYTHON],python,yes,no)
  220. if test $HAVE_PYTHON = "no"; then
  221. AC_MSG_ERROR([*** python not found, aborting])
  222. fi
  223. AC_PYTHON_MOD([setuptools])
  224. AC_CONFIG_FILES([
  225. examples/math_client.py
  226. examples/simple_text.py
  227. src/python/Makefile
  228. ])
  229. fi
  230. if test "x$OSRF_INSTALL_CORE" = "xtrue"; then
  231. #--------------------------------
  232. # Check for dependencies.
  233. #--------------------------------
  234. #APACHE PREFORK DEV TEST
  235. AC_MSG_CHECKING([APXS])
  236. if test -f "${APXS2}"; then
  237. AC_MSG_RESULT([yes])
  238. else
  239. AC_MSG_ERROR([*** apxs not found, aborting])
  240. fi
  241. #-----------------------------
  242. # Checks for libraries.
  243. #-----------------------------
  244. AC_SEARCH_LIBS([dlerror], [dl], [],AC_MSG_ERROR([***OpenSRF requires a library (typically libdl) that provides dlerror()]))
  245. AC_CHECK_LIB([ncurses], [initscr], [], AC_MSG_ERROR(***OpenSRF requires ncurses development headers))
  246. AC_CHECK_LIB([readline], [readline], [], AC_MSG_ERROR(***OpenSRF requires readline development headers))
  247. AC_CHECK_LIB([xml2], [xmlAddID], [], AC_MSG_ERROR(***OpenSRF requires xml2 development headers))
  248. # Check for libmemcached and set flags accordingly
  249. PKG_CHECK_MODULES(memcached, libmemcached >= 0.8.0)
  250. AC_SUBST(memcached_CFLAGS)
  251. AC_SUBST(memcached_LIBS)
  252. # Check Unit test framework
  253. PKG_CHECK_MODULES([CHECK], [check >= 0.9.0], [enable_tests=yes],
  254. [enable_tests=no])
  255. AM_CONDITIONAL(CHECK_TESTS, test x$enable_tests = xyes)
  256. if test "x$enable_tests" = "xno"; then
  257. AC_MSG_WARN(Check unit testing framwork not found.)
  258. fi
  259. #-----------------------------
  260. # Checks for header files.
  261. #-----------------------------
  262. AC_HEADER_STDC
  263. AC_HEADER_SYS_WAIT
  264. AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h malloc.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.h])
  265. #------------------------------------------------------------------
  266. # Checks for typedefs, structures, and compiler characteristics.
  267. #------------------------------------------------------------------
  268. AC_C_CONST
  269. AC_C_INLINE
  270. AC_TYPE_PID_T
  271. AC_TYPE_SIZE_T
  272. AC_HEADER_TIME
  273. AC_STRUCT_TM
  274. AM_PROG_CC_C_O
  275. #----------------------------------
  276. # Checks for library functions.
  277. #----------------------------------
  278. AC_FUNC_FORK
  279. AC_FUNC_MALLOC
  280. AC_FUNC_SELECT_ARGTYPES
  281. AC_TYPE_SIGNAL
  282. AC_FUNC_STRFTIME
  283. AC_FUNC_STRTOD
  284. AC_FUNC_VPRINTF
  285. AC_CHECK_FUNCS([bzero dup2 gethostbyname gethostname gettimeofday malloc_stats memset select socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strtol])
  286. #------------------------------------
  287. # Configuration and output
  288. #------------------------------------
  289. AC_CONFIG_FILES([doc/dokuwiki-doc-stubber.pl
  290. examples/math_xul_client/Makefile
  291. examples/math_bench.pl
  292. examples/multisession-test.pl
  293. src/c-apps/Makefile
  294. src/gateway/Makefile
  295. src/jserver/Makefile
  296. src/libopensrf/Makefile
  297. src/perl/Makefile
  298. src/ports/strn_compat/Makefile
  299. src/python/opensrf.py
  300. src/router/Makefile
  301. src/srfsh/Makefile
  302. tests/Makefile
  303. bin/opensrf-perl.pl
  304. bin/osrf_config
  305. bin/osrf_ctl.sh])
  306. fi
  307. AC_OUTPUT
  308. AC_MSG_RESULT([])
  309. AC_MSG_RESULT([--------------------- Configuration options: -----------------------])
  310. if test "$OSRF_INSTALL_JAVA" = "true" ; then
  311. AC_MSG_RESULT([OSRF install Java support? yes])
  312. AC_MSG_RESULT([Java support files $OSRF_JAVA_DEPSDIR])
  313. else
  314. AC_MSG_RESULT([OSRF install Java support? no])
  315. fi
  316. if test "$OSRF_INSTALL_PYTHON" = "true" ; then
  317. AC_MSG_RESULT([OSRF install Python support? yes])
  318. else
  319. AC_MSG_RESULT([OSRF install Python support? no])
  320. fi
  321. if test "$OSRF_INSTALL_CHOPCHOP" = "true" ; then
  322. AC_MSG_RESULT([OSRF install chopchop? yes])
  323. else
  324. AC_MSG_RESULT([OSRF install chopchop? no])
  325. fi
  326. AC_MSG_RESULT(Installation directory prefix: ${prefix})
  327. AC_MSG_RESULT(Temporary directory: ${TMP})
  328. AC_MSG_RESULT(APXS2 location: ${APXS2})
  329. AC_MSG_RESULT(Apache headers location: ${APACHE2_HEADERS})
  330. AC_MSG_RESULT(APR headers location: ${APR_HEADERS})
  331. AC_MSG_RESULT(libxml2 headers location: ${LIBXML2_HEADERS})
  332. AC_MSG_RESULT([----------------------------------------------------------------------])