pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/pkgtools/libnbcompat/files
Module Name: pkgsrc
Committed By: riastradh
Date: Tue Jun 27 09:30:27 UTC 2023
Modified Files:
pkgsrc/pkgtools/libnbcompat/files: configure.ac
Log Message:
libnbcompat: Use AC_CACHE_CHECK so we can handle cross-compiling.
The printf %lld test, the printf %qd test, and the vsnprintf return
value test are necessarily runtime tests, which don't work during
cross-compilation.
On NetBSD, the tests all pass, so there's no need to substitute the
NetBSD snprintf for is own snprintf in libnbcompat, which falls apart
if we try it because of the ssp macros:
mips64--netbsd-gcc -DHAVE_NBCOMPAT_H=1 -I/home/riastradh/pkgsrc/current/cross/work/net/libfetch/work.mips64eb/libnbcompat -I/usr/include -I. -I. -O2 -fPIC -D_FORTIFY_SOURCE=2 -I/usr/include
-DHAVE_CONFIG_H -c snprintf.c
In file included from /home/riastradh/netbsd/current/obj.evbmips64-eb/destdir.evbmips/usr/include/stdio.h:595,
from /home/riastradh/pkgsrc/current/cross/work/net/libfetch/work.mips64eb/libnbcompat/nbcompat/stdio.h:40,
from /home/riastradh/pkgsrc/current/cross/work/net/libfetch/work.mips64eb/libnbcompat/nbcompat.h:61,
from snprintf.c:28:
snprintf.c:43:1: error: expected declaration specifiers or '...' before numeric constant
43 | snprintf(char *str, size_t size, const char *format, ...)
| ^~~~~~~~
With this change, we have the opportunity to predetermine known test
outcomes without a runtime test by setting nb_cv_* variables in the
configure environment (to be done in a subsequent commit).
To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 pkgsrc/pkgtools/libnbcompat/files/configure.ac
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/pkgtools/libnbcompat/files/configure.ac
diff -u pkgsrc/pkgtools/libnbcompat/files/configure.ac:1.88 pkgsrc/pkgtools/libnbcompat/files/configure.ac:1.89
--- pkgsrc/pkgtools/libnbcompat/files/configure.ac:1.88 Sun May 24 21:51:54 2020
+++ pkgsrc/pkgtools/libnbcompat/files/configure.ac Tue Jun 27 09:30:27 2023
@@ -1,4 +1,4 @@
-dnl $NetBSD: configure.ac,v 1.88 2020/05/24 21:51:54 nia Exp $
+dnl $NetBSD: configure.ac,v 1.89 2023/06/27 09:30:27 riastradh Exp $
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.52)
@@ -463,31 +463,33 @@ AC_CHECK_MEMBERS([struct dirent.d_namlen
# endif
#endif ])
-AC_MSG_CHECKING([for dirfd])
-AC_TRY_LINK(
- [ #include <sys/types.h>
- #if HAVE_DIRENT_H
- # include <dirent.h>
- #else
- # define dirent direct
- # if HAVE_SYS_NDIR_H
- # include <sys/ndir.h>
- # endif
- # if HAVE_SYS_DIR_H
- # include <sys/dir.h>
- # endif
- # if HAVE_NDIR_H
- # include <ndir.h>
- # endif
- #endif
- int dummy_var;
- ], [ dummy_var = dirfd((DIR *)0) ],
- [
- AC_MSG_RESULT(yes)
- AC_DEFINE([HAVE_DIRFD], [1], [Define if dirfd is either a function or a macro.])
- ], [ AC_MSG_RESULT(no) ]
-
-)
+AC_CACHE_CHECK([for dirfd], [nb_cv_dirfd],
+ [
+ nb_cv_dirfd=no
+ AC_TRY_LINK(
+ [ #include <sys/types.h>
+ #if HAVE_DIRENT_H
+ # include <dirent.h>
+ #else
+ # define dirent direct
+ # if HAVE_SYS_NDIR_H
+ # include <sys/ndir.h>
+ # endif
+ # if HAVE_SYS_DIR_H
+ # include <sys/dir.h>
+ # endif
+ # if HAVE_NDIR_H
+ # include <ndir.h>
+ # endif
+ #endif
+ int dummy_var;
+ ], [ dummy_var = dirfd((DIR *)0) ],
+ [nb_cv_dirfd=yes])
+])
+if test $nb_cv_dirfd = yes; then
+ AC_DEFINE([HAVE_DIRFD], [1],
+ [Define if dirfd is either a function or a macro.])
+fi
if test $ac_cv_type_long_long = yes; then
@@ -495,42 +497,48 @@ dnl We assume that if sprintf() support
dnl then all of *printf() does. If not, disable long long
dnl support because we don't know how to display it.
- AC_MSG_CHECKING(*printf() support for %lld)
can_printf_longlong=no
- AC_TRY_RUN([
- #include <stdio.h>
- int main() {
- char buf[100];
- sprintf(buf, "%lld", 4294967300LL);
- return (strcmp(buf, "4294967300"));
- }
- ], [
- AC_MSG_RESULT(yes)
- can_printf_longlong=yes
- ], [
- AC_MSG_RESULT(no)
- ], [:])
- if test $can_printf_longlong != yes; then
- AC_MSG_CHECKING(*printf() support for %qd)
+ AC_CACHE_CHECK([for *printf() support for %lld],
+ [nb_cv_printf_lld],
+ [
+ nb_cv_printf_lld=no
AC_TRY_RUN([
#include <stdio.h>
int main() {
char buf[100];
- sprintf(buf, "%qd", 4294967300LL);
+ sprintf(buf, "%lld", 4294967300LL);
return (strcmp(buf, "4294967300"));
}
- ], [
- AC_MSG_RESULT(yes)
- can_printf_longlong=yes
+ ], [nb_cv_printf_lld=yes])
+ ])
+ if test $nb_cv_printf_lld = yes; then
+ can_printf_longlong=yes
+ fi
+
+ if test $can_printf_longlong != yes; then
+ AC_CACHE_CHECK([for *printf() support for %qd],
+ [nb_cv_printf_qd],
+ [
+ nb_cv_printf_qd=no
+ AC_TRY_RUN([
+ #include <stdio.h>
+ int main() {
+ char buf[100];
+ sprintf(buf, "%qd", 4294967300LL);
+ return (strcmp(buf, "4294967300"));
+ }
+ ], [nb_cv_printf_qd=yes])
+ ])
+ if test $nb_cv_printf_qd = yes; then
AC_DEFINE(HAVE_PRINTF_QD, 1)
AH_TEMPLATE([HAVE_PRINTF_QD], [
- Define to 1 if *printf() uses %qd to print
- `long long' (otherwise uses %lld).
+ Define to 1 if *printf() uses %qd to
+ print `long long'
+ (otherwise uses %lld).
])
- ], [
- AC_MSG_RESULT(no)
- ], [:])
+ can_printf_longlong=yes
+ fi
fi
if test $can_printf_longlong = yes; then
@@ -548,29 +556,27 @@ 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)
-], [:])
+AC_CACHE_CHECK([if vsnprintf is standards compliant],
+ [nb_cv_std_vsnprintf],
+ [
+ nb_cv_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");
+ }
+ ], [nb_cv_std_vsnprintf=yes])
+])
-if test $have_std_vsnprintf = no; then
+if test nb_cv_std_vsnprintf = no; then
AC_LIBOBJ(snprintf)
fi
Home |
Main Index |
Thread Index |
Old Index