Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
third time's the charm. It was already done properly for smpicc, so just port it...
authorAugustin Degomme <adegomme@users.noreply.github.com>
Wed, 13 May 2020 12:44:02 +0000 (14:44 +0200)
committerAugustin Degomme <adegomme@users.noreply.github.com>
Wed, 13 May 2020 12:44:02 +0000 (14:44 +0200)
src/smpi/smpicc.in
src/smpi/smpicxx.in
src/smpi/smpif90.in
src/smpi/smpiff.in

index 8ec8dde..dcf80e7 100755 (executable)
@@ -33,9 +33,6 @@ elif [ "x@APPLE@" = "x1" ]; then
     list_add CFLAGS "-fPIC"
     if [ "x${SMPI_PRETEND_CC}" = "x" ]; then
        list_add LINKARGS "-shared"
-       if [ "@APPLE@" != "1" ]; then
-           list_add LINKARGS "-Wl,-z,defs"
-       fi
     else
        echo "Warning: smpicc pretends to be a regular compiler (SMPI_PRETEND_CC is set). Produced binaries will not be usable in SimGrid."
     fi
index 85463d9..4d7632b 100755 (executable)
@@ -18,21 +18,34 @@ CMAKE_LINKARGS="-L@libdir@"
 
 list_set CXXFLAGS "-std=gnu++11" @SMPI_CXX_FLAGS@
 list_set LINKARGS
-if [ "@WIN32@" != "1" ]; then
+
+if [ "@CMAKE_C_COMPILER_ID@" = "Clang" -a "@HAVE_SANITIZER_ADDRESS@" = "TRUE" ]; then
+    LINKER_UNDEFINED_ERROR=""
+else
+    LINKER_UNDEFINED_ERROR="1"
+fi
+
+if [ "x@WIN32@" = "x1" ]; then
+    list_add CXXFLAGS "-include" "@includedir@/smpi/smpi_main.h"
+    list_add LINKARGS "@libdir@\libsimgrid.dll"
+elif [ "x@APPLE@" = "x1" ]; then
     list_add CXXFLAGS "-include" "@includedir@/smpi/smpi_helpers.h"
     list_add CXXFLAGS "-fPIC"
     if [ "x${SMPI_PRETEND_CC}" = "x" ]; then
        list_add LINKARGS "-shared"
-       if [ "@APPLE@" != "1" ]; then
-           list_add LINKARGS "-Wl,-z,defs"
-       fi
     else
-       echo "Warning: smpicxx pretends to be a regular compiler (SMPI_PRETEND_CC is set). Produced binaries will not be usable in SimGrid."
+       echo "Warning: smpicc pretends to be a regular compiler (SMPI_PRETEND_CC is set). Produced binaries will not be usable in SimGrid."
     fi
-    list_add LINKARGS "-lsimgrid"
+    list_add LINKARGS "-lsimgrid" ${LINKER_UNDEFINED_ERROR:+"-Wl,-undefined,error"}
 else
-    list_add CXXFLAGS "-include" "@includedir@/smpi/smpi_main.h"
-    list_add LINKARGS "@libdir@\libsimgrid.dll"
+    list_add CXXFLAGS "-include" "@includedir@/smpi/smpi_helpers.h"
+    list_add CXXFLAGS "-fPIC"
+    if [ "x${SMPI_PRETEND_CC}" = "x" ]; then
+       list_add LINKARGS "-shared"
+    else
+       echo "Warning: smpicc pretends to be a regular compiler (SMPI_PRETEND_CC is set). Produced binaries will not be usable in SimGrid."
+    fi
+    list_add LINKARGS "-lsimgrid" ${LINKER_UNDEFINED_ERROR:+"-Wl,-z,defs"}
 fi
 
 list_set CMDARGS
index 40ee29a..4039065 100644 (file)
@@ -19,8 +19,10 @@ list_set FFLAGS @SMPI_Fortran_FLAGS@
 list_set LINKARGS "-lsimgrid" @SMPI_Fortran_LIBS@ "-lm"
 if [ "x${SMPI_PRETEND_CC}" = "x" ]; then
    list_add LINKARGS "-shared"
-   if [ "@APPLE@" != "1" ]; then
+   if [ "x@APPLE@" != "x1" ]; then
        list_add LINKARGS "-Wl,-z,defs"
+   else
+       list_add LINKARGS "-Wl,-undefined,error"
    fi
 else
    echo "Warning: smpif90 pretends to be a regular compiler (SMPI_PRETEND_CC is set). Produced binaries will not be usable in SimGrid."
index a41a2f7..7c419de 100644 (file)
@@ -19,8 +19,10 @@ list_set FFLAGS @SMPI_Fortran_FLAGS@
 list_set LINKARGS "-lsimgrid" @SMPI_Fortran_LIBS@ "-lm"
 if [ "x${SMPI_PRETEND_CC}" = "x" ]; then
    list_add LINKARGS "-shared"
-   if [ "@APPLE@" != "1" ]; then
+   if [ "x@APPLE@" != "x1" ]; then
        list_add LINKARGS "-Wl,-z,defs"
+   else
+       list_add LINKARGS "-Wl,-undefined,error"
    fi 
 else
    echo "Warning: smpiff pretends to be a regular compiler (SMPI_PRETEND_CC is set). Produced binaries will not be usable in SimGrid."