Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-2-0]: src Pull up revision 1.44 (requested by jmc in ticket #527):
details: https://anonhg.NetBSD.org/src/rev/6480fed081d5
branches: netbsd-2-0
changeset: 561544:6480fed081d5
user: tron <tron%NetBSD.org@localhost>
date: Tue Jun 22 07:30:28 2004 +0000
description:
Pull up revision 1.44 (requested by jmc in ticket #527):
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
diffstat:
share/mk/bsd.hostprog.mk | 20 +++++++++++++++++++-
tools/compat/configure.ac | 31 +++++++++++++++++++++++++++----
usr.sbin/mtree/compare.c | 24 +++++++++++++++---------
3 files changed, 61 insertions(+), 14 deletions(-)
diffs (159 lines):
diff -r f63262ea5648 -r 6480fed081d5 share/mk/bsd.hostprog.mk
--- a/share/mk/bsd.hostprog.mk Tue Jun 22 07:30:06 2004 +0000
+++ b/share/mk/bsd.hostprog.mk Tue Jun 22 07:30:28 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.hostprog.mk,v 1.41.2.1 2004/05/22 17:35:48 he Exp $
+# $NetBSD: bsd.hostprog.mk,v 1.41.2.2 2004/06/22 07:30:28 tron Exp $
# @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
.include <bsd.init.mk>
@@ -112,3 +112,21 @@
.include <bsd.dep.mk>
${TARGETS}: # ensure existence
+
+# Override YACC/LEX rules so nbtool_config.h can be forced as the 1st include
+.l.c:
+ ${_MKTARGET_LEX}
+ ${LEX.l} -o${.TARGET} ${.IMPSRC}
+ echo '#if HAVE_NBTOOL_CONFIG_H' > ${.TARGET}.1
+ echo '#include "nbtool_config.h"' >> ${.TARGET}.1
+ echo '#endif' >> ${.TARGET}.1
+ cat ${.TARGET} >> ${.TARGET}.1
+ mv ${.TARGET}.1 ${.TARGET}
+.y.c:
+ ${_MKTARGET_YACC}
+ ${YACC.y} -o ${.TARGET} ${.IMPSRC}
+ echo '#if HAVE_NBTOOL_CONFIG_H' > ${.TARGET}.1
+ echo '#include "nbtool_config.h"' >> ${.TARGET}.1
+ echo '#endif' >> ${.TARGET}.1
+ cat ${.TARGET} >> ${.TARGET}.1
+ mv ${.TARGET}.1 ${.TARGET}
diff -r f63262ea5648 -r 6480fed081d5 tools/compat/configure.ac
--- a/tools/compat/configure.ac Tue Jun 22 07:30:06 2004 +0000
+++ b/tools/compat/configure.ac Tue Jun 22 07:30:28 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: configure.ac,v 1.42 2003/11/12 19:43:58 dbj Exp $
+# $NetBSD: configure.ac,v 1.42.2.1 2004/06/22 07:30:28 tron Exp $
#
# Autoconf definition file for libnbcompat.
#
@@ -7,6 +7,21 @@
AC_CONFIG_HEADERS(nbtool_config.h)
AC_CONFIG_FILES(defs.mk)
+AC_DEFUN([AC_NETBSD],
+[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
+ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
+ AC_MSG_CHECKING([for NetBSD])
+ AC_EGREP_CPP(yes,
+ [#ifdef __NetBSD__
+ yes
+ #endif
+ ],
+ [AC_MSG_RESULT([yes])
+ AC_DEFINE(_POSIX_SOURCE, 1) AC_DEFINE(_POSIX_C_SOURCE, 200112L) AC_DEFINE(_XOPEN_SOURCE, 600)],
+ [AC_MSG_RESULT([no])])
+])# AC_NETBSD
+
+AC_NETBSD
AC_PATH_PROG(BSHELL, sh, )
if test x"$BSHELL" = x; then
AC_MSG_ERROR([sh must be somewhere on \$PATH])
@@ -37,11 +52,11 @@
# Find headers that may not be available.
AC_HEADER_DIRENT
AC_CHECK_HEADERS(sys/sysmacros.h sys/syslimits.h \
- features.h malloc.h sys/poll.h stddef.h)
+ getopt.h features.h malloc.h sys/poll.h stddef.h)
AC_CHECK_HEADERS(machine/bswap.h sys/cdefs.h sys/endian.h sys/featuretest.h \
err.h inttypes.h libgen.h paths.h stdint.h util.h,,
[test -f include/$ac_header || touch include/$ac_header])
-AC_CHECK_HEADERS(rpc/types.h getopt.h netconfig.h,,
+AC_CHECK_HEADERS(rpc/types.h netconfig.h,,
[echo '#include "nbtool_config.h"' >include/$ac_header.new
echo '#include "'$srcdir/../../include/$ac_header'"' >>include/$ac_header.new
if cmp include/$ac_header.new include/$ac_header >/dev/null 2>&1; then
@@ -52,7 +67,7 @@
# Typedefs.
AC_TYPE_SIZE_T
-AC_CHECK_TYPES([id_t, long long, u_long, u_quad_t])
+AC_CHECK_TYPES([id_t, long long, u_long, u_char, u_short, u_int, u_quad_t])
AC_CHECK_TYPE(socklen_t, [AC_DEFINE(HAVE_SOCKLEN_T)],,
[#include <sys/types.h>
#include <sys/socket.h>])
@@ -105,6 +120,14 @@
strsuftoll strtoll \
user_from_uid vasprintf vasnprintf vsnprintf)
+AC_CHECK_FUNCS([htobe16, htobe32, htobe64, htole16, htole32, htole64, be16toh, be32toh, be64toh, le16toh, le32toh, le64toh],,, [
+#include <sys/types.h>
+])
+
+AC_CHECK_FUNCS([bswap16, bswap32, bswap64],,, [
+#include <machine/bswap.h>
+])
+
AC_CHECK_DECLS([setgroupent, setpassent],,, [
#include <sys/types.h>
#include <grp.h>
diff -r f63262ea5648 -r 6480fed081d5 usr.sbin/mtree/compare.c
--- a/usr.sbin/mtree/compare.c Tue Jun 22 07:30:06 2004 +0000
+++ b/usr.sbin/mtree/compare.c Tue Jun 22 07:30:28 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compare.c,v 1.43 2003/08/07 11:25:35 agc Exp $ */
+/* $NetBSD: compare.c,v 1.43.2.1 2004/06/22 07:30:28 tron Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -29,12 +29,16 @@
* SUCH DAMAGE.
*/
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
#if 0
static char sccsid[] = "@(#)compare.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: compare.c,v 1.43 2003/08/07 11:25:35 agc Exp $");
+__RCSID("$NetBSD: compare.c,v 1.43.2.1 2004/06/22 07:30:28 tron Exp $");
#endif
#endif /* not lint */
@@ -150,14 +154,16 @@
if (!S_ISLNK(p->fts_statp->st_mode))
goto typeerr;
break;
+#ifdef S_ISSOCK
case F_SOCK:
- if (!S_ISSOCK(p->fts_statp->st_mode)) {
- typeerr: LABEL;
- printf("\ttype (%s, %s)\n",
- nodetype(s->type), inotype(p->fts_statp->st_mode));
- return (label);
- }
+ if (!S_ISSOCK(p->fts_statp->st_mode))
+ goto typeerr;
break;
+#endif
+typeerr: LABEL;
+ printf("\ttype (%s, %s)\n",
+ nodetype(s->type), inotype(p->fts_statp->st_mode));
+ return (label);
}
if (Wflag)
goto afterpermwhack;
@@ -285,7 +291,7 @@
struct stat *ps = p->fts_statp;
time_t smtime = s->st_mtimespec.tv_sec;
-#ifdef BSD4_4
+#if defined(BSD4_4) && !defined(HAVE_NBTOOL_CONFIG_H)
time_t pmtime = ps->st_mtimespec.tv_sec;
TIMESPEC_TO_TIMEVAL(&tv[0], &s->st_mtimespec);
Home |
Main Index |
Thread Index |
Old Index