--- esound-0.2.29.orig/docs/esd-config.pod
+++ esound-0.2.29/docs/esd-config.pod
@@ -0,0 +1,37 @@
+=head1 NAME
+
+esd-config - The Enlightened Sound Daemon
+
+=head1 DESCRIPTION
+
+esd-config  is  a tool that is used to configure to deter­
+mine the compiler and linker flags that should be used  to
+compile  and  link programs that use EsounD. It is also used
+internally to the .m4 macros for  GNU  autoconf  that  are
+included with EsounD.
+
+=head1 USAGE
+
+esd-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--libs] [--cflags]
+
+B<--version> Print the currently installed version of EsounD on the standard output.
+
+B<--libs>    Print the linker flags that are necessary to  link an EsounD program.
+
+B<--cflags>  Print the compiler flags that are necessary to compile an EsounD program.
+
+B<--prefix=PREFIX> If specified, use PREFIX instead of the  installation prefix that EsounD was 
+built with when computing the output for the --cflags and --libs options.  
+This option is also used for the exec prefix if --exec-prefix was not 
+specified. This option must be specified before any --libs or --cflags options.
+
+B<--exec-prefix=PREFIX> If specified, use PREFIX instead of the installation  
+exec prefix that EsounD was built with when computing the output for the 
+--cflags and --libs options. This option must be specified before any --libs 
+or --cflags options.
+
+=head1 SEE ALSO
+
+esd(1), esdcat(1), esddsp(1), esdloop(1), esdplay(1), esdsample(1),
+esdctl(1), esdfilt(1), esdmon(1), esdrec(1)
+
--- esound-0.2.29.orig/docs/esdcat.pod
+++ esound-0.2.29/docs/esdcat.pod
@@ -0,0 +1,16 @@
+=head1 NAME
+
+esdcat - The Enlightened Sound Daemon
+
+=head1 DESCRIPTION
+
+esdcat pipes data from a pipe to the sound device
+
+=head1 USAGE
+
+esdcat [C<-s> server] [C<-b>] [C<-m>] [C<-r> freq] < file
+
+=head1 SEE ALSO
+
+esd(1), esddsp(1), esdfilt(1), esdloop(1), esdplay(1), esdsample(1),
+esd-config(1), esdctl(1), esdmon(1), esdrec(1)
--- esound-0.2.29.orig/docs/esdmon.pod
+++ esound-0.2.29/docs/esdmon.pod
@@ -0,0 +1,27 @@
+=head1 NAME
+
+esdmon - The Enlightened Sound Daemon
+
+=head1 DESCRIPTION
+
+EsounD monitor.  Opens the esd socket and duplicates the stream being
+sent to the sound device.
+
+=head1 USAGE
+
+esdmon [OPTIONS] [FILE] 
+
+Options:
+
+C<-s>, --server=HOSTNAME set EsounD server
+C<-b>, output file should be 8-bit
+C<-m>, output file should be mono
+C<-r> RATE, set output rate to RATE
+
+FILE is the file to write the output stream to.  Default is stdout.
+
+=head1 SEE ALSO
+
+esd(1), esdcat(1), esddsp(1), esdloop(1), esdplay(1), esdsample(1),
+esd-config(1), esdctl(1), esdfilt(1), esdrec(1)
+
--- esound-0.2.29.orig/docs/esdrec.pod
+++ esound-0.2.29/docs/esdrec.pod
@@ -0,0 +1,17 @@
+=head1 NAME
+
+esdrec - The Enlightened Sound Daemon
+
+=head1 DESCRIPTION
+
+EsounD recorder
+
+=head1 USAGE
+
+esdrec [C<-s> server] [C<-b>] [C<-m>] [C<-r> freq] < file
+
+=head1 SEE ALSO
+
+esd(1), esdcat(1), esddsp(1), esdloop(1), esdplay(1), esdsample(1),
+esd-config(1), esdctl(1), esdfilt(1), esdmon(1)
+
--- esound-0.2.29.orig/docs/esdsample.pod
+++ esound-0.2.29/docs/esdsample.pod
@@ -0,0 +1,17 @@
+=head1 NAME
+
+esdsample - The Enlightened Sound Daemon
+
+=head1 DESCRIPTION
+
+EsounD sampler
+
+=head1 USAGE
+
+esdsample [C<-s> server] [C<-d> [C<-b>] [C<-m>] [C<-r> freq]] < file
+
+=head1 SEE ALSO
+
+esd(1), esdcat(1), esddsp(1), esdloop(1), esdplay(1), 
+esd-config(1), esdctl(1), esdfilt(1), esdmon(1), esdrec(1)
+
--- esound-0.2.29.orig/docs/esdfilt.pod
+++ esound-0.2.29/docs/esdfilt.pod
@@ -0,0 +1,27 @@
+=head1 NAME
+
+esdfilt - The Enlightened Sound Daemon
+
+=head1 DESCRIPTION
+
+EsounD filter.  Sample esd filter program that implements halving and doubling,
+Optionally writing the new data to a seperate file.
+
+=head1 USAGE
+
+esdfilt [OPTIONS] [FILE]
+
+C<-s>, --server=HOSTNAME set EsounD server
+C<-b>, output file should be 8-bit
+C<-m>, output file should be mono
+C<-r> RATE, set output rate to RATE
+C<-half> halve each sample
+C<-double> double each sample
+
+If FILE is specified, the filtered output will be written there.  Otherwise
+it will be written back to esound to change the output to the sound device.
+
+=head1 SEE ALSO
+
+esd(1), esdcat(1), esddsp(1), esdloop(1), esdplay(1), esdsample(1),
+esd-config(1), esdctl(1), esdmon(1), esdrec(1)
--- esound-0.2.29.orig/docs/esdloop.pod
+++ esound-0.2.29/docs/esdloop.pod
@@ -0,0 +1,17 @@
+=head1 NAME
+
+esdloop - The Enlightened Sound Daemon
+
+=head1 DESCRIPTION
+
+esdloop is test scaffolding for sample cache, loop, and free.
+
+=head1 USAGE
+
+esdloop [C<-s> server ] [C<-b>] [C<-m>] [C<-r> freq] < file
+
+=head1 SEE ALSO
+
+esd(1), esdcat(1), esddsp(1), esdplay(1), esdsample(1),
+esd-config(1), esdctl(1), esdfilt(1), esdmon(1), esdrec(1)
+
--- esound-0.2.29.orig/docs/esdplay.pod
+++ esound-0.2.29/docs/esdplay.pod
@@ -0,0 +1,26 @@
+=head1 NAME
+
+esdplay - play the specified file using esound
+
+=head1 DESCRIPTION
+
+Plays the FILE with  EsounD.
+
+=head1 USAGE
+
+esdplay [OPTIONS] [FILE]
+
+Plays from standard in if FILE is not specified or is "-"
+
+Options:
+
+C<-s>, --server=HOSTNAME set EsounD server
+
+C<-h>, --help            display this help and exit
+
+C<-v>, --version         output version information and exit
+
+=head1 SEE ALSO
+
+esd(1), esdcat(1), esddsp(1), esdloop(1), esdsample(1),
+esd-config(1), esdctl(1), esdfilt(1), esdmon(1), esdrec(1)
--- esound-0.2.29.orig/docs/esddsp.pod
+++ esound-0.2.29/docs/esddsp.pod
@@ -0,0 +1,24 @@
+=head1 NAME
+
+esddsp - attempt to reroute audio device to esd
+
+=head1 DESCRIPTION
+
+esddsp can allow non-esd applications to be routed through esd.
+
+=head1 USAGE
+
+esddsp [options] player arguments
+ 
+options:
+
+ -h, --help                show brief help
+ -s, --server=HOST:PORT    contact esd server on host at port
+ -m, --mixer               enable mixer support
+ -n, --name=NAME           use name to identify player to esd
+ -v, --verbose             show parameters
+
+=head1 SEE ALSO
+
+esd(1), esdcat(1), esdloop(1), esdplay(1), esdsample(1),
+esd-config(1), esdctl(1), esdfilt(1), esdmon(1), esdrec(1)
--- esound-0.2.29.orig/docs/esd.pod
+++ esound-0.2.29/docs/esd.pod
@@ -0,0 +1,68 @@
+=head1 NAME
+
+esd - The Enlightened Sound Daemon
+
+=head1 DESCRIPTION
+
+Starts up EsounD, which provides a sound mixing server.
+
+=head1 USAGE
+
+esd [options]
+
+  -d DEVICE   force esd to use sound device DEVICE
+  -b          run server in 8 bit sound mode
+  -r RATE     run server at sample rate of RATE
+  -as SECS    free audio device after SECS of inactivity
+  -unix       use unix domain sockets instead of tcp/ip
+  -tcp        use tcp/ip sockets instead of unix domain
+  -public     make tcp/ip access public (other than localhost)
+  -terminate  terminate esd daemone after last client exits
+  -nobeeps    do not play startup beeps
+  -port PORT  listen for connections at PORT (only for tcp/ip)
+
+
+Possible devices are:  /dev/dsp, /dev/dsp2, etc.
+
+=head1 FILES
+
+/etc/esound/esd.conf			daemon configuration file
+
+/etc/esound/esd.conf is a file of key=value pairs.  There may also be a section
+delimiter to placate gnome_config.  There are three options:
+
+=head2 auto_spawn
+
+=over
+
+0 or 1 indicating whether the esd library should automatically spawn a
+daemon if one is not running when a sound is played.  This option is
+not recommended for Gnome users who have enabled sound for events in
+Gnome.
+
+=back
+
+=head2 spawn_options
+
+=over
+
+a string with the command line to be passed to esd when it is
+automatically spawned by the library
+
+=back
+
+=head2 spawn_wait_ms
+
+=over
+
+the number of miliseconds to wait for the daemon to successfully
+start.  If the daemon is not started by the timeout, the application
+will act as if the audio open failed.
+
+=back
+
+=head1 SEE ALSO
+
+esdcat(1), esddsp(1), esdloop(1), esdplay(1), esdsample(1),
+esd-config(1), esdctl(1), esdfilt(1), esdmon(1), esdrec(1)
+
--- esound-0.2.29.orig/docs/esdctl.pod
+++ esound-0.2.29/docs/esdctl.pod
@@ -0,0 +1,39 @@
+=head1 NAME
+
+esdctl - The Enlightened Sound Daemon
+
+=head1 DESCRIPTION
+
+Command-line control program for EsounD
+
+=head1 USAGE
+
+esdctl [options] [command]
+
+options:
+S<C<-s>, --server=host:port        contact esd server on host at port>
+
+commands:
+
+ lock                          foreign clients may not use the server
+ unlock                        foreign clients may use the server
+ standby, off                  suspend sound output for other programs
+ resume, on                    resume sound output
+ cache sample                  cache a sample in the server
+ getid name                    retrieve a sample id from its name
+ free name                     uncache a sample in the server
+ play name                     play a cached sample once
+ loop name                     make a cached sample loop
+ stop name                     stop the looping sample at end
+ serverinfo                    get server info from server
+ allinfo                       get player and sample info from server
+ panstream id left right set   panning for a stream
+ pansample id left right set   default panning for a sample
+                               - left/right pan values scaled to 256.
+ standbymode                   see if server's on standby, etc.
+
+=head1 SEE ALSO
+
+esd(1), esdcat(1), esddsp(1), esdloop(1), esdplay(1), esdsample(1),
+esd-config(1), esdfilt(1), esdmon(1), esdrec(1)     
+
--- esound-0.2.29.orig/esd.conf
+++ esound-0.2.29/esd.conf
@@ -1,4 +1,4 @@
 [esd]
-auto_spawn=1
-spawn_options=-terminate -nobeeps -as 2
+auto_spawn=0
+spawn_options=-terminate -nobeeps -as 5
 spawn_wait_ms=100
--- esound-0.2.29.orig/esdctl.c
+++ esound-0.2.29/esdctl.c
@@ -30,7 +30,7 @@
 	     "\n"
 	     "options:\n"
 	     "-s, --server=host:port        contact esd server on host at port\n"
-	     "-p, --prefix=string	    prefix for cached samples\n"
+	     "-p, --prefix=string           prefix for cached samples\n"
 	     "\n"
 	     "commands:\n"
 	     "lock                          foreign clients may not use the server\n"
--- esound-0.2.29.orig/esddsp.c
+++ esound-0.2.29/esddsp.c
@@ -26,6 +26,8 @@
 
 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
 
+#define _GNU_SOURCE 1
+
 #ifdef DSP_DEBUG
 #define DPRINTF(format, args...)	printf(format, ## args)
 #else
@@ -69,10 +71,13 @@
 typedef int request_t;
 #endif
 
-static int sndfd = -1, mixfd = -1;
-static int settings = 0, done = 0;
+static int sndfd = -1;
+static int mixfd = -1;
+static int settings = 0;
+static int done = 0;
 
-static char *ident = NULL, *mixer = NULL;
+static char *ident = NULL;
+static char *mixer = NULL;
 static int use_mixer = 0;
 
 #define OSS_VOLUME_BASE 50
@@ -115,8 +120,9 @@
   if (!ident)
     {
       char *str = getenv ("ESDDSP_NAME");
-      ident = malloc (ESD_NAME_MAX);
+      ident = malloc (ESD_NAME_MAX+1);
       strncpy (ident, (str ? str : "esddsp"), ESD_NAME_MAX);
+      ident[ESD_NAME_MAX] = '\0';
 
       if (getenv ("ESDDSP_MIXER"))
 	{
@@ -174,10 +180,10 @@
   va_list args;
   mode_t mode;
 
-  if (!func)
+  if (!func) {
     func = (int (*) (const char *, int, mode_t)) dlsym (REAL_LIBC, "open");
-
-  dsp_init ();
+    dsp_init ();
+  }
 
   va_start (args, flags);
   mode = va_arg (args, mode_t);
@@ -185,6 +191,11 @@
 
   if (!strcmp (pathname, "/dev/dsp"))
     {
+/* We shouldn't need this with Unix domain sockets, plus there
+ * is a better test in esdlib.c - for more info see:
+ * http://www.debian.org/Bugs/db/53/53602.html
+ * commented out by bma@debian.org 1999-12-29 */
+/*
       if (!getenv ("ESPEAKER"))
 	{
           int ret;
@@ -193,6 +204,7 @@
 	  if ((ret = (*func) (pathname, flags, mode)) >= 0)
 	    return ret;
 	}
+*/
 
       DPRINTF ("hijacking /dev/dsp open, and taking it to esd...\n");
       settings = done = 0;
@@ -272,13 +284,13 @@
 
       done = 1;
 
-      if (write (sndfd, &proto, sizeof (proto)) != sizeof (proto))
+      if (write (fd, &proto, sizeof (proto)) != sizeof (proto))
         return -1;
-      if (write (sndfd, &fmt, sizeof (fmt)) != sizeof (fmt))
+      if (write (fd, &fmt, sizeof (fmt)) != sizeof (fmt))
         return -1;
-      if (write (sndfd, &speed, sizeof (speed)) != sizeof (speed))
+      if (write (fd, &speed, sizeof (speed)) != sizeof (speed))
         return -1;
-      if (write (sndfd, ident, ESD_NAME_MAX) != ESD_NAME_MAX)
+      if (write (fd, ident, ESD_NAME_MAX) != ESD_NAME_MAX)
         return -1;
 
       fmt = ESD_STREAM | ESD_PLAY | ESD_MONO;
@@ -302,7 +314,7 @@
   return 0;
 }
 
-int
+static int
 mixctl (int fd, request_t request, void *argp)
 {
   static int esd = -1, player = -1;
@@ -492,6 +504,35 @@
 }
 
 #endif /* MULTIPLE_X11AMP */
+
+#if ESDDSP_STDIO_EMU
+/*
+ * use #include rather than linking, because we want to keep everything
+ * static inside esddsp to be sure that we don't override application symbols
+ */
+#include "stdioemu.c"
+FILE *
+fopen (const char *pathname, const char *mode)
+{
+  static FILE *(*func) (const char *, const char *) = NULL;
+
+  if (!func) {
+    func = (FILE *(*) (const char *, const char *)) dlsym (REAL_LIBC, "fopen");
+    dsp_init ();
+  }
+
+  if (!strcmp (pathname, "/dev/dsp"))
+    {
+      return fake_fopen(pathname,mode);
+    }
+  else if (use_mixer && !strcmp (pathname, "/dev/mixer"))
+    {
+      return fake_fopen(pathname,mode);
+    }
+  else
+    return (*func) (pathname, mode);
+}
+#endif
 
 #else /* __GNUC__ */
 
--- esound-0.2.29.orig/esdlib.c
+++ esound-0.2.29/esdlib.c
@@ -558,7 +558,7 @@
 static int is_host_local(const char* host) 
 {
     char hnbuf[256]="";
-    if (!host || (*host)) return 1;
+    if (!host || !(*host)) return 1;
 
     gethostname(hnbuf, sizeof(hnbuf));
     return (!strcasecmp(host,hnbuf) || !strcasecmp(host, "localhost"));
@@ -652,16 +652,42 @@
 
 	childpid = fork();
 	if(!childpid) {
+	    char *preload2;
+	    char *lib;
+	    char *cmd;
+
 	    /* child process */
-	    if(!fork()) {
-		/* child of child process */
-		char *cmd;
+	    close (esd_pipe[0]);
+	    /*
+	     * pull libesddsp out of LD_PRELOAD if it is there
+	     */
+	    preload2 = getenv("LD_PRELOAD");
+	    if (preload2 && (lib = strstr(preload2,"libesddsp")))
+		do {
+		    char *preload = preload2;
+		    char *start = preload;
+		    char *end   = preload+strcspn(preload," \t\n\0");
+		    int length;
+
+		    while(end < lib) {
+			start = end+1;
+			end   = start+strcspn(start,"\t\n\0");
+		    }
+		    length = (preload+strlen(preload))-(end+1);
+		    preload2 = malloc(11+(start-preload)+length);
+		    strcpy(preload2, "LD_PRELOAD=");
+		    strncat(preload2, preload, start-preload);
+		    strncat(preload2, end+1, length);
+		    putenv(preload2);
+		} while (strstr(preload2,"libesddsp"));
+	    cmd = malloc(strlen(SERVERDIR"/esd  -spawnfd 9999999999") + (esd_spawn_options?strlen(esd_spawn_options):0));
+	    sprintf(cmd, "%s/esd %s -spawnfd %d", SERVERDIR, esd_spawn_options?esd_spawn_options:"", esd_pipe[1]);
 
+	    if(!fork()) {
+		/* child of child process.  Minimal so startup overhead is
+		 * not included in the waiting time
+		 */
 		setsid();
-		cmd = malloc(strlen(SERVERDIR"/esd  -spawnfd 999999") + (esd_spawn_options?strlen(esd_spawn_options):0));
-
-		sprintf(cmd, "%s/esd %s -spawnfd %d", SERVERDIR, esd_spawn_options?esd_spawn_options:"", esd_pipe[1]);
-
 		execl("/bin/sh", "/bin/sh", "-c", cmd, NULL);
 		perror("execl");
 		_exit(1);
@@ -672,6 +698,7 @@
 	} else {
 	    int estat;
 
+	    close(esd_pipe[1]);
 	    waitpid(childpid, &estat, 0);
 	}
 
@@ -698,8 +725,6 @@
 	}
 	    
 	close (esd_pipe[0]);
-	close (esd_pipe[1]);
-	
     }
 #endif
  finish_connect:
--- esound-0.2.29.orig/aclocal.m4
+++ esound-0.2.29/aclocal.m4
@@ -330,6 +330,8 @@
 AC_REQUIRE([AC_PROG_LD])dnl
 AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
 AC_REQUIRE([AC_PROG_NM])dnl
+AC_REQUIRE([LT_AC_PROG_SED])dnl
+
 AC_REQUIRE([AC_PROG_LN_S])dnl
 AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
 AC_REQUIRE([AC_OBJEXT])dnl
@@ -379,20 +381,6 @@
   rm -rf conftest*
   ;;
 
-*-*-linux*)
-  # Test if the compiler is 64bit
-  echo 'int i;' > conftest.$ac_ext
-  lt_cv_cc_64bit_output=no
-  if AC_TRY_EVAL(ac_compile); then
-    case `/usr/bin/file conftest.$ac_objext` in
-    *"ELF 64"*)
-      lt_cv_cc_64bit_output=yes
-      ;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-  
 *-*-sco3.2v5*)
   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
   SAVE_CFLAGS="$CFLAGS"
@@ -511,9 +499,12 @@
   lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
   lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
   ;;
-irix*)
+irix* | nonstopux*)
   symcode='[[BCDEGRST]]'
   ;;
+osf*)
+  symcode='[[BCDEGQRST]]'
+  ;;
 solaris* | sysv5*)
   symcode='[[BDT]]'
   ;;
@@ -610,7 +601,7 @@
 	  save_CFLAGS="$CFLAGS"
 	  LIBS="conftstm.$ac_objext"
 	  CFLAGS="$CFLAGS$no_builtin_flag"
-	  if AC_TRY_EVAL(ac_link) && test -s conftest; then
+	  if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then
 	    pipe_works=yes
 	  fi
 	  LIBS="$save_LIBS"
@@ -1154,7 +1145,7 @@
       # like `-m68040'.
       lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
       ;;
-    beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
       # PIC is the default for these OSes.
       ;;
     darwin* | rhapsody*)
@@ -1197,7 +1188,7 @@
       lt_cv_prog_cc_pic='+Z'
       ;;
 
-    irix5* | irix6*)
+    irix5* | irix6* | nonstopux*)
       lt_cv_prog_cc_wl='-Wl,'
       lt_cv_prog_cc_static='-non_shared'
       # PIC (with -KPIC) is the default.
@@ -1241,11 +1232,7 @@
     sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
       lt_cv_prog_cc_pic='-KPIC'
       lt_cv_prog_cc_static='-Bstatic'
-      if test "x$host_vendor" = xsni; then
-	lt_cv_prog_cc_wl='-LD'
-      else
-	lt_cv_prog_cc_wl='-Wl,'
-      fi
+      lt_cv_prog_cc_wl='-Wl,'
       ;;
 
     uts4*)
@@ -1610,7 +1597,7 @@
     # If the export-symbols file already is a .def file (1st line
     # is EXPORTS), use it as is.
     # If DATA tags from a recent dlltool are present, honour them!
-    archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
+    archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then
 	cp $export_symbols $output_objdir/$soname-def;
       else
 	echo EXPORTS > $output_objdir/$soname-def;
@@ -1619,6 +1606,7 @@
 	 set dummy \$symbol;
 	 case \[$]# in
 	   2) echo "   \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
+	   4) echo "   \[$]2 \[$]3 \[$]4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;;
 	   *) echo "     \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;;
 	 esac;
 	 _lt_hint=`expr 1 + \$_lt_hint`;
@@ -1731,10 +1719,12 @@
       # need to do runtime linking.
       case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
 	for ld_flag in $LDFLAGS; do
-	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+	  case $ld_flag in
+	  *-brtl*)
 	    aix_use_runtimelinking=yes
 	    break
-	  fi
+	  ;;
+	  esac
 	done
       esac
 
@@ -1848,8 +1838,9 @@
     esac
     # FIXME: Relying on posixy $() will cause problems for
     #        cross-compilation, but unfortunately the echo tests do not
-    #        yet detect zsh echo's removal of \ escapes.
-    archive_cmds='$nonopt $(test "x$module" = xyes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring'
+    #        yet detect zsh echo's removal of \ escapes.  Also zsh mangles
+    #	     `"' quotes if we put them in here... so don't!
+    archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)'
     # We need to add '_' to the symbols in $export_symbols first
     #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
     hardcode_direct=yes
@@ -1901,13 +1892,14 @@
     export_dynamic_flag_spec='${wl}-E'
     ;;
 
-  irix5* | irix6*)
+  irix5* | irix6* | nonstopux*)
     if test "$GCC" = yes; then
       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
     else
       archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='-rpath $libdir'
     fi
-    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
     hardcode_libdir_separator=:
     link_all_deplibs=yes
     ;;
@@ -1935,7 +1927,7 @@
     hardcode_direct=yes
     hardcode_shlibpath_var=no
     if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags'
+      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
       hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
       export_dynamic_flag_spec='${wl}-E'
     else
@@ -1945,7 +1937,7 @@
 	hardcode_libdir_flag_spec='-R$libdir'
         ;;
       *)
-        archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags'
+        archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
         hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
         ;;
       esac
@@ -2057,13 +2049,23 @@
     ;;
 
   sysv4)
-    if test "x$host_vendor" = xsno; then
-      archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_direct=yes # is this really true???
-    else
-      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_direct=no #Motorola manual says yes, but my tests say they lie
-    fi
+    case $host_vendor in
+      sni)
+        archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+        hardcode_direct=yes # is this really true???
+        ;;
+      siemens)
+        ## LD is ld it makes a PLAMLIB
+        ## CC just makes a GrossModule.
+        archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+        reload_cmds='$CC -r -o $output$reload_objs'
+        hardcode_direct=no
+        ;;
+      motorola)
+        archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+        hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+        ;;
+    esac
     runpath_var='LD_RUN_PATH'
     hardcode_shlibpath_var=no
     ;;
@@ -2189,8 +2191,8 @@
 shlibpath_overrides_runpath=unknown
 version_type=none
 dynamic_linker="$host_os ld.so"
-sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib"
-sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
 
 case $host_os in
 aix3*)
@@ -2204,6 +2206,9 @@
 
 aix4* | aix5*)
   version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
   if test "$host_cpu" = ia64; then
     # AIX 5 supports IA64
     library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so'
@@ -2242,6 +2247,7 @@
     fi
     shlibpath_var=LIBPATH
   fi
+  hardcode_into_libs=yes
   ;;
 
 amigaos*)
@@ -2289,7 +2295,7 @@
     ;;
   yes,mingw*)
     library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll'
-    sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"`
+    sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"`
     ;;
   yes,pw32*)
     library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
@@ -2321,6 +2327,18 @@
   dynamic_linker=no
   ;;
 
+freebsd*-gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU/FreeBSD ld.so'
+  ;;
+
 freebsd*)
   objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
   version_type=freebsd-$objformat
@@ -2372,14 +2390,17 @@
   postinstall_cmds='chmod 555 $lib'
   ;;
 
-irix5* | irix6*)
-  version_type=irix
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)          version_type=irix ;;
+  esac
   need_lib_prefix=no
   need_version=no
   soname_spec='${libname}${release}.so$major'
   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so'
   case $host_os in
-  irix5*)
+  irix5* | nonstopux*)
     libsuff= shlibsuff=
     ;;
   *)
@@ -2417,13 +2438,6 @@
   # before this can be enabled.
   hardcode_into_libs=yes
 
