下载libcurl 源码:http://curl.haxx.se/download.html
curl 7.41.0
android NDK r9c
解压 到 android-ndk-r9c/samples/curl/jni
复制结尾内容生成 curl_config.h 文件到 android-ndk-r9c\samples\curl\jni\lib下
curl 自带 android.mk 在目录packages/android/Android.mk
拷贝 Android.mk 到 目录android-ndk-r9c/samples/curl/jni下
修改后为:
LOCAL_PATH:= $(call my-dir)
common_CFLAGS := -Wpointer-arith -Wwrite-strings -Wunused -Winline \
-Wnested-externs -Wmissing-declarations -Wmissing-prototypes \
-Wno-long-long -Wfloat-equal -Wno-multichar -Wsign-compare \
-Wno-format-nonliteral -Wendif-labels -Wstrict-prototypes \
-Wdeclaration-after-statement -Wno-system-headers -DHAVE_CONFIG_H
#########################
# Build the libcurl library
include $(CLEAR_VARS)
include $(LOCAL_PATH)/lib/Makefile.inc
CURL_HEADERS := \
curlbuild.h \
curl.h \
curlrules.h \
curlver.h \
easy.h \
mprintf.h \
multi.h \
stdcheaders.h \
typecheck-gcc.h
LOCAL_SRC_FILES := $(addprefix lib/,$(CSOURCES))
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include/
LOCAL_C_INCLUDES += $(LOCAL_PATH)/lib/
LOCAL_CFLAGS += $(common_CFLAGS)
LOCAL_COPY_HEADERS_TO := $(LOCAL_PATH)/libcurl/curl
LOCAL_COPY_HEADERS := $(addprefix include/curl/,$(CURL_HEADERS))
LOCAL_MODULE:= libcurl
LOCAL_MODULE_TAGS := optional
# Copy the licence to a place where Android will find it.
# Actually, this doesn't quite work because the build system searches
# for NOTICE files before it gets to this point, so it will only be seen
# on subsequent builds.
include $(BUILD_SHARED_LIBRARY)
在android-ndk-r9c/samples/curl/jni 下 控制台运行ndk-build
生成libcurl.so 头文件
复制出android-ndk-r9c\samples\curl\jni\include\curl 目录下头文件 使用
/* 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 <err