| 1 |
printf_sources = [ |
| 2 |
'asnprintf.c', |
| 3 |
'printf-args.c', |
| 4 |
'printf-parse.c', |
| 5 |
'vasnprintf.c', |
| 6 |
'printf.c', |
| 7 |
'printf-extension.c', |
| 8 |
] |
| 9 |
|
| 10 |
printf_args = gst_c_args + ['-DSTATIC=G_GNUC_INTERNAL'] |
| 11 |
|
| 12 |
# Don't have a need for that and it's not portable so just ignore for now |
| 13 |
printf_args += ['-UHAVE_LONG_DOUBLE'] |
| 14 |
|
| 15 |
# Just use internal emulation for printing long longs for now |
| 16 |
printf_args += ['-UHAVE_LONG_LONG_FORMAT'] |
| 17 |
|
| 18 |
# Don't need any of this widechar stuff, so just disable it for now |
| 19 |
printf_args += ['-UHAVE_WCHAR_T', '-UHAVE_WCSLEN', '-UHAVE_WINT_T'] |
| 20 |
|
| 21 |
if cc.has_argument('-Wno-format-nonliteral') |
| 22 |
printf_args += ['-Wno-format-nonliteral'] |
| 23 |
endif |
| 24 |
|
| 25 |
# Check if 'long long' works and what format can be used to print it |
| 26 |
# jm_AC_TYPE_LONG_LONG |
| 27 |
if cc.compiles('''long long ll = 1LL; |
| 28 |
int i = 63; |
| 29 |
int some_func (void) { |
| 30 |
long long llmax = (long long) -1; |
| 31 |
return ll << i | ll >> i | llmax / ll | llmax % ll; |
| 32 |
}''', name : 'long long') |
| 33 |
printf_args += ['-DHAVE_LONG_LONG'] |
| 34 |
have_long_long = true |
| 35 |
else |
| 36 |
have_long_long = false |
| 37 |
endif |
| 38 |
|
| 39 |
# The following uintmax_t/intmax_t checks are also in glib |
| 40 |
found_uintmax_t = false |
| 41 |
|
| 42 |
# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists, |
| 43 |
# doesn't clash with <sys/types.h>, and declares uintmax_t. |
| 44 |
# jm_AC_HEADER_INTTYPES_H |
| 45 |
if cc.compiles('''#include <sys/types.h> |
| 46 |
#include <inttypes.h> |
| 47 |
uintmax_t i = (uintmax_t) -1; |
| 48 |
''', name : 'uintmax_t in inttypes.h') |
| 49 |
printf_args += ['-DHAVE_INTTYPES_H_WITH_UINTMAX'] |
| 50 |
found_uintmax_t = true |
| 51 |
endif |
| 52 |
|
| 53 |
# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists, |
| 54 |
# doesn't clash with <sys/types.h>, and declares uintmax_t. |
| 55 |
# jm_AC_HEADER_STDINT_H |
| 56 |
if cc.compiles('''#include <sys/types.h> |
| 57 |
#include <stdint.h> |
| 58 |
uintmax_t i = (uintmax_t) -1; |
| 59 |
''', name : 'uintmax_t in stdint.h') |
| 60 |
printf_args += ['-DHAVE_STDINT_H_WITH_UINTMAX'] |
| 61 |
found_uintmax_t = true |
| 62 |
endif |
| 63 |
|
| 64 |
|
| 65 |
# Define intmax_t to 'long' or 'long long' |
| 66 |
# if it is not already defined in <stdint.h> or <inttypes.h>. |
| 67 |
# For simplicity, we assume that a header file defines 'intmax_t' |
| 68 |
# if and only if it defines 'uintmax_t'. |
| 69 |
printf_args += ['-DHAVE_INTMAX_T'] |
| 70 |
if not found_uintmax_t |
| 71 |
if have_long_long |
| 72 |
printf_args += ['-Dintmax_t=long long'] |
| 73 |
else |
| 74 |
printf_args += ['-Dintmax_t=long'] |
| 75 |
endif |
| 76 |
endif |
| 77 |
|
| 78 |
printf_lib = static_library('gstprintf', |
| 79 |
printf_sources, |
| 80 |
include_directories : [configinc], |
| 81 |
c_args : printf_args, |
| 82 |
install : false, |
| 83 |
pic: true, |
| 84 |
dependencies : [glib_dep]) |