]> git.evergreen-ils.org Git - OpenSRF.git/blob - configure.ac
Corrected a glitch in the command-line parser. Now commas
[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 chopchop, the basic XMPP server
112
113 AC_ARG_ENABLE([chopchop],
114 [  --enable-chopchop    build and install chopchop, a basic XMPP server],
115 [case "${enableval}" in
116     yes) OSRF_INSTALL_CHOPCHOP=true ;;
117     no) OSRF_INSTALL_CHOPCHOP=false ;; 
118   *) AC_MSG_ERROR([please choose another value for --enable-chopchop (supported values are yes or no)]) ;;
119 esac],
120 [OSRF_INSTALL_CHOPCHOP=false])
121
122 AM_CONDITIONAL([BUILDCHOPCHOP], [test x$OSRF_INSTALL_CHOPCHOP = xtrue])
123 AC_SUBST([OSRF_INSTALL_CHOPCHOP])
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], [/opt/java])
139 fi
140
141 #--------------------------------
142 # Checks for programs.
143 #--------------------------------
144
145 AC_PROG_LIBTOOL
146 AC_PROG_AWK
147 AC_PROG_CC
148 AC_PROG_INSTALL
149 AC_PROG_MAKE_SET
150
151 #------------------------------
152 # Set install path variables
153 #------------------------------
154 AC_ARG_WITH([tmp],
155 [  --with-tmp=path                  location for the temporary directory for OpenSRF (default is /tmp)],
156 [TMP=${withval}],
157 [TMP=/tmp])
158 AC_SUBST([TMP])
159
160 AC_ARG_WITH([apxs],
161 [  --with-apxs=path                 location of the apxs (Apache extension) tool (default is /usr/bin/apxs2)],
162 [APXS2=${withval}],
163 [APXS2=/usr/bin/apxs2])
164 AC_SUBST([APXS2])
165
166 AC_ARG_WITH([apache],
167 [  --with-apache=path               location of the Apache headers (default is /usr/include/apache2)],
168 [APACHE2_HEADERS=${withval}],
169 [APACHE2_HEADERS=/usr/include/apache2])
170 AC_SUBST([APACHE2_HEADERS])
171
172 AC_ARG_WITH([apr],
173 [  --with-apr=path                  location of the Apache Portable Runtime headers (default is /usr/include/apr-1.0/)],
174 [APR_HEADERS=${withval}],
175 [APR_HEADERS=/usr/include/apr-1.0])
176 AC_SUBST([APR_HEADERS])
177
178 AC_ARG_WITH([libxml],
179 [  --with-libxml=path               location of the libxml2 headers (default is /usr/include/libxml2/))],
180 [LIBXML2_HEADERS=${withval}],
181 [LIBXML2_HEADERS=/usr/include/libxml2/])
182 AC_SUBST([LIBXML2_HEADERS])
183
184 AC_ARG_WITH([includes],
185 [  --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)],
186 [EXTRA_USER_INCLUDES=${withval}])
187
188 AC_ARG_WITH([libraries],
189 [  --with-libraries=DIRECTORIES     a colon-separated list of directories to search for libraries (Example: --with-libraries=/lib:/usr/lib)],
190 [EXTRA_USER_LIBRARIES=${withval}])
191
192 # Change these lists to proper compiler/linker options
193
194 IFSBAK=${IFS}
195 IFS="${IFS}:"
196
197 for dir in $EXTRA_USER_INCLUDES; do
198         if test -d "$dir"; then
199           INCLUDES="$INCLUDES -I$dir"
200         else
201           AC_MSG_WARN([*** Include directory $dir does not exist.])
202         fi
203 done
204 AC_SUBST(INCLUDES)
205
206 for dir in $EXTRA_USER_LIBRARIES; do
207         if test -d "$dir"; then
208           LIBDIRS="$LIBDIRS -L$dir"
209         else
210           AC_MSG_WARN([*** Library directory $dir does not exist.])
211         fi
212 done
213 AC_SUBST(LIBDIRS)
214
215 IFS=${IFSBAK}
216
217 AC_CONFIG_FILES([Makefile
218         src/Makefile])
219
220 if test "x$OSRF_INSTALL_CORE" = "xtrue"; then
221         #--------------------------------
222         # Check for dependencies.
223         #--------------------------------
224
225         #APACHE PREFORK DEV TEST
226         AC_MSG_CHECKING([APXS])
227         if test -f "${APXS2}"; then
228         AC_MSG_RESULT([yes])
229         else
230         AC_MSG_ERROR([*** apxs not found, aborting])
231         fi  
232
233         #PYTHON TESTS
234         if test x$OSRF_INSTALL_PYTHON = xtrue; then
235                 AC_CHECK_PROG([HAVE_PYTHON],python,yes,no)
236                 if test $HAVE_PYTHON = "no"; then
237                         AC_MSG_ERROR([*** python not found, aborting])
238                 fi
239                 AC_PYTHON_MOD([setuptools])
240         fi
241
242
243         #-----------------------------
244         # Checks for libraries.
245         #-----------------------------
246
247         AC_CHECK_LIB([dl], [dlerror], [],AC_MSG_ERROR(***OpenSRF requires libdl))
248         AC_SEARCH_LIBS([mc_req_free], [memcache], [], AC_MSG_ERROR(***OpenSRF requires memcache headers))
249         AC_CHECK_LIB([ncurses], [initscr], [], AC_MSG_ERROR(***OpenSRF requires ncurses headers))
250         AC_CHECK_LIB([readline], [readline], [], AC_MSG_ERROR(***OpenSRF requires readline headers))
251         AC_CHECK_LIB([xml2], [xmlAddID], [], AC_MSG_ERROR(***OpenSRF requires libxml2 headers))
252
253
254
255         #-----------------------------
256         # Checks for header files.
257         #-----------------------------
258
259         AC_HEADER_STDC
260         AC_HEADER_SYS_WAIT
261         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])
262
263         #------------------------------------------------------------------
264         # Checks for typedefs, structures, and compiler characteristics.
265         #------------------------------------------------------------------
266
267         AC_C_CONST
268         AC_C_INLINE
269         AC_TYPE_PID_T
270         AC_TYPE_SIZE_T
271         AC_HEADER_TIME
272         AC_STRUCT_TM
273
274         #----------------------------------
275         # Checks for library functions.
276         #----------------------------------
277
278         AC_FUNC_FORK
279         AC_FUNC_MALLOC
280         AC_FUNC_SELECT_ARGTYPES
281         AC_TYPE_SIGNAL
282         AC_FUNC_STRFTIME
283         AC_FUNC_STRTOD
284         AC_FUNC_VPRINTF
285         AC_CHECK_FUNCS([bzero dup2 gethostbyname gethostname gettimeofday memset select socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strtol])
286
287         #------------------------------------
288         # Configuration and output
289         #------------------------------------
290
291         AC_CONFIG_FILES([doc/dokuwiki-doc-stubber.pl
292                          examples/math_xul_client/Makefile
293                          examples/math_bench.pl
294                          examples/math_client.py
295                          examples/multisession-test.pl
296                          src/c-apps/Makefile
297                          src/gateway/Makefile
298                          src/java/Makefile
299                          src/jserver/Makefile
300                          src/libopensrf/Makefile
301                          src/perl/Makefile
302                          src/ports/strn_compat/Makefile
303                          src/python/Makefile
304                          src/router/Makefile
305                          src/srfsh/Makefile
306                          bin/opensrf-perl.pl
307                          bin/osrf_config
308                          bin/osrf_ctl.sh])
309 fi
310
311 AC_OUTPUT
312
313 AC_MSG_RESULT([])
314 AC_MSG_RESULT([--------------------- Configuration options:  -----------------------])
315
316 if test "$OSRF_INSTALL_JAVA" = "true" ; then
317         AC_MSG_RESULT([OSRF install Java support?       yes])
318         AC_MSG_RESULT([Java support files               $OSRF_JAVA_DEPSDIR])
319 else
320         AC_MSG_RESULT([OSRF install Java support?       no])
321 fi
322
323 if test "$OSRF_INSTALL_PYTHON" = "true" ; then
324         AC_MSG_RESULT([OSRF install Python support?     yes])
325 else
326         AC_MSG_RESULT([OSRF install Python support?     no])
327 fi
328
329 if test "$OSRF_INSTALL_CHOPCHOP" = "true" ; then
330         AC_MSG_RESULT([OSRF install chopchop?           yes])
331 else
332         AC_MSG_RESULT([OSRF install chopchop?           no])
333 fi
334
335         AC_MSG_RESULT(Installation directory prefix:   ${prefix})
336         AC_MSG_RESULT(Temporary directory:             ${TMP})
337         AC_MSG_RESULT(APXS2 location:                  ${APXS2})
338         AC_MSG_RESULT(Apache headers location:         ${APACHE2_HEADERS})
339         AC_MSG_RESULT(APR headers location:            ${APR_HEADERS})
340         AC_MSG_RESULT(libxml2 headers location:        ${LIBXML2_HEADERS})
341
342 AC_MSG_RESULT([----------------------------------------------------------------------])