mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-22 14:57:02 +01:00
* libcurl.m4: Rewrite this to use the new --protocols flag I gave to the
libcurl people. * Makefile.am: Add readline.m4 and libcurl.m4.
This commit is contained in:
parent
9756b0fc68
commit
957ed452ac
@ -1,3 +1,10 @@
|
||||
2004-12-24 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* libcurl.m4: Rewrite this to use the new --protocols flag I gave
|
||||
to the libcurl people.
|
||||
|
||||
* Makefile.am: Add readline.m4 and libcurl.m4.
|
||||
|
||||
2004-12-23 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* libcurl.m4: OSX has a problem with their curl-config script.
|
||||
|
@ -1 +1 @@
|
||||
EXTRA_DIST = intmax.m4 longdouble.m4 longlong.m4 printf-posix.m4 signed.m4 size_max.m4 wchar_t.m4 wint_t.m4 xsize.m4 codeset.m4 gettext.m4 glibc21.m4 iconv.m4 intdiv0.m4 inttypes.m4 inttypes_h.m4 inttypes-pri.m4 isc-posix.m4 lcmessage.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 nls.m4 po.m4 progtest.m4 stdint_h.m4 uintmax_t.m4 ulonglong.m4
|
||||
EXTRA_DIST = intmax.m4 longdouble.m4 longlong.m4 printf-posix.m4 signed.m4 size_max.m4 wchar_t.m4 wint_t.m4 xsize.m4 codeset.m4 gettext.m4 glibc21.m4 iconv.m4 intdiv0.m4 inttypes.m4 inttypes_h.m4 inttypes-pri.m4 isc-posix.m4 lcmessage.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 nls.m4 po.m4 progtest.m4 stdint_h.m4 uintmax_t.m4 ulonglong.m4 readline.m4 libcurl.m4
|
||||
|
226
m4/libcurl.m4
226
m4/libcurl.m4
@ -1,93 +1,197 @@
|
||||
dnl Check for libcurl and dependencies
|
||||
dnl Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
dnl
|
||||
dnl This file is free software, distributed under the terms of the GNU
|
||||
dnl General Public License. As a special exception to the GNU General
|
||||
dnl Public License, this file may be distributed as part of a program
|
||||
dnl that contains a configuration script generated by Autoconf, under
|
||||
dnl the same distribution terms as the rest of that program.
|
||||
dnl
|
||||
dnl Defines HAVE_LIBCURL to 1 if a working curl setup is found, and sets
|
||||
dnl @LIBCURL@ and @LIBCURL_INCLUDES@ to the necessary values.
|
||||
dnl $have_libcurl is set to yes or no so other things in configure can
|
||||
dnl make use of it.
|
||||
# LIBCURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION],
|
||||
# [ACTION-IF-YES], [ACTION-IF-NO])
|
||||
# ----------------------------------------------------------
|
||||
# David Shaw <dshaw@jabberwocky.com> Dec-24-2004
|
||||
#
|
||||
# Checks for libcurl. DEFAULT-ACTION is yes or no whether to default
|
||||
# to --with-libcurl or --without-libcurl. If not supplied,
|
||||
# DEFAULT-ACTION is yes. MINIMUM-VERSION is the minimum version of
|
||||
# libcurl to accept. If not supplied, any version is accepted.
|
||||
# ACTION-IF-YES is a list of shell commands to run if libcurl was
|
||||
# successfully found and passed the various tests. ACTION-IF-NO is a
|
||||
# list of shell commands that are run otherwise. Note that using
|
||||
# --without-libcurl does run ACTION-IF-NO.
|
||||
#
|
||||
# This macro defines HAVE_LIBCURL if a working libcurl setup is found,
|
||||
# and sets @LIBCURL@ and @LIBCURL_INCLUDES@ to the necessary values.
|
||||
# Other useful defines are LIBCURL_FEATURE_xxx where xxx are the
|
||||
# various features supported by libcurl, and LIBCURL_PROTOCOL_yyy
|
||||
# where yyy are the various protocols supported by libcurl. Both xxx
|
||||
# and yyy are capitalized. See the list of AH_TEMPLATEs at the top of
|
||||
# the macro for the complete list of possible defines. Shell
|
||||
# variables $libcurl_feature_xxx and $libcurl_protocol_yyy are also
|
||||
# defined to 'yes' for those features and protocols that were found.
|
||||
# Note that xxx and yyy keep the same capitalization as in the
|
||||
# curl-config list (i.e. it's "HTTP" and not "http").
|
||||
|
||||
AC_DEFUN([GNUPG_CHECK_LIBCURL],
|
||||
AC_DEFUN([LIBCURL_CHECK_CONFIG],
|
||||
[
|
||||
AH_TEMPLATE([LIBCURL_FEATURE_SSL],[Defined if libcurl supports SSL])
|
||||
AH_TEMPLATE([LIBCURL_FEATURE_KRB4],[Defined if libcurl supports KRB4])
|
||||
AH_TEMPLATE([LIBCURL_FEATURE_IPV6],[Defined if libcurl supports IPv6])
|
||||
AH_TEMPLATE([LIBCURL_FEATURE_LIBZ],[Defined if libcurl supports libz])
|
||||
AH_TEMPLATE([LIBCURL_FEATURE_ASYNCHDNS],[Defined if libcurl supports AsynchDNS])
|
||||
|
||||
AH_TEMPLATE([LIBCURL_PROTOCOL_HTTP],[Defined if libcurl supports HTTP])
|
||||
AH_TEMPLATE([LIBCURL_PROTOCOL_HTTPS],[Defined if libcurl supports HTTPS])
|
||||
AH_TEMPLATE([LIBCURL_PROTOCOL_FTP],[Defined if libcurl supports FTP])
|
||||
AH_TEMPLATE([LIBCURL_PROTOCOL_FTPS],[Defined if libcurl supports FTPS])
|
||||
AH_TEMPLATE([LIBCURL_PROTOCOL_GOPHER],[Defined if libcurl supports GOPHER])
|
||||
AH_TEMPLATE([LIBCURL_PROTOCOL_FILE],[Defined if libcurl supports FILE])
|
||||
AH_TEMPLATE([LIBCURL_PROTOCOL_TELNET],[Defined if libcurl supports TELNET])
|
||||
AH_TEMPLATE([LIBCURL_PROTOCOL_LDAP],[Defined if libcurl supports LDAP])
|
||||
AH_TEMPLATE([LIBCURL_PROTOCOL_DICT],[Defined if libcurl supports DICT])
|
||||
|
||||
AC_ARG_WITH(libcurl,
|
||||
AC_HELP_STRING([--with-libcurl=DIR],[look for the curl library in DIR]),
|
||||
[_do_libcurl=$withval],[_do_libcurl=no])
|
||||
[_libcurl_with=$withval],[_libcurl_with=ifelse([$1],,[yes],[$1])])
|
||||
|
||||
if test "$_do_libcurl" != "no" ; then
|
||||
if test -d "$withval" ; then
|
||||
if test "$_libcurl_with" != "no" ; then
|
||||
|
||||
AC_PROG_AWK
|
||||
|
||||
_libcurl_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[[1]]+256*A[[2]]+A[[3]]; print X;}'"
|
||||
|
||||
_libcurl_try_link=yes
|
||||
|
||||
if test -d "$_libcurl_with" ; then
|
||||
CPPFLAGS="${CPPFLAGS} -I$withval/include"
|
||||
LDFLAGS="${LDFLAGS} -L$withval/lib"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for curl-config])
|
||||
AC_PATH_PROG([_libcurl_config],[curl-config])
|
||||
|
||||
if eval curl-config --version 2>/dev/null >/dev/null; then
|
||||
if test x"$LIBCURL_INCLUDES" = "x" ; then
|
||||
LIBCURL_INCLUDES=`curl-config --cflags`
|
||||
if test x$_libcurl_config != "x" ; then
|
||||
AC_CACHE_CHECK([for the version of libcurl],
|
||||
[libcurl_cv_lib_curl_version],
|
||||
[libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $[]2}'`])
|
||||
|
||||
_libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse`
|
||||
_libcurl_wanted=`echo ifelse([$2],,[0],[$2]) | $_libcurl_version_parse`
|
||||
|
||||
if test $_libcurl_wanted -gt 0 ; then
|
||||
AC_CACHE_CHECK([for libcurl >= version $2],
|
||||
[libcurl_cv_lib_version_ok],
|
||||
[
|
||||
if test $_libcurl_version -ge $_libcurl_wanted ; then
|
||||
libcurl_cv_lib_version_ok=yes
|
||||
else
|
||||
libcurl_cv_lib_version_ok=no
|
||||
fi
|
||||
])
|
||||
fi
|
||||
if test x"$LIBCURL" = "x" ; then
|
||||
LIBCURL=`curl-config --libs`
|
||||
|
||||
# This is so silly, but Apple actually has a bug in their
|
||||
# curl-config script!
|
||||
if test $_libcurl_wanted -eq 0 || test x$libcurl_cv_lib_version_ok = xyes ; then
|
||||
if test x"$LIBCURL_INCLUDES" = "x" ; then
|
||||
LIBCURL_INCLUDES=`$_libcurl_config --cflags`
|
||||
fi
|
||||
if test x"$LIBCURL" = "x" ; then
|
||||
LIBCURL=`$_libcurl_config --libs`
|
||||
|
||||
case "${host}" in
|
||||
powerpc-apple-darwin*)
|
||||
LIBCURL=`echo $LIBCURL | sed -e 's|-arch i386||g'`
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
_have_config=yes
|
||||
else
|
||||
_have_config=no
|
||||
# This is so silly, but Apple actually has a bug in their
|
||||
# curl-config script!
|
||||
case "${host}" in
|
||||
powerpc-apple-darwin*)
|
||||
LIBCURL=`echo $LIBCURL | sed -e 's|-arch i386||g'`
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Is it modern enough to have --feature?
|
||||
if test $_libcurl_version -ge 0 ; then
|
||||
_libcurl_features=`$_libcurl_config --feature`
|
||||
fi
|
||||
|
||||
# Is it modern enough to have --protocols? (7.12.4)
|
||||
if test $_libcurl_version -ge 461828 ; then
|
||||
_libcurl_protocols=`$_libcurl_config --protocols`
|
||||
fi
|
||||
else
|
||||
_libcurl_try_link=no
|
||||
fi
|
||||
|
||||
unset _libcurl_wanted
|
||||
unset _libcurl_version
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT([$_have_config])
|
||||
if test $_libcurl_try_link = yes ; then
|
||||
|
||||
# we didn't find curl-config, so let's see if the user-supplied
|
||||
# link line (or failing that, "-lcurl") is enough.
|
||||
# we didn't find curl-config, so let's see if the user-supplied
|
||||
# link line (or failing that, "-lcurl") is enough.
|
||||
LIBCURL=${LIBCURL-"-lcurl"}
|
||||
|
||||
LIBCURL=${LIBCURL-"-lcurl"}
|
||||
AC_CACHE_CHECK([whether libcurl is usable],
|
||||
[libcurl_cv_lib_curl_usable],
|
||||
[
|
||||
_libcurl_save_cppflags=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $LIBCURL_INCLUDES"
|
||||
_libcurl_save_ldflags=$LDFLAGS
|
||||
LDFLAGS="$LDFLAGS $LIBCURL"
|
||||
|
||||
AC_MSG_CHECKING([whether libcurl is usable])
|
||||
|
||||
_libcurl_save_cppflags=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $LIBCURL_INCLUDES"
|
||||
_libcurl_save_ldflags=$LDFLAGS
|
||||
LDFLAGS="$LDFLAGS $LIBCURL"
|
||||
|
||||
AC_LINK_IFELSE(AC_LANG_PROGRAM([#include <curl/curl.h>],[
|
||||
AC_LINK_IFELSE(AC_LANG_PROGRAM([#include <curl/curl.h>],[
|
||||
/* Try and use a few common options to force a failure if we are
|
||||
missing symbols or can't link. */
|
||||
int x;
|
||||
x=CURL_ERROR_SIZE;
|
||||
curl_easy_setopt(NULL,CURLOPT_URL,NULL);
|
||||
x=CURL_ERROR_SIZE;
|
||||
x=CURLOPT_WRITEFUNCTION;
|
||||
x=CURLOPT_FILE;
|
||||
/* x=CURLOPT_WRITEDATA; */
|
||||
x=CURLOPT_ERRORBUFFER;
|
||||
x=CURLOPT_STDERR;
|
||||
x=CURLOPT_VERBOSE;
|
||||
]),have_libcurl=yes,have_libcurl=no)
|
||||
]),libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no)
|
||||
|
||||
CPPFLAGS=$_libcurl_save_cppflags
|
||||
LDFLAGS=$_libcurl_save_ldflags
|
||||
CPPFLAGS=$_libcurl_save_cppflags
|
||||
LDFLAGS=$_libcurl_save_ldflags
|
||||
unset _libcurl_save_cppflags
|
||||
unset _libcurl_save_ldflags
|
||||
])
|
||||
|
||||
AC_MSG_RESULT([$have_libcurl])
|
||||
if test $libcurl_cv_lib_curl_usable = yes ; then
|
||||
AC_DEFINE(HAVE_LIBCURL,1,
|
||||
[Define to 1 if you have a functional curl library.])
|
||||
AC_SUBST(LIBCURL_INCLUDES)
|
||||
AC_SUBST(LIBCURL)
|
||||
|
||||
if test $have_libcurl = yes ; then
|
||||
AC_DEFINE(HAVE_LIBCURL,1,
|
||||
[Define to 1 if you have a fully functional curl library.])
|
||||
AC_SUBST(LIBCURL_INCLUDES)
|
||||
AC_SUBST(LIBCURL)
|
||||
for _libcurl_feature in $_libcurl_features ; do
|
||||
AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_feature_$_libcurl_feature),[1])
|
||||
eval AS_TR_SH(libcurl_feature_$_libcurl_feature)=yes
|
||||
done
|
||||
|
||||
if test "x$_libcurl_protocols" = "x" ; then
|
||||
# We don't have --protocols, so just assume that all protocols
|
||||
# are available
|
||||
|
||||
_libcurl_protocols="HTTP FTP GOPHER FILE TELNET LDAP DICT"
|
||||
|
||||
if test x$libcurl_feature_SSL = xyes ; then
|
||||
_libcurl_protocols="$_libcurl_protocols HTTPS FTPS"
|
||||
fi
|
||||
fi
|
||||
|
||||
for _libcurl_protocol in $_libcurl_protocols ; do
|
||||
AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_protocol_$_libcurl_protocol),[1])
|
||||
eval AS_TR_SH(libcurl_protocol_$_libcurl_protocol)=yes
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
unset _do_libcurl
|
||||
unset _have_config
|
||||
unset _libcurl_save_cppflags
|
||||
unset _libcurl_save_ldflags
|
||||
unset _libcurl_try_link
|
||||
unset _libcurl_version_parse
|
||||
unset _libcurl_config
|
||||
unset _libcurl_feature
|
||||
unset _libcurl_features
|
||||
unset _libcurl_protocol
|
||||
unset _libcurl_protocols
|
||||
fi
|
||||
|
||||
if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then
|
||||
# This is the IF-NO path
|
||||
ifelse([$4],,:,[$4])
|
||||
else
|
||||
# This is the IF-YES path
|
||||
ifelse([$3],,:,[$3])
|
||||
fi
|
||||
|
||||
unset _libcurl_with
|
||||
])dnl
|
||||
|
Loading…
x
Reference in New Issue
Block a user