]> git.evergreen-ils.org Git - OpenSRF.git/blob - configure.ac
Merge the following patches from Kevin Beswick:
[OpenSRF.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 # Process this file with autoconf to produce a configure script.
15
16
17 #-------------------------------
18 # Initialization
19 #-------------------------------
20
21 export PATH=${PATH}:/usr/sbin
22 AC_PREREQ(2.59)
23 AC_INIT([OpenSRF],[trunk],[open-ils-dev@list.georgialibraries.org])
24 AM_INIT_AUTOMAKE([OpenSRF], [trunk])
25 AC_REVISION($Revision: 0.1 $)
26 AC_CONFIG_SRCDIR([configure.ac])
27 AC_PREFIX_DEFAULT([/opensrf/])
28
29
30 AC_SUBST(prefix)
31 AC_SUBST(sysconfdir)
32
33
34 AC_DEFUN([AC_PYTHON_MOD],[
35     if test -z $PYTHON;
36     then
37         PYTHON="python"
38     fi
39     AC_MSG_CHECKING($PYTHON_NAME module: $1)
40         $PYTHON -c "import $1" 2>/dev/null
41         if test $? -eq 0;
42         then
43                 AC_MSG_RESULT(yes)
44                 eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
45         else
46                 AC_MSG_ERROR(failed to find required module $1)
47                 exit 1
48         fi
49 ])
50
51
52
53 #-------------------------------
54 # Installation options
55 #-------------------------------
56
57 # build and install the java libs?
58 AC_ARG_ENABLE([java],
59 [  --enable-java    enable building and installing the java libraries],
60 [case "${enableval}" in
61     yes) OSRF_INSTALL_JAVA=true ;;
62     no) OSRF_INSTALL_JAVA=false ;; 
63   *) AC_MSG_ERROR([please choose another value for --enable-java (supported values are yes or no)]) ;;
64 esac],
65 [OSRF_INSTALL_JAVA=false])
66
67 AM_CONDITIONAL([BUILDJAVA], [test x$OSRF_INSTALL_JAVA = xtrue])
68 AC_SUBST([OSRF_INSTALL_JAVA])
69
70 # build and install the python modules
71 AC_ARG_ENABLE([python],
72 [  --disable-python  disable building and installing python modules],
73 [case "${enableval}" in
74   yes) OSRF_INSTALL_PYTHON=true ;;
75   no) OSRF_INSTALL_PYTHON=false ;;
76   *) AC_MSG_ERROR([please choose another value for --enable-python (supported values are yes or no)]) ;;
77 esac],
78 [OSRF_INSTALL_PYTHON=true])
79
80 AM_CONDITIONAL([BUILDPYTHON], [test x$OSRF_INSTALL_PYTHON = xtrue])
81 AC_SUBST([OSRF_INSTALL_PYTHON])
82
83 # create the legacy JSON headers and .so file for backwards compatibility?
84 AC_ARG_ENABLE([legacyjson],
85 [  --disable-legacyjson    disable the legacy json headers and .so file for backwards compatibility],
86 [case "${enableval}" in
87     yes) OSRF_LEGACY_JSON=true ;;
88     no)  OSRF_LEGACY_JSON=false ;;
89   *) AC_MSG_ERROR([please choose another value for --disable-legacyjson (supported values are yes or no)]) ;;
90 esac],
91 [OSRF_LEGACY_JSON=true])
92
93 AM_CONDITIONAL([BUILDJSON], [test x$OSRF_LEGACY_JSON = xtrue])
94 AC_SUBST([OSRF_LEGACY_JSON])
95
96 # enable debug?
97
98 AC_ARG_ENABLE(debug,
99 [  --enable-debug    Turn on debugging],
100 [case "${enableval}" in
101   yes) debug=true ;;
102   no)  debug=false ;;
103   *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
104 esac],[debug=false])
105 AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
106  
107
108 # path to the directory containing the java dependency jar files (included if java installs)
109 if test $OSRF_INSTALL_JAVA; then
110         AC_SUBST([OSRF_JAVA_DEPSDIR], [/opt/java])
111 fi
112
113
114
115 #--------------------------------
116 # Checks for programs.
117 #--------------------------------
118
119 AC_PROG_LIBTOOL
120 AC_PROG_AWK
121 AC_PROG_CC
122 AC_PROG_INSTALL
123 AC_PROG_MAKE_SET
124
125 #------------------------------
126 # Set install path variables
127 #------------------------------
128 AC_ARG_WITH([tmp],
129 [  --with-tmp=path              location for the tmp dir for openSRF (default is /tmp)],
130 [TMP=${withval}],
131 [TMP=/tmp])
132 AC_SUBST([TMP])
133
134 AC_ARG_WITH([apxs],
135 [  --with-apxs=path                 location of apxs (default is /usr/bin/apxs2)],
136 [APXS2=${withval}],
137 [APXS2=/usr/bin/apxs2])
138 AC_SUBST([APXS2])
139
140 AC_ARG_WITH([apache],
141 [  --with-apache=path               location of the apache headers (default is /usr/include/apache2)],
142 [APACHE2_HEADERS=${withval}],
143 [APACHE2_HEADERS=/usr/include/apache2])
144 AC_SUBST([APACHE2_HEADERS])
145
146 AC_ARG_WITH([apr],
147 [  --with-apr=path                  location of the apr headers (default is /usr/include/apr-1.0/)],
148 [APR_HEADERS=${withval}],
149 [APR_HEADERS=/usr/include/apr-1.0])
150 AC_SUBST([APR_HEADERS])
151
152 AC_ARG_WITH([libxml],
153 [  --with-libxml=path               location of the libxml headers (default is /usr/include/libxml2/))],
154 [LIBXML2_HEADERS=${withval}],
155 [LIBXML2_HEADERS=/usr/include/libxml2/])
156 AC_SUBST([LIBXML2_HEADERS])
157
158 AC_ARG_WITH([includes],
159 [  --with-includes=DIRECTORIES      a colon-separated list of directories that will be added to the list the compiler searches for header files (Example: --with-includes=/path/headers:/anotherpath/moreheaders)],
160 [EXTRA_USER_INCLUDES=${withval}])
161
162 AC_ARG_WITH([libraries],
163 [  --with-libraries=DIRECTORIES     a colon-separated list of directories to search for libraries (Example: --with-libraries=/lib:/usr/lib)],
164 [EXTRA_USER_LIBRARIES=${withval}])
165
166 # Change these lists to proper compiler/linker options
167
168 IFSBAK=${IFS}
169 IFS="${IFS}:"
170
171 for dir in $EXTRA_USER_INCLUDES; do
172         if test -d "$dir"; then
173           INCLUDES="$INCLUDES -I$dir"
174         else
175           AC_MSG_WARN([*** Include directory $dir does not exist.])
176         fi
177 done
178 AC_SUBST(INCLUDES)
179
180 for dir in $EXTRA_USER_LIBRARIES; do
181         if test -d "$dir"; then
182           LIBDIRS="$LIBDIRS -L$dir"
183         else
184           AC_MSG_WARN([*** Library directory $dir does not exist.])
185         fi
186 done
187 AC_SUBST(LIBDIRS)
188
189 IFS=${IFSBAK}
190
191 #--------------------------------
192 # Check for dependencies.
193 #--------------------------------
194
195 #APACHE PREFORK DEV TEST
196 AC_MSG_CHECKING([APXS])
197 if test -f "${APXS2}"; then
198 AC_MSG_RESULT([yes])
199 else
200 AC_MSG_ERROR([*** apxs not found, aborting])
201 fi  
202
203 #PYTHON TESTS
204 if test x$OSRF_INSTALL_PYTHON = xtrue; then
205         AC_CHECK_PROG([HAVE_PYTHON],python,yes,no)
206         if test $HAVE_PYTHON = "no"; then
207                 AC_MSG_ERROR([*** python not found, aborting])
208         fi
209         AC_PYTHON_MOD([setuptools])
210 fi
211
212
213 #-----------------------------
214 # Checks for libraries.
215 #-----------------------------
216
217 AC_CHECK_LIB([dl], [dlerror], [],AC_MSG_ERROR(***OpenSRF requires libdl))
218 AC_CHECK_LIB([memcache], [mc_req_free], [], AC_MSG_ERROR(***OpenSRF requires memcache development headers))
219 AC_CHECK_LIB([ncurses], [initscr], [], AC_MSG_ERROR(***OpenSRF requires ncurses development headers))
220 AC_CHECK_LIB([readline], [readline], [], AC_MSG_ERROR(***OpenSRF requires readline development headers))
221 AC_CHECK_LIB([xml2], [xmlAddID], [], AC_MSG_ERROR(***OpenSRF requires xml2 development headers))
222
223
224
225 #-----------------------------
226 # Checks for header files.
227 #-----------------------------
228
229 AC_HEADER_STDC
230 AC_HEADER_SYS_WAIT
231 AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h malloc.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.h])
232
233 #------------------------------------------------------------------
234 # Checks for typedefs, structures, and compiler characteristics.
235 #------------------------------------------------------------------
236
237 AC_C_CONST
238 AC_C_INLINE
239 AC_TYPE_PID_T
240 AC_TYPE_SIZE_T
241 AC_HEADER_TIME
242 AC_STRUCT_TM
243
244 #----------------------------------
245 # Checks for library functions.
246 #----------------------------------
247
248 AC_FUNC_FORK
249 AC_FUNC_MALLOC
250 AC_FUNC_SELECT_ARGTYPES
251 AC_TYPE_SIGNAL
252 AC_FUNC_STRFTIME
253 AC_FUNC_STRTOD
254 AC_FUNC_VPRINTF
255 AC_CHECK_FUNCS([bzero dup2 gethostbyname gethostname gettimeofday memset select socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strtol])
256
257 #------------------------------------
258 # Configuration and output
259 #------------------------------------
260
261 AC_CONFIG_FILES([Makefile
262                  examples/math_xul_client/Makefile
263                  src/Makefile
264                  src/c-apps/Makefile
265                  src/gateway/Makefile
266                  src/java/Makefile
267                  src/jserver/Makefile
268                  src/libopensrf/Makefile
269                  src/ports/strn_compat/Makefile
270                  src/python/Makefile
271                  src/router/Makefile
272                  src/srfsh/Makefile
273                  bin/osrf_config], [if test -e "./bin/osrf_config"; then chmod 755 bin/osrf_config; fi])
274
275
276 AC_OUTPUT
277
278 bin/osrf_config --cconfig
279
280 AC_MSG_RESULT([])
281 AC_MSG_RESULT([--------------------- Configuration options:  -----------------------])
282
283 if test "$OSRF_INSTALL_JAVA" = "true" ; then
284         AC_MSG_RESULT([OSRF install java?:              yes])
285         AC_MSG_RESULT([Java deps dir:                   $OSRF_JAVA_DEPSDIR])
286 else
287         AC_MSG_RESULT([OSRF install java?:              no])
288 fi
289
290 if test "$OSRF_INSTALL_PYTHON" = "true" ; then
291         AC_MSG_RESULT([OSRF install python?:            yes])
292 else
293         AC_MSG_RESULT([OSRF install python?:            no])
294 fi
295
296 if test "$OSRF_LEGACY_JSON" = "true" ; then
297         AC_MSG_RESULT([OSRF install legacy json?:       yes])
298 else
299         AC_MSG_RESULT([OSRF install legacy json?:       no])
300 fi
301
302         AC_MSG_RESULT(Installation directory prefix:            ${prefix})
303         AC_MSG_RESULT(Tmp dir location:                         ${TMP})
304         AC_MSG_RESULT(APXS2 location:                           ${APXS2})
305         AC_MSG_RESULT(Apache headers location:                  ${APACHE2_HEADERS})
306         AC_MSG_RESULT(APR headers location:                     ${APR_HEADERS})
307         AC_MSG_RESULT(libxml2 headers location:                 ${LIBXML2_HEADERS})
308
309
310
311
312
313 AC_MSG_RESULT([----------------------------------------------------------------------])