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