Re: [PATCH 3/3] Use PKG_CHECK_MODULES to detect libxml2

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

 



On Thu, 2020-07-02 at 23:43 +1000, Hugh McMaster wrote:
> This patch removes the use of xml2-config and instead uses
> PKG_CHECK_MODULES to detect the libxml2 library.
> 
> As noted in [1], Debian is removing xml2-config and is progressively
> updating its repository to use pkg-config and its helper macros.
> 
> This patch builds on Andreas Hasenack's initial patch in [1] and
> addresses feedback from Ian Kent [2].
> 
> [1] https://www.spinics.net/lists/autofs/msg02204.html
> [2] https://www.spinics.net/lists/autofs/msg02206.html
> 
> 
> --- a/Makefile.conf.in
> +++ b/Makefile.conf.in
> @@ -36,7 +36,7 @@ SSSD = @HAVE_SSS_AUTOFS@
> 
>  # SASL support: yes (1) no (0)
>  XML_LIBS = @XML_LIBS@
> -XML_FLAGS = @XML_FLAGS@
> +XML_CFLAGS = @XML_CFLAGS@
>  SASL = @HAVE_SASL@
>  LIBSASL= @LIBSASL@
>  SASL_FLAGS = @SASL_FLAGS@
> diff --git a/aclocal.m4 b/aclocal.m4
> index ec362bb..33561aa 100644
> --- a/aclocal.m4
> +++ b/aclocal.m4
> @@ -272,38 +272,6 @@ else
>  fi])
>  ])
> 
> -dnl ----------------------------------------------------------------
> ----------
> -dnl AF_CHECK_LIBXML
> -dnl
> -dnl Check for lib xml
> -dnl ----------------------------------------------------------------
> ----------
> -AC_DEFUN([AF_CHECK_LIBXML],
> -[AC_PATH_PROGS(XML_CONFIG, xml2-config, no)
> -AC_MSG_CHECKING(for libxml2)
> -if test "$XML_CONFIG" = "no"
> -then
> -  AC_MSG_RESULT(no)
> -  HAVE_LIBXML=0
> -else
> -  AC_MSG_RESULT(yes)
> -  HAVE_LIBXML=1
> -  XML_LIBS=`$XML_CONFIG --libs`
> -  XML_FLAGS=`$XML_CONFIG --cflags`
> -  XML_VER=`$XML_CONFIG --version`
> -  XML_MAJOR=`echo $XML_VER|cut -d\. -f1`
> -  if test $XML_MAJOR -le 99
> -  then
> -    XML_MINOR=`echo $XML_VER|cut -d\. -f2`
> -    if test $XML_MINOR -le 99
> -    then
> -      XML_REV=`echo $XML_VER|cut -d\. -f3`
> -      if test $XML_REV -le 99; then
> -        AC_DEFINE(LIBXML2_WORKAROUND,1, [Use libxml2 tsd usage
> workaround])
> -      fi
> -    fi
> -  fi
> -fi])
> -
>  dnl ----------------------------------------------------------------
> ----------
>  dnl AF_CHECK_KRB5
>  dnl
> diff --git a/configure.in b/configure.in
> index 525f79b..9e211c9 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -210,7 +210,11 @@ fi
>  AC_SUBST(ENABLE_FEDFS)
> 
>  # LDAP SASL auth needs libxml and Kerberos
> -AF_CHECK_LIBXML()
> +PKG_CHECK_MODULES([XML], [libxml-2.0], [

I think perhaps I will need to change [libxml-2.0] to
[libxml-2.0 libxml2] ... the Fedora package name.

It's not clear from the PKG_CHECK_MODULES man page if that's the
correct way to specify this and if a space separator is meant to be
used between package names.

Ian

> +  HAVE_LIBXML=1
> +  AC_DEFINE(LIBXML2_WORKAROUND, 1, [Use libxml2 tsd usage
> workaround])
> +], [HAVE_LIBXML=0])
> +
>  AF_CHECK_KRB5()
> 
>  AC_SEARCH_LIBS([versionsort],[])
> @@ -344,7 +348,7 @@ then
>      fi
>  fi
> 
> -AC_SUBST(XML_FLAGS)
> +AC_SUBST(XML_CFLAGS)
>  AC_SUBST(XML_LIBS)
>  AC_SUBST(SASL_FLAGS)
>  AC_SUBST(HAVE_SASL)
> diff --git a/daemon/Makefile b/daemon/Makefile
> index a7ce430..d8e2d6a 100644
> --- a/daemon/Makefile
> +++ b/daemon/Makefile
> @@ -28,7 +28,7 @@ ifeq ($(SYSTEMD), 1)
>  endif
> 
>  ifeq ($(LDAP), 1)
> -    CFLAGS += $(XML_FLAGS)
> +    CFLAGS += $(XML_CFLAGS)
>      LIBS += $(XML_LIBS)
>  endif
> 
> diff --git a/lib/Makefile b/lib/Makefile
> index 518b483..b20b95b 100644
> --- a/lib/Makefile
> +++ b/lib/Makefile
> @@ -25,7 +25,7 @@ CFLAGS += -DAUTOFS_MAP_DIR=\"$(autofsmapdir)\"
>  CFLAGS += -DAUTOFS_CONF_DIR=\"$(autofsconfdir)\"
> 
>  ifeq ($(LDAP), 1)
> -  CFLAGS += $(XML_FLAGS) $(XML_LIBS)
> +  CFLAGS += $(XML_CFLAGS) $(XML_LIBS)
>  endif
> 
>  .PHONY: all install clean
> diff --git a/modules/Makefile b/modules/Makefile
> index 0447559..989c6c1 100644
> --- a/modules/Makefile
> +++ b/modules/Makefile
> @@ -47,7 +47,7 @@ endif
>  ifeq ($(LDAP), 1)
>    SRCS += lookup_ldap.c
>    MODS += lookup_ldap.so
> -  LDAP_FLAGS += $(XML_FLAGS) -DLDAP_THREAD_SAFE
> +  LDAP_FLAGS += $(XML_CFLAGS) -DLDAP_THREAD_SAFE
>    LIBLDAP += $(XML_LIBS)
>    ifeq ($(SASL), 1)
>      SASL_OBJ = cyrus-sasl.o cyrus-sasl-extern.o




[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux