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
24 AC_INIT([OpenSRF],[trunk],[open-ils-dev@list.georgialibraries.org])
25 AM_INIT_AUTOMAKE([OpenSRF], [trunk])
26 AC_REVISION($Revision: 0.1 $)
27 AC_CONFIG_SRCDIR([configure.ac])
28 AC_PREFIX_DEFAULT([/opensrf])
29 AC_CONFIG_MACRO_DIR([m4])
31 # Enable $prefix to resolve to a reasonable value in substitutions in
32 # scripts if no explict value was passed in to configure
33 if test "$prefix" == "NONE"; then
34 prefix=$ac_default_prefix
37 # Perl and Python scripts don't want ${prefix} if no value was specified
38 eval "eval CONF_DIR=$sysconfdir"
39 eval "eval PID_DIR=$localstatedir"
47 AC_DEFUN([AC_PYTHON_MOD],[
52 AC_MSG_CHECKING($PYTHON_NAME module: $1)
53 $PYTHON -c "import $1" 2>/dev/null
57 eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
59 AC_MSG_ERROR(failed to find required module $1)
64 #-------------------------------
65 # Installation options
66 #-------------------------------
68 # build and install the java libs?
70 [ --enable-java enable building and installing the java libraries],
71 [case "${enableval}" in
72 yes) OSRF_INSTALL_JAVA=true ;;
73 no) OSRF_INSTALL_JAVA=false ;;
74 *) AC_MSG_ERROR([please choose another value for --enable-java (supported values are yes or no)]) ;;
76 [OSRF_INSTALL_JAVA=false])
78 AM_CONDITIONAL([BUILDJAVA], [test x$OSRF_INSTALL_JAVA = xtrue])
79 AC_SUBST([OSRF_INSTALL_JAVA])
81 # install the javascript files?
82 AC_ARG_ENABLE([javascript],
83 [ --disable-javascript disable installing JavaScript libraries],
84 [case "${enableval}" in
85 yes) OSRF_INSTALL_JAVASCRIPT=true ;;
86 no) OSRF_INSTALL_JAVASCRIPT=false ;;
87 *) AC_MSG_ERROR([please choose another value for --disable-javascript (supported values are yes or no)]) ;;
89 [OSRF_INSTALL_JAVASCRIPT=true])
91 AM_CONDITIONAL([INSTALLJAVASCRIPT], [test x$OSRF_INSTALL_JAVASCRIPT = xtrue])
92 AC_SUBST([OSRF_INSTALL_JAVASCRIPT])
94 # install the OpenSRF core files?
96 [ --disable-core disable installing core files],
97 [case "${enableval}" in
98 yes) OSRF_INSTALL_CORE=true ;;
99 no) OSRF_INSTALL_CORE=false ;;
100 *) AC_MSG_ERROR([please choose another value for --disable-core (supported values are yes or no)]) ;;
102 [OSRF_INSTALL_CORE=true])
104 AM_CONDITIONAL([BUILDCORE], [test x$OSRF_INSTALL_CORE = xtrue])
105 AC_SUBST([OSRF_INSTALL_CORE])
108 # build and install the python modules
109 AC_ARG_ENABLE([python],
110 [ --enable-python enable building and installing python modules],
111 [case "${enableval}" in
112 yes) OSRF_INSTALL_PYTHON=true ;;
113 no) OSRF_INSTALL_PYTHON=false ;;
114 *) AC_MSG_ERROR([please choose another value for --enable-python (supported values are yes or no)]) ;;
116 [OSRF_INSTALL_PYTHON=false])
118 AM_CONDITIONAL([BUILDPYTHON], [test x$OSRF_INSTALL_PYTHON = xtrue])
119 AC_SUBST([OSRF_INSTALL_PYTHON])
121 # enable chopchop, the basic XMPP server
123 AC_ARG_ENABLE([chopchop],
124 [ --enable-chopchop build and install chopchop, a basic XMPP server],
125 [case "${enableval}" in
126 yes) OSRF_INSTALL_CHOPCHOP=true ;;
127 no) OSRF_INSTALL_CHOPCHOP=false ;;
128 *) AC_MSG_ERROR([please choose another value for --enable-chopchop (supported values are yes or no)]) ;;
130 [OSRF_INSTALL_CHOPCHOP=false])
132 AM_CONDITIONAL([BUILDCHOPCHOP], [test x$OSRF_INSTALL_CHOPCHOP = xtrue])
133 AC_SUBST([OSRF_INSTALL_CHOPCHOP])
138 [ --enable-debug Turn on debugging],
139 [case "${enableval}" in
142 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
144 AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
146 # path to the directory containing the java dependency jar files (included if java installs)
147 if test $OSRF_INSTALL_JAVA; then
148 AC_SUBST([OSRF_JAVA_DEPSDIR], [/opt/java])
149 AC_CONFIG_FILES([src/java/Makefile])
152 #--------------------------------
153 # Checks for programs.
154 #--------------------------------
162 #------------------------------
163 # Set install path variables
164 #------------------------------
166 [ --with-tmp=path location for the temporary directory for OpenSRF (default is /tmp)],
172 [ --with-apxs=path location of the apxs (Apache extension) tool (default is /usr/bin/apxs2)],
174 [APXS2=/usr/bin/apxs2])
175 if ! test -x "$APXS2"; then
176 for i in /usr/bin /usr/sbin /usr/local/apache/bin /usr/local/apache2/bin ; do
177 for j in apxs apxs2 ; do
178 if test -x "$i/$j"; then
187 AC_ARG_WITH([apache],
188 [ --with-apache=path location of the Apache headers (default is /usr/include/apache2)],
189 [APACHE2_HEADERS=${withval}],
190 [APACHE2_HEADERS=/usr/include/apache2])
191 if ! test -d "$APACHE2_HEADERS"; then
192 for i in /usr/include/httpd ; do
193 if test -d "$i"; then
199 AC_SUBST([APACHE2_HEADERS])
202 [ --with-apr=path location of the Apache Portable Runtime headers (default is /usr/include/apr-1.0/)],
203 [APR_HEADERS=${withval}],
204 [APR_HEADERS=/usr/include/apr-1.0])
205 if ! test -d "$APR_HEADERS"; then
206 for i in /usr/include/apr-1 ; do
207 if test -d "$i"; then
213 AC_SUBST([APR_HEADERS])
215 AC_ARG_WITH([libxml],
216 [ --with-libxml=path location of the libxml2 headers (default is /usr/include/libxml2/))],
217 [LIBXML2_HEADERS=${withval}],
218 [LIBXML2_HEADERS=/usr/include/libxml2/])
219 AC_SUBST([LIBXML2_HEADERS])
221 AC_ARG_WITH([includes],
222 [ --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)],
223 [EXTRA_USER_INCLUDES=${withval}])
225 AC_ARG_WITH([libraries],
226 [ --with-libraries=DIRECTORIES a colon-separated list of directories to search for libraries (Example: --with-libraries=/lib:/usr/lib)],
227 [EXTRA_USER_LIBRARIES=${withval}])
229 # Change these lists to proper compiler/linker options
234 for dir in $EXTRA_USER_INCLUDES; do
235 if test -d "$dir"; then
236 INCLUDES="$INCLUDES -I$dir"
238 AC_MSG_WARN([*** Include directory $dir does not exist.])
243 for dir in $EXTRA_USER_LIBRARIES; do
244 if test -d "$dir"; then
245 LIBDIRS="$LIBDIRS -L$dir"
247 AC_MSG_WARN([*** Library directory $dir does not exist.])
254 AC_CONFIG_FILES([Makefile
258 if test x$OSRF_INSTALL_PYTHON = xtrue; then
259 AC_CHECK_PROG([HAVE_PYTHON],python,yes,no)
260 if test $HAVE_PYTHON = "no"; then
261 AC_MSG_ERROR([*** python not found, aborting])
263 AC_PYTHON_MOD([setuptools])
265 examples/math_client.py
266 examples/simple_text.py
271 if test "x$OSRF_INSTALL_CORE" = "xtrue"; then
272 #--------------------------------
273 # Check for dependencies.
274 #--------------------------------
276 #APACHE PREFORK DEV TEST
277 AC_MSG_CHECKING([APXS])
278 if test -f "${APXS2}"; then
281 AC_MSG_ERROR([*** apxs not found, aborting])
284 #-----------------------------
285 # Checks for libraries.
286 #-----------------------------
288 AC_SEARCH_LIBS([dlerror], [dl], [],AC_MSG_ERROR([***OpenSRF requires a library (typically libdl) that provides dlerror()]))
289 AC_CHECK_LIB([ncurses], [initscr], [], AC_MSG_ERROR(***OpenSRF requires ncurses development headers))
290 AC_CHECK_LIB([readline], [readline], [], AC_MSG_ERROR(***OpenSRF requires readline development headers))
291 AC_CHECK_LIB([xml2], [xmlAddID], [], AC_MSG_ERROR(***OpenSRF requires xml2 development headers))
292 # Check for libmemcached and set flags accordingly
293 PKG_CHECK_MODULES(memcached, libmemcached >= 0.8.0)
294 AC_SUBST(memcached_CFLAGS)
295 AC_SUBST(memcached_LIBS)
297 #-----------------------------
298 # Checks for header files.
299 #-----------------------------
303 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])
305 #------------------------------------------------------------------
306 # Checks for typedefs, structures, and compiler characteristics.
307 #------------------------------------------------------------------
316 #----------------------------------
317 # Checks for library functions.
318 #----------------------------------
322 AC_FUNC_SELECT_ARGTYPES
327 AC_CHECK_FUNCS([bzero dup2 gethostbyname gethostname gettimeofday malloc_stats memset select socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strtol])
329 #------------------------------------
330 # Configuration and output
331 #------------------------------------
333 AC_CONFIG_FILES([doc/dokuwiki-doc-stubber.pl
334 examples/math_xul_client/Makefile
335 examples/math_bench.pl
336 examples/multisession-test.pl
340 src/libopensrf/Makefile
342 src/ports/strn_compat/Makefile
343 src/python/opensrf.py
354 AC_MSG_RESULT([--------------------- Configuration options: -----------------------])
356 if test "$OSRF_INSTALL_JAVA" = "true" ; then
357 AC_MSG_RESULT([OSRF install Java support? yes])
358 AC_MSG_RESULT([Java support files $OSRF_JAVA_DEPSDIR])
360 AC_MSG_RESULT([OSRF install Java support? no])
363 if test "$OSRF_INSTALL_PYTHON" = "true" ; then
364 AC_MSG_RESULT([OSRF install Python support? yes])
366 AC_MSG_RESULT([OSRF install Python support? no])
369 if test "$OSRF_INSTALL_CHOPCHOP" = "true" ; then
370 AC_MSG_RESULT([OSRF install chopchop? yes])
372 AC_MSG_RESULT([OSRF install chopchop? no])
375 AC_MSG_RESULT(Installation directory prefix: ${prefix})
376 AC_MSG_RESULT(Temporary directory: ${TMP})
377 AC_MSG_RESULT(APXS2 location: ${APXS2})
378 AC_MSG_RESULT(Apache headers location: ${APACHE2_HEADERS})
379 AC_MSG_RESULT(APR headers location: ${APR_HEADERS})
380 AC_MSG_RESULT(libxml2 headers location: ${LIBXML2_HEADERS})
382 AC_MSG_RESULT([----------------------------------------------------------------------])