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])
30 # Enable $prefix to resolve to a reasonable value in substitutions in
31 # scripts if no explict value was passed in to configure
32 if test "$prefix" = "NONE"; then
33 prefix=$ac_default_prefix
36 # Perl and Python scripts don't want ${prefix} if no value was specified
37 eval "eval CONF_DIR=$sysconfdir"
44 AC_DEFUN([AC_PYTHON_MOD],[
49 AC_MSG_CHECKING($PYTHON_NAME module: $1)
50 $PYTHON -c "import $1" 2>/dev/null
54 eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
56 AC_MSG_ERROR(failed to find required module $1)
63 #-------------------------------
64 # Installation options
65 #-------------------------------
67 # build and install the java libs?
69 [ --enable-java enable building and installing the java libraries],
70 [case "${enableval}" in
71 yes) OSRF_INSTALL_JAVA=true ;;
72 no) OSRF_INSTALL_JAVA=false ;;
73 *) AC_MSG_ERROR([please choose another value for --enable-java (supported values are yes or no)]) ;;
75 [OSRF_INSTALL_JAVA=false])
77 AM_CONDITIONAL([BUILDJAVA], [test x$OSRF_INSTALL_JAVA = xtrue])
78 AC_SUBST([OSRF_INSTALL_JAVA])
80 # install the javascript files?
81 AC_ARG_ENABLE([javascript],
82 [ --disable-javascript disable installing JavaScript libraries],
83 [case "${enableval}" in
84 yes) OSRF_INSTALL_JAVASCRIPT=true ;;
85 no) OSRF_INSTALL_JAVASCRIPT=false ;;
86 *) AC_MSG_ERROR([please choose another value for --disable-javascript (supported values are yes or no)]) ;;
88 [OSRF_INSTALL_JAVASCRIPT=true])
90 AM_CONDITIONAL([INSTALLJAVASCRIPT], [test x$OSRF_INSTALL_JAVASCRIPT = xtrue])
91 AC_SUBST([OSRF_INSTALL_JAVASCRIPT])
93 # install the OpenSRF core files?
95 [ --disable-core disable installing core files],
96 [case "${enableval}" in
97 yes) OSRF_INSTALL_CORE=true ;;
98 no) OSRF_INSTALL_CORE=false ;;
99 *) AC_MSG_ERROR([please choose another value for --disable-core (supported values are yes or no)]) ;;
101 [OSRF_INSTALL_CORE=true])
103 AM_CONDITIONAL([BUILDCORE], [test x$OSRF_INSTALL_CORE = xtrue])
104 AC_SUBST([OSRF_INSTALL_CORE])
107 # build and install the python modules
108 AC_ARG_ENABLE([python],
109 [ --enable-python enable building and installing python modules],
110 [case "${enableval}" in
111 yes) OSRF_INSTALL_PYTHON=true ;;
112 no) OSRF_INSTALL_PYTHON=false ;;
113 *) AC_MSG_ERROR([please choose another value for --enable-python (supported values are yes or no)]) ;;
115 [OSRF_INSTALL_PYTHON=false])
117 AM_CONDITIONAL([BUILDPYTHON], [test x$OSRF_INSTALL_PYTHON = xtrue])
118 AC_SUBST([OSRF_INSTALL_PYTHON])
120 # enable chopchop, the basic XMPP server
122 AC_ARG_ENABLE([chopchop],
123 [ --enable-chopchop build and install chopchop, a basic XMPP server],
124 [case "${enableval}" in
125 yes) OSRF_INSTALL_CHOPCHOP=true ;;
126 no) OSRF_INSTALL_CHOPCHOP=false ;;
127 *) AC_MSG_ERROR([please choose another value for --enable-chopchop (supported values are yes or no)]) ;;
129 [OSRF_INSTALL_CHOPCHOP=false])
131 AM_CONDITIONAL([BUILDCHOPCHOP], [test x$OSRF_INSTALL_CHOPCHOP = xtrue])
132 AC_SUBST([OSRF_INSTALL_CHOPCHOP])
137 [ --enable-debug Turn on debugging],
138 [case "${enableval}" in
141 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
143 AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
145 # path to the directory containing the java dependency jar files (included if java installs)
146 if test $OSRF_INSTALL_JAVA; then
147 AC_SUBST([OSRF_JAVA_DEPSDIR], [/opt/java])
150 #--------------------------------
151 # Checks for programs.
152 #--------------------------------
160 #------------------------------
161 # Set install path variables
162 #------------------------------
164 [ --with-tmp=path location for the temporary directory for OpenSRF (default is /tmp)],
170 [ --with-apxs=path location of the apxs (Apache extension) tool (default is /usr/bin/apxs2)],
172 [APXS2=/usr/bin/apxs2])
175 AC_ARG_WITH([apache],
176 [ --with-apache=path location of the Apache headers (default is /usr/include/apache2)],
177 [APACHE2_HEADERS=${withval}],
178 [APACHE2_HEADERS=/usr/include/apache2])
179 AC_SUBST([APACHE2_HEADERS])
182 [ --with-apr=path location of the Apache Portable Runtime headers (default is /usr/include/apr-1.0/)],
183 [APR_HEADERS=${withval}],
184 [APR_HEADERS=/usr/include/apr-1.0])
185 AC_SUBST([APR_HEADERS])
187 AC_ARG_WITH([libxml],
188 [ --with-libxml=path location of the libxml2 headers (default is /usr/include/libxml2/))],
189 [LIBXML2_HEADERS=${withval}],
190 [LIBXML2_HEADERS=/usr/include/libxml2/])
191 AC_SUBST([LIBXML2_HEADERS])
193 AC_ARG_WITH([includes],
194 [ --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)],
195 [EXTRA_USER_INCLUDES=${withval}])
197 AC_ARG_WITH([libraries],
198 [ --with-libraries=DIRECTORIES a colon-separated list of directories to search for libraries (Example: --with-libraries=/lib:/usr/lib)],
199 [EXTRA_USER_LIBRARIES=${withval}])
201 # Change these lists to proper compiler/linker options
206 for dir in $EXTRA_USER_INCLUDES; do
207 if test -d "$dir"; then
208 INCLUDES="$INCLUDES -I$dir"
210 AC_MSG_WARN([*** Include directory $dir does not exist.])
215 for dir in $EXTRA_USER_LIBRARIES; do
216 if test -d "$dir"; then
217 LIBDIRS="$LIBDIRS -L$dir"
219 AC_MSG_WARN([*** Library directory $dir does not exist.])
226 AC_CONFIG_FILES([Makefile
229 if test "x$OSRF_INSTALL_CORE" = "xtrue"; then
230 #--------------------------------
231 # Check for dependencies.
232 #--------------------------------
234 #APACHE PREFORK DEV TEST
235 AC_MSG_CHECKING([APXS])
236 if test -f "${APXS2}"; then
239 AC_MSG_ERROR([*** apxs not found, aborting])
243 if test x$OSRF_INSTALL_PYTHON = xtrue; then
244 AC_CHECK_PROG([HAVE_PYTHON],python,yes,no)
245 if test $HAVE_PYTHON = "no"; then
246 AC_MSG_ERROR([*** python not found, aborting])
248 AC_PYTHON_MOD([setuptools])
252 #-----------------------------
253 # Checks for libraries.
254 #-----------------------------
256 AC_CHECK_LIB([dl], [dlerror], [],AC_MSG_ERROR(***OpenSRF requires libdl))
257 AC_SEARCH_LIBS([mc_req_free], [memcache], [], AC_MSG_ERROR(***OpenSRF requires memcache headers))
258 AC_CHECK_LIB([ncurses], [initscr], [], AC_MSG_ERROR(***OpenSRF requires ncurses headers))
259 AC_CHECK_LIB([readline], [readline], [], AC_MSG_ERROR(***OpenSRF requires readline headers))
260 AC_CHECK_LIB([xml2], [xmlAddID], [], AC_MSG_ERROR(***OpenSRF requires libxml2 headers))
264 #-----------------------------
265 # Checks for header files.
266 #-----------------------------
270 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])
272 #------------------------------------------------------------------
273 # Checks for typedefs, structures, and compiler characteristics.
274 #------------------------------------------------------------------
283 #----------------------------------
284 # Checks for library functions.
285 #----------------------------------
289 AC_FUNC_SELECT_ARGTYPES
294 AC_CHECK_FUNCS([bzero dup2 gethostbyname gethostname gettimeofday memset select socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strtol])
296 #------------------------------------
297 # Configuration and output
298 #------------------------------------
300 AC_CONFIG_FILES([doc/dokuwiki-doc-stubber.pl
301 examples/math_xul_client/Makefile
302 examples/math_bench.pl
303 examples/math_client.py
304 examples/multisession-test.pl
309 src/libopensrf/Makefile
311 src/ports/strn_compat/Makefile
323 AC_MSG_RESULT([--------------------- Configuration options: -----------------------])
325 if test "$OSRF_INSTALL_JAVA" = "true" ; then
326 AC_MSG_RESULT([OSRF install Java support? yes])
327 AC_MSG_RESULT([Java support files $OSRF_JAVA_DEPSDIR])
329 AC_MSG_RESULT([OSRF install Java support? no])
332 if test "$OSRF_INSTALL_PYTHON" = "true" ; then
333 AC_MSG_RESULT([OSRF install Python support? yes])
335 AC_MSG_RESULT([OSRF install Python support? no])
338 if test "$OSRF_INSTALL_CHOPCHOP" = "true" ; then
339 AC_MSG_RESULT([OSRF install chopchop? yes])
341 AC_MSG_RESULT([OSRF install chopchop? no])
344 AC_MSG_RESULT(Installation directory prefix: ${prefix})
345 AC_MSG_RESULT(Temporary directory: ${TMP})
346 AC_MSG_RESULT(APXS2 location: ${APXS2})
347 AC_MSG_RESULT(Apache headers location: ${APACHE2_HEADERS})
348 AC_MSG_RESULT(APR headers location: ${APR_HEADERS})
349 AC_MSG_RESULT(libxml2 headers location: ${LIBXML2_HEADERS})
351 AC_MSG_RESULT([----------------------------------------------------------------------])