diff --git a/autoconf_share/Makefile.common b/autoconf_share/Makefile.common
index ce9e0183dbb3b573ec6ed392db6bcd6b4b743e5c..f580c11e7e0ac3f0006e28d47977574d4d28ab4c 100644
--- a/autoconf_share/Makefile.common
+++ b/autoconf_share/Makefile.common
@@ -274,4 +274,5 @@ TESTS_ENVIRONMENT = LOFARROOT="$(LOFARROOT)" \
                     srcdir="$(srcdir)" \
 		    CHECKTOOLPROGS="$(CHECKTOOLPROGS)" \
 		    MPIBIN="$(MPIBIN)" \
-		    AIPSPP="$(AIPSPP)"
+		    AIPSPP="$(AIPSPP)" \
+		    GNU_AUTOTOOLS="yes"
diff --git a/autoconf_share/runtest.sh b/autoconf_share/runtest.sh
index ec090031ff5636f1402035fae3e5bf7e5ba7208d..ff3970543a8930b20da28cce9bf944b9e30dfe4f 100755
--- a/autoconf_share/runtest.sh
+++ b/autoconf_share/runtest.sh
@@ -167,9 +167,10 @@ else
 fi
 
 # For python files create the lofar/package directory, so the tests can
-# be run as if the python files were installed.
+# be run as if the python files were installed. This is only needed when
+# using the GNU Autotools (note: GNU_AUTOTOOLS is set in Makefile.common).
 # Note that python looks in . before PYTHONPATH.
-if [ "$PYTHONPKG" != "" ]; then
+if [ "$PYTHONPKG" != "" -a "$GNU_AUTOTOOLS" != "" ]; then
   PYTHONDIR=${1}_tmp_pythonpkg_dir           # will be removed automatically
   mkdir -p $PYTHONDIR/lofar/$PYTHONPKG
   touch $PYTHONDIR/lofar/__init__.py