--- a/m4/ax_have_qt.m4	2020-01-16 19:40:22.927813462 +0100
+++ b/m4/ax_have_qt.m4	2020-01-16 19:42:12.106436543 +0100
@@ -74,6 +74,12 @@
     [QT_QMAKE="qmake"]
   )
 
+  AC_ARG_WITH(qt5-config,
+    [  --with-qt5-config=FILE   uses given qt configuration],
+    [QT_CONFIGURATION="$withval"],
+    [QT_CONFIGURATION=""]
+  )
+
   AC_MSG_CHECKING(for Qt)
   # If we have Qt5 or later in the path, we're golden
   ver=`$QT_QMAKE --version | grep -o "Qt version ."`
@@ -122,7 +128,11 @@
 percent.commands = @echo -n "\$(\$(@))\ "
 QMAKE_EXTRA_TARGETS += percent
 EOF
-    $QT_QMAKE $am_have_qt_pro -o $am_have_qt_makefile
+    if test -z $QT_CONFIGURATION; then
+        $QT_QMAKE $am_have_qt_pro -o $am_have_qt_makefile
+    else
+        $QT_QMAKE $am_have_qt_pro -o $am_have_qt_makefile -qtconf $QT_CONFIGURATION
+    fi
     QT_CXXFLAGS=`make -s -f $am_have_qt_makefile CXXFLAGS INCPATH`
     QT_LIBS=`make -s -f $am_have_qt_makefile LIBS`
     rm $am_have_qt_pro $am_have_qt_makefile
