Blame m4/printf-posix.m4

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