So. libmemcached has only been packaged on really fresh distros. Install from source...
[OpenSRF.git] / configure.ac
index 4a5d23e..00bcddc 100644 (file)
@@ -1,5 +1,6 @@
 # Copyright (C) 2008 Equinox Software, Inc.
 # Kevin Beswick <kevinbeswick00@gmail.com>
+# Copyright (C) 2009 Dan Scott <dscott@laurentian.ca>
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -24,11 +25,21 @@ AC_INIT([OpenSRF],[trunk],[open-ils-dev@list.georgialibraries.org])
 AM_INIT_AUTOMAKE([OpenSRF], [trunk])
 AC_REVISION($Revision: 0.1 $)
 AC_CONFIG_SRCDIR([configure.ac])
-AC_PREFIX_DEFAULT([/opensrf/])
+AC_PREFIX_DEFAULT([/opensrf])
+AC_CONFIG_MACRO_DIR([m4])
 
+# Enable $prefix to resolve to a reasonable value in substitutions in
+# scripts if no explict value was passed in to configure
+if test "$prefix" == "NONE"; then
+   prefix=$ac_default_prefix
+fi
+
+# Perl and Python scripts don't want ${prefix} if no value was specified
+eval "eval CONF_DIR=$sysconfdir"
+AC_SUBST([CONF_DIR])
 
 AC_SUBST(prefix)
-AC_SUBST(sysconfdir)
+AC_SUBST(bindir)
 
 
 AC_DEFUN([AC_PYTHON_MOD],[
@@ -67,31 +78,59 @@ esac],
 AM_CONDITIONAL([BUILDJAVA], [test x$OSRF_INSTALL_JAVA = xtrue])
 AC_SUBST([OSRF_INSTALL_JAVA])
 
+# install the javascript files?
+AC_ARG_ENABLE([javascript],
+[  --disable-javascript    disable installing JavaScript libraries],
+[case "${enableval}" in
+    yes) OSRF_INSTALL_JAVASCRIPT=true ;;
+    no) OSRF_INSTALL_JAVASCRIPT=false ;; 
+  *) AC_MSG_ERROR([please choose another value for --disable-javascript (supported values are yes or no)]) ;;
+esac],
+[OSRF_INSTALL_JAVASCRIPT=true])
+
+AM_CONDITIONAL([INSTALLJAVASCRIPT], [test x$OSRF_INSTALL_JAVASCRIPT = xtrue])
+AC_SUBST([OSRF_INSTALL_JAVASCRIPT])
+
+# install the OpenSRF core files?
+AC_ARG_ENABLE([core],
+[  --disable-core    disable installing core files],
+[case "${enableval}" in
+    yes) OSRF_INSTALL_CORE=true ;;
+    no) OSRF_INSTALL_CORE=false ;; 
+  *) AC_MSG_ERROR([please choose another value for --disable-core (supported values are yes or no)]) ;;
+esac],
+[OSRF_INSTALL_CORE=true])
+
+AM_CONDITIONAL([BUILDCORE], [test x$OSRF_INSTALL_CORE = xtrue])
+AC_SUBST([OSRF_INSTALL_CORE])
+
+
 # build and install the python modules
 AC_ARG_ENABLE([python],
-[  --disable-python  disable building and installing python modules],
+[  --enable-python  enable building and installing python modules],
 [case "${enableval}" in
   yes) OSRF_INSTALL_PYTHON=true ;;
   no) OSRF_INSTALL_PYTHON=false ;;
   *) AC_MSG_ERROR([please choose another value for --enable-python (supported values are yes or no)]) ;;
 esac],
-[OSRF_INSTALL_PYTHON=true])
+[OSRF_INSTALL_PYTHON=false])
 
 AM_CONDITIONAL([BUILDPYTHON], [test x$OSRF_INSTALL_PYTHON = xtrue])
 AC_SUBST([OSRF_INSTALL_PYTHON])
 
