From: Oliver Kurth Date: Tue, 19 Jun 2018 18:07:46 +0000 (-0700) Subject: open-vm-tools: use AC_CHECK_TOOL for pkg-config X-Git-Tag: stable-10.3.0~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cecbaf6b16f5fd1ecbfe4419310352353b047ba2;p=thirdparty%2Fopen-vm-tools.git open-vm-tools: use AC_CHECK_TOOL for pkg-config AC_CHECK_TOOL honors the --host setting to configure, and searches for tools with the cross compile prefix thus allowing for cross compile specific tools. Fixes issue #26 in github. --- diff --git a/open-vm-tools/configure.ac b/open-vm-tools/configure.ac index 72dc4ff1b..233322a24 100644 --- a/open-vm-tools/configure.ac +++ b/open-vm-tools/configure.ac @@ -351,11 +351,10 @@ if test "$ac_cv_prog_AR" = false; then fi # We use pkg-config to set up the cflags and libs for gtk. -AC_CHECK_PROG( - [HAVE_PKG_CONFIG], +AC_CHECK_TOOL( + [PKG_CONFIG], [pkg-config], - [yes], - [no]) + [not_found]) if test "$GCC" != "yes"; then AC_MSG_ERROR([Only GCC is currently supported. Please put gcc in the path.]) @@ -1437,8 +1436,8 @@ if test "$os" = "linux"; then [UDEVRULESDIR="$withval"], [ UDEVRULESDIR="/lib/udev/rules.d" - if test $HAVE_PKG_CONFIG = "yes"; then - udevdir=$(pkg-config udev --variable=udevdir) + if test "$PKG_CONFIG" != "not_found"; then + udevdir=$($PKG_CONFIG udev --variable=udevdir) if test "x$udevdir" != "x"; then UDEVRULESDIR="$udevdir/rules.d" fi diff --git a/open-vm-tools/m4/vmtools.m4 b/open-vm-tools/m4/vmtools.m4 index 1692e6ec2..efecdc806 100644 --- a/open-vm-tools/m4/vmtools.m4 +++ b/open-vm-tools/m4/vmtools.m4 @@ -1,5 +1,5 @@ ################################################################################ -### Copyright (C) 2009-2016 VMware, Inc. All rights reserved. +### Copyright (C) 2009-2018 VMware, Inc. All rights reserved. ### ### VMware-specific macros for use with autoconf. ### @@ -108,15 +108,15 @@ AC_DEFUN([AC_VMW_CHECK_LIB],[ fi # If that didn't work, try with pkg-config. - if test $ac_vmw_have_lib -eq 0 && test "$HAVE_PKG_CONFIG" = "yes" && test -n "$3"; then + if test $ac_vmw_have_lib -eq 0 && test "$PKG_CONFIG" != "not_found" && test -n "$3"; then if test -n "$5"; then AC_MSG_CHECKING([for $3 >= $5 (via pkg-config)]) - if pkg-config --exists '$3 >= $5'; then + if $PKG_CONFIG --exists '$3 >= $5'; then ac_vmw_have_lib=1 fi else AC_MSG_CHECKING([for $3 (via pkg-config)]) - if pkg-config --exists '$3'; then + if $PKG_CONFIG --exists '$3'; then ac_vmw_have_lib=1 fi fi @@ -124,9 +124,9 @@ AC_DEFUN([AC_VMW_CHECK_LIB],[ if test $ac_vmw_have_lib -eq 1; then # Sometimes pkg-config might fail; for example, "pkg-config gtk+-2.0 --cflags" # fails on OpenSolaris B71. So be pessimistic. - ac_vmw_cppflags="`pkg-config --cflags $3`" + ac_vmw_cppflags="`$PKG_CONFIG --cflags $3`" ac_vmw_ret1=$? - ac_vmw_libs="`pkg-config --libs $3`" + ac_vmw_libs="`$PKG_CONFIG --libs $3`" ac_vmw_ret2=$? if test $ac_vmw_ret1 -eq 0 && test $ac_vmw_ret2 -eq 0; then AC_MSG_RESULT([yes]) @@ -141,16 +141,16 @@ AC_DEFUN([AC_VMW_CHECK_LIB],[ fi # If we still haven't found the lib, try with the library's custom "config" script. - # Before checking, flush the AC_PATH_PROG cached variable. + # Before checking, flush the AC_PATH_TOOL cached variable. unset ac_cv_path_ac_vmw_lib_cfg unset ac_vmw_lib_cfg if test $ac_vmw_have_lib -eq 0 && test -n "$4"; then - AC_PATH_PROG([ac_vmw_lib_cfg], [$4], [no]) - if test "$ac_vmw_lib_cfg" != "no"; then + AC_PATH_TOOL([ac_vmw_lib_cfg], [$4], [not_found]) + if test "$ac_vmw_lib_cfg" != "not_found"; then # XXX: icu-config does not follow the "--cflags" and "--libs" convention, # so single it out here to avoid having to replicate all the rest of the # logic elsewhere. - if test `basename "$ac_vmw_lib_cfg"` = "icu-config"; then + if test "$4" = "icu-config"; then $2_CPPFLAGS="`$ac_vmw_lib_cfg --cppflags`" $2_LIBS="`$ac_vmw_lib_cfg --ldflags`" else