From 6a978a99d476dc26b2ff28a3859ba5fabab13d88 Mon Sep 17 00:00:00 2001 From: dbs Date: Mon, 30 Jun 2008 19:46:08 +0000 Subject: [PATCH] Patch from Kevin Beswick (kbeswick00@gmail.com) to address various problems with the autotools: * src/libopensrf/Makefile.am: * Fix typo for -I (includes) vs. -L (linking libraries) compile option * src/Makefile.am: * Propagate NDEBUG compile flag to all other makefiles * Create target directories * Set directories in example config files to match configured options * configure.ac: * Set default prefix to /opensrf/ instead of /openils/ * bin/osrf_config.in: * Add --localstatedir option for osrf_config * Correct output value for --apxs * bin/osrf_ctl.sh * Set default PID dir to localstatedir rather than sysconfdir * Makefile.am: * Propagate NDEBUG compile flag to all other makefiles * Remove explicit rpath option, automake will figure that out for us (supposedly) * examples/opensrf_core.xml.example, examples/opensrf.xml.example, examples/srfsh.xml.example: * Set directories in example config files to match configured options git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1349 9efc2488-bf62-4759-914b-345cdb29e865 --- Makefile.am | 9 +++++++-- bin/osrf_config.in | 5 ++++- bin/osrf_ctl.sh | 4 ++-- configure.ac | 2 +- examples/opensrf.xml.example | 8 ++++---- examples/opensrf_core.xml.example | 10 +++++----- examples/srfsh.xml.example | 2 +- src/Makefile.am | 16 ++++++++++++---- src/libopensrf/Makefile.am | 2 +- 9 files changed, 37 insertions(+), 21 deletions(-) diff --git a/Makefile.am b/Makefile.am index 33102a4..289b3e3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,6 +12,10 @@ # GNU General Public License for more details. +if !DEBUG +MAYBE_DEBUG = -DNDEBUG +endif + export PREFIX = @prefix@ export TMP = @TMP@ export LIBXML2_HEADERS = @LIBXML2_HEADERS@ @@ -19,9 +23,10 @@ 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_CFLAGS = -D_LARGEFILE64_SOURCE $(MAYBE_DEBUG) -pipe -g -Wall -O2 -fPIC -I@abs_top_builddir@/include/ -I$(LIBXML2_HEADERS) -I$(APACHE2_HEADERS) -I$(APR_HEADERS) @INCLUDES@ +export DEF_LDFLAGS = -L$(TMPDIR) @LIBDIRS@ export DEF_LDLIBS = -lobjson -lopensrf +export VAR = @localstatedir@ export PID = @localstatedir@/run/opensrf export SOCK = @localstatedir@/lock/opensrf export LOG = @localstatedir@/log/opensrf diff --git a/bin/osrf_config.in b/bin/osrf_config.in index 0391d56..ce2f69c 100644 --- a/bin/osrf_config.in +++ b/bin/osrf_config.in @@ -105,11 +105,14 @@ case "$1" in --sysconfdir) echo @sysconfdir@; ;; + --localstatedir) + echo @localstatedir@; + ;; --tmpdir) echo @TMP@; ;; --apxs) - echo @APXS@; + echo @APXS2@; ;; --includedir) echo @includedir@; diff --git a/bin/osrf_ctl.sh b/bin/osrf_ctl.sh index fe752b7..a8fbdd5 100755 --- a/bin/osrf_ctl.sh +++ b/bin/osrf_ctl.sh @@ -9,7 +9,7 @@ # 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="" @@ -94,7 +94,7 @@ 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=`$OSRF_CONFIG --sysconfdir`/run; +[ -z "$OPT_PID_DIR" ] && OPT_PID_DIR=`$OSRF_CONFIG --localstatedir`/run; [ -z "$OPT_ACTION" ] && usage; PID_ROUTER="$OPT_PID_DIR/router.pid"; diff --git a/configure.ac b/configure.ac index 19a1696..7d109fc 100644 --- a/configure.ac +++ b/configure.ac @@ -24,7 +24,7 @@ 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_PREFIX_DEFAULT([/opensrf/]) AC_SUBST(prefix) diff --git a/examples/opensrf.xml.example b/examples/opensrf.xml.example index e8939fa..2598164 100644 --- a/examples/opensrf.xml.example +++ b/examples/opensrf.xml.example @@ -22,16 +22,16 @@ vim:et:ts=2:sw=2: - /path/to/log + LOCALSTATEDIR/log - /path/to/sock + LOCALSTATEDIR/lock - /path/to/pid + LOCALSTATEDIR/run - /path/to/conf + SYSCONFDIR diff --git a/examples/opensrf_core.xml.example b/examples/opensrf_core.xml.example index 9b93f81..bfde5c9 100644 --- a/examples/opensrf_core.xml.example +++ b/examples/opensrf_core.xml.example @@ -27,7 +27,7 @@ vim:et:ts=2:sw=2: 5222 - /openils/var/log/osrfsys.log + LOCALSTATEDIR/log/osrfsys.log @@ -41,7 +41,7 @@ vim:et:ts=2:sw=2: 3 - /openils/conf/opensrf.xml + SYSCONFDIR/opensrf.xml @@ -57,7 +57,7 @@ vim:et:ts=2:sw=2: secret 10.0.0.3 3 - /openils/var/log/osrfsys.log + LOCALSTATEDIR/log/osrfsys.log @@ -88,7 +88,7 @@ vim:et:ts=2:sw=2: mylogin mypassword 5222 - /openils/var/log/gateway.log + LOCALSTATEDIR/log/gateway.log 3 @@ -128,7 +128,7 @@ vim:et:ts=2:sw=2: 5 - /openils/var/log/router.log + LOCALSTATEDIR/log/router.log 2 diff --git a/examples/srfsh.xml.example b/examples/srfsh.xml.example index bf635f6..e8dd6be 100644 --- a/examples/srfsh.xml.example +++ b/examples/srfsh.xml.example @@ -6,6 +6,6 @@ myusername mypassword 5222 - /path/to/log/srfsh.log + LOCALSTATEDIR/log/srfsh.log 4 diff --git a/src/Makefile.am b/src/Makefile.am index 37371d7..754f7fc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -23,13 +23,11 @@ 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 @@ -46,6 +44,10 @@ endif SUBDIRS = libopensrf c-apps router srfsh jserver gateway $(MAYBE_PY) $(MAYBE_JA) install-data-local: + mkdir -p $(VAR) + mkdir -p $(PID) + mkdir -p $(LOG) + mkdir -p $(SOCK) mkdir -p $(JSDIR) mkdir -p $(PERLDIR) mkdir -p $(ETCDIR) @@ -53,6 +55,12 @@ install-data-local: mv $(BINDIR)/opensrf $(BINDIR)/opensrf-c cp ../bin/osrf_config $(BINDIR) cp ../bin/osrf_ctl.sh $(BINDIR) + sed -i 's|LOCALSTATEDIR|$(VAR)|g' '../examples/opensrf.xml.example' + sed -i 's|SYSCONFDIR|$(ETCDIR)|g' '../examples/opensrf.xml.example' + sed -i 's|LOCALSTATEDIR|$(VAR)|g' '../examples/opensrf_core.xml.example' + sed -i 's|SYSCONFDIR|$(ETCDIR)|g' '../examples/opensrf_core.xml.example' + sed -i 's|LOCALSTATEDIR|$(VAR)|g' '../examples/srfsh.xml.example' + sed -i 's|SYSCONFDIR|$(ETCDIR)|g' '../examples/srfsh.xml.example' cp ../examples/opensrf.xml.example $(ETCDIR) cp ../examples/opensrf_core.xml.example $(ETCDIR) cp ../examples/srfsh.xml.example $(ETCDIR) diff --git a/src/libopensrf/Makefile.am b/src/libopensrf/Makefile.am index d49f181..0afb912 100644 --- a/src/libopensrf/Makefile.am +++ b/src/libopensrf/Makefile.am @@ -12,7 +12,7 @@ # 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_CFLAGS = $(DEF_CFLAGS) -DASSUME_STATELESS -DOSRF_STRICT_PARAMS -rdynamic -fno-strict-aliasing -L./.libs/ -DOSRF_JSON_ENABLE_XML_UTILS AM_LDFLAGS = $(DEF_LDFLAGS) LDADD = -lxml2 -ldl -lmemcache -lopensrf -lobjson -- 2.11.0