Index: /pjproject/trunk/aconfigure
===================================================================
--- /pjproject/trunk/aconfigure	(revision 5778)
+++ /pjproject/trunk/aconfigure	(revision 5779)
@@ -763,4 +763,5 @@
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
@@ -888,4 +889,5 @@
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
@@ -1140,4 +1142,13 @@
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
@@ -1277,5 +1288,5 @@
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
@@ -1430,4 +1441,5 @@
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
@@ -6362,8 +6374,9 @@
 	;;
   *)
-		ac_pjmedia_snd=alsa
-	ac_pa_use_alsa=1
-
-	ac_fn_c_check_header_mongrel "$LINENO" "alsa/version.h" "ac_cv_header_alsa_version_h" "$ac_includes_default"
+	if test "x$ac_external_pa" != "x1"; then
+				ac_pjmedia_snd=alsa
+		ac_pa_use_alsa=1
+
+		ac_fn_c_check_header_mongrel "$LINENO" "alsa/version.h" "ac_cv_header_alsa_version_h" "$ac_includes_default"
 if test "x$ac_cv_header_alsa_version_h" = xyes; then :
   LIBS="$LIBS -lasound"
@@ -6373,20 +6386,21 @@
 
 
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Checking sound device backend... unix" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Checking sound device backend... unix" >&5
 $as_echo "Checking sound device backend... unix" >&6; }
 
-		ac_pa_use_oss=1
-
-	# Check whether --enable-oss was given.
+				ac_pa_use_oss=1
+
+		# Check whether --enable-oss was given.
 if test "${enable_oss+set}" = set; then :
   enableval=$enable_oss;
-			if test "$enable_oss" = "no"; then
-			 ac_pa_use_oss=0
-			 { $as_echo "$as_me:${as_lineno-$LINENO}: result: Checking if OSS audio is disabled... yes" >&5
+				if test "$enable_oss" = "no"; then
+				 ac_pa_use_oss=0
+				 { $as_echo "$as_me:${as_lineno-$LINENO}: result: Checking if OSS audio is disabled... yes" >&5
 $as_echo "Checking if OSS audio is disabled... yes" >&6; }
-			fi
-
-fi
-
+				fi
+
+fi
+
+	fi
 	;;
  esac
Index: /pjproject/trunk/aconfigure.ac
===================================================================
--- /pjproject/trunk/aconfigure.ac	(revision 5778)
+++ /pjproject/trunk/aconfigure.ac	(revision 5779)
@@ -736,23 +736,25 @@
 	;;
   *)
-	dnl # Check if ALSA is available
-	ac_pjmedia_snd=alsa
-	AC_SUBST(ac_pa_use_alsa,1)
-	AC_CHECK_HEADER(alsa/version.h,
-			[LIBS="$LIBS -lasound"],
-		        [ac_pa_use_alsa=0])
-	AC_MSG_RESULT([Checking sound device backend... unix])
-
-	dnl # Check if OSS is disabled
-	AC_SUBST(ac_pa_use_oss,1)
-	AC_ARG_ENABLE(oss,
-		      AS_HELP_STRING([--disable-oss],
-				     [Disable OSS audio (default: not disabled)]),
-		      [
-			if test "$enable_oss" = "no"; then
-			 [ac_pa_use_oss=0]
-			 AC_MSG_RESULT([Checking if OSS audio is disabled... yes])
-			fi
-		      ])
+	if test "x$ac_external_pa" != "x1"; then
+		dnl # Check if ALSA is available
+		ac_pjmedia_snd=alsa
+		AC_SUBST(ac_pa_use_alsa,1)
+		AC_CHECK_HEADER(alsa/version.h,
+				[LIBS="$LIBS -lasound"],
+				[ac_pa_use_alsa=0])
+		AC_MSG_RESULT([Checking sound device backend... unix])
+
+		dnl # Check if OSS is disabled
+		AC_SUBST(ac_pa_use_oss,1)
+		AC_ARG_ENABLE(oss,
+			      AS_HELP_STRING([--disable-oss],
+					     [Disable OSS audio (default: not disabled)]),
+			      [
+				if test "$enable_oss" = "no"; then
+				 [ac_pa_use_oss=0]
+				 AC_MSG_RESULT([Checking if OSS audio is disabled... yes])
+				fi
+			      ])
+	fi
 	;;
  esac
Index: /pjproject/trunk/build.mak.in
===================================================================
--- /pjproject/trunk/build.mak.in	(revision 5778)
+++ /pjproject/trunk/build.mak.in	(revision 5779)
@@ -116,17 +116,7 @@
 endif
 
-ifneq ($(findstring pa,@ac_pjmedia_snd@),)
 ifeq (@ac_external_pa@,1)
 # External PA
 APP_THIRD_PARTY_EXT += -lportaudio
-else
-APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libportaudio-$(LIB_SUFFIX)
-ifeq ($(PJ_SHARED_LIBRARIES),)
-APP_THIRD_PARTY_LIBS += -lportaudio-$(TARGET_NAME)
-else
-APP_THIRD_PARTY_LIBS += -lportaudio
-APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libportaudio.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libportaudio.$(SHLIB_SUFFIX)
-endif
-endif
 endif
 
Index: /pjproject/trunk/pjmedia/build/os-auto.mak.in
===================================================================
--- /pjproject/trunk/pjmedia/build/os-auto.mak.in	(revision 5778)
+++ /pjproject/trunk/pjmedia/build/os-auto.mak.in	(revision 5779)
@@ -190,5 +190,6 @@
 ifeq (@ac_external_pa@,1)
 # External PA
-export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_PORTAUDIO=1
+export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_PORTAUDIO=1 \
+		 -DPJMEDIA_AUDIO_DEV_HAS_WMME=0
 endif
 
Index: /pjproject/trunk/pjmedia/src/pjmedia-audiodev/errno.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia-audiodev/errno.c	(revision 5778)
+++ /pjproject/trunk/pjmedia/src/pjmedia-audiodev/errno.c	(revision 5779)
@@ -110,5 +110,5 @@
 
     } else 
-#endif	/* PJMEDIA_SOUND_IMPLEMENTATION */
+#endif	/* PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO */
 
     /* See if the error comes from WMME */
Index: /pjproject/trunk/pjmedia/src/pjmedia/errno.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/errno.c	(revision 5778)
+++ /pjproject/trunk/pjmedia/src/pjmedia/errno.c	(revision 5779)
@@ -21,6 +21,5 @@
 #include <pjmedia/types.h>
 #include <pj/string.h>
-#if defined(PJMEDIA_SOUND_IMPLEMENTATION) && \
-    PJMEDIA_SOUND_IMPLEMENTATION == PJMEDIA_SOUND_PORTAUDIO_SOUND
+#if PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO
 #   include <portaudio.h>
 #endif
@@ -190,6 +189,5 @@
 
     /* See if the error comes from PortAudio. */
-#if defined(PJMEDIA_SOUND_IMPLEMENTATION) && \
-    PJMEDIA_SOUND_IMPLEMENTATION == PJMEDIA_SOUND_PORTAUDIO_SOUND
+#if PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO
     if (statcode >= PJMEDIA_PORTAUDIO_ERRNO_START &&
 	statcode <= PJMEDIA_PORTAUDIO_ERRNO_END)
@@ -208,5 +206,5 @@
 
     } else 
-#endif	/* PJMEDIA_SOUND_IMPLEMENTATION */
+#endif	/* PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO */
 
 #if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
Index: /pjproject/trunk/pjmedia/src/pjmedia/rtcp_xr.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/rtcp_xr.c	(revision 5778)
+++ /pjproject/trunk/pjmedia/src/pjmedia/rtcp_xr.c	(revision 5779)
@@ -350,5 +350,5 @@
 	est_extra_delay = 30;
 
-#if PJMEDIA_SOUND_IMPLEMENTATION!=PJMEDIA_SOUND_NULL_SOUND
+#if !PJMEDIA_AUDIO_DEV_HAS_NULL_AUDIO
 	est_extra_delay += PJMEDIA_SND_DEFAULT_REC_LATENCY + 
 			   PJMEDIA_SND_DEFAULT_PLAY_LATENCY;
