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