summaryrefslogtreecommitdiff
path: root/config/c-library.m4
diff options
context:
space:
mode:
Diffstat (limited to 'config/c-library.m4')
-rw-r--r--config/c-library.m435
1 files changed, 34 insertions, 1 deletions
diff --git a/config/c-library.m4 b/config/c-library.m4
index 679f3844b8..aa6aa397f1 100644
--- a/config/c-library.m4
+++ b/config/c-library.m4
@@ -1,5 +1,5 @@
# Macros that test various C library quirks
-# $PostgreSQL: pgsql/config/c-library.m4,v 1.29 2004/12/16 17:48:26 momjian Exp $
+# $PostgreSQL: pgsql/config/c-library.m4,v 1.30 2005/02/22 03:55:50 momjian Exp $
# PGAC_VAR_INT_TIMEZONE
@@ -266,3 +266,36 @@ case $pgac_cv_snprintf_long_long_int_format in
LONG_LONG_INT_FORMAT=$pgac_cv_snprintf_long_long_int_format;;
*) AC_MSG_RESULT(none);;
esac])# PGAC_FUNC_SNPRINTF_LONG_LONG_INT_FORMAT
+
+
+# PGAC_FUNC_PRINTF_ARG_CONTROL
+# ---------------------------------------
+# Determine if printf supports %1$ argument selection, e.g. %5$ selects
+# the fifth argument after the printf print string.
+# This is not in the C99 standard, but in the Single Unix Specification (SUS).
+# It is used in our langauge translation strings.
+#
+AC_DEFUN([PGAC_FUNC_PRINTF_ARG_CONTROL],
+[AC_MSG_CHECKING([printf supports argument control])
+AC_CACHE_VAL(pgac_cv_printf_arg_control,
+[AC_TRY_RUN([#include <stdio.h>
+
+int does_printf_have_arg_control()
+{
+ char buf[100];
+
+ /* can it swap arguments? */
+ snprintf(buf, 100, "%2$d|%1$d", 3, 4);
+ if (strcmp(buf, "4|3") != 0)
+ return 0;
+ return 1;
+}
+main() {
+ exit(! does_printf_have_arg_control());
+}],
+[pgac_cv_printf_arg_control=yes],
+[pgac_cv_printf_arg_control=no],
+[pgac_cv_printf_arg_control=cross])
+])dnl AC_CACHE_VAL
+AC_MSG_RESULT([$pgac_cv_printf_arg_control])
+])# PGAC_FUNC_PRINTF_ARG_CONTROL