${PROJECT_DIRECTORY}
${PROJECT_DIRECTORY}/CPACK/prog_test/prog_AC_CHECK_MCSC.c
)
-
file(READ "${PROJECT_DIRECTORY}/conftestval" mcsc)
if(mcsc MATCHES "yes")
set(mcsc "yes")
elseif(mcsc MATCHES "yes")
set(mcsc "no")
endif(mcsc MATCHES "yes")
-
+CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H)
if(mcsc MATCHES "no" AND pthread MATCHES "no")
- CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H)
if(HAVE_WINDOWS_H)
set(windows_context "yes")
set(IS_WINDOWS 1)
endif(HAVE_WINDOWS_H)
endif(mcsc MATCHES "no" AND pthread MATCHES "no")
-if(NOT disable_context AND with_context MATCHES "ucontext" AND mcsc MATCHES "no")
+if(with_context MATCHES "ucontext" AND mcsc MATCHES "no")
message(FATAL_ERROR "-Dwith-context=ucontext specified but ucontext unusable.")
-endif(NOT disable_context AND with_context MATCHES "ucontext" AND mcsc MATCHES "no")
-
-if(NOT disable_context)
- set(with_context_ok 0)
- if(with_context MATCHES "windows")
- set(with_context_ok 1)
- 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("with_context auto change to ucontext")
- endif(with_context MATCHES "auto")
-
- if(with_context MATCHES "ucontext")
- set(with_context_ok 1)
- if(mcsc MATCHES "yes")
- set(CONTEXT_UCONTEXT 1)
- CHECK_INCLUDE_FILE(valgrind/valgrind.h HAVE_VALGRIND_VALGRIND_H)
- else(mcsc MATCHES "yes")
- if(windows_context MATCHES "yes")
- set(with_context "windows")
- else(windows_context MATCHES "yes")
- set(with_context "pthread")
- endif(windows_context MATCHES "yes")
- endif(mcsc MATCHES "yes")
- endif(with_context MATCHES "ucontext")
-
- if(with_context MATCHES "pthread")
- set(with_context_ok 1)
- if(pthread MATCHES "no")
- message(FATAL_ERROR "Cannot find pthreads (try -Dwith_context=ucontext if you haven't already tried).")
- endif(pthread MATCHES "no")
- 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)
-endif(NOT disable_context)
+endif(with_context MATCHES "ucontext" AND mcsc MATCHES "no")
+
+set(with_context_ok 0)
+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("with_context auto change to ucontext")
+endif(with_context MATCHES "auto")
+
+if(with_context MATCHES "ucontext")
+ set(with_context_ok 1)
+ if(mcsc MATCHES "yes")
+ set(CONTEXT_UCONTEXT 1)
+ CHECK_INCLUDE_FILE(valgrind/valgrind.h HAVE_VALGRIND_VALGRIND_H)
+ else(mcsc MATCHES "yes")
+ if(windows_context MATCHES "yes")
+ set(with_context "windows")
+ else(windows_context MATCHES "yes")
+ set(with_context "pthread")
+ endif(windows_context MATCHES "yes")
+ endif(mcsc MATCHES "yes")
+endif(with_context MATCHES "ucontext")
+
+if(with_context MATCHES "pthread")
+ set(with_context_ok 1)
+ if(pthread MATCHES "no")
+ message(FATAL_ERROR "Cannot find pthreads (try -Dwith_context=ucontext if you haven't already tried).")
+ endif(pthread MATCHES "no")
+ 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)
#message("CONTEXT_THREADS ${CONTEXT_THREADS}")
set(makecontext_CPPFLAGS_2 "-DOSX")
#message("SYSTEM OSX")
endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
- try_run(RUN_makecontext_VAR COMPILE_makecontext_VAR
- ${PROJECT_DIRECTORY}
- ${PROJECT_DIRECTORY}/CPACK/prog_test/prog_stacksetup.c
- COMPILE_DEFINITIONS ${makecontext_CPPFLAGS} ${makecontext_CPPFLAGS_2}
- )
- find_program(CAT_EXE NAMES cat)
- if(COMPILE_makecontext_VAR)
- set(makecontext_type "ok")
- elseif(COMPILE_makecontext_VAR)
- set(makecontext_type "guessed")
- endif(COMPILE_makecontext_VAR)
+ exec_program("${CMAKE_C_COMPILER} ${PROJECT_DIRECTORY}/CPACK/prog_test/prog_stacksetup.c ${makecontext_CPPFLAGS} ${makecontext_CPPFLAGS_2}" OUTPUT_VARIABLE COMPILE_makecontext_VAR)
+ exec_program("${PROJECT_DIRECTORY}/CPACK/prog_test/a.out" OUTPUT_VARIABLE COMPILE_makecontext_VAR)
+
+ find_program(CAT_EXE NAMES cat)
exec_program("${SED_EXE}" ARGS "-e 's;,.*$;;' ${PROJECT_DIRECTORY}/conftestval" OUTPUT_VARIABLE "makecontext_addr")
exec_program("${SED_EXE}" ARGS "-e 's;^.*,;;' ${PROJECT_DIRECTORY}/conftestval" OUTPUT_VARIABLE "makecontext_size")