pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/libnbcompat/files * configure.ac: Test for a ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/e1f73946acde
branches:  trunk
changeset: 531113:e1f73946acde
user:      tnn <tnn%pkgsrc.org@localhost>
date:      Fri Jul 20 00:21:02 2007 +0000

description:
* configure.ac: Test for a standards-conformant vsnprintf. If it is found
                to be broken, fall back to the one provided by libnbcompat.
* configure:    regen
* config.h.in:  regen

diffstat:

 pkgtools/libnbcompat/files/configure            |  79 +++++++++++++++++++++++++
 pkgtools/libnbcompat/files/configure.ac         |  32 +++++++++-
 pkgtools/libnbcompat/files/nbcompat/config.h.in |  12 ++-
 3 files changed, 119 insertions(+), 4 deletions(-)

diffs (185 lines):

diff -r 34309364a27f -r e1f73946acde pkgtools/libnbcompat/files/configure
--- a/pkgtools/libnbcompat/files/configure      Fri Jul 20 00:11:25 2007 +0000
+++ b/pkgtools/libnbcompat/files/configure      Fri Jul 20 00:21:02 2007 +0000
@@ -11131,6 +11131,85 @@
 
 fi
 
+
+
+{ echo "$as_me:$LINENO: checking if vsnprintf is standards compliant" >&5
+echo $ECHO_N "checking if vsnprintf is standards compliant... $ECHO_C" >&6; }
+have_std_vsnprintf=no
+if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+void dotest(char *fmt, ...) {
+       char buf[3];
+       va_list ap;
+       va_start(ap, fmt);
+       exit(snprintf(buf, 3, fmt, ap) == 4 ? 0 : 1);
+}
+int main() {
+       dotest("test");
+}
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+       { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+       have_std_vsnprintf=yes
+
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+
+       { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+
+if test $have_std_vsnprintf = no; then
+       case " $LIBOBJS " in
+  *" snprintf.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS snprintf.$ac_objext"
+ ;;
+esac
+
+fi
+
 { echo "$as_me:$LINENO: checking whether optind is declared" >&5
 echo $ECHO_N "checking whether optind is declared... $ECHO_C" >&6; }
 if test "${ac_cv_have_decl_optind+set}" = set; then
diff -r 34309364a27f -r e1f73946acde pkgtools/libnbcompat/files/configure.ac
--- a/pkgtools/libnbcompat/files/configure.ac   Fri Jul 20 00:11:25 2007 +0000
+++ b/pkgtools/libnbcompat/files/configure.ac   Fri Jul 20 00:21:02 2007 +0000
@@ -1,4 +1,4 @@
-dnl $NetBSD: configure.ac,v 1.55 2007/06/25 21:35:05 joerg Exp $
+dnl $NetBSD: configure.ac,v 1.56 2007/07/20 00:21:02 tnn Exp $
 
 dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.52)
@@ -379,6 +379,36 @@
 
 fi
 
+
+dnl    Check if vsnprintf returns the number of bytes that would have been
+dnl    written, had the buffer been large enough.
+
+AC_MSG_CHECKING(if vsnprintf is standards compliant)
+have_std_vsnprintf=no
+AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+void dotest(char *fmt, ...) {
+       char buf[3];
+       va_list ap;
+       va_start(ap, fmt);
+       exit(snprintf(buf, 3, fmt, ap) == 4 ? 0 : 1);
+}
+int main() {
+       dotest("test");
+}
+], [
+       AC_MSG_RESULT(yes)
+       have_std_vsnprintf=yes
+], [
+       AC_MSG_RESULT(no)
+], [:])
+
+if test $have_std_vsnprintf = no; then
+       AC_LIBOBJ(snprintf)
+fi
+
 AC_CHECK_DECLS([optind, optreset], [:], [:], [
        #include <stdio.h>
        #include <stdlib.h>
diff -r 34309364a27f -r e1f73946acde pkgtools/libnbcompat/files/nbcompat/config.h.in
--- a/pkgtools/libnbcompat/files/nbcompat/config.h.in   Fri Jul 20 00:11:25 2007 +0000
+++ b/pkgtools/libnbcompat/files/nbcompat/config.h.in   Fri Jul 20 00:21:02 2007 +0000
@@ -6,7 +6,7 @@
 /* Define to 1 if you have the <alloca.h> header file. */
 #undef HAVE_ALLOCA_H
 
-/* Define to 1 if you have the `snprintf' function. */
+/* Define to 1 if you have the `asprintf' function. */
 #undef HAVE_ASPRINTF
 
 /* Define to 1 if you have the <assert.h> header file. */
@@ -202,6 +202,9 @@
 /* Define to 1 if the `SHA1*' functions are built into the library. */
 #undef HAVE_NBCOMPAT_SHA1
 
+/* Define to 1 if the `SHA2*' functions are built into the library. */
+#undef HAVE_NBCOMPAT_SHA2
+
 /* Define to 1 if the `vis' function is built into the library. */
 #undef HAVE_NBCOMPAT_VIS
 
@@ -260,6 +263,9 @@
 /* Define to 1 if you have the <sha1.h> header file. */
 #undef HAVE_SHA1_H
 
+/* Define to 1 if you have the <sha2.h> header file. */
+#undef HAVE_SHA2_H
+
 /* Define to 1 if you have the <signal.h> header file. */
 #undef HAVE_SIGNAL_H
 
@@ -488,7 +494,7 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
-/* The size of a `off_t', as computed by sizeof. */
+/* The size of `off_t', as computed by sizeof. */
 #undef SIZEOF_OFF_T
 
 /* Define to 1 if you have the ANSI C header files. */
@@ -507,7 +513,7 @@
 /* Define to rpl_malloc if the replacement function should be used. */
 #undef malloc
 
-/* Define to `unsigned' if <sys/types.h> does not define. */
+/* Define to `unsigned int' if <sys/types.h> does not define. */
 #undef size_t
 
 



Home | Main Index | Thread Index | Old Index