Merge "Allow BUILD_HOST_static to build statically-linked emulator"
diff --git a/Makefile.android b/Makefile.android
index 7e66bd9..f5c008b 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -132,6 +132,10 @@
       MY_LDLIBS += -m32
     endif
   endif
+
+  ifneq ($(BUILD_HOST_static),)
+    MY_LDLIBS += -static
+  endif
 endif
 
 # Enable warning, except those related to missing field initializers
diff --git a/Makefile.target b/Makefile.target
index 45c8e69..e8a41f4 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -326,7 +326,7 @@
 # Generate a completely static executable if needed.
 # Note that this means no sound and graphics on Linux.
 #
-ifeq ($(CONFIG_STATIC_EXECUTABLE),true)
+ifneq ($(strip $(CONFIG_STATIC_EXECUTABLE)$(BUILD_HOST_static)),)
     LOCAL_SRC_FILES += dynlink-static.c
     LOCAL_LDLIBS    += -static
 endif
@@ -412,7 +412,7 @@
 # Generate a completely static executable if needed.
 # Note that this means no sound and graphics on Linux.
 #
-ifeq ($(CONFIG_STATIC_EXECUTABLE),true)
+ifneq ($(strip $(CONFIG_STATIC_EXECUTABLE)$(BUILD_HOST_static)),)
     common_LOCAL_SRC_FILES += dynlink-static.c
     common_LOCAL_LDLIBS    += -static
 endif