From 5af8d68211007c9a91dcce0f489c44283c48055a Mon Sep 17 00:00:00 2001 From: David Shaw Date: Tue, 16 Jan 2007 06:10:31 +0000 Subject: [PATCH] * libcurl.m4: Check for curl_easy_escape() and curl_easy_unescape(). Replace with curl_escape() and curl_unescape() if libcurl doesn't have it. --- m4/ChangeLog | 6 ++++++ m4/libcurl.m4 | 36 +++++++++++++++++++++++++++++------- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/m4/ChangeLog b/m4/ChangeLog index 7dbe08fac..471b0b552 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,9 @@ +2007-01-16 David Shaw + + * libcurl.m4: Check for curl_easy_escape() and + curl_easy_unescape(). Replace with curl_escape() and + curl_unescape() if libcurl doesn't have it. + 2006-10-02 Werner Koch * autobuild.m4: New. diff --git a/m4/libcurl.m4 b/m4/libcurl.m4 index a9bfa2e23..b43cd9005 100644 --- a/m4/libcurl.m4 +++ b/m4/libcurl.m4 @@ -1,7 +1,7 @@ # LIBCURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION], # [ACTION-IF-YES], [ACTION-IF-NO]) # ---------------------------------------------------------- -# David Shaw May-09-2006 +# David Shaw Jan-16-2007 # # Checks for libcurl. DEFAULT-ACTION is the string yes or no to # specify whether to default to --with-libcurl or --without-libcurl. @@ -162,17 +162,39 @@ x=CURLOPT_VERBOSE; if test $libcurl_cv_lib_curl_usable = yes ; then - # Does curl_free() exist in this version of libcurl? - # If not, fake it with free() - _libcurl_save_cppflags=$CPPFLAGS CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS" _libcurl_save_libs=$LIBS LIBS="$LIBS $LIBCURL" - AC_CHECK_FUNC(curl_free,, - AC_DEFINE(curl_free,free, - [Define curl_free() as free() if our version of curl lacks curl_free.])) + # Check for some libcurl functions that aren't in all + # versions. + + AC_CHECK_FUNCS([curl_free curl_easy_escape curl_easy_unescape]) + + AH_BOTTOM([ +#ifdef HAVE_LIBCURL + +/* Define curl_free() via free() if our version of curl lacks + curl_free() */ +#if !defined(curl_free) && !defined(HAVE_CURL_FREE) +#define curl_free(a) free((a)) +#endif + +/* Define curl_easy_escape() via curl_escape() if our version of curl + lacks curl_easy_escape() */ +#if !defined(curl_easy_escape) && !defined(HAVE_CURL_EASY_ESCAPE) +#define curl_easy_escape(a,b,c) curl_escape((b),(c)) +#endif + +/* Define curl_easy_unescape() via curl_unescape() if our version of + curl lacks curl_easy_unescape() */ +#if !defined(curl_easy_unescape) && !defined(HAVE_CURL_EASY_UNESCAPE) +#define curl_easy_unescape(a,b,c) curl_unescape((b),(c)) +#endif + +#endif /* HAVE_LIBCURL */ +]) CPPFLAGS=$_libcurl_save_cppflags LIBS=$_libcurl_save_libs