-# create the legacy JSON headers and .so file for backwards compatibility?
-AC_ARG_ENABLE([legacyjson],
-[  --disable-legacyjson    disable the legacy json headers and .so file for backwards compatibility],
+# enable chopchop, the basic XMPP server
+
+AC_ARG_ENABLE([chopchop],
+[  --enable-chopchop    build and install chopchop, a basic XMPP server],
 [case "${enableval}" in
-    yes) OSRF_LEGACY_JSON=true ;;
-    no)  OSRF_LEGACY_JSON=false ;;
-  *) AC_MSG_ERROR([please choose another value for --disable-legacyjson (supported values are yes or no)]) ;;
+    yes) OSRF_INSTALL_CHOPCHOP=true ;;
+    no) OSRF_INSTALL_CHOPCHOP=false ;; 
+  *) AC_MSG_ERROR([please choose another value for --enable-chopchop (supported values are yes or no)]) ;;
 esac],
-[OSRF_LEGACY_JSON=true])
+[OSRF_INSTALL_CHOPCHOP=false])
 
-AM_CONDITIONAL([BUILDJSON], [test x$OSRF_LEGACY_JSON = xtrue])
-AC_SUBST([OSRF_LEGACY_JSON])
+AM_CONDITIONAL([BUILDCHOPCHOP], [test x$OSRF_INSTALL_CHOPCHOP = xtrue])
+AC_SUBST([OSRF_INSTALL_CHOPCHOP])
 
 # enable debug?
 
@@ -104,14 +143,11 @@ AC_ARG_ENABLE(debug,
 esac],[debug=false])
 AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
  
-
 # path to the directory containing the java dependency jar files (included if java installs)
 if test $OSRF_INSTALL_JAVA; then
        AC_SUBST([OSRF_JAVA_DEPSDIR], [/opt/java])
 fi
 
-
-
 #--------------------------------
 # Checks for programs.
 #--------------------------------
@@ -126,31 +162,31 @@ AC_PROG_MAKE_SET
 # Set install path variables
 #------------------------------
 AC_ARG_WITH([tmp],
-[  --with-tmp=path              location for the tmp dir for openSRF (default is /tmp)],
+[  --with-tmp=path                  location for the temporary directory for OpenSRF (default is /tmp)],
 [TMP=${withval}],
 [TMP=/tmp])
 AC_SUBST([TMP])
 
 AC_ARG_WITH([apxs],
-[  --with-apxs=path                 location of apxs (default is /usr/bin/apxs2)],
+[  --with-apxs=path                 location of the apxs (Apache extension) tool (default is /usr/bin/apxs2)],
 [APXS2=${withval}],
 [APXS2=/usr/bin/apxs2])
 AC_SUBST([APXS2])
 
 AC_ARG_WITH([apache],
-[  --with-apache=path               location of the apache headers (default is /usr/include/apache2)],
+[  --with-apache=path               location of the Apache headers (default is /usr/include/apache2)],
 [APACHE2_HEADERS=${withval}],
 [APACHE2_HEADERS=/usr/include/apache2])
 AC_SUBST([APACHE2_HEADERS])
 
 AC_ARG_WITH([apr],
-[  --with-apr=path                  location of the apr headers (default is /usr/include/apr-1.0/)],
+[  --with-apr=path                  location of the Apache Portable Runtime headers (default is /usr/include/apr-1.0/)],
 [APR_HEADERS=${withval}],
 [APR_HEADERS=/usr/include/apr-1.0])
 AC_SUBST([APR_HEADERS])
 
 AC_ARG_WITH([libxml],
-[  --with-libxml=path               location of the libxml headers (default is /usr/include/libxml2/))],
+[  --with-libxml=path               location of the libxml2 headers (default is /usr/include/libxml2/))],
 [LIBXML2_HEADERS=${withval}],
 [LIBXML2_HEADERS=/usr/include/libxml2/])
 AC_SUBST([LIBXML2_HEADERS])
@@ -188,126 +224,130 @@ AC_SUBST(LIBDIRS)
 
 IFS=${IFSBAK}
 
