1 project('glib', 'c', 'cpp',
3 meson_version : '>= 0.38.1',
10 cc = meson.get_compiler('c')
11 cxx = meson.get_compiler('cpp')
13 if cc.get_id() == 'msvc'
14 # Ignore several spurious warnings for things glib does very commonly
15 # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
16 # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
17 # NOTE: Only add warnings here if you are sure they're spurious
18 add_project_arguments('/wd4244', '/wd4305', '/wd4035', '/wd4715', '/wd4116',
19 '/wd4046', '/wd4068', '/wo4090', language : 'c')
20 # Disable SAFESEH with MSVC for plugins and libs that use external deps that
21 # are built with MinGW
22 noseh_link_args = ['/SAFESEH:NO']
25 # -mms-bitfields vs -fnative-struct ?
28 host_system = host_machine.system()
30 glib_version = meson.project_version()
31 glib_api_version = '2.0'
32 version_arr = glib_version.split('.')
33 major_version = version_arr[0].to_int()
34 minor_version = version_arr[1].to_int()
35 micro_version = version_arr[2].to_int()
37 interface_age = minor_version.is_odd() ? 0 : micro_version
38 binary_age = 100 * minor_version + micro_version
41 # Maintain compatibility with previous libtool versioning
42 # current = minor * 100 + micro
43 library_version = '@0@.@1@.@2@'.format(soversion, binary_age - interface_age, interface_age)
45 configinc = include_directories('.')
46 glibinc = include_directories('glib')
47 gobjectinc = include_directories('gobject')
48 gmoduleinc = include_directories('gmodule')
49 gioinc = include_directories('gio')
51 glib_prefix = get_option('prefix')
52 glib_libdir = join_paths(glib_prefix, get_option('libdir'))
53 glib_datadir = join_paths(glib_prefix, get_option('datadir'))
54 glib_pkgdatadir = join_paths(glib_datadir, 'glib-2.0')
55 glib_includedir = join_paths(glib_prefix, get_option('includedir'))
56 glib_giomodulesdir = join_paths(glib_libdir, 'gio', 'modules')
58 glib_pkgconfigreldir = join_paths(glib_libdir, 'pkgconfig')
60 ########################
61 # Configuration begins #
62 ########################
63 glib_conf = configuration_data()
64 glibconfig_conf = configuration_data()
66 # accumulated list of defines as we check for them, so we can easily
67 # use them later in test programs (autoconf does this automatically)
70 glib_conf.set('GLIB_VERSION', glib_version)
71 glib_conf.set('GLIB_MAJOR_VERSION', major_version)
72 glib_conf.set('GLIB_MINOR_VERSION', minor_version)
73 glib_conf.set('GLIB_MICRO_VERSION', micro_version)
74 glib_conf.set('GLIB_INTERFACE_AGE', interface_age)
75 glib_conf.set('GLIB_BINARY_AGE', binary_age)
76 glib_conf.set_quoted('GETTEXT_PACKAGE', 'glib20')
77 glib_conf.set_quoted('PACKAGE_BUGREPORT', 'http://bugzilla.gnome.org/enter_bug.cgi?product=glib')
78 glib_conf.set_quoted('PACKAGE_NAME', 'glib')
79 glib_conf.set_quoted('PACKAGE_STRING', 'glib @0@'.format(meson.project_version()))
80 glib_conf.set_quoted('PACKAGE_TARNAME', 'glib')
81 glib_conf.set_quoted('PACKAGE_URL', '')
82 glib_conf.set_quoted('PACKAGE_VERSION', meson.project_version())
83 glib_conf.set('ENABLE_NLS', 1)
84 glib_conf.set('HAVE_GOOD_PRINTF', 1) # FIXME
86 # Variables used in glib-gettextize and pkg-config files
87 # These should not contain " quotes around the values
88 glib_conf.set('PACKAGE', 'glib')
89 glib_conf.set('VERSION', meson.project_version())
90 glib_conf.set('prefix', glib_prefix)
91 glib_conf.set('exec_prefix', glib_prefix)
92 glib_conf.set('libdir', glib_libdir)
93 glib_conf.set('includedir', glib_includedir)
94 glib_conf.set('datadir', glib_datadir)
95 glib_conf.set('datarootdir', glib_datadir)
97 glib_conf.set('_GNU_SOURCE', 1)
99 if host_system == 'windows'
100 # Poll doesn't work on devices on Windows
101 glib_conf.set('BROKEN_POLL', true)
104 # Detect and set symbol visibility
105 glib_hidden_visibility_args = []
106 if get_option('default_library') != 'static'
107 if host_system == 'windows'
108 glib_conf.set('DLL_EXPORT', true)
109 if cc.get_id() == 'msvc'
110 glib_conf.set('_GLIB_EXTERN', '__declspec(dllexport) extern')
111 elif cc.has_argument('-fvisibility=hidden')
112 glib_conf.set('_GLIB_EXTERN', '__attribute__((visibility("default"))) __declspec(dllexport) extern')
113 glib_hidden_visibility_args = ['-fvisibility=hidden']
115 elif cc.has_argument('-fvisibility=hidden')
116 glib_conf.set('_GLIB_EXTERN', '__attribute__((visibility("default"))) extern')
117 glib_hidden_visibility_args = ['-fvisibility=hidden']
121 # FIXME: what about Cygwin (G_WITH_CYGWIN)
122 if host_system == 'windows'
123 glib_os = '''#define G_OS_WIN32
124 #define G_PLATFORM_WIN32'''
126 glib_os = '#define G_OS_UNIX'
128 glibconfig_conf.set('glib_os', glib_os)
130 # check for header files
166 'dirent.h', # Some versions of MSC lack these
167 'sys/time.h', # Some versions of MSC lack these
185 define = 'HAVE_' + h.underscorify().to_upper()
186 glib_conf.set(define, 1)
187 glib_conf_prefix = glib_conf_prefix + '#define @0@ 1\n'.format(define)
191 if cc.has_header('linux/netlink.h')
192 glib_conf.set('HAVE_NETLINK', 1)
195 if glib_conf.has('HAVE_LOCALE_H')
196 if cc.has_header_symbol('locale.h', 'LC_MESSAGES')
197 glib_conf.set('HAVE_LC_MESSAGES', 1)
201 struct_stat_blkprefix = '''
202 #include <sys/types.h>
203 #include <sys/stat.h>
207 #ifdef HAVE_SYS_STATFS_H
208 #include <sys/statfs.h>
210 #ifdef HAVE_SYS_PARAM_H
211 #include <sys/param.h>
213 #ifdef HAVE_SYS_MOUNT_H
214 #include <sys/mount.h>
219 [ 'stat', 'st_mtimensec' ],
220 [ 'stat', 'st_mtim.tv_nsec' ],
221 [ 'stat', 'st_atimensec' ],
222 [ 'stat', 'st_atim.tv_nsec' ],
223 [ 'stat', 'st_ctimensec' ],
224 [ 'stat', 'st_ctim.tv_nsec' ],
225 [ 'stat', 'st_birthtime' ],
226 [ 'stat', 'st_birthtimensec' ],
227 [ 'stat', 'st_birthtim' ],
228 [ 'stat', 'st_birthtim.tv_nsec' ],
229 [ 'stat', 'st_blksize', struct_stat_blkprefix ],
230 [ 'stat', 'st_blocks', struct_stat_blkprefix ],
231 [ 'statfs', 'f_fstypename', struct_stat_blkprefix ],
232 [ 'statfs', 'f_bavail', struct_stat_blkprefix ],
233 [ 'dirent', 'd_type', '''#include <sys/types.h>
234 #include <dirent.h>''' ],
237 foreach m : struct_members
238 header_check_prefix = glib_conf_prefix
240 header_check_prefix = header_check_prefix + m[2]
242 header_check_prefix = header_check_prefix + '#include <sys/stat.h>'
244 if cc.has_member('struct ' + m[0], m[1], prefix : header_check_prefix)
245 define = 'HAVE_STRUCT_@0@_@1@'.format(m[0].to_upper(), m[1].underscorify().to_upper())
246 glib_conf.set(define, 1)
247 glib_conf_prefix = glib_conf_prefix + '#define @0@ 1\n'.format(define)
314 if glib_conf.has('HAVE_SYS_STATVFS_H')
315 functions += ['statvfs']
317 have_func_statvfs = false
319 if glib_conf.has('HAVE_SYS_STATFS_H') or glib_conf.has('HAVE_SYS_MOUNT_H')
320 functions += ['statfs']
322 have_func_statfs = false
325 # AIX splice is something else
326 if host_system != 'aix'
327 functions += ['splice']
330 foreach f : functions
331 if cc.has_function(f)
332 define = 'HAVE_' + f.underscorify().to_upper()
333 glib_conf.set(define, 1)
334 glib_conf_prefix = glib_conf_prefix + '#define @0@ 1\n'.format(define)
335 set_variable('have_func_' + f, true)
337 set_variable('have_func_' + f, false)
341 # Special-case these functions that have alternative names on Windows/MSVC
342 if cc.has_function('snprintf') or cc.has_header_symbol('stdio.h', 'snprintf')
343 glib_conf.set('HAVE_SNPRINTF', 1)
344 glib_conf_prefix = glib_conf_prefix + '#define HAVE_SNPRINTF 1\n'
345 elif cc.has_function('_snprintf') or cc.has_header_symbol('stdio.h', '_snprintf')
346 hack_define = '1\n#define snprintf _snprintf'
347 glib_conf.set('HAVE_SNPRINTF', hack_define)
348 glib_conf_prefix = glib_conf_prefix + '#define HAVE_SNPRINTF ' + hack_define
351 if cc.has_function('strcasecmp')
352 glib_conf.set('HAVE_STRCASECMP', 1)
353 glib_conf_prefix = glib_conf_prefix + '#define HAVE_STRCASECMP 1\n'
354 elif cc.has_function('_stricmp')
355 hack_define = '1\n#define strcasecmp _stricmp'
356 glib_conf.set('HAVE_STRCASECMP', hack_define)
357 glib_conf_prefix = glib_conf_prefix + '#define HAVE_STRCASECMP ' + hack_define
360 if cc.has_function('strncasecmp')
361 glib_conf.set('HAVE_STRNCASECMP', 1)
362 glib_conf_prefix = glib_conf_prefix + '#define HAVE_STRNCASECMP 1\n'
363 elif cc.has_function('_strnicmp')
364 hack_define = '1\n#define strncasecmp _strnicmp'
365 glib_conf.set('HAVE_STRNCASECMP', hack_define)
366 glib_conf_prefix = glib_conf_prefix + '#define HAVE_STRNCASECMP ' + hack_define
369 if cc.has_header_symbol('sys/sysmacros.h', 'major')
370 glib_conf.set('MAJOR_IN_SYSMACROS', 1)
371 elif cc.has_header_symbol('sys/mkdev.h', 'major')
372 glib_conf.set('MAJOR_IN_MKDEV', 1)
375 if cc.has_header_symbol('dlfcn.h', 'RTLD_LAZY')
376 glib_conf.set('HAVE_RTLD_LAZY', 1)
379 if cc.has_header_symbol('dlfcn.h', 'RTLD_NOW')
380 glib_conf.set('HAVE_RTLD_NOW', 1)
383 if cc.has_header_symbol('dlfcn.h', 'RTLD_GLOBAL')
384 glib_conf.set('HAVE_RTLD_GLOBAL', 1)
387 # Check whether to use statfs or statvfs
388 # Some systems have both statfs and statvfs, pick the most "native" for these
389 if have_func_statfs and have_func_statvfs
390 # on solaris and irix, statfs doesn't even have the f_bavail field
391 if not glib_conf.has('HAVE_STRUCT_STATFS_F_BAVAIL')
392 have_func_statfs = false
394 # at least on linux, statfs is the actual syscall
395 have_func_statvfs = false
399 glib_conf.set('USE_STATFS', 1)
400 stat_func_to_use = 'statfs'
401 elif have_func_statvfs
402 glib_conf.set('USE_STATVFS', 1)
403 stat_func_to_use = 'statvfs'
405 stat_func_to_use = 'neither'
407 message('Checking whether to use statfs or statvfs .. ' + stat_func_to_use)
409 # Mac OS X Carbon support
410 glib_have_carbon = cc.compiles('''#include <Carbon/Carbon.h>
411 #include <CoreServices/CoreServices.h>''',
412 name : 'Mac OS X Carbon support')
414 glib_have_os_x_9_or_later = false
417 glib_conf.set('HAVE_CARBON', true)
418 CARBON_LIBS='-Wl,-framework,Carbon' # FIXME: propagate to .pc files as well
419 glib_have_os_x_9_or_later = cc.compiles('''#include <AvailabilityMacros.h>
420 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1090
421 #error Compiling for minimum OS X version before 10.9
422 #endif''', name : 'OS X 9 or later')
427 # Mac OS X Cocoa support
428 glib_have_cocoa = cc.compiles('''#include <Cocoa/Cocoa.h>
429 #ifdef GNUSTEP_BASE_VERSION
430 #error "Detected GNUstep, not Cocoa"
432 name : 'Mac OS X Cocoa support')
435 glib_conf.set('HAVE_COCOA', true)
436 COCOA_LIBS='-Wl,-framework,Foundation' # FIXME: propagate to .pc files as well
442 if cc.links('''#include <linux/futex.h>
443 #include <sys/syscall.h>
445 int main (int argc, char ** argv) {
446 syscall (__NR_futex, NULL, FUTEX_WAKE, FUTEX_WAIT);
448 }''', name : 'futex(2) system call')
449 glib_conf.set('HAVE_FUTEX', 1)
452 # Check for eventfd(2)
453 if cc.links('''#include <sys/eventfd.h>
455 int main (int argc, char ** argv) {
456 eventfd (0, EFD_CLOEXEC);
458 }''', name : 'eventfd(2) system call')
459 glib_conf.set('HAVE_EVENTFD', 1)
462 clock_gettime_test_code = '''
465 int main (int argc, char ** argv) {
466 return clock_gettime(CLOCK_REALTIME, &t);
469 if cc.links(clock_gettime_test_code, name : 'clock_gettime')
470 glib_conf.set('HAVE_CLOCK_GETTIME', 1)
471 elif cc.links(clock_gettime_test_code, args : '-lrt', name : 'clock_gettime in librt')
472 glib_conf.set('HAVE_CLOCK_GETTIME', 1)
473 librt = cc.find_library('rt')
476 # if statfs() takes 2 arguments (Posix) or 4 (Solaris)
478 if cc.compiles(glib_conf_prefix + '''
480 #ifdef HAVE_SYS_PARAM_H
481 #include <sys/param.h>
483 #ifdef HAVE_SYS_VFS_H
486 #ifdef HAVE_SYS_MOUNT_H
487 #include <sys/mount.h>
489 #ifdef HAVE_SYS_STATFS_H
490 #include <sys/statfs.h>
492 void some_func (void) {
495 }''', name : 'number of arguments to statfs() (n=2)')
496 glib_conf.set('STATFS_ARGS', 2)
497 elif cc.compiles(glib_conf_prefix + '''
499 #ifdef HAVE_SYS_PARAM_H
500 #include <sys/param.h>
502 #ifdef HAVE_SYS_VFS_H
505 #ifdef HAVE_SYS_MOUNT_H
506 #include <sys/mount.h>
508 #ifdef HAVE_SYS_STATFS_H
509 #include <sys/statfs.h>
511 void some_func (void) {
513 statfs("/", &st, sizeof (st), 0);
514 }''', name : 'number of arguments to statfs() (n=4)')
515 glib_conf.set('STATFS_ARGS', 4)
517 error('Unable to determine number of arguments to statfs()')
521 # open takes O_DIRECTORY as an option
523 if cc.compiles('''#include <fcntl.h>
524 #include <sys/types.h>
525 #include <sys/stat.h>],
526 void some_func (void) {
527 open(0, O_DIRECTORY, 0);
528 }''', name : 'open() option O_DIRECTORY')
529 glib_conf.set('HAVE_OPEN_O_DIRECTORY', 1)
532 # Check whether there is a vsnprintf() function with C99 semantics installed.
533 # AC_FUNC_VSNPRINTF_C99
534 # Check whether there is a snprintf() function with C99 semantics installed.
535 # AC_FUNC_SNPRINTF_C99
536 if host_system == 'windows' and cc.get_id() == 'gcc'
537 # Unfortunately the mingw implementations of C99-style snprintf and vsnprintf
538 # don't seem to be quite good enough, at least not in mingw-runtime-3.14.
539 # (Sorry, I don't know exactly what is the problem, but it is related to
540 # floating point formatting and decimal point vs. comma.)
541 # The simple tests in AC_FUNC_VSNPRINTF_C99 and AC_FUNC_SNPRINTF_C99 aren't
542 # rigorous enough to notice, though.
543 glib_conf.set('HAVE_C99_SNPRINTF', false)
544 glib_conf.set('HAVE_C99_VSNPRINTF', false)
546 vsnprintf_c99_test_code = '''
558 r = vsnprintf(buffer, 5, s, args);
564 /* AIX 5.1 and Solaris seems to have a half-baked vsnprintf()
565 implementation. The above will return 7 but if you replace
566 the size of the buffer with 0, it borks! */
568 r = vsnprintf(buffer, 0, s, args);
584 rres = cc.run(vsnprintf_c99_test_code, name : 'C99 vsnprintf')
585 if rres.compiled() and rres.returncode() == 0
586 glib_conf.set('HAVE_C99_VSNPRINTF', 1)
589 snprintf_c99_test_code = '''
600 r = snprintf(buffer, 5, "1234567");
605 r = snprintf(buffer, 0, "1234567");
610 r = snprintf(NULL, 0, "1234567");
625 rres = cc.run(snprintf_c99_test_code, name : 'C99 snprintf')
626 if rres.compiled() and rres.returncode() == 0
627 glib_conf.set('HAVE_C99_SNPRINTF', 1)
631 if host_system == 'windows'
632 glib_conf.set('EXEEXT', '".exe"')
634 glib_conf.set('EXEEXT', '""')
637 # Check whether the printf() family supports Unix98 %n$ positional parameters
638 # AC_FUNC_PRINTF_UNIX98
639 # Nothing uses HAVE_UNIX98_PRINTF
641 # Check for nl_langinfo and CODESET
642 # FIXME: Check for HAVE_BIND_TEXTDOMAIN_CODESET
643 if cc.links('''#include <langinfo.h>
644 int main (int argc, char ** argv) {
645 char *codeset = nl_langinfo (CODESET);
647 }''', name : 'nl_langinfo and CODESET')
648 glib_conf.set('HAVE_LANGINFO_CODESET', 1)
649 glib_conf.set('HAVE_CODESET', 1)
652 # Check for nl_langinfo and LC_TIME parts that are needed in gdatetime.c
653 if cc.links('''#include <langinfo.h>
654 int main (int argc, char ** argv) {
656 str = nl_langinfo (PM_STR);
657 str = nl_langinfo (D_T_FMT);
658 str = nl_langinfo (D_FMT);
659 str = nl_langinfo (T_FMT);
660 str = nl_langinfo (T_FMT_AMPM);
661 str = nl_langinfo (MON_1);
662 str = nl_langinfo (ABMON_12);
663 str = nl_langinfo (DAY_1);
664 str = nl_langinfo (ABDAY_7);
666 }''', name : 'nl_langinfo (PM_STR)')
667 glib_conf.set('HAVE_LANGINFO_TIME', 1)
669 if cc.links('''#include <langinfo.h>
670 int main (int argc, char ** argv) {
672 str = nl_langinfo (_NL_CTYPE_OUTDIGIT0_MB);
673 str = nl_langinfo (_NL_CTYPE_OUTDIGIT1_MB);
674 str = nl_langinfo (_NL_CTYPE_OUTDIGIT2_MB);
675 str = nl_langinfo (_NL_CTYPE_OUTDIGIT3_MB);
676 str = nl_langinfo (_NL_CTYPE_OUTDIGIT4_MB);
677 str = nl_langinfo (_NL_CTYPE_OUTDIGIT5_MB);
678 str = nl_langinfo (_NL_CTYPE_OUTDIGIT6_MB);
679 str = nl_langinfo (_NL_CTYPE_OUTDIGIT7_MB);
680 str = nl_langinfo (_NL_CTYPE_OUTDIGIT8_MB);
681 str = nl_langinfo (_NL_CTYPE_OUTDIGIT9_MB);
683 }''', name : 'nl_langinfo (_NL_CTYPE_OUTDIGITn_MB)')
684 glib_conf.set('HAVE_LANGINFO_OUTDIGIT', 1)
687 # Check if C compiler supports the 'signed' keyword
688 if not cc.compiles('''signed char x;''', name : 'signed')
689 glib_conf.set('signed', '/* NOOP */')
692 # Check if the ptrdiff_t type exists
693 if cc.has_header_symbol('stddef.h', 'ptrdiff_t')
694 glib_conf.set('HAVE_PTRDIFF_T', 1)
697 # Check for sig_atomic_t type
698 if cc.links('''#include <signal.h>
699 #include <sys/types.h>
700 sig_atomic_t val = 42;
701 int main (int argc, char ** argv) {
702 return val == 42 ? 0 : 1;
703 }''', name : 'sig_atomic_t')
704 glib_conf.set('HAVE_SIG_ATOMIC_T', 1)
707 # Check if 'long long' works and what format can be used to print it
708 # jm_AC_TYPE_LONG_LONG
709 # Nothing uses HAVE_LONG_LONG_FORMAT and HAVE_INT64_AND_I64
710 if cc.compiles('''long long ll = 1LL;
712 int some_func (void) {
713 long long llmax = (long long) -1;
714 return ll << i | ll >> i | llmax / ll | llmax % ll;
715 }''', name : 'long long')
716 glib_conf.set('HAVE_LONG_LONG', 1)
717 have_long_long = true
719 have_long_long = false
722 # Test whether the compiler supports the 'long double' type.
723 if cc.compiles('''/* The Stardent Vistra knows sizeof(long double), but does not support it. */
724 long double foo = 0.0;
725 /* On Ultrix 4.3 cc, long double is 4 and double is 8. */
726 int array [2*(sizeof(long double) >= sizeof(double)) - 1];''',
727 name : 'long double')
728 glib_conf.set('HAVE_LONG_DOUBLE', 1)
731 #dnl Test whether <stddef.h> has the 'wchar_t' type.
732 if cc.has_header_symbol('stddef.h', 'wchar_t')
733 glib_conf.set('HAVE_WCHAR_T', 1)
736 # Test whether <wchar.h> has the 'wint_t' type.
737 if cc.has_header_symbol('wchar.h', 'wint_t')
738 glib_conf.set('HAVE_WINT_T', 1)
741 found_uintmax_t = false
743 # Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
744 # doesn't clash with <sys/types.h>, and declares uintmax_t.
745 # jm_AC_HEADER_INTTYPES_H
746 if cc.compiles('''#include <sys/types.h>
747 #include <inttypes.h>
748 void some_func (void) {
749 uintmax_t i = (uintmax_t) -1;
750 }''', name : 'uintmax_t in inttypes.h')
751 glib_conf.set('HAVE_INTTYPES_H_WITH_UINTMAX', 1)
752 found_uintmax_t = true
755 # Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
756 # doesn't clash with <sys/types.h>, and declares uintmax_t.
757 # jm_AC_HEADER_STDINT_H
758 if cc.compiles('''#include <sys/types.h>
760 void some_func (void) {
761 uintmax_t i = (uintmax_t) -1;
762 }''', name : 'uintmax_t in stdint.h')
763 glib_conf.set('HAVE_STDINT_H_WITH_UINTMAX', 1)
764 found_uintmax_t = true
767 # Define intmax_t to 'long' or 'long long'
768 # if it is not already defined in <stdint.h> or <inttypes.h>.
769 # For simplicity, we assume that a header file defines 'intmax_t' if and
770 # only if it defines 'uintmax_t'.
772 glib_conf.set('HAVE_INTMAX_T', 1)
774 glib_conf.set('intmax_t', 'long long')
776 glib_conf.set('intmax_t', 'long')
779 char_size = cc.sizeof('char')
780 short_size = cc.sizeof('short')
781 int_size = cc.sizeof('int')
782 voidp_size = cc.sizeof('void*')
783 long_size = cc.sizeof('long')
785 long_long_size = cc.sizeof('long long')
789 sizet_size = cc.sizeof('size_t')
790 if cc.get_id() == 'msvc'
791 ssizet_size = cc.sizeof('SSIZE_T', prefix : '#include <BaseTsd.h>')
793 ssizet_size = cc.sizeof('ssize_t')
796 # On Windows, MSVC supports both ll and I64 as format specifiers for 64-bit
797 # integers, but some versions (at least 4.7.x) of MinGW only support I64.
798 if host_system == 'windows'
804 char_align = cc.alignment('char')
805 short_align = cc.alignment('short')
806 int_align = cc.alignment('int')
807 voidp_align = cc.alignment('void*')
808 long_align = cc.alignment('long')
809 long_long_align = cc.alignment('long long')
810 # NOTE: We don't check for size of __int64 because long long is guaranteed to
811 # be 64-bit in C99, and it is available on all supported compilers
812 sizet_align = cc.alignment('size_t')
814 glib_conf.set('ALIGNOF_UNSIGNED_LONG', long_align)
816 glib_conf.set('SIZEOF_CHAR', char_size)
817 glib_conf.set('SIZEOF_INT', int_size)
818 glib_conf.set('SIZEOF_SHORT', short_size)
819 glib_conf.set('SIZEOF_LONG', long_size)
820 glib_conf.set('SIZEOF_LONG_LONG', long_long_size)
821 glib_conf.set('SIZEOF_SIZE_T', sizet_size)
822 glib_conf.set('SIZEOF_SSIZE_T', ssizet_size)
823 glib_conf.set('SIZEOF_VOID_P', voidp_size)
827 gint16_modifier='"h"'
829 guint16_format='"hu"'
836 error('Compiler provides no native 16-bit integer type')
838 glibconfig_conf.set('gint16', gint16)
839 glibconfig_conf.set('gint16_modifier', gint16_modifier)
840 glibconfig_conf.set('gint16_format', gint16_format)
841 glibconfig_conf.set('guint16_format', guint16_format)
845 gint32_modifier='"h"'
847 guint32_format='"hu"'
848 guint32_align = short_align
854 guint32_align = int_align
857 gint32_modifier='"l"'
859 guint32_format='"lu"'
860 guint32_align = long_align
862 error('Compiler provides no native 32-bit integer type')
864 glibconfig_conf.set('gint32', gint32)
865 glibconfig_conf.set('gint32_modifier', gint32_modifier)
866 glibconfig_conf.set('gint32_format', gint32_format)
867 glibconfig_conf.set('guint32_format', guint32_format)
868 glib_conf.set('ALIGNOF_GUINT32', guint32_align)
876 gint64_constant='(val)'
877 guint64_constant='(val)'
878 guint64_align = int_align
882 gint64_modifier='"l"'
884 guint64_format='"lu"'
885 gint64_constant='(val##L)'
886 guint64_constant='(val##UL)'
887 guint64_align = long_align
888 elif long_long_size == 8
891 gint64_modifier=int64_m + '"'
892 gint64_format=int64_m + 'i"'
893 guint64_format=int64_m + 'u"'
894 gint64_constant='(val##LL)'
895 guint64_constant='(val##ULL)'
896 guint64_align = long_long_align
898 error('Compiler provides no native 64-bit integer type')
900 glibconfig_conf.set('gint64', gint64)
901 glibconfig_conf.set('gint64_modifier', gint64_modifier)
902 glibconfig_conf.set('gint64_format', gint64_format)
903 glibconfig_conf.set('guint64_format', guint64_format)
904 glibconfig_conf.set('gint64_constant', gint64_constant)
905 glibconfig_conf.set('guint64_constant', guint64_constant)
906 glib_conf.set('ALIGNOF_GUINT64', guint64_align)
908 if host_system == 'windows'
909 glibconfig_conf.set('g_pid_type', 'void*')
910 glibconfig_conf.set('G_PID_FORMAT', '"p"')
911 if host_machine.cpu_family() == 'x86_64'
912 glibconfig_conf.set('g_pollfd_format', '"%#I64x"')
914 glibconfig_conf.set('g_pollfd_format', '"%#x"')
917 glibconfig_conf.set('g_pid_type', 'int')
918 glibconfig_conf.set('G_PID_FORMAT', '"i"')
919 glibconfig_conf.set('g_pollfd_format', '"%d"')
922 if sizet_size == short_size
923 glibconfig_conf.set('glib_size_type_define', 'short')
924 glibconfig_conf.set('gsize_modifier', '"h"')
925 glibconfig_conf.set('gssize_modifier', '"h"')
926 glibconfig_conf.set('gsize_format', '"hu"')
927 glibconfig_conf.set('gssize_format', '"hi"')
928 glibconfig_conf.set('glib_msize_type', 'SHRT')
929 elif sizet_size == int_size
930 glibconfig_conf.set('glib_size_type_define', 'int')
931 glibconfig_conf.set('gsize_modifier', '""')
932 glibconfig_conf.set('gssize_modifier', '""')
933 glibconfig_conf.set('gsize_format', '"u"')
934 glibconfig_conf.set('gssize_format', '"i"')
935 glibconfig_conf.set('glib_msize_type', 'INT')
936 elif sizet_size == long_size
937 glibconfig_conf.set('glib_size_type_define', 'long')
938 glibconfig_conf.set('gsize_modifier', '"l"')
939 glibconfig_conf.set('gssize_modifier', '"l"')
940 glibconfig_conf.set('gsize_format', '"lu"')
941 glibconfig_conf.set('gssize_format', '"li"')
942 glibconfig_conf.set('glib_msize_type', 'LONG')
943 elif sizet_size == long_long_size
944 glibconfig_conf.set('glib_size_type_define', 'long long')
945 glibconfig_conf.set('gsize_modifier', int64_m + '"')
946 glibconfig_conf.set('gssize_modifier', int64_m + '"')
947 glibconfig_conf.set('gsize_format', int64_m + 'u"')
948 glibconfig_conf.set('gssize_format', int64_m + 'i"')
949 glibconfig_conf.set('glib_msize_type', 'INT64')
951 error('Could not determine size of size_t.')
954 if voidp_size == int_size
955 glibconfig_conf.set('glib_intptr_type_define', 'int')
956 glibconfig_conf.set('gintptr_modifier', '""')
957 glibconfig_conf.set('gintptr_format', '"i"')
958 glibconfig_conf.set('guintptr_format', '"u"')
959 glibconfig_conf.set('glib_gpi_cast', '(gint)')
960 glibconfig_conf.set('glib_gpui_cast', '(guint)')
961 elif voidp_size == long_size
962 glibconfig_conf.set('glib_intptr_type_define', 'long')
963 glibconfig_conf.set('gintptr_modifier', '"l"')
964 glibconfig_conf.set('gintptr_format', '"li"')
965 glibconfig_conf.set('guintptr_format', '"lu"')
966 glibconfig_conf.set('glib_gpi_cast', '(glong)')
967 glibconfig_conf.set('glib_gpui_cast', '(gulong)')
968 elif voidp_size == long_long_size
969 glibconfig_conf.set('glib_intptr_type_define', 'long long')
970 glibconfig_conf.set('gintptr_modifier', int64_m + '"')
971 glibconfig_conf.set('gintptr_format', int64_m + 'i"')
972 glibconfig_conf.set('guintptr_format', int64_m + 'u"')
973 glibconfig_conf.set('glib_gpi_cast', '(gint64)')
974 glibconfig_conf.set('glib_gpui_cast', '(guint64)')
976 error('Could not determine size of void *')
979 if long_size != 8 and long_long_size != 8 and int_size != 8
980 error('GLib requires a 64-bit type. You might want to consider using the GNU C compiler.')
983 glibconfig_conf.set('gintbits', int_size * 8)
984 glibconfig_conf.set('glongbits', long_size * 8)
985 glibconfig_conf.set('gsizebits', sizet_size * 8)
986 glibconfig_conf.set('gssizebits', ssizet_size * 8)
988 # FIXME: maybe meson should tell us the libsuffix?
989 if host_system == 'windows'
990 g_module_suffix = 'dll'
991 elif host_system == 'darwin'
992 g_module_suffix = 'dylib'
994 g_module_suffix = 'so'
996 glibconfig_conf.set('g_module_suffix', g_module_suffix)
998 glibconfig_conf.set('GLIB_MAJOR_VERSION', major_version)
999 glibconfig_conf.set('GLIB_MINOR_VERSION', minor_version)
1000 glibconfig_conf.set('GLIB_MICRO_VERSION', micro_version)
1002 glibconfig_conf.set('glib_void_p', voidp_size)
1003 glibconfig_conf.set('glib_long', long_size)
1004 glibconfig_conf.set('glib_size_t', sizet_size)
1005 glibconfig_conf.set('glib_ssize_t', ssizet_size)
1006 if host_machine.endian() == 'big'
1007 glibconfig_conf.set('g_byte_order', 'G_BIG_ENDIAN')
1008 glibconfig_conf.set('g_bs_native', 'BE')
1009 glibconfig_conf.set('g_bs_alien', 'LE')
1011 glibconfig_conf.set('g_byte_order', 'G_LITTLE_ENDIAN')
1012 glibconfig_conf.set('g_bs_native', 'LE')
1013 glibconfig_conf.set('g_bs_alien', 'BE')
1016 # === va_copy checks ===
1017 # we currently check for all three va_copy possibilities, so we get
1018 # all results in config.log for bug reports.
1020 foreach try_func : [ '__va_copy', 'va_copy' ]
1021 if cc.compiles('''#include <stdarg.h>
1023 void f (int i, ...) {
1024 va_list args1, args2;
1025 va_start (args1, i);
1027 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1029 va_end (args1); va_end (args2);
1034 }'''.format(try_func),
1035 name : try_func + ' check')
1036 va_copy_func = try_func
1039 glib_conf.set('G_VA_COPY', va_copy_func)
1040 glib_vacopy = '#define G_VA_COPY ' + va_copy_func
1042 va_list_val_copy_prog = '''
1045 void f (int i, ...) {
1046 va_list args1, args2;
1047 va_start (args1, i);
1049 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1051 va_end (args1); va_end (args2);
1058 # We do this in two steps so if compilation fails already it looks less alarming
1059 glib_va_val_copy = false
1060 if cc.compiles(va_list_val_copy_prog, name : 'va_lists can be copied as values')
1061 # FIXME: what to do when cross-compiling?
1062 if cc.run(va_list_val_copy_prog, name : 'va_lists can be copied as values').returncode() == 0
1063 glib_va_val_copy = true
1066 if not glib_va_val_copy
1067 glib_va_val_copy = false
1068 glib_vacopy = glib_vacopy + '\n#define G_VA_COPY_AS_ARRAY 1'
1069 glib_conf.set('G_VA_COPY_AS_ARRAY', 1)
1071 glibconfig_conf.set('glib_vacopy', glib_vacopy)
1073 # check for flavours of varargs macros
1074 g_have_iso_c_varargs = cc.compiles('''
1075 void some_func (void) {
1076 int a(int p1, int p2, int p3);
1077 #define call_a(...) a(1,__VA_ARGS__)
1079 }''', name : 'ISO C99 varargs macros in C')
1081 if g_have_iso_c_varargs
1082 glibconfig_conf.set('g_have_iso_c_varargs', '''
1084 # define G_HAVE_ISO_VARARGS 1
1088 g_have_iso_cxx_varargs = cxx.compiles('''
1089 void some_func (void) {
1090 int a(int p1, int p2, int p3);
1091 #define call_a(...) a(1,__VA_ARGS__)
1093 }''', name : 'ISO C99 varargs macros in C++')
1095 if g_have_iso_cxx_varargs
1096 glibconfig_conf.set('g_have_iso_cxx_varargs', '''
1098 # define G_HAVE_ISO_VARARGS 1
1102 g_have_gnuc_varargs = cc.compiles('''
1103 void some_func (void) {
1104 int a(int p1, int p2, int p3);
1105 #define call_a(params...) a(1,params)
1107 }''', name : 'GNUC varargs macros')
1109 if cc.has_header('alloca.h')
1110 glibconfig_conf.set('GLIB_HAVE_ALLOCA_H', true)
1112 has_syspoll = cc.has_header('sys/poll.h')
1113 has_systypes = cc.has_header('sys/types.h')
1115 glibconfig_conf.set('GLIB_HAVE_SYS_POLL_H', true)
1117 has_winsock2 = cc.has_header('winsock2.h')
1119 if has_syspoll and has_systypes
1120 templ = '''#include<sys/poll.h>
1121 #include<sys/types.h>
1123 int main(int argc, char **argv) {
1124 printf("%d\n", (int)@0@);
1128 templ = '''#define _WIN32_WINNT 0x0600
1130 #include <winsock2.h>
1131 int main(int argc, char **argv) {
1132 printf("%d\n", (int)@0@);
1137 error('FIX POLL* defines')
1140 value_POLLIN = cc.run(templ.format('POLLIN'), name : 'POLLIN value').stdout().strip()
1141 value_POLLOUT = cc.run(templ.format('POLLOUT'), name : 'POLLOUT value').stdout().strip()
1142 value_POLLPRI = cc.run(templ.format('POLLPRI'), name : 'POLLPRI value').stdout().strip()
1143 value_POLLERR = cc.run(templ.format('POLLERR'), name : 'POLLERR value').stdout().strip()
1144 value_POLLHUP = cc.run(templ.format('POLLHUP'), name : 'POLLHUP value').stdout().strip()
1145 value_POLLNVAL = cc.run(templ.format('POLLNVAL'), name : 'POLLNVAL value').stdout().strip()
1147 glibconfig_conf.set('g_pollin', value_POLLIN)
1148 glibconfig_conf.set('g_pollout', value_POLLOUT)
1149 glibconfig_conf.set('g_pollpri', value_POLLPRI)
1150 glibconfig_conf.set('g_pollerr', value_POLLERR)
1151 glibconfig_conf.set('g_pollhup', value_POLLHUP)
1152 glibconfig_conf.set('g_pollnval', value_POLLNVAL)
1154 # Internet address families
1155 # FIXME: what about Cygwin (G_WITH_CYGWIN)
1156 if host_system == 'windows'
1157 glib_inet_includes= '''
1158 #include <winsock2.h>
1161 glib_inet_includes='''
1162 #include <sys/types.h>
1163 #include <sys/socket.h>
1168 [ 'AF_UNIX', 'g_af_unix' ],
1169 [ 'AF_INET', 'g_af_inet' ],
1170 [ 'AF_INET6', 'g_af_inet6' ],
1171 [ 'MSG_OOB', 'g_msg_oob' ],
1172 [ 'MSG_PEEK', 'g_msg_peek' ],
1173 [ 'MSG_DONTROUTE', 'g_msg_dontroute' ],
1175 foreach d : net_defines
1178 int main(int argc, char **argv) {
1179 printf("%d\n", (int)@1@);
1182 # FIXME: fix for cross-compilation
1183 if not meson.has_exe_wrapper()
1184 error('Fix sys define detection for cross build')
1186 val = cc.run(templ.format(glib_inet_includes, d[0]), name : d[0] + ' value').stdout().strip()
1187 glibconfig_conf.set(d[1], val)
1190 glibconfig_conf.set('GLIB_USING_SYSTEM_PRINTF', true) # FIXME!
1192 # We need a more robust approach here...
1193 host_cpu_family = host_machine.cpu_family()
1194 if host_cpu_family == 'x86' or host_cpu_family == 'x86_64' or host_cpu_family == 's390' or host_cpu_family == 's390x' or host_cpu_family.startswith('arm') or host_cpu_family.startswith('crisv32') or host_cpu_family.startswith('etrax')
1195 glib_memory_barrier_needed = false
1196 elif host_cpu_family.startswith('sparc') or host_cpu_family.startswith('alpha') or host_cpu_family.startswith('powerpc') or host_cpu_family == 'ia64'
1197 glib_memory_barrier_needed = true
1199 error('Unknown host cpu: ' + host_cpu_family)
1200 glib_memory_barrier_needed = true
1202 glibconfig_conf.set('G_ATOMIC_OP_MEMORY_BARRIER_NEEDED', glib_memory_barrier_needed)
1204 # Note that the atomic ops are only available with GCC on x86 when
1205 # using -march=i486 or higher. If we detect that the atomic ops are
1206 # not available but would be available given the right flags, we want
1207 # to abort and advise the user to fix their CFLAGS. It's better to do
1208 # that then to silently fall back on emulated atomic ops just because
1209 # the user had the wrong build environment.
1210 atomictest = '''void func() {
1211 volatile int atomic = 2;
1212 __sync_bool_compare_and_swap (&atomic, 2, 3);
1215 if cc.compiles(atomictest)
1216 glibconfig_conf.set('G_ATOMIC_LOCK_FREE', true)
1218 if host_machine.cpu_family() == 'x86' and cc.compiles(atomictest, args : '-march=i486')
1219 error('GLib must be built with -march=i486 or later.')
1221 glibconfig_conf.set('G_ATOMIC_LOCK_FREE', false)
1226 # Let meson figure out all this business and whether -pthread or whatnot is needed
1227 # FIXME: probably needs more tweaking in meson for things like -D_REENTRANT etc.
1228 thread_dep = dependency('threads')
1230 # Determination of thread implementation
1231 if host_system == 'windows'
1232 glibconfig_conf.set('g_threads_impl_def', 'WIN32')
1233 glib_conf.set('THREADS_WIN32', 1)
1235 glibconfig_conf.set('g_threads_impl_def', 'POSIX')
1236 glib_conf.set('THREADS_POSIX', 1)
1237 if cc.has_header_symbol('pthread.h', 'pthread_attr_setstacksize')
1238 glib_conf.set('HAVE_PTHREAD_ATTR_SETSTACKSIZE', 1)
1240 if cc.has_header_symbol('pthread.h', 'pthread_condattr_setclock')
1241 glib_conf.set('HAVE_PTHREAD_CONDATTR_SETCLOCK', 1)
1243 if cc.has_header_symbol('pthread.h', 'pthread_cond_timedwait_relative_np')
1244 glib_conf.set('HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP', 1)
1246 if cc.links('''#include <pthread.h>
1248 pthread_setname_np("example");
1249 }''', name : 'pthread_setname_np(const char*)')
1250 glib_conf.set('HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID', 1)
1251 elif cc.links('''#include <pthread.h>
1253 pthread_setname_np(pthread_self(), "example");
1254 }''', name : 'pthread_setname_np(pthread_t, const char*)')
1255 glib_conf.set('HAVE_PTHREAD_SETNAME_NP_WITH_TID', 1)
1259 # FIXME: how to do this when cross-compiling?
1260 # FIXME: we should make it print the result and always return 0, so that
1261 # the output in meson shows up as green
1262 stack_grows_check_prog = '''
1263 volatile int *a = 0, *b = 0;
1275 return b > a ? 0 : 1;
1277 stack_grows_run_result = cc.run(stack_grows_check_prog, name : 'stack grows check')
1278 if stack_grows_run_result.compiled() and stack_grows_run_result.returncode() == 0
1279 glibconfig_conf.set('G_HAVE_GROWING_STACK', 1)
1281 glibconfig_conf.set('G_HAVE_GROWING_STACK', 0)
1286 # First, we check if the C library provides iconv, then GNU libiconv, then
1287 # a native implementation
1288 # FIXME: add option as well
1290 # USE_LIBICONV_GNU: Using GNU libiconv
1291 # USE_LIBICONV_NATIVE: Using a native impl of iconv in a separate library
1293 # We should never use the MinGW C library's iconv. On Windows we use the
1294 # GNU implementation that ships with MinGW.
1296 # On Windows, just always use the built-in implementation
1297 if host_system == 'windows'
1299 glib_conf.set('USE_LIBICONV_NATIVE', true)
1300 # Check C library; never check MinGW C library
1301 elif cc.has_function('iconv_open')
1303 # Check for libiconv
1304 elif cc.has_header_symbol('iconv.h', 'libiconv_open')
1305 glib_conf.set('USE_LIBICONV_GNU', true)
1306 libiconv = [cc.find_library('iconv')]
1307 # Check for a custom iconv implementation
1308 elif cc.has_header_symbol('iconv.h', 'iconv_open')
1309 glib_conf.set('USE_LIBICONV_NATIVE', true)
1310 libiconv = [cc.find_library('iconv')]
1312 error('No iconv() implementation found in C library or libiconv')
1315 pcre = dependency('libpcre', required : false) # Should check for Unicode support, too. FIXME
1316 glib_conf.set('USE_SYSTEM_PCRE', pcre.found())
1318 libm = cc.find_library('m', required : false)
1319 libffi_dep = dependency('libffi', version : '>= 3.0.0', fallback : ['libffi', 'ffi_dep'])
1320 libz_dep = dependency('zlib', fallback : ['zlib', 'zlib_dep'])
1322 # Only used on non-glibc targets
1323 libintl = cc.find_library('intl', required : false)
1324 if host_system == 'windows' and not libintl.found()
1325 # Used only when the gettext library is not available (MSVC, not MinGW)
1326 libintl = subproject('proxy-libintl').get_variable('intl_dep')
1327 glib_conf.set('HAVE_DCGETTEXT', 1)
1329 glib_conf.set('HAVE_DCGETTEXT', cc.has_header_symbol('libintl.h', 'dcgettext'))
1331 # We require gettext to always be present
1332 glib_conf.set('HAVE_GETTEXT', 1)
1333 glib_conf.set_quoted('GLIB_LOCALE_DIR', join_paths(glib_datadir, 'locale'))
1334 # xgettext is optional (on Windows for instance)
1335 xgettext = find_program('xgettext', required : false)
1337 # libmount is only used by gio, but we need to fetch the libs to generate the
1338 # pkg-config file below
1340 libmount_opt = get_option('enable-libmount')
1341 if host_system == 'linux' and libmount_opt != 'no'
1342 libmount_dep = [dependency('mount', version : '>=2.28', required : false)]
1343 if not libmount_dep[0].found()
1344 libmount_dep = [cc.find_library('mount')]
1345 libmount_h = cc.has_header('libmount/libmount.h')
1346 libmount_needed = libmount_opt == 'yes' and host_system == 'linux'
1347 if libmount_needed and (not libmount_dep[0].found() or not libmount_h)
1348 error('Need libmount but couldn\'t find it')
1353 if host_system == 'windows'
1354 winsock2 = cc.find_library('ws2_32')
1357 python = import('python3').find_python()
1359 # FIXME: defines in config.h that are not actually used anywhere
1360 # (we add them for now to minimise the diff)
1361 glib_conf.set('HAVE_DLFCN_H', 1)
1362 glib_conf.set('__EXTENSIONS__', 1)
1363 glib_conf.set('STDC_HEADERS', 1)
1365 glib_conf.set('SIZEOF___INT64', 8)
1367 # Various substs needed for our pkg-config files
1368 # FIXME: Derive these from the dependency() objects (Meson support needed)
1369 glib_conf.set('ZLIB_LIBS', '-lz')
1370 glib_conf.set('LIBFFI_LIBS', '-lffi')
1372 glib_conf.set('INTLLIBS', '-lintl')
1374 if libiconv.length() != 0
1375 glib_conf.set('ICONV_LIBS', '-liconv')
1378 glib_conf.set('PCRE_LIBS', '-lpcre')
1380 if libmount_dep.length() == 1 and libmount_dep[0].found()
1381 glib_conf.set('LIBMOUNT_LIBS', '-lmount')
1383 glib_conf.set('GIO_MODULE_DIR', '${libdir}/gio/modules')
1385 # @G_MODULE_LIBS@ @SELINUX_LIBS@ @COCOA_LIBS@ @CARBON_LIBS@ @G_LIBS_EXTRA@
1386 # @PCRE_REQUIRES@ @GLIB_EXTRA_CFLAGS@ @G_THREAD_CFLAGS@
1389 want_dtrace = get_option('enable-dtrace')
1390 enable_dtrace = false
1392 # Since dtrace support is opt-in we just error out if it was requested but
1393 # is not available. We don't bother with autodetection yet.
1396 error('GLib dtrace support not yet compatible with macOS dtrace')
1398 dtrace = find_program('dtrace', required : true) # error out if not found
1399 if not cc.has_header('sys/sdt.h')
1400 error('dtrace support needs sys/sdt.h header')
1402 # FIXME: autotools build also passes -fPIC -DPIC but is it needed in this case?
1403 dtrace_obj_gen = generator(dtrace,
1404 output : '@BASENAME@.o',
1405 arguments : ['-G', '-s', '@INPUT@', '-o', '@OUTPUT@'])
1406 # FIXME: $(SED) -e "s,define STAP_HAS_SEMAPHORES 1,undef STAP_HAS_SEMAPHORES,"
1407 # -e "s,define _SDT_HAS_SEMAPHORES 1,undef _SDT_HAS_SEMAPHORES,"
1408 dtrace_hdr_gen = generator(dtrace,
1409 output : '@BASENAME@.h',
1410 arguments : ['-h', '-s', '@INPUT@', '-o', '@OUTPUT@'])
1411 glib_conf.set('HAVE_DTRACE', 1)
1412 enable_dtrace = true
1416 want_systemtap = get_option('enable-systemtap')
1417 enable_systemtap = false
1419 if want_systemtap and enable_dtrace
1420 tapset_install_dir = get_option('tapset-install-dir')
1421 if tapset_install_dir == ''
1422 tapset_install_dir = join_paths(get_option('datadir'), 'systemtap/tapset')
1424 stp_cdata = configuration_data()
1425 stp_cdata.set('ABS_GLIB_RUNTIME_LIBDIR', glib_libdir)
1426 stp_cdata.set('LT_CURRENT', minor_version.to_int() * 100)
1427 stp_cdata.set('LT_REVISION', micro_version.to_int())
1428 enable_systemtap = true
1442 # Configure and install pkg-config files
1448 'gmodule-export-2.0.pc',
1449 'gmodule-no-export-2.0.pc',
1452 if host_system == 'windows'
1453 pc_files += ['gio-windows-2.0.pc']
1455 pc_files += ['gio-unix-2.0.pc']
1458 foreach pc : pc_files
1459 configure_file(input : pc + '.in',
1461 install_dir : glib_pkgconfigreldir,
1463 configuration : glib_conf)
1466 # NOTE: We skip glib-zip.in because the filenames it assumes don't match ours
1468 # Install glib-gettextize executable
1469 configure_file(input : 'glib-gettextize.in',
1471 install_dir : 'bin',
1472 output : 'glib-gettextize',
1473 configuration : glib_conf)
1475 # Install m4 macros that other projects use
1476 install_data('m4macros/glib-2.0.m4', 'm4macros/glib-gettext.m4', 'm4macros/gsettings.m4',
1477 install_dir : join_paths(get_option('datadir'), 'aclocal'))
1478 # Install Valgrind suppression file
1479 install_data('glib.supp',
1480 install_dir : join_paths(get_option('datadir'), 'glib-2.0', 'valgrind'))
1482 configure_file(input : 'config.h.meson',
1483 output : 'config.h',
1484 configuration : glib_conf)
1486 if get_option('with-man') != 'no'
1487 xsltproc = find_program('xsltproc', required : false)
1488 if not xsltproc.found() and get_option('with-man') == 'yes'
1489 error('man pages enabled and xsltproc not found')
1491 xsltproc_command = [
1494 '--stringparam', 'man.output.quietly', '1',
1495 '--stringparam', 'funcsynopsis.style', 'ansi',
1496 '--stringparam', 'man.th.extra1.suppress', '1',
1497 '--stringparam', 'man.authors.section.enabled', '0',
1498 '--stringparam', 'man.copyright.section.enabled', '0',
1500 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
1503 man1_dir = get_option('mandir') + '/man1'
1506 gnome = import('gnome')
1507 subdir('docs/reference/glib')
1508 subdir('docs/reference/gobject')
1509 subdir('docs/reference/gio')