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