]> git.evergreen-ils.org Git - working/Evergreen.git/blob - configure.ac
LP#1136084: drop silent dependency on 'bsdmainutils' Debian/Ubuntu package
[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_SUBST(prefix)
28 AC_SUBST([abs_top_builddir])
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 AM_PROG_CC_C_O
41
42 #-----------------------------------
43 # Install options 
44 #-----------------------------------
45
46 # install openils-all?
47 #AC_ARG_ENABLE([openils-all],
48 #[  --enable-openils-all    enables the installation of the default openils system (base system,web,staffclient) ],
49 #[case "${enableval}" in
50 #    yes) openils_all=true;
51 #     openils_core=true;
52 #     openils_web=true;
53 #     openils_updates=true;
54 #     openils_reporter=true;
55 #     openils_client_xul=true;
56 #     openils_server_xul=true ;;
57 #    no)  openils_all=false ;;
58 #  *) AC_MSG_ERROR([please choose another value for --enable-openils-all (supported values are yes or no])
59 #esac],
60 #[openils_all=false])
61
62 # install evergreen-core?
63 AC_ARG_ENABLE([core],
64 [  --disable-core    disables installation of the Evergreen core components ],
65 [case "${enableval}" in
66     yes) openils_core=true ;;
67     no)  openils_core=false ;;
68   *) AC_MSG_ERROR([please choose another value for --disable-core (supported values are yes or no])
69 esac],
70 [openils_core=true])
71
72 AM_CONDITIONAL([BUILDILSCORE], [test x$openils_core = xtrue])
73
74 # install evergreen-web?
75
76 AC_ARG_ENABLE([web],
77 [  --disable-web    disables installation of the Evergreen web modules ],
78 [case "${enableval}" in
79     yes) openils_web=true ;;
80     no)  openils_web=false ;;
81   *) AC_MSG_ERROR([please choose another value for --disable-web (supported values are yes or no])
82 esac],
83 [openils_web=true])
84
85 AM_CONDITIONAL([BUILDILSWEB], [test x$openils_web = xtrue])
86
87 # install evergreen-updates?
88
89 AC_ARG_ENABLE([updates],
90 [  --disable-updates    disables installation of the Evergreen updates folder ],
91 [case "${enableval}" in
92     yes) openils_updates=true ;;
93     no)  openils_updates=false ;;
94   *) AC_MSG_ERROR([please choose another value for --disable-updates (supported values are yes or no])
95 esac],
96 [openils_updates=true])
97
98 AM_CONDITIONAL([BUILDILSUPDATES], [test x$openils_updates = xtrue])
99
100 # Default updates host?
101 AC_ARG_WITH([updateshost],
102 [  --with-updateshost=hostname    default hostname for automatic updates (default is blank)],
103 [AUTOUPDATE_HOST=${withval}],
104 [AUTOUPDATE_HOST=])
105 AC_SUBST([AUTOUPDATE_HOST])
106
107 # Default updates host?
108 AC_ARG_WITH([initialhost],
109 [  --with-initialhost=hostname    default hostname for staff client (default is blank)],
110 [INITIAL_HOST=${withval}],
111 [INITIAL_HOST=])
112 AC_SUBST([INITIAL_HOST])
113
114
115 # install Evergreen Apache modules?
116 AC_ARG_ENABLE([apache-modules],
117 [  --disable-apache-modules    disables installation of the Evergreen Apache modules ],
118 [case "${enableval}" in
119     yes) build_apachemods=true ;;
120     no)  build_apachemods=false ;;
121   *) AC_MSG_ERROR([please choose another value for --disable-apache-modules (supported values are yes or no])
122 esac],
123 [build_apachemods=true])
124
125 AM_CONDITIONAL([BUILDAPACHEMODS], [test x$build_apachemods = xtrue])
126
127 # build evergreen-reporter ?
128
129 AC_ARG_ENABLE([reporter],
130 [  --disable-reporter    disables installation of the Evergreen reporter module ],
131 [case "${enableval}" in
132     yes) openils_reporter=true ;;
133     no)  openils_reporter=false ;;
134   *) AC_MSG_ERROR([please choose another value for --disable-reporter (supported values are yes or no])
135 esac],
136 [openils_reporter=true])
137
138 AM_CONDITIONAL([BUILDILSREPORTER], [test x$openils_reporter = xtrue])
139
140 # build evergreen-client ?
141
142 AC_ARG_ENABLE([client],
143 [  --disable-client    disables installation of the Evergreen staff client ],
144 [case "${enableval}" in
145     yes) openils_client=true ;;
146     no)  openils_client=false ;;
147   *) AC_MSG_ERROR([please choose another value for --disable-client (supported values are yes or no])
148 esac],
149 [openils_client=true])
150
151 AM_CONDITIONAL([BUILDILSCLIENT], [test x$openils_client = xtrue])
152
153
154 # build evergreen java ?
155
156 AC_ARG_ENABLE([java],
157 [  --enable-java    enables installation of the Evergreen Java components ],
158 [case "${enableval}" in
159     yes) evergreen_java=true ;;
160     no)  evergreen_java=false ;;
161   *) AC_MSG_ERROR([please choose another value for --enable-java (supported values are yes or no])
162 esac],
163 [evergreen_java=false])
164
165 AM_CONDITIONAL([BUILDEGJAVA], [test x$evergreen_java = xtrue])
166
167
168 # build the evergreen python modules?
169
170 AC_ARG_ENABLE([python],
171 [  --enable-python    enables installation of the Evergreen Python modules ],
172 [case "${enableval}" in
173     yes) EG_PYTHON_INSTALL=true ;;
174     no)  EG_PYTHON_INSTALL=false ;;
175   *) AC_MSG_ERROR([please choose another value for --enable-python (supported values are yes or no)])
176 esac],
177 [EG_PYTHON_INSTALL=false])
178
179 AM_CONDITIONAL([BUILDEGPYTHON], [test x$EG_PYTHON_INSTALL = xtrue])
180
181 #-----------------------------------
182 # Check for dependencies 
183 #-----------------------------------
184 AC_PATH_PROG([OSRF_CONFIG], [osrf_config])
185 if test "x$OSRF_CONFIG" == "x"; then
186     AC_MSG_ERROR([Could not find osrf_config.
187     Ensure OpenSRF is installed and that the PATH environment variable includes
188     the OpenSRF executables. For example: PATH=\$PATH:/openils/bin ./configure])
189 fi
190
191 AC_ARG_WITH([opensrf-headers],
192 [  --with-opensrf-headers=path location of the OpenSRF header files],
193 [OPENSRF_HEADERS=${withval}],
194 [OPENSRF_HEADERS=`$OSRF_CONFIG --includedir`])
195 AC_SUBST([OPENSRF_HEADERS])
196
197 # We need this for JavaScript
198 AC_ARG_WITH([opensrf-libs],
199 [  --with-opensrf-libs=path    location of the OpenSRF libraries],
200 [OPENSRF_LIBS=${withval}],
201 [OPENSRF_LIBS=`$OSRF_CONFIG --libdir`])
202 AC_SUBST([OPENSRF_LIBS])
203
204 AC_ARG_WITH([tmp],
205 [  --with-tmp=path             location of the Evergreen temporary directory (default is /tmp) ],
206 [TMP=${withval}],
207 [TMP=/tmp])
208 AC_SUBST([TMP])
209
210 AC_ARG_WITH([apxs],
211 [  --with-apxs=path            location of the apxs Apache configuration tool (default is /usr/bin/apxs2)],
212 [APXS2=${withval}],
213 [APXS2=/usr/bin/apxs2])
214
215 # If the passed in value doesn't work, try some reasonable defaults
216 # Fedora puts the file in /usr/sbin/apxs, for example
217 if ! test -x "$APXS2"; then
218     for i in /usr/bin /usr/sbin /usr/local/apache/bin /usr/local/apache2/bin ; do
219         for j in apxs apxs2 ; do
220             if test -x "$i/$j"; then
221                 APXS2="$i/$j"
222                 break
223             fi
224         done
225     done
226 fi
227 AC_SUBST([APXS2])
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 rest of the libraries
284
285     #check for dynamic linking functions
286     AC_CHECK_LIB(dl,dlopen)
287
288     #check for the libdbi library
289     AC_CHECK_LIB(dbi,dbi_initialize)
290
291     #to check for the availability and function of a particular
292     #driver we need a runtime check (since the driver is loaded
293     #dynamically). This example checks for the mysql driver
294     AC_MSG_CHECKING([for libdbi pgsql driver (dynamic load)])
295     AC_RUN_IFELSE(
296       [AC_LANG_PROGRAM(,
297         [[dbi_initialize(0); return(dbi_conn_new("pgsql") ? 0 : 1);]])],
298       [AC_MSG_RESULT("yes")],
299       [AC_MSG_FAILURE("pgsql driver not installed?")])
300
301     AC_CHECK_LIB([expat], [main], [], AC_MSG_ERROR(*** OpenILS requires libexpat))
302     AC_CHECK_LIB([ncurses], [main], [], AC_MSG_ERROR(*** OpenILS requires libncurses))
303
304     # IF the OpenSRF libs are installed in a non-standard location, such as
305     # /openils/lib, the compilation test will fail. Support that case.
306     LDFLAGS="-L$OPENSRF_LIBS"
307
308     AC_CHECK_LIB([opensrf], [osrfMessageFree], [], AC_MSG_ERROR(*** OpenILS requires libopensrf))
309     AC_CHECK_LIB([readline], [main], [], AC_MSG_ERROR(*** OpenILS requires libreadline))
310     AC_CHECK_LIB([xml2], [main], [], AC_MSG_ERROR(*** OpenILS requires libxml2))
311     AC_CHECK_LIB([xslt], [main], [], AC_MSG_ERROR(*** OpenILS requires libxslt))
312     AC_CHECK_LIB([pq], [main], [], AC_MSG_ERROR(*** OpenILS requires libpq))
313
314     #------------------------------------
315     # Checks for header files.
316     #------------------------------------
317
318     AC_HEADER_STDC
319     AC_CHECK_HEADERS([fcntl.h langinfo.h locale.h stdlib.h string.h unistd.h])
320
321     #-------------------------------------------------------------------
322     # Checks for typedefs, structures, and compiler characteristics.
323     #-------------------------------------------------------------------
324
325     AC_C_CONST
326     AC_TYPE_SIZE_T
327     AC_STRUCT_TM
328     AC_HEADER_STDBOOL
329
330     #-------------------------------------------------------------------
331     # Checks for library functions.
332     #-------------------------------------------------------------------
333
334     AC_FUNC_STRFTIME
335     AC_FUNC_STRTOD
336     AC_CHECK_FUNCS([localtime_r memset nl_langinfo setlocale strcasecmp strchr strdup strerror strncasecmp])
337
338     #----------------------------
339     # Create Makefiles/Output
340     #----------------------------
341
342     AC_CONFIG_FILES([Open-ILS/examples/Makefile
343              Open-ILS/src/c-apps/Makefile
344              Open-ILS/src/extras/Makefile
345              Open-ILS/src/java/Makefile
346              Open-ILS/src/python/Makefile])
347 fi
348
349 if test "x$build_apachemods" = "xtrue"; then
350
351     #-----------------------------------
352     # Set install path variables 
353     #-----------------------------------
354
355     #APACHE PREFORK DEV TEST
356     AC_MSG_CHECKING([APXS2])
357     if test -x "${APXS2}"; then
358     AC_MSG_RESULT([yes])
359     else
360     AC_MSG_ERROR([*** apxs not found in ${APXS2}, aborting])
361     fi  
362
363     AC_CONFIG_FILES([Open-ILS/src/apachemods/Makefile])
364 fi
365
366 AC_CONFIG_FILES([Makefile
367          Open-ILS/src/Makefile
368          Open-ILS/src/perlmods/Makefile
369          Open-ILS/web/Makefile
370          Open-ILS/updates/Makefile
371          Open-ILS/xul/staff_client/Makefile
372          Open-ILS/src/extras/eg_config
373          ],
374         [
375             if test -e "./Open-ILS/src/extras/eg_config"; then chmod 755 Open-ILS/src/extras/eg_config; fi;
376         ])
377 AC_OUTPUT
378
379 #-------------------------------------------------
380 # OUTPUT STUFF 
381 #-------------------------------------------------
382
383 AC_MSG_RESULT([])
384 AC_MSG_RESULT([--------------------- Configuration options:  -----------------------])
385
386 AC_MSG_RESULT([])
387 AC_MSG_RESULT([-------- Installation Options: --------])
388 if test "$openils_core" = "true" ; then
389     AC_MSG_RESULT([Evergreen Core:          yes])
390 else
391     AC_MSG_RESULT([Evergreen Core:          no])
392 fi
393 if test "$build_apachemods" = "true" ; then
394 AC_MSG_RESULT([Evergreen Apache module:     yes])
395     else
396 AC_MSG_RESULT([Evergreen Apache module:     no])
397     fi
398     if test "$openils_web" = "true" ; then
399 AC_MSG_RESULT([Evergreen Web:               yes])
400     else
401 AC_MSG_RESULT([Evergreen Web:               no])
402     fi
403     if test "$openils_updates" = "true" ; then
404 AC_MSG_RESULT([Evergreen Updates:           yes])
405     else
406 AC_MSG_RESULT([Evergreen Updates:           no])
407     fi
408     if test "$openils_reporter" = "true" ; then
409 AC_MSG_RESULT([Evergreen Reporter:          yes])
410     else
411 AC_MSG_RESULT([Evergreen Reporter:          no])
412     fi
413     if test "$openils_client" = "true" ; then
414 AC_MSG_RESULT([Evergreen Staff Client:      yes])
415     else
416 AC_MSG_RESULT([Evergreen Staff Client:      no])
417     fi
418     if test "$EG_PYTHON_INSTALL" = "true" ; then
419 AC_MSG_RESULT([Evergreen Python Components: yes])
420     else
421 AC_MSG_RESULT([Evergreen Python Components: no])
422     fi
423     if test "$evergreen_java" = "true" ; then
424 AC_MSG_RESULT([Evergreen Java Components:   yes])
425     else
426 AC_MSG_RESULT([Evergreen Java Components:   no])
427 fi
428 AC_MSG_RESULT([]) 
429 AC_MSG_RESULT([-------- Installation Directories --------])
430 AC_MSG_RESULT(Installation directory prefix:            ${prefix})
431 AC_MSG_RESULT(Temporary directory:                      ${TMP})
432 AC_MSG_RESULT(APXS2 location:                           ${APXS2})
433 AC_MSG_RESULT(libxml2 headers location:                 ${LIBXML2_HEADERS})
434 AC_MSG_RESULT(libdbi location:                          ${DBI_LIBS})
435 AC_MSG_RESULT(OpenSRF headers location:                 ${OPENSRF_HEADERS})
436 AC_MSG_RESULT(OpenSRF libraries location:               ${OPENSRF_LIBS})
437
438 AC_MSG_RESULT([----------------------------------------------------------------------])
439
440 # vim:et:ts=4:sw=4: