Merged in autoconf branch.  This provides configuration via the autoconf
system.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7014 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/Config/alloca.h b/include/Config/alloca.h
new file mode 100644
index 0000000..f27ef06
--- /dev/null
+++ b/include/Config/alloca.h
@@ -0,0 +1,46 @@
+/*
+ * Header file: alloc.h
+ *
+ * Description:
+ *	This header file includes the infamous alloc.h header file if the
+ *	autoconf system has found it.  It hides all of the autoconf details
+ *	from the rest of the application source code.
+ */
+
+#ifndef _CONFIG_ALLOC_H
+#define _CONFIG_ALLOC_H
+
+#include "Config/config.h"
+
+/*
+ * This is a modified version of that suggested by the Autoconf manual.
+ *	1) The #pragma is indented so that pre-ANSI C compilers ignore it.
+ *	2) If alloca.h cannot be found, then try stdlib.h.  Some platforms
+ *	   (notably FreeBSD) defined alloca() there.
+ */
+#ifndef __GNUC__
+#	ifdef HAVE_ALLOCA_H
+#		include <alloca.h>
+#	else
+#		ifdef _AIX
+ #			pragma alloca
+#		else
+#			ifndef alloca
+				char * alloca ();
+#			endif
+#		endif
+#	endif
+#else
+#	ifdef HAVE_ALLOCA_H
+#		include <alloca.h>
+#	else
+#		ifdef HAVE_STDLIB_H
+#			include <stdlib.h>
+#		else
+#			error "The function alloca() is required but not found!"
+#		endif
+#	endif
+#endif
+
+#endif
+
diff --git a/include/Config/assert.h b/include/Config/assert.h
new file mode 100644
index 0000000..45ebb22
--- /dev/null
+++ b/include/Config/assert.h
@@ -0,0 +1,23 @@
+/*
+ * Header file: assert.h
+ *
+ * Description:
+ *	This header file includes the assert.h header file if the
+ *	autoconf system has found it.
+ */
+
+#ifndef _CONFIG_ASSERT_H
+#define _CONFIG_ASSERT_H
+
+#include "Config/config.h"
+
+/*
+ * This is the suggested use by the Autoconf manual.
+ *	1) The #pragma is indented so that pre-ANSI C compilers ignore it.
+ */
+#ifdef HAVE_ASSERT_H
+#include <assert.h>
+#endif
+
+#endif
+
diff --git a/include/Config/config.h.in b/include/Config/config.h.in
new file mode 100644
index 0000000..fd1c810
--- /dev/null
+++ b/include/Config/config.h.in
@@ -0,0 +1,210 @@
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+   systems. This function is required for `alloca.c' support on those systems.
+   */
+#undef CRAY_STACKSEG_END
+
+/* Define to 1 if using `alloca.c'. */
+#undef C_ALLOCA
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#undef HAVE_ALLOCA
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+   */
+#undef HAVE_ALLOCA_H
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#undef HAVE_DOPRNT
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `getcwd' function. */
+#undef HAVE_GETCWD
+
+/* Define to 1 if you have the `getpagesize' function. */
+#undef HAVE_GETPAGESIZE
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `dl' library (-ldl). */
+#undef HAVE_LIBDL
+
+/* Define to 1 if you have the `elf' library (-lelf). */
+#undef HAVE_LIBELF
+
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
+/* Define to 1 if you have the `papi' library (-lpapi). */
+#undef HAVE_LIBPAPI
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if you have the <malloc.h> header file. */
+#undef HAVE_MALLOC_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have a working `mmap' system call. */
+#undef HAVE_MMAP
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strcspn' function. */
+#undef HAVE_STRCSPN
+
+/* Define to 1 if you have the `strdup' function. */
+#undef HAVE_STRDUP
+
+/* Define to 1 if you have the `strerror' function. */
+#undef HAVE_STRERROR
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strspn' function. */
+#undef HAVE_STRSPN
+
+/* Define to 1 if you have the `strstr' function. */
+#undef HAVE_STRSTR
+
+/* Define to 1 if you have the `strtod' function. */
+#undef HAVE_STRTOD
+
+/* Define to 1 if you have the `strtol' function. */
+#undef HAVE_STRTOL
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#undef HAVE_SYS_WAIT_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `vprintf' function. */
+#undef HAVE_VPRINTF
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#undef RETSIGTYPE
+
+/* Define to 1 if the `setvbuf' function takes the buffering type as its
+   second argument and the buffer pointer as the third, as on System V before
+   release 3. */
+#undef SETVBUF_REVERSED
+
+/* If using the C implementation of alloca, define if you know the
+   direction of stack growth for your system; otherwise it will be
+   automatically deduced at run-time.
+        STACK_DIRECTION > 0 => grows toward higher addresses
+        STACK_DIRECTION < 0 => grows toward lower addresses
+        STACK_DIRECTION = 0 => direction of growth unknown */
+#undef STACK_DIRECTION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
+#undef TM_IN_SYS_TIME
+
+/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
+   `char[]'. */
+#undef YYTEXT_POINTER
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define as `__inline' if that's what the C compiler calls it, or to nothing
+   if it is not supported. */
+#undef inline
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+#undef size_t
+
+/* Define to mark the machine as having little endian */
+#ifndef ENDIAN_LITTLE
+#undef ENDIAN_LITTLE
+#endif
+
+/* Define to mark the machine as having big endian */
+#ifndef ENDIAN_BIG
+#undef ENDIAN_BIG
+#endif
+
+/* Define to indicate how to include hash_map */
+#undef HAVE_STD_EXT_HASH_MAP
+#undef HAVE_GNU_EXT_HASH_MAP
+
+/* Define to incdicate how to include has_set */
+#undef HAVE_STD_EXT_HASH_SET
+#undef HAVE_GNU_EXT_HASH_SET
+
+/* Indicates whether we have STL iterators */
+#undef HAVE_STD_ITERATOR
+
+/* Indicates which slist we should use */
+#undef HAVE_EXT_SLIST
+
+/* Indicates whether we have the MALLINFO functionality */
+#undef HAVE_MALLINFO
+
+/* Indicates if we have MAP_ANONYMOUS */
+#undef HAVE_MMAP_ANONYMOUS
+
+/* Indicates whether we have MMAP header file */
+#undef HAVE_SYS_MMAN_H
+
+/* Indicates that we have assert.h */
+#undef HAVE_ASSERT_H
+
+/* Macros for various header files */
+#undef HAVE_SIGNAL_H
+#undef HAVE_ERRNO_H
+#undef HAVE_SYS_RESOURCE_H
+#undef HAVE_MATH_H
+#undef HAVE_DLFCN_H
+#undef HAVE_LINK_H
diff --git a/include/Config/dlfcn.h b/include/Config/dlfcn.h
new file mode 100644
index 0000000..9beddcc
--- /dev/null
+++ b/include/Config/dlfcn.h
@@ -0,0 +1,27 @@
+/*
+ * Header file: dlfcn.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for dlfcn.h (if it lives
+ *	on the system).
+ */
+
+#ifndef _CONFIG_DLFCN_H
+#define _CONFIG_DLFCN_H
+
+#include "Config/config.h"
+
+/*
+ * According to the man pages on dlopen(), we sometimes need link.h.  So,
+ * go grab it just in case.
+ */
+#ifdef HAVE_DLFCN_H
+#include <dlfcn.h>
+
+#ifdef HAVE_LINK_H
+#include <link.h>
+#endif
+
+#endif
+
+#endif
diff --git a/include/Config/errno.h b/include/Config/errno.h
new file mode 100644
index 0000000..7c7f318
--- /dev/null
+++ b/include/Config/errno.h
@@ -0,0 +1,18 @@
+/*
+ * Header file: errno.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for errno.h (if it lives
+ *	on the system).
+ */
+
+#ifndef _CONFIG_ERRNO_H
+#define _CONFIG_ERRNO_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
+#endif
diff --git a/include/Config/fcntl.h b/include/Config/fcntl.h
new file mode 100644
index 0000000..267503d
--- /dev/null
+++ b/include/Config/fcntl.h
@@ -0,0 +1,18 @@
+/*
+ * Header file: fcntl.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for fcntl.h (if it lives
+ *	on the system).
+ */
+
+#ifndef _CONFIG_FCNTL_H
+#define _CONFIG_FCNTL_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#endif
diff --git a/include/Config/limits.h b/include/Config/limits.h
new file mode 100644
index 0000000..da5cd66
--- /dev/null
+++ b/include/Config/limits.h
@@ -0,0 +1,18 @@
+/*
+ * Header file: limits.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for limits.h (if it lives
+ *	on the system).
+ */
+
+#ifndef _CONFIG_LIMITS_H
+#define _CONFIG_LIMITS_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+#endif
diff --git a/include/Config/link.h b/include/Config/link.h
new file mode 100644
index 0000000..a003e24
--- /dev/null
+++ b/include/Config/link.h
@@ -0,0 +1,18 @@
+/*
+ * Header file: link.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for link.h (if it lives
+ *	on the system).
+ */
+
+#ifndef _CONFIG_LINK_H
+#define _CONFIG_LINK_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_LINK_H
+#include <link.h>
+#endif
+
+#endif
diff --git a/include/Config/malloc.h b/include/Config/malloc.h
new file mode 100644
index 0000000..fa85fc8
--- /dev/null
+++ b/include/Config/malloc.h
@@ -0,0 +1,20 @@
+/*
+ * Header file: malloc.h
+ *
+ * Description:
+ *	This header file includes the infamous malloc.h header file if the
+ *	autoconf system has found it.  It hides all of the autoconf details
+ *	from the rest of the application source code.
+ */
+
+#ifndef _SUPPORT_MALLOC_H
+#define _SUPPORT_MALLOC_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+
+#endif
+
diff --git a/include/Config/memory.h b/include/Config/memory.h
new file mode 100644
index 0000000..01d68ae
--- /dev/null
+++ b/include/Config/memory.h
@@ -0,0 +1,18 @@
+/*
+ * Header file: memory.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for memory.h (if it lives
+ *	on the system).
+ */
+
+#ifndef _CONFIG_MEMORY_H
+#define _CONFIG_MEMORY_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+
+#endif
diff --git a/include/Config/stdint.h b/include/Config/stdint.h
new file mode 100644
index 0000000..fe2a076
--- /dev/null
+++ b/include/Config/stdint.h
@@ -0,0 +1,18 @@
+/*
+ * Header file: stdint.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for stdint.h (if it lives
+ *	on the system).
+ */
+
+#ifndef _CONFIG_STDINT_H
+#define _CONFIG_STDINT_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
+#endif
diff --git a/include/Config/stdio.h b/include/Config/stdio.h
new file mode 100644
index 0000000..3e19f2c
--- /dev/null
+++ b/include/Config/stdio.h
@@ -0,0 +1,22 @@
+/*
+ * Header file: stdio.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for stdio.h (if it lives
+ *	on the system).
+ */
+
+#ifndef _CONFIG_STDIO_H
+#define _CONFIG_STDIO_H
+
+#include "Config/config.h"
+
+/*
+ * Assume that stdio.h exists if autoconf find the ANSI C header files.
+ * I'd think stdlib.h would be here to, but I guess not.
+ */
+#ifdef STDC_HEADERS
+#include <stdio.h>
+#endif
+
+#endif
diff --git a/include/Config/stdlib.h b/include/Config/stdlib.h
new file mode 100644
index 0000000..8767cc4
--- /dev/null
+++ b/include/Config/stdlib.h
@@ -0,0 +1,18 @@
+/*
+ * Header file: stdlib.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for stdlib.h (if it lives
+ *	on the system).
+ */
+
+#ifndef _CONFIG_STDLIB_H
+#define _CONFIG_STDLIB_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#endif
diff --git a/include/Config/string.h b/include/Config/string.h
new file mode 100644
index 0000000..dd02941
--- /dev/null
+++ b/include/Config/string.h
@@ -0,0 +1,18 @@
+/*
+ * Header file: string.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for string.h (if it lives
+ *	on the system).
+ */
+
+#ifndef _CONFIG_STRING_H
+#define _CONFIG_STRING_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#endif
diff --git a/include/Config/strings.h b/include/Config/strings.h
new file mode 100644
index 0000000..af6c480
--- /dev/null
+++ b/include/Config/strings.h
@@ -0,0 +1,18 @@
+/*
+ * Header file: strings.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for strings.h (if it lives
+ *	on the system).
+ */
+
+#ifndef _CONFIG_STRINGS_H
+#define _CONFIG_STRINGS_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+
+#endif
diff --git a/include/Config/sys/mman.h b/include/Config/sys/mman.h
new file mode 100644
index 0000000..af7affd
--- /dev/null
+++ b/include/Config/sys/mman.h
@@ -0,0 +1,24 @@
+/*
+ * Header file: mman.h
+ *
+ * Description:
+ *	This header file includes the headers needed for the mmap() system/
+ *	function call.  It also defines some macros so that all of our calls
+ *	to mmap() can act (more or less) the same, regardless of platform.
+ */
+
+#ifndef _CONFIG_MMAN_H
+#define _CONFIG_MMAN_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+
+#ifndef HAVE_MMAP_ANONYMOUS
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+
+#endif
+
diff --git a/include/Config/sys/resource.h b/include/Config/sys/resource.h
new file mode 100644
index 0000000..00979b2
--- /dev/null
+++ b/include/Config/sys/resource.h
@@ -0,0 +1,33 @@
+/*
+ * Header file: resource.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for sys/resource.h (if it
+ *	lives on the system).
+ */
+
+#ifndef _CONFIG_SYS_RESOURCE_H
+#define _CONFIG_SYS_RESOURCE_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_SYS_RESOURCE_H
+
+/*
+ * In LLVM, we use sys/resource.h to use getrusage() and maybe some other
+ * stuff.  Some man pages say that you also need sys/time.h and unistd.h.
+ * So, to be paranoid, we will try to include all three if possible.
+ */
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#include <sys/resource.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#endif
+
+#endif
diff --git a/include/Config/sys/stat.h b/include/Config/sys/stat.h
new file mode 100644
index 0000000..7bf33d3
--- /dev/null
+++ b/include/Config/sys/stat.h
@@ -0,0 +1,19 @@
+/*
+ * Header file: stat.h
+ *
+ * Description:
+ *	This header file includes the headers needed for the stat() system
+ *	call.
+ */
+
+#ifndef _CONFIG_SYS_STAT_H
+#define _CONFIG_SYS_STAT_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+#endif
+
diff --git a/include/Config/sys/time.h b/include/Config/sys/time.h
new file mode 100644
index 0000000..c982b8e
--- /dev/null
+++ b/include/Config/sys/time.h
@@ -0,0 +1,18 @@
+/*
+ * Header file: time.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for sys/time.h (if it
+ *	lives on the system).
+ */
+
+#ifndef _CONFIG_SYS_TIME_H
+#define _CONFIG_SYS_TIME_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#endif
diff --git a/include/Config/sys/types.h b/include/Config/sys/types.h
new file mode 100644
index 0000000..08ec22d
--- /dev/null
+++ b/include/Config/sys/types.h
@@ -0,0 +1,19 @@
+/*
+ * Header file: types.h
+ *
+ * Description:
+ *	This header file is the autoconf substitute for sys/types.h.  It
+ *	includes it for us if it exists on this system.
+ */
+
+#ifndef _CONFIG_SYS_TYPES_H
+#define _CONFIG_SYS_TYPES_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#endif
+
diff --git a/include/Config/sys/wait.h b/include/Config/sys/wait.h
new file mode 100644
index 0000000..5d69fa1
--- /dev/null
+++ b/include/Config/sys/wait.h
@@ -0,0 +1,19 @@
+/*
+ * Header file: wait.h
+ *
+ * Description:
+ *	This header file includes the headers needed for the wait() system
+ *	call.
+ */
+
+#ifndef _CONFIG_SYS_WAIT_H
+#define _CONFIG_SYS_WAIT_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+
+#endif
+
diff --git a/include/Config/time.h b/include/Config/time.h
new file mode 100644
index 0000000..4f14d0d
--- /dev/null
+++ b/include/Config/time.h
@@ -0,0 +1,28 @@
+/*
+ * Header file: time.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for time.h (if it lives
+ *	on the system).
+ *
+ *	The added benefit of this header file is that it removes the
+ *	"time with sys/time" problem.
+ *
+ *	According to the autoconf manual, some systems have a sys/time.h that
+ *	includes time.h, but time.h is not written to handle multiple
+ *	inclusion.  This means that a program including sys/time.h cannot
+ *	also include time.h.
+ *
+ *	This header file fixes that problem.
+ */
+
+#ifndef _CONFIG_TIME_H
+#define _CONFIG_TIME_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+
+#endif
diff --git a/include/Config/unistd.h b/include/Config/unistd.h
new file mode 100644
index 0000000..72642ae
--- /dev/null
+++ b/include/Config/unistd.h
@@ -0,0 +1,18 @@
+/*
+ * Header file: unistd.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for unistd.h (if it lives
+ *	on the system).
+ */
+
+#ifndef _CONFIG_UNISTD_H
+#define _CONFIG_UNISTD_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#endif
diff --git a/include/Support/Alloca.h b/include/Support/Alloca.h
index a56e874..ea4e41c 100644
--- a/include/Support/Alloca.h
+++ b/include/Support/Alloca.h
@@ -9,22 +9,6 @@
 #ifndef SUPPORT_ALLOCA_H
 #define SUPPORT_ALLOCA_H
 
