]> git.evergreen-ils.org Git - OpenSRF.git/blob - configure.ac
Apply patch 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 # enable debug?
84
85 AC_ARG_ENABLE(debug,
86 [  --enable-debug    Turn on debugging],
87 [case "${enableval}" in
88   yes) debug=true ;;
89   no)  debug=false ;;
90   *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
91 esac],[debug=false])
92 AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
93  
94
95 # path to the directory containing the java dependency jar files (included if java installs)
96 if test $OSRF_INSTALL_JAVA; then
97         AC_SUBST([OSRF_JAVA_DEPSDIR], [/opt/java])
98 fi
99
100
101
102 #--------------------------------
103 # Checks for programs.
104 #--------------------------------
105
106 AC_PROG_LIBTOOL
107 AC_PROG_AWK
108 AC_PROG_CC
109 AC_PROG_INSTALL
110 AC_PROG_MAKE_SET
111
112 #------------------------------
113 # Set install path variables
114 #------------------------------
115 AC_ARG_WITH([tmp],
116 [  --with-tmp=path              location for the tmp dir for openSRF (default is /tmp)],
117 [TMP=${withval}],
118 [TMP=/tmp])
119 AC_SUBST([TMP])
120
121 AC_ARG_WITH([apxs],
122 [  --with-apxs=path                 location of apxs (default is /usr/bin/apxs2)],
123 [APXS2=${withval}],
124 [APXS2=/usr/bin/apxs2])
125 AC_SUBST([APXS2])
126
127 AC_ARG_WITH([apache],
128 [  --with-apache=path               location of the apache headers (default is /usr/include/apache2)],
129 [APACHE2_HEADERS=${withval}],
130 [APACHE2_HEADERS=/usr/include/apache2])
131 AC_SUBST([APACHE2_HEADERS])
132
133 AC_ARG_WITH([apr],
134 [  --with-apr=path                  location of the apr headers (default is /usr/include/apr-1.0/)],
135 [APR_HEADERS=${withval}],
136 [APR_HEADERS=/usr/include/apr-1.0])
137 AC_SUBST([APR_HEADERS])
138
139 AC_ARG_WITH([libxml],
140 [  --with-libxml=path               location of the libxml headers (default is /usr/include/libxml2/))],
141 [LIBXML2_HEADERS=${withval}],
142 [LIBXML2_HEADERS=/usr/include/libxml2/])
143 AC_SUBST([LIBXML2_HEADERS])
144
145 AC_ARG_WITH([includes],
146 [  --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)],
147 [EXTRA_USER_INCLUDES=${withval}])
148
149 AC_ARG_WITH([libraries],
150 [  --with-libraries=DIRECTORIES     a colon-separated list of directories to search for libraries (Example: --with-libraries=/lib:/usr/lib)],
151 [EXTRA_USER_LIBRARIES=${withval}])
152
153 # Change these lists to proper compiler/linker options
154
155 IFSBAK=${IFS}
156 IFS="${IFS}:"
157
158 for dir in $EXTRA_USER_INCLUDES; do
159         if test -d "$dir"; then
160           INCLUDES="$INCLUDES -I$dir"
161         else
162           AC_MSG_WARN([*** Include directory $dir does not exist.])
163         fi
164 done
165 AC_SUBST(INCLUDES)
166
167 for dir in $EXTRA_USER_LIBRARIES; do
168         if test -d "$dir"; then
169           LIBDIRS="$LIBDIRS -L$dir"
170         else
171           AC_MSG_WARN([*** Library directory $dir does not exist.])
172         fi
173 done
174 AC_SUBST(LIBDIRS)
175
176 IFS=${IFSBAK}
177
178 #--------------------------------
179 # Check for dependencies.
180 #--------------------------------
181
182 #APACHE PREFORK DEV TEST
183 AC_MSG_CHECKING([APXS])
184 if test -f "${APXS2}"; then
185 AC_MSG_RESULT([yes])
186 else
187 AC_MSG_ERROR([*** apxs not found, aborting])
188 fi  
189
190 #PYTHON TESTS
191 if test x$OSRF_INSTALL_PYTHON = xtrue; then
192         AC_CHECK_PROG([HAVE_PYTHON],python,yes,no)
193         if test $HAVE_PYTHON = "no"; then
194                 AC_MSG_ERROR([*** python not found, aborting])
195         fi
196         AC_PYTHON_MOD([setuptools])
197 fi
198
199
200 #-----------------------------
201 # Checks for libraries.
202 #-----------------------------
203
204 AC_CHECK_LIB([dl], [dlerror], [],AC_MSG_ERROR(***OpenSRF requires libdl))
205 AC_CHECK_LIB([memcache], [mc_req_free], [], AC_MSG_ERROR(***OpenSRF requires memcache development headers))
206 AC_CHECK_LIB([ncurses], [initscr], [], AC_MSG_ERROR(***OpenSRF requires ncurses development headers))
207 AC_CHECK_LIB([readline], [readline], [], AC_MSG_ERROR(***OpenSRF requires readline development headers))
208 AC_CHECK_LIB([xml2], [xmlAddID], [], AC_MSG_ERROR(***OpenSRF requires xml2 development headers))
209
210
211
212 #-----------------------------
213 # Checks for header files.
214 #-----------------------------
215
216 AC_HEADER_STDC
217 AC_HEADER_SYS_WAIT
218 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])
219
220 #------------------------------------------------------------------
221 # Checks for typedefs, structures, and compiler characteristics.
222 #------------------------------------------------------------------
223
224 AC_C_CONST
225 AC_C_INLINE
226 AC_TYPE_PID_T
227 AC_TYPE_SIZE_T
228 AC_HEADER_TIME
229 AC_STRUCT_TM
230
231 #----------------------------------
232 # Checks for library functions.
233 #----------------------------------
234
235 AC_FUNC_FORK
236 AC_FUNC_MALLOC
237 AC_FUNC_SELECT_ARGTYPES
238 AC_TYPE_SIGNAL
239 AC_FUNC_STRFTIME
240 AC_FUNC_STRTOD
241 AC_FUNC_VPRINTF
242 AC_CHECK_FUNCS([bzero dup2 gethostbyname gethostname gettimeofday memset select socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strtol])
243
244 #------------------------------------
245 # Configuration and output
246 #------------------------------------
247
248 AC_CONFIG_FILES([Makefile
249                  examples/math_xul_client/Makefile
250                  src/Makefile
251                  src/c-apps/Makefile
252                  src/gateway/Makefile
253                  src/java/Makefile
254                  src/jserver/Makefile
255                  src/libopensrf/Makefile
256                  src/ports/strn_compat/Makefile
257                  src/python/Makefile
258                  src/router/Makefile
259                  src/srfsh/Makefile
260                  bin/osrf_config], [if test -e "./bin/osrf_config"; then chmod 755 bin/osrf_config; fi])
261
262
263 AC_OUTPUT
264
265 bin/osrf_config --cconfig
266
267 AC_MSG_RESULT([])
268 AC_MSG_RESULT([--------------------- Configuration options:  -----------------------])
269
270 if test "$OSRF_INSTALL_JAVA" = "true" ; then
271         AC_MSG_RESULT([OSRF install java?:              yes])
272         AC_MSG_RESULT([Java deps dir:                   $OSRF_JAVA_DEPSDIR])
273 else
274         AC_MSG_RESULT([OSRF install java?:              no])
275 fi
276
277 if test "$OSRF_INSTALL_PYTHON" = "true" ; then
278         AC_MSG_RESULT([OSRF install python?:            yes])
279 else
280         AC_MSG_RESULT([OSRF install python?:            no])
281 fi
282
283         AC_MSG_RESULT(Installation directory prefix:            ${prefix})
284         AC_MSG_RESULT(Tmp dir location:                         ${TMP})
285         AC_MSG_RESULT(APXS2 location:                           ${APXS2})
286         AC_MSG_RESULT(Apache headers location:                  ${APACHE2_HEADERS})
287         AC_MSG_RESULT(APR headers location:                     ${APR_HEADERS})
288         AC_MSG_RESULT(libxml2 headers location:                 ${LIBXML2_HEADERS})
289
290
291
292
293
294 AC_MSG_RESULT([----------------------------------------------------------------------])