--- configure.orig	2009-12-17 15:23:05.000000000 +0100
+++ configure	2010-01-11 14:21:26.000000000 +0100
@@ -125,6 +125,8 @@
 if [ "$OS" = "freebsd" ]; then
   INCCURL="-I/usr/local/include"
   LIBCURL="-L/usr/local/lib -lcurl"
+  INCPULSE="-I/usr/local/include"
+  LIBPULSE="-L/usr/local/lib"
 else
   INCCURL=""
   LIBCURL="-lcurl"
@@ -1181,7 +1183,7 @@
 #endif
 }
 EOF
-  if test_compile "-lpulse" pulse pulse; then
+  if test_compile "$INCPULSE $LIBPULSE -lpulse" pulse pulse; then
     test_execute
   fi
 }
@@ -2315,6 +2317,15 @@
 [ $WITH_QT4    -eq 1 ] && check_qt4
 [ $WITH_PYTHON -eq 1 ] && check_python
 
+# PulseAudio
+if [ "$OS" = "linux" -o "$OS" = "freebsd" ]; then
+  if [ $WITH_PULSE -eq 1 ]; then
+    check_pulse
+  else
+    cnf_append "VBOX_WITH_PULSE" ""
+  fi
+fi
+
 # Linux-specific
 if [ "$OS" = "linux" ]; then
   # don't check for the static libstdc++ in the PUEL version as we build the
@@ -2332,11 +2343,6 @@
   else
     cnf_append "VBOX_WITH_ALSA" ""
   fi
-  if [ $WITH_PULSE -eq 1 ]; then
-    check_pulse
-  else
-    cnf_append "VBOX_WITH_PULSE" ""
-  fi
   if [ $WITH_DBUS -eq 0 ]; then
     cnf_append "VBOX_WITH_DBUS" ""
   fi
--- src/VBox/Devices/Audio/audio.c.orig	2009-12-15 14:54:13.000000000 +0900
+++ src/VBox/Devices/Audio/audio.c	2009-12-15 14:53:54.000000000 +0900
@@ -73,6 +73,11 @@
     &pulse_audio_driver,
 # endif
 #endif /* RT_OS_LINUX */
+#ifdef RT_OS_FREEBSD
+# ifdef VBOX_WITH_PULSE
+    &pulse_audio_driver,
+# endif
+#endif
 #ifdef RT_OS_DARWIN
     &coreaudio_audio_driver,
 #endif
--- src/VBox/Devices/Makefile.kmk.orig	2009-12-17 15:27:43.000000000 +0100
+++ src/VBox/Devices/Makefile.kmk	2009-12-21 14:29:56.000000000 +0100
@@ -970,6 +970,10 @@
  Drivers_SOURCES.linux+= \
 	Audio/pulseaudio.c \
 	Audio/pulse_stubs.c
+ Drivers_DEFS.freebsd += VBOX_WITH_PULSE
+ Drivers_SOURCES.freebsd+= \
+	Audio/pulseaudio.c \
+	Audio/pulse_stubs.c
 endif
 
 ifdef VBOX_WITH_USB
--- src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp.orig	2009-12-15 15:16:21.000000000 +0900
+++ src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp	2009-12-15 15:14:01.000000000 +0900
@@ -41,6 +41,11 @@
 #else
     bool fSolaris = false;
 #endif
+#ifdef RT_OS_FREEBSD
+    bool fFreeBSD = true;
+#else
+    bool fFreeBSD = false;
+#endif
 #ifdef RT_OS_DARWIN
     bool fDarwin = true;
 #else
@@ -62,6 +67,7 @@
         fLinux = true;
         fWin = true;
         fSolaris = true;
+	fFreeBSD = true;
         fDarwin = true;
         fVRDP = true;
         fVBoxSDL = true;
@@ -227,6 +233,14 @@
 #endif
                                              );
         }
+        if (fFreeBSD)
+        {
+            RTPrintf(                        "|oss"
+#ifdef VBOX_WITH_PULSE
+                                             "|pulse"
+#endif
+                                             );
+        }
         if (fDarwin)
         {
             RTPrintf(                        "|coreaudio");
--- src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp.orig	2009-09-09 23:39:46.000000000 +0900
+++ src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp	2009-12-15 15:22:27.000000000 +0900
@@ -1478,6 +1478,20 @@
 # endif
 
 #endif /* !RT_OS_SOLARIS */
+#ifdef RT_OS_FREEBSD
+                else if (!strcmp(ValueUnion.psz, "oss"))
+                {
+                    CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS));
+                    CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
+                }
+# ifdef VBOX_WITH_PULSE
+                else if (!strcmp(ValueUnion.psz, "pulse"))
+                {
+                    CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Pulse));
+                    CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
+                }
+# endif
+#endif /* !RT_OS_FREEBSD */
 #ifdef RT_OS_DARWIN
                 else if (!strcmp(ValueUnion.psz, "coreaudio"))
                 {
--- src/VBox/Main/AudioAdapterImpl.cpp.orig	2009-12-15 14:45:08.000000000 +0900
+++ src/VBox/Main/AudioAdapterImpl.cpp	2009-12-15 14:45:42.000000000 +0900
@@ -261,6 +261,11 @@
 #if defined (RT_OS_LINUX) || defined (RT_OS_FREEBSD) || defined(VBOX_WITH_SOLARIS_OSS)
             case AudioDriverType_OSS:
 #endif
+#ifdef RT_OS_FREEBSD
+# ifdef VBOX_WITH_PULSE
+            case AudioDriverType_Pulse:
+# endif
+#endif
 #ifdef RT_OS_DARWIN
             case AudioDriverType_CoreAudio:
 #endif
--- src/VBox/Main/ConsoleImpl2.cpp.orig	2009-12-15 14:48:58.000000000 +0900
+++ src/VBox/Main/ConsoleImpl2.cpp	2009-12-15 14:48:42.000000000 +0900
@@ -1605,6 +1605,15 @@
                 break;
             }
 #endif
+#ifdef RT_OS_FREEBSD
+# ifdef VBOX_WITH_PULSE
+            case AudioDriverType_Pulse:
+            {
+                rc = CFGMR3InsertString(pCfg, "AudioDriver", "pulse");              RC_CHECK();
+                break;
+            }
+# endif
+#endif
 #ifdef RT_OS_DARWIN
             case AudioDriverType_CoreAudio:
             {
--- src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsAudio.cpp.orig	2009-12-17 15:28:01.000000000 +0100
+++ src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsAudio.cpp	2009-12-21 14:14:35.000000000 +0100
@@ -89,6 +89,9 @@
 #endif
 #if defined Q_OS_LINUX || defined Q_OS_FREEBSD
     mCbAudioDriver->addItem (vboxGlobal().toString (KAudioDriverType_OSS));
+# ifdef VBOX_WITH_PULSE
+    mCbAudioDriver->addItem (vboxGlobal().toString (KAudioDriverType_Pulse));
+# endif
 #endif
 #if defined Q_OS_LINUX
 # ifdef VBOX_WITH_ALSA
