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