Use autotools a bit more to our advantage:
authordbs <dbs@9efc2488-bf62-4759-914b-345cdb29e865>
Sun, 31 May 2009 19:49:00 +0000 (19:49 +0000)
committerdbs <dbs@9efc2488-bf62-4759-914b-345cdb29e865>
Sun, 31 May 2009 19:49:00 +0000 (19:49 +0000)
  * 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
bin/osrf_ctl.sh.in [moved from bin/osrf_ctl.sh with 94% similarity]
configure.ac
src/Makefile.am

index 9bd18fb..a61bfe8 100644 (file)
@@ -17,7 +17,7 @@
 # Shows configuration options of OSRF
 
 prefix=@prefix@
-exec_prefix=@prefix@
+exec_prefix=@exec_prefix@
 datarootdir=@datarootdir@
 
 function showInstalled {
similarity index 94%
rename from bin/osrf_ctl.sh
rename to bin/osrf_ctl.sh.in
index e7e34b9..b457f19 100755 (executable)
 # 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
index 9a41285..a12e22e 100644 (file)
@@ -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
index 8ca9c62..d695ad0 100644 (file)
@@ -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