use gcc instead of dpkg for portability
diff --git a/test/Makefile b/test/Makefile
index 1b12756..0218407 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1,7 +1,7 @@
 TARGET = make_nm normalize_prefix bad_address misc cvt_test cvt_test32 noexception misc32
 XBYAK_INC=../xbyak/xbyak.h
 UNAME_S=$(shell uname -s)
-ifeq ($(shell dpkg --print-architecture),x32)
+ifeq ($(shell ./detect_x32),x32)
 X32=1
 endif
 BIT=32
@@ -98,7 +98,10 @@
 	./test_avx512.sh 64
 endif
 
-test:
+detect_x32: detect_x32.c
+	$(CC) $< -o $@
+
+test: detect_x32
 	$(MAKE) test_nm
 	$(MAKE) test_avx
 	$(MAKE) test_avx512
diff --git a/test/detect_x32.c b/test/detect_x32.c
new file mode 100644
index 0000000..549b8d5
--- /dev/null
+++ b/test/detect_x32.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+int main()
+{
+#if defined(__x86_64__) && defined(__ILP32__)
+	puts("x32");
+#endif
+}