Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add context ucontext for windows.
authornavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 15 Jun 2010 13:00:41 +0000 (13:00 +0000)
committernavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 15 Jun 2010 13:00:41 +0000 (13:00 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7860 48e7efb5-ca39-0410-a469-dd3cf9ba447f

buildtools/Cmake/CompleteInFiles.cmake
buildtools/Cmake/Option.cmake
buildtools/Cmake/gras_config.h.in
buildtools/Cmake/test_prog/prog_stacksetup.c
src/simix/smx_context_sysv.c
src/surf/surf.c
src/win32/compiler/visualc.h

index e5b01d7..168aff8 100644 (file)
@@ -34,6 +34,7 @@ CHECK_INCLUDE_FILE(memory.h HAVE_MEMORY_H)
 CHECK_INCLUDE_FILE(stdlib.h HAVE_STDLIB_H)
 CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
 CHECK_INCLUDE_FILE(string.h HAVE_STRING_H)
+CHECK_INCLUDE_FILE(ucontext.h HAVE_UCONTEXT_H)
 
 CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
 CHECK_FUNCTION_EXISTS(usleep HAVE_USLEEP)
@@ -49,6 +50,11 @@ CHECK_FUNCTION_EXISTS(vasprintf HAVE_VASPRINTF)
 CHECK_FUNCTION_EXISTS(makecontext HAVE_MAKECONTEXT)
 CHECK_FUNCTION_EXISTS(mmap HAVE_MMAP)
 
+if(WIN32)
+    set(HAVE_UCONTEXT_H 1)
+    set(HAVE_MAKECONTEXT 1)
+endif(WIN32)
+
 set(CONTEXT_UCONTEXT 0)
 SET(CONTEXT_THREADS 0)
 SET(HAVE_RUBY 0)
@@ -360,8 +366,6 @@ if(IS_DIRECTORY ${PROJECT_DIRECTORY}/.git)
        STRING(REPLACE " +0000" "" GIT_DATE ${GIT_DATE})
        STRING(REPLACE " " "~" GIT_DATE ${GIT_DATE})
        STRING(REPLACE ":" "-" GIT_DATE ${GIT_DATE})
-       message("GIT_DATE       : ${GIT_DATE}")
-       message("GIT_VERSION    : ${GIT_VERSION}")
        foreach(line ${GIT_SVN_VERSION})
                string(REGEX MATCH "^Revision:.*" line_good ${line})
                if(line_good)
@@ -369,7 +373,6 @@ if(IS_DIRECTORY ${PROJECT_DIRECTORY}/.git)
                        set(SVN_VERSION ${line_good})
                endif(line_good)
        endforeach(line ${GIT_SVN_VERSION})
-       message("GIT_SVN_VERSION : ${SVN_VERSION}")
 endif(IS_DIRECTORY ${PROJECT_DIRECTORY}/.git)
 
 ###################################
@@ -471,20 +474,22 @@ SET(SIZEOF_MAX ${var3})
 #--------------------------------------------------------------------------------------------------
 
 set(makecontext_CPPFLAGS_2 "")
-if(HAVE_MAKECONTEXT)
+if(HAVE_MAKECONTEXT OR WIN32)
        set(makecontext_CPPFLAGS "-DTEST_makecontext")
        if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
                set(makecontext_CPPFLAGS_2 "-DOSX")
        endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
+       
+       if(WIN32)
+           set(makecontext_CPPFLAGS_2 "-DWIN32 ${INCLUDES}")
+       endif(WIN32)
 
        try_run(RUN_makecontext_VAR COMPILE_makecontext_VAR
                ${PROJECT_DIRECTORY}
                ${PROJECT_DIRECTORY}/buildtools/Cmake/test_prog/prog_stacksetup.c
                COMPILE_DEFINITIONS "${makecontext_CPPFLAGS} ${makecontext_CPPFLAGS_2}"
                )
-       
        file(READ ${simgrid_BINARY_DIR}/conftestval MAKECONTEXT_ADDR_SIZE)
-       message("MAKECONTEXT_ADDR_SIZE : ${MAKECONTEXT_ADDR_SIZE}")
        string(REPLACE "\n" "" MAKECONTEXT_ADDR_SIZE "${MAKECONTEXT_ADDR_SIZE}")
        string(REGEX MATCH ;^.*,;MAKECONTEXT_ADDR "${MAKECONTEXT_ADDR_SIZE}")
        string(REGEX MATCH ;,.*$; MAKECONTEXT_SIZE "${MAKECONTEXT_ADDR_SIZE}")
@@ -493,7 +498,7 @@ if(HAVE_MAKECONTEXT)
        set(pth_skaddr_makecontext "#define pth_skaddr_makecontext(skaddr,sksize) (${makecontext_addr})")
        set(pth_sksize_makecontext "#define pth_sksize_makecontext(skaddr,sksize) (${makecontext_size})")
 
-endif(HAVE_MAKECONTEXT)
+endif(HAVE_MAKECONTEXT OR WIN32)
 
 #--------------------------------------------------------------------------------------------------
 
index d425823..2177b3f 100644 (file)
@@ -40,7 +40,6 @@ if(WIN32) #actually not enable with windows
        message("Mode supernovae and maintainer disable with Windows.")
        set(enable_supernovae false CACHE TYPE INTERNAL FORCE)
        set(enable_maintainer_mode false CACHE TYPE INTERNAL FORCE)
-       set(with_context "windows" CACHE TYPE INTERNAL FORCE)
 endif(WIN32)
 
 mark_as_advanced(enable_coverage)
index 5d0d6a2..ba3c427 100644 (file)
@@ -44,6 +44,9 @@
 /* Define if xbt contexts are based on our threads implementation or not */
 #cmakedefine CONTEXT_THREADS @CONTEXT_THREADS@
 
+/* Define to 1 if you have the <ucontext.h> header file. */
+#cmakedefine HAVE_UCONTEXT_H @HAVE_UCONTEXT_H@
+
 /* Define if xbt contexts are based on ucontext or not */
 #cmakedefine CONTEXT_UCONTEXT @CONTEXT_UCONTEXT@
 
index 102645e..8bad94a 100644 (file)
@@ -7,6 +7,12 @@
 #if defined OSX
 #define _XOPEN_SOURCE
 #endif
+
+#ifdef WIN32
+       #include "ucontext.h"
+       #include "ucontext.c"
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 9f07c24..775db1c 100644 (file)
@@ -6,12 +6,19 @@
  /* This program is free software; you can redistribute it and/or modify it
   * under the terms of the license (GNU LGPL) which comes with this package. */
 
+
+
 #include "smx_context_sysv_private.h"
 
 #ifdef HAVE_VALGRIND_VALGRIND_H
 #  include <valgrind/valgrind.h>
 #endif /* HAVE_VALGRIND_VALGRIND_H */
 
+#ifdef WIN32
+       #include "ucontext.h"
+       #include "ucontext.c"
+#endif
+
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_context);
 
 static smx_context_t 
