Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Actually, pthreads are not mandatory (win32_ucontext is working)
[simgrid.git] / buildtools / Cmake / CompleteInFiles.cmake
index 79cebc2..ec44421 100644 (file)
@@ -75,10 +75,6 @@ TEST_BIG_ENDIAN(BIGENDIAN)
 include(FindGraphviz)
 include(FindLibSigc++)
 
-set(HAVE_GTNETS 0)
-if(enable_gtnets)
-  include(FindGTnets)
-endif()
 if(enable_java)
   find_package(Java REQUIRED COMPONENTS Runtime Development)
   find_package(JNI REQUIRED)
@@ -99,28 +95,68 @@ endif()
 if(enable_lua)
   include(FindLua51Simgrid)
 endif()
+
+set(HAVE_GTNETS 0)
+if(enable_gtnets)
+  include(FindGTnets)
+  if (NOT HAVE_GTNETS)
+    message(FATAL_ERROR "Cannot find GTNetS. Please install it, or disable that cmake option")
+  endif()
+endif()
 set(HAVE_NS3 0)
 if(enable_ns3)
   include(FindNS3)
+  if (NOT HAVE_NS3)
+    message(FATAL_ERROR "Cannot find NS3. Please install it (apt-get install ns3 libns3-dev) or disable that cmake option")
+  endif()
 endif()
 
-find_package(Boost REQUIRED)
+find_package(Boost 1.48)
 if(Boost_FOUND)
   include_directories(${Boost_INCLUDE_DIRS})
 else()
-  message(FATAL_ERROR, "Failed to find Boost libraries")
+  if(APPLE)
+    message(FATAL_ERROR "Failed to find Boost libraries (Try to install them with 'sudo fink install boost1.53.nopython')")
+  else()
+    message(FATAL_ERROR "Failed to find Boost libraries."
+                        "Did you install libboost-dev and libboost-context-dev?"
+                        "(libboost-context-dev is optional)")
+  endif()
+endif()
+
+# Try again to see if we have libboost-context
+find_package(Boost 1.42 COMPONENTS context)
+set(Boost_FOUND 1) # We don't care of whether this component is missing
+
+if(Boost_FOUND AND Boost_CONTEXT_FOUND)
+  # We should use feature detection for this instead:
+  if (Boost_VERSION LESS 105600)
+    message("Found Boost.Context API v1")
+    set(HAVE_BOOST_CONTEXT 1)
+  else()
+    message("Found Boost.Context API v2")
+    set(HAVE_BOOST_CONTEXT 2)
+  endif()
+else()
+  message ("   boost        : found.")
+  message ("   boost-context: missing. Install libboost-context-dev for this optional feature.")
+  set(HAVE_BOOST_CONTEXT 0)
 endif()
 
 # Checks for header libraries functions.
 CHECK_LIBRARY_EXISTS(dl      dlopen                  "" HAVE_DLOPEN_IN_LIBDL)
 CHECK_LIBRARY_EXISTS(execinfo backtrace              "" HAVE_BACKTRACE_IN_LIBEXECINFO)
-CHECK_LIBRARY_EXISTS(pthread pthread_create          "" pthread)
+CHECK_LIBRARY_EXISTS(pthread pthread_create          "" HAVE_PTHREAD)
 CHECK_LIBRARY_EXISTS(pthread sem_init                "" HAVE_SEM_INIT_LIB)
 CHECK_LIBRARY_EXISTS(pthread sem_open                "" HAVE_SEM_OPEN_LIB)
 CHECK_LIBRARY_EXISTS(pthread sem_timedwait           "" HAVE_SEM_TIMEDWAIT_LIB)
 CHECK_LIBRARY_EXISTS(pthread pthread_mutex_timedlock "" HAVE_MUTEX_TIMEDLOCK_LIB)
 CHECK_LIBRARY_EXISTS(rt      clock_gettime           "" HAVE_POSIX_GETTIME)
 
