Merge "Fix OSX emulator-[arm|mips] debug builds"
diff --git a/Makefile.target b/Makefile.target
index 558ecbf..0377cdd 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -377,18 +377,10 @@
ifeq ($(HOST_OS),windows)
$(eval $(call insert-windows-icon))
- ifneq ($(BUILD_STANDALONE_EMULATOR),)
- # Special exception for Windows: -lmingw32 must appear before libSDLmain
- # on the link command-line, because it depends on _WinMain@16 which is
- # exported by the latter.
- LOCAL_LDFLAGS += -lmingw32
- else
- # The previous trick doesn't work with the platform build system because
- # it places all linker flags _after_ the actually libraries, so instead
- # recompiler SDLmain from source so its object file is listed in the link
- # command, forcing the linker to use it.
- LOCAL_SRC_FILES += $(SDLMAIN_SOURCES:%=$(SDL_DIR)/%)
- endif
+ # Special exception for Windows: -lmingw32 must appear before libSDLmain
+ # on the link command-line, because it depends on _WinMain@16 which is
+ # exported by the latter.
+ LOCAL_LDFLAGS += -lmingw32
endif
$(call end-emulator-program)
@@ -413,4 +405,13 @@
LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
$(call gen-hx-header,qemu-options.hx,qemu-options.def,vl-android.c qemu-options.h)
$(call gen-hw-config-defs)
+
+ifeq ($(HOST_OS),windows)
+ $(eval $(call insert-windows-icon))
+ # Special exception for Windows: -lmingw32 must appear before libSDLmain
+ # on the link command-line, because it depends on _WinMain@16 which is
+ # exported by the latter.
+ LOCAL_LDFLAGS += -lmingw32
+endif
+
$(call end-emulator-program)
diff --git a/android/filesystems/testing/TestSupport.cpp b/android/filesystems/testing/TestSupport.cpp
index f084306..9ff57a0 100644
--- a/android/filesystems/testing/TestSupport.cpp
+++ b/android/filesystems/testing/TestSupport.cpp
@@ -18,6 +18,8 @@
#ifdef _WIN32
#include <windows.h>
+#else
+#include <unistd.h>
#endif
namespace android {
diff --git a/android/main.c b/android/main.c
index 9cba680..8ce827b 100644
--- a/android/main.c
+++ b/android/main.c
@@ -1282,9 +1282,11 @@
bool accel_ok = android_hasCpuAcceleration(&accel_status);
#ifdef __linux__
+ static const char kAccelerator[] = "KVM";
static const char kEnableAccelerator[] = "-enable-kvm";
static const char kDisableAccelerator[] = "-disable-kvm";
#else
+ static const char kAccelerator[] = "Intel HAXM";
static const char kEnableAccelerator[] = "-enable-hax";
static const char kDisableAccelerator[] = "-disable-hax";
#endif
@@ -1303,6 +1305,28 @@
dprint("CPU Acceleration status: %s", accel_status);
}
+ // Special case: x86_64 emulation currently requires hardware
+ // acceleration, so refuse to start in 'auto' mode if it is not
+ // available.
+ {
+ char* abi = avdInfo_getTargetAbi(avd);
+ if (!strcmp(abi, "x86_64")) {
+ if (!accel_ok && accel_mode != ACCEL_OFF) {
+ derror("x86_64 emulation currently requires hardware acceleration!\n"
+ "Please ensure %s is properly installed and usable.\n"
+ "CPU acceleration status: %s",
+ kAccelerator, accel_status);
+ exit(1);
+ }
+ else if (accel_mode == ACCEL_OFF) {
+ // '-no-accel' of '-accel off' was used explicitly. Warn about
+ // the issue but do not exit.
+ dwarning("x86_64 emulation may not work without hardware acceleration!");
+ }
+ }
+ AFREE(abi);
+ }
+
// CPU acceleration only works for x86 and x86_64 system images.
if (accel_mode == ACCEL_OFF && accel_ok) {
args[n++] = ASTRDUP(kDisableAccelerator);
diff --git a/distrib/sdl-1.2.15/sources.make b/distrib/sdl-1.2.15/sources.make
index 0c988ce..2e1af2b 100644
--- a/distrib/sdl-1.2.15/sources.make
+++ b/distrib/sdl-1.2.15/sources.make
@@ -268,6 +268,7 @@
$(call start-emulator64-library,emulator_lib64SDLmain)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
+LOCAL_CFLAGS += $(SDL_CFLAGS)
LOCAL_SRC_FILES := $(SDLMAIN_SOURCES)
$(call end-emulator-library)