Salome HOME
Correction -> ne pas supprimer le PYTHONPATH
[modules/adao.git] / adm_local / check_mpi.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_MPI],[
23
24 AC_REQUIRE([AC_PROG_CC])dnl
25
26 AC_ARG_WITH(mpi_lib,
27    [AC_HELP_STRING([--with-mpi_lib=DIR],[directory path of MPICH lib installation])],
28    MPILIBREQUESTED="$withval")
29
30 AC_ARG_WITH(mpi,
31    [AC_HELP_STRING([--with-mpi=DIR],[root directory path of MPICH installation])],
32    MPIREQUESTED="yes",MPIREQUESTED="no")
33
34 MPI_INCLUDES=""
35 MPI_LIBS=""
36 WITHMPI=no
37 mpi_ok=no
38 if test x"$MPIREQUESTED" = xyes; then
39
40   echo
41   echo ---------------------------------------------
42   echo testing mpi
43   echo ---------------------------------------------
44   echo
45
46   if test "x$withval" != "xyes"; then
47     MPI_HOME=$withval
48     MPI_INCLUDES="-I$MPI_HOME/include"
49     if test "x$MPI_HOME" = "x/usr"
50     then
51       MPI_LIBS=""
52     else
53       MPI_LIBS="-L$MPI_HOME/lib"
54     fi
55   fi
56
57   if test x"$MPILIBREQUESTED" != x; then
58     MPI_LIBS="-L$MPILIBREQUESTED"
59   fi
60
61   CPPFLAGS_old="$CPPFLAGS"
62   CPPFLAGS="$MPI_INCLUDES $CPPFLAGS"
63   AC_CHECK_HEADER(mpi.h,WITHMPI="yes",WITHMPI="no")
64   CPPFLAGS="$CPPFLAGS_old"
65
66   if test "$WITHMPI" = "yes";then
67     LIBS_old="$LIBS"
68     LDFLAGS_old="$LDFLAGS"
69     LDFLAGS="$MPI_LIBS $LDFLAGS"
70     AC_CHECK_LIB(elan,elan_init,MPI_LIBS="$MPI_LIBS -lelan")
71     AC_CHECK_LIB(mpi,MPI_Init,WITHMPI="yes",WITHMPI="no")
72     AC_CHECK_LIB(mpi,MPI_Publish_name,WITHMPI2="yes",WITHMPI2="no")
73     LDFLAGS="$LDFLAGS_old"
74     LIBS="$LIBS_old"
75   fi
76
77   if test "$WITHMPI" = "yes";then
78     mpi_ok=yes
79     MPI_LIBS="$MPI_LIBS -lmpi -lmpio -lmpiCC"
80   else
81     mpi_ok=no
82   fi
83
84 fi
85
86 if test "$WITHMPI" = no; then
87 dnl
88 dnl ---------------------------------------------
89 dnl testing MPICH
90 dnl ---------------------------------------------
91 dnl
92
93   CHECK_MPICH
94
95   if test "$WITHMPICH" = no; then
96 dnl
97 dnl ---------------------------------------------
98 dnl testing LAM
99 dnl ---------------------------------------------
100 dnl
101
102     CHECK_LAM
103
104   fi
105
106   if test "$WITHLAM" = no; then
107 dnl
108 dnl ---------------------------------------------
109 dnl testing OPENMPI
110 dnl ---------------------------------------------
111 dnl
112
113     CHECK_OPENMPI
114
115   fi
116
117 fi
118
119 if test x$WITHMPI2 = xyes; then
120   CPPFLAGS="-DHAVE_MPI2 $CPPFLAGS"
121   CORBA_IDLCXXFLAGS="-DHAVE_MPI2 $CORBA_IDLCXXFLAGS"
122   CORBA_IDLPYFLAGS="-DHAVE_MPI2 $CORBA_IDLPYFLAGS"
123 fi
124
125 AC_SUBST(WITHMPI)
126 AC_SUBST(MPI_INCLUDES)
127 AC_SUBST(MPI_LIBS)
128 AC_SUBST(mpi_ok)
129 AM_CONDITIONAL(MPI_IS_OK, [test x"$mpi_ok" = xyes])
130 ])dnl