+if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
+  set(CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700 -D_DARWIN_C_SOURCE")
+endif()
+
 CHECK_INCLUDE_FILES("time.h;sys/time.h" TIME_WITH_SYS_TIME)
 CHECK_INCLUDE_FILES("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)
 CHECK_INCLUDE_FILE("pthread.h" HAVE_PTHREAD_H)
@@ -132,7 +168,7 @@ CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
 CHECK_INCLUDE_FILE("windows.h" HAVE_WINDOWS_H)
 CHECK_INCLUDE_FILE("winsock.h" HAVE_WINSOCK_H)
 CHECK_INCLUDE_FILE("winsock2.h" HAVE_WINSOCK2_H)
-CHECK_INCLUDE_FILE("WinDef.h" HAVE_WINDEF_H)
+CHECK_INCLUDE_FILE("windef.h" HAVE_WINDEF_H)
 CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H)
 CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
 CHECK_INCLUDE_FILE("execinfo.h" HAVE_EXECINFO_H)
@@ -163,6 +199,9 @@ CHECK_FUNCTION_EXISTS(asprintf HAVE_ASPRINTF)
 CHECK_FUNCTION_EXISTS(vasprintf HAVE_VASPRINTF)
 CHECK_FUNCTION_EXISTS(makecontext HAVE_MAKECONTEXT)
 CHECK_FUNCTION_EXISTS(mmap HAVE_MMAP)
+CHECK_FUNCTION_EXISTS(process_vm_readv HAVE_PROCESS_VM_READV)
+CHECK_FUNCTION_EXISTS(strdup SIMGRID_HAVE_STRDUP)
+CHECK_FUNCTION_EXISTS(_strdup SIMGRID_HAVE__STRDUP)
 
 #Check if __thread is defined
 execute_process(
@@ -189,6 +228,7 @@ else()
   SET(HAVE_MMALLOC 0)
 endif()
 
+
 if(WIN32) #THOSE FILES ARE FUNCTIONS ARE NOT DETECTED BUT THEY SHOULD...
   set(HAVE_UCONTEXT_H 1)
   set(HAVE_MAKECONTEXT 1)
@@ -198,13 +238,6 @@ endif()
 
 set(CONTEXT_UCONTEXT 0)
 SET(CONTEXT_THREADS 0)
-SET(HAVE_TRACING 1)
-
-if(enable_tracing)
-  SET(HAVE_TRACING 1)
-else()
-  SET(HAVE_TRACING 0)
-endif()
 
 if(enable_jedule)
   SET(HAVE_JEDULE 1)
@@ -243,10 +276,16 @@ else()
 endif()
 
 if(enable_smpi)
-  include(FindF2c)
-  # FindGFortran must come after FindF2C, and after having set HAVE_MC
   include(FindGFortran)
+  #really checks for objdump for privatization
+  find_package(BinUtils QUIET)
   SET(HAVE_SMPI 1)
+
+  if( NOT "${CMAKE_OBJDUMP}" MATCHES "CMAKE_OBJDUMP-NOTFOUND" AND HAVE_MMAP)
+    SET(HAVE_PRIVATIZATION 1)
+  else()
+    SET(HAVE_PRIVATIZATION 0)
+  endif()
 endif()
 
 #--------------------------------------------------------------------------------------------------
@@ -294,13 +333,13 @@ endif()
 #--------------------------------------------------------------------------------------------------
 ### Initialize of CONTEXT THREADS
 
-if(pthread)
+if(HAVE_PTHREAD)
   set(pthread 1)
 elseif(pthread)
   set(pthread 0)
 endif()
 
-if(pthread)
+if(HAVE_PTHREAD)
   ### Test that we have a way to create semaphores
 
   if(HAVE_SEM_OPEN_LIB)
@@ -309,6 +348,7 @@ if(pthread)
     OUTPUT_VARIABLE HAVE_SEM_OPEN_compil
     )
 
+    # Test sem_open by compiling:
     if(HAVE_SEM_OPEN_compil)
       set(HAVE_SEM_OPEN 0)
       message(STATUS "Warning: sem_open not compilable")
@@ -318,27 +358,29 @@ if(pthread)
       message(STATUS "sem_open is compilable")
     endif()
 
-    execute_process(COMMAND ./sem_open
-    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-    RESULT_VARIABLE HAVE_SEM_OPEN_run
-    OUTPUT_VARIABLE var_compil
-    )
-    file(REMOVE sem_open)
-
-    if(NOT HAVE_SEM_OPEN_run)
-      set(HAVE_SEM_OPEN 1)
-      message(STATUS "sem_open is executable")
-    else()
-      set(HAVE_SEM_OPEN 0)
-      if(EXISTS "${CMAKE_BINARY_DIR}/sem_open")
-        message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_open exists!")
+    # If we're not crosscompiling, we check by executing the program:
+    if (HAVE_SEM_OPEN AND NOT CMAKE_CROSSCOMPILING)
+      execute_process(COMMAND ./sem_open
+      WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+      RESULT_VARIABLE HAVE_SEM_OPEN_run
+      OUTPUT_VARIABLE var_compil
+      )
+      if (NOT HAVE_SEM_OPEN_run)
+        set(HAVE_SEM_OPEN 1)
+        message(STATUS "sem_open is executable")
       else()
-        message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_open not exists!")
+        set(HAVE_SEM_OPEN 0)
+        if(EXISTS "${CMAKE_BINARY_DIR}/sem_open")
+          message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_open exists!")
+        else()
+          message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_open not exists!")
+        endif()
+        message(STATUS "Warning: sem_open not executable")
+        message(STATUS "Compilation output: '${var_compil}'")
+        message(STATUS "Exit result of sem_open: ${HAVE_SEM_OPEN_run}")
       endif()
-      message(STATUS "Warning: sem_open not executable")
-      message(STATUS "Compilation output: '${var_compil}'")
-      message(STATUS "Exit result of sem_open: ${HAVE_SEM_OPEN_run}")
     endif()
+    file(REMOVE sem_open)
 
   else()
     set(HAVE_SEM_OPEN 0)
@@ -349,6 +391,7 @@ if(pthread)
     WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
     RESULT_VARIABLE HAVE_SEM_INIT_run OUTPUT_VARIABLE HAVE_SEM_INIT_compil)
 
