diff --git a/build/ltconfig b/build/ltconfig
index 729792ddb5ad02d292a8e8c4f45a34a9513f5cf3..e4ecdbd7ecaac41b5e049a96fd97e617795a2623 100755
--- a/build/ltconfig
+++ b/build/ltconfig
@@ -1134,7 +1134,8 @@ freebsd3*)
   version_type=freebsd
   library_names_spec='${libname}${release}.so.$versuffix $libname.so'
   if [ -x `/usr/bin/objformat` ]; then
-  finish_cmds='PATH="$PATH:/sbin" OBJFORMAT=`objformat` ldconfig -m $libdir'
+  OBJFORMAT=`/usr/bin/objformat`
+  finish_cmds='PATH="$PATH:/sbin" OBJFORMAT="$OBJFORMAT" ldconfig -m $libdir'
   else
   finish_cmds='PATH="$PATH:/sbin" ldconfig -m $libdir'
   fi
diff --git a/build/ltmain.sh b/build/ltmain.sh
index ffacb3dfd6193514d1094d6383928065c65ec3c2..b66dcc0d9a559e5196b20019c17fcc3333348273 100755
--- a/build/ltmain.sh
+++ b/build/ltmain.sh
@@ -970,10 +970,17 @@ if test -z "$show_help"; then
       freebsd)
         version_vars="$version_vars major versuffix"
         major="$current"
-	if [ $PORTOBJFORMAT = elf ]; then
-        versuffix="$current";
+		
+	if [ X"$OBJFORMAT" = X ]; then
+		if [ -x /usr/bin/objformat ]; then
+			OBJECTFORMAT=`objformat`
+		fi
+	fi
+		
+	if [ "$OBJFORMAT" = elf ]; then
+		versuffix="$current";
 	else
-        versuffix="$current.$revision";
+		versuffix="$current.$revision";
 	fi
         ;;