From e3821bfc2ae7de238b3ffaba89d8f3cd961261e4 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Wed, 22 Dec 2004 17:03:27 +0000 Subject: [PATCH] * libcurl.m4: Be much more strict with libcurl by trying to compile and link a test program that uses the features that we need. --- m4/ChangeLog | 6 ++++++ m4/libcurl.m4 | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/m4/ChangeLog b/m4/ChangeLog index 0bf09be9f..d1cc039ba 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,9 @@ +2004-12-22 David Shaw + + * libcurl.m4: Be much more strict with libcurl by trying to + compile and link a test program that uses the features that we + need. + 2004-12-21 David Shaw * libcurl.m4: New. diff --git a/m4/libcurl.m4 b/m4/libcurl.m4 index e02455671..6d7d3b60f 100644 --- a/m4/libcurl.m4 +++ b/m4/libcurl.m4 @@ -16,7 +16,7 @@ AC_DEFUN([GNUPG_CHECK_LIBCURL], [ AC_ARG_WITH(libcurl, AC_HELP_STRING([--with-libcurl=DIR],[look for the curl library in DIR]), - [_do_libcurl=$withval],[_do_libcurl=yes]) + [_do_libcurl=$withval],[_do_libcurl=no]) if test "$_do_libcurl" != "no" ; then if test -d "$withval" ; then @@ -36,6 +36,37 @@ AC_DEFUN([GNUPG_CHECK_LIBCURL], AC_MSG_RESULT([$have_libcurl]) + AC_MSG_CHECKING([whether libcurl is modern enough]) + + _libcurl_save_cppflags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $LIBCURL_INCLUDES" + _libcurl_save_ldflags=$LDFLAGS + LDFLAGS="$LDFLAGS $LIBCURL" + + AC_LINK_IFELSE(AC_LANG_PROGRAM([#include ],[ +int x; +x=CURL_ERROR_SIZE; +curl_easy_setopt(NULL,CURLOPT_URL,NULL); +x=CURLOPT_WRITEFUNCTION; +x=CURLOPT_FILE; +/* x=CURLOPT_WRITEDATA; */ +x=CURLOPT_ERRORBUFFER; +x=CURLOPT_STDERR; +x=CURLOPT_VERBOSE; +]),,have_libcurl=no) + + CPPFLAGS=$_libcurl_save_cppflags + LDFLAGS=$_libcurl_save_ldflags + + AC_MSG_RESULT([$have_libcurl]) + + if test $have_libcurl = yes ; then + AC_DEFINE(HAVE_LIBCURL,1, + [Define to 1 if you have a fully functional curl library.]) + fi + unset _do_libcurl + unset _libcurl_save_cppflags + unset _libcurl_save_ldflags fi ])dnl