Salome HOME
Gestion 32/64bits dans l'interfce C/F de Calcium.
[modules/kernel.git] / salome_adm / unix / config_files / check_calcium.m4
1 AC_DEFUN([CHECK_CALCIUM], [
2
3 ## Guess where as cal_int type is provided by --with-cal_int option
4 ## or auto-detection must be used
5
6 AC_ARG_WITH([cal_int],
7             AC_HELP_STRING([--with-cal_int=<C type>],
8                            [Use <C type> for mapping a Fortran integer in C within CALCIUM C/F77 interfaces.]),
9             [],
10             [withval=no])
11
12 if test "x$withval" = "xno"
13 then
14   AC_REQUIRE([CHECK_F77])
15   AC_CHECK_SIZEOF_FORTRAN(integer)
16   AC_CHECK_SIZEOF(long)
17   AC_CHECK_SIZEOF(int)
18
19   if test "x$ac_cv_sizeof_fortran_integer" = "x8" ; then
20      AC_DEFINE(HAVE_F77INT64,[],
21                        [The size of a Fortran integer, as computed by sizeof.])
22      test "x$ac_cv_sizeof_long" = "x8" || AC_MSG_ERROR([Size of C type long expected to be eight bytes])
23      LONG_OR_INT="long"
24      CALCIUM_IDL_INT_F77="long long"
25      CALCIUM_CORBA_INT_F77="CORBA::LongLong"
26   elif test "x$ac_cv_sizeof_fortran_integer" = "x4" ; then
27      test "x$ac_cv_sizeof_int" = "x4" || AC_MSG_ERROR([Size of C type int expected to be four bytes])
28      LONG_OR_INT="int"
29      CALCIUM_IDL_INT_F77="long"
30      CALCIUM_CORBA_INT_F77="CORBA::Long"
31   else
32      AC_MSG_ERROR([Size of Fortran type integer is neither four nor eigth bytes])
33   fi
34
35 else
36   LONG_OR_INT="$withval" 
37   CALCIUM_IDL_INT_F77="long"
38   CALCIUM_CORBA_INT_F77="CORBA::Long"
39   AC_MSG_NOTICE([Using C type $withval for cal_int])
40 fi
41
42 AC_SUBST(CALCIUM_IDL_INT_F77)
43 AC_SUBST(CALCIUM_CORBA_INT_F77)
44 AC_SUBST(LONG_OR_INT)
45 AC_DEFINE_UNQUOTED([CAL_INT],[$LONG_OR_INT],
46          [The C type to be used for mapping a Fortran integer in C within CALCIUM C/F77 interfaces.])
47 ])