Index: libs/srtp/configure.in
===================================================================
--- libs/srtp/configure.in	(revision 6445)
+++ libs/srtp/configure.in	(working copy)
@@ -85,6 +85,18 @@
                         fi
                         DYNAMIC_LIB_EXTEN="so"
                 ;;
+		i*6*-*-freebsd*)
+                        SOLINK="-shared -Xlinker -x"
+                        new_AM_CFLAGS="-fPIC -Wall -O4 -fexpensive-optimizations -funroll-loops"
+                        new_AM_LDFLAGS=""
+                        DYNAMIC_LIB_EXTEN="so"
+		;;
+		x86_64-*-freebsd*|amd64-*-freebsd*)
+                        SOLINK="-shared -Xlinker -x"
+                        new_AM_CFLAGS="-fPIC -Wall -O4 -fexpensive-optimizations -funroll-loops"
+                        new_AM_LDFLAGS=""
+                        DYNAMIC_LIB_EXTEN="so"
+		;;
 esac
 
 #  Enable 64 bit build
Index: libs/libresample/configure.in
===================================================================
--- libs/libresample/configure.in	(revision 6445)
+++ libs/libresample/configure.in	(working copy)
@@ -93,6 +93,18 @@
                         fi
                         DYNAMIC_LIB_EXTEN="so"
                 ;;
+                x86_64-*-freebsd*|amd64-*-freebsd*)
+                        SOLINK="-shared -Xlinker -x"
+                        new_AM_CFLAGS="-fPIC"
+                        new_AM_LDFLAGS=""
+                        DYNAMIC_LIB_EXTEN="so"
+                ;;
+                i*6-*-freebsd*)
+                        SOLINK="-shared -Xlinker -x"
+                        new_AM_CFLAGS="-fpic"
+                        new_AM_LDFLAGS=""
+                        DYNAMIC_LIB_EXTEN="so"
+                ;;
 esac
 
 #  Enable 64 bit build
Index: libs/libteletone/configure.in
===================================================================
--- libs/libteletone/configure.in	(revision 6445)
+++ libs/libteletone/configure.in	(working copy)
@@ -55,6 +55,14 @@
                 new_AM_CFLAGS="-fpic"
                 new_AM_LDFLAGS=""
         ;;
+        x86_64-*-freebsd*|amd64-*-freebsd*)
+                new_AM_CFLAGS="-fPIC"
+                new_AM_LDFLAGS=""
+        ;;
+        i*6-*-freebsd*)
+                new_AM_CFLAGS="-fpic"
+                new_AM_LDFLAGS=""
+        ;;
 esac
 AC_SUBST(new_AM_CFLAGS)
 AC_SUBST(new_AM_LDFLAGS)
Index: libs/js/nsprpub/configure.in
===================================================================
--- libs/js/nsprpub/configure.in	(revision 6445)
+++ libs/js/nsprpub/configure.in	(working copy)
@@ -1125,7 +1125,7 @@
     AC_DEFINE(FREEBSD)
     AC_DEFINE(HAVE_BSD_FLOCK)
     AC_DEFINE(HAVE_SOCKLEN_T)
-    CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
+    CFLAGS="$CFLAGS -ansi -Wall"
     MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
     if test "$MOZ_OBJFORMAT" = "elf"; then
         DLL_SUFFIX=so
@@ -1137,7 +1137,7 @@
     DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
     MDCPUCFG_H=_freebsd.cfg
     PR_MD_CSRCS=freebsd.c
-    ;;
+   ;;
 
 *-hpux*)
     AC_DEFINE(XP_UNIX)
Index: libs/js/configure.ac
===================================================================
--- libs/js/configure.ac	(revision 6445)
+++ libs/js/configure.ac	(working copy)
@@ -179,8 +179,10 @@
 if test ".$ac_cv_with_nspr" = ".yes"; then
     sinclude(nsprpub/config/nspr.m4)
     CPPFLAGS="$CPPFLAGS -DJS_THREADSAFE=1 -Insprpub/dist/include/nspr -Insprpub/pr/include"
-    LDFLAGS="$LDFLAGS -L$prefix/lib -L./nsprpub/dist/lib -lnspr4"
+    LDFLAGS="$LDFLAGS -L$prefix/lib -L./nsprpub/dist/lib"
+    LIBS="$LIBS -lnspr4"
     LIBPATH="LD_LIBRARY_PATH=./nsprpub/dist/lib DYLD_LIBRARY_PATH=./nsprpub/dist/lib" 
+    AC_CHECK_LIB(pthread, pthread_create, [CLI_LIBS="$CLI_LIBS -lpthread"])
 fi
 
 AC_DEFUN([AX_COMPILER_VENDOR],
Index: libs/codec/lpc10/configure.ac
===================================================================
--- libs/codec/lpc10/configure.ac	(revision 6445)
+++ libs/codec/lpc10/configure.ac	(working copy)
@@ -82,6 +82,18 @@
                         fi
                         DYNAMIC_LIB_EXTEN="so"
                 ;;
+                x86_64-*-freebsd*|amd64-*-freebsd*)
+                        SOLINK="-shared -Xlinker -x"
+                        new_AM_CFLAGS="-fPIC"
+                        new_AM_LDFLAGS=""
+                        DYNAMIC_LIB_EXTEN="so"
+                ;;
+                i*6-*-freebsd*)
+                        SOLINK="-shared -Xlinker -x"
+                        new_AM_CFLAGS="-fpic"
+                        new_AM_LDFLAGS=""
+                        DYNAMIC_LIB_EXTEN="so"
+                ;;
 esac
 #  Enable 64 bit build
 AC_ARG_ENABLE(64,
Index: libs/codec/g726/configure.in
===================================================================
--- libs/codec/g726/configure.in	(revision 6445)
+++ libs/codec/g726/configure.in	(working copy)
@@ -84,6 +84,18 @@
                         fi
                         DYNAMIC_LIB_EXTEN="so"
                 ;;
+                x86_64-*-freebsd*|amd64-*-freebsd*)
+                        SOLINK="-shared -Xlinker -x"
+                        new_AM_CFLAGS="-fPIC"
+                        new_AM_LDFLAGS=""
+                        DYNAMIC_LIB_EXTEN="so"
+                ;;
+                i*6-*-freebsd*)
+                        SOLINK="-shared -Xlinker -x"
+                        new_AM_CFLAGS="-fpic"
+                        new_AM_LDFLAGS=""
+                        DYNAMIC_LIB_EXTEN="so"
+                ;;
 esac
 #  Enable 64 bit build
 AC_ARG_ENABLE(64,
Index: libs/codec/ilbc/configure.in
===================================================================
--- libs/codec/ilbc/configure.in	(revision 6445)
+++ libs/codec/ilbc/configure.in	(working copy)
@@ -90,6 +90,20 @@
                         DYNAMIC_LIB_EXTEN="so"
                         IN_LINE=inline
                 ;;
+                x86_64-*-freebsd*|amd64-*-freebsd*)
+                        SOLINK="-shared -Xlinker -x"
+                        new_AM_CFLAGS="-fPIC"
+                        new_AM_LDFLAGS=""
+                        DYNAMIC_LIB_EXTEN="so"
+                        IN_LINE=inline
+                ;;
+                i*6-*-freebsd*)
+                        SOLINK="-shared -Xlinker -x"
+                        new_AM_CFLAGS="-fpic"
+                        new_AM_LDFLAGS=""
+                        DYNAMIC_LIB_EXTEN="so"
+                        IN_LINE=inline
+                ;;
 esac
 #  Enable 64 bit build
 AC_ARG_ENABLE(64,
Index: libs/codec/g7xx/configure.in
===================================================================
--- libs/codec/g7xx/configure.in	(revision 6445)
+++ libs/codec/g7xx/configure.in	(working copy)
@@ -87,6 +87,20 @@
                         DYNAMIC_LIB_EXTEN="so"
                         IN_LINE=inline
                 ;;
+                x86_64-*-freebsd*|amd64-*-freebsd*)
+                        SOLINK="-shared -Xlinker -x"
+                        new_AM_CFLAGS="-fPIC"
+                        new_AM_LDFLAGS=""
+                        DYNAMIC_LIB_EXTEN="so"
+                        IN_LINE=inline
+                ;;
+                i*6-*-freebsd*)
+                        SOLINK="-shared -Xlinker -x"
+                        new_AM_CFLAGS="-fpic"
+                        new_AM_LDFLAGS=""
+                        DYNAMIC_LIB_EXTEN="so"
+                        IN_LINE=inline
+                ;;
 esac
 
 #  Enable 64 bit build
