diff --git a/Makefile.in b/Makefile.in
index 62ae59fe7..7856dcb40 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,6 +1,8 @@
 CC ?= @CC@
 FC ?= @F77@
-FFLAGS = @FFLAGS@
+FFLAGS	= @FFLAGS@
+LDFLAGS	= @LDFLAGS@
+CPPFLAGS = @CPPFLAGS@
 #
 # WSJT specific Fortran flags
 FFLAGS += -Wall -fbounds-check
@@ -9,6 +11,9 @@ OS=@OS@
 G95=@G95@
 COMPILER=@G95_LIB_PATH@
 
+LDFLAGS	+= -L${COMPILER}
+LIBS	= -lpthread -lg2c
+
 PYTHON	?= @PYTHON@
 RM	?= @RM@
 F2PY	= @F2PY@
@@ -21,8 +26,6 @@ OBJS1 = JT65code.o nchar.o grid2deg.o packmsg.o packtext.o \
 	igray.o init_rs_int.o encode_rs_int.o decode_rs_int.o \
 	wrapkarn.o
 
-# For Windows
-#OBJS2C   = init_rs.o encode_rs.o decode_rs.o 
 OBJS2C   = init_rs.o encode_rs.o decode_rs.o 
 F2PYONLY = ftn_init ftn_quit audio_init spec getfile azdist0 astro0
 SRCS2F90 = a2d.f90 abc441.f90 astro0.f90 audio_init.f90 azdist0.f90 \
@@ -31,10 +34,18 @@ SRCS2F90 = a2d.f90 abc441.f90 astro0.f90 audio_init.f90 azdist0.f90 \
 	i1tor4.f90 pix2d.f90 pix2d65.f90 rfile.f90 savedata.f90 spec.f90 \
 	wsjtgen.f90 runqqq.f90 fivehz.f90
 SRCS2F77	= wsjt1.f fsubs1.f fsubs.f astro.f astropak.f
-# For Windows
-#SRCS2C	= jtadudio.c resample.c ptt.c igray.c wrapkarn.c
-# For unix
-SRCS2C	= jtaudio.c ptt_unix.c igray.c wrapkarn.c start_threads.c cutil.c
+#
+# ok, so far for Windows @AUDIO@ will be jtaudio.c since it uses portaudio
+#            for *nix @AUDIO@ will also be jtaudio.c for portaudio
+#            for *nix @AUDIO@ will be start_threads.c for alsa
+#            for *nix @AUDIO@ will be ?? for oss
+#
+# ptt_unix.c vs. ptt.c I'll sort out later. 
+# ditto for cutil.c (only used on *nix)
+# --db
+#
+SRCS2C	= ptt_unix.c igray.c wrapkarn.c cutil.c
+SRCS2C	+=  @AUDIO@
 
 all:	wsjt6
 JT65code: $(OBJS1)
@@ -47,7 +58,7 @@ wsjt6:	Audio.so #wsjt.spec
 Audio.so: $(OBJS2C)
 	 ${PYTHON} ${F2PY_PY} -c --verbose --opt="-O -cpp -D${OS} \
 	-fno-second-underscore"	$(OBJS2C) -m Audio \
-	--f77exec=${G95} --f90exec=${G95} -L${COMPILER} -lpthread -lg2c \
+	--f77exec=${G95} --f90exec=${G95} ${CPPFLAGS} ${LDFLAGS} ${LIBS} \
 	only: $(F2PYONLY) \
 	: $(SRCS2F90) \
 	$(SRCS2F77) \
@@ -57,8 +68,8 @@ wsjt.spec: wsjt.py astro.py g.py options.py palettes.py smeter.py specjt.py
 #	${PYTHON} c:\python23\installer\makespec.py --icon wsjt.ico \
 #	--tk --onefile wsjt.py
 
-#jtaudio.o: jtaudio.c
-#	cl -c jtaudio.c
+jtaudio.o: jtaudio.c
+	$(CC) -c $(CPPFLAGS) jtaudio.c
 
 init_rs_int.o: init_rs.c
 	$(CC) -c -DBIGSYM=1 -o init_rs_int.o init_rs.c
