summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authortnn <tnn>2007-07-20 00:21:02 +0000
committertnn <tnn>2007-07-20 00:21:02 +0000
commitb9ea02556b7a96f27f18bd5611d6a1f80e87b1e4 (patch)
tree61ccaa75a798c1d91dc2424a6caf1b1b9672391c /pkgtools
parentccb4696d1027b7992fc01ae06313d493514d63ff (diff)
downloadpkgsrc-b9ea02556b7a96f27f18bd5611d6a1f80e87b1e4.tar.gz
* 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 (limited to 'pkgtools')
-rwxr-xr-xpkgtools/libnbcompat/files/configure79
-rw-r--r--pkgtools/libnbcompat/files/configure.ac32
-rw-r--r--pkgtools/libnbcompat/files/nbcompat/config.h.in12
3 files changed, 119 insertions, 4 deletions
diff --git a/pkgtools/libnbcompat/files/configure b/pkgtools/libnbcompat/files/configure
index 989efed530c..51a94a4acbb 100755
--- a/pkgtools/libnbcompat/files/configure
+++ b/pkgtools/libnbcompat/files/configure
@@ -11131,6 +11131,85 @@ done
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 --git a/pkgtools/libnbcompat/files/configure.ac b/pkgtools/libnbcompat/files/configure.ac
index a107996ea85..15b3ffccf79 100644
--- a/pkgtools/libnbcompat/files/configure.ac
+++ b/pkgtools/libnbcompat/files/configure.ac
@@ -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 @@ dnl support because we don't know how to display it.
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 --git a/pkgtools/libnbcompat/files/nbcompat/config.h.in b/pkgtools/libnbcompat/files/nbcompat/config.h.in
index caae58b0c1a..c1902ceb8ab 100644
--- a/pkgtools/libnbcompat/files/nbcompat/config.h.in
+++ b/pkgtools/libnbcompat/files/nbcompat/config.h.in
@@ -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