|
| 1 | +project('paps', 'c', |
| 2 | + version: '0.7.0', |
| 3 | + default_options : ['c_std=c99'], |
| 4 | + meson_version : '>= 0.44') |
| 5 | + |
| 6 | +# C compiler. This is the cross compiler if we're cross-compiling |
| 7 | +cc = meson.get_compiler('c') |
| 8 | + |
| 9 | +cdata = configuration_data() |
| 10 | + |
| 11 | +# Checks for library functions |
| 12 | +foreach f : ['memmove', 'memset', 'strdup'] |
| 13 | + cdata.set('HAVE_' + f.to_upper(), cc.has_function(f)) |
| 14 | +endforeach |
| 15 | + |
| 16 | +# Checks for header files |
| 17 | +# Some HAVE_FOO defines need to be defined to either 1 or 0, others need to |
| 18 | +# be defined or undefined. The code base is a bit inconsistent there. |
| 19 | +foreach h : ['stdlib.h', 'string.h', 'memory.h'] |
| 20 | + cdata.set10('HAVE_' + h.underscorify().to_upper(), cc.has_header(h)) |
| 21 | +endforeach |
| 22 | +foreach h : ['strings.h', 'sys/times.h'] |
| 23 | + cdata.set('HAVE_' + h.underscorify().to_upper(), cc.has_header(h)) |
| 24 | +endforeach |
| 25 | + |
| 26 | +# Not entirely correct, but sufficient for us. Should move away from this |
| 27 | +# ancient define and just include individual headers based on individual defs |
| 28 | +if cc.has_header('strings.h') |
| 29 | + # define to 1 or leave undefined otherwise, don't simplify |
| 30 | + cdata.set('STDC_HEADERS', 1) |
| 31 | +endif |
| 32 | + |
| 33 | +# This is available pretty much everywhere |
| 34 | +cdata.set('HAVE_STRINGIZE', 1) |
| 35 | + |
| 36 | +# Assume we have nls, since paps doesn't compile without it |
| 37 | +cdata.set('ENABLE_NLS',1) |
| 38 | + |
| 39 | +# Not really sure what this is used for, but paps doesn't compile without it. |
| 40 | +cdata.set_quoted('DATADIR','.') |
| 41 | + |
| 42 | +buildtype = get_option('buildtype') |
| 43 | +if buildtype == 'debug' or buildtype == 'debugoptimized' |
| 44 | + cdata.set('DEBUG', 1) |
| 45 | +endif |
| 46 | + |
| 47 | +cdata.set_quoted('GETTEXT_PACKAGE', meson.project_name()) |
| 48 | + |
| 49 | +# write config.h |
| 50 | +config_h = configure_file(output: 'config.h', configuration: cdata) |
| 51 | + |
| 52 | +incs = include_directories('.', 'src') |
| 53 | + |
| 54 | +subdir('src') |
0 commit comments