diff --git a/configure.ac b/configure.ac
index 971d7ad440c5..adb01509ab29 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12683,7 +12683,7 @@ then
 
     dnl Check for Meta Object Compiler
 
-    AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
+    AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [$QT5DIR/bin])
     if test "$MOC5" = "no"; then
         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
 the root of your Qt installation by exporting QT5DIR before running "configure".])
