Revert "meson: Use the new `pic` argument on static libs"
[platform/upstream/gstreamer.git] / gst / printf / meson.build
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 # Check if 'long long' works and what format can be used to print it
22 # jm_AC_TYPE_LONG_LONG
23 if cc.compiles('''long long ll = 1LL;
24                   int i = 63;
25                   int some_func (void) {
26                     long long llmax = (long long) -1;
27                     return ll << i | ll >> i | llmax / ll | llmax % ll;
28                   }''', name : 'long long')
29   printf_args += ['-DHAVE_LONG_LONG']
30   have_long_long = true
31 else
32   have_long_long = false
33 endif
34
35 # The following uintmax_t/intmax_t checks are also in glib
36 found_uintmax_t = false
37
38 # Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
39 # doesn't clash with <sys/types.h>, and declares uintmax_t.
40 # jm_AC_HEADER_INTTYPES_H
41 if cc.compiles('''#include <sys/types.h>
42                   #include <inttypes.h>
43                   uintmax_t i = (uintmax_t) -1;
44                ''', name : 'uintmax_t in inttypes.h')
45   printf_args += ['-DHAVE_INTTYPES_H_WITH_UINTMAX']
46   found_uintmax_t = true
47 endif
48
49 # Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
50 # doesn't clash with <sys/types.h>, and declares uintmax_t.
51 # jm_AC_HEADER_STDINT_H
52 if cc.compiles('''#include <sys/types.h>
53                   #include <stdint.h>
54                   uintmax_t i = (uintmax_t) -1;
55                ''', name : 'uintmax_t in stdint.h')
56   printf_args += ['-DHAVE_STDINT_H_WITH_UINTMAX']
57   found_uintmax_t = true
58 endif
59
60
61 # Define intmax_t to 'long' or 'long long'
62 # if it is not already defined in <stdint.h> or <inttypes.h>.
63 # For simplicity, we assume that a header file defines 'intmax_t'
64 # if and only if it defines 'uintmax_t'.
65 printf_args += ['-DHAVE_INTMAX_T']
66 if not found_uintmax_t
67   if have_long_long
68     printf_args += ['-Dintmax_t=long long']
69   else
70     printf_args += ['-Dintmax_t=long']
71   endif
72 endif
73
74 printf_lib = static_library('gstprintf',
75     printf_sources,
76     include_directories : [configinc],
77     c_args : printf_args + pic_args,
78     install : false,
79     dependencies : [glib_dep])