fix broken build rules for host VM.
diff --git a/core/product_config.mk b/core/product_config.mk
index 6dc8221..60d08e5 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -164,6 +164,27 @@
endif # unbundled_goals
# ---------------------------------------------------------------
+# Simulator overrides
+ifeq ($(TARGET_PRODUCT),sim)
+ # Tell the build system to turn on some special cases
+ # to deal with the simulator product.
+ TARGET_SIMULATOR := true
+ # dexpreopt doesn't work when building the simulator
+ DISABLE_DEXPREOPT := true
+endif
+
+# Default to building dalvikvm on hosts that support it...
+ifeq ($(HOST_OS),linux)
+# ... but not if we're building the sim...
+ifneq ($(TARGET_SIMULATOR),true)
+# ... or if the if the option is already set
+ifeq ($(WITH_HOST_DALVIK),)
+ WITH_HOST_DALVIK := true
+endif
+endif
+endif
+
+# ---------------------------------------------------------------
# Include the product definitions.
# We need to do this to translate TARGET_PRODUCT into its
# underlying TARGET_DEVICE before we start defining any rules.
@@ -303,14 +324,3 @@
PRODUCT_EXTRA_RECOVERY_KEYS := $(sort \
$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_EXTRA_RECOVERY_KEYS))
-
-
-# ---------------------------------------------------------------
-# Simulator overrides
-ifeq ($(TARGET_PRODUCT),sim)
- # Tell the build system to turn on some special cases
- # to deal with the simulator product.
- TARGET_SIMULATOR := true
- # dexpreopt doesn't work when building the simulator
- DISABLE_DEXPREOPT := true
-endif