From 4588c9c6463d8958d8305caafa58ea5c263fd352 Mon Sep 17 00:00:00 2001
From: Gilles Dartiguelongue <eva@gentoo.org>
Date: Tue, 16 Jan 2018 09:07:38 +0100
Subject: [PATCH] Fix libcloudproviders check

Use autotools managed variables and make use of pkgconfig macros.
---
 configure.ac | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/configure.ac b/configure.ac
index 24110386b4..cebe66c2e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -349,8 +349,10 @@ AC_ARG_ENABLE(mir-backend,
 
 AC_ARG_ENABLE(cloudproviders,
               [AS_HELP_STRING([--enable-cloudproviders],
-                              [enable libcloudproviders integration])],
-                              [cloudproviders_set=yes])
+                              [enable libcloudproviders integration])
+              ],
+              [],
+              [enable_cloudproviders=yes])
 
 if test -z "$backend_set"; then
   if test "$platform_win32" = yes; then
@@ -1350,17 +1352,15 @@ fi
 # Check for libcloudproviders
 
 CLOUDPROVIDER_PACKAGES=""
-if test "x$cloudproviders_set" = "xyes"; then
-  CLOUDPROVIDER_PACKAGES="cloudproviders >= cloudproviders_required_version"
-  if $PKG_CONFIG --exists $CLOUDPROVIDER_PACKAGES ; then
-    AC_DEFINE(HAVE_CLOUDPROVIDERS, [1],
-              [Define if libcloudproviders is available]
-              )
-  else
-    AC_MSG_ERROR([
-*** libcloudproviders not found.])
-  fi
-fi
+AS_IF([test "$enable_cloudproviders" = "yes"],
+      [
+          CLOUDPROVIDER_PACKAGES="cloudproviders >= cloudproviders_required_version"
+          PKG_CHECK_EXISTS(
+              [$CLOUDPROVIDER_PACKAGES],
+              [AC_DEFINE(HAVE_CLOUDPROVIDERS, [1], [Define if libcloudproviders is available])],
+              [AC_MSG_ERROR([*** libcloudproviders not found])]
+          )
+      ])
 
 CFLAGS="$saved_cflags"
 LDFLAGS="$saved_ldflags"
-- 
2.15.1

