Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use memcpy() instead of possibly broken aliasing through an union.
[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 /* take care of DLL usage madness */
37
38 #ifdef _XBT_DLL_EXPORT
39         #ifndef DLL_EXPORT
40                 #define DLL_EXPORT
41         #endif
42 #else
43         #ifdef _XBT_DLL_STATIC
44                 #ifndef DLL_STATIC
45                         #define DLL_STATIC
46                 #endif
47         #else
48                 #ifndef DLL_EXPORT
49                         #define DLL_IMPORT
50                 #endif
51         #endif
52 #endif
53
54 #cmakedefine _XBT_WIN32 @_XBT_WIN32@    /*this variable is set if it is a windows platform*/
55 #cmakedefine _WIN32 @_WIN32@                    /*this variable is set if it is a 32 bits windows platform*/
56 #cmakedefine _WIN64 @_WIN64@                    /*this variable is set if it is a 64 bits  windows platform*/
57 #cmakedefine __VISUALC__ @__VISUALC__@
58 #cmakedefine __BORLANDC__ @__BORLANDC__@
59 #ifdef _XBT_WIN32
60         #ifndef __GNUC__
61                 #cmakedefine __GNUC__ @__GNUC__@
62         #endif
63 #endif
64
65
66 /* Define to 1 if you have the `mmap' function. */
67 #cmakedefine HAVE_MMAP @HAVE_MMAP@
68
69 /* Get the config */
70 #undef SIMGRID_NEED_GETLINE
71 #undef SIMGRID_NEED_ASPRINTF
72 #undef SIMGRID_NEED_VASPRINTF
73 @need_getline@
74 @simgrid_need_asprintf@
75 @simgrid_need_vasprintf@
76
77 /* Use that config to declare missing elements */
78 #ifdef SIMGRID_NEED_GETLINE
79 #include <stdlib.h> /* size_t */
80 #include <stdio.h>  /* FILE*  */
81 XBT_PUBLIC(long) getline(char **lineptr, size_t * n, FILE * stream);
82 #else
83 #ifndef _GNU_SOURCE
84         #define _GNU_SOURCE
85 #endif
86 #include <stdio.h>
87 #endif
88 #include <stdarg.h>
89
90 /* snprintf related functions */
91 /** @addtogroup XBT_str
92   * @{ */
93 /** @brief print to allocated string (reimplemented when not provided by the system)
94  *
95  * The functions asprintf() and vasprintf() are analogues of
96  * sprintf() and vsprintf(), except that they allocate a string large
97  * enough to hold the output including the terminating null byte, and
98  * return a pointer to it via the first parameter.  This pointer
99  * should be passed to free(3) to release the allocated storage when
100  * it is no longer needed.
101  */
102 #if defined(SIMGRID_NEED_ASPRINTF)||defined(DOXYGEN)
103 XBT_PUBLIC(int) asprintf(char **ptr, const char *fmt,   /*args */
104                          ...) _XBT_GNUC_PRINTF(2, 3);
105 #endif
106 /** @brief print to allocated string (reimplemented when not provided by the system)
107  *
108  * See asprintf()
109  */
110 #if defined(SIMGRID_NEED_VASPRINTF)||defined(DOXYGEN)
111 XBT_PUBLIC(int) vasprintf(char **ptr, const char *fmt, va_list ap);
112 #endif
113 /** @brief print to allocated string
114  *
115  * Works just like vasprintf(), but returns a pointer to the newly
116  * created string, or aborts on error.
117  */
118 XBT_PUBLIC(char *) bvprintf(const char *fmt, va_list ap);
119 /** @brief print to allocated string
120  *
121  * Works just like asprintf(), but returns a pointer to the newly
122  * created string, or aborts on error.
123  */
124 XBT_PUBLIC(char *) bprintf(const char *fmt, ...) _XBT_GNUC_PRINTF(1, 2);
125 /** @} */
126
127 /* Define if xbt contexts are based on our threads implementation or not */
128 #cmakedefine CONTEXT_THREADS @CONTEXT_THREADS@
129
130 /* Tracing SimGrid */
131 #cmakedefine HAVE_TRACING @HAVE_TRACING@
132
133 /* Jedule output  */
134 #cmakedefine HAVE_JEDULE @HAVE_JEDULE@
135
136 /* Tracking of latency bound */
137 #cmakedefine HAVE_LATENCY_BOUND_TRACKING @HAVE_LATENCY_BOUND_TRACKING@
138
139 /* If __thread is available */
140 #cmakedefine HAVE_THREAD_LOCAL_STORAGE @HAVE_THREAD_LOCAL_STORAGE@
141
142 /* If Model-Checking support was requested */
143 #cmakedefine HAVE_MC @HAVE_MC@
144
145 SG_END_DECL()
146 #endif /* SIMGRID_PUBLIC_CONFIG_H */