# HG changeset patch
# User David A. Holland
# Date 1370924071 14400
# Node ID 1e4eef5bf88d70a98396b175cd0891a41d79388e
# Parent  60184aa42604c43c02c81791f79292713662fea8
Set up some real builtin macro config instead of hardwiring my platform.

diff -r 60184aa42604 -r 1e4eef5bf88d config.h
--- a/config.h	Mon Jun 10 23:51:07 2013 -0400
+++ b/config.h	Tue Jun 11 00:14:31 2013 -0400
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * Copyright (c) 2010, 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -27,17 +27,118 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+/*
+ * Config for predefined macros. If this doesn't do what you want you
+ * can set any or all of the CONFIG_ defines from the compiler command
+ * line; or patch the list in main.c; or both.
+ */
+
+/*
+ * Paths
+ */
+
+#ifndef CONFIG_LOCALINCLUDE
 #define CONFIG_LOCALINCLUDE "/usr/local/include"
+#endif
+
+#ifndef CONFIG_SYSTEMINCLUDE
 #define CONFIG_SYSTEMINCLUDE "/usr/include"
+#endif
 
+/*
+ * Operating system
+ */
+
+#ifndef CONFIG_OS
+#if defined(__NetBSD__)
 #define CONFIG_OS "__NetBSD__"
 #define CONFIG_OS_2 "__unix__"
+#elif defined(__FreeBSD__)
+#define CONFIG_OS "__FreeBSD__"
+#define CONFIG_OS_2 "__unix__"
+#elif defined(__OpenBSD__)
+#define CONFIG_OS "__OpenBSD__"
+#define CONFIG_OS_2 "__unix__"
+#elif defined(__DragonFly__)
+#define CONFIG_OS "__DragonFly__"
+#define CONFIG_OS_2 "__unix__"
+#elif defined(__bsdi__)
+#define CONFIG_OS "__bsdi__"
+#define CONFIG_OS_2 "__unix__"
+#elif defined(__sun)
+#define CONFIG_OS "__sun"
+#define CONFIG_OS_2 "__unix__"
+#elif defined(__sgi)
+#define CONFIG_OS "__sgi"
+#define CONFIG_OS_2 "__unix__"
+#elif defined(__SVR4)
+#define CONFIG_OS "__SVR4"
+#define CONFIG_OS_2 "__unix__"
+#elif defined(__APPLE__)
+#define CONFIG_OS "__APPLE__"
+#define CONFIG_OS_2 "__unix__"
+#elif defined(__linux__)
+#define CONFIG_OS "__linux__"
+#elif defined(__CYGWIN__)
+#define CONFIG_OS "__CYGWIN__"
+#elif defined(__INTERIX)
+#define CONFIG_OS "__INTERIX"
+#elif defined(__MINGW32)
+#define CONFIG_OS "__MINGW32"
+#else
+/* we could error... but let's instead assume generic unix */
+#define CONFIG_OS "__unix__"
+#endif
+#endif
 
+/*
+ * CPU
+ */
+
+#ifndef CONFIG_CPU
+#if defined(__x86_64__)
 #define CONFIG_CPU "__x86_64__"
 #define CONFIG_CPU_2 "__amd64__"
+#elif defined(__i386__) || defined(__i386)
+#define CONFIG_CPU "__i386__"
+#define CONFIG_CPU_2 "__i386"
+#elif defined(__sparc)
+#define CONFIG_CPU "__sparc"
+#elif defined(__mips)
+#define CONFIG_CPU "__mips"
+#elif defined(__POWERPC__)
+#define CONFIG_CPU "__POWERPC__"
+#elif defined(__ARM__)
+#define CONFIG_CPU "__ARM__"
+#else
+/* let it go */
+#endif
+#endif
 
+/*
+ * Other stuff
+ */
+
+#ifndef CONFIG_SIZE
+#ifdef __LP64__
 #define CONFIG_SIZE "__LP64__"
+#else
+#define CONFIG_SIZE "__ILP32__"
+#endif
+#endif
+
+#ifndef CONFIG_BINFMT
+#ifdef __ELF__
 #define CONFIG_BINFMT "__ELF__"
+#endif
+#endif
 
-#define CONFIG_COMPILER "__NBCC__"
-#define CONFIG_COMPILER_MINOR "__NBCC_MINOR__"
+/*
+ * We are __TRADCPP__ by default, but if you want to masquerade as
+ * some other compiler this is a convenient place to change it.
+ */
+
+#ifndef CONFIG_COMPILER
+#define CONFIG_COMPILER "__TRADCPP__"
+#define CONFIG_COMPILER_MINOR "__TRADCPP_MINOR__"
+#endif