From: navarrop Date: Mon, 6 Dec 2010 13:36:12 +0000 (+0000) Subject: Now take context pthread and ucontext if it is possible. X-Git-Tag: v3.6_beta2~913 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/4ba8fa73394ad3a5649ab15eebc39606983c4a1c Now take context pthread and ucontext if it is possible. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9010 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/buildtools/Cmake/CompleteInFiles.cmake b/buildtools/Cmake/CompleteInFiles.cmake index c8e72265ad..be1ac6ad22 100644 --- a/buildtools/Cmake/CompleteInFiles.cmake +++ b/buildtools/Cmake/CompleteInFiles.cmake @@ -207,55 +207,29 @@ if(with_context MATCHES "ucontext" AND mcsc MATCHES "no") message(FATAL_ERROR "-Dwith-context=ucontext specified but ucontext unusable.") endif(with_context MATCHES "ucontext" AND mcsc MATCHES "no") -set(with_context_ok 0) +#Only windows + if(with_context MATCHES "windows") - set(with_context_ok 1) if(NOT HAVE_WINDOWS_H) message(FATAL_ERROR "no appropriate backend found windows") endif(NOT HAVE_WINDOWS_H) endif(with_context MATCHES "windows") -if(with_context MATCHES "pthreads") - set(with_context_ok 1) - set(with_context "pthread") -endif(with_context MATCHES "pthreads") - -if(with_context MATCHES "auto") - set(with_context_ok 1) - set(with_context "ucontext") - message(STATUS "With_context auto change to ucontext") -endif(with_context MATCHES "auto") - -if(with_context MATCHES "ucontext") - set(with_context_ok 1) - if(mcsc) - set(CONTEXT_UCONTEXT 1) - else(mcsc) - if(windows_context MATCHES "yes") - set(with_context "windows") - message(STATUS "With_context ucontext change to windows") - else(windows_context MATCHES "yes") - set(with_context "pthread") - message(STATUS "With_context ucontext change to pthread") - endif(windows_context MATCHES "yes") - endif(mcsc) -endif(with_context MATCHES "ucontext") - -if(with_context MATCHES "pthread") - set(with_context_ok 1) - if(NOT pthread) - message(FATAL_ERROR "Cannot find pthreads (try -Dwith_context=ucontext if you haven't already tried).") - endif(NOT pthread) - SET(CONTEXT_THREADS 1) -endif(with_context MATCHES "pthread") - -if(with_context MATCHES "ucontext") - SET(CONTEXT_THREADS 0) -endif(with_context MATCHES "ucontext") - -if(NOT with_context_ok) - message(FATAL_ERROR "-Dwith-context must be either ucontext or pthread") -endif(NOT with_context_ok) +if(windows_context MATCHES "yes") + set(with_context "windows") + message(STATUS "Context change to windows") +endif(windows_context MATCHES "yes") + +#If can have both context + +if(mcsc) + set(CONTEXT_UCONTEXT 1) +endif(mcsc) + +if(pthread) + set(CONTEXT_THREADS 1) +endif(pthread) + ############### ## SVN version check diff --git a/buildtools/Cmake/DefinePackages.cmake b/buildtools/Cmake/DefinePackages.cmake index 7936f935e1..5d2422adf8 100644 --- a/buildtools/Cmake/DefinePackages.cmake +++ b/buildtools/Cmake/DefinePackages.cmake @@ -396,38 +396,32 @@ set(install_HEADERS ) ### depend of some variables setted upper -# -->CONTEXT_THREADS +# -->CONTEXT_THREADS CONTEXT_UCONTEXT if(${CONTEXT_THREADS}) #pthread set(SURF_SRC ${SURF_SRC} src/xbt/xbt_os_thread.c src/simix/smx_context_thread.c - ) + ) +else(${CONTEXT_THREADS}) # NOT pthread set(EXTRA_DIST ${EXTRA_DIST} - src/simix/smx_context_sysv.c - ) -else(${CONTEXT_THREADS}) #ucontext + src/xbt/xbt_os_thread.c + src/simix/smx_context_thread.c + ) +endif(${CONTEXT_THREADS}) + +if(${CONTEXT_UCONTEXT}) #ucontext set(SURF_SRC ${SURF_SRC} src/simix/smx_context_sysv.c ) - - if(WIN32) - set(SURF_SRC - ${SURF_SRC} - src/xbt/xbt_os_thread.c - src/simix/smx_context_thread.c) - else(WIN32) - set(EXTRA_DIST - ${EXTRA_DIST} - src/xbt/xbt_os_thread.c - src/simix/smx_context_thread.c) - endif(WIN32) -endif(${CONTEXT_THREADS}) - - - +else(${CONTEXT_UCONTEXT}) # NOT ucontext + set(EXTRA_DIST + ${EXTRA_DIST} + src/simix/smx_context_sysv.c + ) +endif(${CONTEXT_UCONTEXT}) # -->HAVE_GTNETS if(HAVE_GTNETS) diff --git a/buildtools/Cmake/MakeExeLib.cmake b/buildtools/Cmake/MakeExeLib.cmake index 12e431e1c5..31e5286ac5 100644 --- a/buildtools/Cmake/MakeExeLib.cmake +++ b/buildtools/Cmake/MakeExeLib.cmake @@ -90,9 +90,9 @@ if(HAVE_RUBY) endif(HAVE_RUBY) if(pthread) - if(with_context MATCHES pthread) + if(${CONTEXT_THREADS}) SET(SIMGRID_DEP "${SIMGRID_DEP} -lpthread") - endif(with_context MATCHES pthread) + endif(${CONTEXT_THREADS}) endif(pthread) if(HAVE_LUA) diff --git a/buildtools/Cmake/PrintArgs.cmake b/buildtools/Cmake/PrintArgs.cmake index 190f03945a..4a40d78102 100644 --- a/buildtools/Cmake/PrintArgs.cmake +++ b/buildtools/Cmake/PrintArgs.cmake @@ -85,6 +85,9 @@ if(enable_print_message) message("HAVE_ASPRINTF ${HAVE_ASPRINTF}") message("HAVE_VASPRINTF ${HAVE_VASPRINTF}") message("HAVE_MMAP ${HAVE_MMAP}") + message("") + message("CONTEXT_THREADS ${CONTEXT_THREADS}") + message("CONTEXT_UCONTEXT ${CONTEXT_UCONTEXT}") message("________________________________________________________________________________") message("________________________________________________________________________________ DEBUG END") message("")