chiark / gitweb /
Guess sox generation in configure script
authorRichard Kettlewell <richard@deodand>
Tue, 23 Dec 2008 20:57:49 +0000 (20:57 +0000)
committerRichard Kettlewell <richard@deodand>
Tue, 23 Dec 2008 20:57:49 +0000 (20:57 +0000)
configure.ac
doc/disorder_config.5.in
lib/configuration.c

index a45d6edaf3b499e4c1c73a6ef5166df0ac9ac2c6..0f8f91c301c29df0bfd9d05f6060817f4f371f8a 100644 (file)
@@ -41,6 +41,7 @@ want_coreaudio=yes
 
 # Checks for programs.
 AC_PROG_CC
 
 # Checks for programs.
 AC_PROG_CC
+AC_PROG_AWK
 AC_SET_MAKE
 if test "x$GCC" = xyes; then
   gcc_werror=-Werror
 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])
 
 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])],
 AC_ARG_WITH([server],
            [AS_HELP_STRING([--without-server],
                            [do not build server])],
index 58526c5dfdff769e3763e3ffd8b66e2c8bdbabee..e2f1ab0ec181dd680a2608ea7c70c31d1625491c 100644 (file)
@@ -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 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.
 .TP
 .B speaker_backend \fINAME
 This is an alias for \fBapi\fR; see above.
index e63716e4c5fd175c95de73e7c47e922ce9658d0c..2a0b89ce0dfb5837017d993400072e52dfa8ad96 100644 (file)
@@ -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->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);
   /* Default stopwords */
   if(config_set(&cs, (int)NDEFAULT_STOPWORDS, (char **)default_stopwords))
     exit(1);