This information is provided by Andre Fornacon.
If you have questions regarding omniORB on FreeBSD send them to afo@zlug.org.
[Last modified: 1999/06/13 13:10:39 by afo@xxo.zlug.org]

I compiled omniORB 2.7.1 on a FreeBSD 3.2 (RELEASE) system using
the pthreads from libc , gnu make and egcs 1.1.2.

* the config file for FreeBSD builds :

- omniORB 2.7.1 shared and static libraries
- omniORB utils linked static against the omniORB libs
    [ not enabled by default, edit x86_freebsd_3.2.mk to do so. - SLL ]

* to build applications with omniORB on FreeBSD use
	CXXFLAGS = -D_REENTRANT -D_THREAD_SAFE
	CXXFLAGS += -D__x86__ -D__freebsd__ -D__OSVERSION__=3
	CXXFLAGS += -I<YOUR_OMNIORB_INSTALL_DIRECTORY>/include

	dynamic linked binaries:
	LDFLAGS = -L<YOUR_OMNIORB_DIRECTORY>/lib/x86_freebsd_3.2
	LDFLAGS	+= -lomniORB2 -lomniDynamic2 -ltcpwrapGK -lomnithread
	LDFLAGS += -Wl,-rpath,<YOUR_OMNIORB_DIRECTORY>/lib/x86_freebsd_3.2

	static linked binaries:
	LDFLAGS = -L<YOUR_OMNIORB_INSTALL_DIRECTORY>/lib/x86_freebsd_3.2
	LDFLAGS	+= -Wl,-Bstatic 
	LDFLAGS	+= -lomniORB2 -lomniDynamic2 -ltcpwrapGK -lomnithread
	LDFLAGS	+= -Wl,-Bdynamic

	!!! link with the -lpthread flag !!!

During the port i run into the following problems:

* fcntl.h doesn't define O_SYNC, so i used O_FSYNC instead
	omniORB-2.7.1/src/appl/omniNames/log.cc
	omniORB-2.7.1/src/appl/omniNames/omniNames.cc

* need to include unistd.h and sys/wait.h on freebsd in
	omniORB-2.7.1/src/tool/omniidl2/driver/drv_fork.cc
	omniORB-2.7.1/src/tool/omniidl2/driver/drv_preproc.cc


* stock egcs 1.1.2 doesn't support the FreeBSD specific -pthread linking flag
	als the supplied gcc (2.7.2) does.
	just using -lc_r results into binaries linked against libc_r and libc.
	'cause libc_r comes first it may work but isn't a good idea IMHO.

	so i modified the egcs-1.1.2/gcc/config/i386/freebsd-elf.h file 
	the diff is attached below. 
	apply it and rebuild egcs.	
	[i rename the compiler drivers from gcc and g++ to egcs and egcs++
	just to make sure i don't use the supplied system gcc/g++]


--- /src/egcs-1.1.2/gcc/config/i386/freebsd-elf.h.orig	Wed Mar 17 20:39:58 1999
------------ begin freebsd 3.2 egcs pthread patch ----------------
+++ /src/egcs-1.1.2/gcc/config/i386/freebsd-elf.h	Sat Jun 12 14:19:19 1999
@@ -145,26 +145,17 @@
 #define WCHAR_TYPE_SIZE BITS_PER_WORD
     
 #undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Di386 -Dunix -D__ELF__ -D__FreeBSD__ -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)"
+#define CPP_PREDEFINES "-Di386 -Dunix -D__ELF__ -D__FreeBSD__=3 -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)"
 
 #undef CPP_SPEC
 #define CPP_SPEC "%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}"
 
 #undef	LIB_SPEC
-#if 1
 /* We no longer link with libc_p.a or libg.a by default. If you
  * want to profile or debug the C library, please add
  * -lc_p or -ggdb to LDFLAGS at the link time, respectively.
  */
-#define LIB_SPEC \
-  "%{!shared: %{mieee-fp:-lieee} %{p:-lgmon} %{pg:-lgmon} \
-     %{!ggdb:-lc} %{ggdb:-lg}}"
-#else
-#define LIB_SPEC \
-  "%{!shared: \
-     %{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \
-       %{!p:%{!pg:%{!g*:-lc} %{g*:-lg}}}}"
-#endif
+#define LIB_SPEC "%{!shared:%{!pg:%{!pthread:%{!kthread:-lc}%{kthread:-lpthread -lc}}%{pthread:-lc_r}}%{pg:%{!pthread:%{!kthread:-lc_p}%{kthread:-lpthread_p -lc_p}}%{pthread:-lc_r_p}}}"
 
 /* Provide a LINK_SPEC appropriate for FreeBSD.  Here we provide support
    for the special GCC options -static and -shared, which allow us to
------------ end freebsd 3.2 egcs pthread patch ----------------


