summaryrefslogtreecommitdiffstats
path: root/configure.in
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-01-24 03:26:37 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-01-24 03:26:37 (GMT)
commit563a8dd1401c2f3c04b897f2a727d7d6ac9b141f (patch)
tree4a62599af4c3f8e1d7d9f007a11fc2fbe0f18cab /configure.in
parentd363f95d6d7c8ac25ccf319e9d136fc5842b9474 (diff)
downloadhdf5-563a8dd1401c2f3c04b897f2a727d7d6ac9b141f.zip
hdf5-563a8dd1401c2f3c04b897f2a727d7d6ac9b141f.tar.gz
hdf5-563a8dd1401c2f3c04b897f2a727d7d6ac9b141f.tar.bz2
[svn-r9861] Purpose:
Bug fix Description: Add detect vasprintf() routine and use it instead of vsnprintf() when formatting error descriptions if it's available. Added configure test to detect "broken" vsnprintf() implementations which don't return the correct number of character for strings that are too long to fit into the buffer provided (currently a problem on the SGIs and probably the HP). Re-wrote error formatting code in H5Epush_stack() to handle broken vsnprintf() implementations, etc. Platforms tested: IRIX64 6.5 (modi4) h5committest
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in46
1 files changed, 45 insertions, 1 deletions
diff --git a/configure.in b/configure.in
index 0725202..09ae750 100644
--- a/configure.in
+++ b/configure.in
@@ -1644,7 +1644,51 @@ dnl Check for functions.
dnl
AC_CHECK_FUNCS(fork frexpf frexpl gethostname getpwuid getrusage)
AC_CHECK_FUNCS(BSDgettimeofday longjmp setsysinfo sigaction)
-AC_CHECK_FUNCS(signal snprintf vsnprintf strdup system waitpid)
+AC_CHECK_FUNCS(signal snprintf vasprintf strdup system waitpid)
+
+dnl Check for vsnprintf() separately, so we can detect situations where it
+dnl doesn't return the correct size for formatted strings that are too large
+dnl for the buffer provided
+AC_CHECK_FUNCS(vsnprintf,
+
+ dnl Check if vsnprintf() returns correct size for strings that don't fit
+ dnl into the size allowed. If vsnprintf() works correctly on this platform,
+ dnl it should return a value larger than 15 for the test below
+ AC_MSG_CHECKING([if vsnprintf returns correct value])
+
+ AC_CACHE_VAL([hdf5_cv_vsnprintf_works],
+ AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+int test_vsnprintf(const char *fmt,...)
+{
+ va_list ap;
+ char *s = malloc(16);
+ int ret;
+
+ va_start(ap, fmt);
+ ret=vsnprintf(s,16,"%s",ap);
+ va_end(ap);
+
+ return(ret==15 ? 1 : 0);
+}
+
+int main(void)
+{
+ exit(test_vsnprintf("%s","A string that is longer than 16 characters"));
+}
+ ],[hdf5_cv_vsnprintf_works=yes],[hdf5_cv_vsnprintf_works=no],))
+
+ if test ${hdf5_cv_vsnprintf_works} = "yes"; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([VSNPRINTF_WORKS], [1],
+ [Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ ,)
dnl ----------------------------------------------------------------------
dnl Check compiler characteristics