-  case $host_cpu:$lt_cv_cc_64bit_output in
-  powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes)
-    sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64"
-    sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64"
-    ;;
-  esac
-
   # We used to test for /lib/ld.so.1 and disable shared libraries on
   # powerpc, because MkLinux only supported shared libraries with the
   # GNU dynamic linker.  Since this was broken with cross compilers,
@@ -2490,11 +2504,13 @@
 osf3* | osf4* | osf5*)
   version_type=osf
   need_version=no
-  soname_spec='${libname}${release}.so'
-  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+  need_lib_prefix=no
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
   shlibpath_var=LD_LIBRARY_PATH
   sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
   sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  hardcode_into_libs=yes
   ;;
 
 sco3.2v5*)
@@ -2537,6 +2553,12 @@
   case $host_vendor in
     sni)
       shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
       ;;
     motorola)
       need_lib_prefix=no
@@ -2691,7 +2713,7 @@
   # Now quote all the things that may contain metacharacters while being
   # careful not to overquote the AC_SUBSTed values.  We take copies of the
   # variables and quote the copies for generation of the libtool script.
-  for var in echo old_CC old_CFLAGS \
+  for var in echo old_CC old_CFLAGS SED \
     AR AR_FLAGS CC LD LN_S NM SHELL \
     reload_flag reload_cmds wl \
     pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
@@ -2753,8 +2775,11 @@
 # configuration script generated by Autoconf, you may include it under
 # the same distribution terms that you use for the rest of that program.
 
+# A sed that does not truncate output.
+SED=$lt_SED
+
 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
-Xsed="sed -e s/^X//"
+Xsed="${SED} -e s/^X//"
 
 # The HP-UX ksh and POSIX shell print the target directory to stdout
 # if CDPATH is set.
@@ -3515,7 +3540,7 @@
 # AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies
 #  -- PORTME fill in with the dynamic library characteristics
 AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
-[AC_CACHE_CHECK([how to recognise dependant libraries],
+[AC_CACHE_CHECK([how to recognise dependent libraries],
 lt_cv_deplibs_check_method,
 [lt_cv_file_magic_cmd='$MAGIC_CMD'
 lt_cv_file_magic_test_file=
@@ -3590,9 +3615,9 @@
   lt_cv_file_magic_test_file=/usr/lib/libc.sl
   ;;
 
-irix5* | irix6*)
+irix5* | irix6* | nonstopux*)
   case $host_os in
-  irix5*)
+  irix5* | nonstopux*)
     # this will be overridden with pass_all, but let us keep it just in case
     lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
     ;;
@@ -3614,7 +3639,7 @@
 # This must be Linux ELF.
 linux-gnu*)
   case $host_cpu in
-  alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | x86_64* )
+  alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64*)
     lt_cv_deplibs_check_method=pass_all ;;
   *)
     # glibc up to 2.1.1 does not perform some relocations on ARM
@@ -3685,6 +3710,9 @@
     lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
     lt_cv_file_magic_test_file=/lib/libc.so
     ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
   esac
   ;;
 esac
@@ -3750,12 +3778,12 @@
 ])
 
 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
-# the libltdl convenience library and INCLTDL to the include flags for
+# the libltdl convenience library and LTDLINCL to the include flags for
 # the libltdl header and adds --enable-ltdl-convenience to the
-# configure arguments.  Note that LIBLTDL and INCLTDL are not
+# configure arguments.  Note that LIBLTDL and LTDLINCL are not
 # AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If DIR is not
 # provided, it is assumed to be `libltdl'.  LIBLTDL will be prefixed
-# with '${top_builddir}/' and INCLTDL will be prefixed with
+# with '${top_builddir}/' and LTDLINCL will be prefixed with
 # '${top_srcdir}/' (note the single quotes!).  If your package is not
 # flat and you're not using automake, define top_builddir and
 # top_srcdir appropriately in the Makefiles.
@@ -3767,16 +3795,18 @@
       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
   esac
   LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
-  INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
 ])
 
 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
-# the libltdl installable library and INCLTDL to the include flags for
+# the libltdl installable library and LTDLINCL to the include flags for
 # the libltdl header and adds --enable-ltdl-install to the configure
-# arguments.  Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
+# arguments.  Note that LIBLTDL and LTDLINCL are not AC_SUBSTed, nor is
 # AC_CONFIG_SUBDIRS called.  If DIR is not provided and an installed
 # libltdl is not found, it is assumed to be `libltdl'.  LIBLTDL will
-# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
+# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed
 # with '${top_srcdir}/' (note the single quotes!).  If your package is
 # not flat and you're not using automake, define top_builddir and
 # top_srcdir appropriately in the Makefiles.
@@ -3794,12 +3824,14 @@
   if test x"$enable_ltdl_install" = x"yes"; then
     ac_configure_args="$ac_configure_args --enable-ltdl-install"
     LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
-    INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+    LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
   else
     ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
     LIBLTDL="-lltdl"
-    INCLTDL=
+    LTDLINCL=
   fi
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
 ])
 
 # old names
@@ -3813,6 +3845,95 @@
 
 # This is just to silence aclocal about the macro not being used
 ifelse([AC_DISABLE_FAST_INSTALL])
+
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+# LT_AC_PROG_SED
+# --------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+AC_DEFUN([LT_AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_executable_p="test -f"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+        _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+
+  # Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+: ${TMPDIR=/tmp}
+{
+  tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=$TMPDIR/sed$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in $TMPDIR" >&2
+   { (exit 1); exit 1; }
+}
+  _max=0
+  _count=0
+  # Add /usr/xpg4/bin/sed as it is typically found on Solaris
+  # along with /bin/sed that truncates output.
+  for _sed in $_sed_list /usr/xpg4/bin/sed; do
+    test ! -f ${_sed} && break
+    cat /dev/null > "$tmp/sed.in"
+    _count=0
+    echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in"
+    # Check for GNU sed and select it if it is found.
+    if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then
+      lt_cv_path_SED=${_sed}
+      break
+    fi
+    while true; do
+      cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp"
+      mv "$tmp/sed.tmp" "$tmp/sed.in"
+      cp "$tmp/sed.in" "$tmp/sed.nl"
+      echo >>"$tmp/sed.nl"
+      ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break
+      cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break
+      # 40000 chars as input seems more than enough
+      test $_count -gt 10 && break
+      _count=`expr $_count + 1`
+      if test $_count -gt $_max; then
+        _max=$_count
+        lt_cv_path_SED=$_sed
+      fi
+    done
+  done
+  rm -rf "$tmp"
+])
+if test "X$SED" != "X"; then
+  lt_cv_path_SED=$SED
+else
+  SED=$lt_cv_path_SED
+fi
+AC_MSG_RESULT([$SED])
+])
 
 # Configure paths for the Audio File Library
 # Bertrand Guiheneuf 98-10-21
--- esound-0.2.29.orig/esd.c
+++ esound-0.2.29/esd.c
@@ -170,8 +170,6 @@
       unlink(ESD_UNIX_SOCKET_NAME);
       rmdir(ESD_UNIX_SOCKET_DIR);
     }
-
-
     /* trust the os to clean up the memory for the samples and such */
     exit( 0 );
 }
@@ -202,7 +200,8 @@
     return -1;
   /* set the connect information */
   socket_unix.sun_family = AF_UNIX;
-  strncpy(socket_unix.sun_path, ESD_UNIX_SOCKET_NAME, sizeof(socket_unix.sun_path));
+  strncpy(socket_unix.sun_path, ESD_UNIX_SOCKET_NAME, sizeof(socket_unix.sun_path)-1);
+  socket_unix.sun_path[sizeof(socket_unix.sun_path)-1] = '\0';
   if ( connect( socket_out,
 	       (struct sockaddr *) &socket_unix, SUN_LEN(&socket_unix) ) < 0 )
     return -1;
@@ -498,23 +497,21 @@
     /* Enlightened sound Daemon */
 
     int esd_port = ESD_DEFAULT_PORT;
-    int length = 0;
     int arg = 0;
     int itmp;
 
     void *output_buffer = NULL;
+    extern signed int *mixed_buffer;
 
     char *hostname=NULL;
 
     /* begin test scaffolding parameters */
     /* int format = AFMT_U8; AFMT_S16_LE; */
     /* int stereo = 0; */     /* 0=mono, 1=stereo */
-    int default_rate = ESD_DEFAULT_RATE, default_buf_size = ESD_BUF_SIZE;
+    int default_rate = ESD_DEFAULT_RATE;
     int i, j, freq=440;
     int magl, magr;
 
-    int first = 1;
-
     int default_format = ESD_BITS16 | ESD_STEREO;
     /* end test scaffolding parameters */
 
@@ -574,8 +571,6 @@
 		    fprintf( stderr, "- could not read autostandby timeout: %s\n",
 			     argv[ arg ] );
 		}
-/*		fprintf( stderr, "- autostandby timeout: %d seconds\n",
-			 esd_autostandby_secs );*/
 	    }
 #ifdef ESDBG
 	} else if ( !strcmp( argv[ arg ], "-vt" ) ) {
@@ -590,7 +585,6 @@
 #endif
 	} else if ( !strcmp( argv[ arg ], "-nobeeps" ) ) {
 	    esd_beeps = 0;
-/*	    fprintf( stderr, "- disabling startup beeps\n" );*/
 	} else if ( !strcmp( argv[ arg ], "-unix" ) ) {
 	    esd_use_tcpip = 0;
 	} else if ( !strcmp( argv[ arg ], "-tcp" ) ) {
@@ -655,11 +649,6 @@
     exit( 1 );	
   }
 
-#define ESD_AUDIO_STUFF \
-    esd_sample_size = ( (esd_audio_format & ESD_MASK_BITS) == ESD_BITS16 ) \
-	? sizeof(signed short) : sizeof(unsigned char); \
-    esd_buf_size_samples = default_buf_size / 2; \
-    esd_buf_size_octets = esd_buf_size_samples * esd_sample_size;
 
     /* start the initializatin process */
 /*    printf( "ESound ESD daemon initializing...\n" );*/
@@ -667,7 +656,6 @@
     /* set the data size parameters */
     esd_audio_format = default_format;
     esd_audio_rate = default_rate;
-    ESD_AUDIO_STUFF;
 
   /* open and initialize the audio device, /dev/dsp */
   itmp = esd_audio_open();
@@ -692,7 +680,6 @@
     /* cant do defaults ... try 44.1 kkz 8bit stereo */
     esd_audio_format = ESD_BITS8 | ESD_STEREO;
     esd_audio_rate = 44100;
