Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[simdag,dotloader] clean the valgrind output
[simgrid.git] / include / simgrid_config.h.in
1 /* simgrid_config.h - Results of the configure made visible to user code    */
2
3 /* Copyright (c) 2009, 2010, 2011. Da SimGrid team. All rights reserved.    */
4
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. */
7
8 #include "xbt/misc.h"           /* XBT_PUBLIC */
9
10 #ifndef SIMGRID_PUBLIC_CONFIG_H
11 #define SIMGRID_PUBLIC_CONFIG_H
12 SG_BEGIN_DECL()
13
14
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) */
18
19 #define SIMGRID_VERSION_MAJOR @SIMGRID_VERSION_MAJOR@
20 #define SIMGRID_VERSION_MINOR @SIMGRID_VERSION_MINOR@
21 #define SIMGRID_VERSION_PATCH @SIMGRID_VERSION_PATCH@
22
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)*/
25
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)
31
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);
35
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);                          \
46   }                                               \
47
48   
49
50 /* take care of DLL usage madness */
51
52 #ifdef _XBT_DLL_EXPORT
53         #ifndef DLL_EXPORT
54                 #define DLL_EXPORT
55         #endif
56 #else
57         #ifdef _XBT_DLL_STATIC
58                 #ifndef DLL_STATIC
59                         #define DLL_STATIC
60                 #endif
61         #else
62                 #ifndef DLL_EXPORT
63                         #define DLL_IMPORT
64                 #endif
65         #endif
66 #endif
67
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__@
73 #ifdef _XBT_WIN32
74         #ifndef __GNUC__
75                 #cmakedefine __GNUC__ @__GNUC__@
76         #endif
77 #endif
78
79
80 /* Define to 1 if you have the `mmap' function. */
81 #cmakedefine HAVE_MMAP @HAVE_MMAP@
82
83 /* Get the config */
84 #undef SIMGRID_NEED_GETLINE
85 #undef SIMGRID_NEED_ASPRINTF
86 #undef SIMGRID_NEED_VASPRINTF
87 @need_getline@
88 @simgrid_need_asprintf@
89 @simgrid_need_vasprintf@
90
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);
96 #else
97 #ifndef _GNU_SOURCE
98         #define _GNU_SOURCE
99 #endif
100 #include <stdio.h>
101 #endif
102 #include <stdarg.h>
103
104 /* snprintf related functions */
105 /** @addtogroup XBT_str
106   * @{ */
107 /** @brief print to allocated string (reimplemented when not provided by the system)
108  *
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.
115  */
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);
119 #endif
120 /** @brief print to allocated string (reimplemented when not provided by the system)
121  *
122  * See asprintf()
123  */
124 #if defined(SIMGRID_NEED_VASPRINTF)||defined(DOXYGEN)
125 XBT_PUBLIC(int) vasprintf(char **ptr, const char *fmt, va_list ap);
126 #endif
127 /** @brief print to allocated string
128  *
129  * Works just like vasprintf(), but returns a pointer to the newly
130  * created string, or aborts on error.
131  */
132 XBT_PUBLIC(char *) bvprintf(const char *fmt, va_list ap);
133 /** @brief print to allocated string
134  *
135  * Works just like asprintf(), but returns a pointer to the newly
136  * created string, or aborts on error.
137  */
138 XBT_PUBLIC(char *) bprintf(const char *fmt, ...) _XBT_GNUC_PRINTF(1, 2);
139 /** @} */
140
141 /* Define if xbt contexts are based on our threads implementation or not */
142 #cmakedefine CONTEXT_THREADS @CONTEXT_THREADS@
143
144 /* Tracing SimGrid */
145 #cmakedefine HAVE_TRACING @HAVE_TRACING@
146
147 /* Jedule output  */
148 #cmakedefine HAVE_JEDULE @HAVE_JEDULE@
149
150 /* Tracking of latency bound */
151 #cmakedefine HAVE_LATENCY_BOUND_TRACKING @HAVE_LATENCY_BOUND_TRACKING@
152
153 /* If __thread is available */
154 #cmakedefine HAVE_THREAD_LOCAL_STORAGE @HAVE_THREAD_LOCAL_STORAGE@
155
156 /* If Model-Checking support was requested */
157 #cmakedefine HAVE_MC @HAVE_MC@
158
159 SG_END_DECL()
160 #endif /* SIMGRID_PUBLIC_CONFIG_H */