Merge branch 'upstream' into tizen
[platform/upstream/fribidi.git] / meson.build
1 project('fribidi', 'c', version: '1.0.10',
2   meson_version : '>= 0.48')
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 = false
30 if host_machine.system() != 'windows'
31   have_visibility_hidden = cc.has_argument('-fvisibility=hidden')
32   if have_visibility_hidden
33     add_project_arguments('-fvisibility=hidden', language: 'c')
34   endif
35 endif
36
37 # Must explicitly make symbols public if default visibility is hidden
38 visibility_args = []
39 fribidi_static_cargs = []
40 if have_visibility_hidden
41   visibility_args = ['-DFRIBIDI_ENTRY=__attribute__ ((visibility ("default")))']
42 else
43   if host_machine.system() == 'windows'
44     if get_option('default_library') == 'static'
45       fribidi_static_cargs = ['-DFRIBIDI_LIB_STATIC']
46     endif
47   endif
48 endif
49
50 cdata = configuration_data()
51
52 # Checks for library functions
53 foreach f : ['memmove', 'memset', 'strdup']
54   cdata.set('HAVE_' + f.to_upper(), cc.has_function(f))
55 endforeach
56
57 # Checks for header files
58 # Some HAVE_FOO defines need to be defined to either 1 or 0, others need to
59 # be defined or undefined. The code base is a bit inconsistent there.
60 foreach h : ['stdlib.h', 'string.h', 'memory.h']
61   cdata.set10('HAVE_' + h.underscorify().to_upper(), cc.has_header(h))
62 endforeach
63 foreach h : ['strings.h', 'sys/times.h']
64   cdata.set('HAVE_' + h.underscorify().to_upper(), cc.has_header(h))
65 endforeach
66
67 # Not entirely correct, but sufficient for us. Should move away from this
68 # ancient define and just include individual headers based on individual defs
69 if cc.has_header('strings.h')
70   # define to 1 or leave undefined otherwise, don't simplify
71   cdata.set('STDC_HEADERS', 1)
72 endif
73
74 # This is available pretty much everywhere
75 cdata.set('HAVE_STRINGIZE', 1)
76
77 if get_option('debug')
78   cdata.set('DEBUG', 1)
79 endif
80
81 no_deprecated = not get_option('deprecated')
82 cdata.set('FRIBIDI_NO_DEPRECATED', no_deprecated)
83
84 # write config.h
85 config_h = configure_file(output: 'config.h', configuration: cdata)
86
87 incs = include_directories('.', 'lib', 'gen.tab')
88
89 subdir('gen.tab')
90 subdir('lib')
91 if get_option('bin')
92   subdir('bin')
93 endif
94 if get_option('tests')
95    subdir('test')
96 endif
97 if get_option('docs')
98   subdir('doc')
99 endif
100
101 # fribidi.pc
102 pkg = import('pkgconfig')
103 pkg.generate(name: 'GNU FriBidi',
104   filebase: 'fribidi',
105   description: 'Unicode Bidirectional Algorithm Library',
106   libraries: libfribidi, 
107   subdirs: 'fribidi',
108   version: meson.project_version())