]> git.evergreen-ils.org Git - working/Evergreen.git/blob - configure.ac
Beginning of modperl EDI message viewer
[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_PREFIX_DEFAULT([/openils/])
28 AC_SUBST(prefix)
29 AC_SUBST([abs_top_builddir])
30
31 #-----------------------------------
32 # Checks for programs.
33 #-----------------------------------
34
35
36 AC_PROG_LIBTOOL
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 # install Evergreen Apache modules?
110 AC_ARG_ENABLE([apache-modules],
111 [  --disable-apache-modules    disables installation of the Evergreen Apache modules ],
112 [case "${enableval}" in
113     yes) build_apachemods=true ;;
114     no)  build_apachemods=false ;;
115   *) AC_MSG_ERROR([please choose another value for --disable-apache-modules (supported values are yes or no])
116 esac],
117 [build_apachemods=true])
118
119 AM_CONDITIONAL([BUILDAPACHEMODS], [test x$build_apachemods = xtrue])
120
121 # build evergreen-reporter ?
122
123 AC_ARG_ENABLE([reporter],
124 [  --disable-reporter    disables installation of the Evergreen reporter module ],
125 [case "${enableval}" in
126     yes) openils_reporter=true ;;
127     no)  openils_reporter=false ;;
128   *) AC_MSG_ERROR([please choose another value for --disable-reporter (supported values are yes or no])
129 esac],
130 [openils_reporter=true])
131
132 AM_CONDITIONAL([BUILDILSREPORTER], [test x$openils_reporter = xtrue])
133
134 # build evergreen-client ?
135
136 AC_ARG_ENABLE([client],
137 [  --disable-client    disables installation of the Evergreen staff client ],
138 [case "${enableval}" in
139     yes) openils_client=true ;;
140     no)  openils_client=false ;;
141   *) AC_MSG_ERROR([please choose another value for --disable-client (supported values are yes or no])
142 esac],
143 [openils_client=true])
144
145 AM_CONDITIONAL([BUILDILSCLIENT], [test x$openils_client = xtrue])
146
147
148 # build evergreen java ?
149
150 AC_ARG_ENABLE([java],
151 [  --enable-java    enables installation of the Evergreen Java components ],
152 [case "${enableval}" in
153     yes) evergreen_java=true ;;
154     no)  evergreen_java=false ;;
155   *) AC_MSG_ERROR([please choose another value for --enable-java (supported values are yes or no])
156 esac],
157 [evergreen_java=false])
158
159 AM_CONDITIONAL([BUILDEGJAVA], [test x$evergreen_java = xtrue])
160
161
162 # build the evergreen python modules?
163
164 AC_ARG_ENABLE([python],
165 [  --enable-python    enables installation of the Evergreen Python modules ],
166 [case "${enableval}" in
167     yes) EG_PYTHON_INSTALL=true ;;
168     no)  EG_PYTHON_INSTALL=false ;;
169   *) AC_MSG_ERROR([please choose another value for --enable-python (supported values are yes or no)])
170 esac],
171 [EG_PYTHON_INSTALL=false])
172
173 AM_CONDITIONAL([BUILDEGPYTHON], [test x$EG_PYTHON_INSTALL = xtrue])
174
175 #-----------------------------------
176 # Check for dependencies 
177 #-----------------------------------
178
179 AC_ARG_WITH([opensrf-headers],
180 [  --with-opensrf-headers=path location of the OpenSRF header files (default is /openils/include/)],
181 [OPENSRF_HEADERS=${withval}],
182 [OPENSRF_HEADERS=/openils/include/])
183 AC_SUBST([OPENSRF_HEADERS])
184
185 # We need this for JavaScript
186 AC_ARG_WITH([opensrf-libs],
187 [  --with-opensrf-libs=path    location of the OpenSRF libraries (default is /openils/lib/)],
188 [OPENSRF_LIBS=${withval}],
189 [OPENSRF_LIBS=/openils/lib/])
190 AC_SUBST([OPENSRF_LIBS])
191
192 AC_ARG_WITH([tmp],
193 [  --with-tmp=path             location of the Evergreen temporary directory (default is /tmp) ],
194 [TMP=${withval}],
195 [TMP=/tmp])
196 AC_SUBST([TMP])
197
198 AC_ARG_WITH([apxs],
199 [  --with-apxs=path            location of the apxs Apache configuration tool (default is /usr/bin/apxs2)],
200 [APXS2=${withval}],
201 [APXS2=/usr/bin/apxs2])
202
203 # If the passed in value doesn't work, try some reasonable defaults
204 # Fedora puts the file in /usr/sbin/apxs, for example
205 if ! test -x "$APXS2"; then
206         for i in /usr/bin /usr/sbin /usr/local/apache/bin /usr/local/apache2/bin ; do
207                 for j in apxs apxs2 ; do
208                         if test -x "$i/$j"; then
209                                 APXS2="$i/$j"
210                                 break
211                         fi
212                 done
213         done
214 fi
215 AC_SUBST([APXS2])
216
217 AC_ARG_WITH([apache],
218 [  --with-apache=path          location of the Apache headers (default is /usr/include/apache2)],
219 [APACHE2_HEADERS=${withval}],
220 [APACHE2_HEADERS=/usr/include/apache2])
221 AC_SUBST([APACHE2_HEADERS])
222
223 AC_ARG_WITH([apr],
224 [  --with-apr=path             location of the Apache Portable Runtime (APR) headers (default is /usr/include/apr-1.0/)],
225 [APR_HEADERS=${withval}],
226 [APR_HEADERS=/usr/include/apr-1.0])
227 AC_SUBST([APR_HEADERS])
228
229 AC_ARG_WITH([libxml2],
230 [  --with-libxml2=path         location of the libxml2 headers (default is /usr/include/libxml2)],
231 [LIBXML2_HEADERS=${withval}],
232 [LIBXML2_HEADERS=/usr/include/libxml2/])
233 AC_SUBST([LIBXML2_HEADERS])
234
235 AC_ARG_WITH([dbi],
236 [  --with-dbi=path             location of the libdbi driver libraries (default is /usr/local/lib/dbd)],
237 [DBI_LIBS=${withval}],
238 [DBI_LIBS=/usr/local/lib/dbd/])
239
240 # If the passed in value doesn't work, fall back to reasonable defaults
241 # Distributions are starting to package a good version of libdbi / libdbd
242 if ! test -d "$DBI_LIBS"; then
243         for i in /usr/lib/dbd/ /usr/lib64/dbd /usr/local/lib/dbd/ ; do
244                 if test -d "$i"; then
245                         DBI_LIBS="$i"
246                         break
247                 fi
248         done
249 fi
250 AC_SUBST([DBI_LIBS])
251
252 if test "x$openils_core" = "xtrue"; then
253
254         AC_CHECK_PROG([MEMCACHED],memcached,yes,no)
255         if test $MEMCACHED = "no"; then
256                 AC_MSG_ERROR([*** memcached not found, aborting])
257         fi
258
259         AC_CHECK_PROG([ASPELL],aspell,yes,no)
260         if test $ASPELL = "no"; then
261                 AC_MSG_ERROR([*** aspell not found, aborting])
262         fi
263
264         AC_CHECK_PROG([CPAN],cpan,yes,no)
265         if test $CPAN = "no"; then
266                 AC_MSG_ERROR([*** cpan not found, aborting])
267         fi
268
269         AC_CHECK_PROG([YAZ],yaz-config,yes,no)
270         if test $YAZ = "no"; then
271                 AC_MSG_ERROR([*** yaz not found, aborting])
272         fi
273
274         AC_CHECK_PROG([PERL],perl,yes,no)
275         if test $PERL = "no"; then 
276                 AC_MSG_ERROR([*** perl not found, aborting])
277         fi
278
279         #------------------------------------
280         # Checks for libraries. 
281         #------------------------------------
282
283         # Check for the existence of libraries in non-standard locations
284
285         AC_MSG_CHECKING(for -lopensrf)
286         if test -e ${OPENSRF_LIBS}/libopensrf.so; then
287         AC_MSG_RESULT([yes])
288         else
289         AC_MSG_ERROR([*** libopensrf not found (or not in location specified to configure), aborting])
290         fi
291
292         # Check for the rest of the libraries
293
294         #check for dynamic linking functions
295         AC_CHECK_LIB(dl,dlopen)
296
297         #check for the libdbi library
298         AC_CHECK_LIB(dbi,dbi_initialize)
299
300         #to check for the availability and function of a particular
301         #driver we need a runtime check (since the driver is loaded
302         #dynamically). This example checks for the mysql driver
303         AC_MSG_CHECKING([for libdbi pgsql driver (dynamic load)])
304         AC_RUN_IFELSE(
305           [AC_LANG_PROGRAM(,
306             [[dbi_initialize(0); return(dbi_conn_new("pgsql") ? 0 : 1);]])],
307           [AC_MSG_RESULT("yes")],
308           [AC_MSG_FAILURE("pgsql driver not installed?")])
309
310         AC_CHECK_LIB([expat], [main], [], AC_MSG_ERROR(*** OpenILS requires libexpat))
311         AC_CHECK_LIB([ncurses], [main], [], AC_MSG_ERROR(*** OpenILS requires libncurses))
312         AC_CHECK_LIB([readline], [main], [], AC_MSG_ERROR(*** OpenILS requires libreadline))
313         AC_CHECK_LIB([xml2], [main], [], AC_MSG_ERROR(*** OpenILS requires libxml2))
314         AC_CHECK_LIB([xslt], [main], [], AC_MSG_ERROR(*** OpenILS requires libxslt))
315 #       AC_CHECK_LIB([perl], [main], [], AC_MSG_ERROR(*** OpenILS requires libperl-dev))
316         AC_CHECK_LIB([pq], [main], [], AC_MSG_ERROR(*** OpenILS requires libpq))
317
318
319         #------------------------------------
320         # Checks for header files.
321         #------------------------------------
322
323         AC_HEADER_STDC
324         AC_CHECK_HEADERS([fcntl.h langinfo.h locale.h stdlib.h string.h unistd.h])
325
326         #-------------------------------------------------------------------
327         # Checks for typedefs, structures, and compiler characteristics.
328         #-------------------------------------------------------------------
329
330         AC_C_CONST
331         AC_TYPE_SIZE_T
332         AC_STRUCT_TM
333         AC_HEADER_STDBOOL
334
335         #-------------------------------------------------------------------
336         # Checks for library functions.
337         #-------------------------------------------------------------------
338
339         AC_FUNC_STRFTIME
340         AC_FUNC_STRTOD
341         AC_CHECK_FUNCS([localtime_r memset nl_langinfo setlocale strcasecmp strchr strdup strerror strncasecmp])
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/extras/Makefile
350                          Open-ILS/src/java/Makefile
351                          Open-ILS/src/python/Makefile])
352 fi
353
354 if test "x$build_apachemods" = "xtrue"; then
355
356         #-----------------------------------
357         # Set install path variables 
358         #-----------------------------------
359
360         #APACHE PREFORK DEV TEST
361         AC_MSG_CHECKING([APXS2])
362         if test -x "${APXS2}"; then
363         AC_MSG_RESULT([yes])
364         else
365         AC_MSG_ERROR([*** apxs not found in ${APXS2}, aborting])
366         fi  
367
368         AC_CONFIG_FILES([Open-ILS/src/apachemods/Makefile])
369 fi
370
371 AC_CONFIG_FILES([Makefile
372                  Open-ILS/src/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                  Open-ILS/src/extras/fast-extract],
378                 [
379                         if test -e "./Open-ILS/src/extras/eg_config"; then chmod 755 Open-ILS/src/extras/eg_config; fi;
380                         if test -e "./Open-ILS/src/extras/fast-extract"; then chmod 755 Open-ILS/src/extras/fast-extract; fi;
381                 ])
382 AC_OUTPUT
383
384 #-------------------------------------------------
385 # OUTPUT STUFF 
386 #-------------------------------------------------
387
388 AC_MSG_RESULT([])
389 AC_MSG_RESULT([--------------------- Configuration options:  -----------------------])
390
391 AC_MSG_RESULT([])
392 AC_MSG_RESULT([-------- Installation Options: --------])
393 if test "$openils_core" = "true" ; then
394         AC_MSG_RESULT([Evergreen Core:                  yes])
395 else
396         AC_MSG_RESULT([Evergreen Core:                  no])
397 fi
398 if test "$build_apachemods" = "true" ; then
399         AC_MSG_RESULT([Evergreen Apache module: yes])
400 else
401         AC_MSG_RESULT([Evergreen Apache module: no])
402 fi
403 if test "$openils_web" = "true" ; then
404         AC_MSG_RESULT([Evergreen Web:                   yes])
405 else
406         AC_MSG_RESULT([Evergreen Web:                   no])
407 fi
408 if test "$openils_updates" = "true" ; then
409         AC_MSG_RESULT([Evergreen Updates:               yes])
410 else
411         AC_MSG_RESULT([Evergreen Updates:               no])
412 fi
413 if test "$openils_reporter" = "true" ; then
414         AC_MSG_RESULT([Evergreen Reporter:              yes])
415 else
416         AC_MSG_RESULT([Evergreen Reporter:              no])
417 fi
418 if test "$openils_client" = "true" ; then
419         AC_MSG_RESULT([Evergreen Staff Client:          yes])
420 else
421         AC_MSG_RESULT([Evergreen Staff Client:          no])
422 fi
423 if test "$EG_PYTHON_INSTALL" = "true" ; then
424         AC_MSG_RESULT([Evergreen Python Components:     yes])
425 else
426         AC_MSG_RESULT([Evergreen Python Components:     no])
427 fi
428 if test "$evergreen_java" = "true" ; then
429         AC_MSG_RESULT([Evergreen Java Components:       yes])
430 else
431         AC_MSG_RESULT([Evergreen Java Components:       no])
432 fi
433 AC_MSG_RESULT([]) 
434 AC_MSG_RESULT([-------- Installation Directories --------])
435 AC_MSG_RESULT(Installation directory prefix:            ${prefix})
436 AC_MSG_RESULT(Temporary directory:                      ${TMP})
437 AC_MSG_RESULT(APXS2 location:                           ${APXS2})
438 AC_MSG_RESULT(Apache headers location:                  ${APACHE2_HEADERS})
439 AC_MSG_RESULT(APR headers location:                     ${APR_HEADERS})
440 AC_MSG_RESULT(libxml2 headers location:                 ${LIBXML2_HEADERS})
441 AC_MSG_RESULT(libdbi location:                          ${DBI_LIBS})
442 AC_MSG_RESULT(OpenSRF headers location:                 ${OPENSRF_HEADERS})
443 AC_MSG_RESULT(OpenSRF libraries location:               ${OPENSRF_LIBS})
444
445 AC_MSG_RESULT([----------------------------------------------------------------------])
446