"Fossies" - the Fresh Open Source Software Archive

Member "fuse-3.2.3/meson.build" (11 May 2018, 3253 Bytes) of package /linux/misc/fuse-3.2.3.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "meson.build": 3.2.2_vs_3.2.3.

    1 project('libfuse3', 'c', version: '3.2.3',
    2         meson_version: '>= 0.38',
    3         default_options: [ 'buildtype=debugoptimized' ])
    4 
    5 
    6 platform = host_machine.system()
    7 if platform == 'darwin'
    8   error('libfuse does not support OS-X.\n' +
    9         'Take a look at http://osxfuse.github.io/ instead')
   10 elif platform == 'cygwin' or platform == 'windows'
   11   error('libfuse does not support Windows.\n' +
   12         'Take a look at http://www.secfs.net/winfsp/ instead')       
   13 endif
   14 
   15 #
   16 # Feature detection
   17 #
   18 cfg = configuration_data()
   19 cc = meson.get_compiler('c')
   20 
   21 # Default includes when checking for presence of functions and
   22 # struct members
   23 include_default = '
   24 #include <stdio.h>
   25 #include <stdlib.h>
   26 #include <stddef.h>
   27 #include <unistd.h>
   28 #include <sys/types.h>
   29 #include <sys/stat.h>
   30 #include <fcntl.h>
   31 '
   32 args_default = [ '-D_GNU_SOURCE' ]
   33 
   34 cfg.set_quoted('PACKAGE_VERSION', meson.project_version())
   35 
   36 # Test for presence of some functions
   37 test_funcs = [ 'fork', 'fstatat', 'openat', 'readlinkat', 'pipe2',
   38                'splice', 'vmsplice', 'posix_fallocate', 'fdatasync',
   39                'utimensat' ]
   40 foreach func : test_funcs
   41     cfg.set('HAVE_' + func.to_upper(),
   42         cc.has_function(func, prefix: include_default, args: args_default))
   43 endforeach
   44 cfg.set('HAVE_SETXATTR', 
   45         cc.has_function('setxattr', prefix: '#include <sys/xattr.h>'))
   46 cfg.set('HAVE_ICONV', 
   47         cc.has_function('iconv', prefix: '#include <iconv.h>'))
   48 
   49 # Test if structs have specific member
   50 cfg.set('HAVE_STRUCT_STAT_ST_ATIM',
   51          cc.has_member('struct stat', 'st_atim',
   52                        prefix: include_default,
   53                        args: args_default))
   54 cfg.set('HAVE_STRUCT_STAT_ST_ATIMESPEC',
   55          cc.has_member('struct stat', 'st_atimespec',
   56                        prefix: include_default,
   57                        args: args_default))
   58 
   59 # Write the test results into config.h (stored in build directory)
   60 configure_file(output: 'config.h',
   61                configuration : cfg)
   62 
   63 #
   64 # Compiler configuration
   65 #
   66 add_global_arguments('-D_REENTRANT', '-DHAVE_CONFIG_H', '-Wall', '-Wextra', '-Wno-sign-compare',
   67                      '-Wstrict-prototypes', '-Wmissing-declarations', '-Wwrite-strings',
   68                      '-fno-strict-aliasing', language: 'c')
   69 
   70 # Some (stupid) GCC versions warn about unused return values even when they are
   71 # casted to void. This makes -Wunused-result pretty useless, since there is no
   72 # way to suppress the warning when we really *want* to ignore the value.
   73 code = '''
   74 __attribute__((warn_unused_result)) int get_4() {
   75     return 4;
   76 }
   77 int main(void) {
   78     (void) get_4();
   79     return 0;
   80 }'''
   81 if not cc.compiles(code, args: [ '-O0', '-Werror=unused-result' ])
   82      message('Compiler warns about unused result even when casting to void')
   83      add_global_arguments('-Wno-unused-result', language: 'c')
   84 endif
   85 
   86 # '.' will refer to current build directory, which contains config.h
   87 include_dirs = include_directories('include', 'lib', '.')
   88 
   89 # Common dependencies
   90 thread_dep = dependency('threads') 
   91 
   92 #
   93 # Read build files from sub-directories
   94 #
   95 subdirs = [ 'lib', 'include', 'example', 'doc', 'test' ]
   96 if not platform.endswith('bsd') and platform != 'dragonfly'
   97   subdirs += 'util'
   98 endif
   99 foreach n : subdirs
  100     subdir(n)
  101 endforeach