Qt: Make sure extended grep is used with '|'.

* m4/qt.m4: Use grep -E when using the alternation character.
--

POSIX specifies '|' is only supposed to work as an alternation special
character when grep is used in extended mode. The code worked fine
with GNU grep because it accepts extended regular expressions by
default, but other POSIX-compliant implementations might fail and take
it literally.

Signed-off-by: Raphael Kubo da Costa <rakuco@FreeBSD.org>
This commit is contained in:
Raphael Kubo da Costa 2016-12-18 11:41:33 +01:00 committed by Andre Heinecke
parent da5343a9d2
commit 211844f049

View File

@ -32,18 +32,18 @@ AC_DEFUN([FIND_QT],
AC_CHECK_TOOL(MOC, moc) AC_CHECK_TOOL(MOC, moc)
AC_MSG_CHECKING([moc version]) AC_MSG_CHECKING([moc version])
mocversion=`$MOC -v 2>&1` mocversion=`$MOC -v 2>&1`
mocversiongrep=`echo $mocversion | grep "Qt 5\|moc 5"` mocversiongrep=`echo $mocversion | grep -E "Qt 5|moc 5"`
if test x"$mocversiongrep" != x"$mocversion"; then if test x"$mocversiongrep" != x"$mocversion"; then
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
# moc was not the qt5 one, try with moc-qt5 # moc was not the qt5 one, try with moc-qt5
AC_CHECK_TOOL(MOC2, moc-qt5) AC_CHECK_TOOL(MOC2, moc-qt5)
mocversion=`$MOC2 -v 2>&1` mocversion=`$MOC2 -v 2>&1`
mocversiongrep=`echo $mocversion | grep "Qt 5\|moc-qt5 5\|moc 5"` mocversiongrep=`echo $mocversion | grep -E "Qt 5|moc-qt5 5|moc 5"`
if test x"$mocversiongrep" != x"$mocversion"; then if test x"$mocversiongrep" != x"$mocversion"; then
AC_CHECK_TOOL(QTCHOOSER, qtchooser) AC_CHECK_TOOL(QTCHOOSER, qtchooser)
qt5tooldir=`QT_SELECT=qt5 qtchooser -print-env | grep QTTOOLDIR | cut -d '=' -f 2 | cut -d \" -f 2` qt5tooldir=`QT_SELECT=qt5 qtchooser -print-env | grep QTTOOLDIR | cut -d '=' -f 2 | cut -d \" -f 2`
mocversion=`$qt5tooldir/moc -v 2>&1` mocversion=`$qt5tooldir/moc -v 2>&1`
mocversiongrep=`echo $mocversion | grep "Qt 5\|moc 5"` mocversiongrep=`echo $mocversion | grep -E "Qt 5|moc 5"`
if test x"$mocversiongrep" != x"$mocversion"; then if test x"$mocversiongrep" != x"$mocversion"; then
# no valid moc found # no valid moc found
have_qt5_libs="no"; have_qt5_libs="no";