Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a verification on pcre.h
[simgrid.git] / buildtools / Cmake / CompleteInFiles.cmake
index 2e2e89a..17c6769 100644 (file)
@@ -57,9 +57,11 @@ CHECK_FUNCTION_EXISTS(vasprintf HAVE_VASPRINTF)
 CHECK_FUNCTION_EXISTS(makecontext HAVE_MAKECONTEXT)
 CHECK_FUNCTION_EXISTS(mmap HAVE_MMAP)
 
-if(WIN32)
+if(WIN32) #THOSE FILES ARE FUNCTIONS ARE NOT DETECTED BUT THEY SHOULD...
     set(HAVE_UCONTEXT_H 1)
     set(HAVE_MAKECONTEXT 1)
+    set(HAVE_SNPRINTF 1)
+    set(HAVE_VSNPRINTF 1)
 endif(WIN32)
 
 set(CONTEXT_UCONTEXT 0)
@@ -68,7 +70,6 @@ SET(HAVE_RUBY 0)
 set(HAVE_LUA 0)
 SET(HAVE_JAVA 0)
 SET(HAVE_TRACING 0)
-SET(HAVE_LATENCY_BOUND_TRACKING 0)
 
 if(enable_tracing)
        SET(HAVE_TRACING 1)
@@ -76,6 +77,13 @@ endif(enable_tracing)
 
 if(enable_latency_bound_tracking)
        SET(HAVE_LATENCY_BOUND_TRACKING 1)
+else(enable_latency_bound_tracking)
+  if(enable_gtnets)
+    SET(enable_latency_bound_tracking ON)
+    SET(HAVE_LATENCY_BOUND_TRACKING 1)
+  else(enable_gtnets)
+    SET(HAVE_LATENCY_BOUND_TRACKING 0)
+  endif(enable_gtnets)
 endif(enable_latency_bound_tracking)
 
 if(enable_model-checking AND HAVE_MMAP)
@@ -199,18 +207,24 @@ endif(HAVE_CGRAPH_LIB AND HAVE_CGRAPH_H)
 
 #--------------------------------------------------------------------------------------------------
 ### Initialize of pcre
-find_library(PATH_PCRE_LIB pcre "/usr/lib/")
-
-if(PATH_PCRE_LIB)
-       string(REGEX REPLACE "/libpcre.*[.]so$" "" PATHLIBPCRE "${PATH_PCRE_LIB}")
-               string(REGEX MATCH "-L${PATHLIBPCRE} " operation "${CMAKE_C_FLAGS}")
-               if(NOT operation)
+find_library(PATH_PCRE_LIB pcre)
+find_file(PATH_PCRE_H "pcre.h")
+set(HAVE_PCRE_LIB 0)
+if(PATH_PCRE_LIB AND PATH_PCRE_H)
+       string(REGEX REPLACE "/libpcre.*[.]${LIB_EXE}$" "" PATHLIBPCRE "${PATH_PCRE_LIB}")
+       string(REGEX REPLACE "/pcre.h" "" PATH_PCRE_H "${PATH_PCRE_H}")
+       string(REGEX MATCH "-L${PATHLIBPCRE} " operation "${CMAKE_C_FLAGS}")
+          if(NOT operation)
                        SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-L${PATHLIBPCRE} ")
-               endif(NOT operation)
+          endif(NOT operation)
+          string(REGEX MATCH "-I${PATH_PCRE_H} " operation "${CMAKE_C_FLAGS}")
+          if(NOT operation)
+                       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${PATH_PCRE_H} ")
+          endif(NOT operation)    
        set(HAVE_PCRE_LIB 1)
 else(PATH_PCRE_LIB)
-               message(FATAL_ERROR "You must have libpcre installed (please install the libpcre3-dev package or equivalent)")
-endif(PATH_PCRE_LIB)
+               message("You should install libpcre (please install the libpcre3-dev package or equivalent)")
+endif(PATH_PCRE_LIB AND PATH_PCRE_H)
 
 #--------------------------------------------------------------------------------------------------
 ### Initialize of CONTEXT THREADS
@@ -559,8 +573,8 @@ set(diff_va "va_copy((d),(s))"
 "__builtin_va_copy((d),(s))"
 "do { (d) = (s)\; } while (0)"
 "do { *(d) = *(s)\; } while (0)"
-"memcpy((void *)&(d), (void *)&(s)), sizeof((s))"
-"memcpy((void *)(d), (void *)(s)), sizeof(*(s))"
+"memcpy((void *)&(d), (void *)&(s), sizeof(s))"
+"memcpy((void *)(d), (void *)(s), sizeof(*(s)))"
 )
 
 foreach(fct ${diff_va})
