shithub: sox

Download patch

ref: fb0d5ff0e80305c2dd6e089884c744af4d39850a
parent: 98267de439714fcdff94c9588f34fb8a67df70c1
author: cbagwell <cbagwell>
date: Fri Feb 5 22:53:46 EST 1999

Changed #defines to be "configure" friendly.  Also updated unix makefiles to
work with cygwin compilers better.

--- a/Changelog
+++ b/Changelog
@@ -22,7 +22,8 @@
     effect on STDIN and output the results to STDOUT.
   o Fixed up some makefiles and 16-bit support from patches sent by
     Mark Morgan Lloyd (markMLl.in@telemetry.co.uk).  Also added some
-    nice DOS test bat files from him as well.
+    nice DOS test bat files from him as well.  They only work with
+    an advanced setup like 4DOS or some such thing.
   o Cleaned up some more cross-platform compile problems.  In the process
     got it working with Turbo C again, kinda.  It still locks DOS up at times.
 
--- a/Makefile
+++ b/Makefile
@@ -117,50 +117,50 @@
 #
 # If you don't have any getopt() function then use the following
 # define to use Sox's builtin version
-# GETOPT_DEFINES	= -DNEED_GETOPT
+# GETOPT_DEFINES	= -DHAVE_GETOPT
 #
 # If your system has the more advanced version of getopt() that
 # also has its own getopt.h file (Such as the case with GNU libc 2.0)
 # then uncomment the following line.  Don't uncomment anything if
 # its in stdlib.h.
-GETOPT_DEFINES	= -DHAS_GETOPT_H
+GETOPT_DEFINES	= -DHAVE_GETOPT_H
 
 # Uncomment the following if your system does not have a built in
 # strerror().  This includes SunOS.
 #
-# STRERR_DEFINES	= -DNEED_STRERROR
+# STRERR_DEFINES	= -DHAVE_STRERROR
 
 # Uncomment the following if your system does not have a built in
 # MEMMOVE function.  Sox will attempt to use bcopy instead.
 # SunOS has this problem.
 #
-# MEMMOVE_DEFINES	= -DNEED_MEMMOVE
+# MEMMOVE_DEFINES	= -DHAVE_MEMMOVE
 
 # If you have the GSM 6.10 libraries installed then uncomment the follow
 # 4 lines, and change to reflect your installation paths.
 #
-GSM_PRE_LIBS	= -L/usr/local/lib
-GSM_POST_LIBS	= -lgsm
-GSM_INCLUDES	= -I/usr/local/include/
-GSM_DEFINES	= -DHAS_GSM
+#GSM_PRE_LIBS	= -L/usr/local/lib
+#GSM_POST_LIBS	= -lgsm
+#GSM_INCLUDES	= -I/usr/local/include/
+#GSM_DEFINES	= -DHAS_GSM
 
 # For sound support on machines that include the OSS sound driver
 # (such as Linux) then uncomment the following line.
 #
-OSS_DEFINES	= -DOSS_PLAYER
+#PLAYER_DEFINES	= -DOSS_PLAYER
 
 # For sound support under SunOS and Solaris then uncomment the following line.
 #
-# SUNAUDIO_DEFINES = -DSUNAUDIO_PLAYER
+# PLAYER_DEFINES = -DSUNAUDIO_PLAYER
 
 # For sound support on 386 AT&T Unix then uncomment the following line
 #
-# BLASTER_DEFINES = -DBLASTER
+# PLAYER_DEFINES = -DBLASTER
 
 # For sound support on Intel BSD-derived Unix's using Steve Haenichen's SBLAST
 # driver uncomment the following line.
 #
-# SBLAST_DEFINES = -DSBLAST
+# PLAYER_DEFINES = -DSBLAST
 
 # Uncomment the following lines if your compiling under DOS or Windows.
 # defines .snd to mean a DOS soundtool file (starts with SOUND)
