Android port

Add an Android.mk, a pre-built configuration header
(src/stressapptest_config_android.h) and add an ifdef to use that
header and avoid using namespace __gnu_cxx.

Change-Id: I4fe1f02d46caa9f47bfb644faae7ec095c1517e0
Signed-off-by: Scott Anderson <saa@android.com>
diff --git a/Android.mk b/Android.mk
new file mode 100644
index 0000000..5b0680b
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1,32 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+	src/main.cc \
+	src/adler32memcpy.cc \
+	src/disk_blocks.cc \
+	src/error_diag.cc \
+	src/finelock_queue.cc \
+	src/logger.cc \
+	src/os.cc \
+	src/os_factory.cc \
+	src/pattern.cc \
+	src/queue.cc \
+	src/sat.cc \
+	src/sat_factory.cc \
+	src/worker.cc
+LOCAL_MODULE:= stressapptest
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_CFLAGS := -DHAVE_CONFIG_H -DANDROID -DNDEBUG -UDEBUG -DCHECKOPTS
+
+LOCAL_C_INCLUDES := \
+	bionic \
+	external/stlport/stlport
+
+LOCAL_CPP_EXTENSION := .cc
+
+LOCAL_SHARED_LIBRARIES := libc libstlport
+
+include $(BUILD_EXECUTABLE)
diff --git a/src/sattypes.h b/src/sattypes.h
index 9acfaf4..c9341d0 100644
--- a/src/sattypes.h
+++ b/src/sattypes.h
@@ -26,9 +26,13 @@
 #include <string>
 
 #ifdef HAVE_CONFIG_H  // Built using autoconf
+#ifdef __ANDROID__
+#include "stressapptest_config_android.h"
+#else
 #include "stressapptest_config.h"
-using namespace std;
 using namespace __gnu_cxx;
+#endif
+using namespace std;
 
 typedef signed long long   int64;
 typedef signed int         int32;
diff --git a/src/stressapptest_config_android.h b/src/stressapptest_config_android.h
new file mode 100644
index 0000000..e204198
--- /dev/null
+++ b/src/stressapptest_config_android.h
@@ -0,0 +1,241 @@
+/* src/stressapptest_config.h.  Generated from stressapptest_config.h.in by configure.  */
+/* src/stressapptest_config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to 1 if the `closedir' function returns void instead of `int'. */
+#define CLOSEDIR_VOID 1
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#define HAVE_ARPA_INET_H 1
+
+/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
+   don't. */
+#define HAVE_DECL_STRERROR_R 1
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+   */
+#define HAVE_DIRENT_H 1
+
+/* 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. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the `ftruncate' function. */
+#define HAVE_FTRUNCATE 1
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#define HAVE_GETTIMEOFDAY 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <libaio.h> header file. */
+/* #undef HAVE_LIBAIO_H */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `memset' function. */
+#define HAVE_MEMSET 1
+
+/* Define to 1 if you have the `mmap64' function. */
+/* #undef HAVE_MMAP64 */
+
+/* Define to 1 if you have the `munmap' function. */
+#define HAVE_MUNMAP 1
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+/* #undef HAVE_NDIR_H */
+
+/* Define to 1 if you have the <netdb.h> header file. */
+#define HAVE_NETDB_H 1
+
+/* Define to 1 if you have the `posix_memalign' function. */
+/* #undef HAVE_POSIX_MEMALIGN */
+
+/* Define to 1 if you have the <pthread.h> header file. */
+#define HAVE_PTHREAD_H 1
+
+/* Define to 1 if you have the `rand_r' function. */
+/* #undef HAVE_RAND_R */
+
+/* Define to 1 if you have the `sched_getaffinity' function. */
+#define HAVE_SCHED_GETAFFINITY 1
+
+/* Define to 1 if you have the `select' function. */
+#define HAVE_SELECT 1
+
+/* Define to 1 if you have the `socket' function. */
+#define HAVE_SOCKET 1
+
+/* Define to 1 if stdbool.h conforms to C99. */
+/* #undef HAVE_STDBOOL_H */
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strerror_r' function. */
+#define HAVE_STRERROR_R 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strtol' function. */
+#define HAVE_STRTOL 1
+
+/* Define to 1 if you have the `strtoull' function. */
+#define HAVE_STRTOULL 1
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+   */
+/* #undef HAVE_SYS_DIR_H */
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#define HAVE_SYS_IOCTL_H 1
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+   */
+/* #undef HAVE_SYS_NDIR_H */
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/shm.h> header file. */
+/* #undef HAVE_SYS_SHM_H */
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `vprintf' function. */
+#define HAVE_VPRINTF 1
+
+/* Define to 1 if the system has the type `_Bool'. */
+#define HAVE__BOOL 1
+
+/* Name of package */
+#define PACKAGE "stressapptest"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "opensource@google.com"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "stressapptest"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "stressapptest 1.0.4_autoconf"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "stressapptest"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.0.4_autoconf"
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#define RETSIGTYPE void
+
+/* Define to the type of arg 1 for `select'. */
+#define SELECT_TYPE_ARG1 int
+
+/* Define to the type of args 2, 3 and 4 for `select'. */
+#define SELECT_TYPE_ARG234 (fd_set *)
+
+/* Define to the type of arg 5 for `select'. */
+#define SELECT_TYPE_ARG5 (struct timeval *)
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if strerror_r returns char *. */
+/* #undef STRERROR_R_CHAR_P */
+
+/* Defined if the target CPU is armv7a */
+#define STRESSAPPTEST_CPU_ARMV7A /**/
+
+/* Defined if the target CPU is i686 */
+/* #undef STRESSAPPTEST_CPU_I686 */
+
+/* Defined if the target CPU is PowerPC */
+/* #undef STRESSAPPTEST_CPU_PPC */
+
+/* Defined if the target CPU is x86_64 */
+/* #undef STRESSAPPTEST_CPU_X86_64 */
+
+/* Defined if the target OS is BSD based */
+/* #undef STRESSAPPTEST_OS_BSD */
+
+/* Defined if the target OS is OSX */
+/* #undef STRESSAPPTEST_OS_DARWIN */
+
+/* Defined if the target OS is Linux */
+#define STRESSAPPTEST_OS_LINUX /**/
+
+/* Timestamp when ./configure was executed */
+#define STRESSAPPTEST_TIMESTAMP "saa @ saaws2.mtv.corp.google.com on Tue Feb 28 16:53:44 PST 2012"
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Version number of package */
+#define VERSION "1.0.4_autoconf"
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef pid_t */
+
+/* Define to the equivalent of the C99 'restrict' keyword, or to
+   nothing if this is not supported.  Do not define if restrict is
+   supported directly.  */
+#define restrict __restrict
+/* Work around a bug in Sun C++: it does not support _Restrict or
+   __restrict__, even though the corresponding Sun C compiler ends up with
+   "#define restrict _Restrict" or "#define restrict __restrict__" in the
+   previous line.  Perhaps some future version of Sun C++ will work with
+   restrict; if so, hopefully it defines __RESTRICT like Sun C does.  */
+#if defined __SUNPRO_CC && !defined __RESTRICT
+# define _Restrict
+# define __restrict__
+#endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef ssize_t */
+
+/* Define to the type of an unsigned integer type of width exactly 16 bits if
+   such a type exists and the standard includes do not define it. */
+/* #undef uint16_t */
+
+/* Define to empty if the keyword `volatile' does not work. Warning: valid
+   code using `volatile' can become incorrect without. Disable with care. */
+/* #undef volatile */