Commit bfde602f authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Enable optional MPI compilation

parent 625c8b9d
Loading
Loading
Loading
Loading
+91 −2
Original line number Diff line number Diff line
@@ -33,8 +33,95 @@ AM_INIT_AUTOMAKE([-Wall -Werror foreign])

# Compiler detection
AM_PROG_AR
AC_PROG_F77([mpif90 gfortran f77])
AC_PROG_CXX([mpicxx g++ clang])
AC_ARG_ENABLE(
	[mpi],
	[AS_HELP_STRING([--enable-mpi], [use MPI if available (default is yes)])],
	[
		if test "x$enableval" = "xno"; then
		  if test "x$F77" = "xmpif90"; then
		    gfortran --version > /dev/null
		    if test "x$?" = "x0"; then
		      export F77=gfortran
		    fi
		  fi
		  if test "x$F77" = "xmpif90"; then
		    f77 --version > /dev/null
		    if test "x$?" = "x0"; then
		      export F77=f77
		    fi
		  fi
		  if test "x$CXX" = "xmpicxx"; then
		    g++ --version > /dev/null
		    if test "x$?" = "x0"; then
		      export CXX=g++
		    fi
		  fi
		  if test "x$CXX" = "xmpicxx"; then
		    clang --version > /dev/null
		    if test "x$?" = "x0"; then
		      export CXX=clang
		    fi
		  fi
		  if test "x$F77" = "x"; then
		    gfortran --version > /dev/null
		    if test "x$?" = "x0"; then
		      export F77=gfortran
		    fi
		  fi
		  if test "x$F77" = "x"; then
		    f77 --version > /dev/null
		    if test "x$?" = "x0"; then
		      export F77=f77
		    fi
		  fi
		  if test "x$CXX" = "x"; then
		    g++ --version > /dev/null
		    if test "x$?" = "x0"; then
		      export CXX=g++
		    fi
		  fi
		  if test "x$CXX" = "x"; then
		    clang --version > /dev/null
		    if test "x$?" = "x0"; then
		      export CXX=clang
		    fi
		  fi
		else
		  mpicxx --version > /dev/null
		  if test "x$?" = "x0"; then
		    export CXX=mpicxx
		    export F77=mpif90
		  else
		    AC_MSG_ERROR(["MPI was enabled, but no MPI compiler was found!"])
		  fi
		fi
	],
	[
		if test "x$CXX" = "x"; then
		  mpicxx --version > /dev/null
		  if test "x$?" = "x0"; then
		    export CXX=mpicxx
		    export F77=mpif90
		  fi
		fi
		if test "x$CXX" = "x"; then
		  g++ --version > /dev/null
		  if test "x$?" = "x0"; then
		    export CXX=g++
		  fi
		fi
		if test "x$CXX" = "x"; then
		  clang --version > /dev/null
		  if test "x$?" = "x0"; then
		    export CXX=clang
		  fi
		fi
	]
)
AC_SUBST([CXX])
AC_PROG_CXX(CXX)
AC_SUBST([F77])
AC_PROG_F77([$F77 mpif90 gfortran f77])

# Libtool initialization
LT_INIT
@@ -70,6 +157,8 @@ AS_IF(
)
AC_SUBST([HDF5_LDFLAGS])

# Configure the optional features

# Send output to Makefiles
AC_CONFIG_FILES([Makefile])