@@ -173,12 +173,6 @@
 #
 # NEXT_DEFINES	= -DNeXT
 
-# Uncomment the following line if compling under MacIntosh
-# defines .snd to mean a Mac-style headerless unsigned byte
-#  	sample, probably at 11050 hertz.  You'll have to set 
-#	the speed on the command line.
-# MAC_DEFINES	= -DMAC
-
 # MISC DEFINES - The catch all for things that make even less sense
 #  then normal under unix.  If you need more than one of the following
 #  MISC DEFINES remember to include them on one line so it isn't just
@@ -215,9 +209,9 @@
 SOX_PRE_LIBS	= $(GSM_PRE_LIBS)
 SOX_POST_LIBS	= $(GSM_POST_LIBS) -lm
 SOX_INCLUDES	= $(GSM_INCLUDES)
-SOX_DEFINES	= $(GSM_DEFINES) $(OSS_DEFINES) $(SUNAUDIO_DEFINES) \
-  $(BLASTER) $(GETOPT_DEFINES) $(STRERR_DEFINES) $(MEMMOVE_DEFINES) \
-  $(NEXT_DEFINES) $(MAC_DEFINES) $(MISC_DEFINES)
+SOX_DEFINES	= $(GSM_DEFINES) $(PLAYER_DEFINES) \
+  $(GETOPT_DEFINES) $(STRERR_DEFINES) $(MEMMOVE_DEFINES) \
+  $(DOS_DEFINES) $(NEXT_DEFINES) $(MISC_DEFINES)
 
 CFLAGS  = $O $(SOX_DEFINES) $(SOX_INCLUDES)
 
--- a/Makefile.dos
+++ b/Makefile.dos
@@ -50,13 +50,13 @@
 CC      = $(BINDIR)\tcc
 #CC      = $(BINDIR)\bcc
 LDD	= $(BINDIR)\tlib
-CFLAGS  = -DDOS -DNEED_GETOPT -D__STDC__=1 -a -c -mh -G -O -v -N
+CFLAGS  = -DDOS -DHAVE_GETOPT -D__STDC__=1 -a -c -mh -G -O -v -N
 LFLAGS  = -v -mh
 
 # MS VC needs the following. /AL uses large memory model.
 #CC	= cl
 #LDD	= lib
-#CFLAGS	= -DDOS -D__STDC__=1 -DNEED_GETOPT -c -O /AL /Gt8192
+#CFLAGS	= -DDOS -D__STDC__=1 -DHAVE_GETOPT -c -O /AL /Gt8192
 #LFLAGS	= /AL /Gt8192
 
 .c.obj:
--- a/Makefile.os9
+++ b/Makefile.os9
@@ -8,7 +8,7 @@
 # Boisy G. Pitre (boisy@microware.com)
 
 RDIR	=	RELS
-CFLAGS	=	-ai -DOS9 -DNEED_GETOPT	# use strict ANSI mode, shared libraries
+CFLAGS	=	-ai -DOS9 -DHAVE_GETOPT	# use strict ANSI mode, shared libraries
 LFLAGS	=	$(CFLAGS) -l=/dd/lib/sys_clib.l
 CC		=	cc
 
--- a/Makefile.unx
+++ b/Makefile.unx
@@ -117,50 +117,50 @@
 #
 # If you don't have any getopt() function then use the following
 # define to use Sox's builtin version
-# GETOPT_DEFINES	= -DNEED_GETOPT
+# GETOPT_DEFINES	= -DHAVE_GETOPT
 #
 # If your system has the more advanced version of getopt() that
 # also has its own getopt.h file (Such as the case with GNU libc 2.0)
 # then uncomment the following line.  Don't uncomment anything if
 # its in stdlib.h.
-GETOPT_DEFINES	= -DHAS_GETOPT_H
+GETOPT_DEFINES	= -DHAVE_GETOPT_H
 
 # Uncomment the following if your system does not have a built in
 # strerror().  This includes SunOS.
 #
