]> git.evergreen-ils.org Git - OpenSRF.git/blob - configure.ac
Prevent infinite loop (with logging) in child process reaping.
[OpenSRF.git] / configure.ac
1 # Copyright (C) 2008 Equinox Software, Inc.
2 # Kevin Beswick <kevinbeswick00@gmail.com>
3 # Copyright (C) 2009 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 AC_INIT([OpenSRF],[trunk],[open-ils-dev@list.georgialibraries.org])
25 AM_INIT_AUTOMAKE([OpenSRF], [trunk])
26 AC_REVISION($Revision: 0.1 $)
27 AC_CONFIG_SRCDIR([configure.ac])
28 AC_PREFIX_DEFAULT([/opensrf])
29 AC_CONFIG_MACRO_DIR([m4])
30
31 # Enable $prefix to resolve to a reasonable value in substitutions in
32 # scripts if no explict value was passed in to configure
33 if test "$prefix" == "NONE"; then
34    prefix=$ac_default_prefix
35 fi
36
37 # Perl and Python scripts don't want ${prefix} if no value was specified
38 eval "eval CONF_DIR=$sysconfdir"
39 AC_SUBST([CONF_DIR])
40
41 AC_SUBST(prefix)
42 AC_SUBST(bindir)
43
44
45 AC_DEFUN([AC_PYTHON_MOD],[
46     if test -z $PYTHON;
47     then
48         PYTHON="python"
49     fi
50     AC_MSG_CHECKING($PYTHON_NAME module: $1)
51         $PYTHON -c "import $1" 2>/dev/null
52         if test $? -eq 0;
53         then
54                 AC_MSG_RESULT(yes)
55                 eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
56         else
57                 AC_MSG_ERROR(failed to find required module $1)
58                 exit 1
59         fi
60 ])
61
62
63
64 #-------------------------------
65 # Installation options
66 #-------------------------------
67
68 # build and install the java libs?
69 AC_ARG_ENABLE([java],
70 [  --enable-java    enable building and installing the java libraries],
71 [case "${enableval}" in
72     yes) OSRF_INSTALL_JAVA=true ;;
73     no) OSRF_INSTALL_JAVA=false ;; 
74   *) AC_MSG_ERROR([please choose another value for --enable-java (supported values are yes or no)]) ;;
75 esac],
76 [OSRF_INSTALL_JAVA=false])
77
78 AM_CONDITIONAL([BUILDJAVA], [test x$OSRF_INSTALL_JAVA = xtrue])
79 AC_SUBST([OSRF_INSTALL_JAVA])
80
81 # install the javascript files?
82 AC_ARG_ENABLE([javascript],
83 [  --disable-javascript    disable installing JavaScript libraries],
84 [case "${enableval}" in
85     yes) OSRF_INSTALL_JAVASCRIPT=true ;;
86     no) OSRF_INSTALL_JAVASCRIPT=false ;; 
87   *) AC_MSG_ERROR([please choose another value for --disable-javascript (supported values are yes or no)]) ;;
88 esac],
89 [OSRF_INSTALL_JAVASCRIPT=true])
90
91 AM_CONDITIONAL([INSTALLJAVASCRIPT], [test x$OSRF_INSTALL_JAVASCRIPT = xtrue])
92 AC_SUBST([OSRF_INSTALL_JAVASCRIPT])
93
94 # install the OpenSRF core files?
95 AC_ARG_ENABLE([core],
96 [  --disable-core    disable installing core files],
97 [case "${enableval}" in
98     yes) OSRF_INSTALL_CORE=true ;;
99     no) OSRF_INSTALL_CORE=false ;; 
100   *) AC_MSG_ERROR([please choose another value for --disable-core (supported values are yes or no)]) ;;
101 esac],
102 [OSRF_INSTALL_CORE=true])
103
104 AM_CONDITIONAL([BUILDCORE], [test x$OSRF_INSTALL_CORE = xtrue])
105 AC_SUBST([OSRF_INSTALL_CORE])
106
107
108 # build and install the python modules
109 AC_ARG_ENABLE([python],
110 [  --enable-python  enable building and installing python modules],
111 [case "${enableval}" in
112   yes) OSRF_INSTALL_PYTHON=true ;;
113   no) OSRF_INSTALL_PYTHON=false ;;
114   *) AC_MSG_ERROR([please choose another value for --enable-python (supported values are yes or no)]) ;;
115 esac],
116 [OSRF_INSTALL_PYTHON=false])
117
118 AM_CONDITIONAL([BUILDPYTHON], [test x$OSRF_INSTALL_PYTHON = xtrue])
119 AC_SUBST([OSRF_INSTALL_PYTHON])
120
121 # enable chopchop, the basic XMPP server
122
123 AC_ARG_ENABLE([chopchop],
124 [  --enable-chopchop    build and install chopchop, a basic XMPP server],
125 [case "${enableval}" in
126     yes) OSRF_INSTALL_CHOPCHOP=true ;;
127     no) OSRF_INSTALL_CHOPCHOP=false ;; 
128   *) AC_MSG_ERROR([please choose another value for --enable-chopchop (supported values are yes or no)]) ;;
129 esac],
130 [OSRF_INSTALL_CHOPCHOP=false])
131
132 AM_CONDITIONAL([BUILDCHOPCHOP], [test x$OSRF_INSTALL_CHOPCHOP = xtrue])
133 AC_SUBST([OSRF_INSTALL_CHOPCHOP])
134
135 # enable debug?
136
137 AC_ARG_ENABLE(debug,
138 [  --enable-debug    Turn on debugging],
139 [case "${enableval}" in
140   yes) debug=true ;;
141   no)  debug=false ;;
142   *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
143 esac],[debug=false])
144 AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
145  
146 # path to the directory containing the java dependency jar files (included if java installs)
147 if test $OSRF_INSTALL_JAVA; then
148         AC_SUBST([OSRF_JAVA_DEPSDIR], [/opt/java])
149 fi
150
151 #--------------------------------
152 # Checks for programs.
153 #--------------------------------
154
155 AC_PROG_LIBTOOL
156 AC_PROG_AWK
157 AC_PROG_CC
158 AC_PROG_INSTALL
159 AC_PROG_MAKE_SET
160
161 #------------------------------
162 # Set install path variables
163 #------------------------------
164 AC_ARG_WITH([tmp],
165 [  --with-tmp=path                  location for the temporary directory for OpenSRF (default is /tmp)],
166 [TMP=${withval}],
167 [TMP=/tmp])
168 AC_SUBST([TMP])
169
170 AC_ARG_WITH([apxs],
171 [  --with-apxs=path                 location of the apxs (Apache extension) tool (default is /usr/bin/apxs2)],
172 [APXS2=${withval}],
173 [APXS2=/usr/bin/apxs2])
174 AC_SUBST([APXS2])
175
176 AC_ARG_WITH([apache],
177 [  --with-apache=path               location of the Apache headers (default is /usr/include/apache2)],
178 [APACHE2_HEADERS=${withval}],
179 [APACHE2_HEADERS=/usr/include/apache2])
180 AC_SUBST([APACHE2_HEADERS])
181
182 AC_ARG_WITH([apr],
183 [  --with-apr=path                  location of the Apache Portable Runtime headers (default is /usr/include/apr-1.0/)],
184 [APR_HEADERS=${withval}],
185 [APR_HEADERS=/usr/include/apr-1.0])
186 AC_SUBST([APR_HEADERS])
187
188 AC_ARG_WITH([libxml],
189 [  --with-libxml=path               location of the libxml2 headers (default is /usr/include/libxml2/))],
190 [LIBXML2_HEADERS=${withval}],
191 [LIBXML2_HEADERS=/usr/include/libxml2/])
192 AC_SUBST([LIBXML2_HEADERS])
193
194 AC_ARG_WITH([includes],
195 [  --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)],
196 [EXTRA_USER_INCLUDES=${withval}])
197
198 AC_ARG_WITH([libraries],
199 [  --with-libraries=DIRECTORIES     a colon-separated list of directories to search for libraries (Example: --with-libraries=/lib:/usr/lib)],
200 [EXTRA_USER_LIBRARIES=${withval}])
201
202 # Change these lists to proper compiler/linker options
203
204 IFSBAK=${IFS}
205 IFS="${IFS}:"
206
207 for dir in $EXTRA_USER_INCLUDES; do
208         if test -d "$dir"; then
209           INCLUDES="$INCLUDES -I$dir"
210         else
211           AC_MSG_WARN([*** Include directory $dir does not exist.])
212         fi
213 done
214 AC_SUBST(INCLUDES)
215
216 for dir in $EXTRA_USER_LIBRARIES; do
217         if test -d "$dir"; then
218           LIBDIRS="$LIBDIRS -L$dir"
219         else
220           AC_MSG_WARN([*** Library directory $dir does not exist.])
221         fi
222 done
223 AC_SUBST(LIBDIRS)
224
225 IFS=${IFSBAK}
226
227 AC_CONFIG_FILES([Makefile
228         src/Makefile])
229
230 if test "x$OSRF_INSTALL_CORE" = "xtrue"; then
231         #--------------------------------
232         # Check for dependencies.
233         #--------------------------------
234
235         #APACHE PREFORK DEV TEST
236         AC_MSG_CHECKING([APXS])
237         if test -f "${APXS2}"; then
238         AC_MSG_RESULT([yes])
239         else
240         AC_MSG_ERROR([*** apxs not found, aborting])
241         fi  
242
243         #PYTHON TESTS
244         if test x$OSRF_INSTALL_PYTHON = xtrue; then
245                 AC_CHECK_PROG([HAVE_PYTHON],python,yes,no)
246                 if test $HAVE_PYTHON = "no"; then
247                         AC_MSG_ERROR([*** python not found, aborting])
248                 fi
249                 AC_PYTHON_MOD([setuptools])
250         fi
251
252
253         #-----------------------------
254         # Checks for libraries.
255         #-----------------------------
256
257         AC_CHECK_LIB([dl], [dlerror], [],AC_MSG_ERROR(***OpenSRF requires libdl))
258         AC_SEARCH_LIBS([mc_req_free], [memcache], [], AC_MSG_ERROR(***OpenSRF requires memcache headers))
259         AC_CHECK_LIB([ncurses], [initscr], [], AC_MSG_ERROR(***OpenSRF requires ncurses headers))
260         AC_CHECK_LIB([readline], [readline], [], AC_MSG_ERROR(***OpenSRF requires readline headers))
261         AC_CHECK_LIB([xml2], [xmlAddID], [], AC_MSG_ERROR(***OpenSRF requires libxml2 headers))
262
263
264
265         #-----------------------------
266         # Checks for header files.
267         #-----------------------------
268
269         AC_HEADER_STDC
270         AC_HEADER_SYS_WAIT
271         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         #------------------------------------------------------------------
274         # Checks for typedefs, structures, and compiler characteristics.
275         #------------------------------------------------------------------
276
277         AC_C_CONST
278         AC_C_INLINE
279         AC_TYPE_PID_T
280         AC_TYPE_SIZE_T
281         AC_HEADER_TIME
282         AC_STRUCT_TM
283
284         #----------------------------------
285         # Checks for library functions.
286         #----------------------------------
287
288         AC_FUNC_FORK
289         AC_FUNC_MALLOC
290         AC_FUNC_SELECT_ARGTYPES
291         AC_TYPE_SIGNAL
292         AC_FUNC_STRFTIME
293         AC_FUNC_STRTOD
294         AC_FUNC_VPRINTF
295         AC_CHECK_FUNCS([bzero dup2 gethostbyname gethostname gettimeofday memset select socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strtol])
296
297         #------------------------------------
298         # Configuration and output
299         #------------------------------------
300
301         AC_CONFIG_FILES([doc/dokuwiki-doc-stubber.pl
302                          examples/math_xul_client/Makefile
303                          examples/math_bench.pl
304                          examples/math_client.py
305                          examples/multisession-test.pl
306                          src/c-apps/Makefile
307                          src/gateway/Makefile
308                          src/java/Makefile
309                          src/jserver/Makefile
310                          src/libopensrf/Makefile
311                          src/perl/Makefile
312                          src/ports/strn_compat/Makefile
313                          src/python/Makefile
314                          src/router/Makefile
315                          src/srfsh/Makefile
316                          bin/opensrf-perl.pl
317                          bin/osrf_config
318                          bin/osrf_ctl.sh])
319 fi
320
321 AC_OUTPUT
322
323 AC_MSG_RESULT([])
324 AC_MSG_RESULT([--------------------- Configuration options:  -----------------------])
325
326 if test "$OSRF_INSTALL_JAVA" = "true" ; then
327         AC_MSG_RESULT([OSRF install Java support?       yes])
328         AC_MSG_RESULT([Java support files               $OSRF_JAVA_DEPSDIR])
329 else
330         AC_MSG_RESULT([OSRF install Java support?       no])
331 fi
332
333 if test "$OSRF_INSTALL_PYTHON" = "true" ; then
334         AC_MSG_RESULT([OSRF install Python support?     yes])
335 else
336         AC_MSG_RESULT([OSRF install Python support?     no])
337 fi
338
339 if test "$OSRF_INSTALL_CHOPCHOP" = "true" ; then
340         AC_MSG_RESULT([OSRF install chopchop?           yes])
341 else
342         AC_MSG_RESULT([OSRF install chopchop?           no])
343 fi
344
345         AC_MSG_RESULT(Installation directory prefix:   ${prefix})
346         AC_MSG_RESULT(Temporary directory:             ${TMP})
347         AC_MSG_RESULT(APXS2 location:                  ${APXS2})
348         AC_MSG_RESULT(Apache headers location:         ${APACHE2_HEADERS})
349         AC_MSG_RESULT(APR headers location:            ${APR_HEADERS})
350         AC_MSG_RESULT(libxml2 headers location:        ${LIBXML2_HEADERS})
351
352 AC_MSG_RESULT([----------------------------------------------------------------------])