--- a/src/configure
+++ b/src/configure
@@ -2192,7 +2192,7 @@
 # libstdc++.la in the lib list
 for i in $LIBXAPIAN ; do
     case $i in
-    *libstdc++.la);;
+    *stdc++*|-lm|-lgcc_s);;
     *) tmpxaplib="$tmpxaplib $i";;
     esac
 done
@@ -2296,7 +2296,8 @@
 fi
 
 cd $QTGUI
-# We just want a .pro file: no problem with unsubstituted variables for now
+# We just want a .pro file: no problem with unsubstituted variables at
+# this point.
 test -f recoll.pro && chmod +w recoll.pro
 cp recoll.pro.in recoll.pro
 ${QMAKE} recoll.pro