Patch from Kevin Beswick to use autotools for OpenSRF configuration and build
authordbs <dbs@9efc2488-bf62-4759-914b-345cdb29e865>
Wed, 25 Jun 2008 18:50:00 +0000 (18:50 +0000)
committerdbs <dbs@9efc2488-bf62-4759-914b-345cdb29e865>
Wed, 25 Jun 2008 18:50:00 +0000 (18:50 +0000)
Included is a patch for a working implementation of the GNU Autotools
to OpenSRF. Some of the perks of this system are: the user is given
the ability to install OpenSRF to non-standard locations,
dependency/library checking, gives a user the ability to only install
certain components, more portable to other operating systems, etc.

To test, simply run:
autogen.sh
configure
make
make install

Options for configure can be found using:
./configure --help

Also, the patch contains a new file, osrf_config, which is generated
by running the configure script. Running this file will print all
build options a user has chosen when compiling/installing Opensrf.
Command line arguments can be added to return each single build option
as well. This is useful to developers in that they are able to locate
a certain installation directory on a non-standard installation of
OpenSRF. To see the available command line options, run: osrf_config --help

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1348 9efc2488-bf62-4759-914b-345cdb29e865

29 files changed:
AUTHORS [new file with mode: 0644]
ChangeLog [new file with mode: 0644]
Makefile [deleted file]
Makefile.am [new file with mode: 0644]
NEWS [new file with mode: 0644]
README [new file with mode: 0644]
autogen.sh [new file with mode: 0644]
bin/osrf_config.in [new file with mode: 0644]
bin/osrf_ctl.sh
configure.ac [new file with mode: 0644]
examples/math_xul_client/Makefile.in [moved from examples/math_xul_client/Makefile with 100% similarity]
install.conf [deleted file]
src/Makefile [deleted file]
src/Makefile.am [new file with mode: 0644]
src/c-apps/Makefile [deleted file]
src/c-apps/Makefile.am [new file with mode: 0644]
src/gateway/Makefile [deleted file]
src/gateway/Makefile.am [new file with mode: 0644]
src/java/Makefile.in [moved from src/java/Makefile with 100% similarity]
src/jserver/Makefile [deleted file]
src/jserver/Makefile.am [new file with mode: 0644]
src/libopensrf/Makefile [deleted file]
src/libopensrf/Makefile.am [new file with mode: 0644]
src/ports/strn_compat/Makefile.in [moved from src/ports/strn_compat/Makefile with 100% similarity]
src/python/Makefile.in [moved from src/python/Makefile with 98% similarity]
src/router/Makefile [deleted file]
src/router/Makefile.am [new file with mode: 0644]
src/srfsh/Makefile [deleted file]
src/srfsh/Makefile.am [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..5650c91
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+#AUTHORS
diff --git a/ChangeLog b/ChangeLog
new file mode 100644 (file)
index 0000000..3323187
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1 @@
+#ChangeLog
diff --git a/Makefile b/Makefile
deleted file mode 100644 (file)
index 39f8b8d..0000000
--- a/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-SHELL=/bin/bash
-all:
-       @echo -e "\n * Run 'make verbose' to see full make output\n"
-       source install.conf && make -s -C src all
-
-verbose:
-       source install.conf && make -C src all
-
-jserver:
-       source install.conf && make -s -C src jserver
-
-install:
-       source install.conf && make -s -C src install
-
-jserver-install:
-       source install.conf && make -s -C src jserver-install
-
-javascript-install:
-       source install.conf && make -s -C src javascript-install
-
-clean:
-       make -s -C src clean
-
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..33102a4
--- /dev/null
@@ -0,0 +1,42 @@
+# Copyright (C) 2008 Equinox Software, Inc.
+# Kevin Beswick <kevinbeswick00@gmail.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+
+export PREFIX                   = @prefix@
+export TMP                      = @TMP@
+export LIBXML2_HEADERS          = @LIBXML2_HEADERS@
+export APR_HEADERS              = @APR_HEADERS@
+export ETCDIR                   = @sysconfdir@
+export APXS2                    = @APXS2@
+export APACHE2_HEADERS          = @APACHE2_HEADERS@
+export DEF_CFLAGS              = -D_LARGEFILE64_SOURCE -pipe -g -Wall -O2 -fPIC -I@abs_top_builddir@/include/ -I$(LIBXML2_HEADERS) -I$(APACHE2_HEADERS) -I$(APR_HEADERS) @INCLUDES@
+export DEF_LDFLAGS             = -Wl, -rpath=$(LIBDIR) -L$(TMPDIR) @LIBDIRS@
+export DEF_LDLIBS              = -lobjson -lopensrf
+export PID                     = @localstatedir@/run/opensrf
+export SOCK                    = @localstatedir@/lock/opensrf
+export LOG                     = @localstatedir@/log/opensrf
+
+AM_CFLAGS = $(DEF_CFLAGS)
+LDFLAGS = $(DEF_LDFLAGS) -L./src/
+
+SUBDIRS = src
+
+jserver:
+       make -s -C src jserver
+
+jserver-install:
+       make -s -C src jserver-install
+
+javascript-install:
+       make -s -C src javascript-install
+
diff --git a/NEWS b/NEWS
new file mode 100644 (file)
index 0000000..2aafebb
--- /dev/null
+++ b/NEWS
@@ -0,0 +1 @@
+#NEWS
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..24e5d00
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+#README
diff --git a/autogen.sh b/autogen.sh
new file mode 100644 (file)
index 0000000..dc8591f
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+# autogen.sh - generates configure using the autotools
+
+: ${LIBTOOLIZE=libtoolize}
+: ${ACLOCAL=aclocal}
+: ${AUTOHEADER=autoheader}
+: ${AUTOMAKE=automake}
+: ${AUTOCONF=autoconf}
+
+
+${LIBTOOLIZE} --force --copy
+${ACLOCAL}
+${AUTOMAKE} --add-missing
+
+
+${AUTOCONF}
+
+echo 
+echo "---------------------------------------------"
+echo "autogen finished running, now run ./configure"
+echo "---------------------------------------------"
diff --git a/bin/osrf_config.in b/bin/osrf_config.in
new file mode 100644 (file)
index 0000000..0391d56
--- /dev/null
@@ -0,0 +1,126 @@
+# Copyright (C) 2008 Equinox Software, Inc.
+# Kevin Beswick <kevinbeswick00@gmail.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+
+# Shows configuration options of OSRF
+
+prefix=@prefix@
+exec_prefix=@prefix@
+datarootdir=@datarootdir@
+
+function showInstalled {
+        JAVA=@OSRF_INSTALL_JAVA@
+        PYTHON=@OSRF_INSTALL_PYTHON@
+        JSON=@OSRF_LEGACY_JSON@
+        if test "$JAVA" = "true"; then
+           echo "OSRF_JAVA"
+        fi
+        if test "$PYTHON" = "true"; then
+           echo "OSRF_PYTHON"
+        fi
+        if test "$JSON" = "true"; then
+           echo "OSRF_LEGACY_JSON"
+        fi
+}
+
+function showAll {
+        echo @PACKAGE_STRING@  
+        echo PREFIX=@prefix@
+        echo BINDIR=@bindir@
+        echo LIBDIR=@libdir@
+        echo TMP=@TMP@
+        echo INCLUDEDIR=@includedir@
+        echo SYSCONFDIR=@sysconfdir@
+        echo APXS2=@APXS2@
+        echo APACHE2_HEADERS=@APACHE2_HEADERS@
+        echo APR_HEADERS=@APR_HEADERS@
+        echo LIBXML2_HEADERS=@LIBXML2_HEADERS@
+        echo 
+        echo "Installed modules:"
+        showInstalled;
+}
+
+function showHelp {
+        echo 
+        echo "------------------------------------------------------------"
+        echo " osrf_config                                                "
+        echo " Shows configuration of opensrf                             "
+        echo "------------------------------------------------------------"
+        echo
+        echo "Usage: osrf_config [--option]"
+        echo 
+        echo "Options: "
+        echo
+        echo "--help                  displays help"
+        echo "--version               displays version number of osrf"
+        echo "--installed             displays options that were installed"
+        echo "--prefix                displays prefix"
+        echo "--bindir                displays bindir"
+        echo "--libdir                displays libdir"
+        echo "--tmp                   displays tmp"
+        echo "--includedir            displays includedir"
+        echo "--sysconfdir            displays sysconfdir"
+        echo "--apxs                  displays location of apxs"
+        echo "--apache                displays location of apache2 headers"
+        echo "--apr                   displays location of apr headers"
+        echo "--libxml                displays location of libxml2 headers" 
+        echo
+}
+
+case "$1" in
+     --installed)
+               showInstalled;
+               ;;
+     --libxml)
+               echo @LIBXML2_HEADERS@;
+               ;;
+     --apr)
+               echo @APR_HEADERS@;
+               ;;
+     --apache)
+               echo @APACHE2_HEADERS@;
+               ;;
+     --prefix)
+               echo @prefix@
+               ;;
+     --version) 
+               echo @PACKAGE_STRING@;
+               ;;
+     --bindir)
+               echo @bindir@
+               ;;
+     --libdir)
+               echo @libdir@;
+               ;;
+     --sysconfdir)
+               echo @sysconfdir@;
+               ;;
+     --tmpdir)
+               echo @TMP@;
+               ;;
+     --apxs)
+               echo @APXS@;
+               ;;
+     --includedir)
+               echo @includedir@;
+               ;;
+     --docdir)
+               echo @docdir@;
+               ;;
+     --help)
+               showHelp;
+               ;;
+     *)
+               showAll;
+               ;;
+esac
index 2674115..fe752b7 100755 (executable)
@@ -1,4 +1,15 @@
 #!/bin/bash
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
 
 OPT_ACTION=""
 OPT_CONFIG=""
@@ -76,12 +87,14 @@ while getopts  "a:d:c:lh" flag; do
        esac;
 done
 
-[ -z "$OPT_CONFIG" ] && OPT_CONFIG="$BASEDIR/conf/opensrf_core.xml";
+OSRF_CONFIG=`find $BASEDIR -name osrf_config`
+
+[ -z "$OPT_CONFIG" ] && OPT_CONFIG=`$OSRF_CONFIG --sysconfdir`/opensrf_core.xml;
 if [ ! -r "$OPT_CONFIG" ]; then
        echo "Please specify the location of the opensrf_core.xml file using the -c flag";
        exit 1;
 fi;
-[ -z "$OPT_PID_DIR" ] && OPT_PID_DIR=/tmp;
+[ -z "$OPT_PID_DIR" ] && OPT_PID_DIR=`$OSRF_CONFIG --sysconfdir`/run;
 [ -z "$OPT_ACTION" ] && usage;
 
 PID_ROUTER="$OPT_PID_DIR/router.pid";
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..19a1696
--- /dev/null
@@ -0,0 +1,310 @@
+# Copyright (C) 2008 Equinox Software, Inc.
+# Kevin Beswick <kevinbeswick00@gmail.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# Process this file with autoconf to produce a configure script.
+
+
+#-------------------------------
+# Initialization
+#-------------------------------
+
+export PATH=${PATH}:/usr/sbin
+AC_PREREQ(2.59)
+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([/openils/])
+
+
+AC_SUBST(prefix)
+
+
+AC_DEFUN([AC_PYTHON_MOD],[
+    if test -z $PYTHON;
+    then
+        PYTHON="python"
+    fi
+    AC_MSG_CHECKING($PYTHON_NAME module: $1)
+        $PYTHON -c "import $1" 2>/tmp/null
+        if test $? -eq 0;
+        then
+                AC_MSG_RESULT(yes)
+                eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
+        else
+                AC_MSG_ERROR(failed to find required module $1)
+               exit 1
+        fi
+])
+
+
+
+#-------------------------------
+# Installation options
+#-------------------------------
+
+# build and install the java libs?
+AC_ARG_ENABLE([java],
+[  --enable-java    enable building and installing the java libraries],
+[case "${enableval}" in
+    yes) OSRF_INSTALL_JAVA=true ;;
+    no) OSRF_INSTALL_JAVA=false ;; 
+  *) AC_MSG_ERROR([please choose another value for --enable-java (supported values are yes or no)]) ;;
+esac],
+[OSRF_INSTALL_JAVA=false])
+
+AM_CONDITIONAL([BUILDJAVA], [test x$OSRF_INSTALL_JAVA = xtrue])
+AC_SUBST([OSRF_INSTALL_JAVA])
+
+# build and install the python modules
+AC_ARG_ENABLE([python],
+[  --disable-python  disable 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])
+
+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],
+[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)]) ;;
+esac],
+[OSRF_LEGACY_JSON=true])
+
+AM_CONDITIONAL([BUILDJSON], [test x$OSRF_LEGACY_JSON = xtrue])
+AC_SUBST([OSRF_LEGACY_JSON])
+
+# enable debug?
+
+AC_ARG_ENABLE(debug,
+[  --enable-debug    Turn on debugging],
+[case "${enableval}" in
+  yes) debug=true ;;
+  no)  debug=false ;;
+  *) AC_MSG_ERROR(bad value ${enableval} for --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.
+#--------------------------------
+
+AC_PROG_LIBTOOL
+AC_PROG_AWK
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+
+#------------------------------
+# Set install path variables
+#------------------------------
+AC_ARG_WITH([tmp],
+[  --with-tmp=path              location for the tmp dir for openSRF (/tmp/osrftmp by default)],
+[TMP=${withval}],
+[TMP=/tmp/osrftmp])
+AC_SUBST([TMP])
+
+AC_ARG_WITH([apxs],
+[  --with-apxs=path                 location of apxs (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)],
+[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/)],
+[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/))],
+[LIBXML2_HEADERS=${withval}],
+[LIBXML2_HEADERS=/usr/include/libxml2/])
+AC_SUBST([LIBXML2_HEADERS])
+
+AC_ARG_WITH([includes],
+[  --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)],
+[EXTRA_USER_INCLUDES=${withval}])
+
+AC_ARG_WITH([libraries],
+[  --with-libraries=DIRECTORIES     a colon-separated list of directories to search for libraries (Example: --with-libraries=/lib:/usr/lib)],
+[EXTRA_USER_LIBRARIES=${withval}])
+
+# Change these lists to proper compiler/linker options
+
+IFSBAK=${IFS}
+IFS="${IFS}:"
+
+for dir in $EXTRA_USER_INCLUDES; do
+       if test -d "$dir"; then
+         INCLUDES="$INCLUDES -I$dir"
+       else
+         AC_MSG_WARN([*** Include directory $dir does not exist.])
+       fi
+done
+AC_SUBST(INCLUDES)
+
+for dir in $EXTRA_USER_LIBRARIES; do
+       if test -d "$dir"; then
+         LIBDIRS="$LIBDIRS -L$dir"
+       else
+         AC_MSG_WARN([*** Library directory $dir does not exist.])
+       fi
+done
+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_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([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])
+
+
+AC_OUTPUT
+
+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])
+else
+       AC_MSG_RESULT([OSRF install java?:              no])
+fi
+
+if test "$OSRF_INSTALL_PYTHON" = "true" ; then
+        AC_MSG_RESULT([OSRF install python?:            yes])
+else
+        AC_MSG_RESULT([OSRF install python?:            no])
+fi
+
+if test "$OSRF_LEGACY_JSON" = "true" ; then
+        AC_MSG_RESULT([OSRF install legacy json?:       yes])
+else
+        AC_MSG_RESULT([OSRF install legacy json?:      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([----------------------------------------------------------------------])
diff --git a/install.conf b/install.conf
deleted file mode 100644 (file)
index f9aad3c..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-export PREFIX=/openils
-export BINDIR=/openils/bin
-export LIBDIR=/openils/lib
-export PERLDIR=/openils/lib/perl5
-export INCLUDEDIR=/openils/include
-export ETCDIR=/openils/conf
-export SOCK=/openils/var/sock
-export PID=/openils/var/pid
-export LOG=/openils/var/log
-export TMP=/tmp/ilstemp
-export APXS2=/usr/bin/apxs2
-export APACHE2_HEADERS=/usr/include/apache2
-export APR_HEADERS=/usr/include/apr-1.0
-export LIBXML2_HEADERS=/usr/include/libxml2
-
-# uncomment to create the legacy JSON headers and .so file for backwards compatibility
-export OSRF_LEGACY_JSON=1
-
-# uncomment to build and install the java libs
-#export OSRF_INSTALL_JAVA=1
-
-# path to the directory containing the Java dependency jar files
-#export OSRF_JAVA_DEPSDIR=/opt/java
-
-# uncomment to build and install the Python modules
-export OSRF_INSTALL_PYTHON=1
diff --git a/src/Makefile b/src/Makefile
deleted file mode 100644 (file)
index 00153aa..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-# TOP level 'src' makefile for OpenSRF
-
-export TMPDIR  = $(TMP)/opensrf
-export OPENSRF = opensrf
-export BINDIR  = $(PREFIX)/bin
-export LIBDIR  = $(PREFIX)/lib
-export PERLDIR = $(LIBDIR)/perl5
-export JSDIR   = $(LIBDIR)/javascript
-export INCLUDEDIR= $(PREFIX)/include
-
-export LDLIBS  += 
-export LDFLAGS += -Wl,-rpath=$(LIBDIR) -L $(TMPDIR) -L .
-export CFLAGS  += -D_LARGEFILE64_SOURCE -pipe -g -Wall -O2 -fPIC -I ../../include/ -I$(LIBXML2_HEADERS) -I$(APACHE2_HEADERS) -I$(APR_HEADERS) 
-
-ifneq ($(DEBUG), 1)
-export CFLAGS += -DNDEBUG
-endif
-
-ifeq ($(OSRF_LEGACY_JSON), 1)
-export LDLIBS += -lobjson
-endif
-
-all:   prep \
-       opensrf \
-       router \
-       srfsh \
-       jserver \
-       gateway \
-       java \
-       python-build
-
-install:       install-prep \
-               opensrf-install \
-               gateway-install \
-               router-install \
-               srfsh-install \
-               jserver-install \
-               javascript-install \
-               perl-install \
-               python-install \
-               java-install
-
-
-# --------------------------------------------------------------------------------
-# BINARIES and LIBS
-# --------------------------------------------------------------------------------
-
-prep:
-       mkdir -p $(TMPDIR)
-
-opensrf:       prep
-       make -C libopensrf
-       make -C c-apps
-
-router: opensrf
-       @echo $@
-       make -C router 
-
-srfsh: opensrf
-       @echo $@
-       make -C srfsh
-
-gateway:       opensrf
-       @echo $@
-       make -C gateway
-
-jserver:       opensrf
-       @echo $@
-       make -C jserver
-
-
-java:  prep
-       if [ -n "$(OSRF_INSTALL_JAVA)" ]; then echo $@; cd java && . deps.inc && make; fi;
-
-python-build:
-       if [ -n "$(OSRF_INSTALL_PYTHON)" ]; then echo $@; make -C python build; fi;
-
-# --------------------------------------------------------------------------------
-# INSTALL
-# --------------------------------------------------------------------------------
-
-# make sure the install directories exist
-install-prep:  
-       @echo $@
-       mkdir -p $(LIBDIR)
-       mkdir -p $(BINDIR)
-       mkdir -p $(JSDIR)
-       mkdir -p $(PERLDIR)
-       mkdir -p $(INCLUDEDIR)
-       mkdir -p $(ETCDIR)
-
-# installs libopensrf.so, opensrf-c, headers, example configs, and osrf_ctl.sh
-opensrf-install:       install-prep
-       @echo $@
-       cp $(TMPDIR)/libopensrf.so $(LIBDIR)/libopensrf.so
-       cp -r ../include/opensrf $(INCLUDEDIR)
-       cp libopensrf/opensrf $(BINDIR)/opensrf-c
-       make -C c-apps install
-       cp ../bin/osrf_ctl.sh $(BINDIR)
-       cp ../examples/opensrf.xml.example $(ETCDIR)
-       cp ../examples/opensrf_core.xml.example $(ETCDIR)
-       cp ../examples/srfsh.xml.example $(ETCDIR)
-       if [ ! -z "$(OSRF_LEGACY_JSON)" ]; then\
-               cp -r ../include/objson $(INCLUDEDIR);\
-               cp $(TMPDIR)/libobjson.so $(LIBDIR);\
-       fi
-
-gateway-install:       install-prep opensrf-install    
-       @echo $@
-       make -C gateway install
-
-router-install:        install-prep opensrf-install
-       @echo $@
-       make -C router install
-
-srfsh-install: install-prep opensrf-install 
-       @echo $@
-       make -C srfsh install
-
-jserver-install:       install-prep 
-       @echo $@
-       make -C jserver install
-
-javascript-install:    install-prep
-       @echo $@
-       cp -r javascript/* $(JSDIR)/
-
-perl-install:  install-prep
-       @echo $@
-       cp -r perlmods/* $(PERLDIR)/
-
-python-install:
-       if [ -n "$(OSRF_INSTALL_PYTHON)" ]; then echo $@; make -C python install; fi;
-
-java-install:
-       if [ -n "$(OSRF_INSTALL_JAVA)" ]; then echo $@; cd java && . deps.inc && make install; fi;
-
-# --------------------------------------------------------------------------------
-# CLEAN        
-# --------------------------------------------------------------------------------
-clean:
-       make -C libopensrf clean
-       make -C router clean
-       make -C gateway clean
-       make -C jserver clean
-       make -C srfsh clean
-       make -C c-apps clean
-       make -C java clean
-       if [ -n "$(OSRF_INSTALL_PYTHON)" ]; then echo $@; make -C python clean; fi;
-       /bin/rm -rf $(TMPDIR) *.o
-
-
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644 (file)
index 0000000..37371d7
--- /dev/null
@@ -0,0 +1,64 @@
+# Copyright (C) 2008 Equinox Software, Inc.
+# Kevin Beswick <kevinbeswick00@gmail.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+
+# Declare some directory variables
+
+export TMPDIR  = $(TMP)/opensrf
+export OPENSRF = opensrf
+export BINDIR  = @bindir@
+export LIBDIR  = @libdir@
+export PERLDIR = $(LIBDIR)/perl5
+export JSDIR   = $(LIBDIR)/javascript
+export INCLUDEDIR= @includedir@
+export OSRF_JAVA_DEPSDIR = @OSRF_JAVA_DEPSDIR@
+
+AM_LDFLAGS = $(DEF_LDFLAGS)
+AM_CFLAGS = $(DEF_CFLAGS)
+
+if DEBUG
+AM_CFLAGS += -DNDEBUG
+endif
+
+if BUILDJSON
+LDADD = -lobjson
+BJSON=1
+endif
+
+if BUILDPYTHON
+MAYBE_PY = python
+endif 
+
+if BUILDJAVA
+MAYBE_JA = java
+endif
+
+SUBDIRS = libopensrf c-apps router srfsh jserver gateway $(MAYBE_PY) $(MAYBE_JA)
+
+install-data-local:
+       mkdir -p $(JSDIR)
+       mkdir -p $(PERLDIR)
+       mkdir -p $(ETCDIR)
+       cp -r ../include/opensrf $(INCLUDEDIR)
+       mv $(BINDIR)/opensrf $(BINDIR)/opensrf-c
+       cp ../bin/osrf_config $(BINDIR)
+       cp ../bin/osrf_ctl.sh $(BINDIR)
+       cp ../examples/opensrf.xml.example $(ETCDIR)
+       cp ../examples/opensrf_core.xml.example $(ETCDIR)
+       cp ../examples/srfsh.xml.example $(ETCDIR)
+       cp -r ../include/objson $(INCLUDEDIR)
+       cp -r javascript/* $(JSDIR)/
+       cp -r perlmods/* $(PERLDIR)/
+       mv $(INCLUDEDIR)/apachetools.h $(INCLUDEDIR)/opensrf/apachetools.h
+
+
diff --git a/src/c-apps/Makefile b/src/c-apps/Makefile
deleted file mode 100644 (file)
index d566ff3..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-LDLIBS += -lopensrf
-CFLAGS += -D_LARGEFILE64_SOURCE -DOSRF_LOG_PARAMS
-
-all:   osrf_math.so osrf_dbmath.so osrf_version.so timejson
-
-timejson.o: timejson.c
-osrf_math.o: osrf_math.c
-osrf_dbmath.o: osrf_dbmath.c
-osrf_version.o: osrf_version.c
-
-timejson: timejson.o
-       $(CC) -shared -W1 $(LDLIBS) $(LDFLAGS) timejson.o -o $(TMPDIR)/timejson
-
-osrf_math.so: osrf_math.o
-       $(CC) -shared -W1 $(LDLIBS) $(LDFLAGS) osrf_math.o -o $(TMPDIR)/osrf_math.so
-
-osrf_dbmath.so: osrf_dbmath.o
-       $(CC) -shared -W1 $(LDLIBS) $(LDFLAGS) osrf_dbmath.o -o $(TMPDIR)/osrf_dbmath.so
-
-osrf_version.so: osrf_version.o
-       $(CC) -shared -W1 $(LDLIBS) $(LDFLAGS) osrf_version.o -o $(TMPDIR)/osrf_version.so
-
-install:
-       cp $(TMPDIR)/osrf_math.so $(LIBDIR)/
-       cp $(TMPDIR)/osrf_dbmath.so $(LIBDIR)/
-       cp $(TMPDIR)/osrf_version.so $(LIBDIR)/
-
-clean:
-       rm -f *.o *.so
diff --git a/src/c-apps/Makefile.am b/src/c-apps/Makefile.am
new file mode 100644 (file)
index 0000000..5c3871c
--- /dev/null
@@ -0,0 +1,36 @@
+# Copyright (C) 2007-2008 Equinox Software, Inc.
+# Kevin Beswick <kevinbeswick00@gmail.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+
+# for libtool
+tmpdir = $(TMP)
+
+AM_CFLAGS = $(DEF_CFLAGS) -DORSF_LOG_PARAMS 
+LDADD = $(DEF_LDLIBS)
+AM_LDFLAGS = $(DEF_LDFLAGS) -L$(TMP)/opensrf/ -L../libopensrf/.libs/ -L.  
+
+tmp_PROGRAMS = timejson
+lib_LTLIBRARIES = libosrf_dbmath.la libosrf_math.la libosrf_version.la
+
+timejson_SOURCES = timejson.c
+libosrf_dbmath_la_SOURCES = osrf_dbmath.c 
+libosrf_math_la_SOURCES = osrf_math.c
+libosrf_version_la_SOURCES = osrf_version.c 
+
+## rename libraries (libtool requires the prefix lib, but we dont use that here)
+## remove extra library files created by libtool
+install-exec-hook:
+       cp $(LIBDIR)/libosrf_math.so $(LIBDIR)/osrf_math.so
+       cp $(LIBDIR)/libosrf_dbmath.so $(LIBDIR)/osrf_dbmath.so
+       cp $(LIBDIR)/libosrf_version.so $(LIBDIR)/osrf_version.so       
+       rm $(LIBDIR)/libosrf*
diff --git a/src/gateway/Makefile b/src/gateway/Makefile
deleted file mode 100644 (file)
index 3d60411..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#CFLAGS        += -DASSUME_STATELESS -DOSRF_GATEWAY_NASTY_DEBUG
-CFLAGS += -DASSUME_STATELESS 
-LDLIBS += -lopensrf
-
-all: osrf_json_gateway.so copy
-
-install: 
-       $(APXS2) -i -a -n osrf_json_gateway osrf_json_gateway.so
-       cp apachetools.h $(INCLUDEDIR)/opensrf/
-
-copy:
-       cp apachetools.h $(TMPDIR)
-
-apachetools.o: apachetools.h apachetools.c
-       $(CC) -c $(CFLAGS) apachetools.c -o $@
-
-osrf_json_gateway.o:   osrf_json_gateway.c
-       $(CC) -c $(CFLAGS) osrf_json_gateway.c -o $@
-
-osrf_json_gateway.so:  copy apachetools.o osrf_json_gateway.o
-       $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -shared -W1 apachetools.o osrf_json_gateway.o -o osrf_json_gateway.so
-
-
-clean:
-       /bin/rm -f *.o *.so 
diff --git a/src/gateway/Makefile.am b/src/gateway/Makefile.am
new file mode 100644 (file)
index 0000000..0fdccea
--- /dev/null
@@ -0,0 +1,28 @@
+# Copyright (C) 2008 Equinox Software, Inc.
+# Kevin Beswick <kevinbeswick00@gmail.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+
+AM_LDFLAGS = $(DEF_LDFLAGS)
+AM_CFLAGS = $(DEF_CFLAGS) -DASSUME_STATELESS -L../libopensrf/.libs/ 
+LDADD = $(DEF_LDLIBS)
+
+curdir = @abs_top_builddir@/src/gateway/
+
+cur_LTLIBRARIES = libosrf_json_gateway.la
+libosrf_json_gateway_la_SOURCES = apachetools.c apachetools.h osrf_json_gateway.c
+
+include_HEADERS = apachetools.h
+
+install-exec-local: 
+       cp .libs/libosrf_json_gateway.so osrf_json_gateway.so
+       $(APXS2) -i -a -n osrf_json_gateway osrf_json_gateway.so
similarity index 100%
rename from src/java/Makefile
rename to src/java/Makefile.in
diff --git a/src/jserver/Makefile b/src/jserver/Makefile
deleted file mode 100644 (file)
index 33f9ced..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-LDLIBS += -lopensrf  -lxml2
-CFLAGS += -D_GNU_SOURCE
-
-all: chopchop
-
-chopchop: osrf_chat.o osrf_chat_main.o
-       $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) osrf_chat.o osrf_chat_main.o -o $@
-
-osrf_chat.o: osrf_chat.c osrf_chat.h
-osrf_chat_main.o: osrf_chat_main.c
-
-install: 
-       cp chopchop $(BINDIR)
-
-clean:
-       /bin/rm -f *.o chopchop
-
diff --git a/src/jserver/Makefile.am b/src/jserver/Makefile.am
new file mode 100644 (file)
index 0000000..3763e40
--- /dev/null
@@ -0,0 +1,21 @@
+# Copyright (C) 2008 Equinox Software, Inc.
+# Kevin Beswick <kevinbeswick00@gmail.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+
+LDADD = -lxml2 $(DEF_LDLIBS)
+AM_CFLAGS = $(DEF_CFLAGS) -D_GNU_SOURCE -L../libopensrf/.libs/
+AM_LDFLAGS = $(DEF_LDFLAGS)
+
+bin_PROGRAMS = chopchop
+chopchop_SOURCES = osrf_chat.c osrf_chat.h osrf_chat_main.c
+
diff --git a/src/libopensrf/Makefile b/src/libopensrf/Makefile
deleted file mode 100644 (file)
index c6d5d53..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-# ------------------------------------------------------------------
-# To build the standalone JSON lib libosrf_json.so:
-#      $ make libosrf_json.so
-# To build the standalone JSON lib libosrf_json.so with XML utils 
-#      support, use something like the following:
-#      $ CFLAGS="-DOSRF_JSON_ENABLE_XML_UTILS -I/usr/include/libxml2" LDLIBS=-lxml2 make libosrf_json.so
-#
-# The compiler flag -DOSRF_JSON_ALLOW_COMMENTS tells the parser to 
-# allow legacy JSON comments like /* comment */
-# ------------------------------------------------------------------
-
-CFLAGS +=  -DASSUME_STATELESS  -DOSRF_STRICT_PARAMS -rdynamic -fno-strict-aliasing -I../../include -fPIC -Wall -DOSRF_JSON_ENABLE_XML_UTILS
-LDLIBS += -lxml2 -ldl -lmemcache 
-export OSRF_INC = ../../include/opensrf/
-
-TARGETS =      osrf_message.o \
-                       osrf_app_session.o \
-                       osrf_stack.o \
-                       osrf_system.o \
-                       osrf_settings.o \
-                       osrf_prefork.o \
-                       osrfConfig.o \
-                       osrf_application.o \
-                       osrf_cache.o \
-                       osrf_transgroup.o \
-                       osrf_list.o \
-                       osrf_hash.o \
-                       xml_utils.o \
-                       transport_message.o\
-                       transport_session.o\
-                       transport_client.o\
-                       md5.o\
-                       log.o\
-                       utils.o\
-                       socket_bundle.o\
-                       sha.o\
-                       string_array.o
-
-JSON_TARGETS =         osrf_json_object.o\
-                               osrf_json_parser.o \
-                               osrf_json_tools.o \
-                               osrf_legacy_json.o \
-                               osrf_json_xml.o
-
-# use these when building the standalone JSON module
-JSON_DEPS = osrf_list.o\
-                       osrf_hash.o\
-                       utils.o\
-                       log.o\
-                       md5.o\
-                       string_array.o
-
-
-all: opensrf
-
-# Build the OpenSRF C binary
-opensrf:       opensrf.o libopensrf.so
-       @echo $@
-       $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -lopensrf opensrf.o -o $@
-
-
-# Build the OpenSRF library
-libopensrf.so: $(TARGETS) json
-       if [ ! -z "$(OSRF_LEGACY_JSON)" ]; then\
-               $(CC) -shared -W1 $(LDFLAGS) $(LDLIBS) $(TARGETS) -o $(TMPDIR)/libopensrf.so;\
-       else\
-               $(CC) -shared -W1 $(LDFLAGS) $(LDLIBS) $(TARGETS) $(JSON_TARGETS) -o $(TMPDIR)/libopensrf.so;\
-       fi; 
-
-
-json:  $(JSON_TARGETS) $(JSON_DEPS)
-       if [ ! -z "$(OSRF_LEGACY_JSON)" ]; then \
-               $(CC) -shared -W1  $(CFLAGS) \
-                       $(LDFLAGS) $(JSON_TARGETS) $(JSON_DEPS) -o $(TMPDIR)/libobjson.so;\
-       fi;
-
-libosrf_json.so:       $(JSON_TARGETS) $(JSON_DEPS)
-       $(CC) -shared -W1 $(CFLAGS) \
-               $(LDFLAGS) $(LDLIBS) $(JSON_TARGETS) $(JSON_DEPS) -o $@
-
-
-osrf_json_test:        osrf_json_test.o $(JSON_TARGETS) $(JSON_DEPS)
-
-
-opensrf.o:     opensrf.c
-transport_message.o:   transport_message.c $(OSRF_INC)/transport_message.h     
-transport_session.o:   transport_session.c $(OSRF_INC)/transport_session.h     
-transport_client.o:    transport_client.c $(OSRF_INC)/transport_client.h       
-osrf_message.o:        osrf_message.c $(OSRF_INC)/osrf_message.h
-osrf_app_session.o:    osrf_app_session.c $(OSRF_INC)/osrf_app_session.h
-osrf_stack.o:  osrf_stack.c $(OSRF_INC)/osrf_stack.h
-osrf_system.o: osrf_system.c $(OSRF_INC)/osrf_system.h
-osrf_settings.o:       osrf_settings.c $(OSRF_INC)/osrf_settings.h
-osrf_prefork.o:        osrf_prefork.c $(OSRF_INC)/osrf_prefork.h
-osrfConfig.o:  osrfConfig.c $(OSRF_INC)/osrfConfig.h xml_utils.o
-osrf_application.o: osrf_application.c $(OSRF_INC)/osrf_application.h
-osrf_cache.o:  osrf_cache.c $(OSRF_INC)/osrf_cache.h
-osrf_list.o:   osrf_list.c $(OSRF_INC)/osrf_list.h
-osrf_hash.o:   osrf_hash.c $(OSRF_INC)/osrf_hash.h
-md5.o: md5.c $(OSRF_INC)/md5.h
-log.o: log.c $(OSRF_INC)/log.h 
-utils.o:       utils.c $(OSRF_INC)/utils.h
-socket_bundle.o:       socket_bundle.c $(OSRF_INC)/socket_bundle.h
-sha.o: sha.c $(OSRF_INC)/sha.h
-string_array.o:        string_array.c $(OSRF_INC)/string_array.h
-osrf_json_object.o:    osrf_json_object.c $(OSRF_INC)/osrf_json.h $(OSRF_INC)/osrf_json_utils.h
-osrf_json_parser.o:    osrf_json_parser.c $(OSRF_INC)/osrf_json.h $(OSRF_INC)/osrf_json_utils.h
-osrf_json_tools.o:     osrf_json_tools.c $(OSRF_INC)/osrf_json.h $(OSRF_INC)/osrf_json_utils.h
-osrf_legacy_json.o:    osrf_legacy_json.c $(OSRF_INC)/osrf_json.h $(OSRF_INC)/osrf_json_utils.h
-osrf_json_xml.o:       osrf_json_xml.c $(OSRF_INC)/osrf_json.h $(OSRF_INC)/osrf_json_xml.h
-osrf_json_test.o:      osrf_json_test.c
-
-
-clean:
-       /bin/rm -f *.o *.so opensrf osrf_json_test
-
-
-
-
diff --git a/src/libopensrf/Makefile.am b/src/libopensrf/Makefile.am
new file mode 100644 (file)
index 0000000..d49f181
--- /dev/null
@@ -0,0 +1,139 @@
+# Copyright (C) 2008 Equinox Software, Inc.
+# Kevin Beswick <kevinbeswick00@gmail.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+
+AM_CFLAGS = $(DEF_CFLAGS) -DASSUME_STATELESS  -DOSRF_STRICT_PARAMS -rdynamic -fno-strict-aliasing -I./.libs/ -DOSRF_JSON_ENABLE_XML_UTILS
+AM_LDFLAGS = $(DEF_LDFLAGS)
+LDADD = -lxml2 -ldl -lmemcache -lopensrf -lobjson
+
+export OSRF_INC = @abs_top_builddir@/include/opensrf/
+
+TARGS =                osrf_message.c \
+                       osrf_app_session.c \
+                       osrf_stack.c \
+                       osrf_system.c \
+                       osrf_settings.c \
+                       osrf_prefork.c \
+                       osrfConfig.c \
+                       osrf_application.c \
+                       osrf_cache.c \
+                       osrf_transgroup.c \
+                       osrf_list.c \
+                       osrf_hash.c \
+                       xml_utils.c \
+                       transport_message.c\
+                       transport_session.c\
+                       transport_client.c\
+                       md5.c\
+                       log.c\
+                       utils.c\
+                       socket_bundle.c\
+                       sha.c\
+                       string_array.c
+
+TARGS_HEADS =   $(OSRF_INC)/transport_message.h \
+                $(OSRF_INC)/transport_session.h \
+                $(OSRF_INC)/transport_client.h \
+                $(OSRF_INC)/osrf_message.h \
+                $(OSRF_INC)/osrf_app_session.h \
+                $(OSRF_INC)/osrf_stack.h \
+                $(OSRF_INC)/osrf_system.h \
+                $(OSRF_INC)/osrf_settings.h \
+                $(OSRF_INC)/osrf_prefork.h \
+                $(OSRF_INC)/osrfConfig.h \
+                $(OSRF_INC)/osrf_application.h \
+                $(OSRF_INC)/osrf_cache.h \
+                $(OSRF_INC)/osrf_list.h \
+                $(OSRF_INC)/osrf_hash.h \
+                $(OSRF_INC)/md5.h \
+                $(OSRF_INC)/log.h \
+                $(OSRF_INC)/utils.h \
+                $(OSRF_INC)/socket_bundle.h \
+                $(OSRF_INC)/sha.h \
+                $(OSRF_INC)/string_array.h \
+                $(OSRF_INC)/osrf_json_utils.h \
+                $(OSRF_INC)/osrf_json_xml.h 
+
+JSON_TARGS =                   osrf_json_object.c\
+                               osrf_json_parser.c \
+                               osrf_json_tools.c \
+                               osrf_legacy_json.c \
+                               osrf_json_xml.c
+
+# use these when building the standalone JSON module
+JSON_DEP =             osrf_list.c\
+                       osrf_hash.c\
+                       utils.c\
+                       log.c\
+                       md5.c\
+                       string_array.c
+
+JSON_TARGS_HEADS =             $(OSRF_INC)/osrf_json_object.h\
+                               $(OSRF_INC)/osrf_json_parser.h \
+                               $(OSRF_INC)/osrf_json_tools.h \
+                               $(OSRF_INC)/osrf_legacy_json.h \
+                               $(OSRF_INC)/osrf_json_xml.h
+
+JSON_DEP_HEADS =       $(OSRF_INC)/osrf_list.h\
+                       $(OSRF_INC)/osrf_hash.h\
+                       $(OSRF_INC)/utils.h\
+                       $(OSRF_INC)/log.h\
+                       $(OSRF_INC)/md5.h\
+                       $(OSRF_INC)/string_array.h
+
+
+noinst_PROGRAMS = osrf_json_test
+
+bin_PROGRAMS = opensrf
+opensrf_SOURCES = opensrf.c
+opensrf_DEPENDENCIES = libopensrf.la
+
+osrf_json_test_SOURCES = osrf_json_test.c $(JSON_TARGS) $(JSON_DEP) $(JSON_TARGS_HEADS) $(JSON_DEP_HEADS)
+
+noinst_LTLIBRARIES = libosrf_json.la
+lib_LTLIBRARIES = libobjson.la libopensrf.la
+
+if BUILDJSON
+libobjson_la_SOURCES = $(JSON_TARGS) $(JSON_DEP) $(JSON_TARGS_HEADS) $(JSON_DEP_HEADS)
+libobjson_la_CFLAGS = $(AM_CFLAGS)
+endif
+
+libosrf_json_la_SOURCES = $(JSON_TARGS) $(JSON_DEP) $(JSON_TARGS_HEADS) $(JSON_DEP_HEADS)
+libosrf_json_la_CFLAGS = $(AM_CFLAGS)
+
+if BUILDJSON
+libosrf_json_la_DEPENDENCIES = libobjson.la
+endif
+
+libopensrf_la_CFLAGS = $(AM_CFLAGS)
+libopensrf_la_DEPENDENCIES = libosrf_json.la
+
+if BUILDJSON
+libopensrf_la_SOURCES = $(TARGS) $(TARGS_HEADS)
+else
+libopensrf_la_SOURCES = $(TARGS) $(TARGS_HEADS) $(JSON_TARGS) $(JSON_TARGS_HEADS)
+endif
+
+install-exec-hook:
+       ## Remove extra lib files created by libtool.
+       rm $(LIBDIR)/libobjson.a
+       rm $(LIBDIR)/libobjson.la
+       rm $(LIBDIR)/libobjson.so
+       mv $(LIBDIR)/libobjson.so.*.*.* $(LIBDIR)/libobjson.so
+       rm $(LIBDIR)/libobjson.so.*
+
+       rm $(LIBDIR)/libopensrf.a
+       rm $(LIBDIR)/libopensrf.la
+       rm $(LIBDIR)/libopensrf.so
+       mv $(LIBDIR)/libopensrf.so.*.*.* $(LIBDIR)/libopensrf.so
+       rm $(LIBDIR)/libopensrf.so.*
similarity index 98%
rename from src/python/Makefile
rename to src/python/Makefile.in
index 6be673c..4a3061d 100644 (file)
@@ -1,5 +1,7 @@
 # makefile for OpenSRF Python modules and scripts
 
+all: build
+
 # ------------------------------------------------------------------------------
 # BUILD
 # ------------------------------------------------------------------------------
diff --git a/src/router/Makefile b/src/router/Makefile
deleted file mode 100644 (file)
index f545b66..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#MALLOC_CHECK_=1 # XXX debug only
-
-LDLIBS += -lxml2 -lopensrf 
-CFLAGS += -D_ROUTER
-
-all: opensrf_router 
-#osrf_router
-
-install: 
-       cp opensrf_router $(BINDIR)
-
-#opensrf_router:       router.o 
-#      $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) router.o -o $@
-#router.o:     router.c router.h
-
-opensrf_router:        osrf_router.o osrf_router_main.o
-       $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) osrf_router.o osrf_router_main.o -o $@
-osrf_router.o: osrf_router.c osrf_router.h
-osrf_router_main.o: osrf_router_main.c 
-
-clean:
-       /bin/rm -f *.o opensrf_router
-
diff --git a/src/router/Makefile.am b/src/router/Makefile.am
new file mode 100644 (file)
index 0000000..4532ebb
--- /dev/null
@@ -0,0 +1,21 @@
+# Copyright (C) 2008 Equinox Software, Inc.
+# Kevin Beswick <kevinbeswick00@gmail.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+
+LDADD = -lxml2 $(DEF_LDLIBS) 
+AM_CFLAGS = $(DEF_CFLAGS) -D_ROUTER -L../libopensrf/.libs/
+AM_LDFLAGS = $(DEF_LDFLAGS)
+
+bin_PROGRAMS = opensrf_router
+opensrf_router_SOURCES = osrf_router.c osrf_router_main.c osrf_router.h 
+
diff --git a/src/srfsh/Makefile b/src/srfsh/Makefile
deleted file mode 100644 (file)
index efea8b2..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-# if EXEC_DEFAULT is defined, then srfsh will send all unknown commands to the shell for execution
-
-LDLIBS += -lreadline -lxml2 -lopensrf -lncurses 
-LDFLAGS        += -DEXEC_DEFAULT
-
-all: srfsh
-
-srfsh: srfsh.o
-srfsh.o:       srfsh.c 
-
-install: 
-       cp srfsh $(BINDIR)
-
-clean:
-       /bin/rm -f *.o srfsh
diff --git a/src/srfsh/Makefile.am b/src/srfsh/Makefile.am
new file mode 100644 (file)
index 0000000..d184f75
--- /dev/null
@@ -0,0 +1,20 @@
+# Copyright (C) 2008 Equinox Software, Inc.
+# Kevin Beswick <kevinbeswick00@gmail.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+
+LDADD = -lreadline -lxml2 -lncurses $(DEF_LDLIBS) 
+AM_CFLAGS = $(DEF_CFLAGS) -DEXEC_DEFAULT -L../libopensrf/.libs/ 
+AM_LDFLAGS = $(DEF_LDFLAGS)
+
+bin_PROGRAMS = srfsh
+srfsh_SOURCES = srfsh.c