Browse Source

Add a --with-mpicc option to specify which compiler should be used with MPI.

Cédric Augonnet 15 years ago
parent
commit
d4c070f3ee
2 changed files with 41 additions and 13 deletions
  1. 40 12
      configure.ac
  2. 1 1
      mpi/Makefile.am

+ 40 - 12
configure.ac

@@ -424,31 +424,59 @@ fi
 #                                                                             #
 #                                                                             #
 ###############################################################################
 ###############################################################################
 
 
-AC_ARG_WITH(mpi, [AS_HELP_STRING([--with-mpi[=<dir>]],
+AC_ARG_WITH(mpicc, [AS_HELP_STRING([--with-mpicc[=<path to mpicc>]],
+			[Path of the mpicc compiler])],
+	[
+		if test x$withval = xyes; then
+			AC_MSG_ERROR(--with-mpi must be given a pathname)
+		else
+			use_mpi=forceyes
+			mpicc_path=$withval
+		fi
+	],
+	[
+		# nothing was specified: default value is used
+		AC_PATH_PROG(mpicc_path, mpicc, [no], [])
+		use_mpi=maybe
+	])
+
+AC_ARG_WITH(mpi, [AS_HELP_STRING([--with-mpi],
 			[Generate a library to use StarPU with MPI])],
 			[Generate a library to use StarPU with MPI])],
 	[
 	[
 		if test x$withval != xno; then
 		if test x$withval != xno; then
 			use_mpi=yes
 			use_mpi=yes
-			if test x$withval = xyes; then
-				# mpi option is enabled explicitely, but no dir
-				# is specified
-				use_default_mpi=yes
-			else
-				use_default_mpi=no
-				mpidir=$withval
-				AC_SUBST(MPIDIR, $mpidir)
-			fi
 		else
 		else
 			# explicitly without mpi
 			# explicitly without mpi
 			use_mpi=no
 			use_mpi=no
 		fi
 		fi
 	],
 	],
 	[
 	[
-		use_mpi=no
+		# nothing was specified, the MPI lib is generated only if some
+		# mpicc was explicitely specified (thus implicitely indicating
+		# MPI support).
+		if test x$use_mpi = xforceyes; then
+			use_mpi=yes
+		else
+			use_mpi=no
+		fi
 	])
 	])
-AC_MSG_CHECKING(whether mpi lib should be generated)
+
+if test x$use_mpi = xyes; then
+	# We test if the MPICC compiler exists
+	if test ! -x $mpicc_path; then
+		#MPICC does not exists or is not executable
+		AC_MSG_ERROR(The mpicc compiler is not valid)
+	fi
+
+	AC_MSG_CHECKING(mpicc path)
+	AC_MSG_RESULT($mpicc_path)
+	AC_SUBST(MPICC, $mpicc_path)
+fi
+
+AC_MSG_CHECKING(whether the MPI library should be generated)
 AC_MSG_RESULT($use_mpi)
 AC_MSG_RESULT($use_mpi)
 AC_SUBST(USE_MPI, $use_mpi)
 AC_SUBST(USE_MPI, $use_mpi)
+
 AM_CONDITIONAL(USE_MPI, test x$use_mpi = xyes)
 AM_CONDITIONAL(USE_MPI, test x$use_mpi = xyes)
 
 
 ###############################################################################
 ###############################################################################

+ 1 - 1
mpi/Makefile.am

@@ -14,7 +14,7 @@
 # See the GNU Lesser General Public License in COPYING.LGPL for more details.
 # See the GNU Lesser General Public License in COPYING.LGPL for more details.
 #
 #
 
 
-CC=mpicc
+CC=$(MPICC)
 
 
 if USE_CUDA
 if USE_CUDA
 # TODO define NVCCFLAGS
 # TODO define NVCCFLAGS