-    ESD_AUDIO_STUFF;
     if ( esd_audio_open() < 0 ) {
       fprintf(stderr, "Audio device open for 44.1Khz, stereo, 8bit failed\n"
 
@@ -700,56 +687,48 @@
     /* cant do defaults ... try 48 kkz 16bit stereo */
     esd_audio_format = ESD_BITS16 | ESD_STEREO;
     esd_audio_rate = 48000;
-    ESD_AUDIO_STUFF;
     if ( esd_audio_open() < 0 ) {
       fprintf(stderr, "Audio device open for 48Khz, stereo,16bit failed\n"
 	      "Trying 22.05Khz, 8bit stereo.\n");
       /* cant do defaults ... try 22.05 kkz 8bit stereo */
       esd_audio_format = ESD_BITS8 | ESD_STEREO;
       esd_audio_rate = 22050;
-      ESD_AUDIO_STUFF;
       if ( esd_audio_open() < 0 ) {
 	fprintf(stderr, "Audio device open for 22.05Khz, stereo, 8bit failed\n"
 		"Trying 44.1Khz, 16bit mono.\n");
 	/* cant do defaults ... try 44.1Khz kkz 16bit mono */
 	esd_audio_format = ESD_BITS16;
 	esd_audio_rate = 44100;
-	ESD_AUDIO_STUFF;
 	if ( esd_audio_open() < 0 ) {
 	  fprintf(stderr, "Audio device open for 44.1Khz, mono, 8bit failed\n"
 		  "Trying 22.05Khz, 8bit mono.\n");
 	  /* cant do defaults ... try 22.05 kkz 8bit mono */
 	  esd_audio_format = ESD_BITS8;
 	  esd_audio_rate = 22050;
-	  ESD_AUDIO_STUFF;
 	  if ( esd_audio_open() < 0 ) {
 	    fprintf(stderr, "Audio device open for 22.05Khz, mono, 8bit failed\n"
 		    "Trying 11.025Khz, 8bit stereo.\n");
 	    /* cant to defaults ... try 11.025 kkz 8bit stereo */
 	    esd_audio_format = ESD_BITS8 | ESD_STEREO;
 	    esd_audio_rate = 11025;
-	    ESD_AUDIO_STUFF;
 	    if ( esd_audio_open() < 0 ) {
 	      fprintf(stderr, "Audio device open for 11.025Khz, stereo, 8bit failed\n"
 		      "Trying 11.025Khz, 8bit mono.\n");
 	      /* cant to defaults ... try 11.025 kkz 8bit mono */
 	      esd_audio_format = ESD_BITS8;
 	      esd_audio_rate = 11025;
-	      ESD_AUDIO_STUFF;
 	      if ( esd_audio_open() < 0 ) {
 		fprintf(stderr, "Audio device open for 11.025Khz, mono, 8bit failed\n"
 			"Trying 8.192Khz, 8bit mono.\n");
 	        /* cant to defaults ... try 8.192 kkz 8bit mono */
 		esd_audio_format = ESD_BITS8;
 		esd_audio_rate = 8192;
-		ESD_AUDIO_STUFF;
 		if ( esd_audio_open() < 0 ) {
 		  fprintf(stderr, "Audio device open for 8.192Khz, mono, 8bit failed\n"
 			  "Trying 8Khz, 8bit mono.\n");
 		  /* cant to defaults ... try 8 kkz 8bit mono */
 		  esd_audio_format = ESD_BITS8;
 		  esd_audio_rate = 8000;
-		  ESD_AUDIO_STUFF;
 		  if ( esd_audio_open() < 0 ) {
 		    fprintf(stderr, "Sound device inadequate for Esound. Fatal.\n");
 		    if (!esd_use_tcpip)
@@ -776,9 +755,16 @@
     }
    }
   }
+    esd_sample_size = ( (esd_audio_format & ESD_MASK_BITS) == ESD_BITS16 )
+	? sizeof(signed short) : sizeof(unsigned char);
+    esd_buf_size_samples = ( (esd_audio_format & ESD_MASK_CHAN) == ESD_STEREO)
+    	? esound_getblksize() / 2 : esound_getblksize();
+    esd_buf_size_octets = esd_buf_size_samples * esd_sample_size;
+
 
     /* allocate and zero out buffer */
     output_buffer = (void *) malloc( esd_buf_size_octets );
+    mixed_buffer = malloc( esd_buf_size_samples * sizeof(*mixed_buffer) );
     memset( output_buffer, 0, esd_buf_size_octets );
 
 
@@ -790,7 +776,7 @@
 
     /* send some sine waves just to check the sound connection */
     i = 0;
-    if ( esd_beeps ) {
+    if ( !esd_spawnfd && esd_beeps ) {
 	magl = magr = ( (esd_audio_format & ESD_MASK_BITS) == ESD_BITS16)
 	    ? 30000 : 100;
 
@@ -804,13 +790,8 @@
 		esd_audio_write( output_buffer, esd_buf_size_octets );
 	    }
 	}
-    }
-
-    /* put some stuff in sound driver before pausing */
-    esd_audio_write( NULL, 0);
-
-    /* pause the sound output */
-    esd_audio_pause();
+    } else
+	esd_audio_write( NULL, 0);
 
     /* Startup succeeded */
     if(esd_spawnpid)
@@ -819,108 +800,11 @@
     if(esd_spawnfd) {
 	char c = 1; /* Startup succeeded */
 	write (esd_spawnfd, &c, 1);
+	close (esd_spawnfd);
     }
 
-    /* until we kill the daemon */
-    while ( 1 )
-    {
-	/* block while waiting for more clients and new data */
-	wait_for_clients_and_data( listen_socket );
-
-	/* accept new connections */
-	get_new_clients( listen_socket );
-
-
-	if ((esd_clients_list == NULL) && (!first) && (esd_terminate)) {
-/*	  fprintf(stderr, "No clients!\n");*/
-	  clean_exit(0);
-	  exit(0);
-	}
-
-	/* check for new protocol requests */
-	poll_client_requests();
-	first = 0;
-
-	/* mix new requests, and output to device */
-	refresh_mix_funcs(); /* TODO: set a flag to cue when to do this */
-	length = mix_players( output_buffer, esd_buf_size_octets );
-	
-	/* awaken if on autostandby and doing anything */
-	if ( esd_on_autostandby && length && !esd_forced_standby ) {
-	    ESDBG_TRACE( printf( "stuff to play, waking up.\n" ); );
-	    esd_server_resume();
-	}
-
-	/* we handle this even when length == 0 because a filter could have
-	 * closed, and we don't want to eat the processor if one did.. */
-	if ( esd_filter_list && !esd_on_standby ) {
-	    length = filter_write( output_buffer, length,
-				   esd_audio_format, esd_audio_rate );
-	}
-	
-	if ( length > 0 /* || esd_monitor */ ) {
-	    /* do_sleep = 0; */
-	    if ( !esd_on_standby ) {
-		/* standby check goes in here, so esd will eat sound data */
-		/* TODO: eat a round of data with a better algorithm */
-		/*        this will cause guaranteed timing issues */
-		/* TODO: on monitor, why isn't this a buffer of zeroes? */
-		/* esd_audio_write( output_buffer, esd_buf_size_octets ); */
-		esd_audio_write( output_buffer, length );
-		/* esd_audio_flush(); */ /* this is overkill */
-		esd_last_activity = time( NULL );
-	    }
-	} else {
-	    /* should be pausing just fine within wait_for_clients_and_data */
-	    /* if so, this isn't really needed */
-
-	    /* be very quiet, and wait for a wabbit to come along */
-#if 0
-	    if ( !do_sleep ) { ESDBG_TRACE( printf( "pausing in esd.c\n" ); ); }
-	    do_sleep = 1;
-	    esd_audio_pause();
-#endif
-	}
-
-	/* if someone's monitoring the sound stream, send them data */
-	/* mix_players, above, forces buffer to zero if no players */
-	/* this clears out any leftovers from recording, below */
-	if ( esd_monitor_list && !esd_on_standby && length ) {
-	/* if ( esd_monitor_list && !esd_on_standby ) {  */
-	    monitor_write( output_buffer, length );
-	}
-
-	/* if someone's recording the sound stream, send them data */
-	if ( esd_recorder_list && !esd_on_standby ) {
-	    length = esd_audio_read( output_buffer, esd_buf_size_octets );
-	    if ( length ) {
-		length = recorder_write( output_buffer, length );
-		esd_last_activity = time( NULL );
-	    }
-	}
-
-	if ( esd_on_standby ) {
-#ifdef HAVE_NANOSLEEP
-	    struct timespec restrain;
-	    restrain.tv_sec = 0;
-	    /* funky math to make sure a long can hold it all, calulate in ms */
-	    restrain.tv_nsec = (long) esd_buf_size_samples * 1000L
-		/ (long) esd_audio_rate / 4L;   /* divide by two for stereo */
-	    restrain.tv_nsec *= 1000000L;       /* convert to nanoseconds */
-	    nanosleep( &restrain, NULL );
-#else
-	    struct timeval restrain;
-	    restrain.tv_sec = 0;
-	    /* funky math to make sure a long can hold it all, calulate in ms */
-	    restrain.tv_usec = (long) esd_buf_size_samples * 1000L
-		/ (long) esd_audio_rate / 4L; 	/* divide by two for stereo */
-	    restrain.tv_usec *= 1000L; 		/* convert to microseconds */
-	    select( 0, 0, 0, 0, &restrain );
-#endif
-	}
-    } /* while ( 1 ) */
+    esd_comm_loop(listen_socket,output_buffer,esd_terminate);
 
     /* how we'd get here, i have no idea, should only exit on signal */
     clean_exit( -1 );
-    exit( 0 );
 }
--- esound-0.2.29.orig/esd.h
+++ esound-0.2.29/esd.h
@@ -12,6 +12,8 @@
 
 /* length of the audio buffer size */
 #define ESD_BUF_SIZE (4 * 1024)
+/* maximum size we can write().  Otherwise we might overflow */
+#define ESD_MAX_WRITE_SIZE (21 * 4096)
 
 /* length of the authorization key, octets */
 #define ESD_KEY_LEN (16)
--- esound-0.2.29.orig/mix.c
+++ esound-0.2.29/mix.c
@@ -3,8 +3,7 @@
 #include <limits.h>
 
 /*******************************************************************/
-/* ESD_BUF_SIZE is the maximum possible number of samples */
-signed int mixed_buffer[ ESD_BUF_SIZE ];
+signed int *mixed_buffer = NULL;
 
 /* prototype for compiler */
 int mix_and_copy( void *dest_buf, int dest_len, 
@@ -596,7 +595,7 @@
 	rd_dat = wr_dat * player->rate / esd_audio_rate;
 	rd_dat /= 2;	/* adjust for mono */
 	
-	sample = source_data_uc[ rd_dat++ ];
+	sample = source_data_uc[ rd_dat ];
 	sample -= 127; sample *= 256;
 	
 	mixed_buffer[ wr_dat++ ] += sample;
@@ -657,7 +656,7 @@
 	rd_dat = wr_dat * player->rate / esd_audio_rate;
 	rd_dat /= 2;	/* adjust for mono */
 	
-	sample = source_data_ss[ rd_dat++ ];
+	sample = source_data_ss[ rd_dat ];
 	
 	mixed_buffer[ wr_dat++ ] += sample;
 	mixed_buffer[ wr_dat++ ] += sample;
@@ -721,7 +720,7 @@
 	rd_dat = wr_dat * player->rate / esd_audio_rate;
 	rd_dat /= 2;	/* adjust for mono */
 	
-	sample = source_data_uc[ rd_dat++ ];
+	sample = source_data_uc[ rd_dat ];
 	sample -= 127; sample *= 256;
 	
 	sample = sample * player->left_vol_scale / ESD_VOLUME_BASE;
@@ -766,7 +765,7 @@
 	    sample = sample * player->left_vol_scale / ESD_VOLUME_BASE;
 	    mixed_buffer[ wr_dat++ ] += sample;
 
-	    sample = source_data_uc[ rd_dat++ ];
+	    sample = source_data_uc[ rd_dat ];
 	    sample -= 127; sample *= 256;
 	    sample = sample * player->right_vol_scale / ESD_VOLUME_BASE;
 	    mixed_buffer[ wr_dat++ ] += sample;
@@ -792,7 +791,7 @@
 	rd_dat = wr_dat * player->rate / esd_audio_rate;
 	rd_dat /= 2;	/* adjust for mono */
 	
-	sample = source_data_ss[ rd_dat++ ];
+	sample = source_data_ss[ rd_dat ];
 	
 	mixed_buffer[ wr_dat++ ] 
 	    += sample * player->left_vol_scale / ESD_VOLUME_BASE;
@@ -835,7 +834,7 @@
 	    sample = sample * player->left_vol_scale / ESD_VOLUME_BASE;
 	    mixed_buffer[ wr_dat++ ] += sample;
 
-	    sample = source_data_ss[ rd_dat++ ];
+	    sample = source_data_ss[ rd_dat ];
 	    sample = sample * player->right_vol_scale / ESD_VOLUME_BASE;
 	    mixed_buffer[ wr_dat++ ] += sample;
 	}
@@ -890,14 +889,14 @@
 /* takes all input players, and mixes them to the mixed_buffer */
 int mix_players( void *output, int length )
 {
-    int actual = 0, max = 0;
+    int actual = 0, min = 0, max = 0, translated = 0, iBps, used;
     esd_player_t *player = NULL;
     esd_player_t *erase = NULL;
 
     ESDBG_MIXER( printf( "++++++++++++++++++++++++++++++++++++++++++\n" ); );
 
     /* zero the sum buffer */
-    memset( mixed_buffer, 0, esd_buf_size_samples * sizeof(int) );
+    memset( mixed_buffer, 0, esd_buf_size_samples * sizeof(*mixed_buffer) );
     
     /* as long as there's a player out there */
     player = esd_players_list;
@@ -905,21 +904,45 @@
     {
 	/* read the client sound data */
 	actual = read_player( player );
-
-	/* read_player(): >0 = data, ==0 = no data, <0 = erase it */
-	if ( actual > 0  ) {
-	    /* printf( "received: %d bytes from %d\n", 
-	            actual, player->source_id ); */
-	    /* actual = mix_to_stereo_32s( player, length ); */
-	    actual = player->mix_func( player, length );
-	    if ( actual > max ) max = actual;
-	    
-	} else if ( actual == 0 ) {
-	    ESDBG_TRACE( printf( "(%02d) no data available from player [%p]\n", 
+	
+	if ( actual == 0 ) {
+	    ESDBG_TRACE( printf( "(%02d) no new data available from player [%p]\n", 
 				 player->source_id, player ); );
-	} else {
+	    if ( player->actual_length == 0 ) {
+		player = player->next;
+		continue;
+	    }
+	}
+	
+	if ( actual < 0 ) {
 	    /* actual < 0 means erase the player */
 	    erase = player;
+	} else {
+	    /* actual >= 0 means data might be there to mix */
+	    iBps = sizeof(signed short) * 2;
+
+	    if ( (player->format & ESD_MASK_BITS) == ESD_BITS8 )
+		iBps /= sizeof(signed short);
+	    if ( (player->format & ESD_MASK_CHAN) == ESD_MONO )
+		iBps /= 2;
+
+	    /* how much data is really there? */
+	    translated = ((player->actual_length / iBps) * esd_audio_rate + player->rate - 1) / player->rate;
+	    translated *= sizeof(signed short) * 2;
+
+	    if ( translated > length ) {
+		ESDBG_TRACE( printf( "(%02d) player translated length doesn't fit [%p]\n",
+			player->source_id, player ); );
+		translated = length;
+	    }
+
+	    if ( min == 0 ) {
+		min = translated;
+	    } else {
+		if ( min > translated ) {
+		    min = translated;
+		}
+	    }
 	}
 
 	/* check out the next item in the list */
@@ -932,13 +955,54 @@
 	}
     }
 
+    if ( min > 0 ) {
+	player = esd_players_list;
+	while( player != NULL )
+	{
+	    if ( player->actual_length > 0 ) {
+		/* read_player(): >0 = data, ==0 = no data, <0 = erase it */
+ 		iBps = sizeof(signed short) * 2;
+ 
+  		if ( (player->format & ESD_MASK_BITS) == ESD_BITS8 )
+ 		    iBps /= sizeof(signed short);
+  		if ( (player->format & ESD_MASK_CHAN) == ESD_MONO )
+ 		    iBps /= 2;
+ 
+ 		actual = player->mix_func( player, min );
+  
+ 		/* but how much data did we use? */
+ 		used = (actual / (sizeof(signed short) * 2)) * player->rate / esd_audio_rate;
+ 
+ 		if ( (player->format & ESD_MASK_BITS) != ESD_BITS8 )
+ 		    used *= sizeof(signed short);
+ 		if ( (player->format & ESD_MASK_CHAN) != ESD_MONO )
+ 		    used *= 2;
+ 
+ 		if ( player->actual_length - used > 0 ) {
+ 		    memmove( player->data_buffer, player->data_buffer + used, player->actual_length - used );
+ 		    player->actual_length -= used;
+ 		} else {
+ 		    /* kill it, it's probably all used anyways */
+ 		    player->actual_length = 0;
+ 		}
+ 		
+		if ( actual > max ) {
+		    max = actual;
+		}
+	    }
+
+	    /* check out the next item in the list */
+	    player = player->next;
+	}
+
     /* ESDBG_COMMS( printf( "maximum stream length = %d bytes\n", max ); ); */ 
 
-    if ( (esd_audio_format & ESD_MASK_BITS) == ESD_BITS16 ) 
-	clip_mix_to_output_16s( output, max );
-    else {
-	clip_mix_to_output_8u( output, max );
-	max /= 2; /* half as many samples as you'd think */
+	if ( (esd_audio_format & ESD_MASK_BITS) == ESD_BITS16 ) 
+	    clip_mix_to_output_16s( output, max );
+	else {
+	    clip_mix_to_output_8u( output, max );
+	    max /= 2; /* half as many samples as you'd think */
+	}
     }
 
     return max;
--- esound-0.2.29.orig/audio_alsa09.c
+++ esound-0.2.29/audio_alsa09.c
@@ -4,19 +4,19 @@
  *  by Santiago Otero (siryurian@terra.es)
  *
  *
- *   This program is free software; you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *                                                                             
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *                                                                             
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  *
  */
 
@@ -89,7 +89,6 @@
 
 snd_pcm_t* initAlsa(char *dev, int format, int channels, int speed, int mode) 
 {
-  
 	snd_pcm_t *handle;
 	snd_pcm_hw_params_t *hwparams;
 	int err;
@@ -176,6 +175,8 @@
 		alsaerr = -1;
 		return handle; 
 	} 
+	esd_write_size = BUFFERSIZE;
+
 	err = snd_pcm_hw_params(handle, hwparams); 
 	if (err < 0) { 
 		if (alsadbg)
@@ -266,7 +267,6 @@
 
 int esd_audio_open()
 {
-  
 	int channels;
 	int format;
 	int card;
@@ -310,7 +310,7 @@
 		fprintf(stderr, "dev=%s\n",dev);
 
 	alsa_playback_handle = initAlsa(dev, format, channels, 
-									esd_audio_rate, SND_PCM_STREAM_PLAYBACK);
+			esd_audio_rate, SND_PCM_STREAM_PLAYBACK);
 	if(alsaerr) 
 	{
 		if(alsaerr == -1) snd_pcm_close(alsa_playback_handle);
@@ -482,6 +482,4 @@
   
 	if (alsadbg) 
 		print_state();
-  
-  
 }
--- esound-0.2.29.orig/configure
+++ esound-0.2.29/configure
@@ -1010,10 +1010,13 @@
   
 
 
+
+
+
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1017: checking for $ac_word" >&5
+echo "configure:1020: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1043,7 +1046,7 @@
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1047: checking for $ac_word" >&5
+echo "configure:1050: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1094,7 +1097,7 @@
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1098: checking for $ac_word" >&5
+echo "configure:1101: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1126,7 +1129,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1130: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1133: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1137,12 +1140,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 1141 "configure"
+#line 1144 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:1146: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -1168,12 +1171,12 @@
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1172: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1175: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1177: checking whether we are using GNU C" >&5
+echo "configure:1180: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1182,7 +1185,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1186: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1189: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -1201,7 +1204,7 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1205: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1208: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1233,7 +1236,7 @@
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1237: checking how to run the C preprocessor" >&5
+echo "configure:1240: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -1248,13 +1251,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1252 "configure"
+#line 1255 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1258: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1261: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1265,13 +1268,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1269 "configure"
+#line 1272 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1275: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1278: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1282,13 +1285,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 1286 "configure"
+#line 1289 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1292: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1295: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1324,12 +1327,12 @@
 fi
 
 echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:1328: checking for Cygwin environment" >&5
+echo "configure:1331: checking for Cygwin environment" >&5
 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1333 "configure"
+#line 1336 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1340,7 +1343,7 @@
 return __CYGWIN__;
 ; return 0; }
 EOF
-if { (eval echo configure:1344: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1347: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_cygwin=yes
 else
@@ -1357,19 +1360,19 @@
 CYGWIN=
 test "$ac_cv_cygwin" = yes && CYGWIN=yes
 echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:1361: checking for mingw32 environment" >&5
+echo "configure:1364: checking for mingw32 environment" >&5
 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1366 "configure"
+#line 1369 "configure"
 #include "confdefs.h"
 
 int main() {
 return __MINGW32__;
 ; return 0; }
 EOF
-if { (eval echo configure:1373: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1376: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mingw32=yes
 else
@@ -1461,7 +1464,7 @@
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:1465: checking host system type" >&5
+echo "configure:1468: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -1482,7 +1485,7 @@
 echo "$ac_t""$host" 1>&6
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1486: checking build system type" >&5
+echo "configure:1489: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -1511,7 +1514,7 @@
 if test "$GCC" = yes; then
   # Check if gcc -print-prog-name=ld gives a path.
   echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
-echo "configure:1515: checking for ld used by GCC" >&5
+echo "configure:1518: checking for ld used by GCC" >&5
   case $host in
   *-*-mingw*)
     # gcc leaves a trailing carriage return which upsets mingw
@@ -1541,10 +1544,10 @@
   esac
 elif test "$with_gnu_ld" = yes; then
   echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:1545: checking for GNU ld" >&5
+echo "configure:1548: checking for GNU ld" >&5
 else
   echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1548: checking for non-GNU ld" >&5
+echo "configure:1551: checking for non-GNU ld" >&5
 fi
 if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1579,7 +1582,7 @@
 fi
 test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
 echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
-echo "configure:1583: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:1586: checking if the linker ($LD) is GNU ld" >&5
 if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1596,7 +1599,7 @@
 
 
 echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
-echo "configure:1600: checking for $LD option to reload object files" >&5
+echo "configure:1603: checking for $LD option to reload object files" >&5
 if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1608,7 +1611,7 @@
 test -n "$reload_flag" && reload_flag=" $reload_flag"
 
 echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1612: checking for BSD-compatible nm" >&5
+echo "configure:1615: checking for BSD-compatible nm" >&5
 if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1645,8 +1648,92 @@
 NM="$lt_cv_path_NM"
 echo "$ac_t""$NM" 1>&6
 
+echo $ac_n "checking for a sed that does not truncate output""... $ac_c" 1>&6
+echo "configure:1653: checking for a sed that does not truncate output" >&5
+if eval "test \"`echo '$''{'lt_cv_path_SED'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  # Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_executable_p="test -f"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+        _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+
+  # Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+: ${TMPDIR=/tmp}
+{
+  tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=$TMPDIR/sed$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in $TMPDIR" >&2
+   { (exit 1); exit 1; }
+}
+  _max=0
+  _count=0
+  # Add /usr/xpg4/bin/sed as it is typically found on Solaris
+  # along with /bin/sed that truncates output.
+  for _sed in $_sed_list /usr/xpg4/bin/sed; do
+    test ! -f ${_sed} && break
+    cat /dev/null > "$tmp/sed.in"
+    _count=0
+    echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in"
+    # Check for GNU sed and select it if it is found.
+    if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then
+      lt_cv_path_SED=${_sed}
+      break
+    fi
+    while true; do
+      cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp"
+      mv "$tmp/sed.tmp" "$tmp/sed.in"
+      cp "$tmp/sed.in" "$tmp/sed.nl"
+      echo >>"$tmp/sed.nl"
+      ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break
+      cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break
+      # 40000 chars as input seems more than enough
+      test $_count -gt 10 && break
+      _count=`expr $_count + 1`
+      if test $_count -gt $_max; then
+        _max=$_count
+        lt_cv_path_SED=$_sed
+      fi
+    done
+  done
+  rm -rf "$tmp"
+
+fi
+
+if test "X$SED" != "X"; then
+  lt_cv_path_SED=$SED
+else
+  SED=$lt_cv_path_SED
+fi
+echo "$ac_t""$SED" 1>&6
+
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1650: checking whether ln -s works" >&5
+echo "configure:1737: checking whether ln -s works" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1666,8 +1753,8 @@
   echo "$ac_t""no" 1>&6
 fi
 
-echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6
-echo "configure:1671: checking how to recognise dependant libraries" >&5
+echo $ac_n "checking how to recognise dependent libraries""... $ac_c" 1>&6
+echo "configure:1758: checking how to recognise dependent libraries" >&5
 if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1744,9 +1831,9 @@
   lt_cv_file_magic_test_file=/usr/lib/libc.sl
   ;;
 
-irix5* | irix6*)
+irix5* | irix6* | nonstopux*)
   case $host_os in
-  irix5*)
+  irix5* | nonstopux*)
     # this will be overridden with pass_all, but let us keep it just in case
     lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
     ;;
@@ -1768,7 +1855,7 @@
 # This must be Linux ELF.
 linux-gnu*)
   case $host_cpu in
-  alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | x86_64* )
+  alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64*)
     lt_cv_deplibs_check_method=pass_all ;;
   *)
     # glibc up to 2.1.1 does not perform some relocations on ARM
@@ -1839,6 +1926,9 @@
     lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
     lt_cv_file_magic_test_file=/lib/libc.so
     ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
   esac
   ;;
 esac
@@ -1850,13 +1940,13 @@
 deplibs_check_method=$lt_cv_deplibs_check_method
 
 echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:1854: checking for object suffix" >&5
+echo "configure:1944: checking for object suffix" >&5
 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   rm -f conftest*
 echo 'int i = 1;' > conftest.$ac_ext
-if { (eval echo configure:1860: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1950: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   for ac_file in conftest.*; do
     case $ac_file in
     *.c) ;;
@@ -1876,7 +1966,7 @@
 
 
 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1880: checking for executable suffix" >&5
+echo "configure:1970: checking for executable suffix" >&5
 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1886,10 +1976,10 @@
   rm -f conftest*
   echo 'int main () { return 0; }' > conftest.$ac_ext
   ac_cv_exeext=
-  if { (eval echo configure:1890: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+  if { (eval echo configure:1980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
-      *.c | *.o | *.obj) ;;
+      *.$ac_ext | *.c | *.o | *.obj) ;;
       *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
       esac
     done
@@ -1917,7 +2007,7 @@
 
 # Check for command to grab the raw symbol name followed by C symbol from nm.
 echo $ac_n "checking command to parse $NM output""... $ac_c" 1>&6
-echo "configure:1921: checking command to parse $NM output" >&5
+echo "configure:2011: checking command to parse $NM output" >&5
 if eval "test \"`echo '$''{'lt_cv_sys_global_symbol_pipe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1952,9 +2042,12 @@
   lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
   lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
   ;;
-irix*)
+irix* | nonstopux*)
   symcode='[BCDEGRST]'
   ;;
+osf*)
+  symcode='[BCDEGQRST]'
+  ;;
 solaris* | sysv5*)
   symcode='[BDT]'
   ;;
@@ -1997,10 +2090,10 @@
 int main(){nm_test_var='a';nm_test_func();return(0);}
 EOF
 
-  if { (eval echo configure:2001: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  if { (eval echo configure:2094: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     # Now try to grab the symbols.
     nlist=conftest.nm
-    if { (eval echo configure:2004: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5; } && test -s "$nlist"; then
+    if { (eval echo configure:2097: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5; } && test -s "$nlist"; then
       # Try sorting and uniquifying the output.
       if sort "$nlist" | uniq > "$nlist"T; then
 	mv -f "$nlist"T "$nlist"
@@ -2051,7 +2144,7 @@
 	  save_CFLAGS="$CFLAGS"
 	  LIBS="conftstm.$ac_objext"
 	  CFLAGS="$CFLAGS$no_builtin_flag"
-	  if { (eval echo configure:2055: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+	  if { (eval echo configure:2148: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest$ac_exeext; then
 	    pipe_works=yes
 	  fi
 	  LIBS="$save_LIBS"
@@ -2100,17 +2193,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2104: checking for $ac_hdr" >&5
+echo "configure:2197: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2109 "configure"
+#line 2202 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2114: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2207: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2140,12 +2233,13 @@
 
 
 
+
 # Only perform the check for file, if the check method requires it
 case $deplibs_check_method in
 file_magic*)
   if test "$file_magic_cmd" = '$MAGIC_CMD'; then
     echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
-echo "configure:2149: checking for ${ac_tool_prefix}file" >&5
+echo "configure:2243: checking for ${ac_tool_prefix}file" >&5
 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2207,7 +2301,7 @@
 if test -z "$lt_cv_path_MAGIC_CMD"; then
   if test -n "$ac_tool_prefix"; then
     echo $ac_n "checking for file""... $ac_c" 1>&6
-echo "configure:2211: checking for file" >&5
+echo "configure:2305: checking for file" >&5
 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2278,7 +2372,7 @@
 # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2282: checking for $ac_word" >&5
+echo "configure:2376: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2310,7 +2404,7 @@
   # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2314: checking for $ac_word" >&5
+echo "configure:2408: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2345,7 +2439,7 @@
 # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
 set dummy ${ac_tool_prefix}strip; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2349: checking for $ac_word" >&5
+echo "configure:2443: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2377,7 +2471,7 @@
   # Extract the first word of "strip", so it can be a program name with args.
 set dummy strip; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2381: checking for $ac_word" >&5
+echo "configure:2475: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2426,8 +2520,8 @@
 case $host in
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 2430 "configure"' > conftest.$ac_ext
-  if { (eval echo configure:2431: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  echo '#line 2524 "configure"' > conftest.$ac_ext
+  if { (eval echo configure:2525: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     case `/usr/bin/file conftest.$ac_objext` in
     *32-bit*)
       LD="${LD-ld} -32"
@@ -2443,26 +2537,12 @@
   rm -rf conftest*
   ;;
 
-*-*-linux*)
-  # Test if the compiler is 64bit
-  echo 'int i;' > conftest.$ac_ext
-  lt_cv_cc_64bit_output=no
-  if { (eval echo configure:2451: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-    case `/usr/bin/file conftest.$ac_objext` in
-    *"ELF 64"*)
-      lt_cv_cc_64bit_output=yes
-      ;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-  
 *-*-sco3.2v5*)
   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
   SAVE_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -belf"
   echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:2466: checking whether the C compiler needs -belf" >&5
+echo "configure:2546: checking whether the C compiler needs -belf" >&5
 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2475,14 +2555,14 @@
 cross_compiling=$ac_cv_prog_cc_cross
 
      cat > conftest.$ac_ext <<EOF
-#line 2479 "configure"
+#line 2559 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2486: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2566: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   lt_cv_cc_needs_belf=yes
 else
@@ -2602,7 +2682,7 @@
 compiler="$2"
 
 echo $ac_n "checking for objdir""... $ac_c" 1>&6
-echo "configure:2606: checking for objdir" >&5
+echo "configure:2686: checking for objdir" >&5
 rm -f .libs 2>/dev/null
 mkdir .libs 2>/dev/null
 if test -d .libs; then
@@ -2629,7 +2709,7 @@
 # in isolation, and that seeing it set (from the cache) indicates that
 # the associated values are set (in the cache) correctly too.
 echo $ac_n "checking for $compiler option to produce PIC""... $ac_c" 1>&6
-echo "configure:2633: checking for $compiler option to produce PIC" >&5
+echo "configure:2713: checking for $compiler option to produce PIC" >&5
 if eval "test \"`echo '$''{'lt_cv_prog_cc_pic'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2660,7 +2740,7 @@
       # like `-m68040'.
       lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
       ;;
-    beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
       # PIC is the default for these OSes.
       ;;
     darwin* | rhapsody*)
@@ -2703,7 +2783,7 @@
       lt_cv_prog_cc_pic='+Z'
       ;;
 
-    irix5* | irix6*)
+    irix5* | irix6* | nonstopux*)
       lt_cv_prog_cc_wl='-Wl,'
       lt_cv_prog_cc_static='-non_shared'
       # PIC (with -KPIC) is the default.
@@ -2747,11 +2827,7 @@
     sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
       lt_cv_prog_cc_pic='-KPIC'
       lt_cv_prog_cc_static='-Bstatic'
-      if test "x$host_vendor" = xsni; then
-	lt_cv_prog_cc_wl='-LD'
-      else
-	lt_cv_prog_cc_wl='-Wl,'
-      fi
+      lt_cv_prog_cc_wl='-Wl,'
       ;;
 
     uts4*)
@@ -2781,21 +2857,21 @@
 
   # Check to make sure the pic_flag actually works.
   echo $ac_n "checking if $compiler PIC flag $lt_cv_prog_cc_pic works""... $ac_c" 1>&6
-echo "configure:2785: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5
+echo "configure:2861: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5
   if eval "test \"`echo '$''{'lt_cv_prog_cc_pic_works'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
       save_CFLAGS="$CFLAGS"
     CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC"
     cat > conftest.$ac_ext <<EOF
-#line 2792 "configure"
+#line 2868 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2799: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2875: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
         case $host_os in
       hpux9* | hpux10* | hpux11*)
@@ -2847,7 +2923,7 @@
 fi
 
 echo $ac_n "checking if $compiler static flag $lt_cv_prog_cc_static works""... $ac_c" 1>&6
-echo "configure:2851: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5
+echo "configure:2927: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5
 if eval "test \"`echo '$''{'lt_cv_prog_cc_static_works'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2855,14 +2931,14 @@
   save_LDFLAGS="$LDFLAGS"
   LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static"
   cat > conftest.$ac_ext <<EOF
-#line 2859 "configure"
+#line 2935 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2866: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2942: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   lt_cv_prog_cc_static_works=yes
 else
@@ -2889,7 +2965,7 @@
 
 # Check to see if options -o and -c are simultaneously supported by compiler
 echo $ac_n "checking if $compiler supports -c -o file.$ac_objext""... $ac_c" 1>&6
-echo "configure:2893: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo "configure:2969: checking if $compiler supports -c -o file.$ac_objext" >&5
 if eval "test \"`echo '$''{'lt_cv_compiler_c_o'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2908,7 +2984,7 @@
 save_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
 compiler_c_o=no
-if { (eval echo configure:2912: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
+if { (eval echo configure:2988: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
   # The compiler can only warn and ignore the option if not recognized
   # So say no if there are warnings
   if test -s out/conftest.err; then
@@ -2937,7 +3013,7 @@
 if test x"$compiler_c_o" = x"yes"; then
   # Check to see if we can write to a .lo
   echo $ac_n "checking if $compiler supports -c -o file.lo""... $ac_c" 1>&6
-echo "configure:2941: checking if $compiler supports -c -o file.lo" >&5
+echo "configure:3017: checking if $compiler supports -c -o file.lo" >&5
   if eval "test \"`echo '$''{'lt_cv_compiler_o_lo'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2948,14 +3024,14 @@
   save_objext="$ac_objext"
   ac_objext=lo
   cat > conftest.$ac_ext <<EOF
-#line 2952 "configure"
+#line 3028 "configure"
 #include "confdefs.h"
 
 int main() {
 int some_variable = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:2959: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3035: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
       # The compiler can only warn and ignore the option if not recognized
     # So say no if there are warnings
@@ -2986,7 +3062,7 @@
 if test "$compiler_c_o" = no && test "$need_locks" != no; then
   # do not overwrite the value of need_locks provided by the user
   echo $ac_n "checking if we can lock with hard links""... $ac_c" 1>&6
-echo "configure:2990: checking if we can lock with hard links" >&5
+echo "configure:3066: checking if we can lock with hard links" >&5
   hard_links=yes
   $rm conftest*
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
@@ -3005,20 +3081,20 @@
 if test "$GCC" = yes; then
   # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
   echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions""... $ac_c" 1>&6
-echo "configure:3009: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo "configure:3085: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
   echo "int some_variable = 0;" > conftest.$ac_ext
   save_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext"
   compiler_rtti_exceptions=no
   cat > conftest.$ac_ext <<EOF
-#line 3015 "configure"
+#line 3091 "configure"
 #include "confdefs.h"
 
 int main() {
 int some_variable = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:3022: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3098: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
       # The compiler can only warn and ignore the option if not recognized
     # So say no if there are warnings
@@ -3045,7 +3121,7 @@
 
 # See if the linker supports building shared libraries.
 echo $ac_n "checking whether the linker ($LD) supports shared libraries""... $ac_c" 1>&6
-echo "configure:3049: checking whether the linker ($LD) supports shared libraries" >&5
+echo "configure:3125: checking whether the linker ($LD) supports shared libraries" >&5
 
 allow_undefined_flag=
 no_undefined_flag=
@@ -3201,7 +3277,7 @@
     # If the export-symbols file already is a .def file (1st line
     # is EXPORTS), use it as is.
     # If DATA tags from a recent dlltool are present, honour them!
-    archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
+    archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then
 	cp $export_symbols $output_objdir/$soname-def;
       else
 	echo EXPORTS > $output_objdir/$soname-def;
@@ -3210,6 +3286,7 @@
 	 set dummy \$symbol;
 	 case \$# in
 	   2) echo "   \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
+	   4) echo "   \$2 \$3 \$4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;;
 	   *) echo "     \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;;
 	 esac;
 	 _lt_hint=`expr 1 + \$_lt_hint`;
@@ -3322,10 +3399,12 @@
       # need to do runtime linking.
       case $host_os in aix4.[23]|aix4.[23].*|aix5*)
 	for ld_flag in $LDFLAGS; do
-	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+	  case $ld_flag in
+	  *-brtl*)
 	    aix_use_runtimelinking=yes
 	    break
-	  fi
+	  ;;
+	  esac
 	done
       esac
 
@@ -3439,8 +3518,9 @@
     esac
     # FIXME: Relying on posixy $() will cause problems for
     #        cross-compilation, but unfortunately the echo tests do not
-    #        yet detect zsh echo's removal of \ escapes.
-    archive_cmds='$nonopt $(test "x$module" = xyes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring'
+    #        yet detect zsh echo's removal of \ escapes.  Also zsh mangles
+    #	     `"' quotes if we put them in here... so don't!
+    archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)'
     # We need to add '_' to the symbols in $export_symbols first
     #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
     hardcode_direct=yes
@@ -3492,13 +3572,14 @@
     export_dynamic_flag_spec='${wl}-E'
     ;;
 
-  irix5* | irix6*)
+  irix5* | irix6* | nonstopux*)
     if test "$GCC" = yes; then
       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
     else
       archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='-rpath $libdir'
     fi
-    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
     hardcode_libdir_separator=:
     link_all_deplibs=yes
     ;;
@@ -3526,7 +3607,7 @@
     hardcode_direct=yes
     hardcode_shlibpath_var=no
     if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags'
+      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
       hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
       export_dynamic_flag_spec='${wl}-E'
     else
@@ -3536,7 +3617,7 @@
 	hardcode_libdir_flag_spec='-R$libdir'
         ;;
       *)
-        archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags'
+        archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
         hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
         ;;
       esac
@@ -3648,13 +3729,23 @@
     ;;
 
   sysv4)
-    if test "x$host_vendor" = xsno; then
-      archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_direct=yes # is this really true???
-    else
-      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_direct=no #Motorola manual says yes, but my tests say they lie
-    fi
+    case $host_vendor in
+      sni)
+        archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+        hardcode_direct=yes # is this really true???
+        ;;
+      siemens)
+        ## LD is ld it makes a PLAMLIB
+        ## CC just makes a GrossModule.
+        archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+        reload_cmds='$CC -r -o $output$reload_objs'
+        hardcode_direct=no
+        ;;
+      motorola)
+        archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+        hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+        ;;
+    esac
     runpath_var='LD_RUN_PATH'
     hardcode_shlibpath_var=no
     ;;
@@ -3729,7 +3820,7 @@
 
 # Check hardcoding attributes.
 echo $ac_n "checking how to hardcode library paths into programs""... $ac_c" 1>&6
-echo "configure:3733: checking how to hardcode library paths into programs" >&5
+echo "configure:3824: checking how to hardcode library paths into programs" >&5
 hardcode_action=
 if test -n "$hardcode_libdir_flag_spec" || \
    test -n "$runpath_var"; then
@@ -3757,7 +3848,7 @@
 striplib=
 old_striplib=
 echo $ac_n "checking whether stripping libraries is possible""... $ac_c" 1>&6
-echo "configure:3761: checking whether stripping libraries is possible" >&5
+echo "configure:3852: checking whether stripping libraries is possible" >&5
 if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
   test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
   test -z "$striplib" && striplib="$STRIP --strip-unneeded"
@@ -3771,7 +3862,7 @@
 
 # PORTME Fill in your ld.so characteristics
 echo $ac_n "checking dynamic linker characteristics""... $ac_c" 1>&6
-echo "configure:3775: checking dynamic linker characteristics" >&5
+echo "configure:3866: checking dynamic linker characteristics" >&5
 library_names_spec=
 libname_spec='lib$name'
 soname_spec=
@@ -3783,8 +3874,8 @@
 shlibpath_overrides_runpath=unknown
 version_type=none
 dynamic_linker="$host_os ld.so"
-sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib"
-sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
 
 case $host_os in
 aix3*)
@@ -3798,6 +3889,9 @@
 
 aix4* | aix5*)
   version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
   if test "$host_cpu" = ia64; then
     # AIX 5 supports IA64
     library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so'
@@ -3836,6 +3930,7 @@
     fi
     shlibpath_var=LIBPATH
   fi
+  hardcode_into_libs=yes
   ;;
 
 amigaos*)
@@ -3883,7 +3978,7 @@
     ;;
   yes,mingw*)
     library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
-    sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"`
+    sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"`
     ;;
   yes,pw32*)
     library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll'
@@ -3915,6 +4010,18 @@
   dynamic_linker=no
   ;;
 
+freebsd*-gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU/FreeBSD ld.so'
+  ;;
+
 freebsd*)
   objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
   version_type=freebsd-$objformat
@@ -3966,14 +4073,17 @@
   postinstall_cmds='chmod 555 $lib'
   ;;
 
-irix5* | irix6*)
-  version_type=irix
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)          version_type=irix ;;
+  esac
   need_lib_prefix=no
   need_version=no
   soname_spec='${libname}${release}.so$major'
   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so'
   case $host_os in
-  irix5*)
+  irix5* | nonstopux*)
     libsuff= shlibsuff=
     ;;
   *)
@@ -4011,13 +4121,6 @@
   # before this can be enabled.
   hardcode_into_libs=yes
 
