X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=m4%2Fsearch-libs.m4;h=ce9b468687a783e9eed03741e3071700b1804973;hb=7194c138e93689193b9a5ad611177be74e311c49;hp=6979ea8e52037ed3b3d6bb1e6348ca5756e7e5ae;hpb=365c522e3a5b3ae36005ab1d7f3a8bfbb0a9dee7;p=gnulib.git diff --git a/m4/search-libs.m4 b/m4/search-libs.m4 index 6979ea8e5..ce9b46868 100644 --- a/m4/search-libs.m4 +++ b/m4/search-libs.m4 @@ -1,42 +1,40 @@ -#serial 1 +#serial 4 dnl A replacement for autoconf's macro by the same name. This version dnl uses `ac_lib' rather than `i' for the loop variable, but more importantly -dnl moves the ACTION-IF-FOUND ($3) into the inner `if'-block so that it is +dnl moves the ACTION-IF-FOUND ([$]3) into the inner `if'-block so that it is dnl run only if one of the listed libraries ends up being used (and not in dnl the `none required' case. dnl I hope it's only temporary while we wait for that version to be fixed. -undefine(AC_SEARCH_LIBS) - -dnl AC_SEARCH_LIBS(FUNCTION, SEARCH-LIBS [, ACTION-IF-FOUND -dnl [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]]) -dnl Search for a library defining FUNC, if it's not already available. +undefine([AC_SEARCH_LIBS]) +# AC_SEARCH_LIBS(FUNCTION, SEARCH-LIBS, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [OTHER-LIBRARIES]) +# -------------------------------------------------------- +# Search for a library defining FUNC, if it's not already available. AC_DEFUN(AC_SEARCH_LIBS, [ - AC_PREREQ([2.13]) AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1], [ - ac_func_search_save_LIBS="$LIBS" - ac_cv_search_$1="no" - AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1="none required"]) - if test "$ac_cv_search_$1" = "no"; then + ac_func_search_save_LIBS=$LIBS + ac_cv_search_$1=no + AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1='none required']) + if test "$ac_cv_search_$1" = no; then for ac_lib in $2; do LIBS="-l$ac_lib $5 $ac_func_search_save_LIBS" - AC_TRY_LINK_FUNC([$1], - [ac_cv_search_$1="-l$ac_lib" - break]) + AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1="-l$ac_lib"; break]) done fi - LIBS="$ac_func_search_save_LIBS" + LIBS=$ac_func_search_save_LIBS ]) - if test "$ac_cv_search_$1" = "no"; then + if test "$ac_cv_search_$1" = no; then : $4 else - if test "$ac_cv_search_$1" = "none required"; then + if test "$ac_cv_search_$1" = 'none required'; then : $4 - else : + else LIBS="$ac_cv_search_$1 $LIBS" $3 fi