-#--------------------------------
-# Check for dependencies.
-#--------------------------------
-
-#APACHE PREFORK DEV TEST
-AC_MSG_CHECKING([APXS])
-if test -f "${APXS2}"; then
-AC_MSG_RESULT([yes])
-else
-AC_MSG_ERROR([*** apxs not found, aborting])
-fi  
-
-#PYTHON TESTS
-if test x$OSRF_INSTALL_PYTHON = xtrue; then
-        AC_CHECK_PROG([HAVE_PYTHON],python,yes,no)
-        if test $HAVE_PYTHON = "no"; then
-                AC_MSG_ERROR([*** python not found, aborting])
-        fi
-        AC_PYTHON_MOD([setuptools])
-fi
-
-
-#-----------------------------
-# Checks for libraries.
-#-----------------------------
-
-AC_CHECK_LIB([dl], [dlerror], [],AC_MSG_ERROR(***OpenSRF requires libdl))
-AC_CHECK_LIB([memcache], [mc_req_free], [], AC_MSG_ERROR(***OpenSRF requires memcache development headers))
-AC_CHECK_LIB([ncurses], [initscr], [], AC_MSG_ERROR(***OpenSRF requires ncurses development headers))
-AC_CHECK_LIB([readline], [readline], [], AC_MSG_ERROR(***OpenSRF requires readline development headers))
-AC_CHECK_LIB([xml2], [xmlAddID], [], AC_MSG_ERROR(***OpenSRF requires xml2 development headers))
-
-
-
-#-----------------------------
-# Checks for header files.
-#-----------------------------
-
-AC_HEADER_STDC
-AC_HEADER_SYS_WAIT
-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])
-
-#------------------------------------------------------------------
-# Checks for typedefs, structures, and compiler characteristics.
-#------------------------------------------------------------------
-
-AC_C_CONST
-AC_C_INLINE
-AC_TYPE_PID_T
-AC_TYPE_SIZE_T
-AC_HEADER_TIME
-AC_STRUCT_TM
-
-#----------------------------------
-# Checks for library functions.
-#----------------------------------
+AC_CONFIG_FILES([Makefile
+       src/Makefile])
 
-AC_FUNC_FORK
-AC_FUNC_MALLOC
-AC_FUNC_SELECT_ARGTYPES
-AC_TYPE_SIGNAL
-AC_FUNC_STRFTIME
-AC_FUNC_STRTOD
-AC_FUNC_VPRINTF
-AC_CHECK_FUNCS([bzero dup2 gethostbyname gethostname gettimeofday memset select socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strtol])
+if test "x$OSRF_INSTALL_CORE" = "xtrue"; then
+       #--------------------------------
+       # Check for dependencies.
+       #--------------------------------
 
-#------------------------------------
-# Configuration and output
-#------------------------------------
+       #APACHE PREFORK DEV TEST
+       AC_MSG_CHECKING([APXS])
+       if test -f "${APXS2}"; then
+       AC_MSG_RESULT([yes])
+       else
+       AC_MSG_ERROR([*** apxs not found, aborting])
+       fi  
+
+       #PYTHON TESTS
+       if test x$OSRF_INSTALL_PYTHON = xtrue; then
+               AC_CHECK_PROG([HAVE_PYTHON],python,yes,no)
+               if test $HAVE_PYTHON = "no"; then
+                       AC_MSG_ERROR([*** python not found, aborting])
+               fi
+               AC_PYTHON_MOD([setuptools])
+       fi
 
-AC_CONFIG_FILES([Makefile
-                 examples/math_xul_client/Makefile
-                 src/Makefile
-                 src/c-apps/Makefile
-                 src/gateway/Makefile
-                 src/java/Makefile
-                 src/jserver/Makefile
-                 src/libopensrf/Makefile
-                 src/ports/strn_compat/Makefile
-                 src/python/Makefile
-                 src/router/Makefile
-                 src/srfsh/Makefile
-                bin/osrf_config], [if test -e "./bin/osrf_config"; then chmod 755 bin/osrf_config; fi])
 
