1 # Copyright (C) 2008 Equinox Software, Inc.
2 # Kevin Beswick <kevinbeswick00@gmail.com>
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.
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.
14 # Process this file with autoconf to produce a configure script.
17 #-------------------------------
19 #-------------------------------
21 export PATH=${PATH}:/usr/sbin
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/])
33 AC_DEFUN([AC_PYTHON_MOD],[
38 AC_MSG_CHECKING($PYTHON_NAME module: $1)
39 $PYTHON -c "import $1" 2>/tmp/null
43 eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
45 AC_MSG_ERROR(failed to find required module $1)
52 #-------------------------------
53 # Installation options
54 #-------------------------------
56 # build and install the java libs?
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)]) ;;
64 [OSRF_INSTALL_JAVA=false])
66 AM_CONDITIONAL([BUILDJAVA], [test x$OSRF_INSTALL_JAVA = xtrue])
67 AC_SUBST([OSRF_INSTALL_JAVA])
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)]) ;;
77 [OSRF_INSTALL_PYTHON=true])
79 AM_CONDITIONAL([BUILDPYTHON], [test x$OSRF_INSTALL_PYTHON = xtrue])
80 AC_SUBST([OSRF_INSTALL_PYTHON])
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)]) ;;
90 [OSRF_LEGACY_JSON=true])
92 AM_CONDITIONAL([BUILDJSON], [test x$OSRF_LEGACY_JSON = xtrue])
93 AC_SUBST([OSRF_LEGACY_JSON])
98 [ --enable-debug Turn on debugging],
99 [case "${enableval}" in
102 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
104 AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
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])
114 #--------------------------------
115 # Checks for programs.
116 #--------------------------------
124 #------------------------------
125 # Set install path variables
126 #------------------------------
128 [ --with-tmp=path location for the tmp dir for openSRF (/tmp/osrftmp by default)],
134 [ --with-apxs=path location of apxs (default is /usr/bin/apxs2)],
136 [APXS2=/usr/bin/apxs2])
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])
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])
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])
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}])
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}])
165 # Change these lists to proper compiler/linker options
170 for dir in $EXTRA_USER_INCLUDES; do
171 if test -d "$dir"; then
172 INCLUDES="$INCLUDES -I$dir"
174 AC_MSG_WARN([*** Include directory $dir does not exist.])
179 for dir in $EXTRA_USER_LIBRARIES; do
180 if test -d "$dir"; then
181 LIBDIRS="$LIBDIRS -L$dir"
183 AC_MSG_WARN([*** Library directory $dir does not exist.])
190 #--------------------------------
191 # Check for dependencies.
192 #--------------------------------
194 #APACHE PREFORK DEV TEST
195 AC_MSG_CHECKING([APXS])
196 if test -f "${APXS2}"; then
199 AC_MSG_ERROR([*** apxs not found, aborting])
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])
208 AC_PYTHON_MOD([setuptools])
212 #-----------------------------
213 # Checks for libraries.
214 #-----------------------------
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))
224 #-----------------------------
225 # Checks for header files.
226 #-----------------------------
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])
232 #------------------------------------------------------------------
233 # Checks for typedefs, structures, and compiler characteristics.
234 #------------------------------------------------------------------
243 #----------------------------------
244 # Checks for library functions.
245 #----------------------------------
249 AC_FUNC_SELECT_ARGTYPES
254 AC_CHECK_FUNCS([bzero dup2 gethostbyname gethostname gettimeofday memset select socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strtol])
256 #------------------------------------
257 # Configuration and output
258 #------------------------------------
260 AC_CONFIG_FILES([Makefile
261 examples/math_xul_client/Makefile
267 src/libopensrf/Makefile
268 src/ports/strn_compat/Makefile
272 bin/osrf_config], [if test -e "./bin/osrf_config"; then chmod 755 bin/osrf_config; fi])
278 AC_MSG_RESULT([--------------------- Configuration options: -----------------------])
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])
284 AC_MSG_RESULT([OSRF install java?: no])
287 if test "$OSRF_INSTALL_PYTHON" = "true" ; then
288 AC_MSG_RESULT([OSRF install python?: yes])
290 AC_MSG_RESULT([OSRF install python?: no])
293 if test "$OSRF_LEGACY_JSON" = "true" ; then
294 AC_MSG_RESULT([OSRF install legacy json?: yes])
296 AC_MSG_RESULT([OSRF install legacy json?: no])
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})
310 AC_MSG_RESULT([----------------------------------------------------------------------])