@@ -630,15 +644,15 @@ foreach(fct ${diff_va})
                        set(__VA_COPY_USE_ASP "do { *(d) = *(s); } while (0)")
                endif(${fctbis} STREQUAL "do { *(d) = *(s) } while (0)")
 
-               if(${fctbis} STREQUAL "memcpy((void *)&(d), (void *)&(s)), sizeof((s))")
+               if(${fctbis} STREQUAL "memcpy((void *)&(d), (void *)&(s), sizeof(s))")
                        set(ac_cv_va_copy "CPS")
-                       set(__VA_COPY_USE_CPS "memcpy((void *)&(d), (void *)&(s)), sizeof((s))")
-               endif(${fctbis} STREQUAL "memcpy((void *)&(d), (void *)&(s)), sizeof((s))")
+                       set(__VA_COPY_USE_CPS "memcpy((void *)&(d), (void *)&(s), sizeof(s))")
+               endif(${fctbis} STREQUAL "memcpy((void *)&(d), (void *)&(s), sizeof(s))")
 
-               if(${fctbis} STREQUAL "memcpy((void *)(d), (void *)(s)), sizeof(*(s))")
+               if(${fctbis} STREQUAL "memcpy((void *)(d), (void *)(s), sizeof(*(s)))")
                        set(ac_cv_va_copy "CPP")
-                       set(__VA_COPY_USE_CPP "memcpy((void *)(d), (void *)(s)), sizeof(*(s))")
-               endif(${fctbis} STREQUAL "memcpy((void *)(d), (void *)(s)), sizeof(*(s))")
+                       set(__VA_COPY_USE_CPP "memcpy((void *)(d), (void *)(s), sizeof(*(s)))")
+               endif(${fctbis} STREQUAL "memcpy((void *)(d), (void *)(s), sizeof(*(s)))")
                                
                if(NOT STATUS_OK)
                set(__VA_COPY_USE "__VA_COPY_USE_${ac_cv_va_copy}(d, s)")
@@ -665,8 +679,12 @@ SET(SIMGRID_NEED_GETLINE 0)
 endif(NOT COMPILE_RESULT_VAR)
 
 ### check for a working snprintf
-if(HAVE_SNPRINTF AND HAVE_VSNPRINTF)
-
+if(HAVE_SNPRINTF AND HAVE_VSNPRINTF OR WIN32)
+    if(WIN32)
+        #set(HAVE_SNPRINTF 1)
+        #set(HAVE_VSNPRINTF 1)
+    endif(WIN32)
+    
        try_run(RUN_SNPRINTF_FUNC_VAR COMPILE_SNPRINTF_FUNC_VAR
                ${PROJECT_DIRECTORY}
                ${PROJECT_DIRECTORY}/buildtools/Cmake/test_prog/prog_snprintf.c
@@ -689,7 +707,7 @@ if(HAVE_SNPRINTF AND HAVE_VSNPRINTF)
        if(RUN_SNPRINTF_FUNC_VAR MATCHES "FAILED_TO_RUN")
                set(PREFER_PORTABLE_SNPRINTF 1)
        endif(RUN_SNPRINTF_FUNC_VAR MATCHES "FAILED_TO_RUN")
-endif(HAVE_SNPRINTF AND HAVE_VSNPRINTF)
+endif(HAVE_SNPRINTF AND HAVE_VSNPRINTF OR WIN32)
 
 ### check for asprintf function familly
 if(HAVE_ASPRINTF)
@@ -740,6 +758,7 @@ configure_file(${PROJECT_DIRECTORY}/src/smpi/smpicc.in ${CMAKE_CURRENT_BINARY_DI
 configure_file(${PROJECT_DIRECTORY}/src/smpi/smpirun.in ${CMAKE_CURRENT_BINARY_DIR}/bin/smpirun @ONLY)
 configure_file(${PROJECT_DIRECTORY}/examples/smpi/hostfile ${CMAKE_CURRENT_BINARY_DIR}/examples/smpi/hostfile COPYONLY)
 configure_file(${PROJECT_DIRECTORY}/examples/msg/small_platform.xml ${CMAKE_CURRENT_BINARY_DIR}/examples/msg/small_platform.xml COPYONLY)
+configure_file(${PROJECT_DIRECTORY}/examples/msg/small_platform_with_routers.xml ${CMAKE_CURRENT_BINARY_DIR}/examples/msg/small_platform_with_routers.xml COPYONLY)
 
 exec_program("chmod a=rwx ${CMAKE_CURRENT_BINARY_DIR}/bin/smpicc" OUTPUT_VARIABLE OKITOKI)
 exec_program("chmod a=rwx ${CMAKE_CURRENT_BINARY_DIR}/bin/smpirun" OUTPUT_VARIABLE OKITOKI)