-  case $host_cpu:$lt_cv_cc_64bit_output in
-  powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes)
-    sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64"
-    sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64"
-    ;;
-  esac
-
   # We used to test for /lib/ld.so.1 and disable shared libraries on
   # powerpc, because MkLinux only supported shared libraries with the
   # GNU dynamic linker.  Since this was broken with cross compilers,
@@ -4084,11 +4187,13 @@
 osf3* | osf4* | osf5*)
   version_type=osf
   need_version=no
-  soname_spec='${libname}${release}.so'
-  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+  need_lib_prefix=no
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
   shlibpath_var=LD_LIBRARY_PATH
   sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
   sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  hardcode_into_libs=yes
   ;;
 
 sco3.2v5*)
@@ -4131,6 +4236,12 @@
   case $host_vendor in
     sni)
       shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
       ;;
     motorola)
       need_lib_prefix=no
@@ -4175,11 +4286,11 @@
 
 # Report the final consequences.
 echo $ac_n "checking if libtool supports shared libraries""... $ac_c" 1>&6
-echo "configure:4179: checking if libtool supports shared libraries" >&5
+echo "configure:4290: checking if libtool supports shared libraries" >&5
 echo "$ac_t""$can_build_shared" 1>&6
 
 echo $ac_n "checking whether to build shared libraries""... $ac_c" 1>&6
-echo "configure:4183: checking whether to build shared libraries" >&5
+echo "configure:4294: checking whether to build shared libraries" >&5
 test "$can_build_shared" = "no" && enable_shared=no
 
 # On AIX, shared libraries and static libraries use the same namespace, and
@@ -4202,7 +4313,7 @@
 echo "$ac_t""$enable_shared" 1>&6
 
 echo $ac_n "checking whether to build static libraries""... $ac_c" 1>&6
-echo "configure:4206: checking whether to build static libraries" >&5
+echo "configure:4317: checking whether to build static libraries" >&5
 # Make sure either enable_shared or enable_static is yes.
 test "$enable_shared" = yes || enable_static=yes
 echo "$ac_t""$enable_static" 1>&6
@@ -4243,12 +4354,12 @@
 
   *)
     echo $ac_n "checking for shl_load""... $ac_c" 1>&6
-echo "configure:4247: checking for shl_load" >&5
+echo "configure:4358: checking for shl_load" >&5
 if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4252 "configure"
+#line 4363 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char shl_load(); below.  */
@@ -4271,7 +4382,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4275: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_shl_load=yes"
 else
@@ -4289,7 +4400,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
-echo "configure:4293: checking for shl_load in -ldld" >&5
+echo "configure:4404: checking for shl_load in -ldld" >&5
 ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4297,7 +4408,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldld  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4301 "configure"
+#line 4412 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4308,7 +4419,7 @@
 shl_load()
 ; return 0; }
 EOF
-if { (eval echo configure:4312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4423: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4327,12 +4438,12 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for dlopen""... $ac_c" 1>&6
-echo "configure:4331: checking for dlopen" >&5
+echo "configure:4442: checking for dlopen" >&5
 if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4336 "configure"
+#line 4447 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dlopen(); below.  */
@@ -4355,7 +4466,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4470: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_dlopen=yes"
 else
@@ -4373,7 +4484,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:4377: checking for dlopen in -ldl" >&5
+echo "configure:4488: checking for dlopen in -ldl" >&5
 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4381,7 +4492,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4385 "configure"
+#line 4496 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4392,7 +4503,7 @@
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:4396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4507: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4411,7 +4522,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for dlopen in -lsvld""... $ac_c" 1>&6
-echo "configure:4415: checking for dlopen in -lsvld" >&5
+echo "configure:4526: checking for dlopen in -lsvld" >&5
 ac_lib_var=`echo svld'_'dlopen | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4419,7 +4530,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lsvld  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4423 "configure"
+#line 4534 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4430,7 +4541,7 @@
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:4434: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4545: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4449,7 +4560,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6
-echo "configure:4453: checking for dld_link in -ldld" >&5
+echo "configure:4564: checking for dld_link in -ldld" >&5
 ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4457,7 +4568,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldld  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4461 "configure"
+#line 4572 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4468,7 +4579,7 @@
 dld_link()
 ; return 0; }
 EOF
-if { (eval echo configure:4472: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4583: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4524,7 +4635,7 @@
     LIBS="$lt_cv_dlopen_libs $LIBS"
 
     echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6
-echo "configure:4528: checking whether a program can dlopen itself" >&5
+echo "configure:4639: checking whether a program can dlopen itself" >&5
 if eval "test \"`echo '$''{'lt_cv_dlopen_self'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4534,7 +4645,7 @@
     lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 4538 "configure"
+#line 4649 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -4595,7 +4706,7 @@
     exit (status);
 }
 EOF
-  if { (eval echo configure:4599: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
+  if { (eval echo configure:4710: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
     (./conftest; exit; ) 2>/dev/null
     lt_status=$?
     case x$lt_status in
@@ -4618,7 +4729,7 @@
     if test "x$lt_cv_dlopen_self" = xyes; then
       LDFLAGS="$LDFLAGS $link_static_flag"
       echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6
-echo "configure:4622: checking whether a statically linked program can dlopen itself" >&5
+echo "configure:4733: checking whether a statically linked program can dlopen itself" >&5
 if eval "test \"`echo '$''{'lt_cv_dlopen_self_static'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4628,7 +4739,7 @@
     lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 4632 "configure"
+#line 4743 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -4689,7 +4800,7 @@
     exit (status);
 }
 EOF
-  if { (eval echo configure:4693: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
+  if { (eval echo configure:4804: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
     (./conftest; exit; ) 2>/dev/null
     lt_status=$?
     case x$lt_status in
@@ -4738,14 +4849,14 @@
     # systems, -lgcc has to come before -lc. If gcc already passes -lc
     # to ld, don't add -lc before -lgcc.
     echo $ac_n "checking whether -lc should be explicitly linked in""... $ac_c" 1>&6
-echo "configure:4742: checking whether -lc should be explicitly linked in" >&5
+echo "configure:4853: checking whether -lc should be explicitly linked in" >&5
     if eval "test \"`echo '$''{'lt_cv_archive_cmds_need_lc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   $rm conftest*
     echo 'static int dummy;' > conftest.$ac_ext
 
-    if { (eval echo configure:4749: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+    if { (eval echo configure:4860: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
       soname=conftest
       lib=conftest
       libobjs=conftest.$ac_objext
@@ -4758,7 +4869,7 @@
       libname=conftest
       save_allow_undefined_flag=$allow_undefined_flag
       allow_undefined_flag=
-      if { (eval echo configure:4762: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\") 1>&5; (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5; }
+      if { (eval echo configure:4873: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\") 1>&5; (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5; }
       then
 	lt_cv_archive_cmds_need_lc=no
       else
@@ -4798,7 +4909,7 @@
   # Now quote all the things that may contain metacharacters while being
   # careful not to overquote the AC_SUBSTed values.  We take copies of the
   # variables and quote the copies for generation of the libtool script.
-  for var in echo old_CC old_CFLAGS \
+  for var in echo old_CC old_CFLAGS SED \
     AR AR_FLAGS CC LD LN_S NM SHELL \
     reload_flag reload_cmds wl \
     pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
@@ -4860,8 +4971,11 @@
 # configuration script generated by Autoconf, you may include it under
 # the same distribution terms that you use for the rest of that program.
 
+# A sed that does not truncate output.
+SED=$lt_SED
+
 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
-Xsed="sed -e s/^X//"
+Xsed="${SED} -e s/^X//"
 
 # The HP-UX ksh and POSIX shell print the target directory to stdout
 # if CDPATH is set.
@@ -5349,7 +5463,7 @@
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:5353: checking host system type" >&5
+echo "configure:5467: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -5370,7 +5484,7 @@
 echo "$ac_t""$host" 1>&6
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:5374: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:5488: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5409,7 +5523,7 @@
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:5413: checking for a BSD compatible install" >&5
+echo "configure:5527: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5464,12 +5578,12 @@
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:5468: checking for working const" >&5
+echo "configure:5582: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5473 "configure"
+#line 5587 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -5518,7 +5632,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5522: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5636: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -5539,14 +5653,14 @@
 fi
 
 echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:5543: checking whether byte ordering is bigendian" >&5
+echo "configure:5657: checking whether byte ordering is bigendian" >&5
 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_bigendian=unknown
 # See if sys/param.h defines the BYTE_ORDER macro.
 cat > conftest.$ac_ext <<EOF
-#line 5550 "configure"
+#line 5664 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -5557,11 +5671,11 @@
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:5561: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5675: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   # It does; now see whether it defined to BIG_ENDIAN or not.
 cat > conftest.$ac_ext <<EOF
-#line 5565 "configure"
+#line 5679 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -5572,7 +5686,7 @@
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:5576: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5690: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_bigendian=yes
 else
@@ -5592,7 +5706,7 @@
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 5596 "configure"
+#line 5710 "configure"
 #include "confdefs.h"
 main () {
   /* Are we little or big endian?  From Harbison&Steele.  */
@@ -5605,7 +5719,7 @@
   exit (u.c[sizeof (long) - 1] == 1);
 }
 EOF
-if { (eval echo configure:5609: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_bigendian=no
 else
@@ -5629,21 +5743,21 @@
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:5633: checking for inline" >&5
+echo "configure:5747: checking for inline" >&5
 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
   cat > conftest.$ac_ext <<EOF
-#line 5640 "configure"
+#line 5754 "configure"
 #include "confdefs.h"
 
 int main() {
 } $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:5647: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5761: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -5673,19 +5787,19 @@
 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
 # for constant arguments.  Useless!
 echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:5677: checking for working alloca.h" >&5
+echo "configure:5791: checking for working alloca.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5682 "configure"
+#line 5796 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:5689: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5803: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_header_alloca_h=yes
 else
@@ -5706,12 +5820,12 @@
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:5710: checking for alloca" >&5
+echo "configure:5824: checking for alloca" >&5
 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5715 "configure"
+#line 5829 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -5739,7 +5853,7 @@
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:5743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_func_alloca_works=yes
 else
@@ -5771,12 +5885,12 @@
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:5775: checking whether alloca needs Cray hooks" >&5
+echo "configure:5889: checking whether alloca needs Cray hooks" >&5
 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5780 "configure"
+#line 5894 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -5801,12 +5915,12 @@
 if test $ac_cv_os_cray = yes; then
 for ac_func in _getb67 GETB67 getb67; do
   echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5805: checking for $ac_func" >&5
+echo "configure:5919: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5810 "configure"
+#line 5924 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -5829,7 +5943,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5947: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -5856,7 +5970,7 @@
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:5860: checking stack direction for C alloca" >&5
+echo "configure:5974: checking stack direction for C alloca" >&5
 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5864,7 +5978,7 @@
   ac_cv_c_stack_direction=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 5868 "configure"
+#line 5982 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -5883,7 +5997,7 @@
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:5887: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6001: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_stack_direction=1
 else
@@ -5907,12 +6021,12 @@
 for ac_func in setenv putenv fchown fchmod gethostbyname2
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5911: checking for $ac_func" >&5
+echo "configure:6025: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5916 "configure"
+#line 6030 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -5935,7 +6049,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5939: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -5960,12 +6074,12 @@
 done
 
 echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:5964: checking for connect" >&5
+echo "configure:6078: checking for connect" >&5
 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5969 "configure"
+#line 6083 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char connect(); below.  */
@@ -5988,7 +6102,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5992: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_connect=yes"
 else
@@ -6006,7 +6120,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:6010: checking for connect in -lsocket" >&5
+echo "configure:6124: checking for connect in -lsocket" >&5
 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6014,7 +6128,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6018 "configure"
+#line 6132 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -6025,7 +6139,7 @@
 connect()
 ; return 0; }
 EOF
-if { (eval echo configure:6029: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6055,12 +6169,12 @@
 fi
 
 echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:6059: checking for gethostbyname" >&5
+echo "configure:6173: checking for gethostbyname" >&5
 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6064 "configure"
+#line 6178 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -6083,7 +6197,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6087: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_gethostbyname=yes"
 else
@@ -6101,7 +6215,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:6105: checking for gethostbyname in -lnsl" >&5
+echo "configure:6219: checking for gethostbyname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6109,7 +6223,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6113 "configure"
+#line 6227 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -6120,7 +6234,7 @@
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:6124: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6150,12 +6264,12 @@
 fi
 
 echo $ac_n "checking for nanosleep""... $ac_c" 1>&6
-echo "configure:6154: checking for nanosleep" >&5
+echo "configure:6268: checking for nanosleep" >&5
 if eval "test \"`echo '$''{'ac_cv_func_nanosleep'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6159 "configure"
+#line 6273 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char nanosleep(); below.  */
@@ -6178,7 +6292,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6182: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6296: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_nanosleep=yes"
 else
@@ -6197,7 +6311,7 @@
   echo "$ac_t""no" 1>&6
 
   echo $ac_n "checking for nanosleep in -lrt""... $ac_c" 1>&6
-echo "configure:6201: checking for nanosleep in -lrt" >&5
+echo "configure:6315: checking for nanosleep in -lrt" >&5
 ac_lib_var=`echo rt'_'nanosleep | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6205,7 +6319,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lrt  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6209 "configure"
+#line 6323 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -6216,7 +6330,7 @@
 nanosleep()
 ; return 0; }
 EOF
-if { (eval echo configure:6220: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6334: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6242,7 +6356,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for nanosleep in -lposix4""... $ac_c" 1>&6
-echo "configure:6246: checking for nanosleep in -lposix4" >&5
+echo "configure:6360: checking for nanosleep in -lposix4" >&5
 ac_lib_var=`echo posix4'_'nanosleep | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6250,7 +6364,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lposix4  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6254 "configure"
+#line 6368 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -6261,7 +6375,7 @@
 nanosleep()
 ; return 0; }
 EOF
-if { (eval echo configure:6265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6379: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6295,12 +6409,12 @@
 for ac_func in usleep
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6299: checking for $ac_func" >&5
+echo "configure:6413: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6304 "configure"
+#line 6418 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6323,7 +6437,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6327: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6441: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6348,12 +6462,12 @@
 done
 
 echo $ac_n "checking for inet_aton""... $ac_c" 1>&6
-echo "configure:6352: checking for inet_aton" >&5
+echo "configure:6466: checking for inet_aton" >&5
 if eval "test \"`echo '$''{'ac_cv_func_inet_aton'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6357 "configure"
+#line 6471 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char inet_aton(); below.  */
@@ -6376,7 +6490,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6380: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6494: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_inet_aton=yes"
 else
@@ -6394,7 +6508,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for inet_aton in -lresolv""... $ac_c" 1>&6
-echo "configure:6398: checking for inet_aton in -lresolv" >&5
+echo "configure:6512: checking for inet_aton in -lresolv" >&5
 ac_lib_var=`echo resolv'_'inet_aton | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6402,7 +6516,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lresolv  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6406 "configure"
+#line 6520 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -6413,7 +6527,7 @@
 inet_aton()
 ; return 0; }
 EOF
-if { (eval echo configure:6417: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6531: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6445,12 +6559,12 @@
 for ac_func in strtok_r
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6449: checking for $ac_func" >&5
+echo "configure:6563: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6454 "configure"
+#line 6568 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6473,7 +6587,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6477: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6516,7 +6630,7 @@
 
   
 cat > conftest.$ac_ext <<EOF
-#line 6520 "configure"
+#line 6634 "configure"
 #include "confdefs.h"
 
     #include<sys/types.h>
@@ -6525,7 +6639,7 @@
 unsigned long ul = INADDR_LOOPBACK;
 ; return 0; }
 EOF
-if { (eval echo configure:6529: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6643: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   :
 else
   echo "configure: failed program was:" >&5
@@ -6541,7 +6655,7 @@
 
 
 cat > conftest.$ac_ext <<EOF
-#line 6545 "configure"
+#line 6659 "configure"
 #include "confdefs.h"
 
     #include<sys/types.h>
@@ -6550,7 +6664,7 @@
 struct sockaddr_un su; int i = SUN_LEN(&su);
 ; return 0; }
 EOF
-if { (eval echo configure:6554: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6668: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define HAVE_SUN_LEN 1
@@ -6564,12 +6678,12 @@
 
 
 echo $ac_n "checking for getopt_long""... $ac_c" 1>&6
-echo "configure:6568: checking for getopt_long" >&5
+echo "configure:6682: checking for getopt_long" >&5
 if eval "test \"`echo '$''{'ac_cv_func_getopt_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6573 "configure"
+#line 6687 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char getopt_long(); below.  */
@@ -6592,7 +6706,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6596: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6710: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_getopt_long=yes"
 else
@@ -6627,17 +6741,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6631: checking for $ac_hdr" >&5
+echo "configure:6745: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6636 "configure"
+#line 6750 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6641: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6755: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6702,17 +6816,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6706: checking for $ac_hdr" >&5
+echo "configure:6820: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6711 "configure"
+#line 6825 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6716: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6830: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6742,17 +6856,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6746: checking for $ac_hdr" >&5
+echo "configure:6860: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6751 "configure"
+#line 6865 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6756: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6870: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6782,17 +6896,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6786: checking for $ac_hdr" >&5
+echo "configure:6900: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6791 "configure"
+#line 6905 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6796: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6910: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6825,17 +6939,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6829: checking for $ac_hdr" >&5
+echo "configure:6943: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6834 "configure"
+#line 6948 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6839: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6953: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6984,12 +7098,12 @@
    echo "--- Checking to see which audio libraries are required for linking.";
    echo "--- Most of these checks should also fail. Do not be alarmed.";
    echo $ac_n "checking for _oss_ioctl""... $ac_c" 1>&6
-echo "configure:6988: checking for _oss_ioctl" >&5
+echo "configure:7102: checking for _oss_ioctl" >&5
 if eval "test \"`echo '$''{'ac_cv_func__oss_ioctl'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6993 "configure"
+#line 7107 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char _oss_ioctl(); below.  */
@@ -7012,7 +7126,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:7016: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func__oss_ioctl=yes"
 else
@@ -7030,7 +7144,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for _oss_ioctl in -lossaudio""... $ac_c" 1>&6
-echo "configure:7034: checking for _oss_ioctl in -lossaudio" >&5
+echo "configure:7148: checking for _oss_ioctl in -lossaudio" >&5
 ac_lib_var=`echo ossaudio'_'_oss_ioctl | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -7038,7 +7152,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lossaudio  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7042 "configure"
+#line 7156 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -7049,7 +7163,7 @@
 _oss_ioctl()
 ; return 0; }
 EOF
-if { (eval echo configure:7053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7167: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7079,12 +7193,12 @@
 fi
 
    echo $ac_n "checking for ALnewconfig""... $ac_c" 1>&6
-echo "configure:7083: checking for ALnewconfig" >&5
+echo "configure:7197: checking for ALnewconfig" >&5
 if eval "test \"`echo '$''{'ac_cv_func_ALnewconfig'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7088 "configure"
+#line 7202 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char ALnewconfig(); below.  */
@@ -7107,7 +7221,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:7111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7225: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_ALnewconfig=yes"
 else
@@ -7125,7 +7239,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for ALnewconfig in -laudio""... $ac_c" 1>&6
-echo "configure:7129: checking for ALnewconfig in -laudio" >&5
+echo "configure:7243: checking for ALnewconfig in -laudio" >&5
 ac_lib_var=`echo audio'_'ALnewconfig | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -7133,7 +7247,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-laudio  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7137 "configure"
+#line 7251 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -7144,7 +7258,7 @@
 ALnewconfig()
 ; return 0; }
 EOF
-if { (eval echo configure:7148: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7262: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7175,12 +7289,12 @@
 
    if test "x$enable_alsa" = "xyes"; then
       echo $ac_n "checking for snd_cards""... $ac_c" 1>&6
-echo "configure:7179: checking for snd_cards" >&5
+echo "configure:7293: checking for snd_cards" >&5
 if eval "test \"`echo '$''{'ac_cv_func_snd_cards'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7184 "configure"
+#line 7298 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char snd_cards(); below.  */
@@ -7203,7 +7317,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:7207: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_snd_cards=yes"
 else
@@ -7221,7 +7335,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for snd_cards in -lsound""... $ac_c" 1>&6
-echo "configure:7225: checking for snd_cards in -lsound" >&5
+echo "configure:7339: checking for snd_cards in -lsound" >&5
 ac_lib_var=`echo sound'_'snd_cards | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -7229,7 +7343,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lsound  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7233 "configure"
+#line 7347 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -7240,7 +7354,7 @@
 snd_cards()
 ; return 0; }
 EOF
-if { (eval echo configure:7244: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7270,12 +7384,12 @@
 fi
 
       echo $ac_n "checking for snd_cards""... $ac_c" 1>&6
-echo "configure:7274: checking for snd_cards" >&5
+echo "configure:7388: checking for snd_cards" >&5
 if eval "test \"`echo '$''{'ac_cv_func_snd_cards'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7279 "configure"
+#line 7393 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char snd_cards(); below.  */
@@ -7298,7 +7412,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:7302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7416: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_snd_cards=yes"
 else
@@ -7316,7 +7430,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for snd_cards in -lasound""... $ac_c" 1>&6
-echo "configure:7320: checking for snd_cards in -lasound" >&5
+echo "configure:7434: checking for snd_cards in -lasound" >&5
 ac_lib_var=`echo asound'_'snd_cards | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -7324,7 +7438,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lasound  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7328 "configure"
+#line 7442 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -7335,7 +7449,7 @@
 snd_cards()
 ; return 0; }
 EOF
-if { (eval echo configure:7339: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7365,12 +7479,12 @@
 fi
 
       echo $ac_n "checking for snd_pcm_pause""... $ac_c" 1>&6
-echo "configure:7369: checking for snd_pcm_pause" >&5
+echo "configure:7483: checking for snd_pcm_pause" >&5
 if eval "test \"`echo '$''{'ac_cv_func_snd_pcm_pause'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7374 "configure"
+#line 7488 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char snd_pcm_pause(); below.  */
@@ -7393,7 +7507,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:7397: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_snd_pcm_pause=yes"
 else
@@ -7411,7 +7525,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for snd_pcm_pause in -lasound""... $ac_c" 1>&6
-echo "configure:7415: checking for snd_pcm_pause in -lasound" >&5
+echo "configure:7529: checking for snd_pcm_pause in -lasound" >&5
 ac_lib_var=`echo asound'_'snd_pcm_pause | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -7419,7 +7533,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lasound  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7423 "configure"
+#line 7537 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -7430,7 +7544,7 @@
 snd_pcm_pause()
 ; return 0; }
 EOF
-if { (eval echo configure:7434: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7540,7 +7654,7 @@
   # Extract the first word of "audiofile-config", so it can be a program name with args.
 set dummy audiofile-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:7544: checking for $ac_word" >&5
+echo "configure:7658: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_AUDIOFILE_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7575,7 +7689,7 @@
 
   min_audiofile_version=0.1.5
   echo $ac_n "checking for Audio File Library - version >= $min_audiofile_version""... $ac_c" 1>&6
-echo "configure:7579: checking for Audio File Library - version >= $min_audiofile_version" >&5
+echo "configure:7693: checking for Audio File Library - version >= $min_audiofile_version" >&5
   no_audiofile=""
   if test "$AUDIOFILE_CONFIG" = "no" ; then
     no_audiofile=yes
@@ -7606,7 +7720,7 @@
   echo $ac_n "cross compiling; assumed OK... $ac_c"
 else
   cat > conftest.$ac_ext <<EOF
-#line 7610 "configure"
+#line 7724 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -7664,7 +7778,7 @@
 
 
 EOF
-if { (eval echo configure:7668: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7782: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -7719,7 +7833,7 @@
           CFLAGS="$CFLAGS $AUDIOFILE_CFLAGS"
           LIBS="$LIBS $AUDIOFILE_LIBS"
           cat > conftest.$ac_ext <<EOF
-#line 7723 "configure"
+#line 7837 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -7729,7 +7843,7 @@
  return 0; 
 ; return 0; }
 EOF
-if { (eval echo configure:7733: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
    cat <<END
 *** The test program compiled, but did not run.  This usually means that
@@ -7818,7 +7932,7 @@
 # Extract the first word of "db2html", so it can be a program name with args.
 set dummy db2html; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:7822: checking for $ac_word" >&5
+echo "configure:7936: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_have_db2html'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7855,7 +7969,7 @@
 # Extract the first word of "db2ps", so it can be a program name with args.
 set dummy db2ps; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:7859: checking for $ac_word" >&5
+echo "configure:7973: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_have_db2ps'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7905,11 +8019,11 @@
    LIBS="$LIBS -lwrap"
 
    echo $ac_n "checking for tcp_wrapper library and headers""... $ac_c" 1>&6
-echo "configure:7909: checking for tcp_wrapper library and headers" >&5
+echo "configure:8023: checking for tcp_wrapper library and headers" >&5
 
    wrap_ok=no
    cat > conftest.$ac_ext <<EOF
-#line 7913 "configure"
+#line 8027 "configure"
 #include "confdefs.h"
 #include <tcpd.h>
 #include <syslog.h>
@@ -7919,7 +8033,7 @@
 struct request_info *request; return hosts_access (request);
 ; return 0; }
 EOF
-if { (eval echo configure:7923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8037: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define USE_LIBWRAP 1
@@ -7933,7 +8047,7 @@
   rm -rf conftest*
   LIBS="$LIBS -lnsl"
        cat > conftest.$ac_ext <<EOF
-#line 7937 "configure"
+#line 8051 "configure"
 #include "confdefs.h"
 #include <tcpd.h>
 #include <syslog.h>
@@ -7943,7 +8057,7 @@
 struct request_info *request; return hosts_access (request);
 ; return 0; }
 EOF
-if { (eval echo configure:7947: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8061: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define USE_LIBWRAP 1
@@ -7967,7 +8081,7 @@
 dsp_ok=no DL_LIB=
 
 echo $ac_n "checking if your platform supports esddsp""... $ac_c" 1>&6
-echo "configure:7971: checking if your platform supports esddsp" >&5
+echo "configure:8085: checking if your platform supports esddsp" >&5
 case "$host_os" in
   linux* | freebsd* | bsdi4* )
     dsp_ok=yes
@@ -7977,12 +8091,12 @@
 
 if test "x$dsp_ok" = xyes; then
    echo $ac_n "checking for dlopen""... $ac_c" 1>&6
-echo "configure:7981: checking for dlopen" >&5
+echo "configure:8095: checking for dlopen" >&5
 if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7986 "configure"
+#line 8100 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dlopen(); below.  */
@@ -8005,7 +8119,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:8009: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8123: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_dlopen=yes"
 else
@@ -8023,7 +8137,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:8027: checking for dlopen in -ldl" >&5
+echo "configure:8141: checking for dlopen in -ldl" >&5
 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -8031,7 +8145,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 8035 "configure"
+#line 8149 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -8042,7 +8156,7 @@
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:8046: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8160: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -8066,6 +8180,65 @@
 
    ESDDSP=esddsp
    LIBESDDSP=libesddsp.la
+   
+echo $ac_n "checking for stdio emulation in esddsp""... $ac_c" 1>&6
+echo "configure:8186: checking for stdio emulation in esddsp" >&5
+if eval "test \"`echo '$''{'ac_cv_esddsp_stdio_emu'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext <<EOF
+#line 8200 "configure"
+#include "confdefs.h"
+
+#define _GNU_SOURCE
+#include <stdio.h>
+
+int main() {
+
+	cookie_io_functions_t fns = { 0, 0, 0, 0 };
+	struct fd_cookie *fdc = 0;
+	FILE *out = fopencookie (fdc,"w", fns);
+	out->_fileno = 0;
+
+; return 0; }
+EOF
+if { (eval echo configure:8215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ac_cv_esddsp_stdio_emu=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_esddsp_stdio_emu=no
+fi
+rm -f conftest*
+
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_esddsp_stdio_emu" 1>&6
+if test "x$ac_cv_esddsp_stdio_emu" = "xyes"; then
+  cat >> confdefs.h <<\EOF
+#define ESDDSP_STDIO_EMU 1
+EOF
+
+fi
+
 fi
 
 
--- esound-0.2.29.orig/players.c
+++ esound-0.2.29/players.c
@@ -288,12 +288,11 @@
 	FD_SET( player->source_id, &rd_fds );
 
 	/* if the data is ready, read a block */
-	can_read = select( player->source_id + 1, 
-			   &rd_fds, NULL, NULL, &timeout ) ;
+ 	can_read = (( player->actual_length < player->buffer_length ) &&
+ 		select( player->source_id + 1, &rd_fds, NULL, NULL, &timeout ));
+ 	
 	if ( can_read > 0 )
 	{
-	    player->actual_length = 0;
-	    do {
 		ESD_READ_BIN( player->source_id,
 			      player->data_buffer + player->actual_length, 
 			      player->buffer_length - player->actual_length,
@@ -303,19 +302,15 @@
 		if ( actual == 0 
 		     || ( actual < 0 && errno != EAGAIN && errno != EINTR ) )
 		    return -1;
-		/* more data, save how much we got */
-		if ( actual > 0 )
-		   player->actual_length += actual;
-	    } while (player->actual_length < player->buffer_length);
 
 	    /* endian swap multi-byte data if we need to */
 	    client = (esd_client_t *) (player->parent);
 	    if ( client->swap_byte_order 
 		 && ( (player->format & ESD_MASK_BITS) == ESD_BITS16 ) )
 	    {
-		buffer = (unsigned short*) player->data_buffer;
+		buffer = (unsigned short*) player->data_buffer+player->actual_length;
 		for ( pos = buffer 
-			  ; pos < buffer + player->actual_length / sizeof(short)
+			  ; pos < buffer + actual / sizeof(short)
 			  ; pos ++ )
 		{
 		    data = swap_endian_16( (*pos) );
@@ -323,6 +318,9 @@
 		}
 	    }
 
+	    /* more data, save how much we got */
+	    player->actual_length += actual;
+
 	} else if ( can_read < 0 ) {
 	    sprintf( message, "error reading client (%d)\n", 
 		     player->source_id );
@@ -347,15 +345,16 @@
 
 	/* copy the data from the sample to the player */
 	actual = ( ((esd_sample_t*)player->parent)->sample_length 
-		   - player->last_pos > player->buffer_length )
-	    ? player->buffer_length 
+		   - player->last_pos > player->buffer_length-player->actual_length )
+	    ? player->buffer_length-player->actual_length
 	    : ((esd_sample_t*)player->parent)->sample_length - player->last_pos;
 	if ( actual > 0 ) {
-	    memcpy( player->data_buffer, 
+	    memcpy( player->data_buffer+player->actual_length, 
 		    ((esd_sample_t*)player->parent)->data_buffer 
 		    + player->last_pos, actual );
 	    player->last_pos += actual;
-	    if ( ( player->format & ESD_MASK_FUNC ) != ESD_LOOP ) {
+	    player->actual_length += actual;
+	    if ( player->actual_length == player->buffer_length || ( player->format & ESD_MASK_FUNC ) != ESD_LOOP ) {
 		/* we're done for this iteration */
 		break;
 	    }
@@ -364,34 +363,39 @@
 	    return -1;
 	}
 
-	/* we are looping, see if we need to copy another block */
-	if ( player->last_pos >= ((esd_sample_t*)player->parent)->sample_length ) {
-	    player->last_pos = 0;
-	}
+	while ( player->actual_length < player->buffer_length ) {
+	    /* we are looping, see if we need to copy another block */
+	    if ( player->last_pos >= ((esd_sample_t*)player->parent)->sample_length ) {
+		player->last_pos = 0;
 
-	actual_2nd = ( ((esd_sample_t*)player->parent)->sample_length 
-		   - player->last_pos > player->buffer_length - actual )
-	    ? player->buffer_length - actual
-	    : ((esd_sample_t*)player->parent)->sample_length - player->last_pos;
-	if ( actual_2nd >= 0 ) {
 	    /* only keep going if we didn't want to stop looping */
-	    if ( ( ((esd_sample_t*)player->parent)->format & ESD_MASK_FUNC )
-		 != ESD_STOP ) {
-		memcpy( player->data_buffer + actual, 
+	    if ( ( ((esd_sample_t*)player->parent)->format & ESD_MASK_FUNC ) 
+	      == ESD_STOP ) 
+		break;
+	    }
+
+	    /* copy the data from the sample to the player */
+	    actual_2nd = ( ((esd_sample_t*)player->parent)->sample_length 
+		       - player->last_pos > player->buffer_length-player->actual_length )
+		? player->buffer_length-player->actual_length
+		: ((esd_sample_t*)player->parent)->sample_length - player->last_pos;
+	    if ( actual_2nd > 0 ) {
+		memcpy( player->data_buffer+player->actual_length, 
 			((esd_sample_t*)player->parent)->data_buffer 
 			+ player->last_pos, actual_2nd );
 		player->last_pos += actual_2nd;
 		actual += actual_2nd;
+		player->actual_length += actual_2nd;
 
 		/* make sure we're not at the end */
 		if ( player->last_pos >= ((esd_sample_t*)player->parent)->sample_length ) {
 		    player->last_pos = 0;
+		    /* only keep going if we didn't want to stop looping */
+		    if ( ( ((esd_sample_t*)player->parent)->format & ESD_MASK_FUNC ) 
+		      == ESD_STOP ) 
+			break;
 		}
 	    }
-
-	} else {
-	    /* something horrible has happened to the sample */
-	    return -1;
 	}
 
 	/* sample data is swapped as it's cached, no swap needed here */
@@ -547,8 +551,8 @@
     if ( (player->format & ESD_MASK_CHAN) == ESD_MONO )
 	player->buffer_length /= 2;
 
-    /* force to an even multiple of 4 */
-    player->buffer_length += ( 4 - (player->buffer_length % 4) ) % 4;
+    /* force to an even multiple of 4 bytes (lower) */
+    player->buffer_length -= (player->buffer_length % 4);
 
     player->data_buffer
 	= (void *) malloc( player->buffer_length );
@@ -559,6 +563,7 @@
 	return NULL;
     }
 
+    player->actual_length = 0;
     /* everything's ok, set the easy stuff */
     player->left_vol_scale = player->right_vol_scale = ESD_VOLUME_BASE;
     player->mix_func = get_mix_func( player );
@@ -620,7 +625,7 @@
 	player->buffer_length /= 2;
 
     /* force to an even multiple of 4 */
-    player->buffer_length += ( 4 - (player->buffer_length % 4) ) % 4;
+    player->buffer_length -= ( player->buffer_length % 4 );
 
     player->data_buffer
 	= (void *) malloc( player->buffer_length );
@@ -634,6 +639,7 @@
     /* update housekeeping values */
     esd_playing_samples++;
     player->last_pos = 0;
+    player->actual_length = 0;
     sample->ref_count++;
     player->mix_func = get_mix_func( player );
     player->translate_func = NULL; /* no translating, just mixing */
--- esound-0.2.29.orig/configure.in
+++ esound-0.2.29/configure.in
@@ -22,6 +22,37 @@
 
 AM_MAINTAINER_MODE
 
+dnl check whether we should try to emulate stdio fopen/fclose via
+dnl glibc facilities (this *really* depends on glibc internals)
+
+AC_DEFUN([AC_CHECK_ESDDSP_STDIO_EMU],
+[
+AC_MSG_CHECKING([for stdio emulation in esddsp])
+AC_CACHE_VAL(ac_cv_esddsp_stdio_emu,
+[
+AC_LANG_SAVE
+AC_LANG_C
+AC_TRY_LINK([
+#define _GNU_SOURCE
+#include <stdio.h>
+],
+[
+	cookie_io_functions_t fns = { 0, 0, 0, 0 };
+	struct fd_cookie *fdc = 0;
+	FILE *out = fopencookie (fdc,"w", fns);
+	out->_fileno = 0;
+],
+ac_cv_esddsp_stdio_emu=yes,
+ac_cv_esddsp_stdio_emu=no)
+])
+AC_LANG_RESTORE
+AC_MSG_RESULT($ac_cv_esddsp_stdio_emu)
+if test "x$ac_cv_esddsp_stdio_emu" = "xyes"; then
+  AC_DEFINE(ESDDSP_STDIO_EMU,1,
+	[Define if you want to use glibc facilities to emulate stdio accesses in esddsp])
+fi
+])
+
 AC_PROG_CC
 AC_PROG_CPP
 AM_PROG_LIBTOOL
@@ -346,6 +377,7 @@
       AC_CHECK_LIB(dl, dlopen, dsp_ok=yes DL_LIB=-ldl))
    ESDDSP=esddsp
    LIBESDDSP=libesddsp.la
+   AC_CHECK_ESDDSP_STDIO_EMU
 fi
 AM_CONDITIONAL(BUILD_ESDDSP, test "x$dsp_ok" = xyes)
 
--- esound-0.2.29.orig/config.guess
+++ esound-0.2.29/config.guess
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-#   Free Software Foundation, Inc.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002 Free Software Foundation, Inc.
 
-timestamp='2001-09-04'
+timestamp='2002-03-20'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -24,8 +24,9 @@
 # configuration script generated by Autoconf, you may include it under
 # the same distribution terms that you use for the rest of that program.
 
-# Written by Per Bothner <bothner@cygnus.com>.
-# Please send patches to <config-patches@gnu.org>.
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
 #
 # This script attempts to guess a canonical system name similar to
 # config.sub.  If it succeeds, it prints the system name on stdout, and
@@ -97,7 +98,7 @@
 
 set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
  ,,)    echo "int dummy(){}" > $dummy.c ;
-	for c in cc gcc c89 ; do
+	for c in cc gcc c89 c99 ; do
 	  ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
 	  if test $? = 0 ; then
 	     CC_FOR_BUILD="$c"; break ;
@@ -127,29 +128,29 @@
 
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:NetBSD:*:*)
-	# Netbsd (nbsd) targets should (where applicable) match one or
+	# NetBSD (nbsd) targets should (where applicable) match one or
 	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
 	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
 	# switched to ELF, *-*-netbsd* would select the old
 	# object file format.  This provides both forward
 	# compatibility and a consistent mechanism for selecting the
 	# object file format.
-	# Determine the machine/vendor (is the vendor relevant).
-	case "${UNAME_MACHINE}" in
-	    amiga) machine=m68k-unknown ;;
-	    arm32) machine=arm-unknown ;;
-	    atari*) machine=m68k-atari ;;
-	    sun3*) machine=m68k-sun ;;
-	    mac68k) machine=m68k-apple ;;
-	    macppc) machine=powerpc-apple ;;
-	    hp3[0-9][05]) machine=m68k-hp ;;
-	    ibmrt|romp-ibm) machine=romp-ibm ;;
-	    *) machine=${UNAME_MACHINE}-unknown ;;
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
 	esac
 	# The Operating System including object format, if it has switched
 	# to ELF recently, or will in the future.
-	case "${UNAME_MACHINE}" in
-	    i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k)
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
 		eval $set_cc_for_build
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
 			| grep __ELF__ >/dev/null
@@ -172,6 +173,45 @@
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
 	echo "${machine}-${os}${release}"
 	exit 0 ;;
+    amiga:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    arc:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    hp300:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mac68k:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    macppc:OpenBSD:*:*)
+	echo powerpc-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvme68k:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvme88k:OpenBSD:*:*)
+	echo m88k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvmeppc:OpenBSD:*:*)
+	echo powerpc-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    pmax:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    sgi:OpenBSD:*:*)
+	echo mipseb-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    sun3:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    wgrisc:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    *:OpenBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
     alpha:OSF1:*:*)
 	if test $UNAME_RELEASE = "V4.0"; then
 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
@@ -247,29 +287,11 @@
     Amiga*:UNIX_System_V:4.0:*)
 	echo m68k-unknown-sysv4
 	exit 0;;
-    amiga:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
     *:[Aa]miga[Oo][Ss]:*:*)
 	echo ${UNAME_MACHINE}-unknown-amigaos
 	exit 0 ;;
-    arc64:OpenBSD:*:*)
-	echo mips64el-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    arc:OpenBSD:*:*)
-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    hkmips:OpenBSD:*:*)
-	echo mips-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    pmax:OpenBSD:*:*)
-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    sgi:OpenBSD:*:*)
-	echo mips-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    wgrisc:OpenBSD:*:*)
-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
 	exit 0 ;;
     *:OS/390:*:*)
 	echo i370-ibm-openedition