@@ -89,5 +100,5 @@ start_threads.o: start_threads.c
 
 .PHONY : clean
 clean:
-	${RM} -f *.o *.so JT65code
+	${RM} -f *.o *.so JT65code wsjt6
 
diff --git a/conf.h.in b/conf.h.in
index 9d9b49d88..d3541dcef 100644
--- a/conf.h.in
+++ b/conf.h.in
@@ -58,8 +58,8 @@
 /* Define if you want to use OSS */
 #undef USE_OSS
 
-/* Define if you have audiofile.h */
-#undef HAS_AUDIOFILE_H
+/* Define if you have portaudio.h */
+#undef HAS_PORTAUDIO_H
 
-/* Define if you want to use LIBAUDIO */
-#undef USE_LIBAUDIO
+/* Define if you want to use PORTAUDIO */
+#undef USE_PORTAUDIO
diff --git a/configure b/configure
index 4005aebbc..04ae9ea10 100755
--- a/configure
+++ b/configure
@@ -2,7 +2,7 @@
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.53 for wsjt 0.9.
 #
-# $Id: configure.ac 59 2006-01-07 21:24:49Z va3db $
+# $Id: configure.ac 64 2006-01-08 18:19:01Z va3db $
 #
 # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
 # Free Software Foundation, Inc.
@@ -838,7 +838,7 @@ Optional Features:
   --enable-assert         Enable assert().
   --enable-alsa           Force ALSA SOUNDCARD usage.
   --enable-oss            Force OSS SOUND usage.
-  --enable-libaudio       Force LIBAUDIO SOUND usage.
+  --enable-portaudio      Force PORTAUDIO SOUND usage.
 
 Some influential environment variables:
   CC          C compiler command
@@ -924,7 +924,7 @@ Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 
-$Id: configure.ac 59 2006-01-07 21:24:49Z va3db $
+$Id: configure.ac 64 2006-01-08 18:19:01Z va3db $
 _ACEOF
   exit 0
 fi
@@ -2197,6 +2197,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 CFLAGS="$OLD_CFLAGS"
 
+CPPFLAGS="-I/usr/local/include -I/usr/include/alsa ${CPPFLAGS}"
+LDFLAGS="-L/usr/local/lib ${LDFLAGS}"
+
 echo "$as_me:$LINENO: checking uname -s for Cygwin, Solaris or HPUX" >&5
 echo $ECHO_N "checking uname -s for Cygwin, Solaris or HPUX... $ECHO_C" >&6
 case `uname -s` in
@@ -3758,23 +3761,23 @@ else
 fi
 
 
-if test "${ac_cv_header_alsa_alsasound_h+set}" = set; then
-  echo "$as_me:$LINENO: checking for alsa/alsasound.h" >&5
-echo $ECHO_N "checking for alsa/alsasound.h... $ECHO_C" >&6
-if test "${ac_cv_header_alsa_alsasound_h+set}" = set; then
+if test "${ac_cv_header_alsa_asoundlib_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for alsa/asoundlib.h" >&5
+echo $ECHO_N "checking for alsa/asoundlib.h... $ECHO_C" >&6
+if test "${ac_cv_header_alsa_asoundlib_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_alsa_alsasound_h" >&5
-echo "${ECHO_T}$ac_cv_header_alsa_alsasound_h" >&6
+echo "$as_me:$LINENO: result: $ac_cv_header_alsa_asoundlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_alsa_asoundlib_h" >&6
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking alsa/alsasound.h usability" >&5
-echo $ECHO_N "checking alsa/alsasound.h usability... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking alsa/asoundlib.h usability" >&5
+echo $ECHO_N "checking alsa/asoundlib.h usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
 #line $LINENO "configure"
 #include "confdefs.h"
 $ac_includes_default
-#include <alsa/alsasound.h>
+#include <alsa/asoundlib.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
@@ -3799,12 +3802,12 @@ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
 echo "${ECHO_T}$ac_header_compiler" >&6
 
 # Is the header present?
-echo "$as_me:$LINENO: checking alsa/alsasound.h presence" >&5
-echo $ECHO_N "checking alsa/alsasound.h presence... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking alsa/asoundlib.h presence" >&5
+echo $ECHO_N "checking alsa/asoundlib.h presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
 #line $LINENO "configure"
 #include "confdefs.h"
-#include <alsa/alsasound.h>
+#include <alsa/asoundlib.h>
 _ACEOF
 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
@@ -3836,53 +3839,53 @@ echo "${ECHO_T}$ac_header_preproc" >&6
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc in
   yes:no )
-    { echo "$as_me:$LINENO: WARNING: alsa/alsasound.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: alsa/alsasound.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: alsa/alsasound.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: alsa/alsasound.h: proceeding with the preprocessor's result" >&2;};;
+    { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: proceeding with the preprocessor's result" >&2;};;
   no:yes )
-    { echo "$as_me:$LINENO: WARNING: alsa/alsasound.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: alsa/alsasound.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: alsa/alsasound.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: alsa/alsasound.h: check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: alsa/alsasound.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: alsa/alsasound.h: proceeding with the preprocessor's result" >&2;};;
+    { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: proceeding with the preprocessor's result" >&2;};;
 esac
-echo "$as_me:$LINENO: checking for alsa/alsasound.h" >&5
-echo $ECHO_N "checking for alsa/alsasound.h... $ECHO_C" >&6
-if test "${ac_cv_header_alsa_alsasound_h+set}" = set; then
+echo "$as_me:$LINENO: checking for alsa/asoundlib.h" >&5
+echo $ECHO_N "checking for alsa/asoundlib.h... $ECHO_C" >&6
+if test "${ac_cv_header_alsa_asoundlib_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_alsa_alsasound_h=$ac_header_preproc
+  ac_cv_header_alsa_asoundlib_h=$ac_header_preproc
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_alsa_alsasound_h" >&5
-echo "${ECHO_T}$ac_cv_header_alsa_alsasound_h" >&6
+echo "$as_me:$LINENO: result: $ac_cv_header_alsa_asoundlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_alsa_asoundlib_h" >&6
 
 fi
-if test $ac_cv_header_alsa_alsasound_h = yes; then
-  HAS_ALSASOUND_H=1
+if test $ac_cv_header_alsa_asoundlib_h = yes; then
+  HAS_ASOUNDLIB_H=1
 else
-  HAS_ALSASOUND_H=0
+  HAS_ASOUNDLIB_H=0
 fi
 
 
-if test "${ac_cv_header_audiofile_h+set}" = set; then
-  echo "$as_me:$LINENO: checking for audiofile.h" >&5
-echo $ECHO_N "checking for audiofile.h... $ECHO_C" >&6
-if test "${ac_cv_header_audiofile_h+set}" = set; then
+if test "${ac_cv_header_sys_asoundlib_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for sys/asoundlib.h" >&5
+echo $ECHO_N "checking for sys/asoundlib.h... $ECHO_C" >&6
+if test "${ac_cv_header_sys_asoundlib_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_audiofile_h" >&5
-echo "${ECHO_T}$ac_cv_header_audiofile_h" >&6
+echo "$as_me:$LINENO: result: $ac_cv_header_sys_asoundlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_asoundlib_h" >&6
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking audiofile.h usability" >&5
-echo $ECHO_N "checking audiofile.h usability... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking sys/asoundlib.h usability" >&5
+echo $ECHO_N "checking sys/asoundlib.h usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
 #line $LINENO "configure"
 #include "confdefs.h"
 $ac_includes_default
-#include <audiofile.h>
+#include <sys/asoundlib.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
@@ -3907,12 +3910,12 @@ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
 echo "${ECHO_T}$ac_header_compiler" >&6
 
 # Is the header present?
-echo "$as_me:$LINENO: checking audiofile.h presence" >&5
-echo $ECHO_N "checking audiofile.h presence... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking sys/asoundlib.h presence" >&5
+echo $ECHO_N "checking sys/asoundlib.h presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
 #line $LINENO "configure"
 #include "confdefs.h"
-#include <audiofile.h>
+#include <sys/asoundlib.h>
 _ACEOF
 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
@@ -3944,33 +3947,141 @@ echo "${ECHO_T}$ac_header_preproc" >&6
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc in
   yes:no )
-    { echo "$as_me:$LINENO: WARNING: audiofile.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: audiofile.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: audiofile.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: audiofile.h: proceeding with the preprocessor's result" >&2;};;
+    { echo "$as_me:$LINENO: WARNING: sys/asoundlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sys/asoundlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/asoundlib.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sys/asoundlib.h: proceeding with the preprocessor's result" >&2;};;
   no:yes )
-    { echo "$as_me:$LINENO: WARNING: audiofile.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: audiofile.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: audiofile.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: audiofile.h: check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: audiofile.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: audiofile.h: proceeding with the preprocessor's result" >&2;};;
+    { echo "$as_me:$LINENO: WARNING: sys/asoundlib.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: sys/asoundlib.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/asoundlib.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: sys/asoundlib.h: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/asoundlib.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sys/asoundlib.h: proceeding with the preprocessor's result" >&2;};;
 esac
-echo "$as_me:$LINENO: checking for audiofile.h" >&5
-echo $ECHO_N "checking for audiofile.h... $ECHO_C" >&6
-if test "${ac_cv_header_audiofile_h+set}" = set; then
+echo "$as_me:$LINENO: checking for sys/asoundlib.h" >&5
+echo $ECHO_N "checking for sys/asoundlib.h... $ECHO_C" >&6
+if test "${ac_cv_header_sys_asoundlib_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_audiofile_h=$ac_header_preproc
+  ac_cv_header_sys_asoundlib_h=$ac_header_preproc
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_audiofile_h" >&5
-echo "${ECHO_T}$ac_cv_header_audiofile_h" >&6
+echo "$as_me:$LINENO: result: $ac_cv_header_sys_asoundlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_asoundlib_h" >&6
 
 fi
-if test $ac_cv_header_audiofile_h = yes; then
-  HAS_AUDIOFILE_H=1
+if test $ac_cv_header_sys_asoundlib_h = yes; then
+  HAS_ASOUNDLIB_H=1
 else
-  HAS_AUDIOFILE_H=0
+  HAS_ASOUNDLIB_H=0
+fi
+
+
+if test "${ac_cv_header_portaudio_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for portaudio.h" >&5
+echo $ECHO_N "checking for portaudio.h... $ECHO_C" >&6
+if test "${ac_cv_header_portaudio_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_portaudio_h" >&5
+echo "${ECHO_T}$ac_cv_header_portaudio_h" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking portaudio.h usability" >&5
+echo $ECHO_N "checking portaudio.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#include <portaudio.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking portaudio.h presence" >&5
+echo $ECHO_N "checking portaudio.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <portaudio.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: portaudio.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: portaudio.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: portaudio.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: portaudio.h: proceeding with the preprocessor's result" >&2;};;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: portaudio.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: portaudio.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: portaudio.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: portaudio.h: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: portaudio.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: portaudio.h: proceeding with the preprocessor's result" >&2;};;
+esac
+echo "$as_me:$LINENO: checking for portaudio.h" >&5
+echo $ECHO_N "checking for portaudio.h... $ECHO_C" >&6
+if test "${ac_cv_header_portaudio_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_portaudio_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_portaudio_h" >&5
+echo "${ECHO_T}$ac_cv_header_portaudio_h" >&6
+
+fi
+if test $ac_cv_header_portaudio_h = yes; then
+  HAS_PORTAUDIO_H=1
+else
+  HAS_PORTAUDIO_H=0
 fi
 
 
@@ -5595,12 +5706,12 @@ else
 fi;
 
 
-# Check whether --enable-libaudio or --disable-libaudio was given.
-if test "${enable_libaudio+set}" = set; then
-  enableval="$enable_libaudio"
-  libaudio=$enableval
+# Check whether --enable-portaudio or --disable-portaudio was given.
+if test "${enable_portaudio+set}" = set; then
+  enableval="$enable_portaudio"
+  portaudio=$enableval
 else
-  libaudio=no
+  portaudio=no
 fi;
 
 if test "$alsa" = yes; then
