Salome HOME
Revert "Synchronize adm files"
[modules/kernel.git] / salome_adm / unix / config_files / check_calcium.m4
1 dnl Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
2 dnl
3 dnl This library is free software; you can redistribute it and/or
4 dnl modify it under the terms of the GNU Lesser General Public
5 dnl License as published by the Free Software Foundation; either
6 dnl version 2.1 of the License, or (at your option) any later version.
7 dnl
8 dnl This library is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
10 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 dnl Lesser General Public License for more details.
12 dnl
13 dnl You should have received a copy of the GNU Lesser General Public
14 dnl License along with this library; if not, write to the Free Software
15 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 dnl
17 dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 dnl
19
20 AC_DEFUN([CHECK_CALCIUM], [
21
22 ## Guess where as cal_int type is provided by --with-cal_int option
23 ## or auto-detection must be used
24
25 AC_ARG_WITH([cal_int],
26             AC_HELP_STRING([--with-cal_int=<C type>],
27                            [Use <C type> for mapping a Fortran integer in C within CALCIUM C/F77 interfaces.]),
28             [],
29             [withval=no])
30
31 AC_CHECK_SIZEOF(long)
32 AC_CHECK_SIZEOF(int)
33
34 if test "x$withval" = "xno"
35 then
36   AC_REQUIRE([CHECK_F77])
37   AC_CHECK_SIZEOF_FORTRAN(integer)
38
39   if test "x$ac_cv_sizeof_fortran_integer" = "x8" ; then
40      AC_DEFINE(HAVE_F77INT64,[],
41                        [The size of a Fortran integer, as computed by sizeof.])
42      test "x$ac_cv_sizeof_long" = "x8" || AC_MSG_ERROR([Size of C type long expected to be eight bytes])
43      LONG_OR_INT="long"
44      CALCIUM_IDL_INT_F77="long long"
45      CALCIUM_CORBA_INT_F77="CORBA::LongLong"
46   elif test "x$ac_cv_sizeof_fortran_integer" = "x4" ; then
47      test "x$ac_cv_sizeof_int" = "x4" || AC_MSG_ERROR([Size of C type int expected to be four bytes])
48      LONG_OR_INT="int"
49      CALCIUM_IDL_INT_F77="long"
50      CALCIUM_CORBA_INT_F77="CORBA::Long"
51   else
52      AC_MSG_ERROR([Size of Fortran type integer is neither four nor eigth bytes])
53   fi
54
55 elif test "x$withval" = "xint"
56 then
57   LONG_OR_INT="int" 
58   CALCIUM_IDL_INT_F77="long"
59   CALCIUM_CORBA_INT_F77="CORBA::Long"
60   AC_MSG_NOTICE([Using C type int for cal_int])
61
62 elif test "x$withval" = "xlong"
63 then
64   LONG_OR_INT="long"
65   CALCIUM_IDL_INT_F77="long long"
66   CALCIUM_CORBA_INT_F77="CORBA::LongLong"
67   AC_MSG_NOTICE([Using C type long for cal_int])
68 else
69   AC_MSG_ERROR([Fortran type integer must be mapped to C type int or C type long]) 
70 fi
71
72 AC_SUBST(CALCIUM_IDL_INT_F77)
73 AC_SUBST(CALCIUM_CORBA_INT_F77)
74 AC_SUBST(LONG_OR_INT)
75 AC_DEFINE_UNQUOTED([CAL_INT],[$LONG_OR_INT],
76          [The C type to be used for mapping a Fortran integer in C within CALCIUM C/F77 interfaces.])
77 ])