# Checks for libraries
# check for libcurl
-PKG_CHECK_MODULES(CURL, libcurl)
+AC_ARG_ENABLE(curl,
+ AC_HELP_STRING([--enable-curl], [Enable downloading with curl
+ [[default=yes]] ]),
+ [want_curl="$enableval"], [want_curl="yes"])
+if test "x$want_curl" = "xyes"; then
+ PKG_CHECK_MODULES(CURL, libcurl)
+ AC_DEFINE(HAVE_CURL, 1, [Define if you want CURL support])
+fi
dnl **********
return package;
}
+#ifdef HAVE_CURL
#include <curl/curl.h>
+#endif
/**
* @brief Check the accessibility of repositories. It will try to access the repository to check if the respository is accessible throught current network status.
* @param opkg The opkg_t
repositories--;
err = opkg_download(opkg->conf, iter1->data, "/dev/null", NULL, NULL);
+#ifdef HAVE_CURL
if (!(err == CURLE_OK ||
err == CURLE_HTTP_RETURNED_ERROR ||
err == CURLE_FILE_COULDNT_READ_FILE ||
err == CURLE_REMOTE_FILE_NOT_FOUND ||
err == CURLE_TFTP_NOTFOUND
)) {
+#else
+ if (!(err == 0)) {
+#endif
ret++;
}
str_list_elt_deinit(iter1);
General Public License for more details.
*/
#include "config.h"
+#ifdef HAVE_CURL
#include <curl/curl.h>
+#endif
#ifdef HAVE_GPGME
#include <gpgme.h>
#endif
setenv("no_proxy", conf->no_proxy, 1);
}
+#ifdef HAVE_CURL
CURL *curl;
CURLcode res;
FILE * file = fopen (tmp_file_location, "w");
free(src_basec);
return -1;
}
+#else
+ {
+ int res;
+ char *wgetcmd;
+ char *wgetopts;
+ wgetopts = getenv("OPKG_WGETOPTS");
+ sprintf_alloc(&wgetcmd, "wget -q %s%s -O \"%s\" \"%s\"",
+ (conf->http_proxy || conf->ftp_proxy) ? "-Y on " : "",
+ (wgetopts!=NULL) ? wgetopts : "",
+ tmp_file_location, src);
+ opkg_message(conf, OPKG_INFO, "Executing: %s\n", wgetcmd);
+ res = xsystem(wgetcmd);
+ free(wgetcmd);
+ if (res) {
+ opkg_message(conf, OPKG_ERROR, "Failed to download %s, error %d\n", src, res);
+ free(tmp_file_location);
+ free(src_basec);
+ return res;
+ }
+ }
+#endif
err = file_move(tmp_file_location, dest_file_name);