patch for acinclude.m4.in: Better test for "Qt without flags"

Michael Ritzert kde at ritzert.de
Mon Aug 4 13:21:09 BST 2003


Hi all,

I just found this problem with KDE's configure: I'm using debian unstable as my
build system with Qt 3.1.1 installed. In another directory (/3/KDE/qt) I have
installed qt-copy and this is what I intended to use for compiling KDE. Just
that this attempt failed with missing symbols from libqt-mt.so. I traced down
the problem to the following fact: KDE searches for Qt respecting the hints
given by the user and correctly reports that it found everything: "result:
libraries /3/KDE/qt/lib, headers /3/KDE/qt/include using -mt". Next it checks
"if Qt compiles without flags". This also works. However in my case the linker
it picked up the wrong systemwide libqt-mt.so. configure then thought
everything was alright and created the Makefile without the -L/3/KDE/qt which
explains the error I got.

To prevent this kind of error in the future I propose the attached patch to
have configure check whether the correct libqt-mt.so was picked up. This patch
is mainly intended as food for thought as I have no idea how portable the shell
code is. I checked that it work correctly for bash on GNU/Linux in both
possible cases (wrong/correct lib linked in).

Michael

PS: side note: IMHO KDE's acinclude.m4.in should follow the rest of configure's checks and use conftest$ac_exeext where applicable. I haven't checked but I suppose configuring on Windows (and maybe other systems) won't work without it because the system doesn't execute the file without .exe. Not that I expect this to become a major problem in the near future ;-), but one may still think ahead when one stumbles across these things.


Index: acinclude.m4.in
===================================================================
RCS file: /home/kde/kde-common/admin/acinclude.m4.in,v
retrieving revision 2.381
diff -u -3 -p -r2.381 acinclude.m4.in
--- acinclude.m4.in	31 Jul 2003 18:47:19 -0000	2.381
+++ acinclude.m4.in	4 Aug 2003 12:17:57 -0000
@@ -1193,11 +1193,14 @@ export LIBRARY_PATH
 
 KDE_PRINT_QT_PROGRAM
 
-if AC_TRY_EVAL(ac_link) && test -s conftest; then
+# grep will treat .* not quite the way the shell does, but still no
+# harm is done. one might consider running $LIBQT_GLOB through sed
+# ("." => "\.", "*" => ".*") to have grep behave 100% correctly.
+if AC_TRY_EVAL(ac_link) && ldd conftest 2> /dev/null | grep -q "$ac_qt_libraries/$LIBQT_GLOB"; then
   kde_cv_qt_direct="yes"
 else
   kde_cv_qt_direct="no"
-  echo "configure: failed program was:" >&AC_FD_CC
+  echo "configure: no or wrong Qt library linked in. failed program was:" >&AC_FD_CC
   cat conftest.$ac_ext >&AC_FD_CC
 fi
 




More information about the kde-core-devel mailing list