From 4905c45e5902b4ac576270d093249e0f4adeb3ce Mon Sep 17 00:00:00 2001 From: dbs Date: Sun, 31 May 2009 19:49:00 +0000 Subject: [PATCH] Use autotools a bit more to our advantage: * In osrf_ctl.sh, use the configured location for osrf_config by default * Differentiate between prefix and exec_prefix to respect configure options * Make configure output slightly more consistent git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1708 9efc2488-bf62-4759-914b-345cdb29e865 --- bin/osrf_config.in | 2 +- bin/{osrf_ctl.sh => osrf_ctl.sh.in} | 27 ++++++++------------------- configure.ac | 10 ++++++---- src/Makefile.am | 4 ++-- 4 files changed, 17 insertions(+), 26 deletions(-) rename bin/{osrf_ctl.sh => osrf_ctl.sh.in} (94%) diff --git a/bin/osrf_config.in b/bin/osrf_config.in index 9bd18fb..a61bfe8 100644 --- a/bin/osrf_config.in +++ b/bin/osrf_config.in @@ -17,7 +17,7 @@ # Shows configuration options of OSRF prefix=@prefix@ -exec_prefix=@prefix@ +exec_prefix=@exec_prefix@ datarootdir=@datarootdir@ function showInstalled { diff --git a/bin/osrf_ctl.sh b/bin/osrf_ctl.sh.in similarity index 94% rename from bin/osrf_ctl.sh rename to bin/osrf_ctl.sh.in index e7e34b9..b457f19 100755 --- a/bin/osrf_ctl.sh +++ b/bin/osrf_ctl.sh.in @@ -10,6 +10,12 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. +# Strictness to avoid folly +set -e +set -u + +prefix=@prefix@ +exec_prefix=@exec_prefix@ OPT_ACTION="" OPT_CONFIG="" @@ -57,23 +63,6 @@ function usage { exit; } -# Get root directory of this script -function basepath { - BASEDIR="" - script_path="$1" - IFS="/" - for p in $script_path - do - if [ -z "$BASEDIR" ] && [ -n "$p" ]; then - BASEDIR="$p" - fi; - done - BASEDIR="/$BASEDIR" - IFS= -} - -basepath $0 - # --------------------------------------------------------------------------- # Load the command line options and set the global vars # --------------------------------------------------------------------------- @@ -87,8 +76,8 @@ while getopts "a:d:c:lh" flag; do esac; done -OSRF_CONFIG=`which osrf_config` -[ -z "$OSRF_CONFIG" ] && OSRF_CONFIG=`find $BASEDIR -name osrf_config` +OSRF_CONFIG="@bindir@/osrf_config" +[ ! -f "$OSRF_CONFIG" ] && OSRF_CONFIG=`which osrf_config` [ -z "$OPT_CONFIG" ] && OPT_CONFIG=`$OSRF_CONFIG --sysconfdir`/opensrf_core.xml; if [ ! -r "$OPT_CONFIG" ]; then diff --git a/configure.ac b/configure.ac index 9a41285..a12e22e 100644 --- a/configure.ac +++ b/configure.ac @@ -29,6 +29,7 @@ AC_PREFIX_DEFAULT([/opensrf/]) AC_SUBST(prefix) AC_SUBST(sysconfdir) +AC_SUBST(bindir) AC_DEFUN([AC_PYTHON_MOD],[ @@ -113,19 +114,19 @@ 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 dir 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 configuration 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]) @@ -262,7 +263,8 @@ AC_CONFIG_FILES([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]) + bin/osrf_config + bin/osrf_ctl.sh]) AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am index 8ca9c62..d695ad0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -35,8 +35,8 @@ endif SUBDIRS = libopensrf c-apps router srfsh jserver gateway perl $(MAYBE_PY) $(MAYBE_JA) -dist_bin_SCRIPTS = @top_srcdir@/bin/osrf_ctl.sh @top_srcdir@/bin/opensrf-perl.pl -bin_SCRIPTS = @top_srcdir@/bin/osrf_config +dist_bin_SCRIPTS = @top_srcdir@/bin/opensrf-perl.pl +bin_SCRIPTS = @top_srcdir@/bin/osrf_config @top_srcdir@/bin/osrf_ctl.sh dist_sysconf_DATA = @top_srcdir@/examples/opensrf.xml.example @top_srcdir@/examples/opensrf_core.xml.example @top_srcdir@/examples/srfsh.xml.example -- 2.43.2