Browse Source

In simgrid MPI mode, we need to pass -fPIC to build libstarpu.a etc. because simgrid loads us as a library

Samuel Thibault 5 years ago
parent
commit
ca40564e81
1 changed files with 8 additions and 2 deletions
  1. 8 2
      configure.ac

+ 8 - 2
configure.ac

@@ -603,8 +603,14 @@ if test x$enable_simgrid = xno ; then
 fi
 
 AM_CONDITIONAL(STARPU_MPI_CHECK, test x$running_mpi_check = xyes)
-if test x$running_mpi_check = xyes -a x$enable_simgrid = xyes -a x$enable_shared = xyes ; then
-    AC_MSG_ERROR([MPI with simgrid can not work with shared libraries, use --disable-shared to fix this])
+if test x$running_mpi_check = xyes -a x$enable_simgrid = xyes ; then
+    if test x$enable_shared = xyes ; then
+	AC_MSG_ERROR([MPI with simgrid can not work with shared libraries, use --disable-shared to fix this])
+    else
+	CFLAGS="$CFLAGS -fPIC"
+	CXXFLAGS="$CXXFLAGS -fPIC"
+	NVCCFLAGS="$NVCCFLAGS --compiler-options -fPIC"
+    fi
 fi
 if test x$use_mpi = xyes ; then
     AC_MSG_CHECKING(whether MPI tests should be run)