@@ -5609,6 +5720,9 @@ cat >>confdefs.h <<\_ACEOF
 #define USE_ALSA 1
 _ACEOF
 
+	AUDIO="start_threads.c"
+
+	LDFLAGS="-Lpthreads ${LDFLAGS}"
 fi
 
 if test "$oss" = yes; then
@@ -5617,26 +5731,47 @@ cat >>confdefs.h <<\_ACEOF
 #define USE_OSS 1
 _ACEOF
 
+	AUDIO="jtaudio.c"
+
 fi
 
-if test "$libaudio" = yes; then
+if test "$portaudio" = yes; then
 
 cat >>confdefs.h <<\_ACEOF
-#define USE_LIBAUDIO 1
+#define USE_PORTAUDIO 1
+_ACEOF
+
+	AUDIO="jtaudio.c"
+
+fi
+
+
+if test $HAS_ASOUNDLIB_H -eq 1; then
+	cat >>confdefs.h <<\_ACEOF
+#define HAS_ASOUNDLIB_H 1
+_ACEOF
+
+fi
+
+if test $HAS_SOUNDCARD_H -eq 1; then
+	cat >>confdefs.h <<\_ACEOF
+#define HAS_SOUNDCARD_H 1
+_ACEOF
+
+fi
+
+if test $HAS_PORTAUDIO_H -eq 1; then
+	cat >>confdefs.h <<\_ACEOF
+#define HAS_PORTAUDIO_H 1
 _ACEOF
 
 fi
 
 if test "$alsa" = yes; then
