]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Fix AC_SEARCH_LIBS.
authorStepan Kasal <kasal@ucw.cz>
Tue, 6 Sep 2005 15:34:06 +0000 (15:34 +0000)
committerStepan Kasal <kasal@ucw.cz>
Tue, 6 Sep 2005 15:34:06 +0000 (15:34 +0000)
lib/autoconf/libs.m4
tests/semantics.at

index f0f3fc23fbf179b8f2f39245be6b99ceb8dbdd5c..0498f273becfe9c756f2f995631cf4c4df46c0fb 100644 (file)
 # --------------------------------------------------------
 # Search for a library defining FUNC, if it's not already available.
 AC_DEFUN([AC_SEARCH_LIBS],
-[AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1],
+[AS_VAR_PUSHDEF([ac_Search], [ac_cv_search_$1])dnl
+AC_CACHE_CHECK([for library containing $1], ac_Search,
 [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([], [AS_VAR_SET(ac_Search, [$ac_res])])
+  AS_VAR_SET_IF(ac_Search, [break])dnl
+done
+AS_VAR_SET_IF(ac_Search, , [AS_VAR_SET(ac_Search, [no])])dnl
+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"
+ac_res=AS_VAR_GET(ac_Search)
+AS_IF([test "$ac_res" != no],
+  [test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
   $3],
       [$4])dnl
+AS_VAR_POPDEF([ac_Search])dnl
 ])
 
 
index 2477476193f28610ca7235fd47df9c9122867164..3d69b7f9ba22512bc98c06dfb2c4a225fea37c61 100644 (file)
@@ -83,7 +83,13 @@ AC_SEARCH_LIBS(cos, oser m ust,,
 case "$ac_cv_search_cos" in
   -loser|-lust) AC_MSG_ERROR([jeez, $ac_cv_search_cos must be a cool library!]) ;;
 esac
+])
+
 
+# AC_SEARCH_LIBS (none needed)
+# ----------------------------
+AT_CHECK_MACRO([AC_SEARCH_LIBS (none needed)],
+[
 AC_SEARCH_LIBS(printf, oser c ust,,
             [AC_MSG_ERROR([cannot find `printf'])])
 
@@ -91,7 +97,6 @@ case "$ac_cv_search_printf" in
   -loser|-lust) AC_MSG_ERROR([jeez, $ac_cv_search_printf must be a cool library!]) ;;
   -lc) AC_MSG_ERROR([huh, you need to give -lc?])
 esac
-
 ])