author | Michael Krelin <hacker@klever.net> | 2008-05-18 18:26:17 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2008-05-18 18:26:17 (UTC) |
commit | 89795a918842ef0089d14b29a3bd62a0ac1853d5 (patch) (unidiff) | |
tree | d526aa8176d6f8d56e5938780176294741df889d | |
parent | 575d19f96c275d8b77642f20a8975e1cf0100eb5 (diff) | |
download | libopkele-89795a918842ef0089d14b29a3bd62a0ac1853d5.zip libopkele-89795a918842ef0089d14b29a3bd62a0ac1853d5.tar.gz libopkele-89795a918842ef0089d14b29a3bd62a0ac1853d5.tar.bz2 |
update libcurl.m4 to fix breakage with -Wl,--as-needed ld flagspublic/devel/oauthdevel/oauth
Thanks to Samuli Suominen of Gentoo project for spotting it
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | acinclude.d/libcurl.m4 | 79 |
1 files changed, 55 insertions, 24 deletions
diff --git a/acinclude.d/libcurl.m4 b/acinclude.d/libcurl.m4 index e80c206..f54a5f2 100644 --- a/acinclude.d/libcurl.m4 +++ b/acinclude.d/libcurl.m4 | |||
@@ -1,7 +1,7 @@ | |||
1 | # LIBCURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION], | 1 | # LIBCURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION], |
2 | # [ACTION-IF-YES], [ACTION-IF-NO]) | 2 | # [ACTION-IF-YES], [ACTION-IF-NO]) |
3 | # ---------------------------------------------------------- | 3 | # ---------------------------------------------------------- |
4 | # David Shaw <dshaw@jabberwocky.com> Jan-23-2005 | 4 | # David Shaw <dshaw@jabberwocky.com> May-09-2006 |
5 | # | 5 | # |
6 | # Checks for libcurl. DEFAULT-ACTION is the string yes or no to | 6 | # Checks for libcurl. DEFAULT-ACTION is the string yes or no to |
7 | # specify whether to default to --with-libcurl or --without-libcurl. | 7 | # specify whether to default to --with-libcurl or --without-libcurl. |
@@ -13,10 +13,10 @@ | |||
13 | # ACTION-IF-NO is a list of shell commands that are run otherwise. | 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. | 14 | # Note that using --without-libcurl does run ACTION-IF-NO. |
15 | # | 15 | # |
16 | # This macro defines HAVE_LIBCURL if a working libcurl setup is found, | 16 | # This macro #defines HAVE_LIBCURL if a working libcurl setup is |
17 | # and sets @LIBCURL@ and @LIBCURL_CPPFLAGS@ to the necessary values. | 17 | # found, and sets @LIBCURL@ and @LIBCURL_CPPFLAGS@ to the necessary |
18 | # Other useful defines are LIBCURL_FEATURE_xxx where xxx are the | 18 | # values. Other useful defines are LIBCURL_FEATURE_xxx where xxx are |
19 | # various features supported by libcurl, and LIBCURL_PROTOCOL_yyy | 19 | # the various features supported by libcurl, and LIBCURL_PROTOCOL_yyy |
20 | # where yyy are the various protocols supported by libcurl. Both xxx | 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 | 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 | 22 | # the macro for the complete list of possible defines. Shell |
@@ -32,13 +32,8 @@ | |||
32 | # found is after version 7.7.2, the first version that included the | 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 | 33 | # curl-config script. Note that it is very important for people |
34 | # packaging binary versions of libcurl to include this script! | 34 | # packaging binary versions of libcurl to include this script! |
35 | # Without curl-config, we can only make educated guesses as to what | 35 | # Without curl-config, we can only guess what protocols are available, |
36 | # protocols are available. Specifically, we assume that all of HTTP, | 36 | # or use curl_version_info to figure it out at runtime. |
37 | # FTP, GOPHER, FILE, TELNET, LDAP, and DICT exist, and (if SSL exists) | ||
38 | # HTTPS is present. All of these protocols existed when libcurl was | ||
39 | # first created in version 7, so this is a safe assumption. If the | ||
40 | # version is 7.11.0 or later, FTPS is assumed to be present as well. | ||
41 | # FTPS existed before then, but was not yet fully standards compliant. | ||
42 | 37 | ||
43 | AC_DEFUN([LIBCURL_CHECK_CONFIG], | 38 | AC_DEFUN([LIBCURL_CHECK_CONFIG], |
44 | [ | 39 | [ |
@@ -47,16 +42,19 @@ AC_DEFUN([LIBCURL_CHECK_CONFIG], | |||
47 | AH_TEMPLATE([LIBCURL_FEATURE_IPV6],[Defined if libcurl supports IPv6]) | 42 | AH_TEMPLATE([LIBCURL_FEATURE_IPV6],[Defined if libcurl supports IPv6]) |
48 | AH_TEMPLATE([LIBCURL_FEATURE_LIBZ],[Defined if libcurl supports libz]) | 43 | AH_TEMPLATE([LIBCURL_FEATURE_LIBZ],[Defined if libcurl supports libz]) |
49 | AH_TEMPLATE([LIBCURL_FEATURE_ASYNCHDNS],[Defined if libcurl supports AsynchDNS]) | 44 | AH_TEMPLATE([LIBCURL_FEATURE_ASYNCHDNS],[Defined if libcurl supports AsynchDNS]) |
45 | AH_TEMPLATE([LIBCURL_FEATURE_IDN],[Defined if libcurl supports IDN]) | ||
46 | AH_TEMPLATE([LIBCURL_FEATURE_SSPI],[Defined if libcurl supports SSPI]) | ||
47 | AH_TEMPLATE([LIBCURL_FEATURE_NTLM],[Defined if libcurl supports NTLM]) | ||
50 | 48 | ||
51 | AH_TEMPLATE([LIBCURL_PROTOCOL_HTTP],[Defined if libcurl supports HTTP]) | 49 | AH_TEMPLATE([LIBCURL_PROTOCOL_HTTP],[Defined if libcurl supports HTTP]) |
52 | AH_TEMPLATE([LIBCURL_PROTOCOL_HTTPS],[Defined if libcurl supports HTTPS]) | 50 | AH_TEMPLATE([LIBCURL_PROTOCOL_HTTPS],[Defined if libcurl supports HTTPS]) |
53 | AH_TEMPLATE([LIBCURL_PROTOCOL_FTP],[Defined if libcurl supports FTP]) | 51 | AH_TEMPLATE([LIBCURL_PROTOCOL_FTP],[Defined if libcurl supports FTP]) |
54 | AH_TEMPLATE([LIBCURL_PROTOCOL_FTPS],[Defined if libcurl supports FTPS]) | 52 | AH_TEMPLATE([LIBCURL_PROTOCOL_FTPS],[Defined if libcurl supports FTPS]) |
55 | AH_TEMPLATE([LIBCURL_PROTOCOL_GOPHER],[Defined if libcurl supports GOPHER]) | ||
56 | AH_TEMPLATE([LIBCURL_PROTOCOL_FILE],[Defined if libcurl supports FILE]) | 53 | AH_TEMPLATE([LIBCURL_PROTOCOL_FILE],[Defined if libcurl supports FILE]) |
57 | AH_TEMPLATE([LIBCURL_PROTOCOL_TELNET],[Defined if libcurl supports TELNET]) | 54 | AH_TEMPLATE([LIBCURL_PROTOCOL_TELNET],[Defined if libcurl supports TELNET]) |
58 | AH_TEMPLATE([LIBCURL_PROTOCOL_LDAP],[Defined if libcurl supports LDAP]) | 55 | AH_TEMPLATE([LIBCURL_PROTOCOL_LDAP],[Defined if libcurl supports LDAP]) |
59 | AH_TEMPLATE([LIBCURL_PROTOCOL_DICT],[Defined if libcurl supports DICT]) | 56 | AH_TEMPLATE([LIBCURL_PROTOCOL_DICT],[Defined if libcurl supports DICT]) |
57 | AH_TEMPLATE([LIBCURL_PROTOCOL_TFTP],[Defined if libcurl supports TFTP]) | ||
60 | 58 | ||
61 | AC_ARG_WITH(libcurl, | 59 | AC_ARG_WITH(libcurl, |
62 | AC_HELP_STRING([--with-libcurl=DIR],[look for the curl library in DIR]), | 60 | AC_HELP_STRING([--with-libcurl=DIR],[look for the curl library in DIR]), |
@@ -71,12 +69,14 @@ AC_DEFUN([LIBCURL_CHECK_CONFIG], | |||
71 | _libcurl_try_link=yes | 69 | _libcurl_try_link=yes |
72 | 70 | ||
73 | if test -d "$_libcurl_with" ; then | 71 | if test -d "$_libcurl_with" ; then |
74 | CPPFLAGS="${CPPFLAGS} -I$withval/include" | 72 | LIBCURL_CPPFLAGS="-I$withval/include" |
75 | LDFLAGS="${LDFLAGS} -L$withval/lib" | 73 | _libcurl_ldflags="-L$withval/lib" |
74 | AC_PATH_PROG([_libcurl_config],[curl-config],["$withval/bin"], | ||
75 | ["$withval/bin"]) | ||
76 | else | ||
77 | AC_PATH_PROG([_libcurl_config],[curl-config]) | ||
76 | fi | 78 | fi |
77 | 79 | ||
78 | AC_PATH_PROG([_libcurl_config],[curl-config]) | ||
79 | |||
80 | if test x$_libcurl_config != "x" ; then | 80 | if test x$_libcurl_config != "x" ; then |
81 | AC_CACHE_CHECK([for the version of libcurl], | 81 | AC_CACHE_CHECK([for the version of libcurl], |
82 | [libcurl_cv_lib_curl_version], | 82 | [libcurl_cv_lib_curl_version], |
@@ -103,6 +103,15 @@ AC_DEFUN([LIBCURL_CHECK_CONFIG], | |||
103 | fi | 103 | fi |
104 | if test x"$LIBCURL" = "x" ; then | 104 | if test x"$LIBCURL" = "x" ; then |
105 | LIBCURL=`$_libcurl_config --libs` | 105 | LIBCURL=`$_libcurl_config --libs` |
106 | |||
107 | # This is so silly, but Apple actually has a bug in their | ||
108 | # curl-config script. Fixed in Tiger, but there are still | ||
109 | # lots of Panther installs around. | ||
110 | case "${host}" in | ||
111 | powerpc-apple-darwin7*) | ||
112 | LIBCURL=`echo $LIBCURL | sed -e 's|-arch i386||g'` | ||
113 | ;; | ||
114 | esac | ||
106 | fi | 115 | fi |
107 | 116 | ||
108 | # All curl-config scripts support --feature | 117 | # All curl-config scripts support --feature |
@@ -123,15 +132,15 @@ AC_DEFUN([LIBCURL_CHECK_CONFIG], | |||
123 | 132 | ||
124 | # we didn't find curl-config, so let's see if the user-supplied | 133 | # we didn't find curl-config, so let's see if the user-supplied |
125 | # link line (or failing that, "-lcurl") is enough. | 134 | # link line (or failing that, "-lcurl") is enough. |
126 | LIBCURL=${LIBCURL-"-lcurl"} | 135 | LIBCURL=${LIBCURL-"$_libcurl_ldflags -lcurl"} |
127 | 136 | ||
128 | AC_CACHE_CHECK([whether libcurl is usable], | 137 | AC_CACHE_CHECK([whether libcurl is usable], |
129 | [libcurl_cv_lib_curl_usable], | 138 | [libcurl_cv_lib_curl_usable], |
130 | [ | 139 | [ |
131 | _libcurl_save_cppflags=$CPPFLAGS | 140 | _libcurl_save_cppflags=$CPPFLAGS |
132 | CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS" | 141 | CPPFLAGS="$LIBCURL_CPPFLAGS $CPPFLAGS" |
133 | _libcurl_save_ldflags=$LDFLAGS | 142 | _libcurl_save_libs=$LIBS |
134 | LDFLAGS="$LDFLAGS $LIBCURL" | 143 | LIBS="$LIBCURL $LIBS" |
135 | 144 | ||
136 | AC_LINK_IFELSE(AC_LANG_PROGRAM([#include <curl/curl.h>],[ | 145 | AC_LINK_IFELSE(AC_LANG_PROGRAM([#include <curl/curl.h>],[ |
137 | /* Try and use a few common options to force a failure if we are | 146 | /* Try and use a few common options to force a failure if we are |
@@ -147,12 +156,30 @@ x=CURLOPT_VERBOSE; | |||
147 | ]),libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no) | 156 | ]),libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no) |
148 | 157 | ||
149 | CPPFLAGS=$_libcurl_save_cppflags | 158 | CPPFLAGS=$_libcurl_save_cppflags |
150 | LDFLAGS=$_libcurl_save_ldflags | 159 | LIBS=$_libcurl_save_libs |
151 | unset _libcurl_save_cppflags | 160 | unset _libcurl_save_cppflags |
152 | unset _libcurl_save_ldflags | 161 | unset _libcurl_save_libs |
153 | ]) | 162 | ]) |
154 | 163 | ||
155 | if test $libcurl_cv_lib_curl_usable = yes ; then | 164 | if test $libcurl_cv_lib_curl_usable = yes ; then |
165 | |||
166 | # Does curl_free() exist in this version of libcurl? | ||
167 | # If not, fake it with free() | ||
168 | |||
169 | _libcurl_save_cppflags=$CPPFLAGS | ||
170 | CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS" | ||
171 | _libcurl_save_libs=$LIBS | ||
172 | LIBS="$LIBS $LIBCURL" | ||
173 | |||
174 | AC_CHECK_FUNC(curl_free,, | ||
175 | AC_DEFINE(curl_free,free, | ||
176 | [Define curl_free() as free() if our version of curl lacks curl_free.])) | ||
177 | |||
178 | CPPFLAGS=$_libcurl_save_cppflags | ||
179 | LIBS=$_libcurl_save_libs | ||
180 | unset _libcurl_save_cppflags | ||
181 | unset _libcurl_save_libs | ||
182 | |||
156 | AC_DEFINE(HAVE_LIBCURL,1, | 183 | AC_DEFINE(HAVE_LIBCURL,1, |
157 | [Define to 1 if you have a functional curl library.]) | 184 | [Define to 1 if you have a functional curl library.]) |
158 | AC_SUBST(LIBCURL_CPPFLAGS) | 185 | AC_SUBST(LIBCURL_CPPFLAGS) |
@@ -167,7 +194,7 @@ x=CURLOPT_VERBOSE; | |||
167 | 194 | ||
168 | # We don't have --protocols, so just assume that all | 195 | # We don't have --protocols, so just assume that all |
169 | # protocols are available | 196 | # protocols are available |
170 | _libcurl_protocols="HTTP FTP GOPHER FILE TELNET LDAP DICT" | 197 | _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT" |
171 | 198 | ||
172 | if test x$libcurl_feature_SSL = xyes ; then | 199 | if test x$libcurl_feature_SSL = xyes ; then |
173 | _libcurl_protocols="$_libcurl_protocols HTTPS" | 200 | _libcurl_protocols="$_libcurl_protocols HTTPS" |
@@ -184,6 +211,9 @@ x=CURLOPT_VERBOSE; | |||
184 | AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_protocol_$_libcurl_protocol),[1]) | 211 | AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_protocol_$_libcurl_protocol),[1]) |
185 | eval AS_TR_SH(libcurl_protocol_$_libcurl_protocol)=yes | 212 | eval AS_TR_SH(libcurl_protocol_$_libcurl_protocol)=yes |
186 | done | 213 | done |
214 | else | ||
215 | unset LIBCURL | ||
216 | unset LIBCURL_CPPFLAGS | ||
187 | fi | 217 | fi |
188 | fi | 218 | fi |
189 | 219 | ||
@@ -195,6 +225,7 @@ x=CURLOPT_VERBOSE; | |||
195 | unset _libcurl_protocol | 225 | unset _libcurl_protocol |
196 | unset _libcurl_protocols | 226 | unset _libcurl_protocols |
197 | unset _libcurl_version | 227 | unset _libcurl_version |
228 | unset _libcurl_ldflags | ||
198 | fi | 229 | fi |
199 | 230 | ||
200 | if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then | 231 | if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then |