|
51 | 51 | ])# PGAC_C_INLINE
|
52 | 52 |
|
53 | 53 |
|
| 54 | +# PGAC_C_PRINTF_ARCHETYPE |
| 55 | +# ----------------------- |
| 56 | +# Set the format archetype used by gcc to check printf type functions. We |
| 57 | +# prefer "gnu_printf", which includes what glibc uses, such as %m for error |
| 58 | +# strings and %lld for 64 bit long longs. GCC 4.4 introduced it. It makes a |
| 59 | +# dramatic difference on Windows. |
| 60 | +AC_DEFUN([PGAC_PRINTF_ARCHETYPE], |
| 61 | +[AC_CACHE_CHECK([for printf format archetype], pgac_cv_printf_archetype, |
| 62 | +[ac_save_c_werror_flag=$ac_c_werror_flag |
| 63 | +ac_c_werror_flag=yes |
| 64 | +AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
| 65 | +[extern int |
| 66 | +pgac_write(int ignore, const char *fmt,...) |
| 67 | +__attribute__((format(gnu_printf, 2, 3)));], [])], |
| 68 | + [pgac_cv_printf_archetype=gnu_printf], |
| 69 | + [pgac_cv_printf_archetype=printf]) |
| 70 | +ac_c_werror_flag=$ac_save_c_werror_flag]) |
| 71 | +AC_DEFINE_UNQUOTED([PG_PRINTF_ATTRIBUTE], [$pgac_cv_printf_archetype], |
| 72 | + [Define to gnu_printf if compiler supports it, else printf.]) |
| 73 | +])# PGAC_PRINTF_ARCHETYPE |
| 74 | + |
54 | 75 |
|
55 | 76 | # PGAC_TYPE_64BIT_INT(TYPE)
|
56 | 77 | # -------------------------
|
|
0 commit comments