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