On 03/18/2011 08:50 AM, Vincent Torri wrote: > It's not what I want. The test I want is: > > 1) checking if libbfd can be used without libintl. If yes, then setting > bfd_libs to "-lbfd" > > 2) If no, then checking if libbfd can be used with libintl. If yes, then > setting bfd_libs to "-lbfd -lintl". If not, I exit. > > I want to set bfd_libs like that (because of static linking and .pc files) Then I would suggest not using AC_CHECK_LIB, but writing lower-level functions that don't commit a value to cache that affects a later test. Looking at the source code, you might be able to get away with this alternative instead (okay, so it's not really documented, and happens to be exploiting internals of AC_SEARCH_LIBS, but if this works, it argues that we should enhance AC_SEARCH_LIBS to accept multi-library arguments and properly auto-append -l only when it is not already present): AC_SEARCH_LIBS([bfd_openr], [bfd 'bfd -lintl'], [...], [...]) After all, the body of AC_SEARCH_LIBS is doing this (after temporarily saving the original value of $LIBS): 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 ... which ends up testing no extra libraries, then -lbfd, then -lbfd -lintl, until the link succeeds, and only then writing the cache. -- Eric Blake eblake@xxxxxxxxxx +1-801-349-2682 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf