This patch makes the pkg-config based detection of Qt4 honor --with-qt4-dir: * add $qt4_cv_dir/lib to pkg-config search path * add $qt4_cv_dir/bin to moc search path (and use AC_PATH_PROGS in order to get full path to moc).
This changes make configuration easier for the poor souls who already had to wait for >1h to get qt4 to compile. JMarc
Index: config/qt4.m4 =================================================================== --- config/qt4.m4 (revision 14809) +++ config/qt4.m4 (working copy) @@ -142,6 +142,37 @@ EOF dnl start here AC_DEFUN([QT4_DO_IT_ALL], [ + dnl this variable is precious + AC_ARG_VAR(QT4DIR, [the place where the Qt 4 files are, e.g. /usr/lib/qt4]) + + dnl Please leave this alone. I use this file in + dnl oprofile. + FATAL=0 + + AC_ARG_WITH(qt4-dir, [ --with-qt4-dir where the root of Qt 4 is installed ], + [ qt4_cv_dir=`eval echo "$withval"/` ]) + + AC_ARG_WITH(qt4-includes, [ --with-qt4-includes where the Qt 4 includes are. ], + [ qt4_cv_includes=`eval echo "$withval"` ]) + + AC_ARG_WITH(qt4-libraries, [ --with-qt4-libraries where the Qt 4 library is installed.], + [ qt4_cv_libraries=`eval echo "$withval"` ]) + + dnl pay attention to $QT4DIR unless overridden + if test -z "$qt4_cv_dir"; then + qt4_cv_dir=$QT4DIR + fi + + 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 + fi + if test -z "$qt4_cv_libraries"; then + qt4_cv_libraries=$qt4_cv_dir/lib + fi + fi + dnl Check if it possible to do a pgk-config PKG_PROG_PKG_CONFIG if test -n "$PKG_CONFIG" ; then @@ -153,7 +184,12 @@ AC_DEFUN([QT4_DO_IT_ALL], AC_DEFUN([QT4_DO_PKG_CONFIG], [ - PKG_CHECK_MODULES(QT4_FRONTEND, QtCore QtGui) + save_PKG_CONFIG_PATH=$PKG_CONFIG_PATH + if test -n "$qt4_cv_dir" ; then + PKG_CONFIG_PATH=$qt4_cv_dir/lib:$PKG_CONFIG_PATH + export PKG_CONFIG_PATH + fi + PKG_CHECK_MODULES(QT4_FRONTEND, QtCore QtGui) if test "$pkg_failed" == "no" ; then QT4_INCLUDES=$QT4_FRONTEND_CFLAGS dnl QT4_LDFLAGS=$QT4_FRONTEND_LIBS @@ -169,46 +205,16 @@ AC_DEFUN([QT4_DO_PKG_CONFIG], *mingw*) QT4_CPPFLAGS="-DQT_DLL $QT4_CPPFLAGS";; esac AC_SUBST(QT4_CPPFLAGS) - AC_CHECK_PROGS(MOC4, moc-qt4 moc) - AC_CHECK_PROGS(UIC4, uic-qt4 uic) + AC_PATH_PROGS(MOC4, [moc-qt4 moc],[],$qt4_cv_dir/bin:$PATH) + AC_PATH_PROGS(UIC4, [uic-qt4 uic],[],$qt4_cv_dir/bin:$PATH) else QT4_DO_MANUAL_CONFIG fi + PKG_CONFIG_PATH=$save_PKG_CONFIG_PATH ]) AC_DEFUN([QT4_DO_MANUAL_CONFIG], [ - dnl this variable is precious - AC_ARG_VAR(QT4DIR, [the place where the Qt 4 files are, e.g. /usr/lib/qt4]) - - dnl Please leave this alone. I use this file in - dnl oprofile. - FATAL=0 - - AC_ARG_WITH(qt4-dir, [ --with-qt4-dir where the root of Qt 4 is installed ], - [ qt4_cv_dir=`eval echo "$withval"/` ]) - - AC_ARG_WITH(qt4-includes, [ --with-qt4-includes where the Qt 4 includes are. ], - [ qt4_cv_includes=`eval echo "$withval"` ]) - - AC_ARG_WITH(qt4-libraries, [ --with-qt4-libraries where the Qt 4 library is installed.], - [ qt4_cv_libraries=`eval echo "$withval"` ]) - - dnl pay attention to $QT4DIR unless overridden - if test -z "$qt4_cv_dir"; then - qt4_cv_dir=$QT4DIR - fi - - 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 - fi - if test -z "$qt4_cv_libraries"; then - qt4_cv_libraries=$qt4_cv_dir/lib - fi - fi - dnl flags for compilation QT4_INCLUDES= QT4_LDFLAGS=