-# STRERR_DEFINES	= -DNEED_STRERROR
+# STRERR_DEFINES	= -DHAVE_STRERROR
 
 # Uncomment the following if your system does not have a built in
 # MEMMOVE function.  Sox will attempt to use bcopy instead.
 # SunOS has this problem.
 #
-# MEMMOVE_DEFINES	= -DNEED_MEMMOVE
+# MEMMOVE_DEFINES	= -DHAVE_MEMMOVE
 
 # If you have the GSM 6.10 libraries installed then uncomment the follow
 # 4 lines, and change to reflect your installation paths.
 #
-GSM_PRE_LIBS	= -L/usr/local/lib
-GSM_POST_LIBS	= -lgsm
-GSM_INCLUDES	= -I/usr/local/include/
-GSM_DEFINES	= -DHAS_GSM
+#GSM_PRE_LIBS	= -L/usr/local/lib
+#GSM_POST_LIBS	= -lgsm
+#GSM_INCLUDES	= -I/usr/local/include/
+#GSM_DEFINES	= -DHAS_GSM
 
 # For sound support on machines that include the OSS sound driver
 # (such as Linux) then uncomment the following line.
 #
-OSS_DEFINES	= -DOSS_PLAYER
+#PLAYER_DEFINES	= -DOSS_PLAYER
 
 # For sound support under SunOS and Solaris then uncomment the following line.
 #
-# SUNAUDIO_DEFINES = -DSUNAUDIO_PLAYER
+# PLAYER_DEFINES = -DSUNAUDIO_PLAYER
 
 # For sound support on 386 AT&T Unix then uncomment the following line
 #
-# BLASTER_DEFINES = -DBLASTER
+# PLAYER_DEFINES = -DBLASTER
 
 # For sound support on Intel BSD-derived Unix's using Steve Haenichen's SBLAST
 # driver uncomment the following line.
 #
-# SBLAST_DEFINES = -DSBLAST
+# PLAYER_DEFINES = -DSBLAST
 
 # Uncomment the following lines if your compiling under DOS or Windows.
 # defines .snd to mean a DOS soundtool file (starts with SOUND)
@@ -173,12 +173,6 @@
 #
 # NEXT_DEFINES	= -DNeXT
 
-# Uncomment the following line if compling under MacIntosh
-# defines .snd to mean a Mac-style headerless unsigned byte
-#  	sample, probably at 11050 hertz.  You'll have to set 
-#	the speed on the command line.
-# MAC_DEFINES	= -DMAC
-
 # MISC DEFINES - The catch all for things that make even less sense
 #  then normal under unix.  If you need more than one of the following
 #  MISC DEFINES remember to include them on one line so it isn't just
@@ -215,9 +209,9 @@
 SOX_PRE_LIBS	= $(GSM_PRE_LIBS)
 SOX_POST_LIBS	= $(GSM_POST_LIBS) -lm
 SOX_INCLUDES	= $(GSM_INCLUDES)
-SOX_DEFINES	= $(GSM_DEFINES) $(OSS_DEFINES) $(SUNAUDIO_DEFINES) \
-  $(BLASTER) $(GETOPT_DEFINES) $(STRERR_DEFINES) $(MEMMOVE_DEFINES) \
-  $(NEXT_DEFINES) $(MAC_DEFINES) $(MISC_DEFINES)
+SOX_DEFINES	= $(GSM_DEFINES) $(PLAYER_DEFINES) \
+  $(GETOPT_DEFINES) $(STRERR_DEFINES) $(MEMMOVE_DEFINES) \
+  $(DOS_DEFINES) $(NEXT_DEFINES) $(MISC_DEFINES)
 
 CFLAGS  = $O $(SOX_DEFINES) $(SOX_INCLUDES)
 
