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