+    # Test sem_init by compiling:
     if(HAVE_SEM_INIT_compil)
       set(HAVE_SEM_INIT 0)
       message(STATUS "Warning: sem_init not compilable")
@@ -357,28 +400,30 @@ if(pthread)
       set(HAVE_SEM_INIT 1)
       message(STATUS "sem_init is compilable")
     endif()
-    execute_process(COMMAND ./sem_init
-    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-    RESULT_VARIABLE HAVE_SEM_INIT_run
-    OUTPUT_VARIABLE var_compil
-    )
-    file(REMOVE sem_init)
-
 
-    if(NOT HAVE_SEM_INIT_run)
-      set(HAVE_SEM_INIT 1)
-      message(STATUS "sem_init is executable")
-    else()
-      set(HAVE_SEM_INIT 0)
-      if(EXISTS "${CMAKE_BINARY_DIR}/sem_init")
-        message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_init exists!")
+    # If we're not crosscompiling, we check by executing the program:
+    if (HAVE_SEM_INIT AND NOT CMAKE_CROSSCOMPILING)
+      execute_process(COMMAND ./sem_init
+      WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+      RESULT_VARIABLE HAVE_SEM_INIT_run
+      OUTPUT_VARIABLE var_compil
+      )
+      if (NOT HAVE_SEM_INIT_run)
+        set(HAVE_SEM_INIT 1)
+        message(STATUS "sem_init is executable")
       else()
-        message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_init not exists!")
+        set(HAVE_SEM_INIT 0)
+        if(EXISTS "${CMAKE_BINARY_DIR}/sem_init")
+          message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_init exists!")
+        else()
+          message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_init not exists!")
+        endif()
+        message(STATUS "Warning: sem_init not executable")
+        message(STATUS "Compilation output: '${var_compil}'")
+        message(STATUS "Exit result of sem_init: ${HAVE_SEM_INIT_run}")
       endif()
-      message(STATUS "Warning: sem_init not executable")
-      message(STATUS "Compilation output: '${var_compil}'")
-      message(STATUS "Exit result of sem_init: ${HAVE_SEM_INIT_run}")
     endif()
+    file(REMOVE sem_init)
   endif()
 
   if(NOT HAVE_SEM_OPEN AND NOT HAVE_SEM_INIT)
