Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Stick with brutal C-style casts (and fix compilation errors).
[simgrid.git] / src / smpi / smpiff.in
index 91f1afe..a642099 100644 (file)
@@ -19,6 +19,13 @@ 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 [ "x${SMPI_NO_UNDEFINED_CHECK}" = "x" ]; then
+     if [ "x@APPLE@" != "x1" ]; then
+       list_add LINKARGS "-Wl,-z,defs"
+     else
+       list_add LINKARGS "-Wl,-undefined,error"
+     fi
+   fi
 else
    echo "Warning: smpiff pretends to be a regular compiler (SMPI_PRETEND_CC is set). Produced binaries will not be usable in SimGrid."
 fi
@@ -33,13 +40,17 @@ trap 'cleanup' EXIT
 
 filter_and_compile_f77() {
     list_add TMPFILES "${TMPFILE}"
-    #replace "program main_name by subroutine user_main (and the end clause as well)"
-    if [ $TRACE_CALL_LOCATION -gt 0 ]; then
-      echo "#include \"@includedir@/smpi/smpi_extended_traces_fortran.h\"" > ${TMPFILE}
-      echo "#line 1 \"${ARG}\"" >> ${TMPFILE}
+    if [ "x${SMPI_PRETEND_CC}" = "x" ]; then
+      #replace "program main_name by subroutine user_main (and the end clause as well)"
+      if [ $TRACE_CALL_LOCATION -gt 0 ]; then
+        echo "#include \"@includedir@/smpi/smpi_extended_traces_fortran.h\"" > ${TMPFILE}
+        echo "#line 1 \"${ARG}\"" >> ${TMPFILE}
+      fi
+      sed 's/^[[:space:]]\{6\}[[:space:]]*\([eE][nN][dD] \)\{0,1\}[pP][rR][oO][gG][rR][aA][mM][^a-zA-Z0-9]*\([a-zA-Z0-9_]*\)/      \1subroutine user_main /g' "${ARG}" >> "${TMPFILE}"
+      SRCFILE="${TMPFILE}"
+    else
+      SRCFILE="${ARG}"
     fi
-    sed 's/^[[:space:]]\{6\}[[:space:]]*\([eE][nN][dD] \)\{0,1\}[pP][rR][oO][gG][rR][aA][mM][^a-zA-Z0-9]*\([a-zA-Z0-9_]*\)/      \1subroutine user_main /g' "${ARG}" >> "${TMPFILE}"
-    SRCFILE="${TMPFILE}"
     list_add CMDLINE "${SRCFILE}"
 }
 filter_and_compile_f90() {