@@ -319,7 +341,7 @@
 	echo m68k-sun-sunos${UNAME_RELEASE}
 	exit 0 ;;
     sun*:*:4.2BSD:*)
-	UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
 	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
 	case "`/bin/arch`" in
 	    sun3)
@@ -333,12 +355,6 @@
     aushp:SunOS:*:*)
 	echo sparc-auspex-sunos${UNAME_RELEASE}
 	exit 0 ;;
-    sparc*:NetBSD:*)
-	echo `uname -p`-unknown-netbsd${UNAME_RELEASE}
-	exit 0 ;;
-    atari*:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
     # The situation for MiNT is a little confusing.  The machine name
     # can be virtually everything (everything which is not
     # "atarist" or "atariste" at least should have a processor
@@ -365,18 +381,6 @@
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
         echo m68k-unknown-mint${UNAME_RELEASE}
         exit 0 ;;
-    sun3*:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    mac68k:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    mvme68k:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    mvme88k:OpenBSD:*:*)
-	echo m88k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
     powerpc:machten:*:*)
 	echo powerpc-apple-machten${UNAME_RELEASE}
 	exit 0 ;;
@@ -506,7 +510,7 @@
 	fi
 	exit 0 ;;
     *:AIX:*:[45])
-	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
 	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
 		IBM_ARCH=rs6000
 	else
@@ -546,10 +550,8 @@
 	    9000/31? )            HP_ARCH=m68000 ;;
 	    9000/[34]?? )         HP_ARCH=m68k ;;
 	    9000/[678][0-9][0-9])
-              case "${HPUX_REV}" in
-                11.[0-9][0-9])
-                  if [ -x /usr/bin/getconf ]; then
-                    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
                     sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
                     case "${sc_cpu_version}" in
                       523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
@@ -558,13 +560,13 @@
                         case "${sc_kernel_bits}" in
                           32) HP_ARCH="hppa2.0n" ;;
                           64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
                         esac ;;
                     esac
-                  fi ;;
-              esac
-              if [ "${HP_ARCH}" = "" ]; then
-	      eval $set_cc_for_build
-              sed 's/^              //' << EOF >$dummy.c
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^              //' << EOF >$dummy.c
 
               #define _HPUX_SOURCE
               #include <stdlib.h>
@@ -597,10 +599,10 @@
                   exit (0);
               }
 EOF
