1. 21 12月, 2016 1 次提交
  2. 14 1月, 2013 2 次提交
  3. 11 1月, 2013 3 次提交
    • D
      054bbfcb
    • D
      c45fed8a
    • D
      Add some autoconf helper macros for checking for libraries · cd699ed1
      Daniel P. Berrange 提交于
      Most checks for libraries take the same format
      
        * --with-libFOO=yes|no|check|/some/path  argument
        * check for a function NNN in libFOO.so
        * check for a header file DDD/HHH.h
        * Define a WITH_FOO config.h symbol
        * Define a WITH_FOO make conditional
        * Substitute FOO_CFLAGS and FOO_LIBS make variables
        * Print CFLAGS & LIBS summary at the end
      
      Doing all this correctly is rather difficult, typically
      done by copy+paste of a previous usage. Further small
      improvements people make are not applied to all previous
      usages.
      
      Improve this by creating some helper macros to apply
      good practice. First, to perform the actual checks:
      
        LIBVIRT_CHECK_LIB([SELINUX], [selinux],
           [getfilecon], [selinux/selinux.h])
      
      This checks for 'getfilecon' in -lselinux, and the
      existence of 'selinux/selinux.h' header file. If successful
      it sets SELINUX_CFLAGS and SELINUX_LIBS. The WITH_SELINUX
      config.h macro and WITH_SELINUX make conditional are also
      defined.
      
      In some cases we need to check two variants of the same
      library
      
        LIBVIRT_CHECK_LIB_ALT([SASL], [sasl2],
                              [sasl_client_init], [sasl/sasl.h],
                              [SASL1], [sasl],
                              [sasl_client_init], [sasl/sasl.h])
      
      This checks for sasl_client_init in libsasl2, and if that
      is not found, checks sasl_client_init in libsasl. If the
      first check succeeds WITH_SASL is set, while if the second
      check succeeds *both* WITH_SASL and WITH_SASL1 are set.
      
      If the library supports pkg-config, then another variant
      is available
      
        LIBVIRT_CHECK_PKG([AVAHI], [avahi-client], [0.6.0])
      
      This checks for avahi-client >= 0.6.0 via pkg-config
      and sets WITH_AVAHI if found.
      
      Finally to print a summary of CFLAGS & LIBs found (if any):
      
        LIBVIRT_RESULT_LIB([SELINUX])
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      cd699ed1