]> granicus.if.org Git - curl/commitdiff
configure: add option disable --libcurl output
authorColin Hogben <curl@pythontech.co.uk>
Sun, 5 Feb 2012 17:44:22 +0000 (17:44 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 13 Feb 2012 21:36:10 +0000 (22:36 +0100)
configure.ac
src/tool_easysrc.c
src/tool_easysrc.h
src/tool_getparam.c
src/tool_help.c
src/tool_operate.c
src/tool_setopt.c
src/tool_setopt.h

index 7f74dca0aac67590d7e67e667cd35b1cdea032d0..6dfb4dd40d67a36e43e3ed6b52d75b3f1504214f 100644 (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
index 5c42e808ef4d0d511416dff08d8aef27943a67a5..ba1e78e0de853beae70db7af6387ae33ede4cc55 100644 (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 */
index 21b567458e5e1a62d29cd854d45ee5f16f5d480c..8e81d556719195c2d1cd4f2689248d72a5f23cfb 100644 (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 */
 
index c8519c201de3ce9a6d216a635e254f673836a41c..50450c25fba68312e5903892f4d3b87ffa42aa16 100644 (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;
index 77b6df5465bc93b05c9d44397da9f5d4afbf3953..222af4225b577b56ce4a3ed6f2f95cd9d4713654 100644 (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",
index f3fb8ef2a896459bfd484a449bf3042d30829e25..53da5f3b50380068e6516520bc20fbd31f215b73 100644 (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);
index b636aab38d3670b4b0207c0a7078d98c0e5806a2..6fc6047165d0478e2e849d03e7fcd856d0a25256 100644 (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 */
index d01c9eb24e3360490b65b2962a09ffad460c9a78..fcd60f8569a246ab0f750ac6145107a9018b3c37 100644 (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
  ***************************************************************************/
 #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 */