File: meson.build

package info (click to toggle)
glib2.0 2.85.1-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 66,344 kB
  • sloc: ansic: 541,342; python: 9,624; sh: 1,572; xml: 1,482; perl: 1,222; cpp: 535; makefile: 316; javascript: 11
file content (39 lines) | stat: -rw-r--r-- 1,314 bytes parent folder | download | duplicates (8)
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
# 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.

# Test whether the *printf family of functions supports the - flag correctly.
# (ISO C99.) See
# <https://lists.gnu.org/r/bug-coreutils/2008-02/msg00035.html>
# Result is gl_cv_func_printf_flag_leftadjust.

printf_flag_leftadjust_test = '''
#include <stdio.h>
#include <string.h>
static char buf[100];
int main ()
{
  /* Check that a '-' flag is not annihilated by a negative width.  */
  if (sprintf (buf, "a%-*sc", -3, "b") < 0
      || strcmp (buf, "ab  c") != 0)
    return 1;
  return 0;
}
'''

if meson.can_run_host_binaries()
  run_result = cc.run(printf_flag_leftadjust_test,
      name : 'printf supports the left-adjust flag correctly')
  gl_cv_func_printf_flag_leftadjust = run_result.compiled() and run_result.returncode() == 0
else
  if host_system.startswith ('hpux11')
    gl_cv_func_printf_flag_leftadjust = true
  elif host_system.startswith ('hpux')
    gl_cv_func_printf_flag_leftadjust = false
  elif host_system == 'windows'
    gl_cv_func_printf_flag_leftadjust = true
  else
    gl_cv_func_printf_flag_leftadjust = true
  endif
endif