-	    (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
-	    if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
-	    rm -f $dummy.c $dummy
-	fi ;;
+		    (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy`
+		    if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
+		    rm -f $dummy.c $dummy
+		fi ;;
 	esac
 	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
 	exit 0 ;;
@@ -664,9 +666,6 @@
     parisc*:Lites*:*:*)
 	echo hppa1.1-hp-lites
 	exit 0 ;;
-    hppa*:OpenBSD:*:*)
-	echo hppa-unknown-openbsd
-	exit 0 ;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
 	echo c1-convex-bsd
         exit 0 ;;
@@ -685,9 +684,6 @@
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
 	echo c4-convex-bsd
         exit 0 ;;
-    CRAY*X-MP:*:*:*)
-	echo xmp-cray-unicos
-        exit 0 ;;
     CRAY*Y-MP:*:*:*)
 	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit 0 ;;
@@ -709,18 +705,12 @@
     CRAY*SV1:*:*:*)
 	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit 0 ;;
-    CRAY-2:*:*:*)
-	echo cray2-cray-unicos
-        exit 0 ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
 	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
         FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
         FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
         echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
         exit 0 ;;
-    hp300:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
 	exit 0 ;;
@@ -733,9 +723,6 @@
     *:FreeBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
 	exit 0 ;;
-    *:OpenBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
-	exit 0 ;;
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
 	exit 0 ;;
@@ -745,6 +732,9 @@
     i*:PW*:*)
 	echo ${UNAME_MACHINE}-pc-pw32
 	exit 0 ;;
+    x86:Interix*:3*)
+	echo i386-pc-interix3
+	exit 0 ;;
     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -770,16 +760,30 @@
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit 0 ;;
     ia64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit 0 ;;
     m68*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit 0 ;;
     mips:Linux:*:*)
-	case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in
-	  big)    echo mips-unknown-linux-gnu && exit 0 ;;
-	  little) echo mipsel-unknown-linux-gnu && exit 0 ;;
-	esac
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips
+	#undef mipsel
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mipsel
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+	rm -f $dummy.c
+	test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
 	;;
     ppc:Linux:*:*)
 	echo powerpc-unknown-linux-gnu
@@ -828,7 +832,8 @@
 	# The BFD linker knows what the default object file format is, so
 	# first see if it will tell us. cd to the root directory to prevent
 	# problems with other programs or directories called `ld' in the path.
-	ld_supported_targets=`cd /; ld --help 2>&1 \
+	# Set LC_ALL=C to ensure ld outputs messages in English.
+	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
 			 | sed -ne '/supported targets:/!d
 				    s/[ 	][ 	]*/ /g
 				    s/.*supported targets: *//
@@ -852,32 +857,29 @@
 	esac
 	# Determine whether the default compiler is a.out or elf
 	eval $set_cc_for_build
-	cat >$dummy.c <<EOF
-#include <features.h>
-#ifdef __cplusplus
-#include <stdio.h>  /* for printf() prototype */
-	int main (int argc, char *argv[]) {
-#else
-	int main (argc, argv) int argc; char *argv[]; {
-#endif
-#ifdef __ELF__
-# ifdef __GLIBC__
-#  if __GLIBC__ >= 2
-    printf ("%s-pc-linux-gnu\n", argv[1]);
-#  else
-    printf ("%s-pc-linux-gnulibc1\n", argv[1]);
-#  endif
-# else
-   printf ("%s-pc-linux-gnulibc1\n", argv[1]);
-# endif
-#else
-  printf ("%s-pc-linux-gnuaout\n", argv[1]);
-#endif
-  return 0;
-}
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#ifdef __ELF__
+	# ifdef __GLIBC__
+	#  if __GLIBC__ >= 2
+	LIBC=gnu
+	#  else
+	LIBC=gnulibc1
+	#  endif
+	# else
+	LIBC=gnulibc1
+	# endif
+	#else
+	#ifdef __INTEL_COMPILER
+	LIBC=gnu
+	#else
+	LIBC=gnuaout
+	#endif
+	#endif
 EOF
-	$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
-	rm -f $dummy.c $dummy
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+	rm -f $dummy.c
+	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
 	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
 	;;
     i*86:DYNIX/ptx:4*:*)
@@ -956,7 +958,7 @@
 	exit 0 ;;
     M68*:*:R3V[567]*:*)
 	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
-    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
 	OS_REL=''
 	test -r /etc/.relid \
 	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
@@ -1057,15 +1059,17 @@
 	echo `uname -p`-apple-darwin${UNAME_RELEASE}
 	exit 0 ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
-	if test "${UNAME_MACHINE}" = "x86pc"; then
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
 		UNAME_MACHINE=pc
 	fi
-	echo `uname -p`-${UNAME_MACHINE}-nto-qnx
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
 	exit 0 ;;
     *:QNX:*:4*)
 	echo i386-pc-qnx
 	exit 0 ;;
-    NSR-[KW]:NONSTOP_KERNEL:*:*)
+    NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*)
 	echo nsr-tandem-nsk${UNAME_RELEASE}
 	exit 0 ;;
     *:NonStop-UX:*:*)
--- esound-0.2.29.orig/esdfile.c
+++ esound-0.2.29/esdfile.c
@@ -52,6 +52,7 @@
 
     /* open the audio file */
     in_file = afOpenFile( filename, "rb", NULL );
+
     if ( !in_file )
 	return 0;
 
--- esound-0.2.29.orig/config.sub
+++ esound-0.2.29/config.sub
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-#   Free Software Foundation, Inc.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002 Free Software Foundation, Inc.
 
-timestamp='2001-09-07'
+timestamp='2002-03-07'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -29,7 +29,8 @@
 # configuration script generated by Autoconf, you may include it under
 # the same distribution terms that you use for the rest of that program.
 
-# Please send patches to <config-patches@gnu.org>.
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
@@ -117,7 +118,7 @@
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*)
+  nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
@@ -226,6 +227,7 @@
 	1750a | 580 \
 	| a29k \
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
 	| c4x | clipper \
 	| d10v | d30v | dsp16xx \
@@ -233,25 +235,24 @@
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| i370 | i860 | i960 | ia64 \
 	| m32r | m68000 | m68k | m88k | mcore \
-	| mips16 | mips64 | mips64el | mips64orion | mips64orionel \
+	| mips | mips16 | mips64 | mips64el | mips64orion | mips64orionel \
 	| mips64vr4100 | mips64vr4100el | mips64vr4300 \
 	| mips64vr4300el | mips64vr5000 | mips64vr5000el \
 	| mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \
-	| mipsisa32 \
+	| mipsisa32 | mipsisa64 \
 	| mn10200 | mn10300 \
 	| ns16k | ns32k \
-	| openrisc \
+	| openrisc | or32 \
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
 	| pyramid \
-	| s390 | s390x \
-	| sh | sh[34] | sh[34]eb | shbe | shle \
-	| sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \
-	| stormy16 | strongarm \
+	| sh | sh[34] | sh[34]eb | shbe | shle | sh64 \
+	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
+	| strongarm \
 	| tahoe | thumb | tic80 | tron \
-	| v850 \
+	| v850 | v850e \
 	| we32k \
-	| x86 | xscale \
+	| x86 | xscale | xstormy16 | xtensa \
 	| z8k)
 		basic_machine=$basic_machine-unknown
 		;;
@@ -278,11 +279,13 @@
 	580-* \
 	| a29k-* \
 	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
-	| alphapca5[67]-* | arc-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
 	| arm-*  | armbe-* | armle-* | armv*-* \
+	| avr-* \
 	| bs2000-* \
 	| c[123]* | c30-* | [cjt]90-* | c54x-* \
-	| clipper-* | cray2-* | cydra-* \
+	| clipper-* | cydra-* \
 	| d10v-* | d30v-* \
 	| elxsi-* \
 	| f30[01]-* | f700-* | fr30-* | fx80-* \
@@ -290,7 +293,7 @@
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| m32r-* \
-	| m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
 	| m88110-* | m88k-* | mcore-* \
 	| mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \
 	| mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \
@@ -302,14 +305,14 @@
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
 	| pyramid-* \
 	| romp-* | rs6000-* \
-	| s390-* | s390x-* \
-	| sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \
-	| sparc-* | sparc64-* | sparc86x-* | sparclite-* \
-	| sparcv9-* | sparcv9b-* | stormy16-* | strongarm-* | sv1-* \
-	| t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
-	| v850-* | vax-* \
+	| sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* | sh64-* \
+	| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+	| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+	| tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
+	| v850-* | v850e-* | vax-* \
 	| we32k-* \
-	| x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \
+	| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
+	| xtensa-* \
 	| ymp-* \
 	| z8k-*)
 		;;
@@ -374,6 +377,10 @@
 		basic_machine=ns32k-sequent
 		os=-dynix
 		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
 	convex-c1)
 		basic_machine=c1-convex
 		os=-bsd
@@ -394,16 +401,8 @@
 		basic_machine=c38-convex
 		os=-bsd
 		;;
-	cray | ymp)
-		basic_machine=ymp-cray
-		os=-unicos
-		;;
-	cray2)
-		basic_machine=cray2-cray
-		os=-unicos
-		;;
-	[cjt]90)
-		basic_machine=${basic_machine}-cray
+	cray | j90)
+		basic_machine=j90-cray
 		os=-unicos
 		;;
 	crds | unos)
@@ -418,6 +417,14 @@
 	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
 		basic_machine=mips-dec
 		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
 	delta | 3300 | motorola-3300 | motorola-delta \
 	      | 3300-motorola | delta-motorola)
 		basic_machine=m68k-motorola
@@ -598,14 +605,6 @@
 		basic_machine=m68k-atari
 		os=-mint
 		;;
-	mipsel*-linux*)
-		basic_machine=mipsel-unknown
-		os=-linux-gnu
-		;;
-	mips*-linux*)
-		basic_machine=mips-unknown
-		os=-linux-gnu
-		;;
 	mips3*-*)
 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
 		;;
@@ -620,6 +619,10 @@
 		basic_machine=m68k-rom68k
 		os=-coff
 		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
 	msdos)
 		basic_machine=i386-pc
 		os=-msdos
@@ -699,6 +702,10 @@
 		basic_machine=hppa1.1-oki
 		os=-proelf
 		;;
+	or32 | or32-*)
+		basic_machine=or32-unknown
+		os=-coff
+		;;
 	OSE68000 | ose68000)
 		basic_machine=m68000-ericsson
 		os=-ose
@@ -724,7 +731,7 @@
         pc532 | pc532-*)
 		basic_machine=ns32k-pc532
 		;;
-	pentium | p5 | k5 | k6 | nexgen)
+	pentium | p5 | k5 | k6 | nexgen | viac3)
 		basic_machine=i586-pc
 		;;
 	pentiumpro | p6 | 6x86 | athlon)
@@ -733,7 +740,7 @@
 	pentiumii | pentium2)
 		basic_machine=i686-pc
 		;;
-	pentium-* | p5-* | k5-* | k6-* | nexgen-*)
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
 		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	pentiumpro-* | p6-* | 6x86-* | athlon-*)
@@ -784,6 +791,12 @@
 	rtpc | rtpc-*)
 		basic_machine=romp-ibm
 		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
 	sa29200)
 		basic_machine=a29k-amd
 		os=-udi
@@ -795,7 +808,7 @@
 		basic_machine=sh-hitachi
 		os=-hms
 		;;
-	sparclite-wrs)
+	sparclite-wrs | simso-wrs)
 		basic_machine=sparclite-wrs
 		os=-vxworks
 		;;
@@ -853,7 +866,7 @@
 	sun386 | sun386i | roadrunner)
 		basic_machine=i386-sun
 		;;
-	sv1)
+        sv1)
 		basic_machine=sv1-cray
 		os=-unicos
 		;;
@@ -861,8 +874,16 @@
 		basic_machine=i386-sequent
 		os=-dynix
 		;;
+	t3d)
+		basic_machine=alpha-cray
+		os=-unicos
+		;;
 	t3e)
-		basic_machine=t3e-cray
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
 		os=-unicos
 		;;
 	tic54x | c54x*)
@@ -875,6 +896,10 @@
 	tx39el)
 		basic_machine=mipstx39el-unknown
 		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
 	tower | tower-32)
 		basic_machine=m68k-ncr
 		;;
@@ -925,13 +950,13 @@
 		basic_machine=i386-pc
 		os=-windows32-msvcrt
 		;;
-	xmp)
-		basic_machine=xmp-cray
-		os=-unicos
-		;;
         xps | xps100)
 		basic_machine=xps100-honeywell
 		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
 	z8k-*-coff)
 		basic_machine=z8k-unknown
 		os=-sim
@@ -952,13 +977,6 @@
 	op60c)
 		basic_machine=hppa1.1-oki
 		;;
-	mips)
-		if [ x$os = x-linux-gnu ]; then
-			basic_machine=mips-unknown
-		else
-			basic_machine=mips-mips
-		fi
-		;;
 	romp)
 		basic_machine=romp-ibm
 		;;
@@ -981,6 +999,9 @@
 	sh3 | sh4 | sh3eb | sh4eb)
 		basic_machine=sh-unknown
 		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
 	sparc | sparcv9 | sparcv9b)
 		basic_machine=sparc-sun
 		;;
@@ -1068,7 +1089,8 @@
 	      | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
-	      | -os2* | -vos*)
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1120,12 +1142,18 @@
 	-acis*)
 		os=-aos
 		;;
+	-atheos*)
+		os=-atheos
+		;;
 	-386bsd)
 		os=-bsd
 		;;
 	-ctix* | -uts*)
 		os=-sysv
 		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
 	-ns2 )
 	        os=-nextstep2
 		;;
@@ -1200,6 +1228,7 @@
 	arm*-semi)
 		os=-aout
 		;;
+	# This must come before the *-dec entry.
 	pdp10-*)
 		os=-tops20
 		;;
@@ -1229,6 +1258,9 @@
 		;;
 	mips*-*)
 		os=-elf
+		;;
+	or32-*)
+		os=-coff
 		;;
 	*-tti)	# must be before sparc entry or we get the wrong os.
 		os=-sysv3
--- esound-0.2.29.orig/config.h.in
+++ esound-0.2.29/config.h.in
@@ -1,4 +1,4 @@
-/* config.h.in.  Generated automatically from configure.in by autoheader.  */
+/* config.h.in.  Generated automatically from configure.in by autoheader 2.13.  */
 
 /* Define if using alloca.c.  */
 #undef C_ALLOCA
@@ -49,6 +49,7 @@
 #undef USE_LIBWRAP
 #undef WITH_SYMBOL_UNDERSCORE
 #undef ESDBG 
+#undef ESDDSP_STDIO_EMU
 
 #undef INADDR_LOOPBACK
 #undef HAVE_SUN_LEN
@@ -148,6 +149,9 @@
 
 /* Version number of package */
 #undef VERSION
+
+/* Define if you want to use glibc facilities to emulate stdio accesses in esddsp */
+#undef ESDDSP_STDIO_EMU
 
 /* keep these at the end of the generated config.h */
 
--- esound-0.2.29.orig/audio_oss.c
+++ esound-0.2.29/audio_oss.c
@@ -30,6 +30,8 @@
 
     int afd = -1, value = 0, test = 0;
     int mode = O_WRONLY;
+    struct timeval tv;
+    fd_set set;
 
     /* if recording, set for full duplex mode */
     if ( (esd_audio_format & ESD_MASK_FUNC) == ESD_RECORD )
@@ -57,26 +59,6 @@
     }
 #endif
 
-    /* set the sound driver fragment size and number */
-#if !defined(__powerpc__) /* does not exist on powerpc */
-    /* fragment = max_buffers << 16 + log2(buffer_size), (256 16) */
-    value = test = ( 0x0100 << 16 ) + 0x0008;
-    if (ioctl(afd, SNDCTL_DSP_SETFRAGMENT, &test) == -1)
-    {   /* Fatal error */
-        perror( "SNDCTL_DSP_SETFRAGMENT" );
-        close( afd );
-        esd_audio_fd = -1;
-        return( -1 );
-    }
-    if ( 0 /* value != test */ ) /* TODO: determine the real test */
-    {   /* The device doesn't support the requested audio format. */
-        fprintf( stderr, "unsupported fragment size: %d\n", value );
-        close( afd );
-        esd_audio_fd = -1;
-        return( -1 );
-    }
-#endif /* #if !defined(__powerpc__) */
-
     /* set the sound driver audio format for playback */
     
     value = test = ( (esd_audio_format & ESD_MASK_BITS) == ESD_BITS16 )
@@ -129,8 +111,31 @@
         return( -1 );
     }
 
+    if ( ioctl(afd, SNDCTL_DSP_GETBLKSIZE, &test) == -1)
+    { /* Fatal error */
+        perror("SNDCTL_DSP_GETBLKSIZE");
+        close( afd );
+        esd_audio_fd = -1;
+        return( -1 );
+    }
+    esd_write_size = test > ESD_MAX_WRITE_SIZE ? ESD_MAX_WRITE_SIZE : test;
+
     /* value = test = buf_size; */
     esd_audio_fd = afd;
+    /*
+     * From XMMS:
+     * Stupid hack to find out if the driver supports select; some
+     * drivers won't work properly without a select and some won't
+     * work with a select :/
+     */
+
+    tv.tv_sec = 0;
+    tv.tv_usec = 10;
+    FD_ZERO(&set);
+    FD_SET(afd, &set);
+    test = select(afd + 1, NULL, &set, NULL, &tv);
+    if (test > 0)
+	    select_works = 1;
     return afd;
 }
 
--- esound-0.2.29.orig/clients.c
+++ esound-0.2.29/clients.c
@@ -1,5 +1,6 @@
 #include "esd-server.h"
 #include <time.h>
+#include <errno.h>
 
 #ifdef HAVE_SYS_IOCTL_H
 # include <sys/ioctl.h>
@@ -117,29 +118,32 @@
 
 /*******************************************************************/
 /* checks for new connections at listener - zero when done */
-int get_new_clients( int listen )
+int get_new_clients( int sock )
 {
     int fd, nbl;
     struct sockaddr_in incoming;
     size_t size_in = sizeof(struct sockaddr_in);
     esd_client_t *new_client = NULL;
-    
-    unsigned long addr;
-    short port;
 
     /* see who awakened us */
     do {
-	fd = accept( listen, (struct sockaddr*) &incoming, &size_in );
+	fd = accept( sock, (struct sockaddr*) &incoming, &size_in );
 	if ( fd > 0 ) {
-	    port = ntohs( incoming.sin_port );
-	    addr = ntohl( incoming.sin_addr.s_addr );
 
 	    ESDBG_TRACE( 
+	    if (esd_use_tcpip) {
+		unsigned long addr;
+		short port;
+
+		port = ntohs( incoming.sin_port );
+		addr = ntohl( incoming.sin_addr.s_addr );
+
 		printf( "(%02d) new client from: %03u.%03u.%03u.%03u:%05d\n", 
 			fd, (unsigned int) addr >> 24, 
 			(unsigned int) (addr >> 16) % 256, 
 			(unsigned int) (addr >> 8) % 256, 
-			(unsigned int) addr % 256, port ); );
+			(unsigned int) addr % 256, port );
+		} );
 
 #ifdef USE_LIBWRAP
 	    if (esd_use_tcpip)
@@ -201,113 +205,152 @@
     return 0;
 }
 
-static int is_paused_here = 0;
-/*******************************************************************/
-/* blocks waiting for data from the listener, and client conns. */
-int wait_for_clients_and_data( int listen )
+void esd_comm_loop( int listen_socket, void *output_buffer, int esd_terminate )
 {
     fd_set rd_fds;
     struct timeval timeout;
     struct timeval *timeout_ptr = NULL;
-    esd_client_t *client = esd_clients_list;
-    int max_fd = listen, ready;
-
-    /* add the listener to the file descriptor list */
-    FD_ZERO( &rd_fds );
-    FD_SET( listen, &rd_fds );
+    esd_client_t *client;
+    int max_fd = listen_socket, ready;
+    int first = 1;
+    int is_paused_here = 0;
+    int length = 0;
 
-    /* add the clients to the list, too */
-    while ( client != NULL )
+    while ( 1 )
     {
-	/* add this client, but only if it's not monitoring */
-	if ( client->state == ESD_STREAMING_DATA &&
-	     client->request == ESD_PROTO_STREAM_MON )
-	{
-	    client = client->next;
-	    continue;
-	}
-
-	FD_SET( client->fd, &rd_fds );
-
-	/* update the maximum fd for the select() */
-	if ( client->fd > max_fd )
-	    max_fd = client->fd;
-
-	/* next client */
-	client = client->next;
-    }
+	FD_ZERO( &rd_fds );
+	FD_SET( listen_socket, &rd_fds );
 
-    /* if we're doing something useful, make sure we return immediately */
-    if ( esd_recorder_list || esd_playing_samples ) {
-	timeout.tv_sec = 0;
-	timeout.tv_usec = 0;
-	timeout_ptr = &timeout;
-    } else {
-
-	/* TODO: any reason not to pause indefinitely here? */
-	/* sample players that's why, if no players, can pause indefinitely */
-	/* if ( esd_on_autostandby 
-	        || (esd_autostandby_secs < 0 && !esd_playing_samples ) )
-	       timeout_ptr = NULL; else { ... } */
-
-	if ( is_paused_here ) {
-
-	    ESDBG_TRACE( printf( "paused, awaiting instructions.\n" ); );
-	    timeout_ptr = NULL;
+	if ((esd_clients_list == NULL) && (!first) && (esd_terminate)
+	&& (esd_autostandby_secs<0 || esd_on_autostandby)) {
+	    clean_exit(0);
+	    exit(0);
+	}
 
-	} else {
+	for( client = esd_clients_list ; client ; client = client->next)
+	{
+	    if ( client->state == ESD_STREAMING_DATA &&
+		client->request == ESD_PROTO_STREAM_MON )
+		continue;
+
+	    FD_SET( client->fd, &rd_fds );
+	    if ( client->fd > max_fd )
+		max_fd = client->fd;
+	}
 
+	/* if we're doing something useful, make sure we return immediately */
+	if ( esd_recorder_list || esd_playing_samples ) {
 	    timeout.tv_sec = 0;
-	    /* funky math to make sure a long can hold it all, calulate in ms */
-	    timeout.tv_usec = (long) esd_buf_size_samples * 1000L
-		/ (long) esd_audio_rate / 4L; 	/* divide by two for stereo */
-	    timeout.tv_usec *= 1000L; 		/* convert to microseconds */
+	    timeout.tv_usec = 0;
 	    timeout_ptr = &timeout;
-
-	}
-    }
-
-    ready = select( max_fd+1, &rd_fds, NULL, NULL, timeout_ptr );
-
-    ESDBG_COMMS( printf( 
-	"paused=%d, samples=%d, auto=%d, standby=%d, record=%d, ready=%d\n",
-	is_paused_here, esd_playing_samples, 
-	esd_autostandby_secs, esd_on_standby, 
-	(esd_recorder_list != 0), ready ); );
-
-    /* TODO: return ready, and do this in esd.c */
-    if ( ready <= 0 ) {
-	/* if < 0, something horrible happened:
-	   EBADF   invalid file descriptor - let individual read sort it out
-	   EINTR   non blocked signal caught - o well, no big deal
-	   EINVAL  n is negative - not bloody likely
-	   ENOMEM  unable to allocate internal tables - o well, no big deal */
-
-	if ( !is_paused_here && !esd_playing_samples && (esd_autostandby_secs<0) ) {
-	    ESDBG_TRACE( printf( "doing nothing, pausing server.\n" ); );
-	    esd_audio_flush();
-	    esd_audio_pause();
-	    esd_last_activity = time( NULL );
-	    is_paused_here = 1;
+	} else {
+	    if ( is_paused_here && (esd_autostandby_secs<0 || esd_on_standby)) {
+		ESDBG_TRACE( printf( "paused, awaiting instructions.\n" ); );
+		timeout_ptr = NULL;
+	    } else {
+		if (is_paused_here && esd_autostandby_secs>=0) {
+		    timeout.tv_sec = (esd_last_activity+esd_autostandby_secs+1)-time(NULL);
+		    if (timeout.tv_sec < 0 || timeout.tv_sec > esd_autostandby_secs+1)
+			timeout.tv_sec = 0;
+		    timeout.tv_usec = 0;
+		} else {
+		    timeout.tv_sec = 0;
+		    /* funky math to make sure a long can hold it all, calulate in ms */
+		    timeout.tv_usec = (long) esd_buf_size_samples * 1000L
+			/ (long) esd_audio_rate;
+		    timeout.tv_usec *= 1000/esd_sample_size; 	/* convert to microseconds, sample size */
+		}
+		timeout_ptr = &timeout;
+	    }
 	}
 
-	if ( !is_paused_here && !esd_playing_samples && !esd_recorder_list ) {
+	ready = select( max_fd+1, &rd_fds, NULL, NULL, timeout_ptr );
 
-	    if ( esd_autostandby_secs >= 0
+	ESDBG_COMMS( printf( 
+	    "paused=%d, samples=%d, auto=%d, standby=%d, record=%d, ready=%d\n",
+	    is_paused_here, esd_playing_samples, 
+	    esd_autostandby_secs, esd_on_standby, 
+	    (esd_recorder_list != 0), ready ); );
+
+	if ( ready < 0 ) {
+	    if ( errno == EINTR || errno == EAGAIN )
+		continue;
+	    perror("select");
+	    exit(1);
+	} else if ( ready == 0 ) {
+	    if ( !is_paused_here && !esd_playing_samples && !esd_recorder_list ) {
+		ESDBG_TRACE( printf( "doing nothing, pausing server.\n" ); );
+		esd_audio_flush();
+		esd_audio_pause();
+		esd_last_activity = time( NULL );
+		is_paused_here = 1;
+	    }
+	    if ( is_paused_here && esd_autostandby_secs >= 0
 		 && ( time(NULL) > esd_last_activity + esd_autostandby_secs ) ) {
 		ESDBG_TRACE( printf( "bored, going to standby mode.\n" ); );
 		esd_server_standby();
 		esd_on_autostandby = 1;
-		is_paused_here = 1;
 	    }
+	    if (is_paused_here)
+		continue;
+	}
+	is_paused_here = 0;
 
+	if ( FD_ISSET(listen_socket, &rd_fds ) ) {
+	    get_new_clients( listen_socket );
 	}
 
-    } else {
+	if ( ready || esd_playing_samples || esd_recorder_list ) {
+	    /* check for new protocol requests */
+	    poll_client_requests();
+	    first = 0;
+
+	/* mix new requests, and output to device */
+	refresh_mix_funcs(); /* TODO: set a flag to cue when to do this */
+	length = mix_players( output_buffer, esd_buf_size_octets );
+	
+	/* awaken if on autostandby and doing anything */
+	if ( esd_on_autostandby && length && !esd_forced_standby ) {
+	    ESDBG_TRACE( printf( "stuff to play, waking up.\n" ); );
+	    if ( !esd_server_resume()) {
+		usleep(100);
+	    }
+	}
 
-	is_paused_here = 0;
+	/* we handle this even when length == 0 because a filter could have
+	 * closed, and we don't want to eat the processor if one did.. */
+	if ( esd_filter_list && !esd_on_standby ) {
+	    length = filter_write( output_buffer, length,
+				   esd_audio_format, esd_audio_rate );
+	}
+	
+	if ( length > 0 ) {
+	    if ( !esd_on_standby ) {
+		/* standby check goes in here, so esd will eat sound data */
+		/* TODO: eat a round of data with a better algorithm */
+		/*        this will cause guaranteed timing issues */
+		/* TODO: on monitor, why isn't this a buffer of zeroes? */
+		esd_audio_write( output_buffer, length );
+		esd_last_activity = time( NULL );
+	    }
 
-    }
+	/* if someone's monitoring the sound stream, send them data */
+	/* mix_players, above, forces buffer to zero if no players */
+	/* this clears out any leftovers from recording, below */
+	if ( esd_monitor_list && !esd_on_standby && length ) {
+	    monitor_write( output_buffer, length );
+	}
+
+	/* if someone's recording the sound stream, send them data */
+	if ( esd_recorder_list && !esd_on_standby ) {
+	    length = esd_audio_read( output_buffer, esd_buf_size_octets );
+	    if ( length ) {
+		length = recorder_write( output_buffer, length );
+		esd_last_activity = time( NULL );
+	    }
+	}
 
-    return ready;
+	}
+	}
+    }
 }
--- esound-0.2.29.orig/audio_alsa.c
+++ esound-0.2.29/audio_alsa.c
@@ -2,6 +2,7 @@
    7-19-98: Nick Lopez( kimo_sabe@usa.net ) - it starts!
 */
 #include "esd.h"
+#include <string.h>
 
 /* debugging messages for audio device */
 static int driver_trace = 0;
@@ -22,7 +23,7 @@
 static snd_pcm_format_t alsa_format;
 static snd_pcm_channel_info_t alsa_pinfo;
 static int alsa_direction = SND_PCM_OPEN_PLAYBACK;
-static int alsa_mode = SND_PCM_MODE_BLOCK;
+static int alsa_mode = SND_PCM_MODE_STREAM;
 static int alsa_channel = SND_PCM_CHANNEL_PLAYBACK;
 #endif
 
@@ -65,13 +66,6 @@
     int nbr_cards, ret;
     char buf[256];
     struct snd_ctl_hw_info hw_info;
-    static int frag_size = 4*1024;
-
-#ifdef ALSA_5_API
-    static int frag_count = 0;
-#else
-    static int frag_count = 2;
-#endif
 
 #ifdef ALSA_5_API
     snd_pcm_channel_params_t params;
@@ -84,6 +78,10 @@
 
     snd_ctl_t *ctl_handle;
 
+    if ( esd_audio_device ) {
+	    card = atoi( esd_audio_device );
+    }
+
     if( driver_trace ) {
         fprintf( stderr, "Using ALSA %s\n", SND_LIB_VERSION_STR );
     }
@@ -127,7 +125,7 @@
        fprintf( stderr, "esd: Found %d card(s)\n", nbr_cards );
     }
 
-    for ( card=0; ( card < nbr_cards ) && (alsa_sound_handle == NULL); card++ ) {
+    for ( ; ( card < nbr_cards ) && (alsa_sound_handle == NULL); card++ ) {
             if( driver_trace ) {
                 fprintf( stderr, "esd: trying alsa card %d\n", card );
             }
@@ -195,13 +193,14 @@
     ret = snd_pcm_channel_info( alsa_sound_handle, &alsa_pinfo );
     if ( ret ) {
         fprintf( stderr, "error: %s: in snd_pcm_channel_info\n", snd_strerror(ret) );
+	esd_audio_close();
+	esd_audio_fd = -1;
         return( -1 );
     }
 
     memset(&params, 0, sizeof(params));
-    params.buf.block.frag_size = frag_size;
-    params.buf.block.frags_max = frag_count;
-    params.buf.block.frags_min = 1;
+    params.buf.stream.queue_size = ESD_BUF_SIZE;
+    params.buf.stream.fill = SND_PCM_FILL_NONE;
     params.channel = alsa_channel;
     params.mode = alsa_mode;
     params.start_mode = SND_PCM_START_FULL;
@@ -236,12 +235,16 @@
     ret = snd_pcm_channel_params( alsa_sound_handle, &params );
     if ( ret ) {
               fprintf( stderr, "error: %s: in snd_pcm_channel_params\n", snd_strerror(ret) );
+	      esd_audio_close();
+	      esd_audio_fd = -1;
           return( -1 );
     }
 
     ret = snd_pcm_channel_prepare( alsa_sound_handle, alsa_channel );
     if ( ret ) {
                       fprintf( stderr, "error: %s: in snd_pcm_channel_prepare\n", snd_strerror(ret) );
+	      esd_audio_close();
+	      esd_audio_fd = -1;
         return(-1);
     }
 
@@ -252,13 +255,17 @@
     ret = snd_pcm_channel_setup( alsa_sound_handle, &setup );
     if( ret ) {
         fprintf( stderr, "error: %s: in snd_pcm_channel_setup\n", snd_strerror(ret) );
+ 	esd_audio_close();
+ 	esd_audio_fd = -1;
         return(-1);
     }
 
     if ( params.format.rate != esd_audio_rate || params.format.voices != 2
                        || params.format.format != SND_PCM_SFMT_S16 ) {
-                      fprintf( stderr, "set format didn't work.");
-                      return(-1);
+		fprintf( stderr, "set format didn't work.");
+		esd_audio_close();
+		esd_audio_fd = -1;
+		return(-1);
         }
 
 #else
@@ -343,43 +350,47 @@
 #define ARCH_esd_audio_write
 int esd_audio_write( void *buffer, int buf_size )
 {
-    int i=0;
+    ssize_t nwrite=0, pos=0;
+    int counter = 0;
 
 #ifdef ALSA_5_API
     snd_pcm_channel_status_t status;
     int ret;
 #endif
 
-    i = snd_pcm_write( alsa_sound_handle, buffer, buf_size);
-    if( i<0 ) {
-#if 0
-        fprintf( stderr, "error: %s: in snd_pcm_write\n", snd_strerror(i) );
-#endif
-    }
-
+    while (counter < 100 && (nwrite = snd_pcm_write( alsa_sound_handle, buffer+pos, buf_size-pos )) != buf_size-pos ) {
+	if ( nwrite > 0 ) {
+	    pos += nwrite;
+	    if ( nwrite < 32 ) {
+		usleep(100);
+	    }
+	} else if ( nwrite < 0 ) {
+	    if ( errno == EAGAIN ) {
+		usleep(100);
+		counter++;
+	    } else {
 #ifdef ALSA_5_API
-    status.channel = SND_PCM_CHANNEL_PLAYBACK;
-    ret = snd_pcm_channel_status( alsa_sound_handle, &status );
-    if( ret ) {
-                  if( driver_trace ) fprintf( stderr, "error: %s: in snd_pcm_channel_status\n", snd_strerror(ret) );
-              return(-1);
-    }
-    if( status.underrun ) {
-        snd_pcm_channel_flush( alsa_sound_handle, alsa_channel );
-        snd_pcm_playback_prepare( alsa_sound_handle );
-        snd_pcm_write( alsa_sound_handle, buffer, buf_size );
-        if (snd_pcm_channel_status( alsa_sound_handle, &status ) < 0 && driver_trace) {
-            fprintf(stderr, "ALSA: could not get channel status. giving up\n");
-            return -1;
-              }
-              if (status.underrun) {
-                  if( driver_trace ) fprintf(stderr, "ALSA: write error. giving up\n");
-                        return -1;
-              }
-    }
+		status.channel = alsa_channel;
+		ret = snd_pcm_channel_status( alsa_sound_handle, &status );
+		if( ret ) {
+		    if( driver_trace ) fprintf( stderr, "error: %s: in snd_pcm_channel_status\n", snd_strerror(ret) );
+			return(-1);
+		}
+		if( status.status == SND_PCM_STATUS_UNDERRUN ) {
+		    counter++;
+		    snd_pcm_channel_flush( alsa_sound_handle, alsa_channel );
+		    snd_pcm_playback_prepare( alsa_sound_handle );
+		    usleep(100);
+		} else {
+		    return -1;
+		}
+#else
+		return -1;
 #endif /* ALSA_5_API */
-
-    return (i);
+	    }
+	}
+    }
+    return pos;
 }
 
 #define ARCH_esd_audio_flush
--- esound-0.2.29.orig/audio.c
+++ esound-0.2.29/audio.c
@@ -7,6 +7,8 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <math.h>
+#include <errno.h>
+#include <sys/select.h>
 
 /*******************************************************************/
 /* globals */
@@ -16,6 +18,8 @@
 
 /* the audio device, /dev/dsp, file descriptor */
 static int esd_audio_fd = -1;
+static int select_works = 0;
+static int esd_write_size = ESD_BUF_SIZE;
 
 /*******************************************************************/
 /* returns audio_fd for use by main prog - platform dependent */
@@ -59,7 +63,8 @@
 #ifndef ARCH_esd_audio_close
 void esd_audio_close()
 {
-    close( esd_audio_fd );
+    if ( esd_audio_fd != -1 )
+	close( esd_audio_fd );
     esd_audio_fd = -1;
     return;
 }
@@ -79,7 +84,46 @@
 /* dump a buffer to the sound device */
 int esd_audio_write( void *buffer, int buf_size )
 {
-    return write( esd_audio_fd, buffer, buf_size );
+    ssize_t nwrite=0, pos=0;
+    int counter = 0;
+    int write_size = esd_write_size;
+
+    while (counter < 100 && buf_size-pos > 0) {
+	if (buf_size-pos < write_size)
+	    write_size = buf_size-pos;
+
+	if (select_works) {
+	    fd_set set;
+	    struct timeval tv;
+	    int ret;
+
+	    tv.tv_sec = 0;
+	    tv.tv_usec = 100;
+	    FD_ZERO(&set);
+	    FD_SET(esd_audio_fd, &set);
+	    if ((ret = select(esd_audio_fd+1, NULL, &set, NULL, &tv)) == 0) {
+		counter++;
+		continue;
+	    } else if (ret < 0) {
+		return pos > 0 ? pos : -1;
+	    }
+	}
+
+	if ((nwrite = write( esd_audio_fd, buffer+pos, write_size )) <= 0 ) {
+	    if ( nwrite == -1 ) {
+		if ( errno == EAGAIN || errno == EINTR ) {
+		    usleep(100);
+		    counter++;
+		    continue;
+		} else {
+		    perror("esound: esd_audio_write: write");
+		    return pos > 0 ? pos : -1;
+		}
+	    }
+	}
+	pos += nwrite;
+    }
+    return pos;
 }
 #endif
 
@@ -97,7 +141,14 @@
 /* flush the audio buffer */
 void esd_audio_flush()
 {
-    fsync( esd_audio_fd );
     return;
 }
 #endif
+
+/*
+ * For the daemon's use only -- what size to make the buffer
+ */
+int esound_getblksize(void)
+{
+    return esd_write_size;
+}
--- esound-0.2.29.orig/esd-server.h
+++ esound-0.2.29/esd-server.h
@@ -15,6 +15,7 @@
 #include <sys/ioctl.h>
 #include <netinet/in.h>
 #include <sys/socket.h>
+#include <sys/un.h>
 #include <signal.h>
 #include <sys/time.h>
 #include <sys/types.h>
@@ -140,6 +141,7 @@
 
 int get_new_clients( int listen );
 int wait_for_clients_and_data( int listen );
+void esd_comm_loop( int listen_socket, void *output_buffer, int esd_terminate );
 
 /* filter.c - things with which to handle filters */
 extern esd_player_t *esd_filter_list;
--- esound-0.2.29.orig/acconfig.h
+++ esound-0.2.29/acconfig.h
@@ -15,6 +15,7 @@
 #undef USE_LIBWRAP
 #undef WITH_SYMBOL_UNDERSCORE
 #undef ESDBG 
+#undef ESDDSP_STDIO_EMU
 
 #undef INADDR_LOOPBACK
 #undef HAVE_SUN_LEN
--- esound-0.2.29.orig/proto.c
+++ esound-0.2.29/proto.c
@@ -89,22 +89,23 @@
 int esd_proto_get_latency( esd_client_t *client )
 {
     int lag, amount, actual;
+    int buf_size = esound_getblksize();
 
     ESDBG_TRACE( printf( "(%02d) proto: get latency\n", client->fd ); );
   
     if (esd_audio_format & ESD_STEREO)
       {
 	if (esd_audio_format & ESD_BITS16)
-	  amount = (44100 * (ESD_BUF_SIZE + 64)) / esd_audio_rate;
+	  amount = (44100 * (buf_size + 64)) / esd_audio_rate;
 	else
-	  amount = (44100 * (ESD_BUF_SIZE + 128)) / esd_audio_rate;
+	  amount = (44100 * (buf_size + 128)) / esd_audio_rate;
       }
     else
       {
 	if (esd_audio_format & ESD_BITS16)
-	  amount = (2 * 44100 * (ESD_BUF_SIZE + 128)) / esd_audio_rate;
+	  amount = (2 * 44100 * (buf_size + 128)) / esd_audio_rate;
 	else
-	  amount = (2 * 44100 * (ESD_BUF_SIZE + 256)) / esd_audio_rate;
+	  amount = (2 * 44100 * (buf_size + 256)) / esd_audio_rate;
       }
     lag = maybe_swap_32( client->swap_byte_order, amount );
 
@@ -336,14 +337,14 @@
 	/* let the device know we want to record */
 	ESDBG_TRACE( printf( "closing audio for a sec...\n" ); );
 	esd_audio_close();
-	sleep(1);
+	usleep(100);
 	esd_audio_format |= ESD_RECORD;
 	ESDBG_TRACE( printf( "reopening audio to record...\n" ); );
 	if (esd_audio_open() < 0) {
             /* Failed to record */
             free_player( recorder );
             esd_audio_format &= ~ESD_RECORD;
-            sleep(1);
+            usleep(100);
             /* If we fail here, we have a oops */
             esd_audio_open();
             return 0;
--- esound-0.2.29.orig/stdioemu.c
+++ esound-0.2.29/stdioemu.c
@@ -0,0 +1,96 @@
+    /*
+
+    Copyright (C) 2000 Stefan Westerfeld
+                       stefan@space.twc.de
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+  
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+   
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+    Boston, MA 02111-1307, USA.
+
+    */
+
+/*
+ * This source only exists because some very special programs think that
+ * it is a very special idea to access /dev/dsp by the means of stdio, so
+ * we need to fake FILE* access for artsdsp as well.
+ *
+ * To do so, it relies on glibc internals, so that it will probably not work
+ * on other systems - but then again, it might not be necessary on other
+ * systems, when fopen properly calls open, it might as well work unchanged.
+ */
+
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include <stdio.h>
+#include <libio.h>
+
+struct fd_cookie {
+	int fd;
+};
+
+static ssize_t fdc_read (void *cookie, char *buffer, size_t size)
+{
+	struct fd_cookie *fdc = (struct fd_cookie *)cookie;
+	return read(fdc->fd, buffer, size);
+}
+
+static ssize_t fdc_write (void *cookie, const char *buffer, size_t size)
+{
+	struct fd_cookie *fdc = (struct fd_cookie *)cookie;
+	return write(fdc->fd, buffer, size);
+}
+
+static int fdc_seek (void *cookie, _IO_off64_t *position, int whence)
+{
+	return -1;
+}
+
+static int fdc_clean (void *cookie)
+{
+	struct fd_cookie *fdc = (struct fd_cookie *)cookie;
+	int result = close(fdc->fd);
+	free(cookie);
+	return result;
+}
+
+static FILE *fake_fopen(const char *path, const char *mode)
+{
+	cookie_io_functions_t fns = { fdc_read, fdc_write, fdc_seek, fdc_clean };
+	struct fd_cookie *fdc =
+		(struct fd_cookie *)malloc(sizeof(struct fd_cookie));
+	const char *mptr;
+	int open_mode = 0;
+	FILE *result = 0;
+
+	for(mptr = mode; *mptr; mptr++)
+	{
+		if(*mptr == 'r') open_mode |= 1; /* 1 = read */
+		if(*mptr == 'w') open_mode |= 2; /* 2 = write */
+		if(*mptr == '+') open_mode |= 3; /* 3 = readwrite */
+		if(*mptr == 'a') open_mode |= 2; /* append -> write */
+  	}
+  	if(open_mode == 1) fdc->fd = open(path,O_RDONLY,0666);
+  	if(open_mode == 2) fdc->fd = open(path,O_WRONLY,0666);
+  	if(open_mode == 3) fdc->fd = open(path,O_RDWR,0666);
+
+	if(open_mode && fdc->fd > 0)
+	{
+		result = fopencookie (fdc,"w", fns);
+		result->_fileno = fdc->fd;		/* ugly patchy slimy kludgy hack */
+	}
+	return result;
+}
--- esound-0.2.29.orig/debian/esound-clients.files
+++ esound-0.2.29/debian/esound-clients.files
@@ -0,0 +1,18 @@
+usr/bin/esdcat
+usr/bin/esdctl
+usr/bin/esddsp
+usr/bin/esdfilt
+usr/bin/esdloop
+usr/bin/esdmon
+usr/bin/esdplay
+usr/bin/esdrec
+usr/bin/esdsample
+usr/share/man/man1/esdcat.1.gz
+usr/share/man/man1/esdctl.1.gz
+usr/share/man/man1/esddsp.1.gz
+usr/share/man/man1/esdfilt.1.gz
+usr/share/man/man1/esdloop.1.gz
+usr/share/man/man1/esdmon.1.gz
+usr/share/man/man1/esdplay.1.gz
+usr/share/man/man1/esdrec.1.gz
+usr/share/man/man1/esdsample.1.gz
--- esound-0.2.29.orig/debian/libesd0.files
+++ esound-0.2.29/debian/libesd0.files
@@ -0,0 +1 @@
+usr/lib/*.so.*
--- esound-0.2.29.orig/debian/libesd-alsa0.prerm
+++ esound-0.2.29/debian/libesd-alsa0.prerm
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+#DEBHELPER#
--- esound-0.2.29.orig/debian/libesd-alsa0.postinst
+++ esound-0.2.29/debian/libesd-alsa0.postinst
@@ -0,0 +1,15 @@
+#!/bin/sh -e
+
+case "$1" in
+  configure*)
+    if [ ! -L /usr/share/doc/libesd-alsa0 -a -d /usr/share/doc/libesd-alsa0 ]; then
+        set +e
+    	if rmdir /usr/share/doc/libesd-alsa0; then
+	    ln -s esound-common /usr/share/doc/libesd-alsa0
+	fi
+	set -e
+    fi
+    ;;
+esac
+
+#DEBHELPER#
--- esound-0.2.29.orig/debian/libesd0.prerm
+++ esound-0.2.29/debian/libesd0.prerm
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+#DEBHELPER#
--- esound-0.2.29.orig/debian/libesd0-dev.files
+++ esound-0.2.29/debian/libesd0-dev.files
@@ -0,0 +1,8 @@
+usr/lib/*.so
+usr/lib/*.la
+usr/lib/*.a
+usr/include
+usr/bin/esd-config
+usr/share/aclocal/esd.m4
+usr/share/man/man1/esd-config.1.gz
+usr/lib/pkgconfig/esound.pc
--- esound-0.2.29.orig/debian/esound-common.doc-base
+++ esound-0.2.29/debian/esound-common.doc-base
@@ -0,0 +1,10 @@
+Document: esound-common
+Title: EsounD documentation
+Author: Eric Mitchell
+Abstract: Documentation for the EsounD daemon and library.
+ .
+Section: Apps/Sound
+
+Format: HTML
+Index: /usr/share/doc/esound-common/html/book1.html
+Files: /usr/share/doc/esound-common/html/*.html
--- esound-0.2.29.orig/debian/esound.files
+++ esound-0.2.29/debian/esound.files
@@ -0,0 +1,2 @@
+usr/bin/esd
+usr/share/man/man1/esd.1.gz
--- esound-0.2.29.orig/debian/rules
+++ esound-0.2.29/debian/rules
@@ -0,0 +1,108 @@
+#!/usr/bin/make -f
+
+DEB_BUILD_ARCH:=$(shell dpkg --print-installation-architecture)
+
+INSTALL:=$(shell pwd)/debian/tmp
+INSTALL_ALSA:=$(INSTALL)-alsa
+export DH_COMPAT=3
+
+ifeq ($(DEB_BUILD_ARCH),hurd-i386)
+	CONFIG_OPTS:=--disable-local-sound
+	SHLIB:="libesd0 (>= 0.2.29-1)"
+	build-targets:=build-debstamp
+	install-targets:=install-debstamp
+	binary-targets:=normal
+else
+	CONFIG_OPTS:=
+	SHLIB:="libesd0 (>= 0.2.29-1) | libesd-alsa0 (>= 0.2.29-1)"
+	build-targets:=build-debstamp build-alsa-debstamp
+	install-targets:=install-debstamp install-alsa-debstamp
+	binary-targets:=alsa normal
+endif
+
+build: $(build-targets)
+
+build-debstamp:
+	dh_testdir
+	mkdir build-normal
+	cd build-normal && CFLAGS="-g" ../configure --prefix=/usr --sysconfdir=/etc/esound --disable-alsa --with-libwrap $(CONFIG_OPTS)
+	$(MAKE) -C build-normal all
+	(cd docs && for i in *.pod; do pod2man --center="Debian GNU/Linux" --release="potato" $$i > `basename $$i .pod`.1; done)
+	touch $@
+
+build-alsa-debstamp:
+	dh_testdir
+	mkdir build-alsa
+	cd build-alsa && ../configure --prefix=/usr --sysconfdir=/etc/esound --enable-alsa --with-libwrap
+	$(MAKE) -C build-alsa esd-config libesd.la
+	touch $@
+
+clean:
+	dh_testdir
+	-rm -fr build-normal build-alsa
+	-rm -f build-debstamp build-alsa-debstamp install-debstamp install-alsa-debstamp
+	-rm -f `find . -name "*~"`
+	-rm -rf `find . -name "\.deps"`
+	-rm -rf `find . -name "\.libs"`
+	-rm -rf debian/tmp `find debian/* -type d ! -name CVS` debian/files* core
+	-rm -f debian/*substvars debian/shlibs.local debian/shlibs
+	-rm -f docs/*.1
+	dh_clean
+
+install: $(install-targets)
+install-debstamp: build-debstamp
+	dh_testdir
+	dh_testroot
+	dh_clean
+	$(MAKE) -C build-normal DESTDIR=$(INSTALL) install
+	mkdir -p $(INSTALL)/usr/share/man/man1
+	cp docs/*.1 $(INSTALL)/usr/share/man/man1
+	gzip -9 $(INSTALL)/usr/share/man/man1/*.1
+	touch $@
+
+install-alsa-debstamp: build-alsa-debstamp
+	dh_testdir
+	dh_testroot
+	$(MAKE) -C build-alsa DESTDIR=$(INSTALL_ALSA) install-libLTLIBRARIES
+	touch $@
+
+binary-indep: build-debstamp install-debstamp
+	dh_installchangelogs -i ChangeLog
+	dh_movefiles         -i
+	dh_compress          -i
+	dh_installdocs       -i
+	dh_fixperms          -i
+	dh_installdeb        -i
+	dh_gencontrol        -i
+	dh_md5sums           -i
+	dh_builddeb          -i
+
+alsa: install-alsa-debstamp
+	dh_movefiles   -plibesd-alsa0 --sourcedir=debian/tmp-alsa
+	dh_installdocs -plibesd-alsa0 
+	rmdir debian/libesd-alsa0/usr/share/doc/libesd-alsa0
+	ln -s esound-common debian/libesd-alsa0/usr/share/doc/libesd-alsa0
+
+normal: install-debstamp
+	dh_movefiles         -s -Nlibesd-alsa0
+	dh_strip             -s
+	dh_compress          -s
+	dh_fixperms          -s
+	dh_installdocs       -s -Nlibesd-alsa0
+	dh_installmime       -pesound-clients
+	for i in esound-clients libesd0 libesd0-dev esound; do \
+		rmdir debian/$$i/usr/share/doc/$$i; \
+		ln -s esound-common debian/$$i/usr/share/doc/$$i; \
+	done
+	dh_makeshlibs        -s -V $(SHLIB)
+	dh_installdeb        -s
+	dh_shlibdeps         -s -ldebian/libesd0/usr/lib
+	dh_gencontrol        -s
+	dh_md5sums           -s
+	dh_builddeb          -s
+
+binary-arch: install $(binary-targets)
+
+binary: binary-indep binary-arch
+
+.PHONY: binary clean binary-indep binary-arch build install install-save install-saved
--- esound-0.2.29.orig/debian/esound-common.postinst
+++ esound-0.2.29/debian/esound-common.postinst
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "configure" ]; then
+	if [ -e /usr/share/debconf/confmodule ] && dpkg --compare-versions "$2" lt "0.2.23-1"; then
+		. /usr/share/debconf/confmodule
+		db_purge
+	fi
+fi
+
+#DEBHELPER#
--- esound-0.2.29.orig/debian/changelog
+++ esound-0.2.29/debian/changelog
@@ -0,0 +1,654 @@
+esound (0.2.29-2jds.gnoppix1) UNOFFICIAL; urgency=low
+
+  * built for gnoppix 
+
+ -- James D Strandboge <jstrand1@rochester.rr.com>  Mon, 22 Sep 2003 13:48:03 -0400
+
+esound (0.2.29-1woody1) unstable; urgency=low
+
+  * built on woody 
+
+ -- James Strandboge <jstrand1@rochester.rr.com>  Fri, 11 Jul 2003 15:00:15 -0400
+
+esound (0.2.29-1) unstable; urgency=low
+
+  * New upstream release (closes: #170923)
+  * Rewrote generic esd_audio_write to attempt to use select if the driver
+    seems to support it, and to write in a blocksize that can be changed by
+    audio open functions.
+    (closes: #57905, #95394, #122627, #159915)
+  * Fix endian swapping code (closes: #126879)
+  * build with libasound2-dev as libasound1-dev is no longer installable
+    (closes: #118022)
+  * Correct is_host_local check (closes: #153819)
+  * correct doc-base index file (closes: #152091)
+  * Correct handling while playing samples (closes: #112877, #144211)
+  * add a MIME control file for esdplay (closes: #153279)
+  * Take stdio emu code from libartsc (closes: #148259, #120829)
+  * Remove libesddsp from LD_PRELOAD when autospawning esd (closes: #151434)
+  * Document esd.conf in the esd manpage (closes: #129555)
+  * Correct license in audio_alsa09.c (upstream bug 108799)
+
+ -- Ryan Murray <rmurray@debian.org>  Wed, 19 Mar 2003 17:42:21 -0800
+
+esound (0.2.28-2) unstable; urgency=low
+
+  * Fix quoting on LD_PRELOAD (closes: #151496)
+  * Fix -s parsing in esdctl (closes: #130720)
+
+ -- Ryan Murray <rmurray@debian.org>  Mon,  1 Jul 2002 01:17:42 -0700
+
+esound (0.2.28-1) unstable; urgency=low
+
+  * New upstream release (closes: #144366, #130403, #114761)
+  * Fix README.Debian WRT -tcpip vs -tcp (closes: #129127)
+  * Add version of GPL to copyright statement (closes: #133495)
+  * Correct esdplay manpage title (closes: #141317)
+  * Don't install esddsp for hurd-i386 (closes: #144678)
+
+ -- Ryan Murray <rmurray@debian.org>  Sat, 29 Jun 2002 21:01:34 -0700
+
+esound (0.2.23-3) unstable; urgency=low
+
+  * Ship esound.pc (closes: #120798)
+  * Prepend to LD_PRELOAD in esddsp (closes: #126402)
+  * Add fclose to go with fopen
+
+ -- Ryan Murray <rmurray@debian.org>  Fri, 28 Dec 2001 11:02:46 -0800
+
+esound (0.2.23-2) unstable; urgency=low
+
+  * Update config.guess/config.sub
+
+ -- Ryan Murray <rmurray@debian.org>  Wed, 21 Nov 2001 11:16:21 -0800
+
+esound (0.2.23-1) unstable; urgency=low
+
+  * New upstream release
+  * "For the Glory of the Creator" release.
+  * Build libaesd0-alsa on all Linux architectures, and change shlib for hurd
+    (closes: #114051)
+  * esound socket has moved back to /tmp/.esd, to be binary compatible with
+    other distributions.
+  * Remove debconf template/config (closes: #105871, #104105)
+  * Change default configuration to have auto spawning disabled
+    (closes: #113313)
+  * Fix path to config file in esd manpage (closes: #107354)
+  * Updated esdfilt and esdmon manpages (closes: #117925)
+  * Update README.Debian
+  * Added fopen() wrapper for esddsp (closes: #76301)
+
+ -- Ryan Murray <rmurray@debian.org>  Mon, 19 Nov 2001 00:57:18 -0800
+
+esound (0.2.22-6) unstable; urgency=low
+
+  * Update conflicts to the appropriate packages (closes: #103858, #103751)
+    (closes: #101799)
+  * Added Spanish debconf template (closes: #103230)
+  * Seems some delay is needed on the reopen for recording.  I've added
+    a usleep, hopefully that is enough to make it work, yet not enough
+    to be overly annoying (closes: #103772)
+
+ -- Ryan Murray <rmurray@debian.org>  Sun,  8 Jul 2001 03:21:59 -0700
+
+esound (0.2.22-5) unstable; urgency=low
+
+  * libesd-alsa0 should be extra.  Changing it back.
+  * add a conflicts against older esound due to the move of the unix domain
+    socket (closes: #99782)
+
+ -- Ryan Murray <rmurray@debian.org>  Sun,  3 Jun 2001 12:12:32 -0700
+
+esound (0.2.22-4) unstable; urgency=low
+
+  * Fix dependency generation for esound-clients and esound.
+  * Change libesd-alsa0's priority to optional to match override file.
+  * Build without sound support for the hurd (closes: #89461)
+  * Close alsa PCM handle on errors in handle setup (closes: #83429)
+  * Add sleeps when the writes are small for alsa (closes: #87334, #83346)
+  * Add FILES section with esound.conf to esd manpage (closes: #87860)
+  * Move esound socket dir to /var/run (closes: #90612, #86807)
+  * Add mips to alsa architectures
+  * Update some of the dependencies/conflicts (closes: #95751)
+  * Update config.guess/config.sub (closes: #96729)
+  * Move unix domain socket to /var/run/esound (closes: #98946, #86807)
+  * Broke -terminate sometime ago (0.2.20-1 or so?) fixed now.
+    (closes: #95596)
+  * Update esdctl and esddsp pod pages (closes: #93993)
+  * Implement play, loop, and stop in esdctl, as the docs say (closes: #81236)
+  * Add Swedish, Dutch, and German templates (closes: #83502, #85553, #86217)
+  * Switch to debhelper v3, and simplified the rules file
+
+ -- Ryan Murray <rmurray@debian.org>  Sun, 27 May 2001 21:33:18 -0700
+
+esound (0.2.22-3) unstable; urgency=low
+
+  * Change ALSA from block to stream, and fix up code for dealing with
+    underrun's (closes: #81022)
+  * Remove Suggests: for non-existant package
+  * Don't sleep when attempting to reopen for recording. (closes: #81398)
+  * Really remove hosts.allow updating logic. (closes: #75966)
+
+ -- Ryan Murray <rmurray@debian.org>  Tue, 23 Jan 2001 14:12:39 -0800
+
+esound (0.2.22-2) unstable; urgency=low
+
+  * Remove ugly sleep(1) hack that attempts to work around what appears to be
+    a kernel bug.
+  * Apply a mixing patch from Matthew Ashton <mashton@stormix.com> that fixes
+    32k samples turning into static when 8k samples played in the middle
+    (closes: #79145)
+  * Add Replaces: for old -alsa packages.
+  * Don't use tcp wrappers on unix domain sockets (closes: #79014)
+  * Remove hosts.allow updating logic. (closes: #75966)
+  * Move man pages into packages with the binaries, since they aren't
+    packaged twice anymore.
+
+ -- Ryan Murray <rmurray@debian.org>  Fri,  8 Dec 2000 23:13:55 -0800
+
+esound (0.2.22-1) unstable; urgency=low
+
+  * New upstream release
+  * remove esound-alsa and libesd-alsa0-dev packages.  The only thing
+    that needs a seperate alsa package is the library.
+  * Rewrote mixing to mix the minimum that is available.  This seems to make
+    mixed sounds work correctly now.  It used to be writing random bytes
+    to the socket. (closes: #77553, #59331)
+  * Only build twice the things we actually package twice (libesd)
+  * Retry writes if device is busy. (closes: #76345, #65268)
+  * Use strtok_r if available (closes: #76567)
+  * Re-enable unix domain sockets, and make it the default.
+    (closes: #75064, #66724)
+  * Sleep for a bit if resume fails (closes: #64484)
+
+ -- Ryan Murray <rmurray@debian.org>  Tue,  5 Dec 2000 23:11:24 -0800
+
+esound (0.2.20-2) unstable; urgency=low
+
+  * Fix missing esound-common documentation (closes: #74561, #74964, #74763)
+  * Update package description (closes: #75109)
+  * Add recommends of esound-clients to the esd libraries
+  * Moved client manpages to esound-clients (closes: #75108)
+
+ -- Ryan Murray <rmurray@debian.org>  Sun, 22 Oct 2000 02:39:54 -0700
+
+esound (0.2.20-1) unstable; urgency=low
+
+  * New upstream release
+  * Make -d in esound-alsa take a card number parameter, instead of ignoring
+    -d. (closes: #72653)
+  * Buffer overrun fix (closes: #66759)
+  * only call accept if a new connection is waiting.  Saves a system call
+    on every sound packet.
+  * Add esound-clients package.  Lots of other package reorganizations.
+    (closes: #72304, #69856)
+  * Add an entry to /etc/hosts.allow to allow localhost by default, if there
+    is no entry. (closes: #66433, #67219, #67437, #72794)
+
+ -- Ryan Murray <rmurray@debian.org>  Mon,  9 Oct 2000 02:36:34 -0700
+
+esound (0.2.19-5) unstable; urgency=low
+
+  * Make list of ALSA archs in rules match the list in control (closes: #69671)
+
+ -- Ryan Murray <rmurray@debian.org>  Mon, 21 Aug 2000 21:49:36 -0700
+
+esound (0.2.19-4) unstable; urgency=low
+
+  * Fix segmentation fault when using ALSA (closes: #69449)
+
+ -- Ryan Murray <rmurray@debian.org>  Sun, 20 Aug 2000 19:28:18 -0700
+
+esound (0.2.19-3) unstable; urgency=low
+
+  * sparc and powerpc now have libasound1 available, so update the
+    build-depends to fix it...
+
+ -- Ryan Murray <rmurray@debian.org>  Fri, 18 Aug 2000 17:05:27 -0700
+
+esound (0.2.19-2) unstable; urgency=low
+
+  * Fix version in esddsp (closes: #67658)
+
+ -- Ryan Murray <rmurray@debian.org>  Fri, 11 Aug 2000 04:09:12 -0700
+
+esound (0.2.19-1) unstable; urgency=low
+
+  * New upstream release (closes: #63206)
+  * Remove autogenerated files from the diff.
+
+ -- Ryan Murray <rmurray@debian.org>  Sun, 23 Jul 2000 01:14:48 -0700
+
+esound (0.2.18-3) unstable; urgency=low
+
+  * New Maintainer.
+  * Reword debconf text to try to make it clear that sound must be setup.
+  * Add nobeeps option to manpage, closes: #65359
+  * Update Build-Depends to be libasound1-dev, and add libwrap0-dev
+  * Add a README.Debian with one FAQ, closes: #65198
+  * Add all architectures that currently have a libasound-dev library
+    to build esd-alsa
+
+ -- Ryan Murray <rmurray@debian.org>  Sun, 18 Jun 2000 20:49:50 -0700
+
+esound (0.2.18-2) unstable; urgency=low
+
+  * Applied patch from Juergen E Fischer <fischer@linux-buechse.de>, 
+    closes: #61959, #62054 
+  * s/0.2.17/0.2.18/ in esddsp.in, closes: #62130
+
+ -- Brian M. Almeida <bma@debian.org>  Mon, 10 Apr 2000 13:24:30 -0400
+
+esound (0.2.18-1) unstable; urgency=low
+
+  * New upstream release
+  * Updated download location and author's email in debian/copyright
+  * New upstream HTML documentation
+  * Compiled against ALSA 0.5
+
+ -- Brian M. Almeida <bma@debian.org>  Wed,  5 Apr 2000 11:45:38 -0400
+
+esound (0.2.17-8) unstable; urgency=low
+
+  * Removed garbage from beginning of esound.html, closes: #60804
+  * Removed test if daemon is running in esddsp, it's not really
+    needed anymore anyways, closes: #60681
+
+ -- Brian M. Almeida <bma@debian.org>  Mon, 20 Mar 2000 14:10:28 -0500
+
+esound (0.2.17-7) frozen unstable; urgency=low
+
+  * Fix doc-base entry, closes: #60231 
+
+ -- Brian M. Almeida <bma@debian.org>  Sun, 12 Mar 2000 15:40:53 -0500
+
+esound (0.2.17-6) frozen unstable; urgency=low
+
+  * Print 'opening socket' to stderr (esdcat.c, esdloop.c, esdmon.c,
+    esdrec.c, esdsample.c), closes: #59610
+
+ -- Brian M. Almeida <bma@debian.org>  Mon,  6 Mar 2000 13:35:06 -0500
+
+esound (0.2.17-5) frozen unstable; urgency=low
+
+  * Change ' to " so LD_PRELOAD works, closes: #59085
+
+ -- Brian M. Almeida <bma@debian.org>  Mon, 28 Feb 2000 12:58:38 -0500
+
+esound (0.2.17-4) frozen unstable; urgency=low
+
+  * Fixed a bug in the esddsp shellscript, closes: #58871
+
+ -- Brian M. Almeida <bma@debian.org>  Thu, 24 Feb 2000 16:10:02 -0500
+
+esound (0.2.17-3) frozen unstable; urgency=medium
+
+  * Fix Build-Depends (change libaudiofile0-dev to libaudiofile-dev,
+    only depend on libasoun0.4 on i386 and sparc), closes: #58295
+
+ -- Brian M. Almeida <bma@debian.org>  Thu, 17 Feb 2000 08:12:30 -0500
+
+esound (0.2.17-2) frozen unstable; urgency=medium
+
+  * Security fix, needs to go into potato
+  * Change esd to use TCP/IP and turn off UNIX domain sockets, closes: #58054 
+
+ -- Brian M. Almeida <bma@debian.org>  Wed, 16 Feb 2000 16:14:33 -0500
+
+esound (0.2.17-1) frozen unstable; urgency=medium
+
+  * New upstream version
+  * Contains security fixes only, needs to go into potato
+
+ -- Brian M. Almeida <bma@debian.org>  Fri,  4 Feb 2000 15:14:44 -0500
+
+esound (0.2.16-4) unstable; urgency=low
+
+  * Added debhelper to Build-Depends
+
+ -- Brian M. Almeida <bma@debian.org>  Thu, 13 Jan 2000 10:35:05 -0500
+
+esound (0.2.16-3) unstable; urgency=low
+
+  * Policy version 3.1.1 
+  * Added Build-Depends
+
+ -- Brian M. Almeida <bma@debian.org>  Thu, 13 Jan 2000 10:04:23 -0500
+
+esound (0.2.16-2) unstable; urgency=low
+
+  * Fixed esddsp to use newest shlibs, removed some code from
+    esddsp.c that didn't make sense with unix domain sockets, closes: #53602
+
+ -- Brian M. Almeida <bma@debian.org>  Tue, 28 Dec 1999 09:46:47 -0500
+
+esound (0.2.16-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Brian M. Almeida <bma@debian.org>  Wed, 22 Dec 1999 14:38:10 -0500
+
+esound (0.2.15-14) unstable; urgency=low
+
+  * Build in seperate directories, thanks to Adam Heath <doogie@debian.org>
+    for telling me about the ../configure trick, closes: #53246, #53248
+    Closes: #53249, #53278
+
+ -- Brian M. Almeida <bma@debian.org>  Wed, 22 Dec 1999 07:18:11 -0500
+
+esound (0.2.15-13) unstable; urgency=low
+
+  * Patch from Richard Guenther to chdir to a "safe" directory, closes: #51959
+  * Convert esound.sgml to HTML, closes: #52188
+  * esd-config may not be in -dev, but it is in -common, which -dev
+    now Depends: on, closes: #52208
+  * Loosen dependencies again, closes: #52232
+  * Merged in patch from NMU, closes: #52443
+
+ -- Brian M. Almeida <bma@debian.org>  Mon, 20 Dec 1999 15:49:21 -0500
+
+esound (0.2.15-12.1) unstable; urgency=low
+
+  * Non maintainer upload during the bugsquashing party.
+  * Applied the patch from Roman to debian/rules. Closes: #52443
+
+ -- Raphael Hertzog <hertzog@debian.org>  Sun, 19 Dec 1999 21:16:25 +0100
+
+esound (0.2.15-12) unstable; urgency=medium
+
+  * Changed priority of the *alsa* packages to extra, since alsa is extra
+
+ -- Brian M. Almeida <bma@debian.org>  Sun,  5 Dec 1999 13:46:50 -0500
+
+esound (0.2.15-11) unstable; urgency=medium
+
+  * Removed restriction on shlibs, closes: #51873 
+
+ -- Brian M. Almeida <bma@debian.org>  Sun,  5 Dec 1999 08:46:41 -0500
+
+esound (0.2.15-10) unstable; urgency=medium
+
+  * Added conflicts (libesd0-dev << 0.2.15-8) on esound-common, closes: #51791 
+
+ -- Brian M. Almeida <bma@debian.org>  Thu,  2 Dec 1999 07:23:58 -0500
+
+esound (0.2.15-9) unstable; urgency=medium
+
+  * Moved debconf templates into esound-common, closes: #51585, #51759
+  * Only compile ALSA packages on i386 and sparc, closes: #51699
+
+ -- Brian M. Almeida <bma@debian.org>  Wed,  1 Dec 1999 22:09:35 -0500
+
+esound (0.2.15-8) unstable; urgency=medium
+
+  * Make esound-alsa, split common data between esound and esound-alsa
+    into esound-common (closes: #50941)
+
+ -- Brian M. Almeida <bma@debian.org>  Tue, 23 Nov 1999 11:55:03 -0500
+
+esound (0.2.15-7) unstable; urgency=medium
+
+  * Removed remark about default setting in postinst, closes: #49961 
+
+ -- Brian M. Almeida <bma@debian.org>  Fri, 12 Nov 1999 11:07:19 -0500
+
+esound (0.2.15-6) unstable; urgency=medium
+
+  * Include *.a files, oops 
+
+ -- Brian M. Almeida <bma@debian.org>  Thu, 11 Nov 1999 00:09:26 -0500
+
+esound (0.2.15-5) unstable; urgency=medium
+
+  * Ask questions in debconf's config script, closes: #49511
+
+ -- Brian M. Almeida <bma@debian.org>  Sun,  7 Nov 1999 19:06:29 -0500
+
+esound (0.2.15-4) unstable; urgency=medium
+
+  * Applied patch for PPC architectures, closes: #49086 
+
+ -- Brian M. Almeida <bma@debian.org>  Fri,  5 Nov 1999 08:42:14 -0500
+
+esound (0.2.15-3) unstable; urgency=medium
+
+  * Updated versions of config.guess and config.sub, hopefully
+    this will fix bug#49086 (PowerPC people, please test!) 
+
+ -- Brian M. Almeida <bma@debian.org>  Thu,  4 Nov 1999 14:38:54 -0500
+
+esound (0.2.15-2) unstable; urgency=low
+
+  * Added manpages for all programs (pod owns!), closes: #39486, #39478
+  * References correct doc-base path, closes: #47742
+  * Compiles static library (fixed in last release), closes: #47928
+
+ -- Brian M. Almeida <bma@debian.org>  Thu,  4 Nov 1999 14:03:46 -0500
+
+esound (0.2.15-1) unstable; urgency=low
+
+  * New maintainer (ping, pong, ping, pong)
+  * New upstream version, closes: #47506, #48276
+  * Uses debconf, closes #47617 
+  * Compiled with --with-libwrap, closes: #49042
+  * Simplified debian/rules
+
+ -- Brian M. Almeida <bma@debian.org>  Wed,  3 Nov 1999 21:08:16 -0500
+
+esound (0.2.14-0.2) unstable; urgency=low
+
+  * New maintainer
+  * Non-maintainer release for new maintainer :)
+  * New upstream version, closes: #44139
+  * Fixed bad perms on /tmp/.esd, closes: #41454
+  * esound now depends on libesd0, closes: #45682
+  * esddsp now uses correct library versions, closes: #46466
+  * applied patch to esd.m4, closes: #42527
+  * Inform user how to rerun config script, closes: #40962
+  * Updated to standards 3.0.1.1
+  * Updated to FHS
+
+ -- Brian M. Almeida <bma@debian.org>  Wed,  6 Oct 1999 08:33:14 -0400
+
+esound (0.2.14-0.1) unstable; urgency=low
+
+  * New upstream version NMU for gnome-1.0.50
+
+ -- Michael Alan Dorman <mdorman@debian.org>  Wed, 29 Sep 1999 16:06:47 -0400
+
+esound (0.2.10-0.19990424.6.2) unstable; urgency=medium
+
+  * Non-Maintainer Upload
+  * Conditionalized the ARCH variable thing for Alpha (so as not to break
+    HURD)
+
+ -- David Huggins-Daines <dhd@debian.org>  Sat,  3 Jul 1999 13:50:09 -0400
+
+esound (0.2.10-0.19990424.6.1) unstable; urgency=medium
+
+  * Non-Maintainer Upload
+  * Recompiled without ALSA (both to make GNOME work again, and because
+    this is a policy violation)
+  * Also added an ARCH variable to make Alpha compiles work better.
+
+ -- David Huggins-Daines <dhd@debian.org>  Sat,  3 Jul 1999 01:21:13 -0400
+
+esound (0.2.10-0.19990424.6) unstable; urgency=low
+
+  * Made /usr/sbin/esdconfig executable (closes: #39187)
+  * Applied esdlib.c cleanup patch from BTS (closes: #39188) 
+
+ -- Brian M. Almeida <bma@debian.org>  Wed,  9 Jun 1999 10:20:04 -0400
+
+esound (0.2.10-0.19990424.5) unstable; urgency=low
+
+  * Added esdconfig script to configure /etc/esound/esd.conf (closes: #38707)
+
+ -- Brian M. Almeida <bma@debian.org>  Sun,  6 Jun 1999 22:27:51 -0400
+
+esound (0.2.10-0.19990424.4) unstable; urgency=medium
+
+  * Ok, REALLY fixed the doc-base stuff (closes: #38208, #38223) 
+     + Added shebang to libesd0.prerm ("oops?")
+     + Use correct name of document
+
+ -- Brian M. Almeida <bma@debian.org>  Mon, 24 May 1999 07:28:19 -0400
+
+esound (0.2.10-0.19990424.3) unstable; urgency=low
+
+  * Fixed incorrect doc-base commands (closes: #37976) 
+
+ -- Brian M. Almeida <bma@debian.org>  Sat, 22 May 1999 22:25:07 -0400
+
+esound (0.2.10-0.19990424.2) unstable; urgency=low
+
+  * use -V option of dh_makeshlibs (closes: #37646)
+
+ -- Brian M. Almeida <bma@debian.org>  Mon, 17 May 1999 22:54:28 -0400
+
+esound (0.2.10-0.19990424.1) unstable; urgency=low
+
+  * Fixed dual instance of libaudiofile0 in esound's Depends: 
+
+ -- Brian M. Almeida <bma@debian.org>  Tue, 27 Apr 1999 07:23:31 -0400
+
+esound (0.2.10-0.19990424) unstable; urgency=low
+
+  * Upstream CVS release
+  * Don't use -as 2 as default anymore (esddsp issues)
+  * esddsp.in - don't try to connect to esound if it's not running
+  * Added postinst script for esound, kills esd processes if running,
+    will be respawned by esdlib upon next access (closes: #36163)
+
+ -- Brian M. Almeida <bma@debian.org>  Sat, 24 Apr 1999 18:07:48 -0400
+
+esound (0.2.8-4) unstable; urgency=low
+
+  * Applied upstream patches
+    * Uses Unix domain sockets by default, for less sound breakup
+    * esd now has a conf file (/etc/esd.conf or ~/.esd.conf)
+    * Uses INADDR constants instead of inet_addr calls
+    * More miscellaneous stuff, see /usr/doc/esound/changelog.gz 
+  * Added esd.conf conffile
+  * Bumped standards version to 2.5.0.0
+  * Updated debian/copyright
+  * Added /usr/doc/esound/esound.sgml, registers with doc-base
+
+ -- Brian M. Almeida <bma@debian.org>  Wed, 14 Apr 1999 18:49:45 -0400
+
+esound (0.2.8-3) unstable; urgency=low
+
+  * libesd0-dev depends on libaudiofile-dev. closes: #35322 
+
+ -- Brian M. Almeida <bma@debian.org>  Wed, 31 Mar 1999 07:00:16 -0500
+
+esound (0.2.8-2) unstable; urgency=low
+
+  * Added Author's name and email in copyright (#34183)
+
+ -- Brian M. Almeida <bma@debian.org>  Sat,  6 Mar 1999 22:28:15 -0500
+
+esound (0.2.8-1) unstable; urgency=low
+
+  * New upstream release 
+
+ -- Brian M. Almeida <bma@debian.org>  Sat, 20 Feb 1999 13:19:08 -0500
+
+esound (0.2.7-0.19990216) unstable; urgency=low
+
+  * Fixed rpath stuff
+  * Updated to 19990216 snapshot
+
+ -- Brian M. Almeida <bma@debian.org>  Tue, 16 Feb 1999 08:44:37 -0500
+
+esound (0.2.7-0.19990209) unstable; urgency=low
+
+  * CVS snapshot release for GNOME stuff (#32575) 
+
+ -- Brian M. Almeida <bma@debian.org>  Tue,  9 Feb 1999 23:21:44 -0500
+
+esound (0.2.6-4) unstable; urgency=low
+
+  * Fixes bug #30283 (esd.m4 not included in -dev package)
+
+ -- Brian M. Almeida <bma@debian.org>  Wed,  3 Dec 1998 08:22:00 -0500
+
+esound (0.2.6-3) frozen unstable; urgency=low
+
+  * Fixes bug #29761
+
+ -- Brian M. Almeida <bma@debian.org>  Fri, 20 Oct 1998 08:12:00 -0500
+
+esound (0.2.6-2) unstable; urgency=low
+
+  * Most odd, disntall complained about there being an esound 0.2.6-1.
+    I'm still puzzling over that one.  Anyways, here's one to override it.
+
+ -- Brian M. Almeida <bma@debian.org>  Mon,  9 Oct 1998 16:21:00 -0400
+
+esound (0.2.6-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Brian M. Almeida <bma@debian.org>  Sat, 31 Oct 1998 01:21:00 -0400
+
+esound (0.2.5-5) unstable; urgency=low
+
+  * Added libaudiofile0 dependency on esound so it can use esdplay
+
+ -- Brian M. Almeida <bma@debian.org>  Wed, 14 Oct 1998 20:21:00 -0400
+
+esound (0.2.5-4) unstable; urgency=low
+
+  * Changed Recommends: esound to Suggests: esound in debian/control (#27907)
+
+ -- Brian M. Almeida <bma@debian.org>  Wed, 14 Oct 1998 15:00:00 -0400
+
+esound (0.2.5-3) unstable; urgency=low
+
+  * Fixed debian/control to put esound in the correct sections
+
+ -- Brian M. Almeida <bma@debian.org>  Wed,  6 Oct 1998 13:45:00 -0400
+
+esound (0.2.5-2) unstable; urgency=low
+
+  * Doh! Forgot to change Maintainer: in debian/control
+  * Cleaned up debian/rules to use debhelper correctly.
+
+ -- Brian M. Almeida <bma@debian.org>  Mon,  5 Oct 1998 13:50:00 -0400
+
+esound (0.2.5-1) unstable; urgency=low
+
+  * New maintainer.
+
+ -- Brian M. Almeida <bma@debian.org>  Wed, 30 Sep 1998 20:18:38 -0400
+
+esound (0.2.5-0.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * New upstream release from CVS snapshot 19980929, needed for new
+    release of eMusic (esd_close() function needed).  0.2.5-final 
+    will be released after some more testing.  
+  * The buzzing sound has been fixed...yay!
+
+ -- Brian M. Almeida <bma@debian.org>  Thu, 29 Sep 1998 18:18:38 -0400
+
+esound (0.2.4-0.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * New upstream release.
+
+ -- Brian M. Almeida <bma@debian.org>  Tue, 14 Jul 1998 23:49:38 -0400
+
+esound (0.2.1-2) unstable; urgency=low
+
+  * Updated esd.h so it didn't include the local config.h file
+  * Fixed copyright file.
+
+ -- Scott K. Ellis <scott@debian.org>  Mon,  8 Jun 1998 14:49:38 -0400
+
+esound (0.2.1-1) unstable; urgency=low
+
+  * Initial Release.
+
+ -- Scott K. Ellis <scott@debian.org>  Mon,  8 Jun 1998 13:35:35 -0400
--- esound-0.2.29.orig/debian/esound-common.docs
+++ esound-0.2.29/debian/esound-common.docs
@@ -0,0 +1 @@
+NEWS README TODO TIPS docs/html
--- esound-0.2.29.orig/debian/control
+++ esound-0.2.29/debian/control
@@ -0,0 +1,73 @@
+Source: esound
+Section: sound
+Priority: optional
+Maintainer: Ryan Murray <rmurray@debian.org>
+Standards-Version: 3.5.8
+Build-Depends: libaudiofile-dev, libasound2-dev [alpha arm hppa i386 ia64 m68k mips mipsel powerpc s390 sparc], debhelper (>= 3), libwrap0-dev
+
+Package: esound
+Architecture: any
+Depends: ${shlibs:Depends}, esound-common (>= ${Source-Version})
+Replaces: esound-alsa
+Conflicts: esound-alsa, esound-common (<< 0.2.23-1)
+Description: Enlightened Sound Daemon - Support binaries
+ This program is designed to mix together several digitized 
+ audio streams for playback by a single device.
+
+Package: esound-clients
+Architecture: any
+Depends: ${shlibs:Depends}, esound-common (>= ${Source-Version})
+Conflicts: esound-alsa, esound (<< 0.2.20-2), esound-common (<< 0.2.23-1)
+Description: Enlightened Sound Daemon - clients
+ Utilities that control and interact with the Enlightened Sound Daemon.
+
+Package: esound-common
+Architecture: all
+Conflicts: libesd0-dev (<< 0.2.15-8)
+Description: Enlightened Sound Daemon - Common files
+ This program is designed to mix together several digitized 
+ audio streams for playback by a single device.
+ .
+ This package contains the documentation and configuration files.
+
+Package: libesd0
+Architecture: any
+Section: libs
+Depends: ${shlibs:Depends}, esound-common (>= ${Source-Version})
+Recommends: esound-clients
+Conflicts: esound (<< 0.2.23-1)
+Suggests: esound
+Description: Enlightened Sound Daemon - Shared libraries
+ This program is designed to mix together several digitized 
+ audio streams for playback by a single device.
+ .
+ This package is for use with OSS sound drivers.
+
+Package: libesd0-dev
+Architecture: any
+Section: devel
+Depends: libesd0 (= ${Source-Version}) | libesd-alsa0 (= ${Source-Version}), libaudiofile-dev, esound-common (>= ${Source-Version})
+Replaces: libesd-dev, libesd-alsa0-dev
+Conflicts: libesd-dev
+Description: Enlightened Sound Daemon - Development files
+ This program is designed to mix together several digitized 
+ audio streams for playback by a single device.
+ .
+ This package contains the header files needed to compile applications that
+ use libesd0.
+
+Package: libesd-alsa0
+Architecture: alpha arm hppa i386 ia64 m68k mips mipsel powerpc s390 sh sparc
+Section: libs
+Depends: ${shlibs:Depends}, esound-common (>= ${Source-Version})
+Suggests: esound
+Priority: extra
+Recommends: esound-clients
+Conflicts: libesd0, esound-alsa, esound (<< 0.2.23-1)
+Provides: libesd0
+Description: Enlightened Sound Daemon (ALSA) - Shared libraries
+ This program is designed to mix together several digitized 
+ audio streams for playback by a single device.
+ .
+ This package is for use with ALSA sound drivers.
+
--- esound-0.2.29.orig/debian/libesd-alsa0.files
+++ esound-0.2.29/debian/libesd-alsa0.files
@@ -0,0 +1 @@
+usr/lib/*.so.*
--- esound-0.2.29.orig/debian/esound-common.files
+++ esound-0.2.29/debian/esound-common.files
@@ -0,0 +1 @@
+etc/esound/esd.conf
--- esound-0.2.29.orig/debian/libesd0.postinst
+++ esound-0.2.29/debian/libesd0.postinst
@@ -0,0 +1,15 @@
+#!/bin/sh -e
+
+case "$1" in
+  configure*)
+    if [ ! -L /usr/share/doc/libesd0 -a -d /usr/share/doc/libesd0 ]; then
+        set +e
+    	if rmdir /usr/share/doc/libesd0; then
+	    ln -s esound-common /usr/share/doc/libesd0
+	fi
+	set -e
+    fi
+    ;;
+esac
+
+#DEBHELPER#
--- esound-0.2.29.orig/debian/watch
+++ esound-0.2.29/debian/watch
@@ -0,0 +1,2 @@
+# Site		Directory		Pattern			Version	Script
+http://ftp.gnome.org /pub/GNOME/sources/esound/0.2 esound-(.*)\.tar\.gz debian uupdate
--- esound-0.2.29.orig/debian/libesd0-dev.postinst
+++ esound-0.2.29/debian/libesd0-dev.postinst
@@ -0,0 +1,15 @@
+#!/bin/sh -e
+
+case "$1" in
+  configure*)
+    if [ ! -L /usr/share/doc/libesd0-dev -a -d /usr/share/doc/libesd0-dev ]; then
+        set +e
+    	if rmdir /usr/share/doc/libesd0-dev; then
+	    ln -s esound-common /usr/share/doc/libesd0-dev
+	fi
+	set -e
+    fi
+    ;;
+esac
+
+#DEBHELPER#
--- esound-0.2.29.orig/debian/esound.postinst
+++ esound-0.2.29/debian/esound.postinst
@@ -0,0 +1,19 @@
+#!/bin/sh -e
+
+case "$1" in
+  configure*)
+    if [ ! -L /usr/share/doc/esound -a -d /usr/share/doc/esound ]; then
+        set +e
+    	if rmdir /usr/share/doc/esound; then
+	    ln -s esound-common /usr/share/doc/esound
+	fi
+	set -e
+    fi
+    if [ -e /usr/share/debconf/confmodule ] && dpkg --compare-versions "$2" lt "0.2.23-1"; then
+	    . /usr/share/debconf/confmodule
+	    db_purge
+    fi
+    ;;
+esac
+
+#DEBHELPER#
--- esound-0.2.29.orig/debian/esound-common.README.Debian
+++ esound-0.2.29/debian/esound-common.README.Debian
@@ -0,0 +1,66 @@
+esound for Debian
+-----------------
+
+When using the -tcp option
+--------------------------
+
+Q: I get the error message "unable to bind port 16001"
+
+A:	1. esd is already running, bound to port 16001.
+	2. TCP/IP networking is not configured.  You need at least the lo
+	   interface configured for esound to work.
+	   To configure the interface, try ifup lo
+	   If that does not work, try ifconfig lo 127.0.0.1
+
+Q: Applications saying they can't connect to esd?
+
+A:	1. Ensure that esd is running, or is set to autospawn.  You can
+	   set it back to autospawn by editing /etc/esound/esd.conf
+	2. Ensure that TCP wrappers allow the connection.  If a default is
+	   specified to deny all traffic, ESD will be denied.
+	3. If you are trying to do remote esd, make sure -public is specified
+	   when starting ESD on the server end (the one with sound hardware)
+	   and that TCP wrappers will allow the remote connection.
+
+Q: Why does esound not default to autospawn?
+
+A: esound used to default to autospawning, which means that programs
+would try to start the esd daemon if it wasn't running.  The problem
+is, if you don't have sound hardware correctly setup, esd would take a
+long time to try opening the sound device(s) at all possible supported
+rates, and people would think that the Gnome desktop had "hung" for
+two minutes.
+
+Q: Why don't you make it configurable, like it used to be?
+
+A: esd.conf is a conffile, and you can edit it if you want the default to be
+autospawning.  I've set up the default to work with Gnome and esound, the
+main two users of libesd.  As esd.conf is a conffile, it can't be edited
+by maintainer scripts, including debconf.  The question is also a very
+confusing one for new users, so I think it is much better if the default
+works with the users of libesd, and experts can edit the conffile to turn
+on autospawning if they like.
+
+Q: Why does esound not use libasound2?  ALSA 0.9 will be in 2.5 and OSS will
+be going away!
+
+A: The maintainer is waiting for the ALSA maintainer to upload packages
+that build on all architectures again, and is waiting for the existing
+changes to settle before enabling ALSA 0.9 support.  Use the OSS
+compatibility layer in the meantime.
+
+Q: Esound should be a daemon, that's what the D is for in esd, right?
+
+A: Esound was designed mainly to be used as a "daemon" that is started on each
+login session, and ended when the user logs off, much like the other gnome
+bits (gconf, oaf, etc).  While it can be used as a system daemon and stay
+running all the time, it does open some security issues for a multi-user
+system.  The default of upstream and this packaging is for a multi-user system
+with users allowed to use audio in the audio group.
+
+Q: esddsp hangs when I use it with <blah> application!
+
+A: esddsp is a set of wrappers around libc functions, including open, fopen,
+close, and fclose.  These wrappers are NOT thread safe, so when using them
+with a threaded program, you often end up with the application hanging.
+This hasn't been fixed yet. (patches welcome)
--- esound-0.2.29.orig/debian/esound-common.copyright
+++ esound-0.2.29/debian/esound-common.copyright
@@ -0,0 +1,19 @@
+This package was debianized by Brian M. Almeida bma@debian.org on
+Mon,  8 Jun 1998 13:35:35 -0400.
+
+It was downloaded from ftp://ftp.gnome.org/pub/GNOME/stable/sources/esound/
+
+Author: Eric Mitchell <ricdude@toad.net>
+
+Copyright:
+
+The software in this package falls into several categories, and is
+licensed under either the Gnu GPL or Gnu LGPL as appropriate:
+
+The Enlightened Sound Daemon (esd) - GPL v2
+The Enlightened Sound Daemon Client Library (libesd.so, libesd.a) - LGPL v2
+The ESD-DSP wrapper script and support library (esddsp, libesddsp.so) - LGPL v2
+The Example programs and command line utilities - LGPL v2
+
+You can find the full text of the GPL in /usr/share/common-licenses/GPL-2 and
+the full text of the LGPL in /usr/share/common-licenses/LGPL-2
--- esound-0.2.29.orig/debian/esound-clients.files.hurd-i386
+++ esound-0.2.29/debian/esound-clients.files.hurd-i386
@@ -0,0 +1,16 @@
+usr/bin/esdcat
+usr/bin/esdctl
+usr/bin/esdfilt
+usr/bin/esdloop
+usr/bin/esdmon
+usr/bin/esdplay
+usr/bin/esdrec
+usr/bin/esdsample
+usr/share/man/man1/esdcat.1.gz
+usr/share/man/man1/esdctl.1.gz
+usr/share/man/man1/esdfilt.1.gz
+usr/share/man/man1/esdloop.1.gz
+usr/share/man/man1/esdmon.1.gz
+usr/share/man/man1/esdplay.1.gz
+usr/share/man/man1/esdrec.1.gz
+usr/share/man/man1/esdsample.1.gz
--- esound-0.2.29.orig/debian/esound-clients.mime
+++ esound-0.2.29/debian/esound-clients.mime
@@ -0,0 +1,3 @@
+audio/basic; /usr/bin/esdplay %s
+audio/x-wav; /usr/bin/esdplay %s
+audio/x-aiff; /usr/bin/esdplay %s
