[libvirt] [PATCH 3/4] Add a simple macro to check in which library dlopen() is, and use it.

Eric Blake eblake at redhat.com
Wed Feb 24 15:21:38 UTC 2010


According to Diego Elio Pettenò on 2/24/2010 8:04 AM:
> +dnl AFX to get a unique namespace before it is submitted somewhere
> +dnl (like autoconf-archive).
> +AC_DEFUN([AFX_LIB_DLOPEN], [

Just curious: Why the choice of AFX_, and not something like LV_ for libvirt?

> +  DLOPEN_LIBS=
> +
> +m4_pushdef([action_if_not_found],
> +           [m4_default([$2],
> +                       [AC_MSG_ERROR([Unable to find the dlopen() function])]
> +                      )
> +           ])
> +
> +  old_libs=$LIBS
> +  AC_SEARCH_LIBS([dlopen], [dl],
> +    [DLOPEN_LIBS=${LIBS#${old_libs}}

The shell expansion ${a#b} is not portable to Solaris /bin/sh.  Is that a
problem for libvirt, or are we Linux-centric enough to not care?

> +     $1], action_if_not_found)

Underquoted; if the AC_MSG_ERROR were ever changed to contain a comma,
then this would be passing an unintentional extra argument to
AC_SEARCH_LIBS.  It should work to pass [action_if_not_found] rather than
action_if_not_found, or even avoid the temporary macro altogether and
inline the m4_default directly as the argument to AC_SEARCH_LIBS.

Is this something that would be worth wrapping in an AC_CACHE_CHECK, to
avoid repeating the check if config.cache exists?

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 320 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100224/83fb5a35/attachment-0001.sig>


More information about the libvir-list mailing list