configure: add option disable --libcurl output

This commit is contained in:
Colin Hogben 2012-02-05 17:44:22 +00:00 committed by Daniel Stenberg
parent e71ac0c6fa
commit 2b26eb9857
8 changed files with 106 additions and 41 deletions

View File

@ -5,7 +5,7 @@
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
# Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
@ -155,6 +155,7 @@ curl_tls_srp_msg="no (--enable-tls-srp)"
curl_ipv6_msg="no (--enable-ipv6)"
curl_idn_msg="no (--with-libidn)"
curl_manual_msg="no (--enable-manual)"
curl_libcurl_msg="enabled (--disable-libcurl-option)"
curl_verbose_msg="enabled (--disable-verbose)"
curl_sspi_msg="no (--enable-sspi)"
curl_ldap_msg="no (--enable-ldap / --with-ldap-lib / --with-lber-lib)"
@ -651,6 +652,25 @@ AC_HELP_STRING([--disable-manual],[Disable built-in manual]),
dnl The actual use of the USE_MANUAL variable is done much later in this
dnl script to allow other actions to disable it as well.
dnl ************************************************************
dnl disable C code generation support
dnl
AC_MSG_CHECKING([whether to enable generation of C code])
AC_ARG_ENABLE(libcurl_option,
AC_HELP_STRING([--enable-libcurl-option],[Enable --libcurl C code generation support])
AC_HELP_STRING([--disable-libcurl-option],[Disable --libcurl C code generation support]),
[ case "$enableval" in
no)
AC_MSG_RESULT(no)
AC_DEFINE(CURL_DISABLE_LIBCURL_OPTION, 1, [to disable --libcurl C code generation option])
curl_libcurl_msg="no"
;;
*) AC_MSG_RESULT(yes)
;;
esac ],
AC_MSG_RESULT(yes)
)
dnl **********************************************************************
dnl Checks for libraries.
dnl **********************************************************************
@ -3306,31 +3326,32 @@ CURL_GENERATE_CONFIGUREHELP_PM
AC_MSG_NOTICE([Configured to build curl/libcurl:
curl version: ${CURLVERSION}
Host setup: ${host}
Install prefix: ${prefix}
Compiler: ${CC}
SSL support: ${curl_ssl_msg}
SSH support: ${curl_ssh_msg}
zlib support: ${curl_zlib_msg}
krb4 support: ${curl_krb4_msg}
GSSAPI support: ${curl_gss_msg}
SPNEGO support: ${curl_spnego_msg}
TLS-SRP support: ${curl_tls_srp_msg}
resolver: ${curl_res_msg}
ipv6 support: ${curl_ipv6_msg}
IDN support: ${curl_idn_msg}
Build libcurl: Shared=${enable_shared}, Static=${enable_static}
Built-in manual: ${curl_manual_msg}
Verbose errors: ${curl_verbose_msg}
SSPI support: ${curl_sspi_msg}
ca cert bundle: ${ca}
ca cert path: ${capath}
LDAP support: ${curl_ldap_msg}
LDAPS support: ${curl_ldaps_msg}
RTSP support: ${curl_rtsp_msg}
RTMP support: ${curl_rtmp_msg}
Protocols: ${SUPPORT_PROTOCOLS}
curl version: ${CURLVERSION}
Host setup: ${host}
Install prefix: ${prefix}
Compiler: ${CC}
SSL support: ${curl_ssl_msg}
SSH support: ${curl_ssh_msg}
zlib support: ${curl_zlib_msg}
krb4 support: ${curl_krb4_msg}
GSSAPI support: ${curl_gss_msg}
SPNEGO support: ${curl_spnego_msg}
TLS-SRP support: ${curl_tls_srp_msg}
resolver: ${curl_res_msg}
ipv6 support: ${curl_ipv6_msg}
IDN support: ${curl_idn_msg}
Build libcurl: Shared=${enable_shared}, Static=${enable_static}
Built-in manual: ${curl_manual_msg}
--libcurl option: ${curl_libcurl_msg}
Verbose errors: ${curl_verbose_msg}
SSPI support: ${curl_sspi_msg}
ca cert bundle: ${ca}
ca cert path: ${capath}
LDAP support: ${curl_ldap_msg}
LDAPS support: ${curl_ldaps_msg}
RTSP support: ${curl_rtsp_msg}
RTMP support: ${curl_rtmp_msg}
Protocols: ${SUPPORT_PROTOCOLS}
])
if test "x$soname_bump" = "xyes"; then

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -23,6 +23,8 @@
#include <curl/curl.h>
#ifndef CURL_DISABLE_LIBCURL_OPTION
#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
@ -110,3 +112,4 @@ void dumpeasysrc(struct Configurable *config)
easysrc = NULL;
}
#endif /* CURL_DISABLE_LIBCURL_OPTION */

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -22,6 +22,7 @@
*
***************************************************************************/
#include "setup.h"
#ifndef CURL_DISABLE_LIBCURL_OPTION
/* global variable declarations, for easy-interface source code generation */
@ -30,5 +31,7 @@ extern struct curl_slist *easysrc_remarks;
void dumpeasysrc(struct Configurable *config);
#endif /* CURL_DISABLE_LIBCIRL_CMD */
#endif /* HEADER_CURL_TOOL_EASYSRC_H */

