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