Vitaliy Kirsanov | c39718d | 2019-03-31 23:04:45 +0300 | [diff] [blame] | 1 | include(CheckCSourceCompiles) |
| 2 | |
| 3 | check_c_source_compiles(" |
| 4 | int main() |
| 5 | { |
| 6 | #ifndef _FORTIFY_SOURCE |
| 7 | return 0; |
| 8 | #else |
| 9 | this_is_an_error; |
| 10 | #endif |
| 11 | }" |
| 12 | DODEFINE_FORTIFY_SOURCE) |
| 13 | check_c_source_compiles(" |
| 14 | #include <wchar.h> |
| 15 | mbstate_t x; |
| 16 | int main() { return 0; }" |
| 17 | HAVE_MBSTATE) |
| 18 | if(NOT HAVE_MBSTATE) |
| 19 | check_c_source_compiles(" |
| 20 | #define _XOPEN_SOURCE 500 |
| 21 | #include <wchar.h> |
| 22 | mbstate_t x; |
| 23 | int main() { return 0; }" |
| 24 | DODEFINE_XOPEN_SOURCE) |
| 25 | endif() |
| 26 | check_c_source_compiles(" |
| 27 | #define __EXTENSIONS__ 1 |
| 28 | #include <stdio.h> |
| 29 | #ifdef HAVE_SYS_TYPES_H |
| 30 | # include <sys/types.h> |
| 31 | #endif |
| 32 | #ifdef HAVE_SYS_STAT_H |
| 33 | # include <sys/stat.h> |
| 34 | #endif |
| 35 | #ifdef STDC_HEADERS |
| 36 | # include <stdlib.h> |
| 37 | # include <stddef.h> |
| 38 | #else |
| 39 | # ifdef HAVE_STDLIB_H |
| 40 | # include <stdlib.h> |
| 41 | # endif |
| 42 | #endif |
| 43 | #ifdef HAVE_STRING_H |
| 44 | # if !defined STDC_HEADERS && defined HAVE_MEMORY_H |
| 45 | # include <memory.h> |
| 46 | # endif |
| 47 | # include <string.h> |
| 48 | #endif |
| 49 | #ifdef HAVE_STRINGS_H |
| 50 | # include <strings.h> |
| 51 | #endif |
| 52 | #ifdef HAVE_INTTYPES_H |
| 53 | # include <inttypes.h> |
| 54 | #endif |
| 55 | #ifdef HAVE_STDINT_H |
| 56 | # include <stdint.h> |
| 57 | #endif |
| 58 | #ifdef HAVE_UNISTD_H |
| 59 | # include <unistd.h> |
| 60 | #endif |
| 61 | int main() { return 0; }" |
| 62 | DODEFINE_EXTENSIONS) |
| 63 | |
Vitaly Kirsanov | a82a014 | 2019-04-25 14:14:28 +0000 | [diff] [blame] | 64 | add_definitions( |
| 65 | -D_DARWIN_C_SOURCE |
| 66 | -D_POSIX_PTHREAD_SEMANTICS |
Vitaly Kirsanov | a82a014 | 2019-04-25 14:14:28 +0000 | [diff] [blame] | 67 | -D__STDC_WANT_IEC_60559_BFP_EXT__ |
| 68 | -D__STDC_WANT_IEC_60559_DFP_EXT__ |
| 69 | -D__STDC_WANT_IEC_60559_FUNCS_EXT__ |
| 70 | -D__STDC_WANT_IEC_60559_TYPES_EXT__ |
| 71 | -D__STDC_WANT_LIB_EXT2__ |
| 72 | -D__STDC_WANT_MATH_SPEC_FUNCS__ |
| 73 | -D_TANDEM_SOURCE) |