Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Set SIMGRID NEED GETLINE for Mac.
[simgrid.git] / buildtools / CPACK / src / CMakeCompleteInFiles.txt
index 8d995c5..d5b7097 100644 (file)
@@ -28,11 +28,13 @@ endif(disable_java)
 if(disable_gtnets)
        SET(HAVE_GTNETS 0)
 else(disable_gtnets)
+       SET(BUILDNAME "GTNETS" CACHE TYPE INTERNAL FORCE)
        set(GTNETS_LDFLAGS "-lgtnets -L${gtnets_path}/lib")
-       set(GTNETS_CPPFLAGS "-I${gtnets_path}/include -I${gtnets_path}/include/gtnets")
+       set(GTNETS_CPPFLAGS "-I${gtnets_path}/include/gtnets")
        exec_program("${CMAKE_CXX_COMPILER} ${GTNETS_CPPFLAGS} ${GTNETS_LDFLAGS} ${PROJECT_DIRECTORY}/CPACK/prog_test/prog_gtnets.cpp" OUTPUT_VARIABLE COMPILE_GTNETS_VAR)      
        if(COMPILE_GTNETS_VAR)
                SET(HAVE_GTNETS 0)
+               message("GTnetS doesn't works : set -Ddisable_gtnets=on")
        else(COMPILE_GTNETS_VAR)
                SET(HAVE_GTNETS 1)
                set(INCLUDES
@@ -94,20 +96,24 @@ if(pthread MATCHES "yes")
 endif(pthread MATCHES "yes")
 
 # AC_CHECK_MCSC(mcsc=yes, mcsc=no) 
+set(mcsc_flags "")
+if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
+       set(mcsc_flags "-D_XOPEN_SOURCE")
+endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
+
 try_run(RUN_mcsc_VAR COMPILE_mcsc_VAR
        ${PROJECT_DIRECTORY}
        ${PROJECT_DIRECTORY}/CPACK/prog_test/prog_AC_CHECK_MCSC.c
+       COMPILE_DEFINITIONS "${mcsc_flags}"
        )
-
 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)
@@ -116,57 +122,60 @@ if(mcsc MATCHES "no" AND pthread MATCHES "no")
        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")
+                       message("with_context ucontext change to windows")
+               else(windows_context MATCHES "yes")
+                       set(with_context "pthread")
+                       message("with_context ucontext change to 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}")
@@ -309,30 +318,25 @@ SET(SIZEOF_MAX ${var3})
 
 CHECK_FUNCTION_EXISTS(makecontext HAVE_MAKECONTEXT)
 #message("HAVE_MAKECONTEXT ${HAVE_MAKECONTEXT}")
-
+set(makecontext_CPPFLAGS_2 "")
 if(HAVE_MAKECONTEXT)
        set(makecontext_CPPFLAGS "-DTEST_makecontext")
        if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
                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}
+               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("${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")
-       #message("${makecontext_addr}")
-       #message("${makecontext_size}")
+       message("${makecontext_addr}")
+       message("${makecontext_size}")
        set(pth_skaddr_makecontext "#define pth_skaddr_makecontext(skaddr,sksize) (${makecontext_addr})")
        set(pth_sksize_makecontext "#define pth_sksize_makecontext(skaddr,sksize) (${makecontext_size})")
 
@@ -534,11 +538,11 @@ try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR
        OUTPUT_VARIABLE GETLINE_OUTPUT
        )
 
-if(RUN_RESULT_VAR MATCHES "FAILED_TO_RUN")
-SET(need_getline "")
-else(RUN_RESULT_VAR MATCHES "FAILED_TO_RUN")
+if(RUN_RESULT_VAR MATCHES "FAILED_TO_RUN" OR NOT COMPILE_RESULT_VAR)
 SET(need_getline "#define SIMGRID_NEED_GETLINE 1")
-endif(RUN_RESULT_VAR MATCHES "FAILED_TO_RUN")
+else(RUN_RESULT_VAR MATCHES "FAILED_TO_RUN" OR NOT COMPILE_RESULT_VAR)
+SET(need_getline "")
+endif(RUN_RESULT_VAR MATCHES "FAILED_TO_RUN" OR NOT COMPILE_RESULT_VAR)
 
 ### check for a working snprintf
 CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF)