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 # The following Apache version detection code is adapted from
206 # http://www.gnu.org/software/autoconf-archive/ax_prog_apache.html
207 # licensed under version 2 of the GNU General Public License, or
208 # (at your discretion) any later version.
210 # Copyright (c) 2008 Loic Dachary <loic@senga.org>
212 # Collect apache version number. If for nothing else, this
213 # guarantees that httpd is a working apache executable.
215 APACHE=`$APXS2 -q progname`
216 AC_PATH_PROG(APACHE_PATH, [$APACHE], [])
217 if test -z "$APACHE_PATH" ; then
218 for i in /usr/bin /usr/sbin /usr/local/apache/bin /usr/local/apache2/bin ; do
219 if test -x "$i/$APACHE"; then
220 APACHE_PATH="$i/$APACHE"
225 changequote(<<, >>)dnl
226 APACHE_READABLE_VERSION=`$APACHE_PATH -v | grep 'Server version' | sed -e 's;.*Apache/\([0-9\.][0-9\.]*\).*;\1;'`
228 APACHE_VERSION=`echo $APACHE_READABLE_VERSION | sed -e 's/\.//g'`
229 if test -z "$APACHE_VERSION" ; then
230 AC_MSG_ERROR("could not determine apache version number");
232 APACHE_MAJOR=`expr $APACHE_VERSION : '\(..\)'`
233 APACHE_MINOR=`expr $APACHE_VERSION : '..\(.*\)'`
234 AM_CONDITIONAL(APACHE_MIN_24, test "$APACHE_MAJOR" -ge "24")
235 AC_SUBST([APACHE_MIN_24])
237 AC_ARG_WITH([libxml],
238 [ --with-libxml=path location of the libxml2 headers (default is /usr/include/libxml2/))],
239 [LIBXML2_HEADERS=${withval}],
240 [LIBXML2_HEADERS=/usr/include/libxml2/])
241 AC_SUBST([LIBXML2_HEADERS])
243 AC_ARG_WITH([includes],
244 [ --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)],
245 [EXTRA_USER_INCLUDES=${withval}])
247 AC_ARG_WITH([libraries],
248 [ --with-libraries=DIRECTORIES a colon-separated list of directories to search for libraries (Example: --with-libraries=/lib:/usr/lib)],
249 [EXTRA_USER_LIBRARIES=${withval}])
251 # Change these lists to proper compiler/linker options
256 for dir in $EXTRA_USER_INCLUDES; do
257 if test -d "$dir"; then
258 INCLUDES="$INCLUDES -I$dir"
260 AC_MSG_WARN([*** Include directory $dir does not exist.])
265 for dir in $EXTRA_USER_LIBRARIES; do
266 if test -d "$dir"; then
267 LIBDIRS="$LIBDIRS -L$dir"
269 AC_MSG_WARN([*** Library directory $dir does not exist.])
276 AC_CONFIG_FILES([Makefile
280 if test x$OSRF_INSTALL_PYTHON = xtrue; then
281 AC_CHECK_PROG([HAVE_PYTHON],python,yes,no)
282 if test $HAVE_PYTHON = "no"; then
283 AC_MSG_ERROR([*** python not found, aborting])
285 AC_PYTHON_MOD([setuptools])
287 examples/math_client.py
288 examples/simple_text.py
292 # Check Unit test framework
293 PKG_CHECK_MODULES([CHECK], [check >= 0.9.0], [enable_tests=yes],
295 AM_CONDITIONAL(CHECK_TESTS, test x$enable_tests = xyes)
297 if test "x$enable_tests" = "xno"; then
298 AC_MSG_WARN(Check unit testing framework not found.)
301 if test "x$OSRF_INSTALL_CORE" = "xtrue"; then
302 #--------------------------------
303 # Check for dependencies.
304 #--------------------------------
306 #APACHE PREFORK DEV TEST
307 AC_MSG_CHECKING([APXS])
308 if test -f "${APXS2}"; then
311 AC_MSG_ERROR([*** apxs not found, aborting])
314 #-----------------------------
315 # Checks for libraries.
316 #-----------------------------
318 AC_SEARCH_LIBS([dlerror], [dl], [],AC_MSG_ERROR([***OpenSRF requires a library (typically libdl) that provides dlerror()]))
319 AC_CHECK_LIB([ncurses], [initscr], [], AC_MSG_ERROR(***OpenSRF requires ncurses development headers))
320 AC_CHECK_LIB([readline], [readline], [], AC_MSG_ERROR(***OpenSRF requires readline development headers))
321 AC_CHECK_LIB([xml2], [xmlAddID], [], AC_MSG_ERROR(***OpenSRF requires xml2 development headers))
322 # Check for libmemcached and set flags accordingly
323 PKG_CHECK_MODULES(memcached, libmemcached >= 0.8.0)
324 AC_SUBST(memcached_CFLAGS)
325 AC_SUBST(memcached_LIBS)
327 #-----------------------------
328 # Checks for header files.
329 #-----------------------------
333 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])
335 #------------------------------------------------------------------
336 # Checks for typedefs, structures, and compiler characteristics.
337 #------------------------------------------------------------------
347 #----------------------------------
348 # Checks for library functions.
349 #----------------------------------
353 AC_FUNC_SELECT_ARGTYPES
358 AC_CHECK_FUNCS([bzero dup2 gethostbyname gethostname gettimeofday malloc_stats memset select socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strtol])
360 #------------------------------------
361 # Configuration and output
362 #------------------------------------
364 AC_CONFIG_FILES([doc/dokuwiki-doc-stubber.pl
365 examples/math_xul_client/Makefile
366 examples/math_bench.pl
367 examples/multisession-test.pl
370 src/libopensrf/Makefile
372 src/ports/strn_compat/Makefile
373 src/python/opensrf.py
384 AC_MSG_RESULT([--------------------- Configuration options: -----------------------])
386 if test "$OSRF_INSTALL_JAVA" = "true" ; then
387 AC_MSG_RESULT([OSRF install Java support? yes])
388 AC_MSG_RESULT([Java support files $OSRF_JAVA_DEPSDIR])
390 AC_MSG_RESULT([OSRF install Java support? no])
393 if test "$OSRF_INSTALL_PYTHON" = "true" ; then
394 AC_MSG_RESULT([OSRF install Python support? yes])
396 AC_MSG_RESULT([OSRF install Python support? no])
399 AC_MSG_RESULT(Installation directory prefix: ${prefix})
400 AC_MSG_RESULT(Temporary directory: ${TMP})
401 AC_MSG_RESULT(APXS2 location: ${APXS2})
402 AC_MSG_RESULT(Apache headers location: ${APACHE2_HEADERS})
403 AC_MSG_RESULT(APR headers location: ${APR_HEADERS})
404 AC_MSG_RESULT(Apache version: ${APACHE_READABLE_VERSION})
405 AC_MSG_RESULT(libxml2 headers location: ${LIBXML2_HEADERS})
407 AC_MSG_RESULT([----------------------------------------------------------------------])