@@ -424,87 +469,38 @@ if(pthread)
   endif()
 endif()
 
-# AC_CHECK_MCSC(mcsc=yes, mcsc=no)
-set(mcsc_flags "")
+# This is needed for ucontext on MacOS X:
 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
-  set(mcsc_flags -D_XOPEN_SOURCE)
+  add_definitions(-D_XOPEN_SOURCE=700 -D_DARWIN_C_SOURCE)
 endif()
 
 if(WIN32)
-  if(ARCH_32_BITS)
-    set(mcsc_flags -D_XBT_WIN32 -D_I_X86_ -I${CMAKE_HOME_DIRECTORY}/src/include -I${CMAKE_HOME_DIRECTORY}/src/xbt)
-  else()
-    set(mcsc_flags -D_XBT_WIN32 -D_AMD64_ -I${CMAKE_HOME_DIRECTORY}/src/include -I${CMAKE_HOME_DIRECTORY}/src/xbt)
-  endif()
-endif()
-
-IF(CMAKE_CROSSCOMPILING)
-  IF(WIN32)
-    set(windows_context "yes")
-    set(IS_WINDOWS 1)
-  ENDIF()
-ELSE()
-  file(REMOVE "${CMAKE_BINARY_DIR}/testprog*")
-  file(REMOVE ${CMAKE_BINARY_DIR}/conftestval)
-  execute_process(COMMAND ${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c ${mcsc_flags} -o testprog
-  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/
-  OUTPUT_VARIABLE COMPILE_mcsc_VAR ERROR_VARIABLE COMPILE_mcsc_VAR)
-
-  if(NOT COMPILE_mcsc_VAR)
-    message(STATUS "prog_AC_CHECK_MCSC.c is compilable")
-    execute_process(COMMAND ./testprog
-    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/
-    OUTPUT_VARIABLE var_compil)
-  else()
-    message(STATUS "prog_AC_CHECK_MCSC.c is not compilable:\n${COMPILE_mcsc_VAR}")
-  endif()
-  file(REMOVE "${CMAKE_BINARY_DIR}/testprog*")
-
-  if(EXISTS "${CMAKE_BINARY_DIR}/conftestval")
-    file(READ "${CMAKE_BINARY_DIR}/conftestval" mcsc)
-    STRING(REPLACE "\n" "" mcsc "${mcsc}")
-    if(mcsc)
-      set(mcsc "yes")
-      set(HAVE_UCONTEXT_H 1)
-    else()
-      set(mcsc "no")
-    endif()
-  else()
-    set(mcsc "no")
-  endif()
-
-  message(STATUS "mcsc: ${mcsc}")
-ENDIF()
-
-if(mcsc MATCHES "no" AND pthread)
-  if(HAVE_WINDOWS_H)
-    set(windows_context "yes")
-    set(IS_WINDOWS 1)
-  elseif(HAVE_WINDOWS_H)
-    message(FATAL_ERROR "no appropriate backend found")
-  endif()
-endif()
-
-#Only windows
-
-if(WIN32)
-  if(NOT HAVE_WINDOWS_H)
-    message(FATAL_ERROR "no appropriate backend found windows")
-  endif()
-endif()
-
-if(windows_context MATCHES "yes")
-  message(STATUS "Context change to windows")
+  # We always provide our own implementation of ucontext on Windows.
+  try_compile(HAVE_UCONTEXT
+    ${CMAKE_BINARY_DIR}
+    ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c
+    COMPILE_DEFINITIONS _XBT_WIN32
+    INCLUDE_DIRECTORIES
+      ${CMAKE_HOME_DIRECTORY}/src/include
+      ${CMAKE_HOME_DIRECTORY}/src/xbt
+  )
+else()
+  # We always provide our own implementation of ucontext on Windows.
+  try_compile(HAVE_UCONTEXT
+    ${CMAKE_BINARY_DIR}
+    ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c)
 endif()
 
 #If can have both context
 
-if(mcsc)
+if(HAVE_UCONTEXT)
   set(CONTEXT_UCONTEXT 1)
+  message("-- Support for ucontext factory")
 endif()
 
-if(pthread)
+if(HAVE_PTHREAD)
   set(CONTEXT_THREADS 1)
+  message("-- Support for thread context factory")
 endif()
 
 ###############
@@ -542,21 +538,29 @@ if(EXISTS ${CMAKE_HOME_DIRECTORY}/.git/)
     string(REPLACE "\n" "" GIT_DATE "${GIT_DATE}")
     message(STATUS "Git date: ${GIT_DATE}")
     string(REGEX REPLACE " .*" "" GIT_VERSION "${GIT_VERSION}")
+    
+    execute_process(COMMAND git --git-dir=${CMAKE_HOME_DIRECTORY}/.git log --pretty=format:%H -1
+                    WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
+                   OUTPUT_VARIABLE SIMGRID_GITHASH
+                   RESULT_VARIABLE ret
+                   )
+    string(REPLACE "\n" "" SIMGRID_GITHASH "${SIMGRID_GITHASH}")
+                   
   endif()
 elseif(EXISTS ${CMAKE_HOME_DIRECTORY}/.gitversion)
   FILE(STRINGS ${CMAKE_HOME_DIRECTORY}/.gitversion GIT_VERSION)
 endif()
 
 if(release)
-  set(SIMGRID_VERSION_STRING "${SIMGRID_VERSION_STRING}\\nRelease build")
+  set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER}\\nRelease build")
 else()