-// TODO: Determine HAVE_ALLOCA_H based on autoconf results.
-// The following method is too brittle.
-#if defined(HAVE_ALLOCA_H)
-#undef HAVE_ALLOCA_H
-#endif
-
-#if defined(__linux__)
-#define HAVE_ALLOCA_H 1
-#elif defined(__sparc__)
-#define HAVE_ALLOCA_H 1
-#elif defined(__FreeBSD__)
-// not defined here
-#endif
-
-#if HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
+#include "Config/alloca.h"
 
 #endif  /* SUPPORT_ALLOCA_H */
diff --git a/include/Support/Annotation.h b/include/Support/Annotation.h
index 8dbad76..9642f03 100644
--- a/include/Support/Annotation.h
+++ b/include/Support/Annotation.h
@@ -16,7 +16,7 @@
 #define SUPPORT_ANNOTATION_H
 
 #include <string>
-#include <assert.h>
+
 class AnnotationID;
 class Annotation;
 class Annotable;
diff --git a/include/Support/BitSetVector.h b/include/Support/BitSetVector.h
index 898ea53..cdcd52d 100644
--- a/include/Support/BitSetVector.h
+++ b/include/Support/BitSetVector.h
@@ -24,7 +24,6 @@
 #include <vector>
 #include <functional>
 #include <iostream>
