1 /* simgrid_config.h - Results of the configure made visible to user code */
3 /* Copyright (c) 2009, 2010, 2011. Da SimGrid team. All rights reserved. */
5 /* This program is free software; you can redistribute it and/or modify it
6 * under the terms of the license (GNU LGPL) which comes with this package. */
8 #include "xbt/misc.h" /* XBT_PUBLIC */
10 #ifndef SIMGRID_PUBLIC_CONFIG_H
11 #define SIMGRID_PUBLIC_CONFIG_H
15 /** Define the version numbers of the used header files.
16 sg_version() can be used to retrieve the version of the dynamic library.
17 But actually, if these numbers don't match, SimGrid refuses to start (so you shouldn't have to care about sg_version() yourself) */
19 #define SIMGRID_VERSION_MAJOR @SIMGRID_VERSION_MAJOR@
20 #define SIMGRID_VERSION_MINOR @SIMGRID_VERSION_MINOR@
21 #define SIMGRID_VERSION_PATCH @SIMGRID_VERSION_PATCH@
23 /* Version X.Y.Z will get version number XYZ: all digits concatenated without dots
24 * (with Y and Z must be on two positions)*/
26 #define MAKE_SIMGRID_VERSION(major, minor, patch) \
27 (100UL * (100UL * (major) + (minor)) + (patch))
28 #define SIMGRID_VERSION MAKE_SIMGRID_VERSION(SIMGRID_VERSION_MAJOR, \
29 SIMGRID_VERSION_MINOR, \
30 SIMGRID_VERSION_PATCH)
32 /** Retrieves the version numbers of the used dynamic library (so, DLL or dynlib) , while
33 SIMGRID_VERSION_MAJOR and friends give the version numbers of the used header files */
34 XBT_PUBLIC(void) sg_version(int *major,int *minor,int *patch);
36 /** Check that the link-time and compile-time versions of SimGrid do match.
37 * There is no need to call it yourself, it's done automatically during the SimGrid initialization */
38 #define sg_check_version() { \
39 int ver_major,ver_minor,ver_patch; \
40 sg_version(&ver_major,&ver_minor,&ver_patch); \
41 if ((ver_major != SIMGRID_VERSION_MAJOR) || \
42 (ver_minor != SIMGRID_VERSION_MINOR) || \
43 (ver_patch != SIMGRID_VERSION_PATCH)) { \
44 fprintf(stderr,"FATAL ERROR: Your program was compiled with SimGrid version %d.%d.%d, and then linked against SimGrid %d.%d.%d. Please fix this.\n", \
45 SIMGRID_VERSION_MAJOR,SIMGRID_VERSION_MINOR,SIMGRID_VERSION_PATCH,ver_major,ver_minor,ver_patch); \
50 /* take care of DLL usage madness */
52 #ifdef _XBT_DLL_EXPORT
57 #ifdef _XBT_DLL_STATIC
68 #cmakedefine _XBT_WIN32 @_XBT_WIN32@ /*this variable is set if it is a windows platform*/
69 #cmakedefine _WIN32 @_WIN32@ /*this variable is set if it is a 32 bits windows platform*/
70 #cmakedefine _WIN64 @_WIN64@ /*this variable is set if it is a 64 bits windows platform*/
71 #cmakedefine __VISUALC__ @__VISUALC__@
72 #cmakedefine __BORLANDC__ @__BORLANDC__@
75 #cmakedefine __GNUC__ @__GNUC__@
80 /* Define to 1 if you have the `mmap' function. */
81 #cmakedefine HAVE_MMAP @HAVE_MMAP@
84 #undef SIMGRID_NEED_GETLINE
85 #undef SIMGRID_NEED_ASPRINTF
86 #undef SIMGRID_NEED_VASPRINTF
88 @simgrid_need_asprintf@
89 @simgrid_need_vasprintf@
91 /* Use that config to declare missing elements */
92 #ifdef SIMGRID_NEED_GETLINE
93 #include <stdlib.h> /* size_t */
94 #include <stdio.h> /* FILE* */
95 XBT_PUBLIC(long) getline(char **lineptr, size_t * n, FILE * stream);
104 /* snprintf related functions */
105 /** @addtogroup XBT_str
107 /** @brief print to allocated string (reimplemented when not provided by the system)
109 * The functions asprintf() and vasprintf() are analogues of
110 * sprintf() and vsprintf(), except that they allocate a string large
111 * enough to hold the output including the terminating null byte, and
112 * return a pointer to it via the first parameter. This pointer
113 * should be passed to free(3) to release the allocated storage when
114 * it is no longer needed.
116 #if defined(SIMGRID_NEED_ASPRINTF)||defined(DOXYGEN)
117 XBT_PUBLIC(int) asprintf(char **ptr, const char *fmt, /*args */
118 ...) _XBT_GNUC_PRINTF(2, 3);
120 /** @brief print to allocated string (reimplemented when not provided by the system)
124 #if defined(SIMGRID_NEED_VASPRINTF)||defined(DOXYGEN)
125 XBT_PUBLIC(int) vasprintf(char **ptr, const char *fmt, va_list ap);
127 /** @brief print to allocated string
129 * Works just like vasprintf(), but returns a pointer to the newly
130 * created string, or aborts on error.
132 XBT_PUBLIC(char *) bvprintf(const char *fmt, va_list ap);
133 /** @brief print to allocated string
135 * Works just like asprintf(), but returns a pointer to the newly
136 * created string, or aborts on error.
138 XBT_PUBLIC(char *) bprintf(const char *fmt, ...) _XBT_GNUC_PRINTF(1, 2);
141 /* Define if xbt contexts are based on our threads implementation or not */
142 #cmakedefine CONTEXT_THREADS @CONTEXT_THREADS@
144 /* Tracing SimGrid */
145 #cmakedefine HAVE_TRACING @HAVE_TRACING@
148 #cmakedefine HAVE_JEDULE @HAVE_JEDULE@
150 /* Tracking of latency bound */
151 #cmakedefine HAVE_LATENCY_BOUND_TRACKING @HAVE_LATENCY_BOUND_TRACKING@
153 /* If __thread is available */
154 #cmakedefine HAVE_THREAD_LOCAL_STORAGE @HAVE_THREAD_LOCAL_STORAGE@
156 /* If Model-Checking support was requested */
157 #cmakedefine HAVE_MC @HAVE_MC@
160 #endif /* SIMGRID_PUBLIC_CONFIG_H */