autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about ac_lib and ac_res


From: Eric Blake
Subject: Re: Question about ac_lib and ac_res
Date: Wed, 17 Oct 2012 14:38:53 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121009 Thunderbird/16.0

On 10/17/2012 02:15 PM, Sergio Belkin wrote:
> Hi folks,
> 
> I've found in AC_SEARCH_LIBS functions ac_lib and ac_res what do they do?

They aren't documented in the manual, so you can assume that they are
used internally for implementing the actual search, and that you can
(and should!) safely ignore them.  If you're still more curious than
that, then read the source code: ac_lib is the shell variable that loops
over the 2nd argument passed to the AC_SEARCH_LIBS macro, and ac_res is
the shell variable that tracks which -l library, if any, was needed to
make the link succeed.

AC_DEFUN([AC_SEARCH_LIBS],
[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_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"
  fi
  AC_LINK_IFELSE([], [AS_VAR_SET([ac_Search], [$ac_res])])
  AS_VAR_SET_IF([ac_Search], [break])
done

-- 
Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]