Salome HOME
To see which hdf5 we're using in configure log
[modules/kernel.git] / salome_adm / unix / config_files / DEPRECATED / check_mico.m4
1 dnl  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 dnl
3 dnl  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 dnl  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 dnl
6 dnl  This library is free software; you can redistribute it and/or
7 dnl  modify it under the terms of the GNU Lesser General Public
8 dnl  License as published by the Free Software Foundation; either
9 dnl  version 2.1 of the License.
10 dnl
11 dnl  This library is distributed in the hope that it will be useful,
12 dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 dnl  Lesser General Public License for more details.
15 dnl
16 dnl  You should have received a copy of the GNU Lesser General Public
17 dnl  License along with this library; if not, write to the Free Software
18 dnl  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 dnl
20 dnl  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 dnl
22 AC_DEFUN([CHECK_MICO],[
23 AC_REQUIRE([AC_PROG_CC])dnl
24 AC_REQUIRE([AC_PROG_CXX])dnl
25 AC_REQUIRE([AC_PROG_CPP])dnl
26 AC_REQUIRE([AC_PROG_CXXCPP])dnl
27
28 AC_CHECKING(for mico)
29 mico_ok=yes
30
31 AC_LANG_SAVE
32 AC_LANG_CPLUSPLUS
33
34 AC_PATH_PROG(MICOD, micod)
35 if test "x$MICOD" = "x"
36 then
37   mico_ok=no
38   AC_MSG_RESULT(mico binaries not in PATH variable)
39 else
40   mico_ok=yes
41 fi
42
43 if  test "x$mico_ok" = "xyes"
44 then
45   AC_SUBST(MICO_IDL)
46
47   MICO_BIN=`echo ${MICOD} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
48   MICO_LIB=`echo ${MICO_BIN} | sed -e "s,bin,lib,"`
49   MICO_ROOT=`echo ${MICO_BIN}  | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
50   AC_SUBST(MICO_ROOT)
51
52   MICO_IDL=${MICO_BIN}/idl
53   AC_SUBST(MICO_IDL)
54
55   MICO_INCLUDES="-I$MICO_ROOT/include"
56   AC_SUBST(MICO_INCLUDES)
57
58   MICO_VERSION=`sed -n -e 's/.define *MICO_VERSION *\"\([[^\"]]*\)\"/\1/p' $MICO_ROOT/include/mico/version.h`
59   AC_SUBST(MICO_VERSION)
60   AC_MSG_RESULT(using mico version $MICO_VERSION)
61
62   MICO_CXXFLAGS="-ftemplate-depth-42 -fpermissive"
63   AC_SUBST(MICO_CXXFLAGS)
64
65   CXXFLAGS_old=$CXXFLAGS
66   CXXFLAGS="$CXXFLAGS $MICO_CXXFLAGS $MICO_INCLUDES"
67
68   AC_MSG_CHECKING(include of CORBA.h)
69   AC_TRY_COMPILE(
70 #include "CORBA.h"
71 , ,mico_ok=yes ,mico_ok=no)
72
73   if  test "x$mico_ok" = "xno"
74   then
75     AC_MSG_RESULT(CORBA.h not found in mico installation)
76   else
77     AC_MSG_RESULT(yes)
78   fi
79
80   CXXFLAGS=$CXXFLAGS_old
81
82 fi
83
84 if test "x$mico_ok" = "xyes" 
85 then
86   if test "x$MICO_LIB" = "x/usr/lib"
87   then
88     MICO_LDFLAGS=""
89   else
90     MICO_LDFLAGS="-L$MICO_LIB"
91   fi
92
93   LIBS_old=$LIBS
94   MICO_LIBS="$MICO_LDFLAGS -lmico$MICO_VERSION -ldl"
95   AC_SUBST(MICO_LIBS)
96
97   LIBS="$MICO_LIBS $LIBS"
98   CXXFLAGS_old=$CXXFLAGS
99   CXXFLAGS="$CXXFLAGS $MICO_CXXFLAGS $MICO_INCLUDES"
100
101   AC_MSG_CHECKING(whether we can link with mico)
102   AC_TRY_LINK(
103 #include "CORBA.h"
104 ,CORBA::ORB_var orb,
105     mico_ok=yes,mico_ok=no)
106
107   if test "x$mico_ok" = "xno" 
108   then
109     AC_MSG_RESULT(mico library linking failed)
110     mico_ok=no
111   else
112     AC_MSG_RESULT(yes)
113   fi
114
115   CXXFLAGS=$CXXFLAGS_old
116   LIBS=$LIBS_old
117 fi
118
119
120 if test "x$mico_ok" = "xyes" 
121 then
122
123   MICO_IDLCXXFLAGS="-bcxx -I$MICO_ROOT/idl"
124   AC_SUBST(MICO_IDLCXXFLAGS)
125   AC_SUBST(MICO_IDLPYFLAGS)
126
127   MICO_IDL_CLN_H=.hh
128   MICO_IDL_CLN_CXX=SK.cc
129   MICO_IDL_CLN_OBJ=SK.o 
130   AC_SUBST(MICO_IDL_CLN_H)
131   AC_SUBST(MICO_IDL_CLN_CXX)
132   AC_SUBST(MICO_IDL_CLN_OBJ)
133
134   MICO_IDL_SRV_H=.hh
135   MICO_IDL_SRV_CXX=SK.cc
136   MICO_IDL_SRV_OBJ=SK.o
137   AC_SUBST(MICO_IDL_SRV_H)
138   AC_SUBST(MICO_IDL_SRV_CXX)
139   AC_SUBST(MICO_IDL_SRV_OBJ)
140
141   MICO_IDL_TIE_H=
142   MICO_IDL_TIE_CXX=
143   AC_SUBST(MICO_IDL_TIE_H)
144   AC_SUBST(MICO_IDL_TIE_CXX)
145   
146   AC_DEFINE(MICO)
147
148   CORBA_HAVE_POA=1
149   AC_DEFINE(CORBA_HAVE_POA)
150
151 fi
152
153 AC_LANG_RESTORE
154
155 AC_MSG_RESULT(for mico: $mico_ok)
156
157 ])dnl
158 dnl