File: mpi.m4

package info (click to toggle)
gretl 2025b-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 64,984 kB
  • sloc: ansic: 426,435; sh: 4,916; makefile: 3,257; cpp: 2,777; xml: 610; perl: 364
file content (52 lines) | stat: -rw-r--r-- 1,636 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Configure path for MPI header
# Note: we're assuming that mpicc will take care of finding the MPI library
# (which is only required for linking of gretlmpi), so here we're mostly
# just checking that mpi.h can be found, and recording the include path if
# necessary
# Allin Cottrell, February 2014, revised November 2017

AC_DEFUN([AC_C_MPI],
[
# mpi-lib not used, just retained for backward compatibility
AC_ARG_WITH(mpi-lib,
    [  --with-mpi-lib=PFX path to MPI library],,)

AC_ARG_WITH(mpi-include,
    [  --with-mpi-include=PFX path to MPI header],
    [MPI_inc_check="$with_mpi_include $with_mpi_include/include $with_mpi_include/include/openmpi"],
    [MPI_inc_check="/usr/include /usr/local/include /usr/include/openmpi /opt/openmpi/include /usr/lib/openmpi/include"])

# can we find the header just using the default search paths?
AC_CHECK_HEADER(mpi.h,have_mpi="yes",,)

# if not, try our own search
if test $have_mpi = no ; then
  ARCH=`uname -m`
  ARCHPATHS="/usr/include/openmpi-${ARCH} /usr/lib/${ARCH}-linux-gnu/openmpi/include /usr/local/include/openmpi-${ARCH}"
  MPI_incdir=
  for m in $MPI_inc_check $ARCHPATHS ; do
    if test -d "$m" && test -f "$m/mpi.h" ; then
      MPI_incdir=$m
      break
    fi
  done
  if test -z "$MPI_incdir" ; then
    AC_MSG_RESULT([couldn't find mpi.h])
  else
    AC_MSG_RESULT([found mpi.h in $MPI_incdir])
    have_mpi=yes
    if test "$MPI_incdir" != "/usr/include" ; then
      MPI_CFLAGS="-I${MPI_incdir}"
    fi
  fi
fi

if test $have_mpi = yes ; then
  AC_DEFINE(HAVE_MPI)
  if test x"${MPICC}" = x ; then
    MPICC=mpicc
  fi 
  AC_SUBST(MPICC)
  AC_SUBST(MPI_CFLAGS)
fi
])