Subject: Re: toolchain/30145: build.sh fails on NetBSD-1.5.2 host
To: None <toolchain-manager@NetBSD.org, gnats-admin@NetBSD.org,>
From: Alan Barrett <apb@cequrux.com>
List: netbsd-bugs
Date: 07/11/2005 12:37:26
On Thu, 05 May 2005, Alan Barrett wrote:
> Using build.sh to build netBSD-2.0.2 on a NetBSD-1.5.2 host fails
> with the following message:

To fix this problem, apply the following patches.

For NetBSD-current and the netbsd-3 branch, apply the first patch
below.

For the netbsd-2 and netbsd-2-0 branches, apply the second patch below.

For the netbsd-1-6 and netbsd-1-5 branches, no patch is necessary (these
branches build correctly on a NetBSD-1.5.x host).

---- BEGIN PATCH for NetBSD-current and netbsd-3 branch ----
Index: tools/compat/compat_defs.h
===================================================================
--- tools/compat/compat_defs.h	11 Dec 2004 09:34:08 -0000	1.45
+++ tools/compat/compat_defs.h	11 May 2005 16:03:26 -0000
@@ -15,9 +15,15 @@
 #include <features.h>
 #endif
 
-/* So _NETBSD_SOURCE doesn't end up defined. Define enough to pull in standard
-   defs. Other platforms may need similiar defines. */
-#ifdef __NetBSD__
+/*
+ * The _NETBSD_SOURCE feature test macro was introduced in NetBSD-1.6R,
+ * but we want to ensure that it does not get defined.  Do so by
+ * defining enough other feature test macros to pull in the
+ * definitions we want.
+ *
+ * Other platforms may need similiar defines.
+ */
+#if defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 106180000)
 #define	_ISOC99_SOURCE
 #define _POSIX_SOURCE	1
 #define _POSIX_C_SOURCE	200112L
Index: tools/compat/configure
===================================================================
--- tools/compat/configure	2 Mar 2005 18:08:43 -0000	1.51
+++ tools/compat/configure	11 May 2005 16:03:27 -0000
@@ -2486,15 +2486,15 @@
  EGREP=$ac_cv_prog_egrep
 
 
-            echo "$as_me:$LINENO: checking for NetBSD" >&5
-echo $ECHO_N "checking for NetBSD... $ECHO_C" >&6
+            echo "$as_me:$LINENO: checking for recent NetBSD" >&5
+echo $ECHO_N "checking for recent NetBSD... $ECHO_C" >&6
       cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#ifdef __NetBSD__
+#if defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 106180000)
 	yes
 	#endif
 
Index: tools/compat/configure.ac
===================================================================
--- tools/compat/configure.ac	2 Mar 2005 18:08:44 -0000	1.50
+++ tools/compat/configure.ac	11 May 2005 16:03:28 -0000
@@ -10,9 +10,9 @@
 AC_DEFUN([AC_NETBSD],
 [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
       AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
-      AC_MSG_CHECKING([for NetBSD])
+      AC_MSG_CHECKING([for recent NetBSD])
       AC_EGREP_CPP(yes,
-      [#ifdef __NetBSD__
+      [#if defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 106180000)
 	yes
 	#endif
 	],
---- END PATCH for NetBSD-current and netbsd-3 branch ----

---- BEGIN PATCH for netbsd-2-0 and netbsd-2 branches ----
Index: dist/file/src/file.c
===================================================================
--- dist/file/src/file.c	25 Mar 2004 15:00:24 -0000	1.6
+++ dist/file/src/file.c	9 May 2005 12:13:44 -0000
@@ -68,6 +68,10 @@
 #if defined(__FreeBSD_version) && __FreeBSD_version < 500000
 #undef HAVE_WCHAR_H
 #endif
+/* XXX: NetBSD prior to 1.6 doesn't have real wchar support */
+#if defined(__NetBSD_Version__) && __NetBSD_Version__ < 106000000
+#undef HAVE_WCHAR_H
+#endif
 #ifdef HAVE_WCHAR_H
 #include <wchar.h>
 #endif
Index: tools/compat/compat_defs.h
===================================================================
--- tools/compat/compat_defs.h	6 Apr 2005 10:12:34 -0000	1.31.2.5.2.1
+++ tools/compat/compat_defs.h	9 May 2005 12:22:14 -0000
@@ -15,9 +15,15 @@
 #include <features.h>
 #endif
 
-/* So _NETBSD_SOURCE doesn't end up defined. Define enough to pull in standard
-   defs. Other platforms may need similiar defines. */
-#ifdef __NetBSD__
+/*
+ * The _NETBSD_SOURCE feature test macro was introduced in NetBSD-1.6R,
+ * but we want to ensure that it does not get defined.  Do so by
+ * defining enough other feature test macros to pull in the
+ * definitions we want.
+ *
+ * Other platforms may need similiar defines.
+ */
+#if defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 106180000)
 #define	_ISOC99_SOURCE
 #define _POSIX_SOURCE	1
 #define _POSIX_C_SOURCE	200112L
Index: tools/compat/configure
===================================================================
--- tools/compat/configure	6 Apr 2005 10:01:37 -0000	1.43.2.2.2.1
+++ tools/compat/configure	9 May 2005 12:22:15 -0000
@@ -1862,12 +1862,12 @@
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-            echo "$as_me:1865: checking for NetBSD" >&5
-echo $ECHO_N "checking for NetBSD... $ECHO_C" >&6
+            echo "$as_me:1865: checking for recent NetBSD" >&5
+echo $ECHO_N "checking for recent NetBSD... $ECHO_C" >&6
       cat >conftest.$ac_ext <<_ACEOF
 #line 1868 "configure"
 #include "confdefs.h"
-#ifdef __NetBSD__
+#if defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 106180000)
 	yes
 	#endif
 
Index: tools/compat/configure.ac
===================================================================
--- tools/compat/configure.ac	6 Apr 2005 09:56:40 -0000	1.42.2.2.2.1
+++ tools/compat/configure.ac	9 May 2005 12:22:15 -0000
@@ -10,9 +10,9 @@
 AC_DEFUN([AC_NETBSD],
 [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
       AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
-      AC_MSG_CHECKING([for NetBSD])
+      AC_MSG_CHECKING([for recent NetBSD])
       AC_EGREP_CPP(yes,
-      [#ifdef __NetBSD__
+      [#if defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 106180000)
 	yes
 	#endif
 	],
---- END PATCH for netbsd-2-0 and netbsd-2 branches ----