PRODUCT_TREBLE_LINKER_NAMESPACES must be true for BOARD_VNDK_VERSION

If PRODUCT_TREBLE_LINKER_NAMESPACES is not true when
BOARD_VNDK_VERSION is defined, report a build error.
To enable VNDK, linker namespace must be configured.

Bug: 72704254
Test: Try to build with one of them is missing
Change-Id: I804704e2f48fa44c8f998183508741d5cc40e4ce
diff --git a/core/config.mk b/core/config.mk
index e9b5d4c..b6175d8 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -819,6 +819,14 @@
 .KATI_READONLY := \
     PRODUCT_USE_VNDK
 
+# PRODUCT_TREBLE_LINKER_NAMESPACES must be true to define BOARD_VNDK_VERSION.
+ifdef BOARD_VNDK_VERSION
+  ifneq ($(PRODUCT_TREBLE_LINKER_NAMESPACES),true)
+    $(error PRODUCT_TREBLE_LINKER_NAMESPACES must be true \
+            if BOARD_VNDK_VERSION is defined)
+  endif
+endif
+
 ifdef PRODUCT_SHIPPING_API_LEVEL
   ifneq ($(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),27),)
     ifneq ($(TARGET_USES_MKE2FS),true)