From 1b68ce035883f1ae186d82682fbbc5ea7d1834b3 Mon Sep 17 00:00:00 2001
From: John Jawed <jawed@php.net>
Date: Fri, 18 Jan 2013 20:28:05 +0000
Subject: [PATCH] Bug 64025 (patch via mattsch at gmail dot com)

git-svn-id: https://svn.php.net/repository/pecl/oauth/trunk@329234 c90b9560-bf6c-de11-be94-00142212c4b1
---
 config.m4 | 40 ++++++++++++++++++++++++++--------------
 1 file changed, 26 insertions(+), 14 deletions(-)

diff --git a/config.m4 b/config.m4
index 832c577..48e2608 100644
--- a/config.m4
+++ b/config.m4
@@ -5,27 +5,39 @@ dnl
 PHP_ARG_ENABLE(oauth, for oauth support,
 [  --enable-oauth          Include oauth support])
 
+AC_ARG_WITH([curl],
+    AS_HELP_STRING([--without-curl], [Ignore presence of cURL and disable it]))
+
 if test "$PHP_OAUTH" != "no"; then
   PHP_SUBST(OAUTH_SHARED_LIBADD)
 
   PHP_NEW_EXTENSION(oauth, oauth.c provider.c, $ext_shared)
   CFLAGS="$CFLAGS -Wall -g"
 
-  AC_MSG_CHECKING(for cURL in default path)
-  for i in /usr/local /usr; do
-    if test -r $i/include/curl/easy.h; then
-      CURL_DIR=$i
-      AC_MSG_RESULT(found in $i)
-      break
-    fi
-  done
+  AS_IF([test "x$with_curl" != "xno"],
+      [
+        AC_MSG_CHECKING(for cURL in default path)
+        have_curl=no
+        for i in /usr/local /usr; do
+          if test -r $i/include/curl/easy.h; then
+            have_curl=yes
+            CURL_DIR=$i
+            AC_MSG_RESULT(found in $i)
+            break
+          fi
+        done
+      ],
+      [have_curl=no])
 
-  if test -z "$CURL_DIR"; then
-    AC_MSG_RESULT(cURL not found, cURL support disabled)
-  else
-    PHP_ADD_LIBRARY(curl,,OAUTH_SHARED_LIBADD)
-    AC_DEFINE(OAUTH_USE_CURL, 1, [Whether cURL is present and should be used])
-  fi
+  AS_IF([test "x$have_curl" = "xyes"],
+      [
+        PHP_ADD_LIBRARY(curl,,OAUTH_SHARED_LIBADD)
+        AC_DEFINE(OAUTH_USE_CURL, 1, [Whether cURL is present and should be used])
+      ],
+      [AS_IF([test "x$with_curl" = "xyes"],
+             [AC_MSG_ERROR([cURL requested but not found])
+      ])
+  ])
 
   PHP_ADD_EXTENSION_DEP(oauth, hash)
 fi
-- 
2.1.4