index a670cc1..427af07 100644 (file)
@@ -245,7 +245,7 @@ XBT_LOG_EXTERNAL_CATEGORY(surf_parse);
 XBT_LOG_EXTERNAL_CATEGORY(surf_timer);
 XBT_LOG_EXTERNAL_CATEGORY(surf_workstation);
 XBT_LOG_EXTERNAL_CATEGORY(surf_config);
-XBT_LOG_EXTERNAL_CATEGORY(surf_routing);
+XBT_LOG_EXTERNAL_CATEGORY(surf_route);
 
 
 #ifdef HAVE_GTNETS
@@ -266,7 +266,7 @@ void surf_init(int *argc, char **argv)
   XBT_LOG_CONNECT(surf_timer, surf);
   XBT_LOG_CONNECT(surf_workstation, surf);
   XBT_LOG_CONNECT(surf_config, surf);
-  XBT_LOG_CONNECT(surf_routing, surf);
+  XBT_LOG_CONNECT(surf_route, surf);
 
 #ifdef HAVE_GTNETS
   XBT_LOG_CONNECT(surf_network_gtnets, surf);
index cd6d117..6844375 100644 (file)
@@ -381,6 +381,10 @@ the double. For now, GRAS requires the structures to be compacted. */
        #define va_copy(d, s) __VA_COPY_USE(d, s)
        #endif
 
+       /* Define to id of used va_copy() implementation */
+       #ifndef __VA_COPY_USE
+               #define __VA_COPY_USE __VA_COPY_USE_C99
+       #endif
 #endif
 
 /* xbt contexts are based on our threads implementation */
@@ -388,15 +392,12 @@ the double. For now, GRAS requires the structures to be compacted. */
 #define CONTEXT_THREADS 1
 #endif
 
+
 /* xbt contexts are not based on ucontext */
 #ifdef CONTEXT_UCONTEXT
 #undef CONTEXT_UCONTEXT
 #endif
 
-/* Define to id of used va_copy() implementation */
-#ifndef __VA_COPY_USE
-       #define __VA_COPY_USE __VA_COPY_USE_C99
-#endif
 
 #ifndef _XBT_CALL
        #if defined(_XBT_DESIGNATED_DLL)