+       #-----------------------------
+       # Checks for libraries.
+       #-----------------------------
+
+       AC_CHECK_LIB([dl], [dlerror], [],AC_MSG_ERROR(***OpenSRF requires libdl))
+       AC_CHECK_LIB([ncurses], [initscr], [], AC_MSG_ERROR(***OpenSRF requires ncurses headers))
+       AC_CHECK_LIB([readline], [readline], [], AC_MSG_ERROR(***OpenSRF requires readline headers))
+       AC_CHECK_LIB([xml2], [xmlAddID], [], AC_MSG_ERROR(***OpenSRF requires libxml2 headers))
+       # Check for libmemcached and set flags accordingly
+       PKG_CHECK_MODULES(memcached, libmemcached >= 0.8.0)
+       AC_SUBST(memcached_CFLAGS)
+       AC_SUBST(memcached_LIBS)
+
+       #-----------------------------
+       # Checks for header files.
+       #-----------------------------
+
+       AC_HEADER_STDC
+       AC_HEADER_SYS_WAIT
+       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])
+
+       #------------------------------------------------------------------
+       # Checks for typedefs, structures, and compiler characteristics.
+       #------------------------------------------------------------------
+
+       AC_C_CONST
+       AC_C_INLINE
+       AC_TYPE_PID_T
+       AC_TYPE_SIZE_T
+       AC_HEADER_TIME
+       AC_STRUCT_TM
+
+       #----------------------------------
+       # Checks for library functions.
+       #----------------------------------
+
+       AC_FUNC_FORK
+       AC_FUNC_MALLOC
+       AC_FUNC_SELECT_ARGTYPES
+       AC_TYPE_SIGNAL
+       AC_FUNC_STRFTIME
+       AC_FUNC_STRTOD
+       AC_FUNC_VPRINTF
+       AC_CHECK_FUNCS([bzero dup2 gethostbyname gethostname gettimeofday memset select socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strtol])
+
+       #------------------------------------
+       # Configuration and output
+       #------------------------------------
+
+       AC_CONFIG_FILES([doc/dokuwiki-doc-stubber.pl
+                        examples/math_xul_client/Makefile
+                        examples/math_bench.pl
+                        examples/math_client.py
+                        examples/multisession-test.pl
+                        src/c-apps/Makefile
+                        src/gateway/Makefile
+                        src/java/Makefile
+                        src/jserver/Makefile
+                        src/libopensrf/Makefile
+                        src/perl/Makefile
+                        src/ports/strn_compat/Makefile
+                        src/python/Makefile
+                        src/router/Makefile
+                        src/srfsh/Makefile
+                        bin/opensrf-perl.pl
+                        bin/osrf_config
+                        bin/osrf_ctl.sh])
+fi
 
 AC_OUTPUT
 
-bin/osrf_config --cconfig
-
 AC_MSG_RESULT([])
 AC_MSG_RESULT([--------------------- Configuration options:  -----------------------])
 
 if test "$OSRF_INSTALL_JAVA" = "true" ; then
-       AC_MSG_RESULT([OSRF install java?:              yes])
-       AC_MSG_RESULT([Java deps dir:                   $OSRF_JAVA_DEPSDIR])
+        AC_MSG_RESULT([OSRF install Java support?       yes])
+        AC_MSG_RESULT([Java support files               $OSRF_JAVA_DEPSDIR])
 else
-       AC_MSG_RESULT([OSRF install java?:              no])
+        AC_MSG_RESULT([OSRF install Java support?       no])
 fi
 
 if test "$OSRF_INSTALL_PYTHON" = "true" ; then
-        AC_MSG_RESULT([OSRF install python?:            yes])
+        AC_MSG_RESULT([OSRF install Python support?     yes])
 else
-        AC_MSG_RESULT([OSRF install python?:            no])
+        AC_MSG_RESULT([OSRF install Python support?     no])
 fi
 
-if test "$OSRF_LEGACY_JSON" = "true" ; then
-        AC_MSG_RESULT([OSRF install legacy json?:       yes])
+if test "$OSRF_INSTALL_CHOPCHOP" = "true" ; then
+        AC_MSG_RESULT([OSRF install chopchop?           yes])
 else
-        AC_MSG_RESULT([OSRF install legacy json?:      no])
+        AC_MSG_RESULT([OSRF install chopchop?           no])
 fi
 
-       AC_MSG_RESULT(Installation directory prefix:            ${prefix})
-       AC_MSG_RESULT(Tmp dir location:                         ${TMP})
-       AC_MSG_RESULT(APXS2 location:                           ${APXS2})
-       AC_MSG_RESULT(Apache headers location:                  ${APACHE2_HEADERS})
-       AC_MSG_RESULT(APR headers location:                     ${APR_HEADERS})
-       AC_MSG_RESULT(libxml2 headers location:                 ${LIBXML2_HEADERS})
-
-
-
-
+        AC_MSG_RESULT(Installation directory prefix:   ${prefix})
+        AC_MSG_RESULT(Temporary directory:             ${TMP})
+        AC_MSG_RESULT(APXS2 location:                  ${APXS2})
+        AC_MSG_RESULT(Apache headers location:         ${APACHE2_HEADERS})
+        AC_MSG_RESULT(APR headers location:            ${APR_HEADERS})
+        AC_MSG_RESULT(libxml2 headers location:        ${LIBXML2_HEADERS})
 
 AC_MSG_RESULT([----------------------------------------------------------------------])