]> git.evergreen-ils.org Git - Evergreen.git/blob - configure.ac
Make building & installing the core components of Evergreen optional.
[Evergreen.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
15 #---------------------------
16 # Init
17 #---------------------------
18
19 export PATH=${PATH}:/usr/sbin
20 AC_PREREQ(2.59)
21 AC_INIT(Open-ILS, trunk, open-ils-dev@list.georgialibraries.org)
22 AM_INIT_AUTOMAKE([OpenILS], [trunk])
23 AC_REVISION($Revision: 0.1 $)
24 AC_CONFIG_SRCDIR([configure.ac])
25 AC_PREFIX_DEFAULT([/openils/])
26 AC_SUBST(prefix)
27 AC_SUBST([abs_top_builddir])
28
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
40 #-----------------------------------
41 # Install options 
42 #-----------------------------------
43
44 # install openils-all?
45 #AC_ARG_ENABLE([openils-all],
46 #[  --enable-openils-all    enables the installation of the default openils system (base system,web,staffclient) ],
47 #[case "${enableval}" in
48 #    yes) openils_all=true;
49 #        openils_core=true;
50 #        openils_web=true;
51 #        openils_reporter=true;
52 #        openils_client_xul=true;
53 #        openils_server_xul=true ;;
54 #    no)  openils_all=false ;;
55 #  *) AC_MSG_ERROR([please choose another value for --enable-openils-all (supported values are yes or no])
56 #esac],
57 #[openils_all=false])
58
59 # install evergreen-core?
60 AC_ARG_ENABLE([core],
61 [  --disable-core    disables installation of the Evergreen core components ],
62 [case "${enableval}" in
63     yes) openils_core=true ;;
64     no)  openils_core=false ;;
65   *) AC_MSG_ERROR([please choose another value for --disable-core (supported values are yes or no])
66 esac],
67 [openils_core=true])
68
69 AM_CONDITIONAL([BUILDILSCORE], [test x$openils_core = xtrue])
70
71 # install evergreen-web?
72
73 AC_ARG_ENABLE([web],
74 [  --disable-web    disables installation of the Evergreen web modules ],
75 [case "${enableval}" in
76     yes) openils_web=true ;;
77     no)  openils_web=false ;;
78   *) AC_MSG_ERROR([please choose another value for --disable-web (supported values are yes or no])
79 esac],
80 [openils_web=true])
81
82 AM_CONDITIONAL([BUILDILSWEB], [test x$openils_web = xtrue])
83
84 # install Evergreen Apache modules?
85 AC_ARG_ENABLE([apache-modules],
86 [  --disable-apache-modules    disables installation of the Evergreen Apache modules ],
87 [case "${enableval}" in
88     yes) build_apachemods=true ;;
89     no)  build_apachemods=false ;;
90   *) AC_MSG_ERROR([please choose another value for --disable-apache-modules (supported values are yes or no])
91 esac],
92 [build_apachemods=true])
93
94 AM_CONDITIONAL([BUILDAPACHEMODS], [test x$build_apachemods = xtrue])
95
96 # build evergreen-reporter ?
97
98 AC_ARG_ENABLE([reporter],
99 [  --disable-reporter    disables installation of the Evergreen reporter module ],
100 [case "${enableval}" in
101     yes) openils_reporter=true ;;
102     no)  openils_reporter=false ;;
103   *) AC_MSG_ERROR([please choose another value for --disable-reporter (supported values are yes or no])
104 esac],
105 [openils_reporter=true])
106
107 AM_CONDITIONAL([BUILDILSREPORTER], [test x$openils_reporter = xtrue])
108
109 # build evergreen-client ?
110
111 AC_ARG_ENABLE([client],
112 [  --disable-client    disables installation of the Evergreen staff client ],
113 [case "${enableval}" in
114     yes) openils_client=true ;;
115     no)  openils_client=false ;;
116   *) AC_MSG_ERROR([please choose another value for --disable-client (supported values are yes or no])
117 esac],
118 [openils_client=true])
119
120 AM_CONDITIONAL([BUILDILSCLIENT], [test x$openils_client = xtrue])
121
122
123 # build evergreen java ?
124
125 AC_ARG_ENABLE([java],
126 [  --enable-java    enables installation of the Evergreen Java components ],
127 [case "${enableval}" in
128     yes) evergreen_java=true ;;
129     no)  evergreen_java=false ;;
130   *) AC_MSG_ERROR([please choose another value for --enable-java (supported values are yes or no])
131 esac],
132 [evergreen_java=false])
133
134 AM_CONDITIONAL([BUILDEGJAVA], [test x$evergreen_java = xtrue])
135
136
137 # build the evergreen python modules?
138
139 AC_ARG_ENABLE([python],
140 [  --enable-python    enables installation of the Evergreen Python modules ],
141 [case "${enableval}" in
142     yes) EG_PYTHON_INSTALL=true ;;
143     no)  EG_PYTHON_INSTALL=false ;;
144   *) AC_MSG_ERROR([please choose another value for --enable-python (supported values are yes or no)])
145 esac],
146 [EG_PYTHON_INSTALL=false])
147
148 AM_CONDITIONAL([BUILDEGPYTHON], [test x$EG_PYTHON_INSTALL = xtrue])
149
150 #-----------------------------------
151 # Check for dependencies 
152 #-----------------------------------
153
154 AC_ARG_WITH([opensrf-headers],
155 [  --with-opensrf-headers=path location of the OpenSRF header files (default is /openils/include/)],
156 [OPENSRF_HEADERS=${withval}],
157 [OPENSRF_HEADERS=/openils/include/])
158 AC_SUBST([OPENSRF_HEADERS])
159
160 # We need this for JavaScript
161 AC_ARG_WITH([opensrf-libs],
162 [  --with-opensrf-libs=path    location of the OpenSRF libraries (default is /openils/lib/)],
163 [OPENSRF_LIBS=${withval}],
164 [OPENSRF_LIBS=/openils/lib/])
165 AC_SUBST([OPENSRF_LIBS])
166
167 AC_ARG_WITH([tmp],
168 [  --with-tmp=path             location of the Evergreen temporary directory (default is /tmp) ],
169 [TMP=${withval}],
170 [TMP=/tmp])
171 AC_SUBST([TMP])
172
173 AC_ARG_WITH([apxs],
174 [  --with-apxs=path            location of the apxs Apache configuration tool (default is /usr/bin/apxs2)],
175 [APXS2=${withval}],
176 [APXS2=/usr/bin/apxs2])
177 AC_SUBST([APXS2])
178
179 AC_ARG_WITH([apache],
180 [  --with-apache=path          location of the Apache headers (default is /usr/include/apache2)],
181 [APACHE2_HEADERS=${withval}],
182 [APACHE2_HEADERS=/usr/include/apache2])
183 AC_SUBST([APACHE2_HEADERS])
184
185 AC_ARG_WITH([apr],
186 [  --with-apr=path             location of the Apache Portable Runtime (APR) headers (default is /usr/include/apr-1.0/)],
187 [APR_HEADERS=${withval}],
188 [APR_HEADERS=/usr/include/apr-1.0])
189 AC_SUBST([APR_HEADERS])
190
191 AC_ARG_WITH([libxml2],
192 [  --with-libxml2=path         location of the libxml2 headers (default is /usr/include/libxml2)],
193 [LIBXML2_HEADERS=${withval}],
194 [LIBXML2_HEADERS=/usr/include/libxml2/])
195 AC_SUBST([LIBXML2_HEADERS])
196
197 AC_ARG_WITH([dbi],
198 [  --with-dbi=path             location of the libdbi libraries (default is /usr/local/lib/dbd)],
199 [DBI_LIBS=${withval}],
200 [DBI_LIBS=/usr/local/lib/dbd/])
201 AC_SUBST([DBI_LIBS])
202
203 if test "x$openils_core" = "xtrue"; then
204
205         AC_CHECK_PROG([MEMCACHED],memcached,yes,no)
206         if test $MEMCACHED = "no"; then
207                 AC_MSG_ERROR([*** memcached not found, aborting])
208         fi
209
210         AC_CHECK_PROG([ASPELL],aspell,yes,no)
211         if test $ASPELL = "no"; then
212                 AC_MSG_ERROR([*** aspell not found, aborting])
213         fi
214
215         AC_CHECK_PROG([CPAN],cpan,yes,no)
216         if test $CPAN = "no"; then
217                 AC_MSG_ERROR([*** cpan not found, aborting])
218         fi
219
220         AC_CHECK_PROG([YAZ],yaz-config,yes,no)
221         if test $YAZ = "no"; then
222                 AC_MSG_ERROR([*** yaz not found, aborting])
223         fi
224
225         AC_CHECK_PROG([PERL],perl,yes,no)
226         if test $PERL = "no"; then 
227                 AC_MSG_ERROR([*** perl not found, aborting])
228         fi
229
230         #------------------------------------
231         # Checks for libraries. 
232         #------------------------------------
233
234         # Check for the existence of libraries in non-standard locations
235
236         AC_MSG_CHECKING(for -lopensrf)
237         if test -e ${OPENSRF_LIBS}/libopensrf.so; then
238         AC_MSG_RESULT([yes])
239         else
240         AC_MSG_ERROR([*** libopensrf not found (or not in location specified to configure), aborting])
241         fi
242
243         # Check for the rest of the libraries
244
245         #check for dynamic linking functions
246         AC_CHECK_LIB(dl,dlopen)
247
248         #check for the libdbi library
249         AC_CHECK_LIB(dbi,dbi_initialize)
250
251         #to check for the availability and function of a particular
252         #driver we need a runtime check (since the driver is loaded
253         #dynamically). This example checks for the mysql driver
254         AC_MSG_CHECKING([for libdbi pgsql driver (dynamic load)])
255         AC_RUN_IFELSE(
256           [AC_LANG_PROGRAM(,
257             [[dbi_initialize(0); return(dbi_conn_new("pgsql") ? 0 : 1);]])],
258           [AC_MSG_RESULT("yes")],
259           [AC_MSG_FAILURE("pgsql driver not installed?")])
260
261         AC_CHECK_LIB([expat], [main], [], AC_MSG_ERROR(*** OpenILS requires libexpat))
262         AC_CHECK_LIB([readline], [main], [], AC_MSG_ERROR(*** OpenILS requires libreadline))
263         AC_CHECK_LIB([xml2], [main], [], AC_MSG_ERROR(*** OpenILS requires libxml2))
264         AC_CHECK_LIB([xslt], [main], [], AC_MSG_ERROR(*** OpenILS requires libxslt))
265         AC_CHECK_LIB([perl], [main], [], AC_MSG_ERROR(*** OpenILS requires libperl-dev))
266         AC_CHECK_LIB([pq], [main], [], AC_MSG_ERROR(*** OpenILS requires libpq))
267
268
269         #------------------------------------
270         # Checks for header files.
271         #------------------------------------
272
273         AC_HEADER_STDC
274         AC_CHECK_HEADERS([fcntl.h langinfo.h locale.h stdlib.h string.h unistd.h])
275
276         #-------------------------------------------------------------------
277         # Checks for typedefs, structures, and compiler characteristics.
278         #-------------------------------------------------------------------
279
280         AC_C_CONST
281         AC_TYPE_SIZE_T
282         AC_STRUCT_TM
283         AC_HEADER_STDBOOL
284
285         #-------------------------------------------------------------------
286         # Checks for library functions.
287         #-------------------------------------------------------------------
288
289         AC_FUNC_STRFTIME
290         AC_FUNC_STRTOD
291         AC_CHECK_FUNCS([localtime_r memset nl_langinfo setlocale strcasecmp strchr strdup strerror strncasecmp])
292
293         #----------------------------
294         # Create Makefiles/Output
295         #----------------------------
296
297         AC_CONFIG_FILES([Open-ILS/examples/Makefile
298                          Open-ILS/src/c-apps/Makefile
299                          Open-ILS/src/extras/Makefile
300                          Open-ILS/src/java/Makefile
301                          Open-ILS/src/python/Makefile])
302 fi
303
304 if test "x$build_apachemods" = "xtrue"; then
305
306         #-----------------------------------
307         # Set install path variables 
308         #-----------------------------------
309
310         #APACHE PREFORK DEV TEST
311         AC_MSG_CHECKING([APXS2])
312         if test -x "${APXS2}"; then
313         AC_MSG_RESULT([yes])
314         else
315         AC_MSG_ERROR([*** apxs not found, aborting])
316         fi  
317
318         AC_CONFIG_FILES([Open-ILS/src/apachemods/Makefile])
319 fi
320
321 AC_CONFIG_FILES([Makefile
322                  Open-ILS/src/Makefile
323                  Open-ILS/web/Makefile
324                  Open-ILS/xul/staff_client/Makefile
325                  Open-ILS/src/extras/eg_config],  [if test -e "./Open-ILS/src/extras/eg_config"; then chmod 755 Open-ILS/src/extras/eg_config; fi])
326 AC_OUTPUT
327
328 #-------------------------------------------------
329 # OUTPUT STUFF 
330 #-------------------------------------------------
331
332 AC_MSG_RESULT([])
333 AC_MSG_RESULT([--------------------- Configuration options:  -----------------------])
334
335 AC_MSG_RESULT([])
336 AC_MSG_RESULT([-------- Installation Options: --------])
337 if test "$openils_core" = "true" ; then
338         AC_MSG_RESULT([Evergreen Core:                  yes])
339 else
340         AC_MSG_RESULT([Evergreen Core:                  no])
341 fi
342 if test "$build_apachemods" = "true" ; then
343         AC_MSG_RESULT([Evergreen Apache module: yes])
344 else
345         AC_MSG_RESULT([Evergreen Apache module: no])
346 fi
347 if test "$openils_web" = "true" ; then
348         AC_MSG_RESULT([Evergreen Web:                   yes])
349 else
350         AC_MSG_RESULT([Evergreen Web:                   no])
351 fi
352 if test "$openils_reporter" = "true" ; then
353         AC_MSG_RESULT([Evergreen Reporter:              yes])
354 else
355         AC_MSG_RESULT([Evergreen Reporter:              no])
356 fi
357 if test "$openils_client" = "true" ; then
358         AC_MSG_RESULT([Evergreen Staff Client:          yes])
359 else
360         AC_MSG_RESULT([Evergreen Staff Client:          no])
361 fi
362 if test "$EG_PYTHON_INSTALL" = "true" ; then
363         AC_MSG_RESULT([Evergreen Python Components:     yes])
364 else
365         AC_MSG_RESULT([Evergreen Python Components:     no])
366 fi
367 if test "$evergreen_java" = "true" ; then
368         AC_MSG_RESULT([Evergreen Java Components:       yes])
369 else
370         AC_MSG_RESULT([Evergreen Java Components:       no])
371 fi
372 AC_MSG_RESULT([]) 
373 AC_MSG_RESULT([-------- Installation Directories --------])
374 AC_MSG_RESULT(Installation directory prefix:            ${prefix})
375 AC_MSG_RESULT(Temporary directory:                      ${TMP})
376 AC_MSG_RESULT(APXS2 location:                           ${APXS2})
377 AC_MSG_RESULT(Apache headers location:                  ${APACHE2_HEADERS})
378 AC_MSG_RESULT(APR headers location:                     ${APR_HEADERS})
379 AC_MSG_RESULT(libxml2 headers location:                 ${LIBXML2_HEADERS})
380 AC_MSG_RESULT(libdbi location:                          ${DBI_LIBS})
381 AC_MSG_RESULT(OpenSRF headers location:                 ${OPENSRF_HEADERS})
382 AC_MSG_RESULT(OpenSRF libraries location:               ${OPENSRF_LIBS})
383
384 AC_MSG_RESULT([----------------------------------------------------------------------])
385