From 6737f741ea45c0021af3d931abf36d9c5be073b3 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Thu, 9 Mar 2006 00:52:55 +0000 Subject: [PATCH] * configure.in: Check for vsnprintf and vasprintf, and for positional specification support in printf format strings. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17723 dc483132-0cff-0310-8789-dd5450dbe970 --- src/ChangeLog | 5 +++++ src/configure.in | 26 +++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 8d40b20a9..471fa0fdd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-03-08 Ken Raeburn + + * configure.in: Check for vsnprintf and vasprintf, and for + positional specification support in printf format strings. + 2006-03-06 Ken Raeburn * configure.in: Don't check for dlopen here. Call diff --git a/src/configure.in b/src/configure.in index 63021d9f3..136404367 100644 --- a/src/configure.in +++ b/src/configure.in @@ -56,7 +56,7 @@ LIBUTIL=-lutil AC_SUBST(LIBUTIL) dnl for kdc AC_CHECK_HEADERS(syslog.h stdarg.h sys/select.h sys/sockio.h ifaddrs.h unistd.h) -AC_CHECK_FUNCS(openlog syslog closelog strftime vsprintf) +AC_CHECK_FUNCS(openlog syslog closelog strftime vsprintf vasprintf vsnprintf) KRB5_NEED_PROTO([#include #ifdef HAVE_UNISTD_H #include @@ -496,6 +496,30 @@ AC_CHECK_TYPES([uint32_t, int32_t, uint64_t, int64_t, uint_least32_t, uintptr_t, #endif ]) dnl +dnl Test for POSIX 2001 *printf support (X/Open System Interfaces extension +dnl to ANSI/ISO C 1999 specification). Specifically, positional +dnl specifications; not checking for other features like %zx at present. +AC_MSG_CHECKING(for POSIX printf positional specification support) +AC_CACHE_VAL(ac_cv_printf_positional,[ +AC_TRY_RUN([ +#include +#include +const char expected[] = "200 100"; +int main () { + char buf[30]; + sprintf(buf, "%2\$x %1\$d", 100, 512); + if (strcmp(expected, buf)) { + fprintf(stderr,"bad result: <%s> wanted: <%s>\n", buf, expected); + return 1; + } + return 0; +}], + ac_cv_printf_positional=yes, + ac_cv_printf_positional=no, + AC_MSG_ERROR([Cannot test for printf positional argument support when cross compiling]))]) +dnl Nothing for autoconf.h for now. +AC_MSG_RESULT($ac_cv_printf_positional) +dnl dnl dnl Check for thread safety issues. dnl (Is there a better place for this?) -- 2.26.2