]> git.evergreen-ils.org Git - working/OpenSRF.git/blob - configure.ac
LP1999823: Bump libtool library version
[working/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 libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
23 libtoolize: and rerunning libtoolize and aclocal.
24 libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
25
26
27 export PATH=${PATH}:/usr/sbin
28 AC_PREREQ(2.59)
29
30 # Get our version number from one file
31 m4_include([version.m4])
32
33 # Version number gets turned into @PACKAGE_VERSION@
34 AC_INIT([OpenSRF], [VERSION_NUMBER])
35 AC_CONFIG_SRCDIR([configure.ac])
36 AM_INIT_AUTOMAKE
37 AC_CONFIG_MACRO_DIRS([m4])
38
39 AC_REVISION($Revision: 0.1 $)
40
41 # Enable $prefix to resolve to a reasonable value in substitutions in
42 # scripts if no explict value was passed in to configure
43 if test "$prefix" == "NONE"; then
44    prefix=$ac_default_prefix
45 fi
46
47 # Perl scripts don't want ${prefix} if no value was specified
48 eval "eval CONF_DIR=$sysconfdir"
49 eval "eval PID_DIR=$localstatedir"
50 AC_SUBST([CONF_DIR])
51 AC_SUBST([PID_DIR])
52
53 AC_SUBST(prefix)
54 AC_SUBST(bindir)
55
56 #-------------------------------
57 # Installation options
58 #-------------------------------
59
60 # install the javascript files?
61 AC_ARG_ENABLE([javascript],
62 [  --disable-javascript    disable installing JavaScript libraries],
63 [case "${enableval}" in
64     yes) OSRF_INSTALL_JAVASCRIPT=true ;;
65     no) OSRF_INSTALL_JAVASCRIPT=false ;; 
66   *) AC_MSG_ERROR([please choose another value for --disable-javascript (supported values are yes or no)]) ;;
67 esac],
68 [OSRF_INSTALL_JAVASCRIPT=true])
69
70 AM_CONDITIONAL([INSTALLJAVASCRIPT], [test x$OSRF_INSTALL_JAVASCRIPT = xtrue])
71 AC_SUBST([OSRF_INSTALL_JAVASCRIPT])
72
73 # install the OpenSRF core files?
74 AC_ARG_ENABLE([core],
75 [  --disable-core    disable installing core files],
76 [case "${enableval}" in
77     yes) OSRF_INSTALL_CORE=true ;;
78     no) OSRF_INSTALL_CORE=false ;; 
79   *) AC_MSG_ERROR([please choose another value for --disable-core (supported values are yes or no)]) ;;
80 esac],
81 [OSRF_INSTALL_CORE=true])
82
83 AM_CONDITIONAL([BUILDCORE], [test x$OSRF_INSTALL_CORE = xtrue])
84 AC_SUBST([OSRF_INSTALL_CORE])
85
86 # enable debug?
87
88 AC_ARG_ENABLE(debug,
89 [  --enable-debug    Turn on debugging],
90 [case "${enableval}" in
91   yes) debug=true ;;
92   no)  debug=false ;;
93   *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
94 esac],[debug=false])
95 AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
96  
97
98 #--------------------------------
99 # Checks for programs.
100 #--------------------------------
101
102 LT_INIT
103 AC_PROG_AWK
104 AC_PROG_CC
105 AC_PROG_INSTALL
106 AC_PROG_MAKE_SET
107
108 #------------------------------
109 # Set install path variables
110 #------------------------------
111 AC_ARG_WITH([tmp],
112 [  --with-tmp=path                  location for the temporary directory for OpenSRF (default is /tmp)],
113 [TMP=${withval}],
114 [TMP=/tmp])
115 AC_SUBST([TMP])
116
117 AC_ARG_WITH([apxs],
118 [  --with-apxs=path                 location of the apxs (Apache extension) tool (default is /usr/bin/apxs2)],
119 [APXS2=${withval}],
120 [APXS2=/usr/bin/apxs2])
121 if ! test -x "$APXS2"; then
122         for i in /usr/bin /usr/sbin /usr/local/apache/bin /usr/local/apache2/bin ; do
123                 for j in apxs apxs2 ; do
124                         if test -x "$i/$j"; then
125                                 APXS2="$i/$j"
126                                 break
127                         fi
128                 done
129         done
130 fi
131 AC_SUBST([APXS2])
132
133 AC_ARG_WITH([apache],
134 [  --with-apache=path               location of the Apache headers (default is /usr/include/apache2)],
135 [APACHE2_HEADERS=${withval}],
136 [APACHE2_HEADERS=/usr/include/apache2])
137 if ! test -d "$APACHE2_HEADERS"; then
138         for i in /usr/include/httpd ; do
139                 if test -d "$i"; then
140                         APACHE2_HEADERS="$i"
141                         break
142                 fi
143         done
144 fi
145 AC_SUBST([APACHE2_HEADERS])
146
147 AC_ARG_WITH([apr],
148 [  --with-apr=path                  location of the Apache Portable Runtime headers (default is /usr/include/apr-1.0/)],
149 [APR_HEADERS=${withval}],
150 [APR_HEADERS=/usr/include/apr-1.0])
151 if ! test -d "$APR_HEADERS"; then
152         for i in /usr/include/apr-1 ; do
153                 if test -d "$i"; then
154                         APR_HEADERS="$i"
155                         break
156                 fi
157         done
158 fi
159 AC_SUBST([APR_HEADERS])
160
161 AC_ARG_WITH([perlbase],
162 [  --with-perlbase=path             base location to install Perl modules (default based on Config.pm)],
163 [PERL_BASE=${withval}],
164 [PERL_BASE=x])
165 AC_SUBST([PERL_BASE])
166
167 AC_ARG_WITH([websockets-port],
168 [  --with-websockets-port=path             WebSockets port to use (default is 7682)],
169 [WS_PORT=${withval}],
170 [WS_PORT=7682])
171 AC_SUBST([WS_PORT])
172
173 # The following Apache version detection code is adapted from
174 # http://www.gnu.org/software/autoconf-archive/ax_prog_apache.html
175 # licensed under version 2 of the GNU General Public License, or
176 # (at your discretion) any later version.
177 #
178 # Copyright (c) 2008 Loic Dachary <loic@senga.org>
179 #
180 # Collect apache version number. If for nothing else, this
181 # guarantees that httpd is a working apache executable.
182 #
183 APACHE=`$APXS2 -q progname`
184 AC_PATH_PROG(APACHE_PATH, [$APACHE], [])
185 if test -z "$APACHE_PATH" ; then
186         for i in /usr/bin /usr/sbin /usr/local/apache/bin /usr/local/apache2/bin ; do
187         if test -x "$i/$APACHE"; then
188             APACHE_PATH="$i/$APACHE"
189             break
190         fi
191         done
192 fi
193 changequote(<<, >>)dnl
194 APACHE_READABLE_VERSION=`$APACHE_PATH -v | grep 'Server version' | sed -e 's;.*Apache/\([0-9\.][0-9\.]*\).*;\1;'`
195 changequote([, ])dnl
196 APACHE_VERSION=`echo $APACHE_READABLE_VERSION | sed -e 's/\.//g'`
197 if test -z "$APACHE_VERSION" ; then
198     AC_MSG_ERROR("could not determine apache version number");
199 fi
200 APACHE_MAJOR=`expr $APACHE_VERSION : '\(..\)'`
201 APACHE_MINOR=`expr $APACHE_VERSION : '..\(.*\)'`
202 AM_CONDITIONAL(APACHE_MIN_24, test "$APACHE_MAJOR" -ge "24")
203 AC_SUBST([APACHE_MIN_24])
204
205 AC_ARG_WITH([libxml],
206 [  --with-libxml=path               location of the libxml2 headers (default is /usr/include/libxml2/))],
207 [LIBXML2_HEADERS=${withval}],
208 [LIBXML2_HEADERS=/usr/include/libxml2/])
209 AC_SUBST([LIBXML2_HEADERS])
210
211 AC_ARG_WITH([includes],
212 [  --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)],
213 [EXTRA_USER_INCLUDES=${withval}])
214
215 AC_ARG_WITH([libraries],
216 [  --with-libraries=DIRECTORIES     a colon-separated list of directories to search for libraries (Example: --with-libraries=/lib:/usr/lib)],
217 [EXTRA_USER_LIBRARIES=${withval}])
218
219 # Change these lists to proper compiler/linker options
220
221 IFSBAK=${IFS}
222 IFS="${IFS}:"
223
224 for dir in $EXTRA_USER_INCLUDES; do
225         if test -d "$dir"; then
226           AM_CPPFLAGS="$AM_CPPFLAGS -I$dir"
227         else
228           AC_MSG_WARN([*** Include directory $dir does not exist.])
229         fi
230 done
231 AC_SUBST(AM_CPPFLAGS)
232
233 for dir in $EXTRA_USER_LIBRARIES; do
234         if test -d "$dir"; then
235           LIBDIRS="$LIBDIRS -L$dir"
236         else
237           AC_MSG_WARN([*** Library directory $dir does not exist.])
238         fi
239 done
240 AC_SUBST(LIBDIRS)
241
242 IFS=${IFSBAK}
243
244 AC_CONFIG_FILES([Makefile
245         src/Makefile])
246
247 # Check Unit test framework
248 PKG_CHECK_MODULES([CHECK], [check >= 0.9.0], [enable_tests=yes],
249                   [enable_tests=no])
250 AM_CONDITIONAL(CHECK_TESTS, test x$enable_tests = xyes)
251
252 if test "x$enable_tests" = "xno"; then
253   AC_MSG_WARN(Check unit testing framework not found.)
254 fi
255
256 if test "x$OSRF_INSTALL_CORE" = "xtrue"; then
257         #--------------------------------
258         # Check for dependencies.
259         #--------------------------------
260
261         #APACHE PREFORK DEV TEST
262         AC_MSG_CHECKING([APXS])
263         if test -f "${APXS2}"; then
264         AC_MSG_RESULT([yes])
265         else
266         AC_MSG_ERROR([*** apxs not found, aborting])
267         fi  
268
269         #-----------------------------
270         # Checks for libraries.
271         #-----------------------------
272
273         AC_SEARCH_LIBS([dlerror], [dl], [],AC_MSG_ERROR([***OpenSRF requires a library (typically libdl) that provides dlerror()]))
274         AC_CHECK_LIB([ncurses], [initscr], [], AC_MSG_ERROR(***OpenSRF requires ncurses development headers))
275         AC_CHECK_LIB([readline], [readline], [], AC_MSG_ERROR(***OpenSRF requires readline development headers))
276         AC_CHECK_LIB([xml2], [xmlAddID], [], AC_MSG_ERROR(***OpenSRF requires xml2 development headers))
277         # Check for libmemcached and set flags accordingly
278         PKG_CHECK_MODULES(memcached, libmemcached >= 0.8.0)
279         AC_SUBST(memcached_CFLAGS)
280         AC_SUBST(memcached_LIBS)
281
282         #-----------------------------
283         # Checks for header files.
284         #-----------------------------
285
286         AC_HEADER_SYS_WAIT
287         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])
288
289         #------------------------------------------------------------------
290         # Checks for typedefs, structures, and compiler characteristics.
291         #------------------------------------------------------------------
292
293         AC_C_CONST
294         AC_C_INLINE
295         AC_TYPE_PID_T
296         AC_TYPE_SIZE_T
297         AC_STRUCT_TM
298     AM_PROG_CC_C_O
299
300         #----------------------------------
301         # Checks for library functions.
302         #----------------------------------
303
304         AC_FUNC_FORK
305         AC_FUNC_MALLOC
306         AC_FUNC_SELECT_ARGTYPES
307         AC_FUNC_STRFTIME
308         AC_FUNC_STRTOD
309         AC_FUNC_VPRINTF
310         AC_CHECK_FUNCS([bzero dup2 gethostbyname gethostname gettimeofday malloc_stats memset select socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strtol])
311
312         #------------------------------------
313         # Configuration and output
314         #------------------------------------
315
316         AC_CONFIG_FILES([doc/dokuwiki-doc-stubber.pl
317                          examples/math_bench.pl
318                          examples/multisession-test.pl
319                          src/c-apps/Makefile
320                          src/gateway/Makefile
321                          src/javascript/opensrf_ws.js
322                          src/javascript/opensrf_ws_shared.js
323                          src/libopensrf/Makefile
324                          src/perl/Makefile
325                          src/ports/strn_compat/Makefile
326                          src/router/Makefile
327                          src/srfsh/Makefile
328                          src/websocket-stdio/Makefile
329                          tests/Makefile
330                          bin/opensrf-perl.pl
331                          bin/osrf_config])
332 fi
333
334 AC_OUTPUT
335
336 AC_MSG_RESULT([])
337 AC_MSG_RESULT([--------------------- Configuration options:  -----------------------])
338
339         AC_MSG_RESULT(Installation directory prefix:   ${prefix})
340         AC_MSG_RESULT(Temporary directory:             ${TMP})
341         AC_MSG_RESULT(APXS2 location:                  ${APXS2})
342         AC_MSG_RESULT(Apache headers location:         ${APACHE2_HEADERS})
343         AC_MSG_RESULT(APR headers location:            ${APR_HEADERS})
344         AC_MSG_RESULT(Apache version:                  ${APACHE_READABLE_VERSION})
345         AC_MSG_RESULT(libxml2 headers location:        ${LIBXML2_HEADERS})
346
347 AC_MSG_RESULT([----------------------------------------------------------------------])