[omniORB] How to test for omniorb in configure.in

Lars von Wedel vonWedel@lfpt.rwth-aachen.de
Tue, 21 May 2002 10:34:01 +0200


This is a multi-part message in MIME format.
--------------39AAF6104486F12A0BF205E4
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


Hello,

this is the corba.m4 file we are using here in our systems. 
It's far less generic than autocorba that was posted here
some time ago (you'll find it in the archives). You will
have to modify/adapt it to your own stuff, I believe!

It works okay for us, your mileage may vary. I haven't looked
into omniORB 4 yet, probably there is already a .m4 script
which checks for an omniORB installation and establishes
required settings?

Regards,
Lars


Gustavo Madrigal wrote:
> 
> Hi,
> 
> Can anybody give some clues about how to check for libomniORB3,
> libomnithread, libtcpwrapGK in a configure.in script?
> 
> Thanks,
> 
> Gustavo
--------------39AAF6104486F12A0BF205E4
Content-Type: text/plain; charset=us-ascii;
 name="corba.m4"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="corba.m4"

# LPT_CORBA
#
# Checks for a CORBA implementation to be used
#
AC_DEFUN([LPT_CORBA],[
  AC_REQUIRE(AC_CANONICAL_TARGET)
  AC_ARG_WITH(corba,
	AC_HELP_STRING([--with-corba=corba_dir],
			[enable use of CORBA and specify installation directory (/usr/local/ by default) ]),
	[use_corba=$withval],
	[use_corba=$prefix])  dnl Defaults to ON (if found)

  AC_LANG_PUSH(C++)
  AH_TEMPLATE([HAVE_CORBA],
  	      [Defined, if a CORBA runtime system is available at compilation time.] )

  if [test "x$use_corba" != "xno"]
  then
	if [test "x$use_corba" != "xyes"]
	then
	  CORBA_DIR="$use_corba"
	else
	  dnl The default value if --with-corba=yes 
	  CORBA_DIR="/usr/local/"
	fi

	CORBA_LIBDIR="$CORBA_DIR/lib"
	CORBA_INCDIR="$CORBA_DIR/include"
	CORBA_BINDIR="$CORBA_DIR/bin"
	CORBA_IDLDIR="$CORBA_DIR/idl"

	AC_MSG_CHECKING([IDL compiler to be used])
	if [test -x "$CORBA_BINDIR/omniidl"]
	then
		IDL="$CORBA_BINDIR/omniidl"
		IDLVER=`$IDL -V`
		IDL_FLAGS="-bcxx -bpython"

		AC_MSG_RESULT([$IDLVER])

		dnl check CORBA libraries
		AC_MSG_CHECKING([Checking CORBA libraries])
	   
		TMP_LIBS="$LIBS"
		TMP_CXXFLAGS="$CXXFLAGS"
		TMP_LDFLAGS="$LDFLAGS"

		case "$target" in
		i*86-*-linux-gnu)
                  CORBA_CXXFLAGS="-D__x86__ -D__linux__ -D__OSVERSION__=2"
                  CORBA_LDFLAGS="-L$CORBA_LIBDIR"
		  CORBA_LIBS="-lomniORB3 -lomniDynamic3 -ltcpwrapGK -lomnithread -lpthread";;
		*solaris*)
		  CORBA_CXXFLAGS="-D__sparc__ -D__sunos__ -D__OSVERSION__=5"
		  CORBA_LDFLAGS="-L$CORBA_LIBDIR"
		  CORBA_LIBS="-lomniORB3 -lomniDynamic3 -ltcpwrapGK -lomnithread -lpthread -lsocket -lposix4";;
		i*86-pc-cygwin)
		  CORBA_CXXFLAGS="-D__x86__ -D__NT__ -D__WIN32__ -D__OSVERSION__=4"
		  CORBA_LDFLAGS="-L$CORBA_LIBDIR -L$CORBA_BINDIR"
		  CORBA_LIBS="-lomniORB302_rt -lomniDynamic302_rt -lomnithread2_rt";;
		*)
		  AC_MSG_ERROR([Sorry, CORBA on platform $target currently not supported]) ;;
		esac
	
	        dnl set compile/link flags temporarily
        	LIBS="$LIBS $CORBA_LIBS"
		CXXFLAGS="-I$CORBA_INCDIR $CORBA_CXXFLAGS"
		LDFLAGS="$LDFLAGS $CORBA_LDFLAGS"

		AC_TRY_LINK([#include<omniORB3/CORBA.h>], 
		    	    [int argc; char **argv; CORBA::ORB_ptr orb = CORBA::ORB_init(argc, argv)],
			    [AC_MSG_RESULT(ok)
			     AC_DEFINE(HAVE_CORBA, 1)],
			    [AC_MSG_RESULT(error)
			     AC_DEFINE(HAVE_CORBA, 0)
			     AC_MSG_ERROR(cannot proceed without CORBA libraries.)])

		dnl reset compile/link flags
		LIBS="$TMP_LIBS"
		CXXFLAGS="$TMP_CXXFLAGS"
		LDFLAGS="$TMP_LDFLAGS"

		AC_MSG_NOTICE([Compiling stubs/skeletons with $CORBA_CXXFLAGS])
	else
		AC_DEFINE(HAVE_CORBA, 0)
		AC_MSG_RESULT([none found])
		AC_MSG_ERROR([cannot proceed without IDL compiler])
	fi
  else
	AC_DEFINE(HAVE_CORBA, 0)
  fi

  AC_SUBST(CORBA_LIBDIR)
  AC_SUBST(CORBA_LIBS)
  AC_SUBST(CORBA_LDFLAGS)	

  AC_SUBST(CORBA_INCDIR)
  AC_SUBST(CORBA_CXXFLAGS)

  AC_SUBST(CORBA_BINDIR)

  AC_SUBST(IDL)
  AC_SUBST(IDL_FLAGS)
  AC_SUBST(CORBA_IDLDIR)

  AC_LANG_POP
])# LPT_CORBA

--------------39AAF6104486F12A0BF205E4
Content-Type: text/x-vcard; charset=us-ascii;
 name="vonWedel.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Lars von Wedel
Content-Disposition: attachment;
 filename="vonWedel.vcf"

begin:vcard 
n:von Wedel;Lars
tel;fax:++49 241 8092326
tel;work:++49 241 8095240
x-mozilla-html:FALSE
url:http://www.lfpt.rwth-aachen.de
org:RWTH Aachen;Lehrstuhl fuer Prozesstechnik
adr:;;Turmstrasse 46;52064 Aachen;;;Germany
version:2.1
email;internet:vonWedel@lfpt.rwth-aachen.de
fn:Lars von Wedel
end:vcard

--------------39AAF6104486F12A0BF205E4--