AC_DEFUN([AI_CHECK_VISIBROKER], [ AC_LANG_PUSH(C++) AC_ARG_VAR([IDLCPPFLAGS], [additional -I and -D IDL compiler flags]) AC_ARG_WITH( [visibroker-prefix], AS_HELP_STRING(--with-visibroker-prefix=DIR,search for VisiBroker in DIR [[[/opt/Borland/BDP]]]), [ VISIBROKER_PREFIX="${withval}" ], [ VISIBROKER_PREFIX="" ]) checkVisiBrokerPrefix() { VISIBROKER_PREFIX="${1}" VISIBROKER_PREFIX=`echo ${VISIBROKER_PREFIX} | sed 's|[[\\/]]$||'` if test ! -f "${VISIBROKER_PREFIX}/include/corba.h" && test -d "${VISIBROKER_PREFIX}/include/stubs" then VISIBROKER_PREFIX="" fi } checkVisiBrokerAIXHPUX() { for VISIBROKER_ARCH_BITS in "64" "32" do for VISIBROKER_STL_BUILD in "yes" "no" do VISIBROKER_save_ORB_CPPFLAGS="${ORB_CPPFLAGS}" if test "x${VISIBROKER_ARCH_BITS}" = "x64" then VISIBROKER_LIB_SUFFIX1="64" else VISIBROKER_LIB_SUFFIX1="" fi if test "x${VISIBROKER_STL_BUILD}" = "xyes" then VISIBROKER_LIB_SUFFIX1="${VISIBROKER_LIB_SUFFIX1}_p" VISIBROKER_LIB_SUFFIX2="r" VISIBROKER_LMGR_LIB="-llmgr" ORB_CPPFLAGS="${ORB_CPPFLAGS} -D_VIS_STD" CPPFLAGS="${AI_CHECK_VISIBROKER_save_CPPFLAGS} ${ORB_CPPFLAGS}" else VISIBROKER_LIB_SUFFIX2="_r" VISIBROKER_LMGR_LIB="-llmgr_cls" fi VISIBROKER_LIB_SUFFIX="${VISIBROKER_LIB_SUFFIX1}${VISIBROKER_LIB_SUFFIX2}" for VISIBROKER_LDADD in ${VISIBROKER_LMGR_LIB} "" do LIBS="-lvport${VISIBROKER_LIB_SUFFIX}" LIBS="${LIBS} -lvdlog${VISIBROKER_LIB_SUFFIX}" LIBS="${LIBS} -lorb${VISIBROKER_LIB_SUFFIX}" LIBS="${LIBS} ${VISIBROKER_LDADD}" LIBS="${LIBS} ${ORB_LIBS}" LIBS="${LIBS} ${EXT_ORB_LIBS}" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [ #include ], [ int argc; CORBA::ORB_init(argc, 0); ])], [ ORB_LIBS="${VISIBROKER_LDADD} ${ORB_LIBS}" ORB_LIBS="-lorb${VISIBROKER_LIB_SUFFIX} ${ORB_LIBS}" ORB_LIBS="-lvdlog${VISIBROKER_LIB_SUFFIX} ${ORB_LIBS}" ORB_LIBS="-lvport${VISIBROKER_LIB_SUFFIX} ${ORB_LIBS}" return ]) done ORB_CPPFLAGS="${VISIBROKER_save_ORB_CPPFLAGS}" CPPFLAGS="${AI_CHECK_VISIBROKER_save_CPPFLAGS} ${ORB_CPPFLAGS}" done done ORB_LIBS="" } checkVisiBrokerLinuxSolaris() { for VISIBROKER_ARCH_BITS in "64" "32" do if test "x${VISIBROKER_ARCH_BITS}" = "x64" then VISIBROKER_LIB_SUFFIX1="64" VISIBROKER_LIB_SUFFIX2="_r" else VISIBROKER_LIB_SUFFIX1="" VISIBROKER_LIB_SUFFIX2="_r" fi VISIBROKER_LIB_SUFFIX="${VISIBROKER_LIB_SUFFIX1}${VISIBROKER_LIB_SUFFIX2}" for VISIBROKER_LDADD in "-llmgr" "" do LIBS="-lvport${VISIBROKER_LIB_SUFFIX}" LIBS="${LIBS} -lvdlog${VISIBROKER_LIB_SUFFIX}" LIBS="${LIBS} -lorb${VISIBROKER_LIB_SUFFIX}" LIBS="${LIBS} ${VISIBROKER_LDADD}" LIBS="${LIBS} ${ORB_LIBS}" LIBS="${LIBS} ${EXT_ORB_LIBS}" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [ #include ], [ int argc; CORBA::ORB_init(argc, 0); ])], [ ORB_LIBS="${VISIBROKER_LDADD} ${ORB_LIBS}" ORB_LIBS="-lorb${VISIBROKER_LIB_SUFFIX} ${ORB_LIBS}" ORB_LIBS="-lvdlog${VISIBROKER_LIB_SUFFIX} ${ORB_LIBS}" ORB_LIBS="-lvport${VISIBROKER_LIB_SUFFIX} ${ORB_LIBS}" return ]) done done ORB_LIBS="" } findVisiBroker() { VISIBROKER="no" ORB_DEFINES="" if test "x${AI_DLOPEN}" = "x" then AI_CHECK_DLOPEN fi if test "x${acx_pthread_ok}" = "x" then ACX_PTHREAD fi if test "x${AI_SOCKET}" = "x" then AI_CHECK_SOCKET fi AC_MSG_NOTICE([checking for VisiBroker...]) if test "x${acx_pthread_ok}" != "xyes" || test "x${AI_SOCKET}" != "xyes" || test "x${AI_DLOPEN}" != "xyes" then return fi if test "x${VISIBROKER_PREFIX}" = "x" then for VISIBROKER_PREFIX in "/opt/Borland/BDP" "/usr/local" "/usr" "/usr/pkg" "/opt/sfw" "/usr/sfw" "/opt/local" do checkVisiBrokerPrefix "${VISIBROKER_PREFIX}" if test "x${VISIBROKER_PREFIX}" != "x" then break fi done else checkVisiBrokerPrefix "${VISIBROKER_PREFIX}" fi if test "x${VISIBROKER_PREFIX}" = "x" then return fi if test ! -f "${VISIBROKER_PREFIX}/bin/idl2cpp" then return fi if test ! -d "${VISIBROKER_PREFIX}/include" then return fi ORB_BIN_DIRS="${VISIBROKER_PREFIX}/bin" if test -d "${VISIBROKER_PREFIX}/jdk" then for d in "${VISIBROKER_PREFIX}/jdk/"* do if test -f "${d}/bin/java" then ORB_BIN_DIRS="${ORB_BIN_DIRS} ${d}/bin" break fi if test -f "${d}/jre/bin/java" then ORB_BIN_DIRS="${ORB_BIN_DIRS} ${d}/jre/bin" break fi done fi ORB_LIB_DIRS="${VISIBROKER_PREFIX}/lib" ORB_INC_DIRS="${VISIBROKER_PREFIX}/include" if test -d "${VISIBROKER_PREFIX}/include/stubs" then ORB_INC_DIRS="${ORB_INC_DIRS} ${VISIBROKER_PREFIX}/include/stubs" fi if test -d "${VISIBROKER_PREFIX}/include/costm" then ORB_INC_DIRS="${ORB_INC_DIRS} ${VISIBROKER_PREFIX}/include/costm" fi if test -d "${VISIBROKER_PREFIX}/include/visinotify" then ORB_INC_DIRS="${ORB_INC_DIRS} ${VISIBROKER_PREFIX}/include/visinotify" fi if test -d "${VISIBROKER_PREFIX}/include/telcolog" then ORB_INC_DIRS="${ORB_INC_DIRS} ${VISIBROKER_PREFIX}/include/telcolog" fi ORB_COSS_IDL_DIRS="${VISIBROKER_PREFIX}/idl" ORB_CFLAGS="${PTHREAD_CFLAGS}" ORB_CXXFLAGS="${PTHREAD_CFLAGS}" ORB_LIBS="" EXT_ORB_LIBS="" _AI_LIST_PREPEND_WO_DUPLICATES([${EXT_ORB_LIBS}], [${AI_DLOPEN_LIBS}], EXT_ORB_LIBS) _AI_LIST_PREPEND_WO_DUPLICATES([${EXT_ORB_LIBS}], [${PTHREAD_LIBS}], EXT_ORB_LIBS) _AI_LIST_PREPEND_WO_DUPLICATES([${EXT_ORB_LIBS}], [${AI_SOCKET_LIBS}], EXT_ORB_LIBS) _AI_LIST_ADD_PREFIX_AND_SUFFIX([${ORB_INC_DIRS}], [-I], [ ], ORB_CPPFLAGS) _AI_LIST_ADD_PREFIX_AND_SUFFIX([${ORB_LIB_DIRS}], [-L], [ ], ORB_LDFLAGS) AI_CHECK_VISIBROKER_save_CXXFLAGS="${CXXFLAGS}" AI_CHECK_VISIBROKER_save_CPPFLAGS="${CPPFLAGS}" AI_CHECK_VISIBROKER_save_LDFLAGS="${LDFLAGS}" AI_CHECK_VISIBROKER_save_LIBS="${LIBS}" CXXFLAGS="${CXXFLAGS} ${ORB_CXXFLAGS}" CPPFLAGS="${CPPFLAGS} ${ORB_CPPFLAGS}" LDFLAGS="${LDFLAGS} ${ORB_LDFLAGS}" # Linux and Solaris don't have Classical vs. STL builds. # They have only STL builds, but the naming of the libraries # is equivalent to the Classical builds in AIX and HPUX # (i.e., no "_p" suffix in the library names). # # The lmgr library's suffix is totally inconsistent with the former inconsistency :-) # Under AIX and HPUX, it is "_cls" (as opposed to none) in Classical build, # and none (as opposed to "_p") i STL builds. # Linux and Solaris have only a suffixless lmgr. # # If the host OS cannot be determined to be a VisiBroker supported one, # then the code bellow first tries detection as if we are under AIX or HPUX, # and then Linux or Solaris. This order is significant, because # Linux and Solaris detection would succeed under AIX and HPUX, but # as a Classical build, and we prefer STL always. # # The mandatory libraries seem to have only multithreaded versions # ("_r" suffix), and the lmgr library has only # a singlethreaded version. We will check these only. # The COSS libraries seem to have either a multithreaded or a singlethreaded # version, so we will check both cases for them. AC_MSG_CHECKING([for VisiBroker's mandatory libraries]) case "x${host_os}" in xlinux*|xsolaris*|xsunos*) checkVisiBrokerLinuxSolaris ;; xaix*|xhpux*) checkVisiBrokerAIXHPUX ;; *) checkVisiBrokerAIXHPUX if test "x${ORB_LIBS}" = "x" then checkVisiBrokerLinuxSolaris fi ;; esac if test "x${ORB_LIBS}" = "x" then AC_MSG_RESULT([no]) CXXFLAGS="${AI_CHECK_VISIBROKER_save_CXXFLAGS}" CPPFLAGS="${AI_CHECK_VISIBROKER_save_CPPFLAGS}" LDFLAGS="${AI_CHECK_VISIBROKER_save_LDFLAGS}" LIBS="${AI_CHECK_VISIBROKER_save_LIBS}" return fi AC_MSG_RESULT([yes]) # For all the optional libraries, first check for a multithreaded version. AC_MSG_CHECKING([for VisiBroker's cosev library]) LIBS="-lcosev${VISIBROKER_LIB_SUFFIX} ${ORB_LIBS} ${EXT_ORB_LIBS}" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [ #include #include ], [ CORBA::Object_ptr t = CORBA::Object::_nil(); CosEventComm::PushConsumer::_narrow(t); ])], [ ORB_LIBS="-lcosev${VISIBROKER_LIB_SUFFIX} ${ORB_LIBS}" AC_DEFINE([HAVE_LIBcosev], [1], [Define if VisiBroker's cosev library is detected]) HAVE_LIBcosev="yes" ], [ LIBS="-lcosev${VISIBROKER_LIB_SUFFIX1} ${ORB_LIBS} ${EXT_ORB_LIBS}" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [ #include #include ], [ CORBA::Object_ptr t = CORBA::Object::_nil(); CosEventComm::PushConsumer::_narrow(t); ])], [ ORB_LIBS="-lcosev${VISIBROKER_LIB_SUFFIX1} ${ORB_LIBS}" AC_DEFINE([HAVE_LIBcosev], [1], [Define if VisiBroker's cosev library is detected]) HAVE_LIBcosev="yes" ], [ HAVE_LIBcosev="no" ]) ]) AC_MSG_RESULT([$HAVE_LIBcosev]) AC_MSG_CHECKING([for VisiBroker's cosnm library]) LIBS="-lcosnm${VISIBROKER_LIB_SUFFIX} ${ORB_LIBS} ${EXT_ORB_LIBS}" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [ #include #include ], [ CORBA::Object_ptr t = CORBA::Object::_nil(); CosNaming::NamingContext::_narrow(t); ])], [ ORB_LIBS="-lcosnm${VISIBROKER_LIB_SUFFIX} ${ORB_LIBS}" AC_DEFINE([HAVE_LIBcosnm], [1], [Define if VisiBroker's cosnm library is detected]) HAVE_LIBcosnm="yes" ], [ LIBS="-lcosnm${VISIBROKER_LIB_SUFFIX1} ${ORB_LIBS} ${EXT_ORB_LIBS}" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [ #include #include ], [ CORBA::Object_ptr t = CORBA::Object::_nil(); CosNaming::NamingContext::_narrow(t); ])], [ ORB_LIBS="-lcosnm${VISIBROKER_LIB_SUFFIX1} ${ORB_LIBS}" AC_DEFINE([HAVE_LIBcosnm], [1], [Define if VisiBroker's cosnm library is detected]) HAVE_LIBcosnm="yes" ], [ HAVE_LIBcosnm="no" ]) ]) AC_MSG_RESULT([$HAVE_LIBcosnm]) AC_MSG_CHECKING([for VisiBroker's costm library]) LIBS="-lcostm${VISIBROKER_LIB_SUFFIX} ${ORB_LIBS} ${EXT_ORB_LIBS}" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [ #include #include ], [ CORBA::Object_ptr t = CORBA::Object::_nil(); CosTime::TimeService::_narrow(t); ])], [ ORB_LIBS="-lcostm${VISIBROKER_LIB_SUFFIX} ${ORB_LIBS}" AC_DEFINE([HAVE_LIBcostm], [1], [Define if VisiBroker's costm library is detected]) HAVE_LIBcostm="yes" ], [ LIBS="-lcostm${VISIBROKER_LIB_SUFFIX1} ${ORB_LIBS} ${EXT_ORB_LIBS}" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [ #include #include ], [ CORBA::Object_ptr t = CORBA::Object::_nil(); CosTime::TimeService::_narrow(t); ])], [ ORB_LIBS="-lcostm${VISIBROKER_LIB_SUFFIX1} ${ORB_LIBS}" AC_DEFINE([HAVE_LIBcostm], [1], [Define if VisiBroker's costm library is detected]) HAVE_LIBcostm="yes" ], [ HAVE_LIBcostm="no" ]) ]) AC_MSG_RESULT([$HAVE_LIBcostm]) AC_MSG_CHECKING([for VisiBroker's cosnotify library]) LIBS="-lcosnotify${VISIBROKER_LIB_SUFFIX} ${ORB_LIBS} ${EXT_ORB_LIBS}" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [ #include #include ], [ CORBA::Object_ptr t = CORBA::Object::_nil(); CosNotifyComm::PushConsumer::_narrow(t); ])], [ ORB_LIBS="-lcosnotify${VISIBROKER_LIB_SUFFIX} ${ORB_LIBS}" AC_DEFINE([HAVE_LIBcosnotify], [1], [Define if VisiBroker's cosnotify library is detected]) HAVE_LIBcosnotify="yes" ], [ LIBS="-lcosnotify${VISIBROKER_LIB_SUFFIX1} ${ORB_LIBS} ${EXT_ORB_LIBS}" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [ #include #include ], [ CORBA::Object_ptr t = CORBA::Object::_nil(); CosNotifyComm::PushConsumer::_narrow(t); ])], [ ORB_LIBS="-lcosnotify${VISIBROKER_LIB_SUFFIX1} ${ORB_LIBS}" AC_DEFINE([HAVE_LIBcosnotify], [1], [Define if VisiBroker's cosnotify library is detected]) HAVE_LIBcosnotify="yes" ], [ HAVE_LIBcosnotify="no" ]) ]) AC_MSG_RESULT([$HAVE_LIBcosnotify]) AC_MSG_CHECKING([for VisiBroker's telcolog library]) LIBS="-ltelcolog${VISIBROKER_LIB_SUFFIX} ${ORB_LIBS} ${EXT_ORB_LIBS}" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [ #include #include ], [ CORBA::Object_ptr t = CORBA::Object::_nil(); DsLogAdmin::Log::_narrow(t); ])], [ ORB_LIBS="-ltelcolog${VISIBROKER_LIB_SUFFIX} ${ORB_LIBS}" AC_DEFINE([HAVE_LIBtelcolog], [1], [Define if VisiBroker's telcolog library is detected]) HAVE_LIBtelcolog="yes" ], [ LIBS="-ltelcolog${VISIBROKER_LIB_SUFFIX1} ${ORB_LIBS} ${EXT_ORB_LIBS}" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [ #include #include ], [ CORBA::Object_ptr t = CORBA::Object::_nil(); DsLogAdmin::Log::_narrow(t); ])], [ ORB_LIBS="-ltelcolog${VISIBROKER_LIB_SUFFIX1} ${ORB_LIBS}" AC_DEFINE([HAVE_LIBtelcolog], [1], [Define if VisiBroker's telcolog library is detected]) HAVE_LIBtelcolog="yes" ], [ HAVE_LIBtelcolog="no" ]) ]) AC_MSG_RESULT([$HAVE_LIBtelcolog]) ORB_LIBS="${ORB_LIBS} ${EXT_ORB_LIBS}" CXXFLAGS="${AI_CHECK_ORBACUS_save_CXXFLAGS}" CPPFLAGS="${AI_CHECK_ORBACUS_save_CPPFLAGS}" LDFLAGS="${AI_CHECK_ORBACUS_save_LDFLAGS}" LIBS="${AI_CHECK_ORBACUS_save_LIBS}" _AI_LIST_ADD_SUFFIX([${ORB_BIN_DIRS}], [${PATH_SEPARATOR}], ORB_PATH) ORB_PATH="${ORB_PATH}\$\$PATH" if test "x${AI_BUILD_SHLIBPATH_VAR}" != "x" then _AI_LIST_ADD_SUFFIX([${ORB_LIB_DIRS}], [${PATH_SEPARATOR}], ORB_LD_LIBRARY_PATH) if test "x${AI_BUILD_SHLIBPATH_VAR}" != "xPATH" then ORB_LD_LIBRARY_PATH="${ORB_LD_LIBRARY_PATH}\$\$${AI_BUILD_SHLIBPATH_VAR}" IDLC="PATH=${ORB_PATH} ${AI_BUILD_SHLIBPATH_VAR}=${ORB_LD_LIBRARY_PATH} idl2cpp" else IDLC="PATH=${ORB_LD_LIBRARY_PATH}${ORB_PATH} idl2cpp" fi else IDLC="PATH=${ORB_PATH} idl2cpp" fi _AI_LIST_ADD_PREFIX_AND_SUFFIX([${ORB_COSS_IDL_DIRS}], [-I], [ ], IDLCPPFLAGS) IDLCPPFLAGS="${AI_CHECK_VISIBROKER_save_IDLCPPFLAGS} ${IDLCPPFLAGS}" IDLCXXFLAGS="-client_ext \"\" -server_ext Server -hdr_suffix hpp -src_suffix cpp -type_code_info -excep_spec -namespace -tie" # The double $ is required by make, but not when running the command directly with sh. IDLC_FIXED=`echo ${IDLC} | sed 's/[[$][$]]/$/g'` ORB_VERSION=`${SHELL} -c "${IDLC_FIXED} -version 2>&1 | grep 'C++' | head -n 1 | sed 's/^[[^@<:@]*\@<:@0*\([1-9][0-9]*\)\.0*\([1-9][0-9]*\)[^0-9].*]$/\1.\2/'"` VISIBROKER="yes" AC_DEFINE([HAVE_VISIBROKER], [1], [Define if VisiBroker is used]) ORB_DEFINES="${ORB_DEFINES} -DHAVE_VISIBROKER" ORB_TYPE="VisiBroker" } AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([AI_BUILD_SHLIBPATH]) AI_CHECK_VISIBROKER_save_IDLCPPFLAGS="${IDLCPPFLAGS}" findVisiBroker if test "x${VISIBROKER}" = "xyes" then _AI_ORB_BUILDTEST if test "x${ORB_BUILDTEST}" != "xyes" then VISIBROKER="no" fi fi ORB_DEFINES="" if test "x${VISIBROKER}" = "xyes" then AC_MSG_NOTICE([found VisiBroker ${ORB_VERSION}]) else AC_MSG_NOTICE([VisiBroker not found]) ORB_TYPE="" ORB_VERSION="" IDLC="" IDLCXXFLAGS="" IDLCPPFLAGS="${AI_CHECK_VISIBROKER_save_IDLCPPFLAGS}" ORB_CFLAGS="" ORB_CXXFLAGS="" ORB_CPPFLAGS="" ORB_LDFLAGS="" ORB_LIBS="" ORB_BIN_DIRS="" ORB_LIB_DIRS="" ORB_INC_DIRS="" ORB_COSS_IDL_DIRS="" fi AC_SUBST([ORB_TYPE]) AC_SUBST([ORB_VERSION]) AC_SUBST([IDLC]) AC_SUBST([IDLCXXFLAGS]) AC_SUBST([IDLCPPFLAGS]) AC_SUBST([ORB_CFLAGS]) AC_SUBST([ORB_CXXFLAGS]) AC_SUBST([ORB_CPPFLAGS]) AC_SUBST([ORB_LDFLAGS]) AC_SUBST([ORB_LIBS]) AC_SUBST([ORB_BIN_DIRS]) AC_SUBST([ORB_LIB_DIRS]) AC_SUBST([ORB_INC_DIRS]) AC_SUBST([ORB_COSS_IDL_DIRS]) AC_LANG_POP(C++) ])