close Warning: HTML preview using EnscriptRenderer failed (IOError: [Errno 2] No such file or directory: '/tmp/tmpCv212z')

source: FTPfs/curlftpfs-0.9.1/acinclude.m4 @ 195

Last change on this file since 195 was 10, checked in by zsjheng, 17 years ago
File size: 10.7 KB
RevLine 
[10]1# LIBCURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION],
2#                       [ACTION-IF-YES], [ACTION-IF-NO])
3# ----------------------------------------------------------
4#      David Shaw <dshaw@jabberwocky.com>   Jun-21-2005
5#
6# Checks for libcurl.  DEFAULT-ACTION is the string yes or no to
7# specify whether to default to --with-libcurl or --without-libcurl.
8# If not supplied, DEFAULT-ACTION is yes.  MINIMUM-VERSION is the
9# minimum version of libcurl to accept.  Pass the version as a regular
10# version number like 7.10.1. If not supplied, any version is
11# accepted.  ACTION-IF-YES is a list of shell commands to run if
12# libcurl was successfully found and passed the various tests.
13# ACTION-IF-NO is a list of shell commands that are run otherwise.
14# Note that using --without-libcurl does run ACTION-IF-NO.
15#
16# This macro defines HAVE_LIBCURL if a working libcurl setup is found,
17# and sets @LIBCURL@ and @LIBCURL_CPPFLAGS@ to the necessary values.
18# Other useful defines are LIBCURL_FEATURE_xxx where xxx are the
19# various features supported by libcurl, and LIBCURL_PROTOCOL_yyy
20# where yyy are the various protocols supported by libcurl.  Both xxx
21# and yyy are capitalized.  See the list of AH_TEMPLATEs at the top of
22# the macro for the complete list of possible defines.  Shell
23# variables $libcurl_feature_xxx and $libcurl_protocol_yyy are also
24# defined to 'yes' for those features and protocols that were found.
25# Note that xxx and yyy keep the same capitalization as in the
26# curl-config list (e.g. it's "HTTP" and not "http").
27#
28# Users may override the detected values by doing something like:
29# LIBCURL="-lcurl" LIBCURL_CPPFLAGS="-I/usr/myinclude" ./configure
30#
31# For the sake of sanity, this macro assumes that any libcurl that is
32# found is after version 7.7.2, the first version that included the
33# curl-config script.  Note that it is very important for people
34# packaging binary versions of libcurl to include this script!
35# Without curl-config, we can only guess what protocols are available.
36
37AC_DEFUN([LIBCURL_CHECK_CONFIG],
38[
39  AH_TEMPLATE([LIBCURL_FEATURE_SSL],[Defined if libcurl supports SSL])
40  AH_TEMPLATE([LIBCURL_FEATURE_KRB4],[Defined if libcurl supports KRB4])
41  AH_TEMPLATE([LIBCURL_FEATURE_IPV6],[Defined if libcurl supports IPv6])
42  AH_TEMPLATE([LIBCURL_FEATURE_LIBZ],[Defined if libcurl supports libz])
43  AH_TEMPLATE([LIBCURL_FEATURE_ASYNCHDNS],[Defined if libcurl supports AsynchDNS])
44
45  AH_TEMPLATE([LIBCURL_PROTOCOL_HTTP],[Defined if libcurl supports HTTP])
46  AH_TEMPLATE([LIBCURL_PROTOCOL_HTTPS],[Defined if libcurl supports HTTPS])
47  AH_TEMPLATE([LIBCURL_PROTOCOL_FTP],[Defined if libcurl supports FTP])
48  AH_TEMPLATE([LIBCURL_PROTOCOL_FTPS],[Defined if libcurl supports FTPS])
49  AH_TEMPLATE([LIBCURL_PROTOCOL_GOPHER],[Defined if libcurl supports GOPHER])
50  AH_TEMPLATE([LIBCURL_PROTOCOL_FILE],[Defined if libcurl supports FILE])
51  AH_TEMPLATE([LIBCURL_PROTOCOL_TELNET],[Defined if libcurl supports TELNET])
52  AH_TEMPLATE([LIBCURL_PROTOCOL_LDAP],[Defined if libcurl supports LDAP])
53  AH_TEMPLATE([LIBCURL_PROTOCOL_DICT],[Defined if libcurl supports DICT])
54
55  AC_ARG_WITH(libcurl,
56     AC_HELP_STRING([--with-libcurl=DIR],[look for the curl library in DIR]),
57     [_libcurl_with=$withval],[_libcurl_with=ifelse([$1],,[yes],[$1])])
58
59  if test "$_libcurl_with" != "no" ; then
60
61     AC_PROG_AWK
62
63     _libcurl_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[[1]]+256*A[[2]]+A[[3]]; print X;}'"
64
65     _libcurl_try_link=yes
66
67     if test -d "$_libcurl_with" ; then
68        CPPFLAGS="${CPPFLAGS} -I$withval/include"
69        LDFLAGS="${LDFLAGS} -L$withval/lib"
70     fi
71
72     AC_PATH_PROG([_libcurl_config],[curl-config])
73
74     if test x$_libcurl_config != "x" ; then
75        AC_CACHE_CHECK([for the version of libcurl],
76     [libcurl_cv_lib_curl_version],
77           [libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $[]2}'`])
78
79  _libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse`
80  _libcurl_wanted=`echo ifelse([$2],,[0],[$2]) | $_libcurl_version_parse`
81
82        if test $_libcurl_wanted -gt 0 ; then
83     AC_CACHE_CHECK([for libcurl >= version $2],
84        [libcurl_cv_lib_version_ok],
85              [
86          if test $_libcurl_version -ge $_libcurl_wanted ; then
87           libcurl_cv_lib_version_ok=yes
88              else
89           libcurl_cv_lib_version_ok=no
90          fi
91              ])
92        fi
93
94  if test $_libcurl_wanted -eq 0 || test x$libcurl_cv_lib_version_ok = xyes ; then
95           if test x"$LIBCURL_CPPFLAGS" = "x" ; then
96              LIBCURL_CPPFLAGS=`$_libcurl_config --cflags`
97           fi
98           if test x"$LIBCURL" = "x" ; then
99              LIBCURL=`$_libcurl_config --libs`
100
101              # This is so silly, but Apple actually has a bug in their
102        # curl-config script.  Fixed in Tiger, but there are still
103        # lots of Panther installs around.
104              case "${host}" in
105                 powerpc-apple-darwin7*)
106                    LIBCURL=`echo $LIBCURL | sed -e 's|-arch i386||g'`
107                 ;;
108              esac
109           fi
110
111     # All curl-config scripts support --feature
112     _libcurl_features=`$_libcurl_config --feature`
113
114           # Is it modern enough to have --protocols? (7.12.4)
115     if test $_libcurl_version -ge 461828 ; then
116              _libcurl_protocols=`$_libcurl_config --protocols`
117           fi
118  else
119           _libcurl_try_link=no
120  fi
121
122  unset _libcurl_wanted
123     fi
124
125     if test $_libcurl_try_link = yes ; then
126
127        # we didn't find curl-config, so let's see if the user-supplied
128        # link line (or failing that, "-lcurl") is enough.
129        LIBCURL=${LIBCURL-"-lcurl"}
130
131        AC_CACHE_CHECK([whether libcurl is usable],
132           [libcurl_cv_lib_curl_usable],
133           [
134           _libcurl_save_cppflags=$CPPFLAGS
135           CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS"
136           _libcurl_save_libs=$LIBS
137           LIBS="$LIBS $LIBCURL"
138
139           AC_LINK_IFELSE(AC_LANG_PROGRAM([#include <curl/curl.h>],[
140/* Try and use a few common options to force a failure if we are
141   missing symbols or can't link. */
142int x;
143curl_easy_setopt(NULL,CURLOPT_URL,NULL);
144x=CURL_ERROR_SIZE;
145x=CURLOPT_WRITEFUNCTION;
146x=CURLOPT_FILE;
147x=CURLOPT_ERRORBUFFER;
148x=CURLOPT_STDERR;
149x=CURLOPT_VERBOSE;
150]),libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no)
151
152           CPPFLAGS=$_libcurl_save_cppflags
153           LIBS=$_libcurl_save_libs
154           unset _libcurl_save_cppflags
155           unset _libcurl_save_libs
156           ])
157
158        if test $libcurl_cv_lib_curl_usable = yes ; then
159
160     # Does curl_free() exist in this version of libcurl?
161     # If not, fake it with free()
162
163           _libcurl_save_cppflags=$CPPFLAGS
164           CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS"
165           _libcurl_save_libs=$LIBS
166           LIBS="$LIBS $LIBCURL"
167
168           AC_CHECK_FUNC(curl_free,,
169          AC_DEFINE(curl_free,free,
170    [Define curl_free() as free() if our version of curl lacks curl_free.]))
171
172           CPPFLAGS=$_libcurl_save_cppflags
173           LIBS=$_libcurl_save_libs
174           unset _libcurl_save_cppflags
175           unset _libcurl_save_libs
176
177           AC_DEFINE(HAVE_LIBCURL,1,
178             [Define to 1 if you have a functional curl library.])
179           AC_SUBST(LIBCURL_CPPFLAGS)
180           AC_SUBST(LIBCURL)
181
182           for _libcurl_feature in $_libcurl_features ; do
183        AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_feature_$_libcurl_feature),[1])
184        eval AS_TR_SH(libcurl_feature_$_libcurl_feature)=yes
185           done
186
187     if test "x$_libcurl_protocols" = "x" ; then
188
189        # We don't have --protocols, so just assume that all
190        # protocols are available
191        _libcurl_protocols="HTTP FTP GOPHER FILE TELNET LDAP DICT"
192
193        if test x$libcurl_feature_SSL = xyes ; then
194           _libcurl_protocols="$_libcurl_protocols HTTPS"
195
196     # FTPS wasn't standards-compliant until version
197     # 7.11.0
198     if test $_libcurl_version -ge 461568; then
199        _libcurl_protocols="$_libcurl_protocols FTPS"
200     fi
201        fi
202     fi
203
204     for _libcurl_protocol in $_libcurl_protocols ; do
205        AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_protocol_$_libcurl_protocol),[1])
206        eval AS_TR_SH(libcurl_protocol_$_libcurl_protocol)=yes
207           done
208        fi
209     fi
210
211     unset _libcurl_try_link
212     unset _libcurl_version_parse
213     unset _libcurl_config
214     unset _libcurl_feature
215     unset _libcurl_features
216     unset _libcurl_protocol
217     unset _libcurl_protocols
218     unset _libcurl_version
219  fi
220
221  if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then
222     # This is the IF-NO path
223     ifelse([$4],,:,[$4])
224  else
225     # This is the IF-YES path
226     ifelse([$3],,:,[$3])
227  fi
228
229  unset _libcurl_with
230])dnl
231
232dnl From Bruno Haible.
233
234AC_DEFUN([AM_ICONV],
235[
236  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
237  dnl those with the standalone portable GNU libiconv installed).
238
239  AC_ARG_WITH([libiconv-prefix],
240[  --with-libiconv-prefix=DIR  search for libiconv in DIR/include and DIR/lib], [
241    for dir in `echo "$withval" | tr : ' '`; do
242      if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
243      if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
244    done
245   ])
246
247  AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
248    am_cv_func_iconv="no, consider installing GNU libiconv"
249    am_cv_lib_iconv=no
250    AC_TRY_LINK([#include <stdlib.h>
251#include <iconv.h>],
252      [iconv_t cd = iconv_open("","");
253       iconv(cd,NULL,NULL,NULL,NULL);
254       iconv_close(cd);],
255      am_cv_func_iconv=yes)
256    if test "$am_cv_func_iconv" != yes; then
257      am_save_LIBS="$LIBS"
258      LIBS="$LIBS -liconv"
259      AC_TRY_LINK([#include <stdlib.h>
260#include <iconv.h>],
261        [iconv_t cd = iconv_open("","");
262         iconv(cd,NULL,NULL,NULL,NULL);
263         iconv_close(cd);],
264        am_cv_lib_iconv=yes
265        am_cv_func_iconv=yes)
266      LIBS="$am_save_LIBS"
267    fi
268  ])
269  if test "$am_cv_func_iconv" = yes; then
270    AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
271    AC_MSG_CHECKING([for iconv declaration])
272    AC_CACHE_VAL(am_cv_proto_iconv, [
273      AC_TRY_COMPILE([
274#include <stdlib.h>
275#include <iconv.h>
276extern
277#ifdef __cplusplus
278"C"
279#endif
280#if defined(__STDC__) || defined(__cplusplus)
281size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
282#else
283size_t iconv();
284#endif
285], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
286      am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
287    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
288    AC_MSG_RESULT([$]{ac_t:-
289         }[$]am_cv_proto_iconv)
290    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
291      [Define as const if the declaration of iconv() needs const.])
292  fi
293  LIBICONV=
294  if test "$am_cv_lib_iconv" = yes; then
295    LIBICONV="-liconv"
296  fi
297  AC_SUBST(LIBICONV)
298])
Note: See TracBrowser for help on using the repository browser.