2N/Adnl Copyright (C) 2003, 2007, 2009-2010 Free Software Foundation, Inc.
2N/Adnl This file is free software; the Free Software Foundation
2N/Adnl gives unlimited permission to copy
and/or distribute it,
2N/Adnl with or without modifications, as long as this notice is preserved.
2N/Adnl From Bruno Haible.
2N/Adnl Test whether the printf() function supports
POSIX/XSI format strings with
2N/AAC_DEFUN([gt_PRINTF_POSIX],
2N/A AC_REQUIRE([AC_PROG_CC])
2N/A AC_CACHE_CHECK([whether printf() supports
POSIX/XSI format strings],
2N/A gt_cv_func_printf_posix,
2N/A/* The string "%2$d %1$d", with dollar characters protected from the shell's
2N/A dollar expansion (possibly an autoconf bug). */
2N/Astatic char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' };
2N/Astatic char buf[100];
2N/A sprintf (buf, format, 33, 55);
2N/A return (strcmp (buf, "55 33") != 0);
2N/A [gt_cv_func_printf_posix=yes],
2N/A [gt_cv_func_printf_posix=no],
2N/A AC_EGREP_CPP([notposix], [
2N/A#if defined __NetBSD__ || defined __BEOS__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__
2N/A [gt_cv_func_printf_posix="guessing no"],
2N/A [gt_cv_func_printf_posix="guessing yes"])
2N/A case $gt_cv_func_printf_posix in
2N/A AC_DEFINE([HAVE_POSIX_PRINTF], [1],
2N/A [Define if your printf() function supports format strings with positions.])