-  set(SIMGRID_VERSION_STRING "${SIMGRID_VERSION_STRING}\\nDevelopment build")
+  set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER}\\nDevelopment build")
 endif()
 if(GIT_VERSION)
-  set(SIMGRID_VERSION_STRING "${SIMGRID_VERSION_STRING} at commit ${GIT_VERSION}")
+  set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER} at commit ${GIT_VERSION}")
 endif()
 if(GIT_DATE)
-  set(SIMGRID_VERSION_STRING "${SIMGRID_VERSION_STRING} (${GIT_DATE})")
+  set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER} (${GIT_DATE})")
 endif()
 #--------------------------------------------------------------------------------------------------
 
@@ -564,7 +568,7 @@ set(makecontext_CPPFLAGS_2 "")
 if(HAVE_MAKECONTEXT OR WIN32)
   set(makecontext_CPPFLAGS "-DTEST_makecontext")
   if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
-    set(makecontext_CPPFLAGS_2 "-D_XOPEN_SOURCE")
+    set(makecontext_CPPFLAGS_2 "-D_XOPEN_SOURCE=700")
   endif()
 
   if(WIN32)
@@ -578,11 +582,16 @@ if(HAVE_MAKECONTEXT OR WIN32)
 
   file(REMOVE ${CMAKE_BINARY_DIR}/conftestval)
 
-  try_run(RUN_makecontext_VAR COMPILE_makecontext_VAR
-    ${CMAKE_BINARY_DIR}
-    ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_stacksetup.c
-    COMPILE_DEFINITIONS "${makecontext_CPPFLAGS} ${makecontext_CPPFLAGS_2}"
-    )
+  if(CMAKE_CROSSCOMPILING)
+    set(RUN_makecontext_VAR "cross")
+    set(COMPILE_makecontext_VAR "cross")
+  else()
+    try_run(RUN_makecontext_VAR COMPILE_makecontext_VAR
+      ${CMAKE_BINARY_DIR}
+      ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_stacksetup.c
+      COMPILE_DEFINITIONS "${makecontext_CPPFLAGS} ${makecontext_CPPFLAGS_2}"
+      )
+  endif()
 
   if(EXISTS ${CMAKE_BINARY_DIR}/conftestval)
     file(READ ${CMAKE_BINARY_DIR}/conftestval MAKECONTEXT_ADDR_SIZE)
@@ -607,16 +616,23 @@ if (NOT CMAKE_CROSSCOMPILING)
   try_run(RUN_makecontext_VAR COMPILE_makecontext_VAR
     ${CMAKE_BINARY_DIR}
     ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_stackgrowth.c
+    RUN_OUTPUT_VARIABLE stack
     )
-  file(READ "${CMAKE_BINARY_DIR}/conftestval" stack)
-  if(stack MATCHES "down")
+endif()
+if("${stack}" STREQUAL "down")
+  set(PTH_STACKGROWTH "-1")
+elseif("${stack}" STREQUAL "up")
+  set(PTH_STACKGROWTH "1")
+else()
+  if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
     set(PTH_STACKGROWTH "-1")
