2N/A# printf-posix.m4 serial 6 (gettext-0.18.2)
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/A
2N/Adnl From Bruno Haible.
2N/Adnl Test whether the printf() function supports POSIX/XSI format strings with
2N/Adnl positions.
2N/A
2N/AAC_DEFUN([gt_PRINTF_POSIX],
2N/A[
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 [
2N/A AC_RUN_IFELSE(
2N/A [AC_LANG_SOURCE([[
2N/A#include <stdio.h>
2N/A#include <string.h>
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/Aint main ()
2N/A{
2N/A sprintf (buf, format, 33, 55);
2N/A return (strcmp (buf, "55 33") != 0);
2N/A}]])],
2N/A [gt_cv_func_printf_posix=yes],
2N/A [gt_cv_func_printf_posix=no],
2N/A [
2N/A AC_EGREP_CPP([notposix], [
2N/A#if defined __NetBSD__ || defined __BEOS__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__
2N/A notposix
2N/A#endif
2N/A ],
2N/A [gt_cv_func_printf_posix="guessing no"],
2N/A [gt_cv_func_printf_posix="guessing yes"])
2N/A ])
2N/A ])
2N/A case $gt_cv_func_printf_posix in
2N/A *yes)
2N/A AC_DEFINE([HAVE_POSIX_PRINTF], [1],
2N/A [Define if your printf() function supports format strings with positions.])
2N/A ;;
2N/A esac
2N/A])