File: ruby_check_printf_prefix.m4

package info (click to toggle)
ruby3.3 3.3.8-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 153,620 kB
  • sloc: ruby: 1,244,308; ansic: 836,474; yacc: 28,074; pascal: 6,748; sh: 3,913; python: 1,719; cpp: 1,158; makefile: 742; asm: 712; javascript: 394; lisp: 97; perl: 62; awk: 36; sed: 23; xml: 4
file content (29 lines) | stat: -rw-r--r-- 1,377 bytes parent folder | download | duplicates (3)
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
dnl -*- Autoconf -*-
AC_DEFUN([RUBY_CHECK_PRINTF_PREFIX], [
AC_CACHE_CHECK([for printf prefix for $1], [rb_cv_pri_prefix_]AS_TR_SH($1),[
    [rb_cv_pri_prefix_]AS_TR_SH($1)=[NONE]
    RUBY_WERROR_FLAG(RUBY_APPEND_OPTIONS(CFLAGS, $rb_cv_wsuppress_flags)
    for pri in $2; do
        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <stdio.h>
	    @%:@include <stddef.h>
            @%:@ifdef __GNUC__
            @%:@if defined __MINGW_PRINTF_FORMAT
            @%:@define PRINTF_ARGS(decl, string_index, first_to_check) \
              decl __attribute__((format(__MINGW_PRINTF_FORMAT, string_index, first_to_check)))
            @%:@else
            @%:@define PRINTF_ARGS(decl, string_index, first_to_check) \
              decl __attribute__((format(printf, string_index, first_to_check)))
            @%:@endif
            @%:@else
            @%:@define PRINTF_ARGS(decl, string_index, first_to_check) decl
            @%:@endif
	    PRINTF_ARGS(void test_sprintf(const char*, ...), 1, 2);]],
            [[printf("%]${pri}[d", (]$1[)42);
             test_sprintf("%]${pri}[d", (]$1[)42);]])],
            [rb_cv_pri_prefix_]AS_TR_SH($1)[=[$pri]; break])
    done)])
AS_IF([test "[$rb_cv_pri_prefix_]AS_TR_SH($1)" != NONE], [
    AC_DEFINE_UNQUOTED([PRI_]m4_ifval($3,$3,AS_TR_CPP(m4_bpatsubst([$1],[_t$])))[_PREFIX],
        "[$rb_cv_pri_prefix_]AS_TR_SH($1)")
])
])dnl