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