]> git.evergreen-ils.org Git - OpenSRF.git/blob - configure.ac
Partial fix for launchpad bug 489294: OpenSRF seems to depend on explicit --prefix...
[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 # 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
34 fi
35
36 # Perl and Python scripts don't want ${prefix} if no value was specified
37 eval "eval CONF_DIR=$sysconfdir"
38 AC_SUBST([CONF_DIR])
39
40 AC_SUBST(prefix)
41 AC_SUBST(bindir)
42
43
44 AC_DEFUN([AC_PYTHON_MOD],[
45     if test -z $PYTHON;
46     then
47         PYTHON="python"
48     fi
49     AC_MSG_CHECKING($PYTHON_NAME module: $1)
50         $PYTHON -c "import $1" 2>/dev/null
51         if test $? -eq 0;
52         then
53                 AC_MSG_RESULT(yes)
54                 eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
55         else
56                 AC_MSG_ERROR(failed to find required module $1)
57                 exit 1
58         fi
59 ])
60
61
62
63 #-------------------------------
64 # Installation options
65 #-------------------------------
66
67 # build and install the java libs?
68 AC_ARG_ENABLE([java],
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)]) ;;
74 esac],
75 [OSRF_INSTALL_JAVA=false])
76
77 AM_CONDITIONAL([BUILDJAVA], [test x$OSRF_INSTALL_JAVA = xtrue])
78 AC_SUBST([OSRF_INSTALL_JAVA])
79
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)]) ;;
87 esac],
88 [OSRF_INSTALL_JAVASCRIPT=true])
89
90 AM_CONDITIONAL([INSTALLJAVASCRIPT], [test x$OSRF_INSTALL_JAVASCRIPT = xtrue])
91 AC_SUBST([OSRF_INSTALL_JAVASCRIPT])
92
93 # install the OpenSRF core files?
94 AC_ARG_ENABLE([core],
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)]) ;;
100 esac],
101 [OSRF_INSTALL_CORE=true])
102
103 AM_CONDITIONAL([BUILDCORE], [test x$OSRF_INSTALL_CORE = xtrue])
104 AC_SUBST([OSRF_INSTALL_CORE])
105
106
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)]) ;;
114 esac],
115 [OSRF_INSTALL_PYTHON=false])
116
117 AM_CONDITIONAL([BUILDPYTHON], [test x$OSRF_INSTALL_PYTHON = xtrue])
118 AC_SUBST([OSRF_INSTALL_PYTHON])
119
120 # enable chopchop, the basic XMPP server
121
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)]) ;;
128 esac],
129 [OSRF_INSTALL_CHOPCHOP=false])
130
131 AM_CONDITIONAL([BUILDCHOPCHOP], [test x$OSRF_INSTALL_CHOPCHOP = xtrue])
132 AC_SUBST([OSRF_INSTALL_CHOPCHOP])
133
134 # enable debug?
135
136 AC_ARG_ENABLE(debug,
137 [  --enable-debug    Turn on debugging],
138 [case "${enableval}" in
139   yes) debug=true ;;
140   no)  debug=false ;;
141   *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
142 esac],[debug=false])
143 AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
144  
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])
148 fi
149
150 #--------------------------------
151 # Checks for programs.
152 #--------------------------------
153
154 AC_PROG_LIBTOOL
155 AC_PROG_AWK
156 AC_PROG_CC
157 AC_PROG_INSTALL
158 AC_PROG_MAKE_SET
159
160 #------------------------------
161 # Set install path variables
162 #------------------------------
163 AC_ARG_WITH([tmp],
164 [  --with-tmp=path                  location for the temporary directory for OpenSRF (default is /tmp)],
165 [TMP=${withval}],
166 [TMP=/tmp])
167 AC_SUBST([TMP])
168
169 AC_ARG_WITH([apxs],
170 [  --with-apxs=path                 location of the apxs (Apache extension) tool (default is /usr/bin/apxs2)],
171 [APXS2=${withval}],
172 [APXS2=/usr/bin/apxs2])
173 AC_SUBST([APXS2])
174
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])
180
181 AC_ARG_WITH([apr],
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])
186
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])
192
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}])
196
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}])
200
201 # Change these lists to proper compiler/linker options
202
203 IFSBAK=${IFS}
204 IFS="${IFS}:"
205
206 for dir in $EXTRA_USER_INCLUDES; do
207         if test -d "$dir"; then
208           INCLUDES="$INCLUDES -I$dir"
209         else
210           AC_MSG_WARN([*** Include directory $dir does not exist.])
211         fi
212 done
213 AC_SUBST(INCLUDES)
214
215 for dir in $EXTRA_USER_LIBRARIES; do
216         if test -d "$dir"; then
217           LIBDIRS="$LIBDIRS -L$dir"
218         else
219           AC_MSG_WARN([*** Library directory $dir does not exist.])
220         fi
221 done
222 AC_SUBST(LIBDIRS)
223
224 IFS=${IFSBAK}
225
226 AC_CONFIG_FILES([Makefile
227         src/Makefile])
228
229 if test "x$OSRF_INSTALL_CORE" = "xtrue"; then
230         #--------------------------------
231         # Check for dependencies.
232         #--------------------------------
233
234         #APACHE PREFORK DEV TEST
235         AC_MSG_CHECKING([APXS])
236         if test -f "${APXS2}"; then
237         AC_MSG_RESULT([yes])
238         else
239         AC_MSG_ERROR([*** apxs not found, aborting])
240         fi  
241
242         #PYTHON TESTS
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])
247                 fi
248                 AC_PYTHON_MOD([setuptools])
249         fi
250
251
252         #-----------------------------
253         # Checks for libraries.
254         #-----------------------------
255
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))
261
262
263
264         #-----------------------------
265         # Checks for header files.
266         #-----------------------------
267
268         AC_HEADER_STDC
269         AC_HEADER_SYS_WAIT
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])
271
272         #------------------------------------------------------------------
273         # Checks for typedefs, structures, and compiler characteristics.
274         #------------------------------------------------------------------
275
276         AC_C_CONST
277         AC_C_INLINE
278         AC_TYPE_PID_T
279         AC_TYPE_SIZE_T
280         AC_HEADER_TIME
281         AC_STRUCT_TM
282
283         #----------------------------------
284         # Checks for library functions.
285         #----------------------------------
286
287         AC_FUNC_FORK
288         AC_FUNC_MALLOC
289         AC_FUNC_SELECT_ARGTYPES
290         AC_TYPE_SIGNAL
291         AC_FUNC_STRFTIME
292         AC_FUNC_STRTOD
293         AC_FUNC_VPRINTF
294         AC_CHECK_FUNCS([bzero dup2 gethostbyname gethostname gettimeofday memset select socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strtol])
295
296         #------------------------------------
297         # Configuration and output
298         #------------------------------------
299
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
305                          src/c-apps/Makefile
306                          src/gateway/Makefile
307                          src/java/Makefile
308                          src/jserver/Makefile
309                          src/libopensrf/Makefile
310                          src/perl/Makefile
311                          src/ports/strn_compat/Makefile
312                          src/python/Makefile
313                          src/router/Makefile
314                          src/srfsh/Makefile
315                          bin/opensrf-perl.pl
316                          bin/osrf_config
317                          bin/osrf_ctl.sh])
318 fi
319
320 AC_OUTPUT
321
322 AC_MSG_RESULT([])
323 AC_MSG_RESULT([--------------------- Configuration options:  -----------------------])
324
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])
328 else
329         AC_MSG_RESULT([OSRF install Java support?       no])
330 fi
331
332 if test "$OSRF_INSTALL_PYTHON" = "true" ; then
333         AC_MSG_RESULT([OSRF install Python support?     yes])
334 else
335         AC_MSG_RESULT([OSRF install Python support?     no])
336 fi
337
338 if test "$OSRF_INSTALL_CHOPCHOP" = "true" ; then
339         AC_MSG_RESULT([OSRF install chopchop?           yes])
340 else
341         AC_MSG_RESULT([OSRF install chopchop?           no])
342 fi
343
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})
350
351 AC_MSG_RESULT([----------------------------------------------------------------------])