1.下载curl库源码 https://curl.haxx.se/download.html。
2.解压文件后,一般是用cygwin 执行./configure配置环境生成curl_config.h,然后修改一些宏定义,让curl库适应android环境配置。
下面附上修改后的curl_config.h源码。
curl_config.h
/* lib/curl_config.h. Generated from curl_config.h.in by configure. */
/* lib/curl_config.h.in. Generated from configure.ac by autoheader. */
/* when building libcurl itself */
/* #undef BUILDING_LIBCURL */
/* Location of default ca bundle */
/* #undef CURL_CA_BUNDLE */
/* Location of default ca path */
/* #undef CURL_CA_PATH */
/* to disable cookies support */
/* #undef CURL_DISABLE_COOKIES */
/* to disable cryptographic authentication */
/* #undef CURL_DISABLE_CRYPTO_AUTH */
/* to disable DICT */
/* #undef CURL_DISABLE_DICT */
/* to disable FILE */
/* #undef CURL_DISABLE_FILE */
/* to disable FTP */
#define CURL_DISABLE_FTP 1
/* to disable HTTP */
/* #undef CURL_DISABLE_HTTP */
/* to disable IMAP */
#define CURL_DISABLE_IMAP 1
/* to disable LDAP */
#define CURL_DISABLE_LDAP 1
/* to disable LDAPS */
#define CURL_DISABLE_LDAPS 1
/* to disable POP3 */
#define CURL_DISABLE_POP3 1
/* to disable proxies */
/* #undef CURL_DISABLE_PROXY */
/* to disable RTSP */
#define CURL_DISABLE_RTSP 1
/* to disable SMTP */
#define CURL_DISABLE_SMTP 1
/* to disable TELNET */
#define CURL_DISABLE_TELNET 1
/* to disable TFTP */
#define CURL_DISABLE_TFTP 1
/* to disable verbose strings */
/* #undef CURL_DISABLE_VERBOSE_STRINGS */
/* to make a symbol visible */
/* #undef CURL_EXTERN_SYMBOL */
/* to enable hidden symbols */
/* #undef CURL_HIDDEN_SYMBOLS */
/* W$ LDAP with non-W$ compiler */
/* #undef CURL_LDAP_HYBRID */
/* Use W$ LDAP implementation */
/* #undef CURL_LDAP_WIN */
/* when not building a shared library */
/* #undef CURL_STATICLIB */
/* your Entropy Gathering Daemon socket pathname */
/* #undef EGD_SOCKET */
/* Define if you want to enable IPv6 support */
/* #undef ENABLE_IPV6 */
/* Define to the type qualifier of arg 1 for getnameinfo. */
#define GETNAMEINFO_QUAL_ARG1 const
/* Define to the type of arg 1 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG1 struct sockaddr *
/* Define to the type of arg 2 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG2 socklen_t
/* Define to the type of args 4 and 6 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG46 size_t
/* Define to the type of arg 7 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG7 int
/* Specifies the number of arguments to getservbyport_r */
/* #undef GETSERVBYPORT_R_ARGS */
/* Specifies the size of the buffer to pass to getservbyport_r */
/* #undef GETSERVBYPORT_R_BUFSIZE */
/* Define to 1 if you have the alarm function. */
#define HAVE_ALARM 1
/* Define to 1 if you have the <alloca.h> header file. */
#define HAVE_ALLOCA_H 1
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
/* Define to 1 if you have the <arpa/tftp.h> header file. */
/* #undef HAVE_ARPA_TFTP_H */
/* Define to 1 if you have the <assert.h> header file. */
#define HAVE_ASSERT_H 1
/* Define to 1 if you have the basename function. */
#define HAVE_BASENAME 1
/* Define to 1 if bool is an available type. */
#define HAVE_BOOL_T 1
/* Define to 1 if you have the clock_gettime function and monotonic timer. */
#define HAVE_CLOCK_GETTIME_MONOTONIC 1
/* Define to 1 if you have the closesocket function. */
/* #undef HAVE_CLOSESOCKET */
/* Define to 1 if you have the CloseSocket camel case function. */
/* #undef HAVE_CLOSESOCKET_CAMEL */
/* Define to 1 if you have the connect function. */
#define HAVE_CONNECT 1
/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */
/* #undef HAVE_CRYPTO_CLEANUP_ALL_EX_DATA */
/* Define to 1 if you have the <crypto.h> header file. */
/* #undef HAVE_CRYPTO_H */
/* Define to 1 if you have the <des.h> header file. */
/* #undef HAVE_DES_H */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the `ENGINE_cleanup' function. */
/* #undef HAVE_ENGINE_CLEANUP */
/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */
/* #undef HAVE_ENGINE_LOAD_BUILTIN_ENGINES */
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define to 1 if you have the <err.h> header file. */
/* #undef HAVE_ERR_H */
/* Define to 1 if you have the fcntl function. */
#define HAVE_FCNTL 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have a working fcntl O_NONBLOCK function. */
#define HAVE_FCNTL_O_NONBLOCK 1
/* Define to 1 if you have the fdopen function. */
#define HAVE_FDOPEN 1
/* Define to 1 if you have the `fork' function. */
#define HAVE_FORK 1
/* Define to 1 if you have the freeaddrinfo function. */
#define HAVE_FREEADDRINFO 1
/* Define to 1 if you have the freeifaddrs function. */
/* #undef HAVE_FREEIFADDRS */
/* Define to 1 if you have the ftruncate function. */
#define HAVE_FTRUNCATE 1
/* Define to 1 if you have a working getaddrinfo function. */
#define HAVE_GETADDRINFO 1
/* Define to 1 if the getaddrinfo function is threadsafe. */
#define HAVE_GETADDRINFO_THREADSAFE 1
/* Define to 1 if you have the `geteuid' function. */
#define HAVE_GETEUID 1
/* Define to 1 if you have the gethostbyaddr function. */
#define HAVE_GETHOSTBYADDR 1
/* Define to 1 if you have the gethostbyaddr_r function. */
/* #undef HAVE_GETHOSTBYADDR_R */
/* gethostbyaddr_r() takes 5 args */
/* #undef HAVE_GETHOSTBYADDR_R_5 */
/* gethostbyaddr_r() takes 7 args */
/* #undef HAVE_GETHOSTBYADDR_R_7 */
/* gethostbyaddr_r() takes 8 args */
/* #undef HAVE_GETHOSTBYADDR_R_8 */
/* Define to 1 if you have the gethostbyname function. */
#define HAVE_GETHOSTBYNAME 1
/* Define to 1 if you have the gethostbyname_r function. */
#define HAVE_GETHOSTBYNAME_R 1
/* gethostbyname