]> git.evergreen-ils.org Git - OpenSRF.git/blob - configure.ac
LP#1655449: Bundling/chunking limits for SubRquests
[OpenSRF.git] / configure.ac
1 # Copyright (C) 2008 Equinox Software, Inc.
2 # Kevin Beswick <kevinbeswick00@gmail.com>
3 # Copyright (C) 2009-2010 Dan Scott <dscott@laurentian.ca>
4 #
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.
9 #
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.
14 #
15 # Process this file with autoconf to produce a configure script.
16
17
18 #-------------------------------
19 # Initialization
20 #-------------------------------
21
22 export PATH=${PATH}:/usr/sbin
23 AC_PREREQ(2.59)
24
25 # Get our version number from one file
26 m4_include([version.m4])
27
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]))
31
32 AC_REVISION($Revision: 0.1 $)
33 AC_CONFIG_SRCDIR([configure.ac])
34
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
39 fi
40
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"
44 AC_SUBST([CONF_DIR])
45 AC_SUBST([PID_DIR])
46
47 AC_SUBST(prefix)
48 AC_SUBST(bindir)
49
50
51 AC_DEFUN([AC_PYTHON_MOD],[
52     if test -z $PYTHON;
53     then
54         PYTHON="python"
55     fi
56     AC_MSG_CHECKING($PYTHON_NAME module: $1)
57         $PYTHON -c "import $1" 2>/dev/null
58         if test $? -eq 0;
59         then
60                 AC_MSG_RESULT(yes)
61                 eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
62         else
63                 AC_MSG_ERROR(failed to find required module $1)
64                 exit 1
65         fi
66 ])
67
68 #-------------------------------
69 # Installation options
70 #-------------------------------
71
72 # build and install the java libs?
73 AC_ARG_ENABLE([java],
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)]) ;;
79 esac],
80 [OSRF_INSTALL_JAVA=false])
81
82 AM_CONDITIONAL([BUILDJAVA], [test x$OSRF_INSTALL_JAVA = xtrue])
83 AC_SUBST([OSRF_INSTALL_JAVA])
84
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)]) ;;
92 esac],
93 [OSRF_INSTALL_JAVASCRIPT=true])
94
95 AM_CONDITIONAL([INSTALLJAVASCRIPT], [test x$OSRF_INSTALL_JAVASCRIPT = xtrue])
96 AC_SUBST([OSRF_INSTALL_JAVASCRIPT])
97
98 # install the OpenSRF core files?
99 AC_ARG_ENABLE([core],
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)]) ;;
105 esac],
106 [OSRF_INSTALL_CORE=true])
107
108 AM_CONDITIONAL([BUILDCORE], [test x$OSRF_INSTALL_CORE = xtrue])
109 AC_SUBST([OSRF_INSTALL_CORE])
110
111
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)]) ;;
119 esac],
120 [OSRF_INSTALL_PYTHON=false])
121
122 AM_CONDITIONAL([BUILDPYTHON], [test x$OSRF_INSTALL_PYTHON = xtrue])
123 AC_SUBST([OSRF_INSTALL_PYTHON])
124
125 # enable debug?
126
127 AC_ARG_ENABLE(debug,
128 [  --enable-debug    Turn on debugging],
129 [case "${enableval}" in
130   yes) debug=true ;;
131   no)  debug=false ;;
132   *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
133 esac],[debug=false])
134 AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
135  
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])
140 fi
141
142 #--------------------------------
143 # Checks for programs.
144 #--------------------------------
145
146 AC_PROG_LIBTOOL
147 AC_PROG_AWK
148 AC_PROG_CC
149 AC_PROG_INSTALL
150 AC_PROG_MAKE_SET
151
152 #------------------------------
153 # Set install path variables
154 #------------------------------
155 AC_ARG_WITH([tmp],
156 [  --with-tmp=path                  location for the temporary directory for OpenSRF (default is /tmp)],
157 [TMP=${withval}],
158 [TMP=/tmp])
159 AC_SUBST([TMP])
160
161 AC_ARG_WITH([apxs],
162 [  --with-apxs=path                 location of the apxs (Apache extension) tool (default is /usr/bin/apxs2)],
163 [APXS2=${withval}],
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
169                                 APXS2="$i/$j"
170                                 break
171                         fi
172                 done
173         done
174 fi
175 AC_SUBST([APXS2])
176
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
184                         APACHE2_HEADERS="$i"
185                         break
186                 fi
187         done
188 fi
189 AC_SUBST([APACHE2_HEADERS])
190
191 AC_ARG_WITH([apr],
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
198                         APR_HEADERS="$i"
199                         break
200                 fi
201         done
202 fi
203 AC_SUBST([APR_HEADERS])
204
205 AC_ARG_WITH([perlbase],
206 [  --with-perlbase=path             base location to install Perl modules (default based on Config.pm)],
207 [PERL_BASE=${withval}],
208 [PERL_BASE=x])
209 AC_SUBST([PERL_BASE])
210
211 # The following Apache version detection code is adapted from
212 # http://www.gnu.org/software/autoconf-archive/ax_prog_apache.html
213 # licensed under version 2 of the GNU General Public License, or
214 # (at your discretion) any later version.
215 #
216 # Copyright (c) 2008 Loic Dachary <loic@senga.org>
217 #
218 # Collect apache version number. If for nothing else, this
219 # guarantees that httpd is a working apache executable.
220 #
221 APACHE=`$APXS2 -q progname`
222 AC_PATH_PROG(APACHE_PATH, [$APACHE], [])
223 if test -z "$APACHE_PATH" ; then
224         for i in /usr/bin /usr/sbin /usr/local/apache/bin /usr/local/apache2/bin ; do
225         if test -x "$i/$APACHE"; then
226             APACHE_PATH="$i/$APACHE"
227             break
228         fi
229         done
230 fi
231 changequote(<<, >>)dnl
232 APACHE_READABLE_VERSION=`$APACHE_PATH -v | grep 'Server version' | sed -e 's;.*Apache/\([0-9\.][0-9\.]*\).*;\1;'`
233 changequote([, ])dnl
234 APACHE_VERSION=`echo $APACHE_READABLE_VERSION | sed -e 's/\.//g'`
235 if test -z "$APACHE_VERSION" ; then
236     AC_MSG_ERROR("could not determine apache version number");
237 fi
238 APACHE_MAJOR=`expr $APACHE_VERSION : '\(..\)'`
239 APACHE_MINOR=`expr $APACHE_VERSION : '..\(.*\)'`
240 AM_CONDITIONAL(APACHE_MIN_24, test "$APACHE_MAJOR" -ge "24")
241 AC_SUBST([APACHE_MIN_24])
242
243 AC_ARG_WITH([libxml],
244 [  --with-libxml=path               location of the libxml2 headers (default is /usr/include/libxml2/))],
245 [LIBXML2_HEADERS=${withval}],
246 [LIBXML2_HEADERS=/usr/include/libxml2/])
247 AC_SUBST([LIBXML2_HEADERS])
248
249 AC_ARG_WITH([includes],
250 [  --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)],
251 [EXTRA_USER_INCLUDES=${withval}])
252
253 AC_ARG_WITH([libraries],
254 [  --with-libraries=DIRECTORIES     a colon-separated list of directories to search for libraries (Example: --with-libraries=/lib:/usr/lib)],
255 [EXTRA_USER_LIBRARIES=${withval}])
256
257 # Change these lists to proper compiler/linker options
258
259 IFSBAK=${IFS}
260 IFS="${IFS}:"
261
262 for dir in $EXTRA_USER_INCLUDES; do
263         if test -d "$dir"; then
264           INCLUDES="$INCLUDES -I$dir"
265         else
266           AC_MSG_WARN([*** Include directory $dir does not exist.])
267         fi
268 done
269 AC_SUBST(INCLUDES)
270
271 for dir in $EXTRA_USER_LIBRARIES; do
272         if test -d "$dir"; then
273           LIBDIRS="$LIBDIRS -L$dir"
274         else
275           AC_MSG_WARN([*** Library directory $dir does not exist.])
276         fi
277 done
278 AC_SUBST(LIBDIRS)
279
280 IFS=${IFSBAK}
281
282 AC_CONFIG_FILES([Makefile
283         src/Makefile])
284
285 #PYTHON TESTS
286 if test x$OSRF_INSTALL_PYTHON = xtrue; then
287     AC_CHECK_PROG([HAVE_PYTHON],python,yes,no)
288     if test $HAVE_PYTHON = "no"; then
289         AC_MSG_ERROR([*** python not found, aborting])
290     fi
291     AC_PYTHON_MOD([setuptools])
292     AC_CONFIG_FILES([
293         examples/math_client.py
294         examples/simple_text.py
295         src/python/Makefile
296     ])
297 fi
298 # Check Unit test framework
299 PKG_CHECK_MODULES([CHECK], [check >= 0.9.0], [enable_tests=yes],
300                   [enable_tests=no])
301 AM_CONDITIONAL(CHECK_TESTS, test x$enable_tests = xyes)
302
303 if test "x$enable_tests" = "xno"; then
304   AC_MSG_WARN(Check unit testing framework not found.)
305 fi
306
307 if test "x$OSRF_INSTALL_CORE" = "xtrue"; then
308         #--------------------------------
309         # Check for dependencies.
310         #--------------------------------
311
312         #APACHE PREFORK DEV TEST
313         AC_MSG_CHECKING([APXS])
314         if test -f "${APXS2}"; then
315         AC_MSG_RESULT([yes])
316         else
317         AC_MSG_ERROR([*** apxs not found, aborting])
318         fi  
319
320         #-----------------------------
321         # Checks for libraries.
322         #-----------------------------
323
324         AC_SEARCH_LIBS([dlerror], [dl], [],AC_MSG_ERROR([***OpenSRF requires a library (typically libdl) that provides dlerror()]))
325         AC_CHECK_LIB([ncurses], [initscr], [], AC_MSG_ERROR(***OpenSRF requires ncurses development headers))
326         AC_CHECK_LIB([readline], [readline], [], AC_MSG_ERROR(***OpenSRF requires readline development headers))
327         AC_CHECK_LIB([xml2], [xmlAddID], [], AC_MSG_ERROR(***OpenSRF requires xml2 development headers))
328         # Check for libmemcached and set flags accordingly
329         PKG_CHECK_MODULES(memcached, libmemcached >= 0.8.0)
330         AC_SUBST(memcached_CFLAGS)
331         AC_SUBST(memcached_LIBS)
332
333         #-----------------------------
334         # Checks for header files.
335         #-----------------------------
336
337         AC_HEADER_STDC
338         AC_HEADER_SYS_WAIT
339         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])
340
341         #------------------------------------------------------------------
342         # Checks for typedefs, structures, and compiler characteristics.
343         #------------------------------------------------------------------
344
345         AC_C_CONST
346         AC_C_INLINE
347         AC_TYPE_PID_T
348         AC_TYPE_SIZE_T
349         AC_HEADER_TIME
350         AC_STRUCT_TM
351     AM_PROG_CC_C_O
352
353         #----------------------------------
354         # Checks for library functions.
355         #----------------------------------
356
357         AC_FUNC_FORK
358         AC_FUNC_MALLOC
359         AC_FUNC_SELECT_ARGTYPES
360         AC_TYPE_SIGNAL
361         AC_FUNC_STRFTIME
362         AC_FUNC_STRTOD
363         AC_FUNC_VPRINTF
364         AC_CHECK_FUNCS([bzero dup2 gethostbyname gethostname gettimeofday malloc_stats memset select socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strtol])
365
366         #------------------------------------
367         # Configuration and output
368         #------------------------------------
369
370         AC_CONFIG_FILES([doc/dokuwiki-doc-stubber.pl
371                          examples/math_xul_client/Makefile
372                          examples/math_bench.pl
373                          examples/multisession-test.pl
374                          src/c-apps/Makefile
375                          src/gateway/Makefile
376                          src/libopensrf/Makefile
377                          src/perl/Makefile
378                          src/ports/strn_compat/Makefile
379                          src/python/opensrf.py
380                          src/router/Makefile
381                          src/srfsh/Makefile
382              tests/Makefile
383                          bin/opensrf-perl.pl
384                          bin/osrf_config])
385 fi
386
387 AC_OUTPUT
388
389 AC_MSG_RESULT([])
390 AC_MSG_RESULT([--------------------- Configuration options:  -----------------------])
391
392 if test "$OSRF_INSTALL_JAVA" = "true" ; then
393         AC_MSG_RESULT([OSRF install Java support?       yes])
394         AC_MSG_RESULT([Java support files               $OSRF_JAVA_DEPSDIR])
395 else
396         AC_MSG_RESULT([OSRF install Java support?       no])
397 fi
398
399 if test "$OSRF_INSTALL_PYTHON" = "true" ; then
400         AC_MSG_RESULT([OSRF install Python support?     yes])
401 else
402         AC_MSG_RESULT([OSRF install Python support?     no])
403 fi
404
405         AC_MSG_RESULT(Installation directory prefix:   ${prefix})
406         AC_MSG_RESULT(Temporary directory:             ${TMP})
407         AC_MSG_RESULT(APXS2 location:                  ${APXS2})
408         AC_MSG_RESULT(Apache headers location:         ${APACHE2_HEADERS})
409         AC_MSG_RESULT(APR headers location:            ${APR_HEADERS})
410         AC_MSG_RESULT(Apache version:                  ${APACHE_READABLE_VERSION})
411         AC_MSG_RESULT(libxml2 headers location:        ${LIBXML2_HEADERS})
412
413 AC_MSG_RESULT([----------------------------------------------------------------------])