--- a/src/configure.ac
+++ b/src/configure.ac
@@ -58,7 +58,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