aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-02-24 01:34:45 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-02-24 01:34:45 +0000
commite71d09a47213ec34b626477e40845b07e8abc7c2 (patch)
treef31daad6af083ad8f7d4dce8d3170f0513eae32c
parent41994145d44ca3a10015dfcb5be856834e968d1a (diff)
downloadpostgresql-e71d09a47213ec34b626477e40845b07e8abc7c2.tar.gz
postgresql-e71d09a47213ec34b626477e40845b07e8abc7c2.zip
Clean up printf arg-control test, per Kurt Roeckx.
-rw-r--r--config/c-library.m420
-rwxr-xr-xconfigure18
2 files changed, 17 insertions, 21 deletions
diff --git a/config/c-library.m4 b/config/c-library.m4
index aa6aa397f15..31dba1cbfdd 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.30 2005/02/22 03:55:50 momjian Exp $
+# $PostgreSQL: pgsql/config/c-library.m4,v 1.31 2005/02/24 01:34:45 tgl Exp $
# PGAC_VAR_INT_TIMEZONE
@@ -273,25 +273,23 @@ esac])# PGAC_FUNC_SNPRINTF_LONG_LONG_INT_FORMAT
# 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.
+# It is used in our language translation strings.
#
AC_DEFUN([PGAC_FUNC_PRINTF_ARG_CONTROL],
-[AC_MSG_CHECKING([printf supports argument control])
+[AC_MSG_CHECKING([whether printf supports argument control])
AC_CACHE_VAL(pgac_cv_printf_arg_control,
[AC_TRY_RUN([#include <stdio.h>
+#include <string.h>
-int does_printf_have_arg_control()
+int main()
{
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());
+ snprintf(buf, 100, "%2\$d %1\$d", 3, 4);
+ if (strcmp(buf, "4 3") != 0)
+ return 1;
+ return 0;
}],
[pgac_cv_printf_arg_control=yes],
[pgac_cv_printf_arg_control=no],
diff --git a/configure b/configure
index 7f083500174..b4eb5c5dd98 100755
--- a/configure
+++ b/configure
@@ -12162,8 +12162,8 @@ fi
done
-echo "$as_me:$LINENO: checking printf supports argument control" >&5
-echo $ECHO_N "checking printf supports argument control... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking whether printf supports argument control" >&5
+echo $ECHO_N "checking whether printf supports argument control... $ECHO_C" >&6
if test "${pgac_cv_printf_arg_control+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -12174,19 +12174,17 @@ else
#line $LINENO "configure"
#include "confdefs.h"
#include <stdio.h>
+#include <string.h>
-int does_printf_have_arg_control()
+int main()
{
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());
+ snprintf(buf, 100, "%2\$d %1\$d", 3, 4);
+ if (strcmp(buf, "4 3") != 0)
+ return 1;
+ return 0;
}
_ACEOF
rm -f conftest$ac_exeext