-#include <assert.h>
 
 class BitSetVector {
   enum { BITSET_WORDSIZE = sizeof(long)*8 };
diff --git a/include/Support/Casting.h b/include/Support/Casting.h
index 491d165..476d3ae 100644
--- a/include/Support/Casting.h
+++ b/include/Support/Casting.h
@@ -8,8 +8,6 @@
 #ifndef SUPPORT_CASTING_H
 #define SUPPORT_CASTING_H
 
-#include <assert.h>
-
 //===----------------------------------------------------------------------===//
 //                          isa<x> Support Templates
 //===----------------------------------------------------------------------===//
diff --git a/include/Support/CommandLine.h b/include/Support/CommandLine.h
index 97b223c..eb1aa18 100644
--- a/include/Support/CommandLine.h
+++ b/include/Support/CommandLine.h
@@ -18,7 +18,6 @@
 #include <utility>
 #include <cstdarg>
 #include "boost/type_traits/object_traits.hpp"
-#include <assert.h>
 
 /// cl Namespace - This namespace contains all of the command line option
 /// processing machinery.  It is intentionally a short name to make qualified
diff --git a/include/Support/DataTypes.h b/include/Support/DataTypes.h
index 80543c6..2f6724c 100644
--- a/include/Support/DataTypes.h
+++ b/include/Support/DataTypes.h
@@ -13,65 +13,19 @@
 //
 //===----------------------------------------------------------------------===//
 
-// TODO: This file sucks.  Not only does it not work, but this stuff should be
-// autoconfiscated anyways. Major FIXME
-
 #ifndef SUPPORT_DATATYPES_H
 #define SUPPORT_DATATYPES_H
 
+#include "Config/config.h"
+
 #define __STDC_LIMIT_MACROS 1
+
+#ifdef HAVE_INTTYPES_H
 #include <inttypes.h>
-
-#ifdef __linux__
-#  include <endian.h>
-#  if BYTE_ORDER == LITTLE_ENDIAN
-#    undef BIG_ENDIAN
-#  else
-#    undef LITTLE_ENDIAN
-#  endif
 #endif
 
-#ifdef __FreeBSD__
-#  include <machine/endian.h>
-#  if _BYTE_ORDER == _LITTLE_ENDIAN
-#    ifndef LITTLE_ENDIAN
-#      define LITTLE_ENDIAN 1
-#    endif
-#    ifdef BIG_ENDIAN
-#      undef BIG_ENDIAN
-#    endif
-#  else
-#    ifndef BIG_ENDIAN
-#      define BIG_ENDIAN 1
-#    endif
-#    ifdef LITTLE_ENDIAN
-#      undef LITTLE_ENDIAN
-#    endif
-#  endif
-#endif
-
-#ifdef __sparc__
-#  include <sys/types.h>
-#  ifdef _LITTLE_ENDIAN
-#    define LITTLE_ENDIAN 1
-#  else
-#    define BIG_ENDIAN 1
-#  endif
-#endif
-
-//
-// Convert the information from the header files into our own local
-// endian macros.  We do this because various strange systems define both
-// BIG_ENDIAN and LITTLE_ENDIAN, and we don't want to conflict with them.
-//
-// Don't worry; once we introduce autoconf, this will look a lot nicer.
-// 
-#ifdef LITTLE_ENDIAN
-#define ENDIAN_LITTLE
-#endif
-
-#ifdef BIG_ENDIAN
-#define ENDIAN_BIG
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
 #endif
 
 #if (defined(ENDIAN_LITTLE) && defined(ENDIAN_BIG))
diff --git a/include/Support/SCCIterator.h b/include/Support/SCCIterator.h
index a06e186..4de80f4 100644
--- a/include/Support/SCCIterator.h
+++ b/include/Support/SCCIterator.h
@@ -21,7 +21,6 @@
 #include <vector>
 #include <stack>
 #include <map>
-#include <assert.h>
 
 //--------------------------------------------------------------------------
 // class SCC : A simple representation of an SCC in a generic Graph.
diff --git a/include/Support/Signals.h b/include/Support/Signals.h
index 1445bd4..86e5f91 100644
--- a/include/Support/Signals.h
+++ b/include/Support/Signals.h
@@ -10,6 +10,11 @@
 
 #include <string>
 
+//
+// This will include the signal handler return type.
+//
+#include "Config/config.h"
+
 // RemoveFileOnSignal - This function registers signal handlers to ensure that
 // if a signal gets delivered that the named file is removed.
 //
diff --git a/include/Support/Timer.h b/include/Support/Timer.h
index 5cacada..c36006f 100644
--- a/include/Support/Timer.h
+++ b/include/Support/Timer.h
@@ -28,7 +28,6 @@
 #include <string>
 #include <vector>
 #include <iosfwd>
-#include <assert.h>
 
 class TimerGroup;
 
diff --git a/include/Support/Tree.h b/include/Support/Tree.h
index 7a3e9c4..928c99b 100644
--- a/include/Support/Tree.h
+++ b/include/Support/Tree.h
@@ -9,7 +9,6 @@
 #define SUPPORT_TREE_H
 
 #include <vector>
-#include <assert.h>
 
 template<class ConcreteTreeNode, class Payload>
 class Tree {
diff --git a/include/Support/hash_map b/include/Support/hash_map
index 3c50e4b..ce4c42f 100644
--- a/include/Support/hash_map
+++ b/include/Support/hash_map
@@ -17,23 +17,25 @@
 //  3.0.4       std      ext/hash_map
 //  3.1      __gnu_cxx   ext/hash_map
 //
-#if __GNUC__ == 3
+
+#include "Config/config.h"
+
+#ifdef HAVE_GNU_EXT_HASH_MAP
+
 #include <ext/hash_map>
-
-#ifndef HASH_NAMESPACE
-#if __GNUC_MINOR__ == 0
-#define HASH_NAMESPACE std
-#else
 #define HASH_NAMESPACE __gnu_cxx
-#endif
-#endif
 
 #else
 
-#include <hash_map>
-#ifndef HASH_NAMESPACE
+#ifdef HAVE_STD_EXT_HASH_MAP
+#include <ext/hash_map>
 #define HASH_NAMESPACE std
+
+#else
+#include <hash_map>
+#define HASH_NAMESPACE
 #endif
+
 #endif
 
 using HASH_NAMESPACE::hash_map;
diff --git a/include/Support/hash_set b/include/Support/hash_set
index 72c20ce..045083c 100644
--- a/include/Support/hash_set
+++ b/include/Support/hash_set
@@ -17,23 +17,25 @@
 //  3.0.4       std      ext/hash_set
 //  3.1      __gnu_cxx   ext/hash_set
 //
-#if __GNUC__==3
+
+#include "Config/config.h"
+
+#ifdef HAVE_GNU_EXT_HASH_SET
+
 #include <ext/hash_set>
-
-#ifndef HASH_NAMESPACE
-#if __GNUC_MINOR__ == 0
-#define HASH_NAMESPACE std
-#else
 #define HASH_NAMESPACE __gnu_cxx
-#endif
-#endif
 
 #else
 
-#include <hash_set>
-#ifndef HASH_NAMESPACE
+#ifdef HAVE_STD_EXT_HASH_SET
+#include <ext/hash_set>
 #define HASH_NAMESPACE std
+
+#else
+#include <hash_set>
+#define HASH_NAMESPACE
 #endif
+
 #endif
 
 using HASH_NAMESPACE::hash_set;
diff --git a/include/Support/ilist b/include/Support/ilist
index ce906ba..83a1fe6 100644
--- a/include/Support/ilist
+++ b/include/Support/ilist
@@ -31,7 +31,6 @@
 #ifndef SUPPORT_ILIST
 #define SUPPORT_ILIST
 
-#include <assert.h>
 #include <algorithm>
 #include <Support/iterator>
 
diff --git a/include/Support/iterator b/include/Support/iterator
index 444f5ab..d0c7b51 100644
--- a/include/Support/iterator
+++ b/include/Support/iterator
@@ -19,9 +19,11 @@
 #ifndef SUPPORT_ITERATOR
 #define SUPPORT_ITERATOR
 
+#include "Config/config.h"
+
 #include <iterator>
 
-#if __GNUC__ == 3
+#ifdef HAVE_STD_ITERATOR
 
 // Define stupid wrappers around std::iterator...
 template<class Ty, class PtrDiffTy>
@@ -35,6 +37,7 @@
 };
 
 #else
+
 // Just use bidirectional_iterator directly.
 using std::bidirectional_iterator;
 using std::forward_iterator;
diff --git a/include/Support/slist b/include/Support/slist
index 71670e6..31c5ce8 100644
--- a/include/Support/slist
+++ b/include/Support/slist
@@ -10,6 +10,8 @@
 #ifndef SUPPORT_SLIST
 #define SUPPORT_SLIST
 
+#include "Config/config.h"
+
 // Compiler Support Matrix
 //
 // Version   Namespace   Header File
@@ -17,18 +19,19 @@
 //  3.0.4       std      ext/slist
 //  3.1      __gnu_cxx   ext/slist
 //
-#if __GNUC__ == 3
-#include <ext/slist>
 
-#if __GNUC_MINOR__ == 0
-using std::slist;
+#ifdef HAVE_EXT_SLIST
+#include <ext/slist>
 #else
-using __gnu_cxx::slist;
+#include <slist>
 #endif
 
-#else
-// GCC 2.x
-#include <slist>
+#if HAVE_EXT_SLIST == std
+using std::slist;
+#endif
+
+#if HAVE_EXT_SLIST == gnu
+using __gnu_cxx::slist;
 #endif
 
 #endif
diff --git a/include/llvm/ADT/BitSetVector.h b/include/llvm/ADT/BitSetVector.h
index 898ea53..cdcd52d 100644
--- a/include/llvm/ADT/BitSetVector.h
+++ b/include/llvm/ADT/BitSetVector.h
@@ -24,7 +24,6 @@
 #include <vector>
 #include <functional>
 #include <iostream>
-#include <assert.h>
 
 class BitSetVector {
   enum { BITSET_WORDSIZE = sizeof(long)*8 };
diff --git a/include/llvm/ADT/SCCIterator.h b/include/llvm/ADT/SCCIterator.h
index a06e186..4de80f4 100644
--- a/include/llvm/ADT/SCCIterator.h
+++ b/include/llvm/ADT/SCCIterator.h
@@ -21,7 +21,6 @@
 #include <vector>
 #include <stack>
 #include <map>
-#include <assert.h>
 
 //--------------------------------------------------------------------------
 // class SCC : A simple representation of an SCC in a generic Graph.
diff --git a/include/llvm/ADT/Tree.h b/include/llvm/ADT/Tree.h
index 7a3e9c4..928c99b 100644
--- a/include/llvm/ADT/Tree.h
+++ b/include/llvm/ADT/Tree.h
@@ -9,7 +9,6 @@
 #define SUPPORT_TREE_H
 
 #include <vector>
-#include <assert.h>
 
 template<class ConcreteTreeNode, class Payload>
 class Tree {
diff --git a/include/llvm/ADT/ilist b/include/llvm/ADT/ilist
index ce906ba..83a1fe6 100644
--- a/include/llvm/ADT/ilist
+++ b/include/llvm/ADT/ilist
@@ -31,7 +31,6 @@
 #ifndef SUPPORT_ILIST
 #define SUPPORT_ILIST
 
-#include <assert.h>
 #include <algorithm>
 #include <Support/iterator>
 
diff --git a/include/llvm/AbstractTypeUser.h b/include/llvm/AbstractTypeUser.h
index 751c5ac..c1548c8 100644
--- a/include/llvm/AbstractTypeUser.h
+++ b/include/llvm/AbstractTypeUser.h
@@ -21,7 +21,16 @@
 #ifndef LLVM_ABSTRACT_TYPE_USER_H
 #define LLVM_ABSTRACT_TYPE_USER_H
 
-#include <assert.h>
+//
+// This is the "master" include for assert.h
+// Whether this file needs it or not, it must always include assert.h for the
+// files which include llvm/AbstractTypeUser.h
+//
+// In this way, most every LLVM source file will have access to the assert()
+// macro without having to #include <assert.h> directly.
+//
+#include "Config/assert.h"
+
 class Type;
 class DerivedType;
 
diff --git a/include/llvm/Analysis/DependenceGraph.h b/include/llvm/Analysis/DependenceGraph.h
index 65831f9..9081e4d 100644
--- a/include/llvm/Analysis/DependenceGraph.h
+++ b/include/llvm/Analysis/DependenceGraph.h
@@ -21,7 +21,6 @@
 #include <iosfwd>
 #include <vector>
 #include <utility>
-#include <assert.h>
 
 class Instruction;
 class Function;
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index 7881d82..a38d7d1 100644
--- a/include/llvm/Analysis/Dominators.h
+++ b/include/llvm/Analysis/Dominators.h
@@ -20,6 +20,7 @@
 
 #include "llvm/Pass.h"
 #include <set>
+
 class Instruction;
 
 template <typename GraphType> struct GraphTraits;
diff --git a/include/llvm/CodeGen/InstrSelection.h b/include/llvm/CodeGen/InstrSelection.h
index c1ed86e..03999db 100644
--- a/include/llvm/CodeGen/InstrSelection.h
+++ b/include/llvm/CodeGen/InstrSelection.h
@@ -8,6 +8,7 @@
 #define LLVM_CODEGEN_INSTR_SELECTION_H
 
 #include "llvm/Instruction.h"
+
 class Function;
 class InstrForest;
 class MachineInstr;
diff --git a/include/llvm/CodeGen/MachineFrameInfo.h b/include/llvm/CodeGen/MachineFrameInfo.h
index 5b2b0b5..6f907e1 100644
--- a/include/llvm/CodeGen/MachineFrameInfo.h
+++ b/include/llvm/CodeGen/MachineFrameInfo.h
@@ -35,7 +35,6 @@
 class TargetRegisterClass;
 class MachineFunction;
 #include <vector>
-#include <assert.h>
 
 class MachineFrameInfo {
 
diff --git a/include/llvm/CodeGen/SSARegMap.h b/include/llvm/CodeGen/SSARegMap.h
index b1b00ac..08fa672 100644
--- a/include/llvm/CodeGen/SSARegMap.h
+++ b/include/llvm/CodeGen/SSARegMap.h
@@ -11,6 +11,7 @@
 #define LLVM_CODEGEN_SSAREGMAP_H
 
 #include "llvm/Target/MRegisterInfo.h"
+
 class TargetRegisterClass;
 
 class SSARegMap {
diff --git a/include/llvm/Config/alloca.h b/include/llvm/Config/alloca.h
new file mode 100644
index 0000000..f27ef06
--- /dev/null
+++ b/include/llvm/Config/alloca.h
@@ -0,0 +1,46 @@
+/*
+ * Header file: alloc.h
+ *
+ * Description:
+ *	This header file includes the infamous alloc.h header file if the
+ *	autoconf system has found it.  It hides all of the autoconf details
+ *	from the rest of the application source code.
+ */
+
+#ifndef _CONFIG_ALLOC_H
+#define _CONFIG_ALLOC_H
+
+#include "Config/config.h"
+
+/*
+ * This is a modified version of that suggested by the Autoconf manual.
+ *	1) The #pragma is indented so that pre-ANSI C compilers ignore it.
+ *	2) If alloca.h cannot be found, then try stdlib.h.  Some platforms
+ *	   (notably FreeBSD) defined alloca() there.
+ */
+#ifndef __GNUC__
+#	ifdef HAVE_ALLOCA_H
+#		include <alloca.h>
+#	else
+#		ifdef _AIX
+ #			pragma alloca
+#		else
+#			ifndef alloca
+				char * alloca ();
+#			endif
+#		endif
+#	endif
+#else
+#	ifdef HAVE_ALLOCA_H
+#		include <alloca.h>
+#	else
+#		ifdef HAVE_STDLIB_H
+#			include <stdlib.h>
+#		else
+#			error "The function alloca() is required but not found!"
+#		endif
+#	endif
+#endif
+
+#endif
+
diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in
new file mode 100644
index 0000000..fd1c810
--- /dev/null
+++ b/include/llvm/Config/config.h.in
@@ -0,0 +1,210 @@
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+   systems. This function is required for `alloca.c' support on those systems.
+   */
+#undef CRAY_STACKSEG_END
+
+/* Define to 1 if using `alloca.c'. */
+#undef C_ALLOCA
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#undef HAVE_ALLOCA
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+   */
+#undef HAVE_ALLOCA_H
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#undef HAVE_DOPRNT
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `getcwd' function. */
+#undef HAVE_GETCWD
+
+/* Define to 1 if you have the `getpagesize' function. */
+#undef HAVE_GETPAGESIZE
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `dl' library (-ldl). */
+#undef HAVE_LIBDL
+
+/* Define to 1 if you have the `elf' library (-lelf). */
+#undef HAVE_LIBELF
+
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
+/* Define to 1 if you have the `papi' library (-lpapi). */
+#undef HAVE_LIBPAPI
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if you have the <malloc.h> header file. */
+#undef HAVE_MALLOC_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have a working `mmap' system call. */
+#undef HAVE_MMAP
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strcspn' function. */
+#undef HAVE_STRCSPN
+
+/* Define to 1 if you have the `strdup' function. */
+#undef HAVE_STRDUP
+
+/* Define to 1 if you have the `strerror' function. */
+#undef HAVE_STRERROR
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strspn' function. */
+#undef HAVE_STRSPN
+
+/* Define to 1 if you have the `strstr' function. */
+#undef HAVE_STRSTR
+
+/* Define to 1 if you have the `strtod' function. */
+#undef HAVE_STRTOD
+
+/* Define to 1 if you have the `strtol' function. */
+#undef HAVE_STRTOL
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#undef HAVE_SYS_WAIT_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `vprintf' function. */
+#undef HAVE_VPRINTF
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#undef RETSIGTYPE
+
+/* Define to 1 if the `setvbuf' function takes the buffering type as its
+   second argument and the buffer pointer as the third, as on System V before
+   release 3. */
+#undef SETVBUF_REVERSED
+
+/* If using the C implementation of alloca, define if you know the
+   direction of stack growth for your system; otherwise it will be
+   automatically deduced at run-time.
+        STACK_DIRECTION > 0 => grows toward higher addresses
+        STACK_DIRECTION < 0 => grows toward lower addresses
+        STACK_DIRECTION = 0 => direction of growth unknown */
+#undef STACK_DIRECTION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
+#undef TM_IN_SYS_TIME
+
+/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
+   `char[]'. */
+#undef YYTEXT_POINTER
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define as `__inline' if that's what the C compiler calls it, or to nothing
+   if it is not supported. */
+#undef inline
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+#undef size_t
+
+/* Define to mark the machine as having little endian */
+#ifndef ENDIAN_LITTLE
+#undef ENDIAN_LITTLE
+#endif
+
+/* Define to mark the machine as having big endian */
+#ifndef ENDIAN_BIG
+#undef ENDIAN_BIG
+#endif
+
+/* Define to indicate how to include hash_map */
+#undef HAVE_STD_EXT_HASH_MAP
+#undef HAVE_GNU_EXT_HASH_MAP
+
+/* Define to incdicate how to include has_set */
+#undef HAVE_STD_EXT_HASH_SET
+#undef HAVE_GNU_EXT_HASH_SET
+
+/* Indicates whether we have STL iterators */
+#undef HAVE_STD_ITERATOR
+
+/* Indicates which slist we should use */
+#undef HAVE_EXT_SLIST
+
+/* Indicates whether we have the MALLINFO functionality */
+#undef HAVE_MALLINFO
+
+/* Indicates if we have MAP_ANONYMOUS */
+#undef HAVE_MMAP_ANONYMOUS
+
+/* Indicates whether we have MMAP header file */
+#undef HAVE_SYS_MMAN_H
+
+/* Indicates that we have assert.h */
+#undef HAVE_ASSERT_H
+
+/* Macros for various header files */
+#undef HAVE_SIGNAL_H
+#undef HAVE_ERRNO_H
+#undef HAVE_SYS_RESOURCE_H
+#undef HAVE_MATH_H
+#undef HAVE_DLFCN_H
+#undef HAVE_LINK_H
diff --git a/include/llvm/Config/dlfcn.h b/include/llvm/Config/dlfcn.h
new file mode 100644
index 0000000..9beddcc
--- /dev/null
+++ b/include/llvm/Config/dlfcn.h
@@ -0,0 +1,27 @@
+/*
+ * Header file: dlfcn.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for dlfcn.h (if it lives
+ *	on the system).
+ */
+
+#ifndef _CONFIG_DLFCN_H
+#define _CONFIG_DLFCN_H
+
+#include "Config/config.h"
+
+/*
+ * According to the man pages on dlopen(), we sometimes need link.h.  So,
+ * go grab it just in case.
+ */
+#ifdef HAVE_DLFCN_H
+#include <dlfcn.h>
+
+#ifdef HAVE_LINK_H
+#include <link.h>
+#endif
+
+#endif
+
+#endif
diff --git a/include/llvm/Config/fcntl.h b/include/llvm/Config/fcntl.h
new file mode 100644
index 0000000..267503d
--- /dev/null
+++ b/include/llvm/Config/fcntl.h
@@ -0,0 +1,18 @@
+/*
+ * Header file: fcntl.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for fcntl.h (if it lives
+ *	on the system).
+ */
+
+#ifndef _CONFIG_FCNTL_H
+#define _CONFIG_FCNTL_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#endif
diff --git a/include/llvm/Config/limits.h b/include/llvm/Config/limits.h
new file mode 100644
index 0000000..da5cd66
--- /dev/null
+++ b/include/llvm/Config/limits.h
@@ -0,0 +1,18 @@
+/*
+ * Header file: limits.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for limits.h (if it lives
+ *	on the system).
+ */
+
+#ifndef _CONFIG_LIMITS_H
+#define _CONFIG_LIMITS_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+#endif
diff --git a/include/llvm/Config/malloc.h b/include/llvm/Config/malloc.h
new file mode 100644
index 0000000..fa85fc8
--- /dev/null
+++ b/include/llvm/Config/malloc.h
@@ -0,0 +1,20 @@
+/*
+ * Header file: malloc.h
+ *
+ * Description:
+ *	This header file includes the infamous malloc.h header file if the
+ *	autoconf system has found it.  It hides all of the autoconf details
+ *	from the rest of the application source code.
+ */
+
+#ifndef _SUPPORT_MALLOC_H
+#define _SUPPORT_MALLOC_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+
+#endif
+
diff --git a/include/llvm/Config/memory.h b/include/llvm/Config/memory.h
new file mode 100644
index 0000000..01d68ae
--- /dev/null
+++ b/include/llvm/Config/memory.h
@@ -0,0 +1,18 @@
+/*
+ * Header file: memory.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for memory.h (if it lives
+ *	on the system).
+ */
+
+#ifndef _CONFIG_MEMORY_H
+#define _CONFIG_MEMORY_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+
+#endif
diff --git a/include/llvm/Config/stdint.h b/include/llvm/Config/stdint.h
new file mode 100644
index 0000000..fe2a076
--- /dev/null
+++ b/include/llvm/Config/stdint.h
@@ -0,0 +1,18 @@
+/*
+ * Header file: stdint.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for stdint.h (if it lives
+ *	on the system).
+ */
+
+#ifndef _CONFIG_STDINT_H
+#define _CONFIG_STDINT_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
+#endif
diff --git a/include/llvm/Config/sys/mman.h b/include/llvm/Config/sys/mman.h
new file mode 100644
index 0000000..af7affd
--- /dev/null
+++ b/include/llvm/Config/sys/mman.h
@@ -0,0 +1,24 @@
+/*
+ * Header file: mman.h
+ *
+ * Description:
+ *	This header file includes the headers needed for the mmap() system/
+ *	function call.  It also defines some macros so that all of our calls
+ *	to mmap() can act (more or less) the same, regardless of platform.
+ */
+
+#ifndef _CONFIG_MMAN_H
+#define _CONFIG_MMAN_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+
+#ifndef HAVE_MMAP_ANONYMOUS
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+
+#endif
+
diff --git a/include/llvm/Config/sys/resource.h b/include/llvm/Config/sys/resource.h
new file mode 100644
index 0000000..00979b2
--- /dev/null
+++ b/include/llvm/Config/sys/resource.h
@@ -0,0 +1,33 @@
+/*
+ * Header file: resource.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for sys/resource.h (if it
+ *	lives on the system).
+ */
+
+#ifndef _CONFIG_SYS_RESOURCE_H
+#define _CONFIG_SYS_RESOURCE_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_SYS_RESOURCE_H
+
+/*
+ * In LLVM, we use sys/resource.h to use getrusage() and maybe some other
+ * stuff.  Some man pages say that you also need sys/time.h and unistd.h.
+ * So, to be paranoid, we will try to include all three if possible.
+ */
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#include <sys/resource.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#endif
+
+#endif
diff --git a/include/llvm/Config/sys/stat.h b/include/llvm/Config/sys/stat.h
new file mode 100644
index 0000000..7bf33d3
--- /dev/null
+++ b/include/llvm/Config/sys/stat.h
@@ -0,0 +1,19 @@
+/*
+ * Header file: stat.h
+ *
+ * Description:
+ *	This header file includes the headers needed for the stat() system
+ *	call.
+ */
+
+#ifndef _CONFIG_SYS_STAT_H
+#define _CONFIG_SYS_STAT_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+#endif
+
diff --git a/include/llvm/Config/sys/time.h b/include/llvm/Config/sys/time.h
new file mode 100644
index 0000000..c982b8e
--- /dev/null
+++ b/include/llvm/Config/sys/time.h
@@ -0,0 +1,18 @@
+/*
+ * Header file: time.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for sys/time.h (if it
+ *	lives on the system).
+ */
+
+#ifndef _CONFIG_SYS_TIME_H
+#define _CONFIG_SYS_TIME_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#endif
diff --git a/include/llvm/Config/sys/types.h b/include/llvm/Config/sys/types.h
new file mode 100644
index 0000000..08ec22d
--- /dev/null
+++ b/include/llvm/Config/sys/types.h
@@ -0,0 +1,19 @@
+/*
+ * Header file: types.h
+ *
+ * Description:
+ *	This header file is the autoconf substitute for sys/types.h.  It
+ *	includes it for us if it exists on this system.
+ */
+
+#ifndef _CONFIG_SYS_TYPES_H
+#define _CONFIG_SYS_TYPES_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#endif
+
diff --git a/include/llvm/Config/sys/wait.h b/include/llvm/Config/sys/wait.h
new file mode 100644
index 0000000..5d69fa1
--- /dev/null
+++ b/include/llvm/Config/sys/wait.h
@@ -0,0 +1,19 @@
+/*
+ * Header file: wait.h
+ *
+ * Description:
+ *	This header file includes the headers needed for the wait() system
+ *	call.
+ */
+
+#ifndef _CONFIG_SYS_WAIT_H
+#define _CONFIG_SYS_WAIT_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+
+#endif
+
diff --git a/include/llvm/Config/time.h b/include/llvm/Config/time.h
new file mode 100644
index 0000000..4f14d0d
--- /dev/null
+++ b/include/llvm/Config/time.h
@@ -0,0 +1,28 @@
+/*
+ * Header file: time.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for time.h (if it lives
+ *	on the system).
+ *
+ *	The added benefit of this header file is that it removes the
+ *	"time with sys/time" problem.
+ *
+ *	According to the autoconf manual, some systems have a sys/time.h that
+ *	includes time.h, but time.h is not written to handle multiple
+ *	inclusion.  This means that a program including sys/time.h cannot
+ *	also include time.h.
+ *
+ *	This header file fixes that problem.
+ */
+
+#ifndef _CONFIG_TIME_H
+#define _CONFIG_TIME_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+
+#endif
diff --git a/include/llvm/Config/unistd.h b/include/llvm/Config/unistd.h
new file mode 100644
index 0000000..72642ae
--- /dev/null
+++ b/include/llvm/Config/unistd.h
@@ -0,0 +1,18 @@
+/*
+ * Header file: unistd.h
+ *
+ * Description:
+ *	This header file is the autoconf replacement for unistd.h (if it lives
+ *	on the system).
+ */
+
+#ifndef _CONFIG_UNISTD_H
+#define _CONFIG_UNISTD_H
+
+#include "Config/config.h"
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#endif
diff --git a/include/llvm/GlobalVariable.h b/include/llvm/GlobalVariable.h
index 6fb74a3..1fd004c 100644
--- a/include/llvm/GlobalVariable.h
+++ b/include/llvm/GlobalVariable.h
@@ -14,6 +14,7 @@
 #define LLVM_GLOBAL_VARIABLE_H
 
 #include "llvm/GlobalValue.h"
+
 class Module;
 class Constant;
 class PointerType;
diff --git a/include/llvm/Instruction.h b/include/llvm/Instruction.h
index 5f61b2d..4011794 100644
--- a/include/llvm/Instruction.h
+++ b/include/llvm/Instruction.h
@@ -9,6 +9,7 @@
 #define LLVM_INSTRUCTION_H
 
 #include "llvm/User.h"
+
 template<typename SC> struct ilist_traits;
 template<typename ValueSubClass, typename ItemParentClass, typename SymTabClass,
          typename SubClass> class SymbolTableListTraits;
diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h
index 7ca3fdd..344baa0 100644
--- a/include/llvm/Pass.h
+++ b/include/llvm/Pass.h
@@ -22,7 +22,6 @@
 #ifndef LLVM_PASS_H
 #define LLVM_PASS_H
 
-#include <assert.h>
 #include <vector>
 #include <map>
 #include <iosfwd>
diff --git a/include/llvm/Support/Annotation.h b/include/llvm/Support/Annotation.h
index 8dbad76..9642f03 100644
--- a/include/llvm/Support/Annotation.h
+++ b/include/llvm/Support/Annotation.h
@@ -16,7 +16,7 @@
 #define SUPPORT_ANNOTATION_H
 
 #include <string>
-#include <assert.h>
+
 class AnnotationID;
 class Annotation;
 class Annotable;
diff --git a/include/llvm/Support/Casting.h b/include/llvm/Support/Casting.h
index 491d165..476d3ae 100644
--- a/include/llvm/Support/Casting.h
+++ b/include/llvm/Support/Casting.h
@@ -8,8 +8,6 @@
 #ifndef SUPPORT_CASTING_H
 #define SUPPORT_CASTING_H
 
-#include <assert.h>
-
 //===----------------------------------------------------------------------===//
 //                          isa<x> Support Templates
 //===----------------------------------------------------------------------===//
diff --git a/include/llvm/Support/CommandLine.h b/include/llvm/Support/CommandLine.h
index 97b223c..eb1aa18 100644
--- a/include/llvm/Support/CommandLine.h
+++ b/include/llvm/Support/CommandLine.h
@@ -18,7 +18,6 @@
 #include <utility>
 #include <cstdarg>
 #include "boost/type_traits/object_traits.hpp"
-#include <assert.h>
 
 /// cl Namespace - This namespace contains all of the command line option
 /// processing machinery.  It is intentionally a short name to make qualified
diff --git a/include/llvm/Support/Timer.h b/include/llvm/Support/Timer.h
index 5cacada..c36006f 100644
--- a/include/llvm/Support/Timer.h
+++ b/include/llvm/Support/Timer.h
@@ -28,7 +28,6 @@
 #include <string>
 #include <vector>
 #include <iosfwd>
-#include <assert.h>
 
 class TimerGroup;
 
diff --git a/include/llvm/System/Signals.h b/include/llvm/System/Signals.h
index 1445bd4..86e5f91 100644
--- a/include/llvm/System/Signals.h
+++ b/include/llvm/System/Signals.h
@@ -10,6 +10,11 @@
 
 #include <string>
 
+//
+// This will include the signal handler return type.
+//
+#include "Config/config.h"
+
 // RemoveFileOnSignal - This function registers signal handlers to ensure that
 // if a signal gets delivered that the named file is removed.
 //
diff --git a/include/llvm/Target/TargetCacheInfo.h b/include/llvm/Target/TargetCacheInfo.h
index 6d5d374..822c881 100644
--- a/include/llvm/Target/TargetCacheInfo.h
+++ b/include/llvm/Target/TargetCacheInfo.h
@@ -8,7 +8,6 @@
 #define LLVM_TARGET_TARGETCACHEINFO_H
 
 #include "Support/DataTypes.h"
-#include <assert.h>
 
 class TargetMachine;
 
diff --git a/include/llvm/Target/TargetInstrInfo.h b/include/llvm/Target/TargetInstrInfo.h
index 754b3a6..6c585c6 100644
--- a/include/llvm/Target/TargetInstrInfo.h
+++ b/include/llvm/Target/TargetInstrInfo.h
@@ -9,7 +9,6 @@
 
 #include "Support/DataTypes.h"
 #include <vector>
-#include <assert.h>
 
 class MachineInstr;
 class TargetMachine;
diff --git a/include/llvm/Target/TargetRegInfo.h b/include/llvm/Target/TargetRegInfo.h
index 1b8c481..7808efc 100644
--- a/include/llvm/Target/TargetRegInfo.h
+++ b/include/llvm/Target/TargetRegInfo.h
@@ -10,7 +10,6 @@
 
 #include "Support/hash_map"
 #include <string>
-#include <assert.h>
 
 class TargetMachine;
 class IGNode;