From 419893d77041c006cb22eeaa189f9797773fbdc1 Mon Sep 17 00:00:00 2001 Message-Id: <419893d77041c006cb22eeaa189f9797773fbdc1.1715511510.git.mdw@distorted.org.uk> From: Mark Wooding Date: Tue, 23 Dec 2008 20:57:49 +0000 Subject: [PATCH] Guess sox generation in configure script Organization: Straylight/Edgeware From: Richard Kettlewell --- configure.ac | 32 ++++++++++++++++++++++++++++++++ doc/disorder_config.5.in | 5 ++++- lib/configuration.c | 1 + 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index a45d6ed..0f8f91c 100644 --- a/configure.ac +++ b/configure.ac @@ -41,6 +41,7 @@ want_coreaudio=yes # Checks for programs. AC_PROG_CC +AC_PROG_AWK AC_SET_MAKE if test "x$GCC" = xyes; then gcc_werror=-Werror @@ -167,6 +168,37 @@ if test -z "$browser"; then fi AC_DEFINE_UNQUOTED([BROWSER],["$browser"],[HTML viewer]) +# Figure out what version of sox is installed +AC_CACHE_CHECK([sox version],[rjk_cv_soxver],[ + rjk_cv_soxver=UNKNOWN + if sox --version > /dev/null 2>&1; then + rjk_cv_soxver=`sox --version|$AWK '{ if(match($0, /[[0-9\.]]+/)) print substr($0,RSTART,RLENGTH)}'` + else + rjk_cv_soxver=`sox -h 2>&1|$AWK '/Version/ { if(match($0, /[[0-9\.]]+/)) print substr($0,RSTART,RLENGTH)}'` + fi +]) + +# Decide what command line options to use +# +# sox version endian bits deployed +# 12.17.9 -x -[bwld] debian etch, ubuntu dapper +# 14.0.0 -x/-[BL] -[bwld] ubuntu hardy +# 14.0.1 -x/-[BL] -[1248] debian lenny +# 14.2.0 -x/-[BL] -[1248] debian sid (at 2008-12) + +AC_CACHE_CHECK([default sox generation],[rjk_cv_soxgen],[ + case $rjk_cv_soxver in + [0-9].* | 1[0123].* ) + rjk_cv_soxgen=0 + ;; + * ) + rjk_cv_soxgen=1 + ;; + esac +]) +AC_DEFINE_UNQUOTED([DEFAULT_SOX_GENERATION],[$rjk_cv_soxgen], + [default sox generation]) + AC_ARG_WITH([server], [AS_HELP_STRING([--without-server], [do not build server])], diff --git a/doc/disorder_config.5.in b/doc/disorder_config.5.in index 58526c5..e2f1ab0 100644 --- a/doc/disorder_config.5.in +++ b/doc/disorder_config.5.in @@ -646,7 +646,10 @@ Determines whether calls to \fBsox\fR(1) should use \fB\-b\fR, \fB\-x\fR, etc (i the generation is 0) or \fB\-\fIbits\fR, \fB\-L\fR etc (if it is 1). See the documentation for your installed copy of \fBsox\fR to determine which you need. -The default is 0. +The default is set according to the version of sox found when DisOrder was +built. +If you run on a system with a different version of sox, you will need to +set this option. .TP .B speaker_backend \fINAME This is an alias for \fBapi\fR; see above. diff --git a/lib/configuration.c b/lib/configuration.c index e63716e..2a0b89c 100644 --- a/lib/configuration.c +++ b/lib/configuration.c @@ -1196,6 +1196,7 @@ static struct config *config_default(void) { c->reminder_interval = 600; /* 10m */ c->new_bias_age = 7 * 86400; /* 1 week */ c->new_bias = 4500000; /* 50 times the base weight */ + c->sox_generation = DEFAULT_SOX_GENERATION; /* Default stopwords */ if(config_set(&cs, (int)NDEFAULT_STOPWORDS, (char **)default_stopwords)) exit(1); -- [mdw]