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