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