+  elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686")
+    set(PTH_STACKGROWTH "-1")
+  else()
+    message(ERROR "Could not figure the stack direction.")
   endif()
-  if(stack MATCHES "up")
-    set(PTH_STACKGROWTH "1")
-  endif()
-
 endif()
+
 ###############
 ## System checks
 ##
@@ -627,18 +643,6 @@ endif()
 
 #AC_PROG_MAKE_SET
 
-#AC_PRINTF_NULL FIXME: this is too ancient to survive!
-try_run(RUN_PRINTF_NULL_VAR COMPILE_PRINTF_NULL_VAR
-  ${CMAKE_BINARY_DIR}
-  ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_printf_null.c
-  )
-
-if(RUN_PRINTF_NULL_VAR MATCHES "FAILED_TO_RUN")
-  SET(PRINTF_NULL_WORKING "0")
-else()
-  SET(PRINTF_NULL_WORKING "1")
-endif()
-
 #AC_CHECK_VA_COPY
 
 set(diff_va "va_copy((d),(s))"
@@ -834,16 +838,15 @@ set(CMAKE_SMPI_COMMAND "export LD_LIBRARY_PATH=\"${CMAKE_INSTALL_PREFIX}/lib")
 if(GTNETS_LIB_PATH)
   set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${GTNETS_LIB_PATH}")
 endif()
-if(HAVE_NS3_LIB)
-  set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${HAVE_NS3_LIB}")
+if(NS3_LIBRARY_PATH)
+  set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${NS3_LIBRARY_PATH}")
 endif()
 set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:\${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}\"")
 
 file(READ ${CMAKE_HOME_DIRECTORY}/src/smpi/smpitools.sh SMPITOOLS_SH)
 configure_file(${CMAKE_HOME_DIRECTORY}/include/smpi/mpif.h.in ${CMAKE_BINARY_DIR}/include/smpi/mpif.h @ONLY)
-configure_file(${CMAKE_HOME_DIRECTORY}/include/smpi/smpif.h.in ${CMAKE_BINARY_DIR}/include/smpi/smpif.h @ONLY)
 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicc.in ${CMAKE_BINARY_DIR}/bin/smpicc @ONLY)
-configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpif2c.in ${CMAKE_BINARY_DIR}/bin/smpif2c @ONLY)
+configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicxx.in ${CMAKE_BINARY_DIR}/bin/smpicxx @ONLY)
 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpiff.in ${CMAKE_BINARY_DIR}/bin/smpiff @ONLY)
 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpif90.in ${CMAKE_BINARY_DIR}/bin/smpif90 @ONLY)
 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpirun.in ${CMAKE_BINARY_DIR}/bin/smpirun @ONLY)
@@ -857,14 +860,14 @@ set(CMAKE_SMPI_COMMAND "export LD_LIBRARY_PATH=\"${CMAKE_BINARY_DIR}/lib")
 if(GTNETS_LIB_PATH)
   set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${GTNETS_LIB_PATH}")
 endif()
-if(HAVE_NS3_LIB)
-  set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${HAVE_NS3_LIB}")
+if(NS3_LIBRARY_PATH)
+  set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${NS3_LIBRARY_PATH}")
 endif()
 set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:\${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}\"")
 set(libdir "${CMAKE_BINARY_DIR}/lib")
 
 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicc.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc @ONLY)
-configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpif2c.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpif2c @ONLY)
+configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicxx.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicxx @ONLY)
 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpiff.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpiff @ONLY)
 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpif90.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpif90 @ONLY)
 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpirun.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun @ONLY)
@@ -873,12 +876,12 @@ set(top_builddir ${CMAKE_HOME_DIRECTORY})
 
 if(NOT WIN32)
   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpicc)
-  execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpif2c)
+  execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpicxx)
   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpiff)
   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpif90)
   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpirun)
   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc)
-  execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpif2c)
+  execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicxx)
   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpiff)
   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpif90)
   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun)