View File

@ -739,8 +739,14 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
config->ftp_ssl_ccc_mode = ftpcccmethod(config, nextarg);
break;
case 'z': /* --libcurl */
#ifdef CURL_DISABLE_LIBCURL_OPTION
warnf(config,
"--libcurl option was disabled at build-time!\n");
return PARAM_OPTION_UNKNOWN;
#else
GetStr(&config->libcurl, nextarg);
break;
#endif
case '#': /* --raw */
config->raw = toggle;
break;

View File

@ -110,7 +110,9 @@ static const char *const helptext[] = {
" --key KEY Private key file name (SSL/SSH)",
" --key-type TYPE Private key file type (DER/PEM/ENG) (SSL)",
" --krb LEVEL Enable Kerberos with specified security level (F)",
#ifndef CURL_DISABLE_LIBCURL_OPTION
" --libcurl FILE Dump libcurl equivalent code of this command line",
#endif
" --limit-rate RATE Limit transfer speed to this rate",
" -l, --list-only List only names of an FTP directory (F)",
" --local-port RANGE Force use of these local port numbers",

View File

@ -354,6 +354,7 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
}
}
#ifndef CURL_DISABLE_LIBCURL_OPTION
/* This is the first entry added to easysrc and it initializes the slist */
easysrc = curl_slist_append(easysrc, "CURL *hnd = curl_easy_init();");
if(!easysrc) {
@ -361,6 +362,7 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
res = CURLE_OUT_OF_MEMORY;
goto quit_curl;
}
#endif
if(config->list_engines) {
struct curl_slist *engines = NULL;
@ -1246,10 +1248,12 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
retry_sleep = retry_sleep_default; /* ms */
retrystart = tvnow();
#ifndef CURL_DISABLE_LIBCURL_OPTION
if(!curl_slist_append(easysrc, "ret = curl_easy_perform(hnd);")) {
res = CURLE_OUT_OF_MEMORY;
goto show_error;
}
#endif
for(;;) {
res = curl_easy_perform(curl);
@ -1572,8 +1576,10 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
curl_easy_cleanup(curl);
config->easy = curl = NULL;
}
#ifndef CURL_DISABLE_LIBCURL_OPTION
if(easysrc)
curl_slist_append(easysrc, "curl_easy_cleanup(hnd);");
#endif
/* Close function-local opened file descriptors */
@ -1585,10 +1591,12 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
if(config->trace_fopened && config->trace_stream)
fclose(config->trace_stream);
#ifndef CURL_DISABLE_LIBCURL_OPTION
/* Dump the libcurl code if previously enabled.
NOTE: that this function relies on config->errors amongst other things
so not everything can be closed and cleaned before this is called */
dumpeasysrc(config);
#endif
if(config->errors_fopened && config->errors)
fclose(config->errors);

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -21,6 +21,8 @@
***************************************************************************/
#include "setup.h"
#ifndef CURL_DISABLE_LIBCURL_OPTION
#include <curl/curl.h>
#define ENABLE_CURLX_PRINTF
@ -123,3 +125,4 @@ CURLcode tool_setopt(CURL *curl, bool str, struct Configurable *config,
return ret;
}
#endif /* CURL_DISABLE_LIBCURL_OPTION */

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -23,28 +23,47 @@
***************************************************************************/
#include "setup.h"
CURLcode tool_setopt(CURL *curl, bool str, struct Configurable *config,
const char *name, CURLoption tag, ...);
/*
* Macros used in operate()
*/
#define my_setopt(x,y,z) do { \
res = tool_setopt(x, FALSE, config, #y, y, z); \
#define SETOPT_CHECK(v) do { \
res = (v); \
if(res) \
goto show_error; \
} WHILE_FALSE
#define my_setopt_str(x,y,z) do { \
res = tool_setopt(x, TRUE, config, #y, y, z); \
if(res) \
goto show_error; \
} WHILE_FALSE
#ifndef CURL_DISABLE_LIBCURL_OPTION
/* Intercept setopt calls for --libcurl */
CURLcode tool_setopt(CURL *curl, bool str, struct Configurable *config,
const char *name, CURLoption tag, ...);
#define my_setopt(x,y,z) \
SETOPT_CHECK(tool_setopt(x, FALSE, config, #y, y, z))
#define my_setopt_str(x,y,z) \
SETOPT_CHECK(tool_setopt(x, TRUE, config, #y, y, z))
#define res_setopt(x,y,z) tool_setopt(x, FALSE, config, #y, y, z)
#define res_setopt_str(x,y,z) tool_setopt(x, TRUE, config, #y, y, z)
#endif /* HEADER_CURL_TOOL_SETOPT_H */
#else
/* No --libcurl, so pass options directly to library */
#define my_setopt(x,y,z) \
SETOPT_CHECK(curl_easy_setopt(x, y, z))
#define my_setopt_str(x,y,z) \
SETOPT_CHECK(curl_easy_setopt(x, y, z))
#define res_setopt(x,y,z) curl_easy_setopt(x,y,z)
#define res_setopt_str(x,y,z) curl_easy_setopt(x,y,z)
#endif /* CURL_DISABLE_LIBCURL_OPTION */
#endif /* HEADER_CURL_TOOL_SETOPT_H */