1 # Copyright (C) 2008 Equinox Software, Inc.
2 # Kevin Beswick <kevinbeswick00@gmail.com>
3 # Copyright (C) 2009-2010 Dan Scott <dscott@laurentian.ca>
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.
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.
15 # Process this file with autoconf to produce a configure script.
18 #-------------------------------
20 #-------------------------------
22 export PATH=${PATH}:/usr/sbin
25 # Get our version number from one file
26 m4_include([version.m4])
28 # Version number gets turned into @PACKAGE_VERSION@
29 AC_INIT([OpenSRF],m4_defn([VERSION_NUMBER]),[open-ils-dev@list.georgialibraries.org])
30 AM_INIT_AUTOMAKE([OpenSRF], m4_defn([VERSION_NUMBER]))
32 AC_REVISION($Revision: 0.1 $)
33 AC_CONFIG_SRCDIR([configure.ac])
35 # Enable $prefix to resolve to a reasonable value in substitutions in
36 # scripts if no explict value was passed in to configure
37 if test "$prefix" == "NONE"; then
38 prefix=$ac_default_prefix
41 # Perl and Python scripts don't want ${prefix} if no value was specified
42 eval "eval CONF_DIR=$sysconfdir"
43 eval "eval PID_DIR=$localstatedir"
51 AC_DEFUN([AC_PYTHON_MOD],[
56 AC_MSG_CHECKING($PYTHON_NAME module: $1)
57 $PYTHON -c "import $1" 2>/dev/null
61 eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
63 AC_MSG_ERROR(failed to find required module $1)
68 #-------------------------------
69 # Installation options
70 #-------------------------------
72 # build and install the java libs?
74 [ --enable-java enable building and installing the java libraries],
75 [case "${enableval}" in
76 yes) OSRF_INSTALL_JAVA=true ;;
77 no) OSRF_INSTALL_JAVA=false ;;
78 *) AC_MSG_ERROR([please choose another value for --enable-java (supported values are yes or no)]) ;;
80 [OSRF_INSTALL_JAVA=false])
82 AM_CONDITIONAL([BUILDJAVA], [test x$OSRF_INSTALL_JAVA = xtrue])
83 AC_SUBST([OSRF_INSTALL_JAVA])
85 # install the javascript files?
86 AC_ARG_ENABLE([javascript],
87 [ --disable-javascript disable installing JavaScript libraries],
88 [case "${enableval}" in
89 yes) OSRF_INSTALL_JAVASCRIPT=true ;;
90 no) OSRF_INSTALL_JAVASCRIPT=false ;;
91 *) AC_MSG_ERROR([please choose another value for --disable-javascript (supported values are yes or no)]) ;;
93 [OSRF_INSTALL_JAVASCRIPT=true])
95 AM_CONDITIONAL([INSTALLJAVASCRIPT], [test x$OSRF_INSTALL_JAVASCRIPT = xtrue])
96 AC_SUBST([OSRF_INSTALL_JAVASCRIPT])
98 # install the OpenSRF core files?
100 [ --disable-core disable installing core files],
101 [case "${enableval}" in
102 yes) OSRF_INSTALL_CORE=true ;;
103 no) OSRF_INSTALL_CORE=false ;;
104 *) AC_MSG_ERROR([please choose another value for --disable-core (supported values are yes or no)]) ;;
106 [OSRF_INSTALL_CORE=true])
108 AM_CONDITIONAL([BUILDCORE], [test x$OSRF_INSTALL_CORE = xtrue])
109 AC_SUBST([OSRF_INSTALL_CORE])
112 # build and install the python modules
113 AC_ARG_ENABLE([python],
114 [ --enable-python enable building and installing python modules],
115 [case "${enableval}" in
116 yes) OSRF_INSTALL_PYTHON=true ;;
117 no) OSRF_INSTALL_PYTHON=false ;;
118 *) AC_MSG_ERROR([please choose another value for --enable-python (supported values are yes or no)]) ;;
120 [OSRF_INSTALL_PYTHON=false])
122 AM_CONDITIONAL([BUILDPYTHON], [test x$OSRF_INSTALL_PYTHON = xtrue])
123 AC_SUBST([OSRF_INSTALL_PYTHON])
128 [ --enable-debug Turn on debugging],
129 [case "${enableval}" in
132 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
134 AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
136 # path to the directory containing the java dependency jar files (included if java installs)
137 if test $OSRF_INSTALL_JAVA; then
138 AC_SUBST([OSRF_JAVA_DEPSDIR], [deps])
139 AC_CONFIG_FILES([src/java/Makefile])
142 #--------------------------------
143 # Checks for programs.
144 #--------------------------------
152 #------------------------------
153 # Set install path variables
154 #------------------------------
156 [ --with-tmp=path location for the temporary directory for OpenSRF (default is /tmp)],
162 [ --with-apxs=path location of the apxs (Apache extension) tool (default is /usr/bin/apxs2)],
164 [APXS2=/usr/bin/apxs2])
165 if ! test -x "$APXS2"; then
166 for i in /usr/bin /usr/sbin /usr/local/apache/bin /usr/local/apache2/bin ; do
167 for j in apxs apxs2 ; do
168 if test -x "$i/$j"; then
177 AC_ARG_WITH([apache],
178 [ --with-apache=path location of the Apache headers (default is /usr/include/apache2)],
179 [APACHE2_HEADERS=${withval}],
180 [APACHE2_HEADERS=/usr/include/apache2])
181 if ! test -d "$APACHE2_HEADERS"; then
182 for i in /usr/include/httpd ; do
183 if test -d "$i"; then
189 AC_SUBST([APACHE2_HEADERS])
192 [ --with-apr=path location of the Apache Portable Runtime headers (default is /usr/include/apr-1.0/)],
193 [APR_HEADERS=${withval}],
194 [APR_HEADERS=/usr/include/apr-1.0])
195 if ! test -d "$APR_HEADERS"; then
196 for i in /usr/include/apr-1 ; do
197 if test -d "$i"; then
203 AC_SUBST([APR_HEADERS])
205 AC_ARG_WITH([perlbase],
206 [ --with-perlbase=path base location to install Perl modules (default based on Config.pm)],
207 [PERL_BASE=${withval}],
209 AC_SUBST([PERL_BASE])
211 AC_ARG_WITH([websockets-port],
212 [ --with-websockets-port=path WebSockets port to use (default is 7682)],
213 [WS_PORT=${withval}],
217 # The following Apache version detection code is adapted from
218 # http://www.gnu.org/software/autoconf-archive/ax_prog_apache.html
219 # licensed under version 2 of the GNU General Public License, or
220 # (at your discretion) any later version.
222 # Copyright (c) 2008 Loic Dachary <loic@senga.org>
224 # Collect apache version number. If for nothing else, this
225 # guarantees that httpd is a working apache executable.
227 APACHE=`$APXS2 -q progname`
228 AC_PATH_PROG(APACHE_PATH, [$APACHE], [])
229 if test -z "$APACHE_PATH" ; then
230 for i in /usr/bin /usr/sbin /usr/local/apache/bin /usr/local/apache2/bin ; do
231 if test -x "$i/$APACHE"; then
232 APACHE_PATH="$i/$APACHE"
237 changequote(<<, >>)dnl
238 APACHE_READABLE_VERSION=`$APACHE_PATH -v | grep 'Server version' | sed -e 's;.*Apache/\([0-9\.][0-9\.]*\).*;\1;'`
240 APACHE_VERSION=`echo $APACHE_READABLE_VERSION | sed -e 's/\.//g'`
241 if test -z "$APACHE_VERSION" ; then
242 AC_MSG_ERROR("could not determine apache version number");
244 APACHE_MAJOR=`expr $APACHE_VERSION : '\(..\)'`
245 APACHE_MINOR=`expr $APACHE_VERSION : '..\(.*\)'`
246 AM_CONDITIONAL(APACHE_MIN_24, test "$APACHE_MAJOR" -ge "24")
247 AC_SUBST([APACHE_MIN_24])
249 AC_ARG_WITH([libxml],
250 [ --with-libxml=path location of the libxml2 headers (default is /usr/include/libxml2/))],
251 [LIBXML2_HEADERS=${withval}],
252 [LIBXML2_HEADERS=/usr/include/libxml2/])
253 AC_SUBST([LIBXML2_HEADERS])
255 AC_ARG_WITH([includes],
256 [ --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)],
257 [EXTRA_USER_INCLUDES=${withval}])
259 AC_ARG_WITH([libraries],
260 [ --with-libraries=DIRECTORIES a colon-separated list of directories to search for libraries (Example: --with-libraries=/lib:/usr/lib)],
261 [EXTRA_USER_LIBRARIES=${withval}])
263 # Change these lists to proper compiler/linker options
268 for dir in $EXTRA_USER_INCLUDES; do
269 if test -d "$dir"; then
270 INCLUDES="$INCLUDES -I$dir"
272 AC_MSG_WARN([*** Include directory $dir does not exist.])
277 for dir in $EXTRA_USER_LIBRARIES; do
278 if test -d "$dir"; then
279 LIBDIRS="$LIBDIRS -L$dir"
281 AC_MSG_WARN([*** Library directory $dir does not exist.])
288 AC_CONFIG_FILES([Makefile
292 if test x$OSRF_INSTALL_PYTHON = xtrue; then
293 AC_CHECK_PROG([HAVE_PYTHON],python,yes,no)
294 if test $HAVE_PYTHON = "no"; then
295 AC_MSG_ERROR([*** python not found, aborting])
297 AC_PYTHON_MOD([setuptools])
299 examples/math_client.py
300 examples/simple_text.py
304 # Check Unit test framework
305 PKG_CHECK_MODULES([CHECK], [check >= 0.9.0], [enable_tests=yes],
307 AM_CONDITIONAL(CHECK_TESTS, test x$enable_tests = xyes)
309 if test "x$enable_tests" = "xno"; then
310 AC_MSG_WARN(Check unit testing framework not found.)
313 if test "x$OSRF_INSTALL_CORE" = "xtrue"; then
314 #--------------------------------
315 # Check for dependencies.
316 #--------------------------------
318 #APACHE PREFORK DEV TEST
319 AC_MSG_CHECKING([APXS])
320 if test -f "${APXS2}"; then
323 AC_MSG_ERROR([*** apxs not found, aborting])
326 #-----------------------------
327 # Checks for libraries.
328 #-----------------------------
330 AC_SEARCH_LIBS([dlerror], [dl], [],AC_MSG_ERROR([***OpenSRF requires a library (typically libdl) that provides dlerror()]))
331 AC_CHECK_LIB([ncurses], [initscr], [], AC_MSG_ERROR(***OpenSRF requires ncurses development headers))
332 AC_CHECK_LIB([readline], [readline], [], AC_MSG_ERROR(***OpenSRF requires readline development headers))
333 AC_CHECK_LIB([xml2], [xmlAddID], [], AC_MSG_ERROR(***OpenSRF requires xml2 development headers))
334 # Check for libmemcached and set flags accordingly
335 PKG_CHECK_MODULES(memcached, libmemcached >= 0.8.0)
336 AC_SUBST(memcached_CFLAGS)
337 AC_SUBST(memcached_LIBS)
339 #-----------------------------
340 # Checks for header files.
341 #-----------------------------
345 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])
347 #------------------------------------------------------------------
348 # Checks for typedefs, structures, and compiler characteristics.
349 #------------------------------------------------------------------
359 #----------------------------------
360 # Checks for library functions.
361 #----------------------------------
365 AC_FUNC_SELECT_ARGTYPES
370 AC_CHECK_FUNCS([bzero dup2 gethostbyname gethostname gettimeofday malloc_stats memset select socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strtol])
372 #------------------------------------
373 # Configuration and output
374 #------------------------------------
376 AC_CONFIG_FILES([doc/dokuwiki-doc-stubber.pl
377 examples/math_xul_client/Makefile
378 examples/math_bench.pl
379 examples/multisession-test.pl
382 src/javascript/opensrf_ws.js
383 src/javascript/opensrf_ws_shared.js
384 src/libopensrf/Makefile
386 src/ports/strn_compat/Makefile
387 src/python/opensrf.py
390 src/websocket-stdio/Makefile
399 AC_MSG_RESULT([--------------------- Configuration options: -----------------------])
401 if test "$OSRF_INSTALL_JAVA" = "true" ; then
402 AC_MSG_RESULT([OSRF install Java support? yes])
403 AC_MSG_RESULT([Java support files $OSRF_JAVA_DEPSDIR])
405 AC_MSG_RESULT([OSRF install Java support? no])
408 if test "$OSRF_INSTALL_PYTHON" = "true" ; then
409 AC_MSG_RESULT([OSRF install Python support? yes])
411 AC_MSG_RESULT([OSRF install Python support? no])
414 AC_MSG_RESULT(Installation directory prefix: ${prefix})
415 AC_MSG_RESULT(Temporary directory: ${TMP})
416 AC_MSG_RESULT(APXS2 location: ${APXS2})
417 AC_MSG_RESULT(Apache headers location: ${APACHE2_HEADERS})
418 AC_MSG_RESULT(APR headers location: ${APR_HEADERS})
419 AC_MSG_RESULT(Apache version: ${APACHE_READABLE_VERSION})
420 AC_MSG_RESULT(libxml2 headers location: ${LIBXML2_HEADERS})
422 AC_MSG_RESULT([----------------------------------------------------------------------])