--- cwidget-0.5.16/debian/rules	2013-08-30 09:03:14.000000000 +0000
+++ cwidget/debian/rules	2013-08-30 09:01:32.458831234 +0000
@@ -10,9 +10,18 @@
   DEB_CXXFLAGS_MAINT_APPEND=-fno-strict-aliasing
 endif
 
+ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
+  NOCHECK = yes
+endif
+
+ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
+  CROSS_CONFIGURE_OPTIONS = --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
+  NOCHECK = yes
+endif
+
 configure: configure-stamp
 configure-stamp:
-	./configure --prefix=/usr $(shell dpkg-buildflags --export=configure)
+	./configure --prefix=/usr $(shell dpkg-buildflags --export=configure) $(CROSS_CONFIGURE_OPTIONS)
 
 	touch configure-stamp
 
@@ -21,7 +30,9 @@
 	dh_testdir
 
 	$(MAKE)
+ifneq (yes,$(NOCHECK))
 	$(MAKE) check
+endif
 
 	touch build-stamp-arch