-	if test $HAS_ALSASOUND_H -eq 0; then
-		{ { echo "$as_me:$LINENO: error: You need alsasound.h to use --enable-alsa" >&5
-echo "$as_me: error: You need alsasound.h to use --enable-alsa" >&2;}
+	if test $HAS_ASOUNDLIB_H -eq 0; then
+		{ { echo "$as_me:$LINENO: error: You need asoundlib.h to use --enable-alsa" >&5
+echo "$as_me: error: You need asoundlib.h to use --enable-alsa" >&2;}
    { (exit 1); exit 1; }; }
-	else
-		cat >>confdefs.h <<\_ACEOF
-#define HAS_ALSASOUND_H 1
-_ACEOF
-
 	fi
 fi
 
@@ -5645,27 +5780,22 @@ if test "$oss" = yes; then
 		{ { echo "$as_me:$LINENO: error: You need soundcard.h to use --enable-oss" >&5
 echo "$as_me: error: You need soundcard.h to use --enable-oss" >&2;}
    { (exit 1); exit 1; }; }
-	else
-		cat >>confdefs.h <<\_ACEOF
-#define HAS_SOUNDCARD_H 1
-_ACEOF
-
 	fi
 fi
 
-if test "$libaudio" = yes; then
-	if test $HAS_AUDIOFILE_H -eq 0; then
-		{ { echo "$as_me:$LINENO: error: You need audiofile.h to use --enable-libaudio" >&5
-echo "$as_me: error: You need audiofile.h to use --enable-libaudio" >&2;}
+if test "$portaudio" = yes; then
+	if test $HAS_PORTAUDIO_H -eq 0; then
+		{ { echo "$as_me:$LINENO: error: You need portaudio.h to use --enable-portaudio" >&5
+echo "$as_me: error: You need portaudio.h to use --enable-portaudio" >&2;}
    { (exit 1); exit 1; }; }
-	else
-		cat >>confdefs.h <<\_ACEOF
-#define HAS_AUDIOFILE_H 1
-_ACEOF
-
 	fi
 fi
 
+CPPFLAGS="${CPPFLAGS}"
+
+LDFLAGS="${LDFLAGS}"
+
+
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
@@ -6250,6 +6380,7 @@ s,@G95_LIB_PATH@,$G95_LIB_PATH,;t t
 s,@OS@,$OS,;t t
 s,@CLOBBER@,$CLOBBER,;t t
 s,@WSJT_CFLAGS@,$WSJT_CFLAGS,;t t
+s,@AUDIO@,$AUDIO,;t t
 CEOF
 
 _ACEOF
diff --git a/configure.ac b/configure.ac
index b16499ce1..090b40600 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,6 +22,10 @@ AC_PROG_F77
 dnl Make sure autoconf doesn't interfere with cflags -jmallett
 CFLAGS="$OLD_CFLAGS"
 
+dnl Lets guess at some likely places for extra libs/includes XXX -db
+CPPFLAGS="-I/usr/local/include -I/usr/include/alsa ${CPPFLAGS}"
+LDFLAGS="-L/usr/local/lib ${LDFLAGS}"
+
 AC_MSG_CHECKING([uname -s for Cygwin, Solaris or HPUX])
 case `uname -s` in
 	CYGWIN*)
@@ -96,9 +100,9 @@ AC_HEADER_STDC
 
 AC_CHECK_HEADERS([inttypes.h stdint.h sys/resource.h sys/param.h errno.h sys/syslog.h stddef.h libgen.h sys/wait.h wait.h ])
 AC_CHECK_HEADER([sys/soundcard.h], [HAS_SOUNDCARD_H=1], [HAS_SOUNDCARD_H=0])
-AC_CHECK_HEADER([alsa/alsasound.h], [HAS_ALSASOUND_H=1], [HAS_ALSASOUND_H=0])
-dnl XXX non portable portaudio.h check fix later --db
-AC_CHECK_HEADER([/usr/local/include/portaudio.h], [HAS_PORTAUDIO_H=1], [HAS_PORTAUDIO_H=0])
+AC_CHECK_HEADER([alsa/asoundlib.h], [HAS_ASOUNDLIB_H=1], [HAS_ASOUNDLIB_H=0])
+AC_CHECK_HEADER([sys/asoundlib.h], [HAS_ASOUNDLIB_H=1], [HAS_ASOUNDLIB_H=0])
+AC_CHECK_HEADER([portaudio.h], [HAS_PORTAUDIO_H=1], [HAS_PORTAUDIO_H=0])
 
 dnl See whether we can include both string.h and strings.h.
 AC_CACHE_CHECK([whether string.h and strings.h may both be included],
@@ -216,20 +220,24 @@ AC_HELP_STRING([--enable-portaudio],[Force PORTAUDIO SOUND usage.]),
 
 if test "$alsa" = yes; then
 	AC_DEFINE(USE_ALSA, 1, [Define if you want ALSA used.])
+	AC_SUBST(AUDIO, "start_threads.c")
+	LDFLAGS="-Lpthreads ${LDFLAGS}"
 fi
 
 if test "$oss" = yes; then
 	AC_DEFINE(USE_OSS, 1, [Define if you want OSS used.])
+	AC_SUBST(AUDIO, "jtaudio.c")
 fi
 
 if test "$portaudio" = yes; then
 	AC_DEFINE(USE_PORTAUDIO, 1, [Define if you want PORTAUDIO used.])
+	AC_SUBST(AUDIO, "jtaudio.c")
 fi
 
 dnl set conf flags
 
-if test $HAS_ALSASOUND_H -eq 1; then
-	AC_DEFINE(HAS_ALSASOUND_H, 1, )
+if test $HAS_ASOUNDLIB_H -eq 1; then
+	AC_DEFINE(HAS_ASOUNDLIB_H, 1, )
 fi
 
 if test $HAS_SOUNDCARD_H -eq 1; then
@@ -242,8 +250,8 @@ fi
 
 dnl sanity tests.
 if test "$alsa" = yes; then
-	if test $HAS_ALSASOUND_H -eq 0; then
-		AC_MSG_ERROR([You need alsasound.h to use --enable-alsa])
+	if test $HAS_ASOUNDLIB_H -eq 0; then
+		AC_MSG_ERROR([You need asoundlib.h to use --enable-alsa])
 	fi
 fi
 
@@ -259,6 +267,10 @@ if test "$portaudio" = yes; then
 	fi
 fi
 
+dnl 
+AC_SUBST(CPPFLAGS, "${CPPFLAGS}")
+AC_SUBST(LDFLAGS, "${LDFLAGS}")
+
 AC_OUTPUT
 
 echo