1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
|
dnl--------------------------------------------------------------------------------
dnl
dnl This file is part of Code_Saturne, a general-purpose CFD tool.
dnl
dnl Copyright (C) 1998-2018 EDF S.A.
dnl
dnl This program is free software; you can redistribute it and/or modify it under
dnl the terms of the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any later
dnl version.
dnl
dnl This program is distributed in the hope that it will be useful, but WITHOUT
dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
dnl FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
dnl details.
dnl
dnl You should have received a copy of the GNU General Public License along with
dnl this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
dnl Street, Fifth Floor, Boston, MA 02110-1301, USA.
dnl
dnl--------------------------------------------------------------------------------
dnl Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
dnl
dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
AC_DEFUN([CS_AC_TEST_OMNIORB],[
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_CXX])dnl
AC_REQUIRE([AC_PROG_CPP])dnl
AC_REQUIRE([AC_PROG_CXXCPP])dnl
AC_CHECKING(for omniORB)
omniORB_ok=yes
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_ARG_VAR([OMNIIDL], [the omniORB IDL compiler])
AC_PATH_PROG([OMNIIDL], [omniidl])
AC_ARG_VAR([OMNIIDLPYBE], [Python backend for omniidl])
if test "x$OMNIIDL" = "x"
then
omniORB_ok=no
AC_MSG_RESULT(omniORB binaries not in PATH variable)
else
omniORB_ok=yes
fi
if test "x$omniORB_ok" = "xyes"
then
OMNIORB_BIN=`echo ${OMNIIDL} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
OMNIORB_ROOT=${OMNIORB_BIN}
# one-level up
OMNIORB_ROOT=`echo ${OMNIORB_ROOT} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
#
#
if test -d $OMNIORB_ROOT/include ; then
# if $OMNIORB_ROOT/include exists, there are a lot of chance that
# this is omniORB4.x installed via configure && make && make install
OMNIORB_LIB=`echo ${OMNIORB_BIN} | sed -e "s,bin\$,lib,"`
OMNIORB_VERSION=4
else
# omniORB has been installed old way
OMNIORB_LIB=`echo ${OMNIORB_BIN} | sed -e "s,bin/,lib/,"`
# one-level up again
OMNIORB_ROOT=`echo ${OMNIORB_ROOT} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
if test -d $OMNIORB_ROOT/include/omniORB4 ; then
OMNIORB_VERSION=4
else
OMNIORB_VERSION=3
fi
fi
AC_SUBST(OMNIORB_ROOT)
OMNIORB_INCLUDES="-I$OMNIORB_ROOT/include -I$OMNIORB_ROOT/include/omniORB${OMNIORB_VERSION} -I$OMNIORB_ROOT/include/COS"
AC_SUBST(OMNIORB_INCLUDES)
CS_AC_ENABLE_PTHREADS
OMNIORB_CXXFLAGS="-DOMNIORB_VERSION=$OMNIORB_VERSION"
case $build_cpu in
sparc*)
# AC_DEFINE(__sparc__)
OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__sparc__"
;;
*86*)
# AC_DEFINE(__x86__)
OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__x86__"
;;
esac
case $build_os in
solaris*)
# AC_DEFINE(__sunos__)
__OSVERSION__=5
AC_DEFINE([__OSVERSION__], [5], [OmniORB OS version])
OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__sunos__"
;;
mingw*)
# AC_DEFINE(__WIN32__)
__OSVERSION__=4
AC_DEFINE([__OSVERSION__], [4], [OmniORB OS version])
OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__WIN32__"
;;
linux*)
# AC_DEFINE(__linux__)
__OSVERSION__=2
AC_DEFINE([__OSVERSION__], [2], [OmniORB OS version])
OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__linux__"
;;
esac
AC_SUBST(OMNIORB_CXXFLAGS)
CPPFLAGS_old=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $OMNIORB_CXXFLAGS $OMNIORB_INCLUDES"
AC_CHECK_HEADER(CORBA.h,omniORB_ok="yes",omniORB_ok="no")
CPPFLAGS=$CPPFLAGS_old
fi
if test "x$omniORB_ok" = "xyes"
then
if test "x$OMNIORB_LIB" = "x/usr/lib"
then
OMNIORB_LDFLAGS=""
OMNIORB_RFLAGS=""
else
OMNIORB_LDFLAGS="-L$OMNIORB_LIB"
OMNIORB_RFLAGS="-R$OMNIORB_LIB"
fi
if test $host_os = mingw32 ; then
OMNILIBSUFFIX="_rt"
else
OMNILIBSUFFIX=""
fi
LIBS_old=$LIBS
LIBS="$OMNIORB_LDFLAGS -lomnithread$OMNILIBSUFFIX $LIBS"
CXXFLAGS_old=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $OMNIORB_CXXFLAGS $OMNIORB_INCLUDES"
AC_MSG_CHECKING(whether we can link with omnithreads)
AC_CACHE_VAL(salome_cv_lib_omnithreads,[
AC_TRY_LINK(
#include <omnithread.h>
, omni_mutex my_mutex,
eval "salome_cv_lib_omnithreads=yes",eval "salome_cv_lib_omnithreads=no")
])
omniORB_ok="$salome_cv_lib_omnithreads"
if test "x$omniORB_ok" = "xno"
then
AC_MSG_RESULT(omnithreads not found)
else
AC_MSG_RESULT(yes)
fi
LIBS=$LIBS_old
CXXFLAGS=$CXXFLAGS_old
fi
dnl omniORB_ok=yes
if test "x$omniORB_ok" = "xyes"
then
AC_CHECK_LIB(socket,socket, LIBS="-lsocket $LIBS",,)
AC_CHECK_LIB(nsl,gethostbyname, LIBS="-lnsl $LIBS",,)
LIBS_old=$LIBS
OMNIORB_LIBS="$OMNIORB_LDFLAGS"
OMNIORB_LIBS="$OMNIORB_LIBS -lomniORB${OMNIORB_VERSION}$OMNILIBSUFFIX"
OMNIORB_LIBS="$OMNIORB_LIBS -lomniDynamic${OMNIORB_VERSION}$OMNILIBSUFFIX"
OMNIORB_LIBS="$OMNIORB_LIBS -lCOS${OMNIORB_VERSION}$OMNILIBSUFFIX"
OMNIORB_LIBS="$OMNIORB_LIBS -lCOSDynamic${OMNIORB_VERSION}$OMNILIBSUFFIX"
OMNIORB_LIBS="$OMNIORB_LIBS -lomnithread$OMNILIBSUFFIX"
OMNIORB_LIBS="$OMNIORB_LIBS ${OMNIORB_RFLAGS}"
if test $OMNIORB_VERSION = 3 ; then
OMNIORB_LIBS="$OMNIORB_LIBS -ltcpwrapGK"
fi
AC_SUBST(OMNIORB_LIBS)
LIBS_old=$LIBS
LIBS="$OMNIORB_LIBS $LIBS"
CXXFLAGS_old=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $OMNIORB_CXXFLAGS $OMNIORB_INCLUDES"
AC_MSG_CHECKING(whether we can link with omniORB)
AC_CACHE_VAL(salome_cv_lib_omniorb,[
AC_TRY_LINK(
#include <CORBA.h>
, CORBA::ORB_var orb,
eval "salome_cv_lib_omniorb3=yes",eval "salome_cv_lib_omniorb3=no")
])
omniORB_ok="$salome_cv_lib_omniorb3"
omniORB_ok=yes
if test "x$omniORB_ok" = "xno"
then
AC_MSG_RESULT(omniORB library linking failed)
omniORB_ok=no
else
AC_MSG_RESULT(yes)
fi
LIBS="$LIBS_old"
CXXFLAGS=$CXXFLAGS_old
fi
if test "x$omniORB_ok" = "xyes"
then
OMNIORB_IDLCXXFLAGS="-Wba -nf -I${OMNIORB_ROOT}/idl"
OMNIORB_IDLPYFLAGS_1='-bpython -nf '
OMNIORB_IDLPYFLAGS_2=" -I${OMNIORB_ROOT}/idl"
OMNIORB_IDLPYFLAGS=${OMNIORB_IDLPYFLAGS_1}${OMNIORB_IDLPYFLAGS_2}
AC_SUBST(OMNIORB_IDLCXXFLAGS)
AC_SUBST(OMNIORB_IDLPYFLAGS)
OMNIORB_IDL_CLN_H=.hh
OMNIORB_IDL_CLN_CXX=SK.cc
OMNIORB_IDL_CLN_OBJ=SK.o
AC_SUBST(OMNIORB_IDL_CLN_H)
AC_SUBST(OMNIORB_IDL_CLN_CXX)
AC_SUBST(OMNIORB_IDL_CLN_OBJ)
OMNIORB_IDL_SRV_H=.hh
OMNIORB_IDL_SRV_CXX=SK.cc
OMNIORB_IDL_SRV_OBJ=SK.o
AC_SUBST(OMNIORB_IDL_SRV_H)
AC_SUBST(OMNIORB_IDL_SRV_CXX)
AC_SUBST(OMNIORB_IDL_SRV_OBJ)
OMNIORB_IDL_TIE_H=
OMNIORB_IDL_TIE_CXX=
AC_SUBST(OMNIORB_IDL_TIE_H)
AC_SUBST(OMNIORB_IDL_TIE_CXX)
AC_DEFINE([OMNIORB], [], [Description])
CORBA_HAVE_POA=1
AC_DEFINE([CORBA_HAVE_POA], [], [Description])
CORBA_ORB_INIT_HAVE_3_ARGS=1
AC_DEFINE([CORBA_ORB_INIT_HAVE_3_ARGS], [], [Description])
CORBA_ORB_INIT_THIRD_ARG='"omniORB"'
AC_DEFINE([CORBA_ORB_INIT_THIRD_ARG], [], [omniORB])
fi
omniORBpy_ok=no
if test "x$omniORB_ok" = "xyes"
then
AC_MSG_CHECKING(omniORBpy)
$PYTHON -c "import omniORB" &> /dev/null
if test $? = 0 ; then
AC_MSG_RESULT(yes)
omniORBpy_ok=yes
else
AC_MSG_RESULT(no, check your installation of omniORBpy)
omniORBpy_ok=no
fi
fi
dnl AC_LANG_RESTORE
AC_MSG_RESULT(for omniORBpy: $omniORBpy_ok)
AC_MSG_RESULT(for omniORB: $omniORB_ok)
# Save cache
AC_CACHE_SAVE
if test "x$omniORB_ok" = "xyes"
then
CXXFLAGS_old=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $OMNIORB_CXXFLAGS $OMNIORB_INCLUDES"
LIBS_old=$LIBS
LIBS="$OMNIORB_LDFLAGS $OMNIORB_LIBS $LIBS"
AC_MSG_CHECKING(whether we have double and CORBA::Double compatibility)
# Note: in cross-compilation mode, run-time checks are replaced
# by compile-time checks; the latter are based on the fact that
# the case statement does not allow twice the same label
# (autoconf uses a similar test for some of its macros)
AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
#include <CORBA.h>]],
[[CORBA::Double *a=new CORBA::Double(2.5);
double c=2.5;
double *b;
b=(double *)a;
if( (c==*b) && (sizeof(double)==sizeof(CORBA::Double)) ){
delete a;
exit(0);
}
else{
delete a;
exit(1);
}]]) ],
DOUBLECOMP="yes",
DOUBLECOMP="no",
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
#include <CORBA.h>]],
[[switch (0) case 0: case (sizeof(double)==sizeof(CORBA::Double)):;]])],
[ DOUBLECOMP="yes" ],
[ DOUBLECOMP="no"])]
)
if test "$DOUBLECOMP" = yes; then
OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -DCOMP_CORBA_DOUBLE"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING(whether we have int and CORBA::Long compatibility)
AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
#include <CORBA.h>]],
[[CORBA::Long *a=new CORBA::Long(2);
int c=2;
int *b;
b=(int *)a;
if( (c==*b) && (sizeof(int)==sizeof(CORBA::Long)) )
exit(0);
else
exit(1);]]) ],
LONGCOMP="yes",
LONGCOMP="no",
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
#include <CORBA.h>]],
[[switch (0) case 0: case (sizeof(int)==sizeof(CORBA::Long)):;]])],
[ LONGCOMP="yes" ],
[ LONGCOMP="no"])]
)
if test "$LONGCOMP" = yes; then
OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -DCOMP_CORBA_LONG"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
CXXFLAGS=$CXXFLAGS_old
LIBS=$LIBS_old
fi
AC_LANG_RESTORE
AC_SUBST(OMNIORB_CXXFLAGS)
])dnl
dnl
|