--- libidn-1.28/debian/rules	2013-07-10 13:31:48.000000000 +0000
+++ libidn/debian/rules	2013-08-15 05:38:24.872517096 +0000
@@ -3,13 +3,24 @@
 
 export DH_VERBOSE=1
 
+
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+  CHECK_TARGET = check
+else
+  CHECK_TARGET =
+endif
 # Don't build libidn11-java on platforms that doesn't have gcj.
 NO_JAVA_ARCHES := arm hppa hurd-i386
 DEB_HOST_ARCH  ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
-ifeq (,$(filter $(DEB_HOST_ARCH),$(NO_JAVA_ARCHES)))
-  ENABLE_JAVA := --enable-java
+ifeq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
+  ifeq (,$(filter $(DEB_HOST_ARCH),$(NO_JAVA_ARCHES)))
+    ENABLE_JAVA := --enable-java
+  else
+    export DH_OPTIONS=-Nlibidn11-java
+  endif
 else
   export DH_OPTIONS=-Nlibidn11-java
+  CHECK_TARGET =
 endif
 
 # These are used for cross-compiling and for saving the configure script
@@ -43,7 +54,7 @@
 	dh_testdir
 
 	# Add here commands to compile the package.
-	$(MAKE) all check
+	$(MAKE) all $(CHECK_TARGET)
 
 	touch $@
