--- config/cf/FreeBSD.cf.orig	Mon Sep 21 18:23:34 1998
+++ config/cf/FreeBSD.cf	Tue Sep 22 17:16:30 1998
@@ -1,8 +1,14 @@
 XCOMM platform:  $TOG: FreeBSD.cf /main/18 1997/06/12 07:40:35 kaleb $
 XCOMM platform:  $XFree86: xc/config/cf/FreeBSD.cf,v 3.58.2.12 1998/04/29 04:18:26 dawes Exp $
 
+#if UseElfFormat
+# define OSBinaryFormat		[ELF]
+#else
+# define OSBinaryFormat		/**/
+#endif
+
 #ifndef OSName
-#define OSName			DefaultOSName
+#define OSName			DefaultOSName OSBinaryFormat
 #endif
 #ifndef OSVendor
 #define OSVendor		/**/
@@ -116,9 +122,21 @@
  */
 #if OSMajorVersion > 2 || (OsMajorVersion == 2 && OSMinorVersion >= 2)
 #ifndef ExtraLoadFlags
+#if UseElfFormat
+#define ExtraLoadFlags		-Wl,-rpath,$(USRLIBDIRPATH)
+#else
 #define ExtraLoadFlags		-Wl,-R,$(USRLIBDIRPATH)
 #endif
 #endif
+#endif
+
+#ifndef SharedLibraryLoadFlags
+#if UseElfFormat
+#define SharedLibraryLoadFlags	-shared -rpath $(USRLIBDIRPATH)
+#else
+#define SharedLibraryLoadFlags	-Bshareable -R $(USRLIBDIRPATH)
+#endif
+#endif
 
 #ifndef GnuMallocLibrary
 #define GnuMallocLibrary	-lgnumalloc
@@ -221,11 +239,18 @@
 #undef  InstallCmd
 #define InstallCmd		/usr/bin/install
 
+#if UseElfFormat
+# define AsmElfDefines		-D__ELF__
+#else
+# define AsmElfDefines		/**/
+#endif
+
 #if GccUsesGas
 # define GccGasOption 		-DGCCUSESGAS
-# define AsmDefines		-DUSE_GAS
+# define AsmDefines		-DUSE_GAS AsmElfDefines
 #else
 # define GccGasOption /**/
+# define AsmDefines		AsmElfDefines
 #endif
 
 #define ServerExtraDefines GccGasOption XFree86ServerDefines
@@ -360,6 +385,18 @@
 
 #ifndef StaticLibrary
 #define StaticLibrary(libpath,libname) -Wl,-Bstatic Concat(-L,libpath) Concat(-l,libname) -Wl,-Bdynamic
+#endif
+
+#if UseElfFormat
+#define DlLibrary		-rdynamic
+#else
+#define DlLibrary		/**/
+#endif
+
+#if BuildDynamicLoading
+#define ServerExtraSysLibs	DlLibrary
+#else
+#define ServerExtraSysLibs	/**/
 #endif
 
 #include <bsdLib.rules>
