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/])
34 AC_DEFUN([AC_PYTHON_MOD],[
39 AC_MSG_CHECKING($PYTHON_NAME module: $1)
40 $PYTHON -c "import $1" 2>/dev/null
44 eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
46 AC_MSG_ERROR(failed to find required module $1)
53 #-------------------------------
54 # Installation options
55 #-------------------------------
57 # build and install the java libs?
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)]) ;;
65 [OSRF_INSTALL_JAVA=false])
67 AM_CONDITIONAL([BUILDJAVA], [test x$OSRF_INSTALL_JAVA = xtrue])
68 AC_SUBST([OSRF_INSTALL_JAVA])
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)]) ;;
78 [OSRF_INSTALL_PYTHON=true])
80 AM_CONDITIONAL([BUILDPYTHON], [test x$OSRF_INSTALL_PYTHON = xtrue])
81 AC_SUBST([OSRF_INSTALL_PYTHON])
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)]) ;;
91 [OSRF_LEGACY_JSON=true])
93 AM_CONDITIONAL([BUILDJSON], [test x$OSRF_LEGACY_JSON = xtrue])
94 AC_SUBST([OSRF_LEGACY_JSON])
99 [ --enable-debug Turn on debugging],
100 [case "${enableval}" in
103 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
105 AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
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])
115 #--------------------------------
116 # Checks for programs.
117 #--------------------------------
125 #------------------------------
126 # Set install path variables
127 #------------------------------
129 [ --with-tmp=path location for the tmp dir for openSRF (default is /tmp)],
135 [ --with-apxs=path location of apxs (default is /usr/bin/apxs2)],
137 [APXS2=/usr/bin/apxs2])
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])
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])
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])
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}])
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}])
166 # Change these lists to proper compiler/linker options
171 for dir in $EXTRA_USER_INCLUDES; do
172 if test -d "$dir"; then
173 INCLUDES="$INCLUDES -I$dir"
175 AC_MSG_WARN([*** Include directory $dir does not exist.])
180 for dir in $EXTRA_USER_LIBRARIES; do
181 if test -d "$dir"; then
182 LIBDIRS="$LIBDIRS -L$dir"
184 AC_MSG_WARN([*** Library directory $dir does not exist.])
191 #--------------------------------
192 # Check for dependencies.
193 #--------------------------------
195 #APACHE PREFORK DEV TEST
196 AC_MSG_CHECKING([APXS])
197 if test -f "${APXS2}"; then
200 AC_MSG_ERROR([*** apxs not found, aborting])
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])
209 AC_PYTHON_MOD([setuptools])
213 #-----------------------------
214 # Checks for libraries.
215 #-----------------------------
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))
225 #-----------------------------
226 # Checks for header files.
227 #-----------------------------
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])
233 #------------------------------------------------------------------
234 # Checks for typedefs, structures, and compiler characteristics.
235 #------------------------------------------------------------------
244 #----------------------------------
245 # Checks for library functions.
246 #----------------------------------
250 AC_FUNC_SELECT_ARGTYPES
255 AC_CHECK_FUNCS([bzero dup2 gethostbyname gethostname gettimeofday memset select socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strtol])
257 #------------------------------------
258 # Configuration and output
259 #------------------------------------
261 AC_CONFIG_FILES([Makefile
262 examples/math_xul_client/Makefile
268 src/libopensrf/Makefile
269 src/ports/strn_compat/Makefile
273 bin/osrf_config], [if test -e "./bin/osrf_config"; then chmod 755 bin/osrf_config; fi])
278 bin/osrf_config --cconfig
281 AC_MSG_RESULT([--------------------- Configuration options: -----------------------])
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])
287 AC_MSG_RESULT([OSRF install java?: no])
290 if test "$OSRF_INSTALL_PYTHON" = "true" ; then
291 AC_MSG_RESULT([OSRF install python?: yes])
293 AC_MSG_RESULT([OSRF install python?: no])
296 if test "$OSRF_LEGACY_JSON" = "true" ; then
297 AC_MSG_RESULT([OSRF install legacy json?: yes])
299 AC_MSG_RESULT([OSRF install legacy json?: no])
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})
313 AC_MSG_RESULT([----------------------------------------------------------------------])