Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/med.git] / adm_local_without_kernel / unix / config_files / check_mpich.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_MPICH],[
23
24 AC_REQUIRE([AC_PROG_CC])dnl
25
26 AC_ARG_WITH(mpich,
27   [AC_HELP_STRING([--with-mpich=DIR],[root directory path of MPICH installation])],
28   WITHMPICH="yes",WITHMPICH="no")
29
30 MPI_INCLUDES=""
31 MPI_LIBS=""
32 if test "$WITHMPICH" = yes; then
33
34   MPIREQUESTED="yes"
35   echo
36   echo ---------------------------------------------
37   echo testing mpich
38   echo ---------------------------------------------
39   echo
40   MPICH_HOME=$withval
41
42   if test "$MPICH_HOME"; then
43     MPI_INCLUDES="-I$MPICH_HOME/include -DMPICH_IGNORE_CXX_SEEK"
44     if test "x$MPICH_HOME" = "x/usr"
45     then
46       MPI_LIBS=""
47     else
48       MPI_LIBS="-L$MPICH_HOME/lib"
49     fi
50   fi
51
52   CPPFLAGS_old="$CPPFLAGS"
53   CPPFLAGS="$MPI_INCLUDES $CPPFLAGS"
54   AC_CHECK_HEADER(mpi.h,WITHMPICH="yes",WITHMPICH="no")
55   CPPFLAGS="$CPPFLAGS_old"
56
57   if test "$WITHMPICH" = "yes";then
58      MPI_LIBS="$MPI_LIBS -lmpich -lpmpich"
59   fi
60
61   if test "$WITHMPICH" = "yes";then
62     LDFLAGS_old="$LDFLAGS"
63     LDFLAGS="$MPI_LIBS $LDFLAGS"
64     AC_CHECK_LIB(mpich,MPI_Init,WITHMPICH="yes",WITHMPICH="no")
65     AC_CHECK_LIB(mpich,MPI_Publish_name,WITHMPI2="yes",WITHMPI2="no")
66     LDFLAGS="$LDFLAGS_old"
67   fi
68
69   if test "$WITHMPICH" = "yes";then
70      WITHMPI="yes"
71      mpi_ok=yes
72   else
73      mpi_ok=no
74   fi
75
76 fi
77
78 ])dnl