@@ -886,7 +889,6 @@ endif()
 
 set(generated_headers_to_install
   ${CMAKE_CURRENT_BINARY_DIR}/include/smpi/mpif.h
-  ${CMAKE_CURRENT_BINARY_DIR}/include/smpi/smpif.h
   ${CMAKE_CURRENT_BINARY_DIR}/include/simgrid_config.h
   )
 
@@ -899,7 +901,7 @@ set(generated_files_to_clean
   ${generated_headers}
   ${generated_headers_to_install}
   ${CMAKE_BINARY_DIR}/bin/smpicc
-  ${CMAKE_BINARY_DIR}/bin/smpif2c
+  ${CMAKE_BINARY_DIR}/bin/smpicxx
   ${CMAKE_BINARY_DIR}/bin/smpiff
   ${CMAKE_BINARY_DIR}/bin/smpif90
   ${CMAKE_BINARY_DIR}/bin/smpirun
@@ -908,11 +910,7 @@ set(generated_files_to_clean
   ${CMAKE_BINARY_DIR}/examples/smpi/tracing/smpi_traced.trace
   )
 
-if("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_HOME_DIRECTORY}")
-else()
-  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/hostfile ${CMAKE_BINARY_DIR}/examples/smpi/hostfile COPYONLY)
-  configure_file(${CMAKE_HOME_DIRECTORY}/examples/msg/small_platform.xml ${CMAKE_BINARY_DIR}/examples/msg/small_platform.xml COPYONLY)
-  configure_file(${CMAKE_HOME_DIRECTORY}/examples/msg/small_platform_with_routers.xml ${CMAKE_BINARY_DIR}/examples/msg/small_platform_with_routers.xml COPYONLY)
+if(NOT "${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_HOME_DIRECTORY}")
   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions0.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions0.txt COPYONLY)
   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions1.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions1.txt COPYONLY)
   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_allReduce.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allReduce.txt COPYONLY)
@@ -926,12 +924,45 @@ else()
   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_gather.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_gather.txt COPYONLY)
   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_allgatherv.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allgatherv.txt COPYONLY)
   configure_file(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/hostfile ${CMAKE_BINARY_DIR}/teshsuite/smpi/hostfile COPYONLY)
+  
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/description_file ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/description_file COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/README ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/README COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/smpi_replay.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/smpi_replay.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace0.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace0.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace1.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace1.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace2.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace2.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace3.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace3.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace4.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace4.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace5.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace5.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace6.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace6.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace7.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace7.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace8.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace8.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace9.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace9.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace10.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace10.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace11.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace11.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace12.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace12.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace13.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace13.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace14.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace14.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace15.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace15.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace16.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace16.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace17.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace17.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace18.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace18.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace19.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace19.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace20.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace20.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace21.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace21.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace22.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace22.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace23.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace23.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace24.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace24.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace25.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace25.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace26.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace26.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace27.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace27.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace28.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace28.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace29.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace29.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace30.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace30.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace31.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace31.txt COPYONLY)
 
   set(generated_files_to_clean
     ${generated_files_to_clean}
-    ${CMAKE_BINARY_DIR}/examples/smpi/hostfile
-    ${CMAKE_BINARY_DIR}/examples/msg/small_platform.xml
-    ${CMAKE_BINARY_DIR}/examples/msg/small_platform_with_routers.xml
     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions0.txt
     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions1.txt
     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allReduce.txt
@@ -941,7 +972,45 @@ else()
     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_alltoall.txt
     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_alltoallv.txt
     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_waitall.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_gather.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allgatherv.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_reducescatter.txt
     ${CMAKE_BINARY_DIR}/teshsuite/smpi/hostfile
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/description_file
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/README
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/smpi_replay.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace0.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace1.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace2.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace3.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace4.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace5.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace6.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace7.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace8.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace9.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace10.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace11.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace12.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace13.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace14.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace15.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace16.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace17.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace18.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace19.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace20.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace21.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace22.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace23.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace24.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace25.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace26.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace27.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace28.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace29.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace30.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace31.txt
     )
 endif()