From: dbs Date: Fri, 27 Nov 2009 22:47:49 +0000 (+0000) Subject: Partial fix for launchpad bug 489294: OpenSRF seems to depend on explicit --prefix... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b2fe63d8cc9d5a480ff581c712ca209f0a4df645;p=working%2FOpenSRF.git Partial fix for launchpad bug 489294: OpenSRF seems to depend on explicit --prefix configure option In the process of creating Perl and Python scripts using AC_SUBST(sysconfdir), autoconf would generate variables like '${prefix}' if no explicit --prefix option was passed to configure - and this would cause those scripts to fail with syntax errors. We can work around that, and so we shall. The bigger question is whether creating scripts with hardcoded defaults results in problems when it comes to creating system packages; according to http://www.gnu.org/software/hello/manual/autoconf/Installation-Directory-Variables.html one should try to defer these changes to the Makefile so that the destination directory can be specified at make or make install time, instead. At least this gets us working with no explicit configure options again. Perhaps a packaging expert can help us out of this mire :) git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1863 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/bin/opensrf-perl.pl.in b/bin/opensrf-perl.pl.in index e650115..80b7df6 100755 --- a/bin/opensrf-perl.pl.in +++ b/bin/opensrf-perl.pl.in @@ -27,7 +27,7 @@ use OpenSRF::Utils::Config; my $opt_action = undef; my $opt_service = undef; -my $opt_config = "@sysconfdir@/opensrf_core.xml"; +my $opt_config = "@CONF_DIR@/opensrf_core.xml"; my $opt_pid_dir = "@TMP@"; my $opt_no_daemon = 0; my $opt_settings_pause = 0; @@ -215,7 +215,7 @@ sub msg { sub do_help { print < Actions include start, stop, restart, and start_all, stop_all, and restart_all diff --git a/configure.ac b/configure.ac index ddf5e70..c5e04e9 100644 --- a/configure.ac +++ b/configure.ac @@ -24,11 +24,20 @@ 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) diff --git a/doc/dokuwiki-doc-stubber.pl.in b/doc/dokuwiki-doc-stubber.pl.in index 021f7d4..1edd4d1 100755 --- a/doc/dokuwiki-doc-stubber.pl.in +++ b/doc/dokuwiki-doc-stubber.pl.in @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -use OpenSRF::System qw(@sysconfdir@/opensrf_core.xml); +use OpenSRF::System qw(@CONF_DIR@/opensrf_core.xml); use Getopt::Long $| = 1; diff --git a/examples/math_bench.pl.in b/examples/math_bench.pl.in index 5831e71..7752579 100755 --- a/examples/math_bench.pl.in +++ b/examples/math_bench.pl.in @@ -13,7 +13,7 @@ my $count = $ARGV[0]; print "usage: $0 \n" and exit unless $count; # * connect to the Jabber network -OpenSRF::System->bootstrap_client( config_file => "@sysconfdir@/opensrf_core.xml" ); +OpenSRF::System->bootstrap_client( config_file => "@CONF_DIR@/opensrf_core.xml" ); $log->set_service('math_bench'); # * create a new application session for the opensrf.math service diff --git a/examples/math_client.py.in b/examples/math_client.py.in index 77d5885..d0e048d 100644 --- a/examples/math_client.py.in +++ b/examples/math_client.py.in @@ -3,7 +3,7 @@ import osrf.system import osrf.ses # XXX: Replace with command line arguments -file = '@sysconfdir@/opensrf_core.xml' +file = '@CONF_DIR@/opensrf_core.xml' operator = 'add' operand1 = 5 operand2 = 7