Am Donnerstag, 1. Juni 2006 12:10 schrieb Jean-Marc Lasgouttes:
> >>>>> "Georg" == Georg Baum <[EMAIL PROTECTED]> writes:
> 
> Georg> I think it would be possible, but not easier than tweaking
> Georg> qt.m4. 
> 
> Getting rid of AC_PATH_EXTRA (just keep it for xforms) would be nice...

That is not used in qt.m4. Could you explain what you mean?

> Georg> And I can understand Lars' desire to use configure without
> Georg> flags, but I don't think we need to do that for all possible
> Georg> configurations, only the mainstream ones.
> 
> Agreed. We should not hardcode this stuff.

Here comes the next try. Changes:
- Search also moc4 and uic4
- Check version of moc and uic
- use pkg-config if available and no qt dir was given

Lars, does it work for you? Can it go in?


Georg
Index: config/qt.m4
===================================================================
--- config/qt.m4	(Revision 13983)
+++ config/qt.m4	(Arbeitskopie)
@@ -328,7 +328,15 @@ AC_DEFUN([QT4_FIND_PATH],
 dnl Find the uic compiler on the path or in qt_cv_dir
 AC_DEFUN([QT_FIND_UIC4],
 [
-	QT4_FIND_PATH(uic, ac_uic4, $qt4_cv_dir/bin)
+	QT4_FIND_PATH(uic4, ac_uic4, $qt4_cv_dir/bin)
+	if test -z "$ac_uic4"; then
+		QT4_FIND_PATH(uic, ac_uic4, $qt4_cv_dir/bin)
+	fi
+
+	dnl test the version
+	if test -n "$ac_uic4" && ! "$ac_uic4" -version 2>&1 | grep "Qt user interface compiler 4" >/dev/null; then
+		ac_uic4=""
+	fi
 
 	if test -z "$ac_uic4" -a "$FATAL" = 1; then
 		AC_MSG_ERROR([uic 4 binary not found in \$PATH or $qt4_cv_dir/bin !])
@@ -338,7 +346,15 @@ AC_DEFUN([QT_FIND_UIC4],
 dnl Find the right moc in path/qt_cv_dir
 AC_DEFUN([QT_FIND_MOC4],
 [
-	QT4_FIND_PATH(moc, ac_moc4, $qt4_cv_dir/bin)
+	QT4_FIND_PATH(moc4, ac_moc4, $qt4_cv_dir/bin)
+	if test -z "$ac_moc4"; then
+		QT4_FIND_PATH(moc, ac_moc4, $qt4_cv_dir/bin)
+	fi
+
+	dnl test the version
+	if test -n "$ac_moc4" && ! "$ac_moc4" -v 2>&1 | grep "Qt 4" >/dev/null; then
+		ac_moc4=""
+	fi
 
 	if test -z "$ac_moc4"  -a "$FATAL" = 1; then
 		AC_MSG_ERROR([moc 4 binary not found in \$PATH or $qt4_cv_dir/bin !])
@@ -449,16 +465,26 @@ AC_DEFUN([QT4_DO_IT_ALL],
 	dnl derive inc/lib if needed
 	if test -n "$qt4_cv_dir"; then
 		if test -z "$qt4_cv_includes"; then
-			qt4_cv_includes=$qt4_cv_dir/include
+			qt4_cv_includes="$qt4_cv_dir/include"
 		fi
 		if test -z "$qt4_cv_libraries"; then
-			qt4_cv_libraries=$qt4_cv_dir/lib
+			qt4_cv_libraries="$qt4_cv_dir/lib"
 		fi
 	fi
 
 	dnl flags for compilation
 	QT4_INCLUDES=
 	QT4_LDFLAGS=
+	dnl try pkg-config if we don't know the qt dir
+	if test -z "$qt4_cv_includes" -o -z "$qt4_cv_libraries"; then
+		if test -z "$PKG_CONFIG"; then
+			AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+		fi
+		if test -n "$PKG_CONFIG"; then
+			PKG_CHECK_MODULES(QT4, QtCore QtGui)
+			QT4_INCLUDES="$QT4_CFLAGS"
+		fi
+	fi
 	if test -n "$qt4_cv_includes"; then
 		QT4_INCLUDES="-I$qt4_cv_includes"
 		for i in Qt QtCore QtGui; do
@@ -480,12 +506,12 @@ AC_DEFUN([QT4_DO_IT_ALL],
 
 	if test -z "$MOC4"; then
 		QT_FIND_MOC4
-		MOC4=$ac_moc4
+		MOC4="$ac_moc4"
 	fi
 	AC_SUBST(MOC4)
 	if test -z "$UIC4"; then
 		QT_FIND_UIC4
-		UIC4=$ac_uic4
+		UIC4="$ac_uic4"
 	fi
 	AC_SUBST(UIC4)
 

Reply via email to