1 # Copyright (C) 2008 Equinox Software, Inc.
2 # Kevin Beswick <kevinbeswick00@gmail.com>
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # Process this file with autoconf to produce a configure script.
17 #-------------------------------
19 #-------------------------------
21 export PATH=${PATH}:/usr/sbin
23 AC_INIT([OpenSRF],[trunk],[open-ils-dev@list.georgialibraries.org])
24 AM_INIT_AUTOMAKE([OpenSRF], [trunk])
25 AC_REVISION($Revision: 0.1 $)
26 AC_CONFIG_SRCDIR([configure.ac])
27 AC_PREFIX_DEFAULT([/opensrf/])
28 AC_CONFIG_MACRO_DIR([m4])
35 AC_DEFUN([AC_PYTHON_MOD],[
40 AC_MSG_CHECKING($PYTHON_NAME module: $1)
41 $PYTHON -c "import $1" 2>/dev/null
45 eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
47 AC_MSG_ERROR(failed to find required module $1)
54 #-------------------------------
55 # Installation options
56 #-------------------------------
58 # build and install the java libs?
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)]) ;;
66 [OSRF_INSTALL_JAVA=false])
68 AM_CONDITIONAL([BUILDJAVA], [test x$OSRF_INSTALL_JAVA = xtrue])
69 AC_SUBST([OSRF_INSTALL_JAVA])
71 # install the javascript files?
72 AC_ARG_ENABLE([javascript],
73 [ --disable-javascript disable installing JavaScript libraries],
74 [case "${enableval}" in
75 yes) OSRF_INSTALL_JAVASCRIPT=true ;;
76 no) OSRF_INSTALL_JAVASCRIPT=false ;;
77 *) AC_MSG_ERROR([please choose another value for --disable-javascript (supported values are yes or no)]) ;;
79 [OSRF_INSTALL_JAVASCRIPT=true])
81 AM_CONDITIONAL([INSTALLJAVASCRIPT], [test x$OSRF_INSTALL_JAVASCRIPT = xtrue])
82 AC_SUBST([OSRF_INSTALL_JAVASCRIPT])
84 # install the OpenSRF core files?
86 [ --disable-core disable installing core files],
87 [case "${enableval}" in
88 yes) OSRF_INSTALL_CORE=true ;;
89 no) OSRF_INSTALL_CORE=false ;;
90 *) AC_MSG_ERROR([please choose another value for --disable-core (supported values are yes or no)]) ;;
92 [OSRF_INSTALL_CORE=true])
94 AM_CONDITIONAL([BUILDCORE], [test x$OSRF_INSTALL_CORE = xtrue])
95 AC_SUBST([OSRF_INSTALL_CORE])
98 # build and install the python modules
99 AC_ARG_ENABLE([python],
100 [ --enable-python enable building and installing python modules],
101 [case "${enableval}" in
102 yes) OSRF_INSTALL_PYTHON=true ;;
103 no) OSRF_INSTALL_PYTHON=false ;;
104 *) AC_MSG_ERROR([please choose another value for --enable-python (supported values are yes or no)]) ;;
106 [OSRF_INSTALL_PYTHON=false])
108 AM_CONDITIONAL([BUILDPYTHON], [test x$OSRF_INSTALL_PYTHON = xtrue])
109 AC_SUBST([OSRF_INSTALL_PYTHON])
111 # enable chopchop, the basic XMPP server
113 AC_ARG_ENABLE([chopchop],
114 [ --enable-chopchop build and install chopchop, a basic XMPP server],
115 [case "${enableval}" in
116 yes) OSRF_INSTALL_CHOPCHOP=true ;;
117 no) OSRF_INSTALL_CHOPCHOP=false ;;
118 *) AC_MSG_ERROR([please choose another value for --enable-chopchop (supported values are yes or no)]) ;;
120 [OSRF_INSTALL_CHOPCHOP=false])
122 AM_CONDITIONAL([BUILDCHOPCHOP], [test x$OSRF_INSTALL_CHOPCHOP = xtrue])
123 AC_SUBST([OSRF_INSTALL_CHOPCHOP])
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], [/opt/java])
141 #--------------------------------
142 # Checks for programs.
143 #--------------------------------
151 #------------------------------
152 # Set install path variables
153 #------------------------------
155 [ --with-tmp=path location for the temporary directory for OpenSRF (default is /tmp)],
161 [ --with-apxs=path location of the apxs (Apache extension) tool (default is /usr/bin/apxs2)],
163 [APXS2=/usr/bin/apxs2])
166 AC_ARG_WITH([apache],
167 [ --with-apache=path location of the Apache headers (default is /usr/include/apache2)],
168 [APACHE2_HEADERS=${withval}],
169 [APACHE2_HEADERS=/usr/include/apache2])
170 AC_SUBST([APACHE2_HEADERS])
173 [ --with-apr=path location of the Apache Portable Runtime headers (default is /usr/include/apr-1.0/)],
174 [APR_HEADERS=${withval}],
175 [APR_HEADERS=/usr/include/apr-1.0])
176 AC_SUBST([APR_HEADERS])
178 AC_ARG_WITH([libxml],
179 [ --with-libxml=path location of the libxml2 headers (default is /usr/include/libxml2/))],
180 [LIBXML2_HEADERS=${withval}],
181 [LIBXML2_HEADERS=/usr/include/libxml2/])
182 AC_SUBST([LIBXML2_HEADERS])
184 AC_ARG_WITH([includes],
185 [ --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)],
186 [EXTRA_USER_INCLUDES=${withval}])
188 AC_ARG_WITH([libraries],
189 [ --with-libraries=DIRECTORIES a colon-separated list of directories to search for libraries (Example: --with-libraries=/lib:/usr/lib)],
190 [EXTRA_USER_LIBRARIES=${withval}])
192 # Change these lists to proper compiler/linker options
197 for dir in $EXTRA_USER_INCLUDES; do
198 if test -d "$dir"; then
199 INCLUDES="$INCLUDES -I$dir"
201 AC_MSG_WARN([*** Include directory $dir does not exist.])
206 for dir in $EXTRA_USER_LIBRARIES; do
207 if test -d "$dir"; then
208 LIBDIRS="$LIBDIRS -L$dir"
210 AC_MSG_WARN([*** Library directory $dir does not exist.])
217 AC_CONFIG_FILES([Makefile
220 if test "x$OSRF_INSTALL_CORE" = "xtrue"; then
221 #--------------------------------
222 # Check for dependencies.
223 #--------------------------------
225 #APACHE PREFORK DEV TEST
226 AC_MSG_CHECKING([APXS])
227 if test -f "${APXS2}"; then
230 AC_MSG_ERROR([*** apxs not found, aborting])
234 if test x$OSRF_INSTALL_PYTHON = xtrue; then
235 AC_CHECK_PROG([HAVE_PYTHON],python,yes,no)
236 if test $HAVE_PYTHON = "no"; then
237 AC_MSG_ERROR([*** python not found, aborting])
239 AC_PYTHON_MOD([setuptools])
243 #-----------------------------
244 # Checks for libraries.
245 #-----------------------------
247 AC_CHECK_LIB([dl], [dlerror], [],AC_MSG_ERROR(***OpenSRF requires libdl))
248 AC_SEARCH_LIBS([mc_req_free], [memcache], [], AC_MSG_ERROR(***OpenSRF requires memcache headers))
249 AC_CHECK_LIB([ncurses], [initscr], [], AC_MSG_ERROR(***OpenSRF requires ncurses headers))
250 AC_CHECK_LIB([readline], [readline], [], AC_MSG_ERROR(***OpenSRF requires readline headers))
251 AC_CHECK_LIB([xml2], [xmlAddID], [], AC_MSG_ERROR(***OpenSRF requires libxml2 headers))
255 #-----------------------------
256 # Checks for header files.
257 #-----------------------------
261 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])
263 #------------------------------------------------------------------
264 # Checks for typedefs, structures, and compiler characteristics.
265 #------------------------------------------------------------------
274 #----------------------------------
275 # Checks for library functions.
276 #----------------------------------
280 AC_FUNC_SELECT_ARGTYPES
285 AC_CHECK_FUNCS([bzero dup2 gethostbyname gethostname gettimeofday memset select socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strtol])
287 #------------------------------------
288 # Configuration and output
289 #------------------------------------
291 AC_CONFIG_FILES([doc/dokuwiki-doc-stubber.pl
292 examples/math_xul_client/Makefile
293 examples/math_bench.pl
294 examples/math_client.py
295 examples/multisession-test.pl
300 src/libopensrf/Makefile
302 src/ports/strn_compat/Makefile
314 AC_MSG_RESULT([--------------------- Configuration options: -----------------------])
316 if test "$OSRF_INSTALL_JAVA" = "true" ; then
317 AC_MSG_RESULT([OSRF install Java support? yes])
318 AC_MSG_RESULT([Java support files $OSRF_JAVA_DEPSDIR])
320 AC_MSG_RESULT([OSRF install Java support? no])
323 if test "$OSRF_INSTALL_PYTHON" = "true" ; then
324 AC_MSG_RESULT([OSRF install Python support? yes])
326 AC_MSG_RESULT([OSRF install Python support? no])
329 if test "$OSRF_INSTALL_CHOPCHOP" = "true" ; then
330 AC_MSG_RESULT([OSRF install chopchop? yes])
332 AC_MSG_RESULT([OSRF install chopchop? no])
335 AC_MSG_RESULT(Installation directory prefix: ${prefix})
336 AC_MSG_RESULT(Temporary directory: ${TMP})
337 AC_MSG_RESULT(APXS2 location: ${APXS2})
338 AC_MSG_RESULT(Apache headers location: ${APACHE2_HEADERS})
339 AC_MSG_RESULT(APR headers location: ${APR_HEADERS})
340 AC_MSG_RESULT(libxml2 headers location: ${LIBXML2_HEADERS})
342 AC_MSG_RESULT([----------------------------------------------------------------------])