--- a/TODO
+++ b/TODO
@@ -8,7 +8,7 @@
     standard, weither inferer or not.
 
   o Add GSM support to WAV format.
-
+ 
   o highpass and lowpass filters don't let you specify the cut
     of freq.  Need some improvements to these filters.
 
--- a/src/cvsd.c
+++ b/src/cvsd.c
@@ -50,7 +50,7 @@
 
 /* ---------------------------------------------------------------------- */
 
-#ifdef NEED_MEMMOVE
+#ifndef HAVE_MEMMOVE
 #define memmove(dest,src,len) (bcopy((src),(dest),(len)))
 #endif
 
--- a/src/getopt.c
+++ b/src/getopt.c
@@ -46,7 +46,7 @@
 
 int ansi_c_needs_something_here_too;
 
-#ifdef NEED_GETOPT
+#ifndef HAVE_GETOPT
 #include <stdio.h>
 
 #include <string.h>
--- a/src/misc.c
+++ b/src/misc.c
@@ -414,7 +414,7 @@
 }
 
 
-#ifdef	NEED_STRERROR
+#ifdef	HAVE_STRERROR
 /* strerror function */
 char *strerror(errcode)
 int errcode;
--- a/src/sox.c
+++ b/src/sox.c
@@ -40,8 +40,10 @@
 #include <unistd.h>		/* for unlink() */
 #endif
 
-#ifdef HAS_GETOPT_H
+#ifdef HAVE_GETOPT_H
 #include <getopt.h>
+#else
+int getopt(P3(int,char **,char *));
 #endif
 
 #ifdef VMS
@@ -80,9 +82,6 @@
 void statistics();
 LONG volumechange();
 void checkeffect(P1(eff_t));
-#ifdef NEED_GETOPT
-int getopt(P3(int,char **,char *));
-#endif
 int flow_effect(P1(int));
 int drain_effect(P1(int));
 
@@ -232,7 +231,7 @@
 	return(0);
 }
 
-#ifdef HAS_GETOPT_H
+#ifdef HAVE_GETOPT_H
 char *getoptstr = "+r:v:t:c:phsuUAagbwlfdDxV";
 #else
 char *getoptstr = "r:v:t:c:phsuUAagbwlfdDxV";
--- a/src/tests.sh
+++ b/src/tests.sh
@@ -1,7 +1,10 @@
 #!/bin/sh
-# test files
+#
 # SOX Test script.  This should run without core-dumping or printing any
-# messages.
+# messages from the compare program.
+#
+# This script is manual just quick sanity check of SOX.
+
 file=monkey
 
 # verbose options
@@ -12,8 +15,10 @@
 ./sox $noise -t raw -r 8196 -u -b -c 1 ub.raw -r 8196 -s -b sb.raw
 ./sox $noise -t raw -r 8196 -s -b -c 1 sb.raw -r 8196 -u -b ub2.raw
 ./sox $noise -r 8196 -u -b -c 1 ub2.raw -r 8196 ub2.voc 
+echo Comparing ub.raw o ub2.raw
 cmp -l ub.raw ub2.raw
 # skip checksum and rate byte
+echo Comparing $file.voc to ub2.voc, ignoring Comment field
 cmp -l $file.voc ub2.voc | grep -v '^    2[3456]' | grep -v '^    31'
 rm -f ub.raw sb.raw ub2.raw ub2.voc
 ./sox $noise $file.au -u -r 8192 -u -b ub.raw
@@ -23,7 +28,7 @@
 rm -f ub.raw ub.au ub2.raw ub.sf 
 ./sox $noise ub2.sf ub2.aiff
 ./sox $noise ub2.aiff ub3.sf
-# skip comment field containing differnt filenames
+echo Comparing ub2.sf to ub3.sf, ignoring Comment field
 cmp -l ub2.sf ub3.sf | grep -v '^    2[3456789]'
 rm -f ub2.sf ub2.aiff ub3.sf
 #