summaryrefslogtreecommitdiff
path: root/glib/gnulib/gl_cv_func_ldexpl_works/meson.build
blob: ae176cb8e01bbf53bcf8c8a05b7b7e052e46cbb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Copyright (C) 2002-2004, 2006-2018 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

ldexpl_test = '''
#include <math.h>
extern
#ifdef __cplusplus
"C"
#endif

#if !defined (_MSC_VER) || defined (TEST_LDEXPL_DECL)
long double ldexpl (long double, int);
#endif

int main()
{
  int result = 0;
  {
    volatile long double x = 1.0;
    volatile long double y = ldexpl (x, -1);
    if (y != 0.5L)
      result |= 1;
  }
  {
    volatile long double x = 1.73205L;
    volatile long double y = ldexpl (x, 0);
    if (y != x)
      result |= 2;
  }
  return result;
}
'''

if not meson.is_cross_build() or meson.has_exe_wrapper()
  run_result = cc.run(ldexpl_test,
      name : 'ldexpl works',
      dependencies : [libm])
  gl_cv_func_ldexpl_works = run_result.compiled() and run_result.returncode() == 0
else
  if host_system.startswith ('aix')
    gl_cv_func_ldexpl_works = false
  elif host_system == 'windows'
    gl_cv_func_ldexpl_works = true
  else
    gl_cv_func_ldexpl_works = true
  endif
endif

ldexpl_test_decl = '''
#define TEST_LDEXPL_DECL 1
''' + ldexpl_test

build_result = cc.compiles(ldexpl_test_decl,
    name : 'ldexpl prototype can be re-listed')
gl_cv_func_ldexpl_decl = build_result