Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/yacs.git] / src / wrappergen / bin / HXX2SALOME_GENERIC_CLASS_NAME_SRC / adm_local / unix / config_files / check_Med2.m4
index 8bd6991e2a139043b295789f00e9d2e1faf8db58..4ef9fab92adf7298b7930f31fd00e1969ee5a088 100644 (file)
@@ -1,25 +1,27 @@
-dnl  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
+dnl Copyright (C) 2007-2012  CEA/DEN, EDF R&D
 dnl
-dnl  This library is free software; you can redistribute it and/or
-dnl  modify it under the terms of the GNU Lesser General Public
-dnl  License as published by the Free Software Foundation; either
-dnl  version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
 dnl
-dnl  This library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl Lesser General Public License for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public
-dnl  License along with this library; if not, write to the Free Software
-dnl  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 dnl
-dnl  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 dnl
+
 AC_DEFUN([CHECK_MED2],[
 AC_REQUIRE([AC_PROG_CC])dnl
 AC_REQUIRE([AC_PROG_CPP])dnl
 AC_REQUIRE([CHECK_HDF5])dnl
+AC_REQUIRE([MED_CHECK_SIZEOF_MEDINT])
 
 AC_CHECKING(for MED2)
 
@@ -32,15 +34,17 @@ AC_ARG_WITH(med2,
 AC_SUBST(MED2_INCLUDES)
 AC_SUBST(MED2_LIBS)
 AC_SUBST(MED2_MT_LIBS)
+AC_SUBST(MED_CPPFLAGS)
 
 MED2_INCLUDES=""
 MED2_LIBS=""
 MED2_MT_LIBS=""
+MED_CPPFLAGS="$DEFINED_F77INT64"
 
 med2_ok=no
 
 LOCAL_INCLUDES="$HDF5_INCLUDES"
-LOCAL_LIBS="-lmed $HDF5_LIBS"
+LOCAL_LIBS="-lmed -lmedimportcxx $HDF5_LIBS"
 
 if test -z $MED2HOME
 then
@@ -65,12 +69,89 @@ fi
 
 dnl check med2 header
 
+f77int="F77INT32"
+case  $host_os in
+   irix5.* | irix6.* | osf4.* | osf5.* | linux*  )
+
+        linux64="true"
+# porting on intel processor 64 bits
+        expr "$host_os" : 'linux' >/dev/null && ( test ! x"$host_cpu" = x"x86_64" && test ! x"$host_cpu" = x"ia64" ) && linux64="false"
+       if test ! x"$linux64" = "xfalse" ; then
+         echo "$as_me:$LINENO: checking for 64bits integers size in F77/F90" >&5
+echo $ECHO_N "checking for 64bits integers size in F77/F90... $ECHO_C" >&6
+         # Check whether --enable-int64 or --disable-int64 was given.
+if test "${enable_int64+set}" = set; then
+  enableval="$enable_int64"
+
+fi;
+         case "X-$enable_int64" in
+           X-no)
+            echo "$as_me:$LINENO: result: \"disabled\"" >&5
+echo "${ECHO_T}\"disabled\"" >&6
+            SUFFIXES="_32"
+            ;;
+           *)
+            echo "$as_me:$LINENO: result: \"enabled\"" >&5
+echo "${ECHO_T}\"enabled\"" >&6
+            SUFFIXES=""
+            f77int="F77INT64"
+            ;;
+         esac
+       fi
+     ;;
+   *)
+     ;;
+esac
+
+case $host_os in
+    linux*)
+        test x"$linux64" = x"true" && \
+          MACHINE="PCLINUX64${SUFFIXES}" || \
+       MACHINE=PCLINUX
+       ;;
+    hpux*)
+       MACHINE=HP9000
+       ;;
+    aix4.*)
+       MACHINE=RS6000
+       host_os_novers=aix4.x
+       ;;
+    irix5.*)
+       MACHINE="IRIX64${SUFFIXES}"
+       host_os_novers=irix5.x
+       ;;
+    irix6.*)
+       MACHINE="IRIX64${SUFFIXES}"
+       host_os_novers=irix6.x
+       ;;
+    osf4.*)
+       MACHINE="OSF1${SUFFIXES}"
+       host_os_novers=osf4.x
+       ;;
+    osf5.*)
+       MACHINE="OSF1${SUFFIXES}"
+        host_os_novers=osf5.x
+        ;;
+    solaris2.*)
+       MACHINE=SUN4SOL2
+        host_os_novers=solaris2.x
+        ;;
+    uxpv*)
+       MACHINE=VPP5000
+        ;;
+    *)
+       MACHINE=
+        host_os_novers=$host_os
+        ;;
+esac
+
 CPPFLAGS_old="$CPPFLAGS"
 dnl we must test system : linux = -DPCLINUX
 dnl we must test system : Alpha-OSF = -DOSF1
 case $host_os in
    linux*)
-      CPPFLAGS="$CPPFLAGS -DPCLINUX $LOCAL_INCLUDES"
+      CPPFLAGS="$CPPFLAGS -D$MACHINE $LOCAL_INCLUDES"
+dnl      CPPFLAGS="$CPPFLAGS -DPCLINUX $LOCAL_INCLUDES"
       ;;
    osf*)
       CPPFLAGS="$CPPFLAGS -DOSF1 $LOCAL_INCLUDES"
@@ -87,15 +168,21 @@ dnl check med2 library
   LIBS_old="$LIBS"
   LIBS="$LIBS $LOCAL_LIBS"
   AC_CHECK_LIB(med,MEDouvrir,med2_ok=yes,med2_ok=no)
-  LIBS="$LIBS_old"
 
+  if  test "x$med2_ok" = "xyes"
+  then
+   AC_CHECK_LIB(medimportcxx,HAVE_MEDimport,med2_ok=yes,med2_ok=no)
+  fi
+  LIBS="$LIBS_old"
 fi
 
 if  test "x$med2_ok" = "xyes"
 then
 case $host_os in
    linux*)
-        MED2_INCLUDES="-DPCLINUX $LOCAL_INCLUDES"
+      MED2_INCLUDES="-D$MACHINE $LOCAL_INCLUDES"
+dnl      MED2_INCLUDES="-DPCLINUX $LOCAL_INCLUDES"
       ;;
    osf*)
       MED2_INCLUDES="-DOSF1 $LOCAL_INCLUDES"
@@ -105,6 +192,7 @@ esac
   MED2_MT_LIBS="$LOCAL_LIBS"
 fi
 
+
 AC_MSG_RESULT(for med2: $med2_ok)
 
 ])dnl