Hello,
  I have done the following optimization of AC_SEARCH_LIBS.

If you apply it to current CVS, the test 117 fails.  But that is caused
by another bug, which I have just reported to bug-autoconf.
As soon as that bug is fixed, one way or another, this patch will pass
the tests, I believe.

Do you like this patch?
Can I commit it, as soon as the mentioned bug is fixed?

Have a nice day,
        Stepan Kasal
2005-08-31  Stepan Kasal  <[EMAIL PROTECTED]>

        * lib/autoconf/libs.m4 (AC_SEARCH_LIBS): Merge the two AC_LINK_IFELSE
          calls, so that the final expansion of this macro is shorter.
          Create the conftest.$ac_ext outside the for loop, to speed the run.

Index: lib/autoconf/libs.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/libs.m4,v
retrieving revision 1.12
diff -u -r1.12 libs.m4
--- lib/autoconf/libs.m4        26 Aug 2005 19:42:25 -0000      1.12
+++ lib/autoconf/libs.m4        31 Aug 2005 14:57:54 -0000
@@ -70,16 +70,17 @@
 [AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1],
 [ac_func_search_save_LIBS=$LIBS
 ac_cv_search_$1=no
-AC_LINK_IFELSE([AC_LANG_CALL([], [$1])],
-              [ac_cv_search_$1="none required"])
-if test "$ac_cv_search_$1" = no; then
-  for ac_lib in $2; do
+AC_LANG_CONFTEST([AC_LANG_CALL([], [$1])])
+for ac_lib in '' $2; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
     LIBS="-l$ac_lib $5 $ac_func_search_save_LIBS"
-    AC_LINK_IFELSE([AC_LANG_CALL([], [$1])],
-                  [ac_cv_search_$1="-l$ac_lib"
-break])
-  done
-fi
+  fi
+  AC_LINK_IFELSE([], [ac_cv_search_$1=$ac_res; break])
+done
+rm conftest.$ac_ext
 LIBS=$ac_func_search_save_LIBS])
 AS_IF([test "$ac_cv_search_$1" != no],
   [test "$ac_cv_search_$1" = "none required" || LIBS="$ac_cv_search_$1 $LIBS"

Reply via email to