]> eyrie.org Git - kerberos/krb5-strength.git/blob - m4/vamacros.m4
Tweak RPM spec file
[kerberos/krb5-strength.git] / m4 / vamacros.m4
1 # serial 1
2
3 dnl Check for support for variadic macros.
4 dnl
5 dnl This file defines two macros for probing for compiler support for variadic
6 dnl macros.  Provided are RRA_C_C99_VAMACROS, which checks for support for the
7 dnl C99 variadic macro syntax, namely:
8 dnl
9 dnl     #define macro(...) fprintf(stderr, __VA_ARGS__)
10 dnl
11 dnl and RRA_C_GNU_VAMACROS, which checks for support for the older GNU
12 dnl variadic macro syntax, namely:
13 dnl
14 dnl    #define macro(args...) fprintf(stderr, args)
15 dnl
16 dnl They set HAVE_C99_VAMACROS or HAVE_GNU_VAMACROS as appropriate.
17 dnl
18 dnl The canonical version of this file is maintained in the rra-c-util
19 dnl package, available at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
20 dnl
21 dnl Written by Russ Allbery <eagle@eyrie.org>
22 dnl Copyright 2006, 2008-2009
23 dnl     The Board of Trustees of the Leland Stanford Junior University
24 dnl
25 dnl This file is free software; the authors give unlimited permission to copy
26 dnl and/or distribute it, with or without modifications, as long as this
27 dnl notice is preserved.
28 dnl
29 dnl SPDX-License-Identifier: FSFULLR
30
31 AC_DEFUN([_RRA_C_C99_VAMACROS_SOURCE], [[
32 #include <stdio.h>
33 #define error(...) fprintf(stderr, __VA_ARGS__)
34
35 int
36 main(void) {
37     error("foo");
38     error("foo %d", 0);
39     return 0;
40 }
41 ]])
42
43 AC_DEFUN([RRA_C_C99_VAMACROS],
44 [AC_CACHE_CHECK([for C99 variadic macros], [rra_cv_c_c99_vamacros],
45     [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_RRA_C_C99_VAMACROS_SOURCE])],
46         [rra_cv_c_c99_vamacros=yes],
47         [rra_cv_c_c99_vamacros=no])])
48  AS_IF([test x"$rra_cv_c_c99_vamacros" = xyes],
49     [AC_DEFINE([HAVE_C99_VAMACROS], 1,
50         [Define if the compiler supports C99 variadic macros.])])])
51
52 AC_DEFUN([_RRA_C_GNU_VAMACROS_SOURCE], [[
53 #include <stdio.h>
54 #define error(args...) fprintf(stderr, args)
55
56 int
57 main(void) {
58     error("foo");
59     error("foo %d", 0);
60     return 0;
61 }
62 ]])
63
64 AC_DEFUN([RRA_C_GNU_VAMACROS],
65 [AC_CACHE_CHECK([for GNU-style variadic macros], [rra_cv_c_gnu_vamacros],
66     [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_RRA_C_GNU_VAMACROS_SOURCE])],
67         [rra_cv_c_gnu_vamacros=yes],
68         [rra_cv_c_gnu_vamacros=no])])
69  AS_IF([test x"$rra_cv_c_gnu_vamacros" = xyes],
70     [AC_DEFINE([HAVE_GNU_VAMACROS], 1,
71         [Define if the compiler supports GNU-style variadic macros.])])])