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 # build and install the python modules
72 AC_ARG_ENABLE([python],
73 [ --enable-python enable building and installing python modules],
74 [case "${enableval}" in
75 yes) OSRF_INSTALL_PYTHON=true ;;
76 no) OSRF_INSTALL_PYTHON=false ;;
77 *) AC_MSG_ERROR([please choose another value for --enable-python (supported values are yes or no)]) ;;
79 [OSRF_INSTALL_PYTHON=false])
81 AM_CONDITIONAL([BUILDPYTHON], [test x$OSRF_INSTALL_PYTHON = xtrue])
82 AC_SUBST([OSRF_INSTALL_PYTHON])
87 [ --enable-debug Turn on debugging],
88 [case "${enableval}" in
91 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
93 AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
96 # path to the directory containing the java dependency jar files (included if java installs)
97 if test $OSRF_INSTALL_JAVA; then
98 AC_SUBST([OSRF_JAVA_DEPSDIR], [/opt/java])
103 #--------------------------------
104 # Checks for programs.
105 #--------------------------------
113 #------------------------------
114 # Set install path variables
115 #------------------------------
117 [ --with-tmp=path location for the temporary dir for OpenSRF (default is /tmp)],
123 [ --with-apxs=path location of the apxs Apache configuration tool (default is /usr/bin/apxs2)],
125 [APXS2=/usr/bin/apxs2])
128 AC_ARG_WITH([apache],
129 [ --with-apache=path location of the Apache headers (default is /usr/include/apache2)],
130 [APACHE2_HEADERS=${withval}],
131 [APACHE2_HEADERS=/usr/include/apache2])
132 AC_SUBST([APACHE2_HEADERS])
135 [ --with-apr=path location of the apr headers (default is /usr/include/apr-1.0/)],
136 [APR_HEADERS=${withval}],
137 [APR_HEADERS=/usr/include/apr-1.0])
138 AC_SUBST([APR_HEADERS])
140 AC_ARG_WITH([libxml],
141 [ --with-libxml=path location of the libxml headers (default is /usr/include/libxml2/))],
142 [LIBXML2_HEADERS=${withval}],
143 [LIBXML2_HEADERS=/usr/include/libxml2/])
144 AC_SUBST([LIBXML2_HEADERS])
146 AC_ARG_WITH([includes],
147 [ --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)],
148 [EXTRA_USER_INCLUDES=${withval}])
150 AC_ARG_WITH([libraries],
151 [ --with-libraries=DIRECTORIES a colon-separated list of directories to search for libraries (Example: --with-libraries=/lib:/usr/lib)],
152 [EXTRA_USER_LIBRARIES=${withval}])
154 # Change these lists to proper compiler/linker options
159 for dir in $EXTRA_USER_INCLUDES; do
160 if test -d "$dir"; then
161 INCLUDES="$INCLUDES -I$dir"
163 AC_MSG_WARN([*** Include directory $dir does not exist.])
168 for dir in $EXTRA_USER_LIBRARIES; do
169 if test -d "$dir"; then
170 LIBDIRS="$LIBDIRS -L$dir"
172 AC_MSG_WARN([*** Library directory $dir does not exist.])
179 #--------------------------------
180 # Check for dependencies.
181 #--------------------------------
183 #APACHE PREFORK DEV TEST
184 AC_MSG_CHECKING([APXS])
185 if test -f "${APXS2}"; then
188 AC_MSG_ERROR([*** apxs not found, aborting])
192 if test x$OSRF_INSTALL_PYTHON = xtrue; then
193 AC_CHECK_PROG([HAVE_PYTHON],python,yes,no)
194 if test $HAVE_PYTHON = "no"; then
195 AC_MSG_ERROR([*** python not found, aborting])
197 AC_PYTHON_MOD([setuptools])
201 #-----------------------------
202 # Checks for libraries.
203 #-----------------------------
205 AC_CHECK_LIB([dl], [dlerror], [],AC_MSG_ERROR(***OpenSRF requires libdl))
206 AC_SEARCH_LIBS([mc_req_free], [memcache], [], AC_MSG_ERROR(***OpenSRF requires memcache development headers))
207 AC_CHECK_LIB([ncurses], [initscr], [], AC_MSG_ERROR(***OpenSRF requires ncurses development headers))
208 AC_CHECK_LIB([readline], [readline], [], AC_MSG_ERROR(***OpenSRF requires readline development headers))
209 AC_CHECK_LIB([xml2], [xmlAddID], [], AC_MSG_ERROR(***OpenSRF requires xml2 development headers))
213 #-----------------------------
214 # Checks for header files.
215 #-----------------------------
219 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])
221 #------------------------------------------------------------------
222 # Checks for typedefs, structures, and compiler characteristics.
223 #------------------------------------------------------------------
232 #----------------------------------
233 # Checks for library functions.
234 #----------------------------------
238 AC_FUNC_SELECT_ARGTYPES
243 AC_CHECK_FUNCS([bzero dup2 gethostbyname gethostname gettimeofday memset select socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strtol])
245 #------------------------------------
246 # Configuration and output
247 #------------------------------------
249 AC_CONFIG_FILES([Makefile
250 doc/dokuwiki-doc-stubber.pl
251 examples/math_xul_client/Makefile
252 examples/math_bench.pl
253 examples/math_client.py
254 examples/multisession-test.pl
260 src/libopensrf/Makefile
262 src/ports/strn_compat/Makefile
274 AC_MSG_RESULT([--------------------- Configuration options: -----------------------])
276 if test "$OSRF_INSTALL_JAVA" = "true" ; then
277 AC_MSG_RESULT([OSRF install java?: yes])
278 AC_MSG_RESULT([Java deps dir: $OSRF_JAVA_DEPSDIR])
280 AC_MSG_RESULT([OSRF install java?: no])
283 if test "$OSRF_INSTALL_PYTHON" = "true" ; then
284 AC_MSG_RESULT([OSRF install python?: yes])
286 AC_MSG_RESULT([OSRF install python?: no])
289 AC_MSG_RESULT(Installation directory prefix: ${prefix})
290 AC_MSG_RESULT(Tmp dir location: ${TMP})
291 AC_MSG_RESULT(APXS2 location: ${APXS2})
292 AC_MSG_RESULT(Apache headers location: ${APACHE2_HEADERS})
293 AC_MSG_RESULT(APR headers location: ${APR_HEADERS})
294 AC_MSG_RESULT(libxml2 headers location: ${LIBXML2_HEADERS})
300 AC_MSG_RESULT([----------------------------------------------------------------------])