Merge branch 'upstream' into tizen
[platform/upstream/fribidi.git] / meson.build
1 project('fribidi', 'c', version: '1.0.2',
2   meson_version : '>= 0.44')
3
4 # New release:
5 #   interface_age++
6 #   micro version++
7 #
8 # If any functions have been added:
9 #   interface_age = 0
10 #   interface_version++
11 #
12 # If binary backwards compatibility has been broken:
13 #   panic!
14
15 interface_age = 0
16 interface_version = 4
17
18 soversion = 0
19 libversion = '@0@.@1@.0'.format(soversion, interface_version, interface_age)
20
21 # C compiler. This is the cross compiler if we're cross-compiling
22 cc = meson.get_compiler('c')
23
24 if cc.get_id() == 'gcc' and cc.has_argument('-ansi')
25   add_project_arguments('-ansi', language: 'c')
26 endif
27
28 # Symbol visibility
29 have_visibility_hidden = cc.has_argument('-fvisibility=hidden')
30 if have_visibility_hidden
31   add_project_arguments('-fvisibility=hidden', language: 'c')
32 endif
33
34 # Must explicitly make symbols public if default visibility is hidden
35 if have_visibility_hidden
36   visibility_args = ['-DFRIBIDI_ENTRY=extern __attribute__ ((visibility ("default")))']
37 else
38   if host_machine.system() == 'windows' and get_option('default_library') != 'static'
39     visibility_args = ['-DFRIBIDI_ENTRY=__declspec(dllexport)']
40   else
41     visibility_args = ['-DFRIBIDI_ENTRY=extern']
42   endif
43 endif
44
45 cdata = configuration_data()
46
47 # Checks for library functions
48 foreach f : ['memmove', 'memset', 'strdup']
49   cdata.set('HAVE_' + f.to_upper(), cc.has_function(f))
50 endforeach
51
52 # Checks for header files
53 # Some HAVE_FOO defines need to be defined to either 1 or 0, others need to
54 # be defined or undefined. The code base is a bit inconsistent there.
55 foreach h : ['stdlib.h', 'string.h', 'memory.h']
56   cdata.set10('HAVE_' + h.underscorify().to_upper(), cc.has_header(h))
57 endforeach
58 foreach h : ['strings.h', 'sys/times.h']
59   cdata.set('HAVE_' + h.underscorify().to_upper(), cc.has_header(h))
60 endforeach
61
62 # Not entirely correct, but sufficient for us. Should move away from this
63 # ancient define and just include individual headers based on individual defs
64 if cc.has_header('strings.h')
65   # define to 1 or leave undefined otherwise, don't simplify
66   cdata.set('STDC_HEADERS', 1)
67 endif
68
69 # This is available pretty much everywhere
70 cdata.set('HAVE_STRINGIZE', 1)
71
72 buildtype = get_option('buildtype')
73 if buildtype == 'debug' or buildtype == 'debugoptimized'
74   cdata.set('DEBUG', 1)
75 endif
76
77 no_deprecated = not get_option('deprecated')
78 cdata.set('FRIBIDI_NO_DEPRECATED', no_deprecated)
79
80 # write config.h
81 config_h = configure_file(output: 'config.h', configuration: cdata)
82
83 incs = include_directories('.', 'lib')
84
85 subdir('gen.tab')
86 subdir('lib')
87 subdir('bin')
88 subdir('test')
89 if get_option('docs')
90   subdir('doc')
91 endif
92
93 # fribidi.pc
94 pkg = import('pkgconfig')
95 pkg.generate(name: 'GNU FriBidi',
96   filebase: 'fribidi',
97   description: 'Unicode Bidirectional Algorithm Library',
98   libraries: libfribidi, 
99   subdirs: 'fribidi',
100   version: meson.project_version())