]> git.evergreen-ils.org Git - working/Evergreen.git/blob - configure.ac
01bcf66aefeb583bb4323c74cf5a36cdb0bb052f
[working/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
178 # If the passed in value doesn't work, try some reasonable defaults
179 # Fedora puts the file in /usr/sbin/apxs, for example
180 if ! test -x "$APXS2"; then
181         for i in /usr/bin /usr/sbin /usr/local/apache/bin /usr/local/apache2/bin ; do
182                 for j in apxs apxs2 ; do
183                         if test -x "$i/$j"; then
184                                 APXS2="$i/$j"
185                                 break
186                         fi
187                 done
188         done
189 fi
190 AC_SUBST([APXS2])
191
192 AC_ARG_WITH([apache],
193 [  --with-apache=path          location of the Apache headers (default is /usr/include/apache2)],
194 [APACHE2_HEADERS=${withval}],
195 [APACHE2_HEADERS=/usr/include/apache2])
196 AC_SUBST([APACHE2_HEADERS])
197
198 AC_ARG_WITH([apr],
199 [  --with-apr=path             location of the Apache Portable Runtime (APR) headers (default is /usr/include/apr-1.0/)],
200 [APR_HEADERS=${withval}],
201 [APR_HEADERS=/usr/include/apr-1.0])
202 AC_SUBST([APR_HEADERS])
203
204 AC_ARG_WITH([libxml2],
205 [  --with-libxml2=path         location of the libxml2 headers (default is /usr/include/libxml2)],
206 [LIBXML2_HEADERS=${withval}],
207 [LIBXML2_HEADERS=/usr/include/libxml2/])
208 AC_SUBST([LIBXML2_HEADERS])
209
210 AC_ARG_WITH([dbi],
211 [  --with-dbi=path             location of the libdbi driver libraries (default is /usr/local/lib/dbd)],
212 [DBI_LIBS=${withval}],
213 [DBI_LIBS=/usr/local/lib/dbd/])
214
215 # If the passed in value doesn't work, fall back to reasonable defaults
216 # Distributions are starting to package a good version of libdbi / libdbd
217 if ! test -d "$DBI_LIBS"; then
218         for i in /usr/lib/dbd/ /usr/local/lib/dbd/ ; do
219                 if test -d "$i"; then
220                         DBI_LIBS="$i"
221                         break
222                 fi
223         done
224 fi
225 AC_SUBST([DBI_LIBS])
226
227 if test "x$openils_core" = "xtrue"; then
228
229         AC_CHECK_PROG([MEMCACHED],memcached,yes,no)
230         if test $MEMCACHED = "no"; then
231                 AC_MSG_ERROR([*** memcached not found, aborting])
232         fi
233
234         AC_CHECK_PROG([ASPELL],aspell,yes,no)
235         if test $ASPELL = "no"; then
236                 AC_MSG_ERROR([*** aspell not found, aborting])
237         fi
238
239         AC_CHECK_PROG([CPAN],cpan,yes,no)
240         if test $CPAN = "no"; then
241                 AC_MSG_ERROR([*** cpan not found, aborting])
242         fi
243
244         AC_CHECK_PROG([YAZ],yaz-config,yes,no)
245         if test $YAZ = "no"; then
246                 AC_MSG_ERROR([*** yaz not found, aborting])
247         fi
248
249         AC_CHECK_PROG([PERL],perl,yes,no)
250         if test $PERL = "no"; then 
251                 AC_MSG_ERROR([*** perl not found, aborting])
252         fi
253
254         #------------------------------------
255         # Checks for libraries. 
256         #------------------------------------
257
258         # Check for the existence of libraries in non-standard locations
259
260         AC_MSG_CHECKING(for -lopensrf)
261         if test -e ${OPENSRF_LIBS}/libopensrf.so; then
262         AC_MSG_RESULT([yes])
263         else
264         AC_MSG_ERROR([*** libopensrf not found (or not in location specified to configure), aborting])
265         fi
266
267         # Check for the rest of the libraries
268
269         #check for dynamic linking functions
270         AC_CHECK_LIB(dl,dlopen)
271
272         #check for the libdbi library
273         AC_CHECK_LIB(dbi,dbi_initialize)
274
275         #to check for the availability and function of a particular
276         #driver we need a runtime check (since the driver is loaded
277         #dynamically). This example checks for the mysql driver
278         AC_MSG_CHECKING([for libdbi pgsql driver (dynamic load)])
279         AC_RUN_IFELSE(
280           [AC_LANG_PROGRAM(,
281             [[dbi_initialize(0); return(dbi_conn_new("pgsql") ? 0 : 1);]])],
282           [AC_MSG_RESULT("yes")],
283           [AC_MSG_FAILURE("pgsql driver not installed?")])
284
285         AC_CHECK_LIB([expat], [main], [], AC_MSG_ERROR(*** OpenILS requires libexpat))
286         AC_CHECK_LIB([readline], [main], [], AC_MSG_ERROR(*** OpenILS requires libreadline))
287         AC_CHECK_LIB([xml2], [main], [], AC_MSG_ERROR(*** OpenILS requires libxml2))
288         AC_CHECK_LIB([xslt], [main], [], AC_MSG_ERROR(*** OpenILS requires libxslt))
289         AC_CHECK_LIB([perl], [main], [], AC_MSG_ERROR(*** OpenILS requires libperl-dev))
290         AC_CHECK_LIB([pq], [main], [], AC_MSG_ERROR(*** OpenILS requires libpq))
291
292
293         #------------------------------------
294         # Checks for header files.
295         #------------------------------------
296
297         AC_HEADER_STDC
298         AC_CHECK_HEADERS([fcntl.h langinfo.h locale.h stdlib.h string.h unistd.h])
299
300         #-------------------------------------------------------------------
301         # Checks for typedefs, structures, and compiler characteristics.
302         #-------------------------------------------------------------------
303
304         AC_C_CONST
305         AC_TYPE_SIZE_T
306         AC_STRUCT_TM
307         AC_HEADER_STDBOOL
308
309         #-------------------------------------------------------------------
310         # Checks for library functions.
311         #-------------------------------------------------------------------
312
313         AC_FUNC_STRFTIME
314         AC_FUNC_STRTOD
315         AC_CHECK_FUNCS([localtime_r memset nl_langinfo setlocale strcasecmp strchr strdup strerror strncasecmp])
316
317         #----------------------------
318         # Create Makefiles/Output
319         #----------------------------
320
321         AC_CONFIG_FILES([Open-ILS/examples/Makefile
322                          Open-ILS/src/c-apps/Makefile
323                          Open-ILS/src/extras/Makefile
324                          Open-ILS/src/java/Makefile
325                          Open-ILS/src/python/Makefile])
326 fi
327
328 if test "x$build_apachemods" = "xtrue"; then
329
330         #-----------------------------------
331         # Set install path variables 
332         #-----------------------------------
333
334         #APACHE PREFORK DEV TEST
335         AC_MSG_CHECKING([APXS2])
336         if test -x "${APXS2}"; then
337         AC_MSG_RESULT([yes])
338         else
339         AC_MSG_ERROR([*** apxs not found in ${APXS2}, aborting])
340         fi  
341
342         AC_CONFIG_FILES([Open-ILS/src/apachemods/Makefile])
343 fi
344
345 AC_CONFIG_FILES([Makefile
346                  Open-ILS/src/Makefile
347                  Open-ILS/web/Makefile
348                  Open-ILS/xul/staff_client/Makefile
349                  Open-ILS/src/extras/eg_config
350                  Open-ILS/src/extras/fast-extract],
351                 [
352                         if test -e "./Open-ILS/src/extras/eg_config"; then chmod 755 Open-ILS/src/extras/eg_config; fi;
353                         if test -e "./Open-ILS/src/extras/fast-extract"; then chmod 755 Open-ILS/src/extras/fast-extract; fi;
354                 ])
355 AC_OUTPUT
356
357 #-------------------------------------------------
358 # OUTPUT STUFF 
359 #-------------------------------------------------
360
361 AC_MSG_RESULT([])
362 AC_MSG_RESULT([--------------------- Configuration options:  -----------------------])
363
364 AC_MSG_RESULT([])
365 AC_MSG_RESULT([-------- Installation Options: --------])
366 if test "$openils_core" = "true" ; then
367         AC_MSG_RESULT([Evergreen Core:                  yes])
368 else
369         AC_MSG_RESULT([Evergreen Core:                  no])
370 fi
371 if test "$build_apachemods" = "true" ; then
372         AC_MSG_RESULT([Evergreen Apache module: yes])
373 else
374         AC_MSG_RESULT([Evergreen Apache module: no])
375 fi
376 if test "$openils_web" = "true" ; then
377         AC_MSG_RESULT([Evergreen Web:                   yes])
378 else
379         AC_MSG_RESULT([Evergreen Web:                   no])
380 fi
381 if test "$openils_reporter" = "true" ; then
382         AC_MSG_RESULT([Evergreen Reporter:              yes])
383 else
384         AC_MSG_RESULT([Evergreen Reporter:              no])
385 fi
386 if test "$openils_client" = "true" ; then
387         AC_MSG_RESULT([Evergreen Staff Client:          yes])
388 else
389         AC_MSG_RESULT([Evergreen Staff Client:          no])
390 fi
391 if test "$EG_PYTHON_INSTALL" = "true" ; then
392         AC_MSG_RESULT([Evergreen Python Components:     yes])
393 else
394         AC_MSG_RESULT([Evergreen Python Components:     no])
395 fi
396 if test "$evergreen_java" = "true" ; then
397         AC_MSG_RESULT([Evergreen Java Components:       yes])
398 else
399         AC_MSG_RESULT([Evergreen Java Components:       no])
400 fi
401 AC_MSG_RESULT([]) 
402 AC_MSG_RESULT([-------- Installation Directories --------])
403 AC_MSG_RESULT(Installation directory prefix:            ${prefix})
404 AC_MSG_RESULT(Temporary directory:                      ${TMP})
405 AC_MSG_RESULT(APXS2 location:                           ${APXS2})
406 AC_MSG_RESULT(Apache headers location:                  ${APACHE2_HEADERS})
407 AC_MSG_RESULT(APR headers location:                     ${APR_HEADERS})
408 AC_MSG_RESULT(libxml2 headers location:                 ${LIBXML2_HEADERS})
409 AC_MSG_RESULT(libdbi location:                          ${DBI_LIBS})
410 AC_MSG_RESULT(OpenSRF headers location:                 ${OPENSRF_HEADERS})
411 AC_MSG_RESULT(OpenSRF libraries location:               ${OPENSRF_LIBS})
412
413 AC_MSG_RESULT([----------------------------------------------------------------------])
414