]> git.evergreen-ils.org Git - Evergreen.git/blob - configure.ac
LP1999823: Require a Fixed Version of libopensrf
[Evergreen.git] / configure.ac
1 # Copyright (C) 2008 Equinox Software, Inc.
2 # Kevin Beswick <kevinbeswick00@gmail.com>
3 # Copyright (C) 2010 Laurentian University 
4 # Dan Scott <dscott@laurentian.ca>
5 #
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15
16
17 #---------------------------
18 # Init
19 #---------------------------
20
21 export PATH=${PATH}:/usr/sbin
22 AC_PREREQ(2.61)
23 AC_INIT(Open-ILS, trunk, open-ils-dev@list.georgialibraries.org)
24 AC_CONFIG_SRCDIR([configure.ac])
25 AC_CONFIG_MACRO_DIR([m4])
26 AM_INIT_AUTOMAKE
27 AC_REVISION($Revision: 0.1 $)
28 AC_CONFIG_SUBDIRS([Open-ILS/xul/staff_client/external/libmar])
29 AC_SUBST(prefix)
30 AC_SUBST([abs_top_builddir])
31 #-----------------------------------
32 # Checks for programs.
33 #-----------------------------------
34
35
36 LT_INIT
37 AC_PROG_CC
38 AC_PROG_INSTALL
39 AC_PROG_LN_S
40 AC_PROG_MAKE_SET
41 AC_PROG_MKDIR_P
42 AM_PROG_CC_C_O
43
44 #-----------------------------------
45 # Install options 
46 #-----------------------------------
47
48 # install openils-all?
49 #AC_ARG_ENABLE([openils-all],
50 #[  --enable-openils-all    enables the installation of the default openils system (base system,web,staffclient) ],
51 #[case "${enableval}" in
52 #    yes) openils_all=true;
53 #     openils_core=true;
54 #     openils_web=true;
55 #     openils_updates=true;
56 #     openils_reporter=true;
57 #     openils_client_xul=true;
58 #     openils_server_xul=true ;;
59 #    no)  openils_all=false ;;
60 #  *) AC_MSG_ERROR([please choose another value for --enable-openils-all (supported values are yes or no])
61 #esac],
62 #[openils_all=false])
63
64 # install evergreen-core?
65 AC_ARG_ENABLE([core],
66 [  --disable-core    disables installation of the Evergreen core components ],
67 [case "${enableval}" in
68     yes) openils_core=true ;;
69     no)  openils_core=false ;;
70   *) AC_MSG_ERROR([please choose another value for --disable-core (supported values are yes or no])
71 esac],
72 [openils_core=true])
73
74 AM_CONDITIONAL([BUILDILSCORE], [test x$openils_core = xtrue])
75
76 # install evergreen-web?
77
78 AC_ARG_ENABLE([web],
79 [  --disable-web    disables installation of the Evergreen web modules ],
80 [case "${enableval}" in
81     yes) openils_web=true ;;
82     no)  openils_web=false ;;
83   *) AC_MSG_ERROR([please choose another value for --disable-web (supported values are yes or no])
84 esac],
85 [openils_web=true])
86
87 AM_CONDITIONAL([BUILDILSWEB], [test x$openils_web = xtrue])
88
89 # install evergreen-updates?
90
91 AC_ARG_ENABLE([updates],
92 [  --disable-updates    disables installation of the Evergreen updates folder ],
93 [case "${enableval}" in
94     yes) openils_updates=true ;;
95     no)  openils_updates=false ;;
96   *) AC_MSG_ERROR([please choose another value for --disable-updates (supported values are yes or no])
97 esac],
98 [openils_updates=true])
99
100 AM_CONDITIONAL([BUILDILSUPDATES], [test x$openils_updates = xtrue])
101
102 # Default updates host?
103 AC_ARG_WITH([updateshost],
104 [  --with-updateshost=hostname    default hostname for automatic updates (default is blank)],
105 [AUTOUPDATE_HOST=${withval}],
106 [AUTOUPDATE_HOST=])
107 AC_SUBST([AUTOUPDATE_HOST])
108
109 # Default updates host?
110 AC_ARG_WITH([initialhost],
111 [  --with-initialhost=hostname    default hostname for staff client (default is blank)],
112 [INITIAL_HOST=${withval}],
113 [INITIAL_HOST=])
114 AC_SUBST([INITIAL_HOST])
115
116
117 # install Evergreen Apache modules?
118 AC_ARG_ENABLE([apache-modules],
119 [  --disable-apache-modules    disables installation of the Evergreen Apache modules ],
120 [case "${enableval}" in
121     yes) build_apachemods=true ;;
122     no)  build_apachemods=false ;;
123   *) AC_MSG_ERROR([please choose another value for --disable-apache-modules (supported values are yes or no])
124 esac],
125 [build_apachemods=true])
126
127 AM_CONDITIONAL([BUILDAPACHEMODS], [test x$build_apachemods = xtrue])
128
129 # build evergreen-reporter ?
130
131 AC_ARG_ENABLE([reporter],
132 [  --disable-reporter    disables installation of the Evergreen reporter module ],
133 [case "${enableval}" in
134     yes) openils_reporter=true ;;
135     no)  openils_reporter=false ;;
136   *) AC_MSG_ERROR([please choose another value for --disable-reporter (supported values are yes or no])
137 esac],
138 [openils_reporter=true])
139
140 AM_CONDITIONAL([BUILDILSREPORTER], [test x$openils_reporter = xtrue])
141
142 # build evergreen-client ?
143
144 AC_ARG_ENABLE([client],
145 [  --disable-client    disables installation of the Evergreen staff client ],
146 [case "${enableval}" in
147     yes) openils_client=true ;;
148     no)  openils_client=false ;;
149   *) AC_MSG_ERROR([please choose another value for --disable-client (supported values are yes or no])
150 esac],
151 [openils_client=true])
152
153 AM_CONDITIONAL([BUILDILSCLIENT], [test x$openils_client = xtrue])
154
155
156 #-----------------------------------
157 # Check for dependencies 
158 #-----------------------------------
159 AC_ARG_WITH([tmp],
160 [  --with-tmp=path             location of the Evergreen temporary directory (default is /tmp) ],
161 [TMP=${withval}],
162 [TMP=/tmp])
163 AC_SUBST([TMP])
164
165 AC_ARG_WITH([apxs],
166 [  --with-apxs=path            location of the apxs Apache configuration tool (default is /usr/bin/apxs2)],
167 [APXS2=${withval}],
168 [APXS2=/usr/bin/apxs2])
169
170 # If the passed in value doesn't work, try some reasonable defaults
171 # Fedora puts the file in /usr/sbin/apxs, for example
172 if ! test -x "$APXS2"; then
173     for i in /usr/bin /usr/sbin /usr/local/apache/bin /usr/local/apache2/bin ; do
174         for j in apxs apxs2 ; do
175             if test -x "$i/$j"; then
176                 APXS2="$i/$j"
177                 break
178             fi
179         done
180     done
181 fi
182 AC_SUBST([APXS2])
183
184 AC_ARG_WITH([libxml2],
185 [  --with-libxml2=path         location of the libxml2 headers (default is /usr/include/libxml2)],
186 [LIBXML2_HEADERS=${withval}],
187 [LIBXML2_HEADERS=/usr/include/libxml2/])
188 AC_SUBST([LIBXML2_HEADERS])
189
190 PKG_CHECK_MODULES([DBI], [dbi])
191
192 AC_ARG_WITH([hiredis],
193 [  --with-hiredis=path         location of the hiredis headers (default is /usr/include/hiredis/))],
194 [HIREDIS_HEADERS=${withval}],
195 [HIREDIS_HEADERS=/usr/include/hiredis/])
196 AC_SUBST([HIREDIS_HEADERS])
197
198 AC_ARG_WITH([dbi],
199 [  --with-dbi=path             location of the libdbi driver libraries (default is /usr/lib/x86_64-linux-gnu/dbd/)],
200 [DBI_LIBS=${withval}],
201 [DBI_LIBS=/usr/lib/x86_64-linux-gnu/dbd/])
202
203 AC_ARG_WITH([perlbase],
204 [  --with-perlbase=path        base location to install Perl modules (default based on Config.pm)],
205 [PERL_BASE=${withval}],
206 [PERL_BASE=x])
207 AC_SUBST([PERL_BASE])
208
209 AC_ARG_WITH([redis-accounts],
210 [  --with-redis-accounts=path  location of the redis accounts file (default is $sysconfdir/redis-accounts.txt)],
211 [REDIS_ACCOUNTS=${withval}],
212 [REDIS_ACCOUNTS=$sysconfdir/redis-accounts.txt])
213 AC_SUBST([REDIS_ACCOUNTS])
214
215 OPENSRF_BUS_PASSWORD=$(grep 'ACL SETUSER opensrf on >' ${REDIS_ACCOUNTS} | cut -d'>' -f2)
216 GATEWAY_BUS_PASSWORD=$(grep 'ACL SETUSER gateway on >' ${REDIS_ACCOUNTS} | cut -d'>' -f2)
217 ROUTER_BUS_PASSWORD=$(grep 'ACL SETUSER router on >' ${REDIS_ACCOUNTS} | cut -d'>' -f2)
218
219 AC_SUBST([OPENSRF_BUS_PASSWORD])
220 AC_SUBST([GATEWAY_BUS_PASSWORD])
221 AC_SUBST([ROUTER_BUS_PASSWORD])
222
223 AM_CONDITIONAL(CHECK_TESTS, test x$enable_tests = xyes)
224
225 if test "x$openils_core" = "xtrue"; then
226
227     AC_PATH_PROG([OSRF_CONFIG], [osrf_config])
228     if test "x$OSRF_CONFIG" == "x"; then
229         AC_MSG_ERROR([Could not find osrf_config.
230         Ensure OpenSRF is installed and that the PATH environment variable includes
231         the OpenSRF executables. For example: PATH=\$PATH:/openils/bin ./configure])
232     fi
233
234     AC_ARG_WITH([opensrf-headers],
235     [  --with-opensrf-headers=path location of the OpenSRF header files],
236     [OPENSRF_HEADERS=${withval}],
237     [OPENSRF_HEADERS=`$OSRF_CONFIG --includedir`])
238     AC_SUBST([OPENSRF_HEADERS])
239
240     # We need this for JavaScript
241     AC_ARG_WITH([opensrf-libs],
242     [  --with-opensrf-libs=path    location of the OpenSRF libraries],
243     [OPENSRF_LIBS=${withval}],
244     [OPENSRF_LIBS=`$OSRF_CONFIG --libdir`])
245     AC_SUBST([OPENSRF_LIBS])
246
247     AC_CHECK_PROG([MEMCACHED],memcached,yes,no)
248     if test $MEMCACHED = "no"; then
249         AC_MSG_ERROR([*** memcached not found, aborting])
250     fi
251
252     AC_CHECK_PROG([ASPELL],aspell,yes,no)
253     if test $ASPELL = "no"; then
254         AC_MSG_ERROR([*** aspell not found, aborting])
255     fi
256
257     AC_CHECK_PROG([CPAN],cpan,yes,no)
258     if test $CPAN = "no"; then
259         AC_MSG_ERROR([*** cpan not found, aborting])
260     fi
261
262     PKG_CHECK_MODULES([YAZ],[yaz],[YAZ=yes],[YAZ=no])
263     if test $YAZ = "no"; then
264         AC_MSG_ERROR([*** yaz not found, aborting])
265     fi
266
267     AC_CHECK_PROG([PERL],perl,yes,no)
268     if test $PERL = "no"; then 
269         AC_MSG_ERROR([*** perl not found, aborting])
270     fi
271
272     #------------------------------------
273     # Checks for libraries. 
274     #------------------------------------
275
276     # Check for the rest of the libraries
277
278     #check for dynamic linking functions
279     AC_CHECK_LIB(dl,dlopen)
280
281     #check for the libdbi library
282     AC_CHECK_LIB(dbi,dbi_initialize)
283
284     #to check for the availability and function of a particular
285     #driver we need a runtime check (since the driver is loaded
286     #dynamically). This example checks for the mysql driver
287     AC_MSG_CHECKING([for libdbi pgsql driver (dynamic load)])
288     AC_RUN_IFELSE(
289       [AC_LANG_PROGRAM(,
290         [[dbi_initialize(0); return(dbi_conn_new("pgsql") ? 0 : 1);]])],
291       [AC_MSG_RESULT("yes")],
292       [AC_MSG_FAILURE("pgsql driver not installed?")])
293
294     AC_CHECK_LIB([expat], [main], [], AC_MSG_ERROR(*** OpenILS requires libexpat))
295     AC_CHECK_LIB([ncurses], [main], [], AC_MSG_ERROR(*** OpenILS requires libncurses))
296
297     # IF the OpenSRF libs are installed in a non-standard location, such as
298     # /openils/lib, the compilation test will fail. Support that case.
299     LDFLAGS="-L$OPENSRF_LIBS"
300
301     # checking this specific function name ensures we have a "new enough" libopensrf but isn't actually checking the lib version :-/
302     AC_CHECK_LIB([opensrf], [osrf_buffer_free], [], AC_MSG_ERROR(*** OpenILS requires libopensrf))
303     AC_CHECK_LIB([readline], [main], [], AC_MSG_ERROR(*** OpenILS requires libreadline))
304     AC_CHECK_LIB([xml2], [main], [], AC_MSG_ERROR(*** OpenILS requires libxml2))
305     AC_CHECK_LIB([hiredis], [redisConnect], [], AC_MSG_ERROR(***OpenSRF requires libhiredis))
306     AC_CHECK_LIB([xslt], [main], [], AC_MSG_ERROR(*** OpenILS requires libxslt))
307     AC_CHECK_LIB([pq], [main], [], AC_MSG_ERROR(*** OpenILS requires libpq))
308     PKG_CHECK_MODULES(pcre, libpcre >= 3.0.0)
309
310
311     #------------------------------------
312     # Checks for header files.
313     #------------------------------------
314
315     AC_CHECK_HEADERS([fcntl.h langinfo.h locale.h stdlib.h string.h unistd.h])
316
317     #-------------------------------------------------------------------
318     # Checks for typedefs, structures, and compiler characteristics.
319     #-------------------------------------------------------------------
320
321     AC_C_CONST
322     AC_TYPE_SIZE_T
323     AC_STRUCT_TM
324     AC_HEADER_STDBOOL
325
326     #-------------------------------------------------------------------
327     # Checks for library functions.
328     #-------------------------------------------------------------------
329
330     AC_FUNC_STRFTIME
331     AC_FUNC_STRTOD
332     AC_CHECK_FUNCS([localtime_r memset nl_langinfo setlocale strcasecmp strchr strdup strerror strncasecmp])
333
334     #---------------------------------
335     # Check for unit test framework.
336     #---------------------------------
337     PKG_CHECK_MODULES([CHECK], [check >= 0.9.0], [enable_tests=yes],
338                       [enable_tests=no])
339     if test "x$enable_tests" = "xno"; then
340         AC_MSG_WARN(Check unit testing framework not found.)
341     fi
342
343     #----------------------------
344     # Create Makefiles/Output
345     #----------------------------
346
347     AC_CONFIG_FILES([Open-ILS/examples/Makefile
348              Open-ILS/src/c-apps/Makefile
349              Open-ILS/src/c-apps/tests/Makefile
350              Open-ILS/src/extras/Makefile])
351 fi
352
353 if test "x$build_apachemods" = "xtrue"; then
354
355     #-----------------------------------
356     # Set install path variables 
357     #-----------------------------------
358
359     #APACHE PREFORK DEV TEST
360     AC_MSG_CHECKING([APXS2])
361     if test -x "${APXS2}"; then
362     AC_MSG_RESULT([yes])
363     else
364     AC_MSG_ERROR([*** apxs not found in ${APXS2}, aborting])
365     fi  
366
367     AC_CONFIG_FILES([Open-ILS/src/apachemods/Makefile])
368 fi
369
370 AC_CONFIG_FILES([Makefile
371          Open-ILS/src/Makefile
372          Open-ILS/src/perlmods/Makefile
373          Open-ILS/web/Makefile
374          Open-ILS/updates/Makefile
375          Open-ILS/xul/staff_client/Makefile
376          Open-ILS/src/extras/eg_config
377          ],
378         [
379             if test -e "./Open-ILS/src/extras/eg_config"; then chmod 755 Open-ILS/src/extras/eg_config; fi;
380         ])
381 AC_OUTPUT
382
383 #-------------------------------------------------
384 # OUTPUT STUFF 
385 #-------------------------------------------------
386
387 AC_MSG_RESULT([])
388 AC_MSG_RESULT([--------------------- Configuration options:  -----------------------])
389
390 AC_MSG_RESULT([])
391 AC_MSG_RESULT([-------- Installation Options: --------])
392 if test "$openils_core" = "true" ; then
393     AC_MSG_RESULT([Evergreen Core:          yes])
394 else
395     AC_MSG_RESULT([Evergreen Core:          no])
396 fi
397 if test "$build_apachemods" = "true" ; then
398 AC_MSG_RESULT([Evergreen Apache module:     yes])
399     else
400 AC_MSG_RESULT([Evergreen Apache module:     no])
401     fi
402     if test "$openils_web" = "true" ; then
403 AC_MSG_RESULT([Evergreen Web:               yes])
404     else
405 AC_MSG_RESULT([Evergreen Web:               no])
406     fi
407     if test "$openils_updates" = "true" ; then
408 AC_MSG_RESULT([Evergreen Updates:           yes])
409     else
410 AC_MSG_RESULT([Evergreen Updates:           no])
411     fi
412     if test "$openils_reporter" = "true" ; then
413 AC_MSG_RESULT([Evergreen Reporter:          yes])
414     else
415 AC_MSG_RESULT([Evergreen Reporter:          no])
416     fi
417     if test "$openils_client" = "true" ; then
418 AC_MSG_RESULT([Evergreen Staff Client:      yes])
419     else
420 AC_MSG_RESULT([Evergreen Staff Client:      no])
421     fi
422 AC_MSG_RESULT([]) 
423 AC_MSG_RESULT([-------- Installation Directories --------])
424 AC_MSG_RESULT(Installation directory prefix:            ${prefix})
425 AC_MSG_RESULT(Temporary directory:                      ${TMP})
426 AC_MSG_RESULT(APXS2 location:                           ${APXS2})
427 AC_MSG_RESULT(libxml2 headers location:                 ${LIBXML2_HEADERS})
428 AC_MSG_RESULT(libdbi location:                          ${DBI_LIBS})
429 AC_MSG_RESULT(OpenSRF headers location:                 ${OPENSRF_HEADERS})
430 AC_MSG_RESULT(OpenSRF libraries location:               ${OPENSRF_LIBS})
431 AC_MSG_RESULT(libhiredis headers location:              ${HIREDIS_HEADERS})
432 AC_MSG_RESULT(Redis Accounts: ${REDIS_ACCOUNTS})
433
434 AC_MSG_RESULT([----------------------------------------------------------------------])
435
436 # vim:et:ts=4:sw=4: