Index: libs/iax/configure.in
===================================================================
--- libs/iax/configure.in	(revision 6468)
+++ libs/iax/configure.in	(working copy)
@@ -39,11 +39,13 @@
 
 case "$host" in
                 *-solaris2*)
-                        if test "x${ax_cv_c_compiler_vendor}"  =  "xsun" ; then                                SOLINK="-Bdynamic -dy -G"
+                        if test "x${ax_cv_c_compiler_vendor}"  =  "xsun" ; then
+                                SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                                 IN_LINE=""
-                        elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then                                SOLINK="-Bdynamic -dy -G"
+                        elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
+                                SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-fPIC"
                                 new_AM_LDFLAGS=""
                                 IN_LINE=inline
@@ -63,7 +65,7 @@
                         if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
                                 SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                         elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
                                 SOLINK="-shared -Xlinker -x"
                                 new_AM_CFLAGS="-fPIC"
@@ -76,7 +78,7 @@
                         if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
                                 SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                         elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
                                 SOLINK="-shared -Xlinker -x"
                                 new_AM_CFLAGS="-fpic"
@@ -89,7 +91,7 @@
                         if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
                                 SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                         elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
                                 SOLINK="-shared -Xlinker -x"
                                 new_AM_CFLAGS="-fPIC"
Index: libs/libdingaling/configure.in
===================================================================
--- libs/libdingaling/configure.in	(revision 6468)
+++ libs/libdingaling/configure.in	(working copy)
@@ -42,12 +42,14 @@
 
 case "$host" in
                 *-solaris2*)
-                        if test "x${ax_cv_c_compiler_vendor}"  =  "xsun" ; then                                SOLINK="-Bdynamic -dy -G"
+                        if test "x${ax_cv_c_compiler_vendor}"  =  "xsun" ; then
+                                SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                                 FUNC_DEF=__func__
                                 IN_LINE=""
-                        elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then                                SOLINK="-Bdynamic -dy -G"
+                        elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
+                                SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-fPIC"
                                 new_AM_LDFLAGS=""
                                 IN_LINE=inline
@@ -67,7 +69,7 @@
                         if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
                                 SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                                 FUNC_DEF=__func__
                         elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
                                 SOLINK="-shared -Xlinker -x"
@@ -81,7 +83,7 @@
                         if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
                                 SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                                 FUNC_DEF=__func__
                         elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
                                 SOLINK="-shared -Xlinker -x"
@@ -95,7 +97,7 @@
                         if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
                                 SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                                 FUNC_DEF=__func__
                         elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
                                 SOLINK="-shared -Xlinker -x"
Index: libs/speex/speex.m4
===================================================================
--- libs/speex/speex.m4	(revision 6468)
+++ libs/speex/speex.m4	(working copy)
@@ -21,7 +21,7 @@
   elif test "x$speex_prefix" != "x" ; then
     SPEEX_LIBS="-L$speex_prefix/lib"
   elif test "x$prefix" != "xNONE" ; then
-    SPEEX_LIBS="-L$prefix/lib"
+    SPEEX_LIBS=""
   fi
 
   SPEEX_LIBS="$SPEEX_LIBS -lspeex"
Index: libs/speex/acinclude.m4
===================================================================
--- libs/speex/acinclude.m4	(revision 6468)
+++ libs/speex/acinclude.m4	(working copy)
@@ -19,7 +19,7 @@
   elif test "x$ogg_prefix" != "x" ; then
     OGG_LIBS="-L$ogg_prefix/lib"
   elif test "x$prefix" != "xNONE" ; then
-    OGG_LIBS="-L$prefix/lib"
+    OGG_LIBS=""
   fi
 
   OGG_LIBS="$OGG_LIBS -logg"
Index: libs/srtp/configure.in
===================================================================
--- libs/srtp/configure.in	(revision 6468)
+++ libs/srtp/configure.in	(working copy)
@@ -40,7 +40,7 @@
                         if test "x${ax_cv_c_compiler_vendor}"  = "xsun" ; then
                                 SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                                 FUNC_DEF=__func__
                                 IN_LINE=""
                         elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
@@ -63,7 +63,7 @@
                         if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
                                 SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                                 FUNC_DEF=__func__
                         elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
                                SOLINK="-shared -Xlinker -x"
@@ -76,7 +76,7 @@
                         if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
                                 SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                                 FUNC_DEF=__func__
                         elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
                                 SOLINK="-shared -Xlinker -x"
@@ -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 6468)
+++ libs/libresample/configure.in	(working copy)
@@ -47,12 +47,14 @@
 
 case "$host" in
                 *-solaris2*)
-                        if test "x${ax_cv_c_compiler_vendor}"  =  "xsun" ; then                                SOLINK="-Bdynamic -dy -G"
+                        if test "x${ax_cv_c_compiler_vendor}"  =  "xsun" ; then
+                                SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                                 FUNC_DEF=__func__
                                 IN_LINE=""
-                        elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then                                SOLINK="-Bdynamic -dy -G"
+                        elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
+                                SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-fPIC"
                                 new_AM_LDFLAGS=""
                                 IN_LINE=inline
@@ -71,7 +73,7 @@
                         if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
                                 SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                                 FUNC_DEF=__func__
                         elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
                                 SOLINK="-shared -Xlinker -x"
@@ -84,7 +86,7 @@
                         if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
                                 SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                                 FUNC_DEF=__func__
                         elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
                                 SOLINK="-shared -Xlinker -x"
@@ -93,6 +95,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 6468)
+++ libs/libteletone/configure.in	(working copy)
@@ -39,7 +39,7 @@
         *-solaris2*)
                 if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
                         new_AM_CFLAGS="-KPIC -DPIC"
-                        new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                        new_AM_LDFLAGS="-R${prefix}/lib"
                 fi
         ;;
         *-darwin*)
@@ -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 6468)
+++ 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 6468)
+++ 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./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 6468)
+++ libs/codec/lpc10/configure.ac	(working copy)
@@ -40,10 +40,12 @@
 
 case "$host" in
                 *-solaris2*)
-                        if test "x${ax_cv_c_compiler_vendor}"  =  "xsun" ; then                                SOLINK="-Bdynamic -dy -G"
+                        if test "x${ax_cv_c_compiler_vendor}"  =  "xsun" ; then
+                                SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
-                        elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then                                SOLINK="-Bdynamic -dy -G"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
+                        elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
+                                SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-fPIC"
                                 new_AM_LDFLAGS=""
                                 IN_LINE=inline
@@ -62,7 +64,7 @@
                         if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
                                 SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                         elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
                                 SOLINK="-shared -Xlinker -x"
                                 new_AM_CFLAGS="-fPIC"
@@ -74,7 +76,7 @@
                         if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
                                 SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                         elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
                                 SOLINK="-shared -Xlinker -x"
                                 new_AM_CFLAGS="-fpic"
@@ -82,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/g726/configure.in
===================================================================
--- libs/codec/g726/configure.in	(revision 6468)
+++ libs/codec/g726/configure.in	(working copy)
@@ -44,7 +44,7 @@
                         if test "x${ax_cv_c_compiler_vendor}"  =  "xsun" ; then
                                 SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                         elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
                                 SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-fPIC"
@@ -64,7 +64,7 @@
                         if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
                                 SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                         elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
                                 SOLINK="-shared -Xlinker -x"
                                 new_AM_CFLAGS="-fPIC"
@@ -76,7 +76,7 @@
                         if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
                                 SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                         elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
                                 SOLINK="-shared -Xlinker -x"
                                 new_AM_CFLAGS="-fpic"
@@ -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 6468)
+++ libs/codec/ilbc/configure.in	(working copy)
@@ -41,12 +41,14 @@
 
 case "$host" in
                 *-solaris2*)
-                        if test "x${ax_cv_c_compiler_vendor}"  =  "xsun" ; then                                SOLINK="-Bdynamic -dy -G"
+                        if test "x${ax_cv_c_compiler_vendor}"  =  "xsun" ; then
+                                SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                                 FUNC_DEF=__func__
                                 IN_LINE=""
-                        elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then                                SOLINK="-Bdynamic -dy -G"
+                        elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
+                                SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-fPIC"
                                 new_AM_LDFLAGS=""
                                 IN_LINE=inline
@@ -66,7 +68,7 @@
                         if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
                                 SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                                 FUNC_DEF=__func__
                         elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
                                 SOLINK="-shared -Xlinker -x"
@@ -80,7 +82,7 @@
                         if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
                                 SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                                 FUNC_DEF=__func__
                         elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
                                 SOLINK="-shared -Xlinker -x"
@@ -90,6 +92,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 6468)
+++ libs/codec/g7xx/configure.in	(working copy)
@@ -38,12 +38,14 @@
 
 case "$host" in
                 *-solaris2*)
-                        if test "x${ax_cv_c_compiler_vendor}"  =  "xsun" ; then                                SOLINK="-Bdynamic -dy -G"
+                        if test "x${ax_cv_c_compiler_vendor}"  =  "xsun" ; then
+                                SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                                 FUNC_DEF=__func__
                                 IN_LINE=""
-                        elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then                                SOLINK="-Bdynamic -dy -G"
+                        elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
+                                SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-fPIC"
                                 new_AM_LDFLAGS=""
                                 IN_LINE=inline
@@ -63,7 +65,7 @@
                         if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
                                 SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                                 FUNC_DEF=__func__
                         elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
                                 SOLINK="-shared -Xlinker -x"
@@ -77,7 +79,7 @@
                         if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
                                 SOLINK="-Bdynamic -dy -G"
                                 new_AM_CFLAGS="-KPIC -DPIC"
-                                new_AM_LDFLAGS="-L${prefix}/lib -R${prefix}/lib"
+                                new_AM_LDFLAGS="-R${prefix}/lib"
                                 FUNC_DEF=__func__
                         elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
                                 SOLINK="-shared -Xlinker -x"
@@ -87,6 +89,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
