Mercurial > repos > dawe > srf2fastq
comparison srf2fastq/io_lib-1.12.2/acinclude.m4 @ 0:d901c9f41a6a default tip
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
author | dawe |
---|---|
date | Tue, 07 Jun 2011 17:48:05 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:d901c9f41a6a |
---|---|
1 # LIBCURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION], | |
2 # [ACTION-IF-YES], [ACTION-IF-NO]) | |
3 # ---------------------------------------------------------- | |
4 # David Shaw <dshaw@jabberwocky.com <mailto:dshaw@jabberwocky.com>> May-09-2006 | |
5 # Modified by Rob to deal with curl-config linking against more libraries than | |
6 # strictly necessary. | |
7 # | |
8 # Checks for libcurl. DEFAULT-ACTION is the string yes or no to | |
9 # specify whether to default to --with-libcurl or --without-libcurl. | |
10 # If not supplied, DEFAULT-ACTION is yes. MINIMUM-VERSION is the | |
11 # minimum version of libcurl to accept. Pass the version as a regular | |
12 # version number like 7.10.1. If not supplied, any version is | |
13 # accepted. ACTION-IF-YES is a list of shell commands to run if | |
14 # libcurl was successfully found and passed the various tests. | |
15 # ACTION-IF-NO is a list of shell commands that are run otherwise. | |
16 # Note that using --without-libcurl does run ACTION-IF-NO. | |
17 # | |
18 # This macro #defines HAVE_LIBCURL if a working libcurl setup is | |
19 # found, and sets @LIBCURL@ and @LIBCURL_CPPFLAGS@ to the necessary | |
20 # values. Other useful defines are LIBCURL_FEATURE_xxx where xxx are | |
21 # the various features supported by libcurl, and LIBCURL_PROTOCOL_yyy | |
22 # where yyy are the various protocols supported by libcurl. Both xxx | |
23 # and yyy are capitalized. See the list of AH_TEMPLATEs at the top of | |
24 # the macro for the complete list of possible defines. Shell | |
25 # variables $libcurl_feature_xxx and $libcurl_protocol_yyy are also | |
26 # defined to 'yes' for those features and protocols that were found. | |
27 # Note that xxx and yyy keep the same capitalization as in the | |
28 # curl-config list (e.g. it's "HTTP" and not "http"). | |
29 # | |
30 # Users may override the detected values by doing something like: | |
31 # LIBCURL="-lcurl" LIBCURL_CPPFLAGS="-I/usr/myinclude" ./configure | |
32 # | |
33 # For the sake of sanity, this macro assumes that any libcurl that is | |
34 # found is after version 7.7.2, the first version that included the | |
35 # curl-config script. Note that it is very important for people | |
36 # packaging binary versions of libcurl to include this script! | |
37 # Without curl-config, we can only guess what protocols are available, | |
38 # or use curl_version_info to figure it out at runtime. | |
39 | |
40 AC_DEFUN([LIBCURL_CHECK_CONFIG], | |
41 [ | |
42 AH_TEMPLATE([LIBCURL_FEATURE_SSL],[Defined if libcurl supports SSL]) | |
43 AH_TEMPLATE([LIBCURL_FEATURE_KRB4],[Defined if libcurl supports KRB4]) | |
44 AH_TEMPLATE([LIBCURL_FEATURE_IPV6],[Defined if libcurl supports IPv6]) | |
45 AH_TEMPLATE([LIBCURL_FEATURE_LIBZ],[Defined if libcurl supports libz]) | |
46 AH_TEMPLATE([LIBCURL_FEATURE_ASYNCHDNS],[Defined if libcurl supports AsynchDNS]) | |
47 AH_TEMPLATE([LIBCURL_FEATURE_IDN],[Defined if libcurl supports IDN]) | |
48 AH_TEMPLATE([LIBCURL_FEATURE_SSPI],[Defined if libcurl supports SSPI]) | |
49 AH_TEMPLATE([LIBCURL_FEATURE_NTLM],[Defined if libcurl supports NTLM]) | |
50 | |
51 AH_TEMPLATE([LIBCURL_PROTOCOL_HTTP],[Defined if libcurl supports HTTP]) | |
52 AH_TEMPLATE([LIBCURL_PROTOCOL_HTTPS],[Defined if libcurl supports HTTPS]) | |
53 AH_TEMPLATE([LIBCURL_PROTOCOL_FTP],[Defined if libcurl supports FTP]) | |
54 AH_TEMPLATE([LIBCURL_PROTOCOL_FTPS],[Defined if libcurl supports FTPS]) | |
55 AH_TEMPLATE([LIBCURL_PROTOCOL_FILE],[Defined if libcurl supports FILE]) | |
56 AH_TEMPLATE([LIBCURL_PROTOCOL_TELNET],[Defined if libcurl supports TELNET]) | |
57 AH_TEMPLATE([LIBCURL_PROTOCOL_LDAP],[Defined if libcurl supports LDAP]) | |
58 AH_TEMPLATE([LIBCURL_PROTOCOL_DICT],[Defined if libcurl supports DICT]) | |
59 AH_TEMPLATE([LIBCURL_PROTOCOL_TFTP],[Defined if libcurl supports TFTP]) | |
60 | |
61 AC_ARG_WITH(libcurl, | |
62 AC_HELP_STRING([--with-libcurl=DIR],[look for the curl library in DIR]), | |
63 [_libcurl_with=$withval],[_libcurl_with=ifelse([$1],,[yes],[$1])]) | |
64 | |
65 if test "$_libcurl_with" != "no" ; then | |
66 | |
67 AC_PROG_AWK | |
68 | |
69 _libcurl_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[[1]]+256*A[[2]]+A[[3]]; print X;}'" | |
70 | |
71 _libcurl_try_link=yes | |
72 | |
73 if test -d "$_libcurl_with" ; then | |
74 LIBCURL_CPPFLAGS="-I$withval/include" | |
75 _libcurl_ldflags="-L$withval/lib" | |
76 AC_PATH_PROG([_libcurl_config],["$withval/bin/curl-config"]) | |
77 else | |
78 AC_PATH_PROG([_libcurl_config],[curl-config]) | |
79 fi | |
80 | |
81 if test x$_libcurl_config != "x" ; then | |
82 AC_CACHE_CHECK([for the version of libcurl], | |
83 [libcurl_cv_lib_curl_version], | |
84 [libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $[]2}'`]) | |
85 | |
86 _libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse` | |
87 _libcurl_wanted=`echo ifelse([$2],,[0],[$2]) | $_libcurl_version_parse` | |
88 | |
89 if test $_libcurl_wanted -gt 0 ; then | |
90 AC_CACHE_CHECK([for libcurl >= version $2], | |
91 [libcurl_cv_lib_version_ok], | |
92 [ | |
93 if test $_libcurl_version -ge $_libcurl_wanted ; then | |
94 libcurl_cv_lib_version_ok=yes | |
95 else | |
96 libcurl_cv_lib_version_ok=no | |
97 fi | |
98 ]) | |
99 fi | |
100 | |
101 if test $_libcurl_wanted -eq 0 || test x$libcurl_cv_lib_version_ok = xyes ; then | |
102 if test x"$LIBCURL_CPPFLAGS" = "x" ; then | |
103 LIBCURL_CPPFLAGS=`$_libcurl_config --cflags` | |
104 fi | |
105 if test x"$LIBCURL" = "x" ; then | |
106 # libcurl-config --libs gives a ridiculous number of libraries | |
107 # check to see if we can actually link just using -lcurl | |
108 | |
109 LIBCURL=${LIBCURL-"$_libcurl_ldflags -lcurl"} | |
110 | |
111 AC_CACHE_CHECK([whether libcurl just needs -lcurl], | |
112 [libcurl_cv_lib_curl_only_needs_minus_l_curl], | |
113 [ | |
114 _libcurl_save_cppflags=$CPPFLAGS | |
115 CPPFLAGS="$LIBCURL_CPPFLAGS $CPPFLAGS" | |
116 _libcurl_save_libs=$LIBS | |
117 LIBS="$LIBCURL $LIBS" | |
118 | |
119 AC_LINK_IFELSE(AC_LANG_PROGRAM([#include <curl/curl.h>],[ | |
120 /* Try and use a few common options to force a failure if we are | |
121 missing symbols or can't link. */ | |
122 int x; | |
123 curl_easy_setopt(NULL,CURLOPT_URL,NULL); | |
124 x=CURL_ERROR_SIZE; | |
125 x=CURLOPT_WRITEFUNCTION; | |
126 x=CURLOPT_FILE; | |
127 x=CURLOPT_ERRORBUFFER; | |
128 x=CURLOPT_STDERR; | |
129 x=CURLOPT_VERBOSE; | |
130 ]),libcurl_cv_lib_curl_only_needs_minus_l_curl=yes,libcurl_cv_lib_curl_only_needs_minus_l_curl=no) | |
131 | |
132 CPPFLAGS=$_libcurl_save_cppflags | |
133 LIBS=$_libcurl_save_libs | |
134 unset _libcurl_save_cppflags | |
135 unset _libcurl_save_libs | |
136 ]) | |
137 | |
138 | |
139 if test "x$libcurl_cv_lib_curl_only_needs_minus_l_curl" != xyes ; then | |
140 LIBCURL=`$_libcurl_config --libs` | |
141 fi | |
142 | |
143 # This is so silly, but Apple actually has a bug in their | |
144 # curl-config script. Fixed in Tiger, but there are still | |
145 # lots of Panther installs around. | |
146 case "${host}" in | |
147 powerpc-apple-darwin7*) | |
148 LIBCURL=`echo $LIBCURL | sed -e 's|-arch i386||g'` | |
149 ;; | |
150 esac | |
151 fi | |
152 | |
153 # All curl-config scripts support --feature | |
154 _libcurl_features=`$_libcurl_config --feature` | |
155 | |
156 # Is it modern enough to have --protocols? (7.12.4) | |
157 if test $_libcurl_version -ge 461828 ; then | |
158 _libcurl_protocols=`$_libcurl_config --protocols` | |
159 fi | |
160 else | |
161 _libcurl_try_link=no | |
162 fi | |
163 | |
164 unset _libcurl_wanted | |
165 fi | |
166 | |
167 if test $_libcurl_try_link = yes ; then | |
168 | |
169 # we didn't find curl-config, so let's see if the user-supplied | |
170 # link line (or failing that, "-lcurl") is enough. | |
171 LIBCURL=${LIBCURL-"$_libcurl_ldflags -lcurl"} | |
172 | |
173 AC_CACHE_CHECK([whether libcurl is usable], | |
174 [libcurl_cv_lib_curl_usable], | |
175 [ | |
176 _libcurl_save_cppflags=$CPPFLAGS | |
177 CPPFLAGS="$LIBCURL_CPPFLAGS $CPPFLAGS" | |
178 _libcurl_save_libs=$LIBS | |
179 LIBS="$LIBCURL $LIBS" | |
180 | |
181 AC_LINK_IFELSE(AC_LANG_PROGRAM([#include <curl/curl.h>],[ | |
182 /* Try and use a few common options to force a failure if we are | |
183 missing symbols or can't link. */ | |
184 int x; | |
185 curl_easy_setopt(NULL,CURLOPT_URL,NULL); | |
186 x=CURL_ERROR_SIZE; | |
187 x=CURLOPT_WRITEFUNCTION; | |
188 x=CURLOPT_FILE; | |
189 x=CURLOPT_ERRORBUFFER; | |
190 x=CURLOPT_STDERR; | |
191 x=CURLOPT_VERBOSE; | |
192 ]),libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no) | |
193 | |
194 CPPFLAGS=$_libcurl_save_cppflags | |
195 LIBS=$_libcurl_save_libs | |
196 unset _libcurl_save_cppflags | |
197 unset _libcurl_save_libs | |
198 ]) | |
199 | |
200 if test $libcurl_cv_lib_curl_usable = yes ; then | |
201 | |
202 # Does curl_free() exist in this version of libcurl? | |
203 # If not, fake it with free() | |
204 | |
205 _libcurl_save_cppflags=$CPPFLAGS | |
206 CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS" | |
207 _libcurl_save_libs=$LIBS | |
208 LIBS="$LIBS $LIBCURL" | |
209 | |
210 AC_CHECK_FUNC(curl_free,, | |
211 AC_DEFINE(curl_free,free, | |
212 [Define curl_free() as free() if our version of curl lacks curl_free.])) | |
213 | |
214 CPPFLAGS=$_libcurl_save_cppflags | |
215 LIBS=$_libcurl_save_libs | |
216 unset _libcurl_save_cppflags | |
217 unset _libcurl_save_libs | |
218 | |
219 AC_DEFINE(HAVE_LIBCURL,1, | |
220 [Define to 1 if you have a functional curl library.]) | |
221 AC_SUBST(LIBCURL_CPPFLAGS) | |
222 AC_SUBST(LIBCURL) | |
223 | |
224 for _libcurl_feature in $_libcurl_features ; do | |
225 AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_feature_$_libcurl_feature),[1]) | |
226 eval AS_TR_SH(libcurl_feature_$_libcurl_feature)=yes | |
227 done | |
228 | |
229 if test "x$_libcurl_protocols" = "x" ; then | |
230 | |
231 # We don't have --protocols, so just assume that all | |
232 # protocols are available | |
233 _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT" | |
234 | |
235 if test x$libcurl_feature_SSL = xyes ; then | |
236 _libcurl_protocols="$_libcurl_protocols HTTPS" | |
237 | |
238 # FTPS wasn't standards-compliant until version | |
239 # 7.11.0 | |
240 if test $_libcurl_version -ge 461568; then | |
241 _libcurl_protocols="$_libcurl_protocols FTPS" | |
242 fi | |
243 fi | |
244 fi | |
245 | |
246 for _libcurl_protocol in $_libcurl_protocols ; do | |
247 AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_protocol_$_libcurl_protocol),[1]) | |
248 eval AS_TR_SH(libcurl_protocol_$_libcurl_protocol)=yes | |
249 done | |
250 else | |
251 unset LIBCURL | |
252 unset LIBCURL_CPPFLAGS | |
253 fi | |
254 fi | |
255 | |
256 unset _libcurl_try_link | |
257 unset _libcurl_version_parse | |
258 unset _libcurl_config | |
259 unset _libcurl_feature | |
260 unset _libcurl_features | |
261 unset _libcurl_protocol | |
262 unset _libcurl_protocols | |
263 unset _libcurl_version | |
264 unset _libcurl_ldflags | |
265 fi | |
266 | |
267 if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then | |
268 # This is the IF-NO path | |
269 ifelse([$4],,:,[$4]) | |
270 else | |
271 # This is the IF-YES path | |
272 ifelse([$3],,:,[$3]) | |
273 fi | |
274 | |
275 unset _libcurl_with | |
276 ])dnl | |
277 | |
278 # ZLIB_CHECK_CONFIG ([DEFAULT-ACTION] [MINIMUM-VERSION], | |
279 # [ACTION-IF-YES], [ACTION-IF-NO]) | |
280 # | |
281 AC_DEFUN([ZLIB_CHECK_CONFIG], | |
282 [ | |
283 AC_ARG_WITH(zlib, | |
284 AC_HELP_STRING([--with-zlib=DIR],[look for zlib in DIR]), | |
285 [_zlib_with=$withval],[_zlib_with="no"]) | |
286 | |
287 ZLIB_ROOT="" | |
288 if test "$_zlib_with" != "no" | |
289 then | |
290 if test -f "$_zlib_with/include/zlib.h" | |
291 then | |
292 ZLIB_ROOT=$_zlib_with | |
293 fi | |
294 fi | |
295 | |
296 # Check if it's a working library | |
297 zlib_ok=no | |
298 if test "$ZLIB_ROOT" != "" | |
299 then | |
300 _cppflags=$CPPFLAGS | |
301 CPPFLAGS="$CPPFLAGS -I${ZLIB_ROOT}/include" | |
302 _ldflags=$LDFLAGS | |
303 LDFLAGS="$LFDLAGS -L${ZLIB_ROOT}/lib" | |
304 AC_LANG_SAVE | |
305 AC_LANG_C | |
306 AC_CHECK_LIB(z, inflateEnd, | |
307 [AC_CHECK_HEADER(zlib.h, zlib_ok=yes, zlib_ok=no)]) | |
308 AC_LANG_RESTORE | |
309 if test "$zlib_ok" != "yes" | |
310 then | |
311 # Backout and whinge | |
312 CPPFLAGS=$_cppflags | |
313 LDFLAGS=$_ldflags | |
314 AC_MSG_WARN("--with-zlib specified, but non functioning") | |
315 fi | |
316 | |
317 else | |
318 # Maybe it works "out of the box"? | |
319 AC_CHECK_LIB(z, inflateEnd, | |
320 [AC_CHECK_HEADER(zlib.h, zlib_ok=yes, zlib_ok=no)]) | |
321 fi | |
322 | |
323 if test "$zlib_ok" = "yes" | |
324 then | |
325 AC_DEFINE(HAVE_ZLIB, 1, | |
326 [Define to 1 if you have a functional libz.]) | |
327 if test "$ZLIB_ROOT" != "" | |
328 then | |
329 LIBZ="-L${ZLIB_ROOT}/lib -lz" | |
330 else | |
331 LIBZ=-lz | |
332 fi | |
333 AC_SUBST(LIBZ) | |
334 else | |
335 AC_MSG_WARN("No functioning zlib found") | |
336 fi | |
337 | |
338 # Not sure how many of these are needed, but it's belt-and-braces mode | |
339 AH_TEMPLATE([HAVE_ZLIB], [Define if zlib is installed]) | |
340 AM_CONDITIONAL(HAVE_ZLIB, test "$zlib_ok" = "yes") | |
341 ]) |